From python-checkins at python.org Wed Jun 1 01:01:36 2016 From: python-checkins at python.org (zach.ware) Date: Wed, 01 Jun 2016 05:01:36 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Fix_typo?= Message-ID: <20160601050136.28452.38587.525035A7@psf.io> https://hg.python.org/cpython/rev/a96822adeaac changeset: 101579:a96822adeaac branch: 3.5 parent: 101572:fd0ac7ba091e user: Zachary Ware date: Wed Jun 01 00:01:10 2016 -0500 summary: Fix typo files: Doc/library/asyncio-task.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -620,7 +620,7 @@ Unlike other functions from the module, :func:`run_coroutine_threadsafe` requires the *loop* argument to - be passed explicitely. + be passed explicitly. .. versionadded:: 3.5.1 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 1 01:01:39 2016 From: python-checkins at python.org (zach.ware) Date: Wed, 01 Jun 2016 05:01:39 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_with_3=2E5?= Message-ID: <20160601050136.67212.61673.944B8C09@psf.io> https://hg.python.org/cpython/rev/b75b4fdd62f8 changeset: 101580:b75b4fdd62f8 parent: 101576:20bd4c23cfe4 parent: 101579:a96822adeaac user: Zachary Ware date: Wed Jun 01 00:01:21 2016 -0500 summary: Merge with 3.5 files: Doc/library/asyncio-task.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -620,7 +620,7 @@ Unlike other functions from the module, :func:`run_coroutine_threadsafe` requires the *loop* argument to - be passed explicitely. + be passed explicitly. .. versionadded:: 3.5.1 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 1 04:29:39 2016 From: python-checkins at python.org (martin.panter) Date: Wed, 01 Jun 2016 08:29:39 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI1NTcw?= =?utf-8?q?=3A_Add_example_of_customizing_User-Agent_via_add=5Fheader=28?= =?utf-8?q?=29?= Message-ID: <20160601082936.67212.54040.110BC654@psf.io> https://hg.python.org/cpython/rev/320b9a65ac07 changeset: 101581:320b9a65ac07 branch: 3.5 parent: 101579:a96822adeaac user: Martin Panter date: Wed Jun 01 08:10:50 2016 +0000 summary: Issue #25570: Add example of customizing User-Agent via add_header() files: Doc/library/urllib.request.rst | 7 ++++++- 1 files changed, 6 insertions(+), 1 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 @@ -189,7 +189,7 @@ *headers* should be a dictionary, and will be treated as if :meth:`add_header` was called with each key and value as arguments. - This is often used to "spoof" the ``User-Agent`` header, which is + This is often used to "spoof" the ``User-Agent`` header value, which is used by a browser to identify itself -- some HTTP servers only allow requests coming from common browsers as opposed to scripts. For example, Mozilla Firefox may identify itself as ``"Mozilla/5.0 @@ -1111,6 +1111,9 @@ Examples -------- +In addition to the examples below, more examples are given in +:ref:`urllib-howto`. + This example gets the python.org main page and displays the first 300 bytes of it. :: @@ -1220,6 +1223,8 @@ import urllib.request req = urllib.request.Request('http://www.example.com/') req.add_header('Referer', 'http://www.python.org/') + # Customize the default User-Agent header value: + req.add_header('User-Agent', 'urllib-example/0.1 (Contact: . . .)') r = urllib.request.urlopen(req) :class:`OpenerDirector` automatically adds a :mailheader:`User-Agent` header to -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 1 04:29:42 2016 From: python-checkins at python.org (martin.panter) Date: Wed, 01 Jun 2016 08:29:42 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2325570=3A_Merge_add=5Fheader=28=29_example_from_?= =?utf-8?b?My41?= Message-ID: <20160601082941.79829.15957.ABDAB56A@psf.io> https://hg.python.org/cpython/rev/75dc64c8c22b changeset: 101582:75dc64c8c22b parent: 101580:b75b4fdd62f8 parent: 101581:320b9a65ac07 user: Martin Panter date: Wed Jun 01 08:17:27 2016 +0000 summary: Issue #25570: Merge add_header() example from 3.5 files: Doc/library/urllib.request.rst | 7 ++++++- 1 files changed, 6 insertions(+), 1 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 @@ -189,7 +189,7 @@ *headers* should be a dictionary, and will be treated as if :meth:`add_header` was called with each key and value as arguments. - This is often used to "spoof" the ``User-Agent`` header, which is + This is often used to "spoof" the ``User-Agent`` header value, which is used by a browser to identify itself -- some HTTP servers only allow requests coming from common browsers as opposed to scripts. For example, Mozilla Firefox may identify itself as ``"Mozilla/5.0 @@ -1111,6 +1111,9 @@ Examples -------- +In addition to the examples below, more examples are given in +:ref:`urllib-howto`. + This example gets the python.org main page and displays the first 300 bytes of it. :: @@ -1220,6 +1223,8 @@ import urllib.request req = urllib.request.Request('http://www.example.com/') req.add_header('Referer', 'http://www.python.org/') + # Customize the default User-Agent header value: + req.add_header('User-Agent', 'urllib-example/0.1 (Contact: . . .)') r = urllib.request.urlopen(req) :class:`OpenerDirector` automatically adds a :mailheader:`User-Agent` header to -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 1 04:29:43 2016 From: python-checkins at python.org (martin.panter) Date: Wed, 01 Jun 2016 08:29:43 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI1NTcw?= =?utf-8?q?=3A_Add_example_of_customizing_User-Agent_via_add=5Fheader=28?= =?utf-8?q?=29?= Message-ID: <20160601082942.67233.29070.CD95F47D@psf.io> https://hg.python.org/cpython/rev/3aa49900869b changeset: 101583:3aa49900869b branch: 2.7 parent: 101578:55e6b4fd0e04 user: Martin Panter date: Wed Jun 01 08:20:22 2016 +0000 summary: Issue #25570: Add example of customizing User-Agent via add_header() files: Doc/howto/urllib2.rst | 2 ++ Doc/library/urllib2.rst | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/Doc/howto/urllib2.rst b/Doc/howto/urllib2.rst --- a/Doc/howto/urllib2.rst +++ b/Doc/howto/urllib2.rst @@ -1,3 +1,5 @@ +.. _urllib-howto: + ************************************************ HOWTO Fetch Internet Resources Using urllib2 ************************************************ diff --git a/Doc/library/urllib2.rst b/Doc/library/urllib2.rst --- a/Doc/library/urllib2.rst +++ b/Doc/library/urllib2.rst @@ -167,7 +167,7 @@ *headers* should be a dictionary, and will be treated as if :meth:`add_header` was called with each key and value as arguments. This is often used to "spoof" - the ``User-Agent`` header, which is used by a browser to identify itself -- + the ``User-Agent`` header value, which is used by a browser to identify itself -- some HTTP servers only allow requests coming from common browsers as opposed to scripts. For example, Mozilla Firefox may identify itself as ``"Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 Firefox/2.0.0.11"``, while :mod:`urllib2`'s @@ -950,6 +950,9 @@ Examples -------- +In addition to the examples below, more examples are given in +:ref:`urllib-howto`. + This example gets the python.org main page and displays the first 100 bytes of it:: @@ -1016,6 +1019,8 @@ import urllib2 req = urllib2.Request('http://www.example.com/') req.add_header('Referer', 'http://www.python.org/') + # Customize the default User-Agent header value: + req.add_header('User-Agent', 'urllib-example/0.1 (Contact: . . .)') r = urllib2.urlopen(req) :class:`OpenerDirector` automatically adds a :mailheader:`User-Agent` header to -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Wed Jun 1 04:50:24 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 01 Jun 2016 08:50:24 +0000 Subject: [Python-checkins] Daily reference leaks (b75b4fdd62f8): sum=64 Message-ID: <20160601085009.17384.1738.9890D269@psf.io> results for b75b4fdd62f8 on branch "default" -------------------------------------------- test_collections leaked [4, 0, -4] memory blocks, sum=0 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [38, 0, 0] references, sum=38 test_multiprocessing_forkserver leaked [21, 0, 0] memory blocks, sum=21 test_multiprocessing_forkserver leaked [2, 0, 0] file descriptors, sum=2 test_multiprocessing_spawn leaked [1, 0, -2] memory blocks, sum=-1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/refloghF1DwT', '--timeout', '7200'] From lp_benchmark_robot at intel.com Wed Jun 1 06:56:45 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 1 Jun 2016 11:56:45 +0100 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python Default 2016-06-01 Message-ID: Results for project Python default, build date 2016-06-01 02:03:18 +0000 commit: 20bd4c23cfe4 previous commit: 0945b9729734 revision date: 2016-06-01 00:17:58 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.21% 0.04% 7.52% 16.98% :-| pybench 0.38% -0.06% 1.53% 7.82% :-( regex_v8 2.71% 0.04% -2.50% 3.96% :-| nbody 0.12% 0.10% 0.70% 7.97% :-| json_dump_v2 0.36% -0.34% -0.56% 11.67% :-| normal_startup 0.64% -0.01% -0.25% 5.99% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-default-2016-06-01/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Wed Jun 1 07:02:46 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 1 Jun 2016 12:02:46 +0100 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2016-06-01 Message-ID: <60f746dc-2664-4fc9-ab4f-27365d97df66@irsmsx103.ger.corp.intel.com> No new revisions. Here are the previous results: Results for project Python 2.7, build date 2016-06-01 02:47:06 +0000 commit: 824d32436198 previous commit: c817d1b5b937 revision date: 2016-05-30 04:04:50 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.16% 0.43% 4.74% 7.57% :-) pybench 0.19% -0.04% 5.88% 4.70% :-( regex_v8 0.87% -0.05% -2.19% 11.23% :-) nbody 0.15% -0.29% 9.09% 2.09% :-| json_dump_v2 0.52% 0.70% 1.79% 12.84% :-( normal_startup 1.96% 0.72% -4.93% 1.58% :-) ssbench 0.21% -0.13% 2.23% 1.69% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-2-7-2016-06-01/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Wed Jun 1 12:26:26 2016 From: python-checkins at python.org (berker.peksag) Date: Wed, 01 Jun 2016 16:26:26 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5?= Message-ID: <20160601162615.7750.35333.4F2C6563@psf.io> https://hg.python.org/cpython/rev/8041366187dd changeset: 101585:8041366187dd parent: 101582:75dc64c8c22b parent: 101584:89825636d368 user: Berker Peksag date: Wed Jun 01 09:36:40 2016 -0700 summary: Merge from 3.5 files: Doc/tutorial/classes.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -120,7 +120,7 @@ If a name is declared global, then all references and assignments go directly to the middle scope containing the module's global names. To rebind variables found outside of the innermost scope, the :keyword:`nonlocal` statement can be -used; if not declared nonlocal, those variable are read-only (an attempt to +used; if not declared nonlocal, those variables are read-only (an attempt to write to such a variable will simply create a *new* local variable in the innermost scope, leaving the identically named outer variable unchanged). -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 1 12:26:45 2016 From: python-checkins at python.org (berker.peksag) Date: Wed, 01 Jun 2016 16:26:45 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Fix_typo_in_Py?= =?utf-8?q?thon_tutorial?= Message-ID: <20160601162615.114476.42414.5F293C0F@psf.io> https://hg.python.org/cpython/rev/89825636d368 changeset: 101584:89825636d368 branch: 3.5 parent: 101581:320b9a65ac07 user: Berker Peksag date: Wed Jun 01 09:36:14 2016 -0700 summary: Fix typo in Python tutorial files: Doc/tutorial/classes.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -120,7 +120,7 @@ If a name is declared global, then all references and assignments go directly to the middle scope containing the module's global names. To rebind variables found outside of the innermost scope, the :keyword:`nonlocal` statement can be -used; if not declared nonlocal, those variable are read-only (an attempt to +used; if not declared nonlocal, those variables are read-only (an attempt to write to such a variable will simply create a *new* local variable in the innermost scope, leaving the identically named outer variable unchanged). -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 1 12:42:49 2016 From: python-checkins at python.org (berker.peksag) Date: Wed, 01 Jun 2016 16:42:49 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MTc0?= =?utf-8?q?=3A_Update_IPython_URL_in_tutorial?= Message-ID: <20160601164242.17637.33950.7D636D5F@psf.io> https://hg.python.org/cpython/rev/92fd6935e882 changeset: 101586:92fd6935e882 branch: 3.5 parent: 101584:89825636d368 user: Berker Peksag date: Wed Jun 01 09:52:35 2016 -0700 summary: Issue #27174: Update IPython URL in tutorial files: Doc/tutorial/interactive.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/tutorial/interactive.rst b/Doc/tutorial/interactive.rst --- a/Doc/tutorial/interactive.rst +++ b/Doc/tutorial/interactive.rst @@ -50,5 +50,5 @@ .. _GNU Readline: https://tiswww.case.edu/php/chet/readline/rltop.html -.. _IPython: http://ipython.scipy.org/ +.. _IPython: https://ipython.org/ .. _bpython: http://www.bpython-interpreter.org/ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 1 12:42:49 2016 From: python-checkins at python.org (berker.peksag) Date: Wed, 01 Jun 2016 16:42:49 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327174=3A_Merge_from_3=2E5?= Message-ID: <20160601164242.7725.89053.2E3A3C62@psf.io> https://hg.python.org/cpython/rev/87d76611470c changeset: 101587:87d76611470c parent: 101585:8041366187dd parent: 101586:92fd6935e882 user: Berker Peksag date: Wed Jun 01 09:53:05 2016 -0700 summary: Issue #27174: Merge from 3.5 files: Doc/tutorial/interactive.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/tutorial/interactive.rst b/Doc/tutorial/interactive.rst --- a/Doc/tutorial/interactive.rst +++ b/Doc/tutorial/interactive.rst @@ -50,5 +50,5 @@ .. _GNU Readline: https://tiswww.case.edu/php/chet/readline/rltop.html -.. _IPython: http://ipython.scipy.org/ +.. _IPython: https://ipython.org/ .. _bpython: http://www.bpython-interpreter.org/ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 1 16:46:03 2016 From: python-checkins at python.org (berker.peksag) Date: Wed, 01 Jun 2016 20:46:03 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5?= Message-ID: <20160601204435.27159.43660.7E55AA0E@psf.io> https://hg.python.org/cpython/rev/fe0c4f258458 changeset: 101589:fe0c4f258458 parent: 101587:87d76611470c parent: 101588:dbe69f54b09c user: Berker Peksag date: Wed Jun 01 13:55:00 2016 -0700 summary: Merge from 3.5 files: Doc/faq/programming.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst --- a/Doc/faq/programming.rst +++ b/Doc/faq/programming.rst @@ -1313,7 +1313,7 @@ The technique, attributed to Randal Schwartz of the Perl community, sorts the elements of a list by a metric which maps each element to its "sort value". In -Python, use the ``key`` argument for the :func:`sort()` function:: +Python, use the ``key`` argument for the :meth:`list.sort` method:: Isorted = L[:] Isorted.sort(key=lambda s: int(s[10:15])) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 1 16:46:03 2016 From: python-checkins at python.org (berker.peksag) Date: Wed, 01 Jun 2016 20:46:03 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Fix_link_in_pr?= =?utf-8?q?ogramming_FAQ=2E?= Message-ID: <20160601204435.7551.62665.58541892@psf.io> https://hg.python.org/cpython/rev/dbe69f54b09c changeset: 101588:dbe69f54b09c branch: 3.5 parent: 101586:92fd6935e882 user: Berker Peksag date: Wed Jun 01 13:54:33 2016 -0700 summary: Fix link in programming FAQ. The example actually uses the sort method of list object. files: Doc/faq/programming.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst --- a/Doc/faq/programming.rst +++ b/Doc/faq/programming.rst @@ -1312,7 +1312,7 @@ The technique, attributed to Randal Schwartz of the Perl community, sorts the elements of a list by a metric which maps each element to its "sort value". In -Python, use the ``key`` argument for the :func:`sort()` function:: +Python, use the ``key`` argument for the :meth:`list.sort` method:: Isorted = L[:] Isorted.sort(key=lambda s: int(s[10:15])) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 1 17:28:08 2016 From: python-checkins at python.org (berker.peksag) Date: Wed, 01 Jun 2016 21:28:08 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327178=3A_Fix_mark?= =?utf-8?q?up_in_tutorial?= Message-ID: <20160601212758.7725.52894.AA42C9DE@psf.io> https://hg.python.org/cpython/rev/a2ffc966363e changeset: 101590:a2ffc966363e user: Berker Peksag date: Wed Jun 01 14:38:18 2016 -0700 summary: Issue #27178: Fix markup in tutorial Patch by Nathan Harold. files: Doc/tutorial/interpreter.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/tutorial/interpreter.rst b/Doc/tutorial/interpreter.rst --- a/Doc/tutorial/interpreter.rst +++ b/Doc/tutorial/interpreter.rst @@ -1,4 +1,4 @@ -3.6.. _tut-using: +.. _tut-using: **************************** Using the Python Interpreter -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 1 21:02:44 2016 From: python-checkins at python.org (guido.van.rossum) Date: Thu, 02 Jun 2016 01:02:44 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Add_NewType=28=29_to_PEP_484?= =?utf-8?q?=2E?= Message-ID: <20160602010243.114663.11675.90846959@psf.io> https://hg.python.org/peps/rev/64f152d66b72 changeset: 6345:64f152d66b72 user: Guido van Rossum date: Wed Jun 01 18:02:33 2016 -0700 summary: Add NewType() to PEP 484. files: pep-0484.txt | 65 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 65 insertions(+), 0 deletions(-) diff --git a/pep-0484.txt b/pep-0484.txt --- a/pep-0484.txt +++ b/pep-0484.txt @@ -1173,6 +1173,68 @@ in expressions, while type comments only apply to assignments. +NewType helper function +----------------------- + +There are also situations where a programmer might want to avoid logical +errors by creating simple classes. For example:: + + class UserId(int): + pass + + get_by_user_id(user_id: UserId): + ... + +However, this approach introduces a runtime overhead. To avoid this, +``typing.py`` provides a helper function ``NewType`` that creates +simple unique types with almost zero runtime overhead. For a static type +checker ``Derived = NewType('Derived', Base)`` is roughly equivalent +to a definition:: + +class Derived(Base): + def __init__(self, _x: Base) -> None: + ... + +While at runtime, ``NewType('Derived', Base)`` returns a dummy function +that simply returns its argument. Type checkers require explicit casts +from ``int`` where ``UserId`` is expected, while implicitly casting +from ``UserId`` where ``int`` is expected. Examples:: + + UserId = NewType('UserId', int) + + def name_by_id(user_id: UserId) -> str: + ... + + UserId('user') # Fails type check + + name_by_id(42) # Fails type check + name_by_id(UserId(42)) # OK + + num = UserId(5) + 1 # type: int + +``NewType`` accepts only one argument that shoud be a proper class, +i.e., not a type construct like ``Union``, etc. The function returned +by ``NewType`` accepts only one argument; this is equivalent to supporting +only one constructor accepting an instance of the base class (see above). +Example:: + + class PacketId: + def __init__(self, major: int, minor: int) -> None: + self._major = major + self._minor = minor + + TcpPacketId = NewType('TcpPacketId', PacketId) + + packet = PacketId(100, 100) + tcp_packet = TcpPacketId(packet) # OK + + tcp_packet = TcpPacketId(127, 0) # Fails in type checker and at runtime + +Both ``isinstance`` and ``issubclass``, as well as subclassing will fail +for ``NewType('Derived', Base)`` since function objects don't support +these operations. + + Stub Files ========== @@ -1562,6 +1624,9 @@ This is useful to declare the types of the fields of a named tuple type. +* NewType, used to create unique types with little runtime overhead + ``UserId = NewType('UserId', int)`` + * cast(), described earlier * @no_type_check, a decorator to disable type checking per class or -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Wed Jun 1 21:16:25 2016 From: python-checkins at python.org (berker.peksag) Date: Thu, 02 Jun 2016 01:16:25 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2312243=3A_Merge_from_3=2E5?= Message-ID: <20160602011624.67341.60996.67C8A68D@psf.io> https://hg.python.org/cpython/rev/1bd3daae351d changeset: 101592:1bd3daae351d parent: 101590:a2ffc966363e parent: 101591:c13198a2007e user: Berker Peksag date: Wed Jun 01 18:26:50 2016 -0700 summary: Issue #12243: Merge from 3.5 files: Doc/library/getpass.rst | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/Doc/library/getpass.rst b/Doc/library/getpass.rst --- a/Doc/library/getpass.rst +++ b/Doc/library/getpass.rst @@ -23,8 +23,6 @@ a warning message to *stream* and reading from ``sys.stdin`` and issuing a :exc:`GetPassWarning`. - Availability: Macintosh, Unix, Windows. - .. note:: If you call getpass from within IDLE, the input may be done in the terminal you launched IDLE from rather than the idle window itself. @@ -36,7 +34,7 @@ .. function:: getuser() - Return the "login name" of the user. Availability: Unix, Windows. + Return the "login name" of the user. This function checks the environment variables :envvar:`LOGNAME`, :envvar:`USER`, :envvar:`LNAME` and :envvar:`USERNAME`, in order, and returns -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 1 21:17:20 2016 From: python-checkins at python.org (berker.peksag) Date: Thu, 02 Jun 2016 01:17:20 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzEyMjQz?= =?utf-8?q?=3A_Remove_redundant_availability_notes_from_getpass_docs?= Message-ID: <20160602011624.1195.48922.D3169A8B@psf.io> https://hg.python.org/cpython/rev/c13198a2007e changeset: 101591:c13198a2007e branch: 3.5 parent: 101588:dbe69f54b09c user: Berker Peksag date: Wed Jun 01 18:26:18 2016 -0700 summary: Issue #12243: Remove redundant availability notes from getpass docs Patch by Bryce Verdier. files: Doc/library/getpass.rst | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/Doc/library/getpass.rst b/Doc/library/getpass.rst --- a/Doc/library/getpass.rst +++ b/Doc/library/getpass.rst @@ -23,8 +23,6 @@ a warning message to *stream* and reading from ``sys.stdin`` and issuing a :exc:`GetPassWarning`. - Availability: Macintosh, Unix, Windows. - .. note:: If you call getpass from within IDLE, the input may be done in the terminal you launched IDLE from rather than the idle window itself. @@ -36,7 +34,7 @@ .. function:: getuser() - Return the "login name" of the user. Availability: Unix, Windows. + Return the "login name" of the user. This function checks the environment variables :envvar:`LOGNAME`, :envvar:`USER`, :envvar:`LNAME` and :envvar:`USERNAME`, in order, and returns -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 1 21:23:15 2016 From: python-checkins at python.org (berker.peksag) Date: Thu, 02 Jun 2016 01:23:15 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyMjQz?= =?utf-8?q?=3A_Remove_redundant_availability_notes_from_getpass_docs?= Message-ID: <20160602012313.4858.70966.928A1D6D@psf.io> https://hg.python.org/cpython/rev/98870f27d2ed changeset: 101593:98870f27d2ed branch: 2.7 parent: 101583:3aa49900869b user: Berker Peksag date: Wed Jun 01 18:32:42 2016 -0700 summary: Issue #12243: Remove redundant availability notes from getpass docs I wonder why I keep forgetting 2.7 :P Patch by Bryce Verdier. files: Doc/library/getpass.rst | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/Doc/library/getpass.rst b/Doc/library/getpass.rst --- a/Doc/library/getpass.rst +++ b/Doc/library/getpass.rst @@ -22,8 +22,6 @@ a warning message to *stream* and reading from ``sys.stdin`` and issuing a :exc:`GetPassWarning`. - Availability: Macintosh, Unix, Windows. - .. versionchanged:: 2.5 The *stream* parameter was added. .. versionchanged:: 2.6 @@ -41,7 +39,7 @@ .. function:: getuser() - Return the "login name" of the user. Availability: Unix, Windows. + Return the "login name" of the user. This function checks the environment variables :envvar:`LOGNAME`, :envvar:`USER`, :envvar:`LNAME` and :envvar:`USERNAME`, in order, and returns -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Thu Jun 2 04:50:59 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 02 Jun 2016 08:50:59 +0000 Subject: [Python-checkins] Daily reference leaks (1bd3daae351d): sum=9 Message-ID: <20160602085058.63235.55887.8B8DD850@psf.io> results for 1bd3daae351d on branch "default" -------------------------------------------- test_collections leaked [4, 0, 0] memory blocks, sum=4 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [2, 0, -1] memory blocks, sum=1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogu4il_g', '--timeout', '7200'] From lp_benchmark_robot at intel.com Thu Jun 2 06:20:35 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 2 Jun 2016 11:20:35 +0100 Subject: [Python-checkins] BAD Benchmark Results for Python Default 2016-06-02 Message-ID: Results for project Python default, build date 2016-06-02 02:03:11 +0000 commit: 1bd3daae351d previous commit: 20bd4c23cfe4 revision date: 2016-06-02 01:26:50 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.20% -2.65% 5.07% 19.51% :-| pybench 0.36% 0.13% 1.66% 7.20% :-( regex_v8 2.66% -0.04% -2.55% 4.76% :-| nbody 0.10% -0.00% 0.70% 7.68% :-| json_dump_v2 0.33% 0.65% 0.10% 13.29% :-| normal_startup 0.71% -0.23% -0.38% 6.15% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/bad-benchmark-results-for-python-default-2016-06-02/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Thu Jun 2 06:21:54 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 2 Jun 2016 11:21:54 +0100 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2016-06-02 Message-ID: Results for project Python 2.7, build date 2016-06-02 02:49:08 +0000 commit: 98870f27d2ed previous commit: 824d32436198 revision date: 2016-06-02 01:32:42 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.10% 0.14% 4.87% 5.99% :-) pybench 0.16% 0.28% 6.14% 4.97% :-( regex_v8 0.65% 0.11% -2.08% 10.69% :-) nbody 0.14% 0.21% 9.28% 3.93% :-| json_dump_v2 0.56% -0.67% 1.13% 13.03% :-( normal_startup 1.90% -0.96% -5.93% 2.06% :-) ssbench 0.20% 0.34% 2.57% 1.31% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-2-7-2016-06-02/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Thu Jun 2 06:41:07 2016 From: python-checkins at python.org (martin.panter) Date: Thu, 02 Jun 2016 10:41:07 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327171=3A_Fix_typo?= =?utf-8?q?_in_exception_message?= Message-ID: <20160602104106.63460.59689.5E56A93E@psf.io> https://hg.python.org/cpython/rev/0ddba0abab49 changeset: 101596:0ddba0abab49 user: Martin Panter date: Thu Jun 02 10:13:47 2016 +0000 summary: Issue #27171: Fix typo in exception message files: Modules/_ctypes/callproc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -380,7 +380,7 @@ whose operation is not allowed in the current machine mode. */ PyErr_SetString(PyExc_OSError, - "exception: priviledged instruction"); + "exception: privileged instruction"); break; case EXCEPTION_NONCONTINUABLE_EXCEPTION: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 06:41:06 2016 From: python-checkins at python.org (martin.panter) Date: Thu, 02 Jun 2016 10:41:06 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327171=3A_Merge_typo_fixes_from_3=2E5?= Message-ID: <20160602104106.4617.65756.126C81F0@psf.io> https://hg.python.org/cpython/rev/c67f1f4ebb32 changeset: 101595:c67f1f4ebb32 parent: 101592:1bd3daae351d parent: 101594:ce31ee3b1e69 user: Martin Panter date: Thu Jun 02 10:11:18 2016 +0000 summary: Issue #27171: Merge typo fixes from 3.5 files: Include/pymacconfig.h | 2 +- Lib/_osx_support.py | 12 +++++----- Lib/_pydecimal.py | 2 +- Lib/_pyio.py | 2 +- Lib/distutils/tests/test_build_ext.py | 2 +- Lib/idlelib/autocomplete.py | 2 +- Lib/idlelib/multicall.py | 2 +- Lib/idlelib/rpc.py | 2 +- Lib/pathlib.py | 2 +- Lib/pdb.py | 2 +- Lib/random.py | 2 +- Lib/site.py | 4 +- Lib/test/test_bigmem.py | 2 +- Lib/test/test_email/test_policy.py | 2 +- Lib/test/test_module.py | 2 +- Lib/test/test_pep3151.py | 6 ++-- Lib/test/test_random.py | 2 +- Lib/test/test_socket.py | 2 +- Lib/test/test_sys_setprofile.py | 2 +- Lib/tkinter/__init__.py | 2 +- Lib/unittest/suite.py | 2 +- Misc/HISTORY | 18 +++++++------- Misc/NEWS | 4 +- Modules/_datetimemodule.c | 4 +- Modules/_lzmamodule.c | 2 +- Modules/ld_so_aix.in | 6 ++-- Modules/readline.c | 2 +- Objects/exceptions.c | 2 +- Objects/unicodeobject.c | 2 +- setup.py | 4 +- 30 files changed, 51 insertions(+), 51 deletions(-) diff --git a/Include/pymacconfig.h b/Include/pymacconfig.h --- a/Include/pymacconfig.h +++ b/Include/pymacconfig.h @@ -66,7 +66,7 @@ * Therefore surpress the toolbox-glue in 64-bit mode. */ - /* In 64-bit mode setpgrp always has no argments, in 32-bit + /* In 64-bit mode setpgrp always has no arguments, in 32-bit * mode that depends on the compilation environment */ # undef SETPGRP_HAVE_ARG diff --git a/Lib/_osx_support.py b/Lib/_osx_support.py --- a/Lib/_osx_support.py +++ b/Lib/_osx_support.py @@ -157,7 +157,7 @@ # gcc-4.2 is either not present, or a copy of 'llvm-gcc' that # miscompiles Python. - # skip checks if the compiler was overriden with a CC env variable + # skip checks if the compiler was overridden with a CC env variable if 'CC' in os.environ: return _config_vars @@ -193,7 +193,7 @@ if cc != oldcc: # Found a replacement compiler. # Modify config vars using new compiler, if not already explicitly - # overriden by an env variable, preserving additional arguments. + # overridden by an env variable, preserving additional arguments. for cv in _COMPILER_CONFIG_VARS: if cv in _config_vars and cv not in os.environ: cv_split = _config_vars[cv].split() @@ -207,7 +207,7 @@ """Remove all universal build arguments from config vars""" for cv in _UNIVERSAL_CONFIG_VARS: - # Do not alter a config var explicitly overriden by env var + # Do not alter a config var explicitly overridden by env var if cv in _config_vars and cv not in os.environ: flags = _config_vars[cv] flags = re.sub('-arch\s+\w+\s', ' ', flags, re.ASCII) @@ -228,7 +228,7 @@ # build extensions on OSX 10.7 and later with the prebuilt # 32-bit installer on the python.org website. - # skip checks if the compiler was overriden with a CC env variable + # skip checks if the compiler was overridden with a CC env variable if 'CC' in os.environ: return _config_vars @@ -244,7 +244,7 @@ # across Xcode and compiler versions, there is no reliable way # to be sure why it failed. Assume here it was due to lack of # PPC support and remove the related '-arch' flags from each - # config variables not explicitly overriden by an environment + # config variables not explicitly overridden by an environment # variable. If the error was for some other reason, we hope the # failure will show up again when trying to compile an extension # module. @@ -292,7 +292,7 @@ sdk = m.group(1) if not os.path.exists(sdk): for cv in _UNIVERSAL_CONFIG_VARS: - # Do not alter a config var explicitly overriden by env var + # Do not alter a config var explicitly overridden by env var if cv in _config_vars and cv not in os.environ: flags = _config_vars[cv] flags = re.sub(r'-isysroot\s+\S+(?:\s|$)', ' ', flags) diff --git a/Lib/_pydecimal.py b/Lib/_pydecimal.py --- a/Lib/_pydecimal.py +++ b/Lib/_pydecimal.py @@ -1152,7 +1152,7 @@ def __pos__(self, context=None): """Returns a copy, unless it is a sNaN. - Rounds the number (if more then precision digits) + Rounds the number (if more than precision digits) """ if self._is_special: ans = self._check_nans(context=context) diff --git a/Lib/_pyio.py b/Lib/_pyio.py --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -1043,7 +1043,7 @@ break avail += len(chunk) chunks.append(chunk) - # n is more then avail only when an EOF occurred or when + # n is more than avail only when an EOF occurred or when # read() would have blocked. n = min(n, avail) out = b"".join(chunks) diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py --- a/Lib/distutils/tests/test_build_ext.py +++ b/Lib/distutils/tests/test_build_ext.py @@ -278,7 +278,7 @@ def test_compiler_option(self): # cmd.compiler is an option and - # should not be overriden by a compiler instance + # should not be overridden by a compiler instance # when the command is run dist = Distribution() cmd = self.build_ext(dist) diff --git a/Lib/idlelib/autocomplete.py b/Lib/idlelib/autocomplete.py --- a/Lib/idlelib/autocomplete.py +++ b/Lib/idlelib/autocomplete.py @@ -1,6 +1,6 @@ """autocomplete.py - An IDLE extension for automatically completing names. -This extension can complete either attribute names of file names. It can pop +This extension can complete either attribute names or file names. It can pop a window with all available names, for the user to select from. """ import os diff --git a/Lib/idlelib/multicall.py b/Lib/idlelib/multicall.py --- a/Lib/idlelib/multicall.py +++ b/Lib/idlelib/multicall.py @@ -111,7 +111,7 @@ raise # An int in range(1 << len(_modifiers)) represents a combination of modifiers -# (if the least significent bit is on, _modifiers[0] is on, and so on). +# (if the least significant bit is on, _modifiers[0] is on, and so on). # _state_subsets gives for each combination of modifiers, or *state*, # a list of the states which are a subset of it. This list is ordered by the # number of modifiers is the state - the most specific state comes first. diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py --- a/Lib/idlelib/rpc.py +++ b/Lib/idlelib/rpc.py @@ -1,4 +1,4 @@ -"""RPC Implemention, originally written for the Python Idle IDE +"""RPC Implementation, originally written for the Python Idle IDE For security reasons, GvR requested that Idle's Python execution server process connect to the Idle process, which listens for the connection. Since Idle has diff --git a/Lib/pathlib.py b/Lib/pathlib.py --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -674,7 +674,7 @@ return cls._flavour.join(parts) def _init(self): - # Overriden in concrete Path + # Overridden in concrete Path pass def _make_child(self, args): diff --git a/Lib/pdb.py b/Lib/pdb.py --- a/Lib/pdb.py +++ b/Lib/pdb.py @@ -52,7 +52,7 @@ directory, it is read in and executed as if it had been typed at the debugger prompt. This is particularly useful for aliases. If both files exist, the one in the home directory is read first and aliases -defined there can be overriden by the local file. +defined there can be overridden by the local file. Aside from aliases, the debugger is not directly programmable; but it is implemented as a class from which you can derive your own debugger diff --git a/Lib/random.py b/Lib/random.py --- a/Lib/random.py +++ b/Lib/random.py @@ -231,7 +231,7 @@ while r >= n: r = getrandbits(k) return r - # There's an overriden random() method but no new getrandbits() method, + # There's an overridden random() method but no new getrandbits() method, # so we can only use random() from here. if n >= maxsize: _warn("Underlying random() generator does not supply \n" diff --git a/Lib/site.py b/Lib/site.py --- a/Lib/site.py +++ b/Lib/site.py @@ -59,7 +59,7 @@ omitted because it is not mentioned in either path configuration file. The readline module is also automatically configured to enable -completion for systems that support it. This can be overriden in +completion for systems that support it. This can be overridden in sitecustomize, usercustomize or PYTHONSTARTUP. After these operations, an attempt is made to import a module @@ -379,7 +379,7 @@ If the readline module can be imported, the hook will set the Tab key as completion key and register ~/.python_history as history file. - This can be overriden in the sitecustomize or usercustomize module, + This can be overridden in the sitecustomize or usercustomize module, or in a PYTHONSTARTUP file. """ def register_readline(): diff --git a/Lib/test/test_bigmem.py b/Lib/test/test_bigmem.py --- a/Lib/test/test_bigmem.py +++ b/Lib/test/test_bigmem.py @@ -736,7 +736,7 @@ finally: r = s = None - # The original test_translate is overriden here, so as to get the + # The original test_translate is overridden here, so as to get the # correct size estimate: str.translate() uses an intermediate Py_UCS4 # representation. diff --git a/Lib/test/test_email/test_policy.py b/Lib/test/test_email/test_policy.py --- a/Lib/test/test_email/test_policy.py +++ b/Lib/test/test_email/test_policy.py @@ -177,7 +177,7 @@ with self.assertRaisesRegex(self.MyDefect, "the telly is broken"): self.MyPolicy(raise_on_defect=True).handle_defect(foo, defect) - def test_overriden_register_defect_works(self): + def test_overridden_register_defect_works(self): foo = self.MyObj() defect1 = self.MyDefect("one") my_policy = self.MyPolicy() diff --git a/Lib/test/test_module.py b/Lib/test/test_module.py --- a/Lib/test/test_module.py +++ b/Lib/test/test_module.py @@ -227,7 +227,7 @@ b"len = len", b"shutil.rmtree = rmtree"}) - def test_descriptor_errors_propogate(self): + def test_descriptor_errors_propagate(self): class Descr: def __get__(self, o, t): raise RuntimeError diff --git a/Lib/test/test_pep3151.py b/Lib/test/test_pep3151.py --- a/Lib/test/test_pep3151.py +++ b/Lib/test/test_pep3151.py @@ -163,7 +163,7 @@ e = SubOSError(EEXIST, "Bad file descriptor") self.assertIs(type(e), SubOSError) - def test_init_overriden(self): + def test_init_overridden(self): e = SubOSErrorWithInit("some message", "baz") self.assertEqual(e.bar, "baz") self.assertEqual(e.args, ("some message",)) @@ -173,7 +173,7 @@ self.assertEqual(e.bar, "baz") self.assertEqual(e.args, ("some message",)) - def test_new_overriden(self): + def test_new_overridden(self): e = SubOSErrorWithNew("some message", "baz") self.assertEqual(e.baz, "baz") self.assertEqual(e.args, ("some message",)) @@ -183,7 +183,7 @@ self.assertEqual(e.baz, "baz") self.assertEqual(e.args, ("some message",)) - def test_init_new_overriden(self): + def test_init_new_overridden(self): e = SubOSErrorCombinedInitFirst("some message", "baz") self.assertEqual(e.bar, "baz") self.assertEqual(e.baz, "baz") diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py --- a/Lib/test/test_random.py +++ b/Lib/test/test_random.py @@ -494,7 +494,7 @@ self.assertTrue(2**k > n > 2**(k-1)) # note the stronger assertion @unittest.mock.patch('random.Random.random') - def test_randbelow_overriden_random(self, random_mock): + def test_randbelow_overridden_random(self, random_mock): # Random._randbelow() can only use random() when the built-in one # has been overridden but no new getrandbits() method was supplied. random_mock.side_effect = random.SystemRandom().random 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 @@ -1314,7 +1314,7 @@ # socket.gethostbyaddr('?????????.python.org') def check_sendall_interrupted(self, with_timeout): - # socketpair() is not stricly required, but it makes things easier. + # socketpair() is not strictly required, but it makes things easier. if not hasattr(signal, 'alarm') or not hasattr(socket, 'socketpair'): self.skipTest("signal.alarm and socket.socketpair required for this test") # Our signal handlers clobber the C errno by calling a math function diff --git a/Lib/test/test_sys_setprofile.py b/Lib/test/test_sys_setprofile.py --- a/Lib/test/test_sys_setprofile.py +++ b/Lib/test/test_sys_setprofile.py @@ -164,7 +164,7 @@ (1, 'return', g_ident), ]) - def test_exception_propogation(self): + def test_exception_propagation(self): def f(p): 1/0 def g(p): diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -3125,7 +3125,7 @@ """Creates a peer text widget with the given newPathName, and any optional standard configuration options. By default the peer will have the same start and end line as the parent widget, but - these can be overriden with the standard configuration options.""" + these can be overridden with the standard configuration options.""" self.tk.call(self._w, 'peer', 'create', newPathName, *self._options(cnf, kw)) def peer_names(self): # new in Tk 8.5 diff --git a/Lib/unittest/suite.py b/Lib/unittest/suite.py --- a/Lib/unittest/suite.py +++ b/Lib/unittest/suite.py @@ -71,7 +71,7 @@ try: test = self._tests[index] except TypeError: - # support for suite implementations that have overriden self._tests + # support for suite implementations that have overridden self._tests pass else: # Some unittest tests add non TestCase/TestSuite objects to diff --git a/Misc/HISTORY b/Misc/HISTORY --- a/Misc/HISTORY +++ b/Misc/HISTORY @@ -1834,7 +1834,7 @@ objects. Initial patch by Matthias Troffaes. - Fix OSError.__init__ and OSError.__new__ so that each of them can be - overriden and take additional arguments (followup to issue #12555). + overridden and take additional arguments (followup to issue #12555). - 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 @@ -2053,7 +2053,7 @@ given, produce an informative error message which includes the name(s) of the missing arguments. -- Issue #12370: Fix super with no arguments when __class__ is overriden in the +- Issue #12370: Fix super with no arguments when __class__ is overridden in the class body. - Issue #12084: os.stat on Windows now works properly with relative symbolic @@ -7273,7 +7273,7 @@ messages parsed by email.Parser.HeaderParser. - Issue #7361: Importlib was not properly checking the number of bytes in - bytecode file when it was less then 8 bytes. + bytecode file when it was less than 8 bytes. - Issue #7633: In the decimal module, Context class methods (with the exception of canonical and is_canonical) now accept instances of int and long wherever a @@ -7709,7 +7709,7 @@ - Issue #7900: The getgroups(2) system call on MacOSX behaves rather oddly compared to other unix systems. In particular, os.getgroups() does not reflect - any changes made using os.setgroups() but basicly always returns the same + any changes made using os.setgroups() but basically always returns the same information as the id command. os.getgroups() can now return more than 16 groups on MacOSX. @@ -7728,7 +7728,7 @@ - Issue #1578269: Implement os.symlink for Windows 6.0+. Patch by Jason R. Coombs. -- In struct.pack, correctly propogate exceptions from computing the truth of an +- In struct.pack, correctly propagate exceptions from computing the truth of an object in the '?' format. - Issue #9000: datetime.timezone objects now have eval-friendly repr. @@ -8215,7 +8215,7 @@ added LIBS to OS X framework builds. - Issue #5809: Specifying both --enable-framework and --enable-shared is - an error. Configure now explicity tells you about this. + an error. Configure now explicitly tells you about this. @@ -9209,7 +9209,7 @@ been backported to help facilitate transitions from 2.7 to 3.1. - Issue #1885: distutils. When running sdist with --formats=tar,gztar - the tar file was overriden by the gztar one. + the tar file was overridden by the gztar one. - Issue #4863: distutils.mwerkscompiler has been removed. @@ -10679,7 +10679,7 @@ - Removed the 'new' module. -- Removed all types from the 'types' module that are easily accessable +- Removed all types from the 'types' module that are easily accessible through builtins. @@ -20921,7 +20921,7 @@ * Tools/scripts/dutree.py: During display, if EPIPE is raised, it's probably because a pager was - killed. Discard the error in that case, but propogate it otherwise. + killed. Discard the error in that case, but propagate it otherwise. Fri Mar 26 16:20:45 1999 Guido van Rossum diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -7862,8 +7862,8 @@ error message has been removed. Patch by Ram Rachum. - Issue #18080: When building a C extension module on OS X, if the compiler - is overriden with the CC environment variable, use the new compiler as - the default for linking if LDSHARED is not also overriden. This restores + is overridden with the CC environment variable, use the new compiler as + the default for linking if LDSHARED is not also overridden. This restores Distutils behavior introduced in 3.2.3 and inadvertently dropped in 3.3.0. - Issue #18113: Fixed a refcount leak in the curses.panel module's diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -1071,7 +1071,7 @@ minutes = divmod(seconds, 60, &seconds); hours = divmod(minutes, 60, &minutes); assert(seconds == 0); - /* XXX ignore sub-minute data, curently not allowed. */ + /* XXX ignore sub-minute data, currently not allowed. */ PyOS_snprintf(buf, buflen, "%c%02d%s%02d", sign, hours, sep, minutes); return 0; @@ -3305,7 +3305,7 @@ Py_DECREF(offset); minutes = divmod(seconds, 60, &seconds); hours = divmod(minutes, 60, &minutes); - /* XXX ignore sub-minute data, curently not allowed. */ + /* XXX ignore sub-minute data, currently not allowed. */ assert(seconds == 0); return PyUnicode_FromFormat("UTC%c%02d:%02d", sign, hours, minutes); } diff --git a/Modules/_lzmamodule.c b/Modules/_lzmamodule.c --- a/Modules/_lzmamodule.c +++ b/Modules/_lzmamodule.c @@ -701,7 +701,7 @@ check: int(c_default="-1") = unspecified The integrity check to use. For FORMAT_XZ, the default - is CHECK_CRC64. FORMAT_ALONE and FORMAT_RAW do not suport integrity + is CHECK_CRC64. FORMAT_ALONE and FORMAT_RAW do not support integrity checks; for these formats, check must be omitted, or be CHECK_NONE. preset: object = None diff --git a/Modules/ld_so_aix.in b/Modules/ld_so_aix.in --- a/Modules/ld_so_aix.in +++ b/Modules/ld_so_aix.in @@ -12,7 +12,7 @@ # # ARGUMENTS: Same as for "ld". The following arguments are processed # or supplied by this script (those marked with an asterisk -# can be overriden from command line): +# can be overridden from command line): # # Argument Default value # (*) -o [OutputFileName] -o shr.o @@ -85,7 +85,7 @@ fi # Default import file for Python -# Can be overriden by providing a -bI: argument. +# Can be overridden by providing a -bI: argument. impfile="./python.exp" # Parse arguments @@ -156,7 +156,7 @@ fi # Default entry symbol for Python modules = init[modulename] -# Can be overriden by providing a -e argument. +# Can be overridden by providing a -e argument. if test -z "$entry"; then entry=PyInit_`echo $filename | sed "s/module.*//"` fi diff --git a/Modules/readline.c b/Modules/readline.c --- a/Modules/readline.c +++ b/Modules/readline.c @@ -1092,7 +1092,7 @@ #ifndef __APPLE__ if (!isatty(STDOUT_FILENO)) { - /* Issue #19884: stdout is no a terminal. Disable meta modifier + /* Issue #19884: stdout is not a terminal. Disable meta modifier keys to not write the ANSI sequence "\033[1034h" into stdout. On terminals supporting 8 bit characters like TERM=xterm-256color (which is now the default Fedora since Fedora 18), the meta key is diff --git a/Objects/exceptions.c b/Objects/exceptions.c --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -870,7 +870,7 @@ solution, given __new__ takes a variable number of arguments, is to defer arg parsing and initialization to __init__. - But when __new__ is overriden as well, it should call our __new__ + But when __new__ is overridden as well, it should call our __new__ with the right arguments. (see http://bugs.python.org/issue12555#msg148829 ) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9492,7 +9492,7 @@ PyUnicode_GET_LENGTH(substring) * PyUnicode_KIND(substring)); } - /* otherwise we have to compare each character by first accesing it */ + /* otherwise we have to compare each character by first accessing it */ else { /* We do not need to compare 0 and len(substring)-1 because the if statement above ensured already that they are equal diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -768,7 +768,7 @@ # In every directory on the search path search for a dynamic # library and then a static library, instead of first looking # for dynamic libraries on the entire path. - # This way a staticly linked custom readline gets picked up + # This way a statically linked custom readline gets picked up # before the (possibly broken) dynamic library in /usr/lib. readline_extra_link_args = ('-Wl,-search_paths_first',) else: @@ -1622,7 +1622,7 @@ # --with-tcltk-libs="-L/path/to/tcllibs -ltclm.n \ # -L/path/to/tklibs -ltkm.n" # - # These values can also be specified or overriden via make: + # These values can also be specified or overridden via make: # make TCLTK_INCLUDES="..." TCLTK_LIBS="..." # # This can be useful for building and testing tkinter with multiple -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 06:41:06 2016 From: python-checkins at python.org (martin.panter) Date: Thu, 02 Jun 2016 10:41:06 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MTcx?= =?utf-8?q?=3A_Fix_typos_in_documentation=2C_comments=2C_and_test_function?= =?utf-8?q?_names?= Message-ID: <20160602104106.10397.15650.B74DDE86@psf.io> https://hg.python.org/cpython/rev/ce31ee3b1e69 changeset: 101594:ce31ee3b1e69 branch: 3.5 parent: 101591:c13198a2007e user: Martin Panter date: Thu Jun 02 10:07:09 2016 +0000 summary: Issue #27171: Fix typos in documentation, comments, and test function names files: Include/pymacconfig.h | 2 +- Lib/_osx_support.py | 12 +++++----- Lib/_pydecimal.py | 2 +- Lib/_pyio.py | 2 +- Lib/distutils/tests/test_build_ext.py | 2 +- Lib/idlelib/AutoComplete.py | 2 +- Lib/idlelib/MultiCall.py | 2 +- Lib/idlelib/rpc.py | 2 +- Lib/pathlib.py | 2 +- Lib/pdb.py | 2 +- Lib/random.py | 2 +- Lib/site.py | 4 +- Lib/test/test_bigmem.py | 2 +- Lib/test/test_email/test_policy.py | 2 +- Lib/test/test_module.py | 2 +- Lib/test/test_pep3151.py | 6 ++-- Lib/test/test_random.py | 2 +- Lib/test/test_socket.py | 2 +- Lib/test/test_sys_setprofile.py | 2 +- Lib/tkinter/__init__.py | 2 +- Lib/unittest/suite.py | 2 +- Misc/HISTORY | 18 +++++++------- Misc/NEWS | 4 +- Modules/_datetimemodule.c | 4 +- Modules/_lzmamodule.c | 2 +- Modules/ld_so_aix.in | 6 ++-- Modules/readline.c | 2 +- Objects/exceptions.c | 2 +- Objects/unicodeobject.c | 2 +- setup.py | 4 +- 30 files changed, 51 insertions(+), 51 deletions(-) diff --git a/Include/pymacconfig.h b/Include/pymacconfig.h --- a/Include/pymacconfig.h +++ b/Include/pymacconfig.h @@ -66,7 +66,7 @@ * Therefore surpress the toolbox-glue in 64-bit mode. */ - /* In 64-bit mode setpgrp always has no argments, in 32-bit + /* In 64-bit mode setpgrp always has no arguments, in 32-bit * mode that depends on the compilation environment */ # undef SETPGRP_HAVE_ARG diff --git a/Lib/_osx_support.py b/Lib/_osx_support.py --- a/Lib/_osx_support.py +++ b/Lib/_osx_support.py @@ -157,7 +157,7 @@ # gcc-4.2 is either not present, or a copy of 'llvm-gcc' that # miscompiles Python. - # skip checks if the compiler was overriden with a CC env variable + # skip checks if the compiler was overridden with a CC env variable if 'CC' in os.environ: return _config_vars @@ -193,7 +193,7 @@ if cc != oldcc: # Found a replacement compiler. # Modify config vars using new compiler, if not already explicitly - # overriden by an env variable, preserving additional arguments. + # overridden by an env variable, preserving additional arguments. for cv in _COMPILER_CONFIG_VARS: if cv in _config_vars and cv not in os.environ: cv_split = _config_vars[cv].split() @@ -207,7 +207,7 @@ """Remove all universal build arguments from config vars""" for cv in _UNIVERSAL_CONFIG_VARS: - # Do not alter a config var explicitly overriden by env var + # Do not alter a config var explicitly overridden by env var if cv in _config_vars and cv not in os.environ: flags = _config_vars[cv] flags = re.sub('-arch\s+\w+\s', ' ', flags, re.ASCII) @@ -228,7 +228,7 @@ # build extensions on OSX 10.7 and later with the prebuilt # 32-bit installer on the python.org website. - # skip checks if the compiler was overriden with a CC env variable + # skip checks if the compiler was overridden with a CC env variable if 'CC' in os.environ: return _config_vars @@ -244,7 +244,7 @@ # across Xcode and compiler versions, there is no reliable way # to be sure why it failed. Assume here it was due to lack of # PPC support and remove the related '-arch' flags from each - # config variables not explicitly overriden by an environment + # config variables not explicitly overridden by an environment # variable. If the error was for some other reason, we hope the # failure will show up again when trying to compile an extension # module. @@ -292,7 +292,7 @@ sdk = m.group(1) if not os.path.exists(sdk): for cv in _UNIVERSAL_CONFIG_VARS: - # Do not alter a config var explicitly overriden by env var + # Do not alter a config var explicitly overridden by env var if cv in _config_vars and cv not in os.environ: flags = _config_vars[cv] flags = re.sub(r'-isysroot\s+\S+(?:\s|$)', ' ', flags) diff --git a/Lib/_pydecimal.py b/Lib/_pydecimal.py --- a/Lib/_pydecimal.py +++ b/Lib/_pydecimal.py @@ -1102,7 +1102,7 @@ def __pos__(self, context=None): """Returns a copy, unless it is a sNaN. - Rounds the number (if more then precision digits) + Rounds the number (if more than precision digits) """ if self._is_special: ans = self._check_nans(context=context) diff --git a/Lib/_pyio.py b/Lib/_pyio.py --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -1043,7 +1043,7 @@ break avail += len(chunk) chunks.append(chunk) - # n is more then avail only when an EOF occurred or when + # n is more than avail only when an EOF occurred or when # read() would have blocked. n = min(n, avail) out = b"".join(chunks) diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py --- a/Lib/distutils/tests/test_build_ext.py +++ b/Lib/distutils/tests/test_build_ext.py @@ -279,7 +279,7 @@ def test_compiler_option(self): # cmd.compiler is an option and - # should not be overriden by a compiler instance + # should not be overridden by a compiler instance # when the command is run dist = Distribution() cmd = self.build_ext(dist) diff --git a/Lib/idlelib/AutoComplete.py b/Lib/idlelib/AutoComplete.py --- a/Lib/idlelib/AutoComplete.py +++ b/Lib/idlelib/AutoComplete.py @@ -1,6 +1,6 @@ """AutoComplete.py - An IDLE extension for automatically completing names. -This extension can complete either attribute names of file names. It can pop +This extension can complete either attribute names or file names. It can pop a window with all available names, for the user to select from. """ import os diff --git a/Lib/idlelib/MultiCall.py b/Lib/idlelib/MultiCall.py --- a/Lib/idlelib/MultiCall.py +++ b/Lib/idlelib/MultiCall.py @@ -111,7 +111,7 @@ raise # An int in range(1 << len(_modifiers)) represents a combination of modifiers -# (if the least significent bit is on, _modifiers[0] is on, and so on). +# (if the least significant bit is on, _modifiers[0] is on, and so on). # _state_subsets gives for each combination of modifiers, or *state*, # a list of the states which are a subset of it. This list is ordered by the # number of modifiers is the state - the most specific state comes first. diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py --- a/Lib/idlelib/rpc.py +++ b/Lib/idlelib/rpc.py @@ -1,4 +1,4 @@ -"""RPC Implemention, originally written for the Python Idle IDE +"""RPC Implementation, originally written for the Python Idle IDE For security reasons, GvR requested that Idle's Python execution server process connect to the Idle process, which listens for the connection. Since Idle has diff --git a/Lib/pathlib.py b/Lib/pathlib.py --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -674,7 +674,7 @@ return cls._flavour.join(parts) def _init(self): - # Overriden in concrete Path + # Overridden in concrete Path pass def _make_child(self, args): diff --git a/Lib/pdb.py b/Lib/pdb.py --- a/Lib/pdb.py +++ b/Lib/pdb.py @@ -52,7 +52,7 @@ directory, it is read in and executed as if it had been typed at the debugger prompt. This is particularly useful for aliases. If both files exist, the one in the home directory is read first and aliases -defined there can be overriden by the local file. +defined there can be overridden by the local file. Aside from aliases, the debugger is not directly programmable; but it is implemented as a class from which you can derive your own debugger diff --git a/Lib/random.py b/Lib/random.py --- a/Lib/random.py +++ b/Lib/random.py @@ -231,7 +231,7 @@ while r >= n: r = getrandbits(k) return r - # There's an overriden random() method but no new getrandbits() method, + # There's an overridden random() method but no new getrandbits() method, # so we can only use random() from here. if n >= maxsize: _warn("Underlying random() generator does not supply \n" diff --git a/Lib/site.py b/Lib/site.py --- a/Lib/site.py +++ b/Lib/site.py @@ -59,7 +59,7 @@ omitted because it is not mentioned in either path configuration file. The readline module is also automatically configured to enable -completion for systems that support it. This can be overriden in +completion for systems that support it. This can be overridden in sitecustomize, usercustomize or PYTHONSTARTUP. After these operations, an attempt is made to import a module @@ -379,7 +379,7 @@ If the readline module can be imported, the hook will set the Tab key as completion key and register ~/.python_history as history file. - This can be overriden in the sitecustomize or usercustomize module, + This can be overridden in the sitecustomize or usercustomize module, or in a PYTHONSTARTUP file. """ def register_readline(): diff --git a/Lib/test/test_bigmem.py b/Lib/test/test_bigmem.py --- a/Lib/test/test_bigmem.py +++ b/Lib/test/test_bigmem.py @@ -737,7 +737,7 @@ finally: r = s = None - # The original test_translate is overriden here, so as to get the + # The original test_translate is overridden here, so as to get the # correct size estimate: str.translate() uses an intermediate Py_UCS4 # representation. diff --git a/Lib/test/test_email/test_policy.py b/Lib/test/test_email/test_policy.py --- a/Lib/test/test_email/test_policy.py +++ b/Lib/test/test_email/test_policy.py @@ -177,7 +177,7 @@ with self.assertRaisesRegex(self.MyDefect, "the telly is broken"): self.MyPolicy(raise_on_defect=True).handle_defect(foo, defect) - def test_overriden_register_defect_works(self): + def test_overridden_register_defect_works(self): foo = self.MyObj() defect1 = self.MyDefect("one") my_policy = self.MyPolicy() diff --git a/Lib/test/test_module.py b/Lib/test/test_module.py --- a/Lib/test/test_module.py +++ b/Lib/test/test_module.py @@ -227,7 +227,7 @@ b"len = len", b"shutil.rmtree = rmtree"}) - def test_descriptor_errors_propogate(self): + def test_descriptor_errors_propagate(self): class Descr: def __get__(self, o, t): raise RuntimeError diff --git a/Lib/test/test_pep3151.py b/Lib/test/test_pep3151.py --- a/Lib/test/test_pep3151.py +++ b/Lib/test/test_pep3151.py @@ -164,7 +164,7 @@ e = SubOSError(EEXIST, "Bad file descriptor") self.assertIs(type(e), SubOSError) - def test_init_overriden(self): + def test_init_overridden(self): e = SubOSErrorWithInit("some message", "baz") self.assertEqual(e.bar, "baz") self.assertEqual(e.args, ("some message",)) @@ -174,7 +174,7 @@ self.assertEqual(e.bar, "baz") self.assertEqual(e.args, ("some message",)) - def test_new_overriden(self): + def test_new_overridden(self): e = SubOSErrorWithNew("some message", "baz") self.assertEqual(e.baz, "baz") self.assertEqual(e.args, ("some message",)) @@ -184,7 +184,7 @@ self.assertEqual(e.baz, "baz") self.assertEqual(e.args, ("some message",)) - def test_init_new_overriden(self): + def test_init_new_overridden(self): e = SubOSErrorCombinedInitFirst("some message", "baz") self.assertEqual(e.bar, "baz") self.assertEqual(e.baz, "baz") diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py --- a/Lib/test/test_random.py +++ b/Lib/test/test_random.py @@ -494,7 +494,7 @@ self.assertTrue(2**k > n > 2**(k-1)) # note the stronger assertion @unittest.mock.patch('random.Random.random') - def test_randbelow_overriden_random(self, random_mock): + def test_randbelow_overridden_random(self, random_mock): # Random._randbelow() can only use random() when the built-in one # has been overridden but no new getrandbits() method was supplied. random_mock.side_effect = random.SystemRandom().random 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 @@ -1304,7 +1304,7 @@ # socket.gethostbyaddr('?????????.python.org') def check_sendall_interrupted(self, with_timeout): - # socketpair() is not stricly required, but it makes things easier. + # socketpair() is not strictly required, but it makes things easier. if not hasattr(signal, 'alarm') or not hasattr(socket, 'socketpair'): self.skipTest("signal.alarm and socket.socketpair required for this test") # Our signal handlers clobber the C errno by calling a math function diff --git a/Lib/test/test_sys_setprofile.py b/Lib/test/test_sys_setprofile.py --- a/Lib/test/test_sys_setprofile.py +++ b/Lib/test/test_sys_setprofile.py @@ -164,7 +164,7 @@ (1, 'return', g_ident), ]) - def test_exception_propogation(self): + def test_exception_propagation(self): def f(p): 1/0 def g(p): diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -3141,7 +3141,7 @@ """Creates a peer text widget with the given newPathName, and any optional standard configuration options. By default the peer will have the same start and end line as the parent widget, but - these can be overriden with the standard configuration options.""" + these can be overridden with the standard configuration options.""" self.tk.call(self._w, 'peer', 'create', newPathName, *self._options(cnf, kw)) def peer_names(self): # new in Tk 8.5 diff --git a/Lib/unittest/suite.py b/Lib/unittest/suite.py --- a/Lib/unittest/suite.py +++ b/Lib/unittest/suite.py @@ -71,7 +71,7 @@ try: test = self._tests[index] except TypeError: - # support for suite implementations that have overriden self._tests + # support for suite implementations that have overridden self._tests pass else: # Some unittest tests add non TestCase/TestSuite objects to diff --git a/Misc/HISTORY b/Misc/HISTORY --- a/Misc/HISTORY +++ b/Misc/HISTORY @@ -1834,7 +1834,7 @@ objects. Initial patch by Matthias Troffaes. - Fix OSError.__init__ and OSError.__new__ so that each of them can be - overriden and take additional arguments (followup to issue #12555). + overridden and take additional arguments (followup to issue #12555). - 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 @@ -2053,7 +2053,7 @@ given, produce an informative error message which includes the name(s) of the missing arguments. -- Issue #12370: Fix super with no arguments when __class__ is overriden in the +- Issue #12370: Fix super with no arguments when __class__ is overridden in the class body. - Issue #12084: os.stat on Windows now works properly with relative symbolic @@ -7273,7 +7273,7 @@ messages parsed by email.Parser.HeaderParser. - Issue #7361: Importlib was not properly checking the number of bytes in - bytecode file when it was less then 8 bytes. + bytecode file when it was less than 8 bytes. - Issue #7633: In the decimal module, Context class methods (with the exception of canonical and is_canonical) now accept instances of int and long wherever a @@ -7709,7 +7709,7 @@ - Issue #7900: The getgroups(2) system call on MacOSX behaves rather oddly compared to other unix systems. In particular, os.getgroups() does not reflect - any changes made using os.setgroups() but basicly always returns the same + any changes made using os.setgroups() but basically always returns the same information as the id command. os.getgroups() can now return more than 16 groups on MacOSX. @@ -7728,7 +7728,7 @@ - Issue #1578269: Implement os.symlink for Windows 6.0+. Patch by Jason R. Coombs. -- In struct.pack, correctly propogate exceptions from computing the truth of an +- In struct.pack, correctly propagate exceptions from computing the truth of an object in the '?' format. - Issue #9000: datetime.timezone objects now have eval-friendly repr. @@ -8215,7 +8215,7 @@ added LIBS to OS X framework builds. - Issue #5809: Specifying both --enable-framework and --enable-shared is - an error. Configure now explicity tells you about this. + an error. Configure now explicitly tells you about this. @@ -9209,7 +9209,7 @@ been backported to help facilitate transitions from 2.7 to 3.1. - Issue #1885: distutils. When running sdist with --formats=tar,gztar - the tar file was overriden by the gztar one. + the tar file was overridden by the gztar one. - Issue #4863: distutils.mwerkscompiler has been removed. @@ -10679,7 +10679,7 @@ - Removed the 'new' module. -- Removed all types from the 'types' module that are easily accessable +- Removed all types from the 'types' module that are easily accessible through builtins. @@ -20921,7 +20921,7 @@ * Tools/scripts/dutree.py: During display, if EPIPE is raised, it's probably because a pager was - killed. Discard the error in that case, but propogate it otherwise. + killed. Discard the error in that case, but propagate it otherwise. Fri Mar 26 16:20:45 1999 Guido van Rossum diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -7141,8 +7141,8 @@ error message has been removed. Patch by Ram Rachum. - Issue #18080: When building a C extension module on OS X, if the compiler - is overriden with the CC environment variable, use the new compiler as - the default for linking if LDSHARED is not also overriden. This restores + is overridden with the CC environment variable, use the new compiler as + the default for linking if LDSHARED is not also overridden. This restores Distutils behavior introduced in 3.2.3 and inadvertently dropped in 3.3.0. - Issue #18113: Fixed a refcount leak in the curses.panel module's diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -1073,7 +1073,7 @@ minutes = divmod(seconds, 60, &seconds); hours = divmod(minutes, 60, &minutes); assert(seconds == 0); - /* XXX ignore sub-minute data, curently not allowed. */ + /* XXX ignore sub-minute data, currently not allowed. */ PyOS_snprintf(buf, buflen, "%c%02d%s%02d", sign, hours, sep, minutes); return 0; @@ -3304,7 +3304,7 @@ Py_DECREF(offset); minutes = divmod(seconds, 60, &seconds); hours = divmod(minutes, 60, &minutes); - /* XXX ignore sub-minute data, curently not allowed. */ + /* XXX ignore sub-minute data, currently not allowed. */ assert(seconds == 0); return PyUnicode_FromFormat("UTC%c%02d:%02d", sign, hours, minutes); } diff --git a/Modules/_lzmamodule.c b/Modules/_lzmamodule.c --- a/Modules/_lzmamodule.c +++ b/Modules/_lzmamodule.c @@ -705,7 +705,7 @@ check: int(c_default="-1") = unspecified The integrity check to use. For FORMAT_XZ, the default - is CHECK_CRC64. FORMAT_ALONE and FORMAT_RAW do not suport integrity + is CHECK_CRC64. FORMAT_ALONE and FORMAT_RAW do not support integrity checks; for these formats, check must be omitted, or be CHECK_NONE. preset: object = None diff --git a/Modules/ld_so_aix.in b/Modules/ld_so_aix.in --- a/Modules/ld_so_aix.in +++ b/Modules/ld_so_aix.in @@ -12,7 +12,7 @@ # # ARGUMENTS: Same as for "ld". The following arguments are processed # or supplied by this script (those marked with an asterisk -# can be overriden from command line): +# can be overridden from command line): # # Argument Default value # (*) -o [OutputFileName] -o shr.o @@ -85,7 +85,7 @@ fi # Default import file for Python -# Can be overriden by providing a -bI: argument. +# Can be overridden by providing a -bI: argument. impfile="./python.exp" # Parse arguments @@ -156,7 +156,7 @@ fi # Default entry symbol for Python modules = init[modulename] -# Can be overriden by providing a -e argument. +# Can be overridden by providing a -e argument. if test -z "$entry"; then entry=PyInit_`echo $filename | sed "s/module.*//"` fi diff --git a/Modules/readline.c b/Modules/readline.c --- a/Modules/readline.c +++ b/Modules/readline.c @@ -1075,7 +1075,7 @@ #ifndef __APPLE__ if (!isatty(STDOUT_FILENO)) { - /* Issue #19884: stdout is no a terminal. Disable meta modifier + /* Issue #19884: stdout is not a terminal. Disable meta modifier keys to not write the ANSI sequence "\033[1034h" into stdout. On terminals supporting 8 bit characters like TERM=xterm-256color (which is now the default Fedora since Fedora 18), the meta key is diff --git a/Objects/exceptions.c b/Objects/exceptions.c --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -876,7 +876,7 @@ solution, given __new__ takes a variable number of arguments, is to defer arg parsing and initialization to __init__. - But when __new__ is overriden as well, it should call our __new__ + But when __new__ is overridden as well, it should call our __new__ with the right arguments. (see http://bugs.python.org/issue12555#msg148829 ) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -9323,7 +9323,7 @@ PyUnicode_GET_LENGTH(substring) * PyUnicode_KIND(substring)); } - /* otherwise we have to compare each character by first accesing it */ + /* otherwise we have to compare each character by first accessing it */ else { /* We do not need to compare 0 and len(substring)-1 because the if statement above ensured already that they are equal diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -768,7 +768,7 @@ # In every directory on the search path search for a dynamic # library and then a static library, instead of first looking # for dynamic libraries on the entire path. - # This way a staticly linked custom readline gets picked up + # This way a statically linked custom readline gets picked up # before the (possibly broken) dynamic library in /usr/lib. readline_extra_link_args = ('-Wl,-search_paths_first',) else: @@ -1622,7 +1622,7 @@ # --with-tcltk-libs="-L/path/to/tcllibs -ltclm.n \ # -L/path/to/tklibs -ltkm.n" # - # These values can also be specified or overriden via make: + # These values can also be specified or overridden via make: # make TCLTK_INCLUDES="..." TCLTK_LIBS="..." # # This can be useful for building and testing tkinter with multiple -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 06:41:09 2016 From: python-checkins at python.org (martin.panter) Date: Thu, 02 Jun 2016 10:41:09 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI3MTcx?= =?utf-8?q?=3A_Fix_typos_in_documentation=2C_code_comments=2C_and_tests?= Message-ID: <20160602104107.5256.24948.35D1DE2C@psf.io> https://hg.python.org/cpython/rev/b0b463760b45 changeset: 101597:b0b463760b45 branch: 2.7 parent: 101593:98870f27d2ed user: Martin Panter date: Thu Jun 02 10:35:44 2016 +0000 summary: Issue #27171: Fix typos in documentation, code comments, and tests files: Demo/tkinter/ttk/ttkcalendar.py | 2 +- Include/pymacconfig.h | 2 +- Lib/Cookie.py | 2 +- Lib/_osx_support.py | 12 ++++++------ Lib/_pyio.py | 2 +- Lib/bsddb/test/test_all.py | 2 +- Lib/decimal.py | 2 +- Lib/distutils/tests/test_build_ext.py | 2 +- Lib/hotshot/__init__.py | 2 +- Lib/idlelib/AutoComplete.py | 2 +- Lib/idlelib/MultiCall.py | 2 +- Lib/idlelib/rpc.py | 2 +- Lib/locale.py | 2 +- Lib/pdb.doc | 2 +- Lib/plat-mac/bgenlocations.py | 2 +- Lib/test/test_socket.py | 4 ++-- Lib/test/test_sys_setprofile.py | 2 +- Misc/HISTORY | 2 +- Misc/NEWS | 10 +++++----- Modules/_bsddb.c | 2 +- Modules/ld_so_aix.in | 6 +++--- Modules/readline.c | 2 +- Objects/fileobject.c | 2 +- Tools/bgen/bgen/bgenVariable.py | 2 +- setup.py | 4 ++-- 25 files changed, 38 insertions(+), 38 deletions(-) diff --git a/Demo/tkinter/ttk/ttkcalendar.py b/Demo/tkinter/ttk/ttkcalendar.py --- a/Demo/tkinter/ttk/ttkcalendar.py +++ b/Demo/tkinter/ttk/ttkcalendar.py @@ -191,7 +191,7 @@ self._date = self._date - self.timedelta(days=1) self._date = self.datetime(self._date.year, self._date.month, 1) - self._build_calendar() # reconstuct calendar + self._build_calendar() # reconstruct calendar def _next_month(self): """Update calendar to show the next month.""" diff --git a/Include/pymacconfig.h b/Include/pymacconfig.h --- a/Include/pymacconfig.h +++ b/Include/pymacconfig.h @@ -66,7 +66,7 @@ * Therefore surpress the toolbox-glue in 64-bit mode. */ - /* In 64-bit mode setpgrp always has no argments, in 32-bit + /* In 64-bit mode setpgrp always has no arguments, in 32-bit * mode that depends on the compilation environment */ # undef SETPGRP_HAVE_ARG diff --git a/Lib/Cookie.py b/Lib/Cookie.py --- a/Lib/Cookie.py +++ b/Lib/Cookie.py @@ -190,7 +190,7 @@ Backwards Compatibility ----------------------- -In order to keep compatibilty with earlier versions of Cookie.py, +In order to keep compatibility with earlier versions of Cookie.py, it is still possible to use Cookie.Cookie() to create a Cookie. In fact, this simply returns a SmartCookie. diff --git a/Lib/_osx_support.py b/Lib/_osx_support.py --- a/Lib/_osx_support.py +++ b/Lib/_osx_support.py @@ -157,7 +157,7 @@ # gcc-4.2 is either not present, or a copy of 'llvm-gcc' that # miscompiles Python. - # skip checks if the compiler was overriden with a CC env variable + # skip checks if the compiler was overridden with a CC env variable if 'CC' in os.environ: return _config_vars @@ -193,7 +193,7 @@ if cc != oldcc: # Found a replacement compiler. # Modify config vars using new compiler, if not already explicitly - # overriden by an env variable, preserving additional arguments. + # overridden by an env variable, preserving additional arguments. for cv in _COMPILER_CONFIG_VARS: if cv in _config_vars and cv not in os.environ: cv_split = _config_vars[cv].split() @@ -207,7 +207,7 @@ """Remove all universal build arguments from config vars""" for cv in _UNIVERSAL_CONFIG_VARS: - # Do not alter a config var explicitly overriden by env var + # Do not alter a config var explicitly overridden by env var if cv in _config_vars and cv not in os.environ: flags = _config_vars[cv] flags = re.sub('-arch\s+\w+\s', ' ', flags) @@ -228,7 +228,7 @@ # build extensions on OSX 10.7 and later with the prebuilt # 32-bit installer on the python.org website. - # skip checks if the compiler was overriden with a CC env variable + # skip checks if the compiler was overridden with a CC env variable if 'CC' in os.environ: return _config_vars @@ -244,7 +244,7 @@ # across Xcode and compiler versions, there is no reliable way # to be sure why it failed. Assume here it was due to lack of # PPC support and remove the related '-arch' flags from each - # config variables not explicitly overriden by an environment + # config variables not explicitly overridden by an environment # variable. If the error was for some other reason, we hope the # failure will show up again when trying to compile an extension # module. @@ -292,7 +292,7 @@ sdk = m.group(1) if not os.path.exists(sdk): for cv in _UNIVERSAL_CONFIG_VARS: - # Do not alter a config var explicitly overriden by env var + # Do not alter a config var explicitly overridden by env var if cv in _config_vars and cv not in os.environ: flags = _config_vars[cv] flags = re.sub(r'-isysroot\s+\S+(?:\s|$)', ' ', flags) diff --git a/Lib/_pyio.py b/Lib/_pyio.py --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -997,7 +997,7 @@ break avail += len(chunk) chunks.append(chunk) - # n is more then avail only when an EOF occurred or when + # n is more than avail only when an EOF occurred or when # read() would have blocked. n = min(n, avail) out = b"".join(chunks) diff --git a/Lib/bsddb/test/test_all.py b/Lib/bsddb/test/test_all.py --- a/Lib/bsddb/test/test_all.py +++ b/Lib/bsddb/test/test_all.py @@ -523,7 +523,7 @@ return path -# This path can be overriden via "set_test_path_prefix()". +# This path can be overridden via "set_test_path_prefix()". import os, os.path get_new_path.prefix=os.path.join(os.environ.get("TMPDIR", os.path.join(os.sep,"tmp")), "z-Berkeley_DB") diff --git a/Lib/decimal.py b/Lib/decimal.py --- a/Lib/decimal.py +++ b/Lib/decimal.py @@ -1082,7 +1082,7 @@ def __pos__(self, context=None): """Returns a copy, unless it is a sNaN. - Rounds the number (if more then precision digits) + Rounds the number (if more than precision digits) """ if self._is_special: ans = self._check_nans(context=context) diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py --- a/Lib/distutils/tests/test_build_ext.py +++ b/Lib/distutils/tests/test_build_ext.py @@ -251,7 +251,7 @@ def test_compiler_option(self): # cmd.compiler is an option and - # should not be overriden by a compiler instance + # should not be overridden by a compiler instance # when the command is run dist = Distribution() cmd = build_ext(dist) diff --git a/Lib/hotshot/__init__.py b/Lib/hotshot/__init__.py --- a/Lib/hotshot/__init__.py +++ b/Lib/hotshot/__init__.py @@ -72,7 +72,7 @@ Additional positional and keyword arguments may be passed along; the result of the call is returned, and exceptions are - allowed to propogate cleanly, while ensuring that profiling is + allowed to propagate cleanly, while ensuring that profiling is disabled on the way out. """ return self._prof.runcall(func, args, kw) diff --git a/Lib/idlelib/AutoComplete.py b/Lib/idlelib/AutoComplete.py --- a/Lib/idlelib/AutoComplete.py +++ b/Lib/idlelib/AutoComplete.py @@ -1,6 +1,6 @@ """AutoComplete.py - An IDLE extension for automatically completing names. -This extension can complete either attribute names of file names. It can pop +This extension can complete either attribute names or file names. It can pop a window with all available names, for the user to select from. """ import os diff --git a/Lib/idlelib/MultiCall.py b/Lib/idlelib/MultiCall.py --- a/Lib/idlelib/MultiCall.py +++ b/Lib/idlelib/MultiCall.py @@ -101,7 +101,7 @@ self.widget.unbind(self.widgetinst, self.sequence, self.handlerid) # An int in range(1 << len(_modifiers)) represents a combination of modifiers -# (if the least significent bit is on, _modifiers[0] is on, and so on). +# (if the least significant bit is on, _modifiers[0] is on, and so on). # _state_subsets gives for each combination of modifiers, or *state*, # a list of the states which are a subset of it. This list is ordered by the # number of modifiers is the state - the most specific state comes first. diff --git a/Lib/idlelib/rpc.py b/Lib/idlelib/rpc.py --- a/Lib/idlelib/rpc.py +++ b/Lib/idlelib/rpc.py @@ -1,4 +1,4 @@ -"""RPC Implemention, originally written for the Python Idle IDE +"""RPC Implementation, originally written for the Python Idle IDE For security reasons, GvR requested that Idle's Python execution server process connect to the Idle process, which listens for the connection. Since Idle has diff --git a/Lib/locale.py b/Lib/locale.py --- a/Lib/locale.py +++ b/Lib/locale.py @@ -16,7 +16,7 @@ import operator import functools -# keep a copy of the builtin str type, because 'str' name is overriden +# keep a copy of the builtin str type, because 'str' name is overridden # in globals by a function below _str = str diff --git a/Lib/pdb.doc b/Lib/pdb.doc --- a/Lib/pdb.doc +++ b/Lib/pdb.doc @@ -48,7 +48,7 @@ directory, it is read in and executed as if it had been typed at the debugger prompt. This is particularly useful for aliases. If both files exist, the one in the home directory is read first and aliases -defined there can be overriden by the local file. +defined there can be overridden by the local file. Aside from aliases, the debugger is not directly programmable; but it is implemented as a class from which you can derive your own debugger diff --git a/Lib/plat-mac/bgenlocations.py b/Lib/plat-mac/bgenlocations.py --- a/Lib/plat-mac/bgenlocations.py +++ b/Lib/plat-mac/bgenlocations.py @@ -34,7 +34,7 @@ # Creator for C files: CREATOR="CWIE" -# The previous definitions can be overriden by creating a module +# The previous definitions can be overridden by creating a module # bgenlocationscustomize.py and putting it in site-packages (or anywere else # on sys.path, actually) try: 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 @@ -708,7 +708,7 @@ pass def check_sendall_interrupted(self, with_timeout): - # socketpair() is not stricly required, but it makes things easier. + # socketpair() is not strictly required, but it makes things easier. if not hasattr(signal, 'alarm') or not hasattr(socket, 'socketpair'): self.skipTest("signal.alarm and socket.socketpair required for this test") # Our signal handlers clobber the C errno by calling a math function @@ -827,7 +827,7 @@ self.serv_conn.sendall(big_chunk) @unittest.skipUnless(hasattr(socket, 'fromfd'), - 'socket.fromfd not availble') + 'socket.fromfd not available') def testFromFd(self): # Testing fromfd() fd = self.cli_conn.fileno() diff --git a/Lib/test/test_sys_setprofile.py b/Lib/test/test_sys_setprofile.py --- a/Lib/test/test_sys_setprofile.py +++ b/Lib/test/test_sys_setprofile.py @@ -165,7 +165,7 @@ (1, 'return', g_ident), ]) - def test_exception_propogation(self): + def test_exception_propagation(self): def f(p): 1./0 def g(p): diff --git a/Misc/HISTORY b/Misc/HISTORY --- a/Misc/HISTORY +++ b/Misc/HISTORY @@ -10009,7 +10009,7 @@ * Tools/scripts/dutree.py: During display, if EPIPE is raised, it's probably because a pager was - killed. Discard the error in that case, but propogate it otherwise. + killed. Discard the error in that case, but propagate it otherwise. Fri Mar 26 16:20:45 1999 Guido van Rossum diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2344,8 +2344,8 @@ with port None or "0" and flags AI_NUMERICSERV. - Issue #18080: When building a C extension module on OS X, if the compiler - is overriden with the CC environment variable, use the new compiler as - the default for linking if LDSHARED is not also overriden. This restores + is overridden with the CC environment variable, use the new compiler as + the default for linking if LDSHARED is not also overridden. This restores Distutils behavior introduced in 2.7.3 and inadvertently dropped in 2.7.4. - Issue #18071: C extension module builds on OS X could fail with TypeError @@ -5467,7 +5467,7 @@ - Issue #7900: The getgroups(2) system call on MacOSX behaves rather oddly compared to other unix systems. In particular, os.getgroups() does - not reflect any changes made using os.setgroups() but basicly always + not reflect any changes made using os.setgroups() but basically always returns the same information as the id command. os.getgroups() can now return more than 16 groups on MacOSX. @@ -8076,7 +8076,7 @@ backported to help facilitate transitions from 2.7 to 3.1. - Issue #1885: distutils: When running sdist with --formats=tar,gztar the tar - file was overriden by the gztar one. + file was overridden by the gztar one. - Issue #4863: distutils.mwerkscompiler has been removed. @@ -8365,7 +8365,7 @@ installed. - Issue #5809: Specifying both --enable-framework and --enable-shared is an - error. Configure now explicity tells you about this. + error. Configure now explicitly tells you about this. - Issue #3585: Add pkg-config support. It creates a python-2.7.pc file and a python.pc symlink in the $(LIBDIR)/pkgconfig directory. Patch by Clinton Roy. diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c --- a/Modules/_bsddb.c +++ b/Modules/_bsddb.c @@ -3686,7 +3686,7 @@ /* ** DB_BUFFER_SMALL is only used if we use "get". ** We can drop it when we only use "exists", - ** when we drop suport for Berkeley DB < 4.6. + ** when we drop support for Berkeley DB < 4.6. */ if (err == DB_BUFFER_SMALL || err == 0) { Py_INCREF(Py_True); diff --git a/Modules/ld_so_aix.in b/Modules/ld_so_aix.in --- a/Modules/ld_so_aix.in +++ b/Modules/ld_so_aix.in @@ -12,7 +12,7 @@ # # ARGUMENTS: Same as for "ld". The following arguments are processed # or supplied by this script (those marked with an asterisk -# can be overriden from command line): +# can be overridden from command line): # # Argument Default value # (*) -o [OutputFileName] -o shr.o @@ -85,7 +85,7 @@ fi # Default import file for Python -# Can be overriden by providing a -bI: argument. +# Can be overridden by providing a -bI: argument. impfile="./python.exp" # Parse arguments @@ -156,7 +156,7 @@ fi # Default entry symbol for Python modules = init[modulename] -# Can be overriden by providing a -e argument. +# Can be overridden by providing a -e argument. if test -z "$entry"; then entry=init`echo $filename | sed "s/module.*//"` fi diff --git a/Modules/readline.c b/Modules/readline.c --- a/Modules/readline.c +++ b/Modules/readline.c @@ -960,7 +960,7 @@ #ifndef __APPLE__ if (!isatty(STDOUT_FILENO)) { - /* Issue #19884: stdout is no a terminal. Disable meta modifier + /* Issue #19884: stdout is not a terminal. Disable meta modifier keys to not write the ANSI sequence "\033[1034h" into stdout. On terminals supporting 8 bit characters like TERM=xterm-256color (which is now the default Fedora since Fedora 18), the meta key is diff --git a/Objects/fileobject.c b/Objects/fileobject.c --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -835,7 +835,7 @@ if (initialpos == -1) goto onioerror; - /* Set newsize to current postion if newsizeobj NULL, else to the + /* Set newsize to current position if newsizeobj NULL, else to the * specified value. */ if (newsizeobj != NULL) { diff --git a/Tools/bgen/bgen/bgenVariable.py b/Tools/bgen/bgen/bgenVariable.py --- a/Tools/bgen/bgen/bgenVariable.py +++ b/Tools/bgen/bgen/bgenVariable.py @@ -20,7 +20,7 @@ """A Variable holds a type, a name, a transfer mode and flags. - Most of its methods call the correponding type method with the + Most of its methods call the corresponding type method with the variable name. """ diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -770,7 +770,7 @@ # In every directory on the search path search for a dynamic # library and then a static library, instead of first looking # for dynamic libraries on the entire path. - # This way a staticly linked custom readline gets picked up + # This way a statically linked custom readline gets picked up # before the (possibly broken) dynamic library in /usr/lib. readline_extra_link_args = ('-Wl,-search_paths_first',) else: @@ -1767,7 +1767,7 @@ # --with-tcltk-libs="-L/path/to/tcllibs -ltclm.n \ # -L/path/to/tklibs -ltkm.n" # - # These values can also be specified or overriden via make: + # These values can also be specified or overridden via make: # make TCLTK_INCLUDES="..." TCLTK_LIBS="..." # # This can be useful for building and testing tkinter with multiple -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 13:21:40 2016 From: python-checkins at python.org (kushal.das) Date: Thu, 02 Jun 2016 17:21:40 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2321271=3A_Adds_new?= =?utf-8?q?_keyword_only_parameters_in_reset=5Fmock_call?= Message-ID: <20160602172135.70725.98379.236F21E0@psf.io> https://hg.python.org/cpython/rev/b110dd3d6cea changeset: 101598:b110dd3d6cea parent: 101596:0ddba0abab49 user: Kushal Das date: Thu Jun 02 10:20:16 2016 -0700 summary: Issue #21271: Adds new keyword only parameters in reset_mock call We now have two keyword only parameters in the reset_mock function to selectively reset the return_value or the side_effects, or both. files: Doc/library/unittest.mock.rst | 12 +++++++- Lib/unittest/mock.py | 7 ++++- Lib/unittest/test/testmock/testmock.py | 18 ++++++++++++++ Misc/NEWS | 2 + 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst --- a/Doc/library/unittest.mock.rst +++ b/Doc/library/unittest.mock.rst @@ -364,7 +364,7 @@ .. versionadded:: 3.5 - .. method:: reset_mock() + .. method:: reset_mock(*, return_value=False, side_effect=False) The reset_mock method resets all the call attributes on a mock object: @@ -376,12 +376,20 @@ >>> mock.called False + .. versionchanged:: 3.6 + Added two keyword only argument to the reset_mock function. + This can be useful where you want to make a series of assertions that reuse the same object. Note that :meth:`reset_mock` *doesn't* clear the return value, :attr:`side_effect` or any child attributes you have - set using normal assignment. Child mocks and the return value mock + set using normal assignment by default. In case you want to reset + *return_value* or :attr:`side_effect`, then pass the corresponding + parameter as ``True``. Child mocks and the return value mock (if any) are reset as well. + .. note:: *return_value*, and :attr:`side_effect` are keyword only + argument. + .. method:: mock_add_spec(spec, spec_set=False) diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -523,7 +523,7 @@ side_effect = property(__get_side_effect, __set_side_effect) - def reset_mock(self, visited=None): + def reset_mock(self, visited=None,*, return_value=False, side_effect=False): "Restore the mock object to its initial state." if visited is None: visited = [] @@ -538,6 +538,11 @@ self.call_args_list = _CallList() self.method_calls = _CallList() + if return_value: + self._mock_return_value = DEFAULT + if side_effect: + self._mock_side_effect = None + for child in self._mock_children.values(): if isinstance(child, _SpecState): continue diff --git a/Lib/unittest/test/testmock/testmock.py b/Lib/unittest/test/testmock/testmock.py --- a/Lib/unittest/test/testmock/testmock.py +++ b/Lib/unittest/test/testmock/testmock.py @@ -1277,6 +1277,24 @@ self.assertEqual(m.method_calls[0], c) self.assertEqual(m.method_calls[1], i) + def test_reset_return_sideeffect(self): + m = Mock(return_value=10, side_effect=[2,3]) + m.reset_mock(return_value=True, side_effect=True) + self.assertIsInstance(m.return_value, Mock) + self.assertEqual(m.side_effect, None) + + def test_reset_return(self): + m = Mock(return_value=10, side_effect=[2,3]) + m.reset_mock(return_value=True) + self.assertIsInstance(m.return_value, Mock) + self.assertNotEqual(m.side_effect, None) + + def test_reset_sideeffect(self): + m = Mock(return_value=10, side_effect=[2,3]) + m.reset_mock(side_effect=True) + self.assertEqual(m.return_value, 10) + self.assertEqual(m.side_effect, None) + def test_mock_add_spec(self): class _One(object): one = 1 diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -36,6 +36,8 @@ - Issue #27056: Optimize pickle.load() and pickle.loads(), up to 10% faster to deserialize a lot of small objects. +- Issue #21271: New keyword only parameters in reset_mock call. + IDLE ---- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 14:21:59 2016 From: python-checkins at python.org (berker.peksag) Date: Thu, 02 Jun 2016 18:21:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2323116=3A_Merge_from_3=2E5?= Message-ID: <20160602182124.922.37949.748D0898@psf.io> https://hg.python.org/cpython/rev/174eae50b664 changeset: 101600:174eae50b664 parent: 101598:b110dd3d6cea parent: 101599:ef800c30e28c user: Berker Peksag date: Thu Jun 02 11:31:51 2016 -0700 summary: Issue #23116: Merge from 3.5 files: Doc/tutorial/controlflow.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst --- a/Doc/tutorial/controlflow.rst +++ b/Doc/tutorial/controlflow.rst @@ -364,7 +364,7 @@ This creates a function that can be called with fewer arguments than it is defined to allow. For example:: - def ask_ok(prompt, retries=4, complaint='Yes or no, please!'): + def ask_ok(prompt, retries=4, reminder='Please try again!'): while True: ok = input(prompt) if ok in ('y', 'ye', 'yes'): @@ -373,8 +373,8 @@ return False retries = retries - 1 if retries < 0: - raise OSError('uncooperative user') - print(complaint) + raise ValueError('invalid user response') + print(reminder) This function can be called in several ways: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 14:21:59 2016 From: python-checkins at python.org (berker.peksag) Date: Thu, 02 Jun 2016 18:21:59 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIzMTE2?= =?utf-8?q?=3A_Improve_ask=5Fok=28=29_example_in_the_Python_tutorial?= Message-ID: <20160602182124.119721.51189.EB2A4945@psf.io> https://hg.python.org/cpython/rev/ef800c30e28c changeset: 101599:ef800c30e28c branch: 3.5 parent: 101594:ce31ee3b1e69 user: Berker Peksag date: Thu Jun 02 11:31:19 2016 -0700 summary: Issue #23116: Improve ask_ok() example in the Python tutorial files: Doc/tutorial/controlflow.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst --- a/Doc/tutorial/controlflow.rst +++ b/Doc/tutorial/controlflow.rst @@ -361,7 +361,7 @@ This creates a function that can be called with fewer arguments than it is defined to allow. For example:: - def ask_ok(prompt, retries=4, complaint='Yes or no, please!'): + def ask_ok(prompt, retries=4, reminder='Please try again!'): while True: ok = input(prompt) if ok in ('y', 'ye', 'yes'): @@ -370,8 +370,8 @@ return False retries = retries - 1 if retries < 0: - raise OSError('uncooperative user') - print(complaint) + raise ValueError('invalid user response') + print(reminder) This function can be called in several ways: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 14:32:58 2016 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 02 Jun 2016 18:32:58 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_replace_custom_validation_?= =?utf-8?q?logic_in_the_parse_module_with_a_simple_DFA_validator?= Message-ID: <20160602183248.72964.43203.21CCDB55@psf.io> https://hg.python.org/cpython/rev/4a9159ea2536 changeset: 101601:4a9159ea2536 user: Benjamin Peterson date: Thu Jun 02 11:30:18 2016 -0700 summary: replace custom validation logic in the parse module with a simple DFA validator (closes #26526) Patch from A. Skrobov. files: Misc/NEWS | 3 + Modules/parsermodule.c | 2545 +-------------------------- 2 files changed, 96 insertions(+), 2452 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -22,6 +22,9 @@ Library ------- +- Issue #26526: Replace custom parse tree validation in the parser + module with a simple DFA validator. + - Issue #27114: Fix SSLContext._load_windows_store_certs fails with PermissionError diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c --- a/Modules/parsermodule.c +++ b/Modules/parsermodule.c @@ -670,9 +670,75 @@ static node* build_node_tree(PyObject *tuple); -static int validate_expr_tree(node *tree); -static int validate_file_input(node *tree); -static int validate_encoding_decl(node *tree); + +static int +validate_node(node *tree) +{ + int type = TYPE(tree); + int nch = NCH(tree); + dfa *nt_dfa; + state *dfa_state; + int pos, arc; + + assert(ISNONTERMINAL(type)); + type -= NT_OFFSET; + if (type >= _PyParser_Grammar.g_ndfas) { + PyErr_Format(parser_error, "Unrecognized node type %d.", TYPE(tree)); + return 0; + } + nt_dfa = &_PyParser_Grammar.g_dfa[type]; + REQ(tree, nt_dfa->d_type); + + /* Run the DFA for this nonterminal. */ + dfa_state = &nt_dfa->d_state[nt_dfa->d_initial]; + for (pos = 0; pos < nch; ++pos) { + node *ch = CHILD(tree, pos); + int ch_type = TYPE(ch); + for (arc = 0; arc < dfa_state->s_narcs; ++arc) { + short a_label = dfa_state->s_arc[arc].a_lbl; + assert(a_label < _PyParser_Grammar.g_ll.ll_nlabels); + if (_PyParser_Grammar.g_ll.ll_label[a_label].lb_type == ch_type) { + /* The child is acceptable; if non-terminal, validate it recursively. */ + if (ISNONTERMINAL(ch_type) && !validate_node(ch)) + return 0; + + /* Update the state, and move on to the next child. */ + dfa_state = &nt_dfa->d_state[dfa_state->s_arc[arc].a_arrow]; + goto arc_found; + } + } + /* What would this state have accepted? */ + { + short a_label = dfa_state->s_arc->a_lbl; + int next_type; + if (!a_label) /* Wouldn't accept any more children */ + goto illegal_num_children; + + next_type = _PyParser_Grammar.g_ll.ll_label[a_label].lb_type; + if (ISNONTERMINAL(next_type)) + PyErr_Format(parser_error, "Expected node type %d, got %d.", + next_type, ch_type); + else + PyErr_Format(parser_error, "Illegal terminal: expected %s.", + _PyParser_TokenNames[next_type]); + return 0; + } + +arc_found: + continue; + } + /* Are we in a final state? If so, return 1 for successful validation. */ + for (arc = 0; arc < dfa_state->s_narcs; ++arc) { + if (!dfa_state->s_arc[arc].a_lbl) { + return 1; + } + } + +illegal_num_children: + PyErr_Format(parser_error, + "Illegal number of children for %s node.", nt_dfa->d_name); + return 0; +} /* PyObject* parser_tuple2st(PyObject* self, PyObject* args) * @@ -681,7 +747,7 @@ * tuple can be validated. It does this by checking the first code of the * tuple, and, if acceptable, builds the internal representation. If this * step succeeds, the internal representation is validated as fully as - * possible with the various validate_*() routines defined below. + * possible with the recursive validate_node() routine defined above. * * This function must be changed if support is to be added for PyST_FRAGMENT * ST objects. @@ -710,33 +776,35 @@ */ tree = build_node_tree(tuple); if (tree != 0) { - int start_sym = TYPE(tree); - if (start_sym == eval_input) { + node *validation_root = tree; + int tree_type = 0; + switch (TYPE(tree)) { + case eval_input: /* Might be an eval form. */ - if (validate_expr_tree(tree)) - st = parser_newstobject(tree, PyST_EXPR); - else - PyNode_Free(tree); - } - else if (start_sym == file_input) { + tree_type = PyST_EXPR; + break; + case encoding_decl: + /* This looks like an encoding_decl so far. */ + if (NCH(tree) != 1) + err_string("Error Parsing encoding_decl"); + validation_root = CHILD(tree, 0); + /* Fall through */ + case file_input: /* This looks like an exec form so far. */ - if (validate_file_input(tree)) - st = parser_newstobject(tree, PyST_SUITE); - else - PyNode_Free(tree); - } - else if (start_sym == encoding_decl) { - /* This looks like an encoding_decl so far. */ - if (validate_encoding_decl(tree)) - st = parser_newstobject(tree, PyST_SUITE); - else - PyNode_Free(tree); - } - else { + + tree_type = PyST_SUITE; + break; + default: /* This is a fragment, at best. */ PyNode_Free(tree); err_string("parse tree does not use a valid start symbol"); + return (0); } + + if (validate_node(validation_root)) + st = parser_newstobject(tree, tree_type); + else + PyNode_Free(tree); } /* Make sure we raise an exception on all errors. We should never * get this, but we'd do well to be sure something is done. @@ -981,2433 +1049,6 @@ } -/* - * Validation routines used within the validation section: - */ -static int validate_terminal(node *terminal, int type, const char *string); - -#define validate_ampersand(ch) validate_terminal(ch, AMPER, "&") -#define validate_circumflex(ch) validate_terminal(ch, CIRCUMFLEX, "^") -#define validate_colon(ch) validate_terminal(ch, COLON, ":") -#define validate_comma(ch) validate_terminal(ch, COMMA, ",") -#define validate_dedent(ch) validate_terminal(ch, DEDENT, "") -#define validate_equal(ch) validate_terminal(ch, EQUAL, "=") -#define validate_indent(ch) validate_terminal(ch, INDENT, (char*)NULL) -#define validate_lparen(ch) validate_terminal(ch, LPAR, "(") -#define validate_newline(ch) validate_terminal(ch, NEWLINE, (char*)NULL) -#define validate_rparen(ch) validate_terminal(ch, RPAR, ")") -#define validate_semi(ch) validate_terminal(ch, SEMI, ";") -#define validate_star(ch) validate_terminal(ch, STAR, "*") -#define validate_vbar(ch) validate_terminal(ch, VBAR, "|") -#define validate_doublestar(ch) validate_terminal(ch, DOUBLESTAR, "**") -#define validate_dot(ch) validate_terminal(ch, DOT, ".") -#define validate_at(ch) validate_terminal(ch, AT, "@") -#define validate_rarrow(ch) validate_terminal(ch, RARROW, "->") -#define validate_name(ch, str) validate_terminal(ch, NAME, str) - -#define VALIDATER(n) static int validate_##n(node *tree) - -VALIDATER(node); VALIDATER(small_stmt); -VALIDATER(class); VALIDATER(node); -VALIDATER(parameters); VALIDATER(suite); -VALIDATER(testlist); VALIDATER(varargslist); -VALIDATER(vfpdef); -VALIDATER(stmt); VALIDATER(simple_stmt); -VALIDATER(expr_stmt); VALIDATER(power); -VALIDATER(del_stmt); -VALIDATER(return_stmt); VALIDATER(raise_stmt); -VALIDATER(import_stmt); VALIDATER(import_stmt); -VALIDATER(import_name); VALIDATER(yield_stmt); -VALIDATER(global_stmt); VALIDATER(nonlocal_stmt); -VALIDATER(assert_stmt); -VALIDATER(compound_stmt); VALIDATER(test_or_star_expr); -VALIDATER(while); VALIDATER(for); -VALIDATER(try); VALIDATER(except_clause); -VALIDATER(test); VALIDATER(and_test); -VALIDATER(not_test); VALIDATER(comparison); -VALIDATER(comp_op); -VALIDATER(star_expr); VALIDATER(expr); -VALIDATER(xor_expr); VALIDATER(and_expr); -VALIDATER(shift_expr); VALIDATER(arith_expr); -VALIDATER(term); VALIDATER(factor); -VALIDATER(atom); VALIDATER(lambdef); -VALIDATER(trailer); VALIDATER(subscript); -VALIDATER(subscriptlist); VALIDATER(sliceop); -VALIDATER(exprlist); VALIDATER(dictorsetmaker); -VALIDATER(arglist); VALIDATER(argument); -VALIDATER(comp_for); -VALIDATER(comp_iter); VALIDATER(comp_if); -VALIDATER(testlist_comp); VALIDATER(yield_expr); -VALIDATER(or_test); -VALIDATER(test_nocond); VALIDATER(lambdef_nocond); -VALIDATER(yield_arg); -VALIDATER(async_funcdef); VALIDATER(async_stmt); -VALIDATER(atom_expr); - -#undef VALIDATER - -#define is_even(n) (((n) & 1) == 0) -#define is_odd(n) (((n) & 1) == 1) - - -static int -validate_ntype(node *n, int t) -{ - if (TYPE(n) != t) { - PyErr_Format(parser_error, "Expected node type %d, got %d.", - t, TYPE(n)); - return 0; - } - return 1; -} - - -/* Verifies that the number of child nodes is exactly 'num', raising - * an exception if it isn't. The exception message does not indicate - * the exact number of nodes, allowing this to be used to raise the - * "right" exception when the wrong number of nodes is present in a - * specific variant of a statement's syntax. This is commonly used - * in that fashion. - */ -static int -validate_numnodes(node *n, int num, const char *const name) -{ - if (NCH(n) != num) { - PyErr_Format(parser_error, - "Illegal number of children for %s node.", name); - return 0; - } - return 1; -} - - -static int -validate_terminal(node *terminal, int type, const char *string) -{ - int res = (validate_ntype(terminal, type) - && ((string == 0) || (strcmp(string, STR(terminal)) == 0))); - - if (!res && !PyErr_Occurred()) { - PyErr_Format(parser_error, - "Illegal terminal: expected \"%s\"", string); - } - return (res); -} - -/* X (',' X) [','] */ -static int -validate_repeating_list_variable(node *tree, - int list_node_type, - int (*validate_child_func_inc)(node *, int *), - int *pos, - const char *const list_node_type_name) -{ - int nch = NCH(tree); - int res = (nch && validate_ntype(tree, list_node_type)); - - if (!res && !PyErr_Occurred()) { - /* Unconditionally raise. */ - (void) validate_numnodes(tree, 1, list_node_type_name); - } - else { - for ( ; res && *pos < nch; ) { - res = validate_child_func_inc(tree, pos); - if (!res || *pos >= nch) - break; - res = validate_comma(CHILD(tree, (*pos)++)); - } - } - return res; -} - -/* X (',' X) [','] */ -static int -validate_repeating_list(node *tree, - int list_node_type, - int (*validate_child_func)(node *), - const char *const list_node_type_name) -{ - int nch = NCH(tree); - int res = (nch && validate_ntype(tree, list_node_type)); - int pos = 0; - - if (!res && !PyErr_Occurred()) { - /* Unconditionally raise. */ - (void) validate_numnodes(tree, 1, list_node_type_name); - } - else { - for ( ; res && pos < nch; ) { - res = validate_child_func(CHILD(tree, pos++)); - if (!res || pos >= nch) - break; - res = validate_comma(CHILD(tree, pos++)); - } - } - return res; -} - - -/* validate_class() - * - * classdef: - * 'class' NAME ['(' testlist ')'] ':' suite - */ -static int -validate_class(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, classdef) && - ((nch == 4) || (nch == 6) || (nch == 7))); - - if (res) { - res = (validate_name(CHILD(tree, 0), "class") - && validate_ntype(CHILD(tree, 1), NAME) - && validate_colon(CHILD(tree, nch - 2)) - && validate_suite(CHILD(tree, nch - 1))); - } - else { - (void) validate_numnodes(tree, 4, "class"); - } - - if (res) { - if (nch == 7) { - res = ((validate_lparen(CHILD(tree, 2)) && - validate_arglist(CHILD(tree, 3)) && - validate_rparen(CHILD(tree, 4)))); - } - else if (nch == 6) { - res = (validate_lparen(CHILD(tree,2)) && - validate_rparen(CHILD(tree,3))); - } - } - return (res); -} - - -/* if_stmt: - * 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite] - */ -static int -validate_if(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, if_stmt) - && (nch >= 4) - && validate_name(CHILD(tree, 0), "if") - && validate_test(CHILD(tree, 1)) - && validate_colon(CHILD(tree, 2)) - && validate_suite(CHILD(tree, 3))); - - if (res && ((nch % 4) == 3)) { - /* ... 'else' ':' suite */ - res = (validate_name(CHILD(tree, nch - 3), "else") - && validate_colon(CHILD(tree, nch - 2)) - && validate_suite(CHILD(tree, nch - 1))); - nch -= 3; - } - else if (!res && !PyErr_Occurred()) - (void) validate_numnodes(tree, 4, "if"); - if ((nch % 4) != 0) - /* Will catch the case for nch < 4 */ - res = validate_numnodes(tree, 0, "if"); - else if (res && (nch > 4)) { - /* ... ('elif' test ':' suite)+ ... */ - int j = 4; - while ((j < nch) && res) { - res = (validate_name(CHILD(tree, j), "elif") - && validate_colon(CHILD(tree, j + 2)) - && validate_test(CHILD(tree, j + 1)) - && validate_suite(CHILD(tree, j + 3))); - j += 4; - } - } - return (res); -} - - -/* parameters: - * '(' [varargslist] ')' - * - */ -static int -validate_parameters(node *tree) -{ - int nch = NCH(tree); - int res = validate_ntype(tree, parameters) && ((nch == 2) || (nch == 3)); - - if (res) { - res = (validate_lparen(CHILD(tree, 0)) - && validate_rparen(CHILD(tree, nch - 1))); - if (res && (nch == 3)) - res = validate_varargslist(CHILD(tree, 1)); - } - else { - (void) validate_numnodes(tree, 2, "parameters"); - } - return (res); -} - - -/* validate_suite() - * - * suite: - * simple_stmt - * | NEWLINE INDENT stmt+ DEDENT - */ -static int -validate_suite(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, suite) && ((nch == 1) || (nch >= 4))); - - if (res && (nch == 1)) - res = validate_simple_stmt(CHILD(tree, 0)); - else if (res) { - /* NEWLINE INDENT stmt+ DEDENT */ - res = (validate_newline(CHILD(tree, 0)) - && validate_indent(CHILD(tree, 1)) - && validate_stmt(CHILD(tree, 2)) - && validate_dedent(CHILD(tree, nch - 1))); - - if (res && (nch > 4)) { - int i = 3; - --nch; /* forget the DEDENT */ - for ( ; res && (i < nch); ++i) - res = validate_stmt(CHILD(tree, i)); - } - else if (nch < 4) - res = validate_numnodes(tree, 4, "suite"); - } - return (res); -} - - -static int -validate_testlist(node *tree) -{ - return (validate_repeating_list(tree, testlist, - validate_test, "testlist")); -} - -static int -validate_testlist_star_expr(node *tl) -{ - return (validate_repeating_list(tl, testlist_star_expr, validate_test_or_star_expr, - "testlist")); -} - - -/* validate either vfpdef or tfpdef. - * vfpdef: NAME - * tfpdef: NAME [':' test] - */ -static int -validate_vfpdef(node *tree) -{ - int nch = NCH(tree); - if (TYPE(tree) == vfpdef) { - return nch == 1 && validate_name(CHILD(tree, 0), NULL); - } - else if (TYPE(tree) == tfpdef) { - if (nch == 1) { - return validate_name(CHILD(tree, 0), NULL); - } - else if (nch == 3) { - return validate_name(CHILD(tree, 0), NULL) && - validate_colon(CHILD(tree, 1)) && - validate_test(CHILD(tree, 2)); - } - } - return 0; -} - -/* '*' [vfpdef] (',' vfpdef ['=' test])* [',' '**' vfpdef] | '**' vfpdef - * ..or tfpdef in place of vfpdef. vfpdef: NAME; tfpdef: NAME [':' test] - */ -static int -validate_varargslist_trailer(node *tree, int start) -{ - int nch = NCH(tree); - int res = 0; - - if (nch <= start) { - err_string("expected variable argument trailer for varargslist"); - return 0; - } - if (TYPE(CHILD(tree, start)) == STAR) { - /* - * '*' [vfpdef] - */ - res = validate_star(CHILD(tree, start++)); - if (res && start < nch && (TYPE(CHILD(tree, start)) == vfpdef || - TYPE(CHILD(tree, start)) == tfpdef)) - res = validate_vfpdef(CHILD(tree, start++)); - /* - * (',' vfpdef ['=' test])* - */ - while (res && start + 1 < nch && ( - TYPE(CHILD(tree, start + 1)) == vfpdef || - TYPE(CHILD(tree, start + 1)) == tfpdef)) { - res = (validate_comma(CHILD(tree, start++)) - && validate_vfpdef(CHILD(tree, start++))); - if (res && start + 1 < nch && TYPE(CHILD(tree, start)) == EQUAL) - res = (validate_equal(CHILD(tree, start++)) - && validate_test(CHILD(tree, start++))); - } - /* - * [',' '**' vfpdef] - */ - if (res && start + 2 < nch && TYPE(CHILD(tree, start+1)) == DOUBLESTAR) - res = (validate_comma(CHILD(tree, start++)) - && validate_doublestar(CHILD(tree, start++)) - && validate_vfpdef(CHILD(tree, start++))); - } - else if (TYPE(CHILD(tree, start)) == DOUBLESTAR) { - /* - * '**' vfpdef - */ - if (start + 1 < nch) - res = (validate_doublestar(CHILD(tree, start++)) - && validate_vfpdef(CHILD(tree, start++))); - else { - res = 0; - err_string("expected vfpdef after ** in varargslist trailer"); - } - } - else { - res = 0; - err_string("expected * or ** in varargslist trailer"); - } - - if (res && start != nch) { - res = 0; - err_string("unexpected extra children in varargslist trailer"); - } - return res; -} - - -/* validate_varargslist() - * - * Validate typedargslist or varargslist. - * - * typedargslist: ((tfpdef ['=' test] ',')* - * ('*' [tfpdef] (',' tfpdef ['=' test])* [',' '**' tfpdef] | - * '**' tfpdef) - * | tfpdef ['=' test] (',' tfpdef ['=' test])* [',']) - * tfpdef: NAME [':' test] - * varargslist: ((vfpdef ['=' test] ',')* - * ('*' [vfpdef] (',' vfpdef ['=' test])* [',' '**' vfpdef] | - * '**' vfpdef) - * | vfpdef ['=' test] (',' vfpdef ['=' test])* [',']) - * vfpdef: NAME - * - */ -static int -validate_varargslist(node *tree) -{ - int nch = NCH(tree); - int res = (TYPE(tree) == varargslist || - TYPE(tree) == typedargslist) && - (nch != 0); - int sym; - node *ch; - int i = 0; - - if (!res) - return 0; - if (nch < 1) { - err_string("varargslist missing child nodes"); - return 0; - } - while (i < nch) { - ch = CHILD(tree, i); - sym = TYPE(ch); - if (sym == vfpdef || sym == tfpdef) { - /* validate (vfpdef ['=' test] ',')+ */ - res = validate_vfpdef(ch); - ++i; - if (res && (i+2 <= nch) && TYPE(CHILD(tree, i)) == EQUAL) { - res = (validate_equal(CHILD(tree, i)) - && validate_test(CHILD(tree, i+1))); - if (res) - i += 2; - } - if (res && i < nch) { - res = validate_comma(CHILD(tree, i)); - ++i; - } - } else if (sym == DOUBLESTAR || sym == STAR) { - res = validate_varargslist_trailer(tree, i); - break; - } else { - res = 0; - err_string("illegal formation for varargslist"); - } - } - return res; -} - - -/* comp_iter: comp_for | comp_if - */ -static int -validate_comp_iter(node *tree) -{ - int res = (validate_ntype(tree, comp_iter) - && validate_numnodes(tree, 1, "comp_iter")); - if (res && TYPE(CHILD(tree, 0)) == comp_for) - res = validate_comp_for(CHILD(tree, 0)); - else - res = validate_comp_if(CHILD(tree, 0)); - - return res; -} - -/* comp_for: 'for' exprlist 'in' test [comp_iter] - */ -static int -validate_comp_for(node *tree) -{ - int nch = NCH(tree); - int res; - - if (nch == 5) - res = validate_comp_iter(CHILD(tree, 4)); - else - res = validate_numnodes(tree, 4, "comp_for"); - - if (res) - res = (validate_name(CHILD(tree, 0), "for") - && validate_exprlist(CHILD(tree, 1)) - && validate_name(CHILD(tree, 2), "in") - && validate_or_test(CHILD(tree, 3))); - - return res; -} - -/* comp_if: 'if' test_nocond [comp_iter] - */ -static int -validate_comp_if(node *tree) -{ - int nch = NCH(tree); - int res; - - if (nch == 3) - res = validate_comp_iter(CHILD(tree, 2)); - else - res = validate_numnodes(tree, 2, "comp_if"); - - if (res) - res = (validate_name(CHILD(tree, 0), "if") - && validate_test_nocond(CHILD(tree, 1))); - - return res; -} - - -/* simple_stmt | compound_stmt - * - */ -static int -validate_stmt(node *tree) -{ - int res = (validate_ntype(tree, stmt) - && validate_numnodes(tree, 1, "stmt")); - - if (res) { - tree = CHILD(tree, 0); - - if (TYPE(tree) == simple_stmt) - res = validate_simple_stmt(tree); - else - res = validate_compound_stmt(tree); - } - return (res); -} - - -/* small_stmt (';' small_stmt)* [';'] NEWLINE - * - */ -static int -validate_simple_stmt(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, simple_stmt) - && (nch >= 2) - && validate_small_stmt(CHILD(tree, 0)) - && validate_newline(CHILD(tree, nch - 1))); - - if (nch < 2) - res = validate_numnodes(tree, 2, "simple_stmt"); - --nch; /* forget the NEWLINE */ - if (res && is_even(nch)) - res = validate_semi(CHILD(tree, --nch)); - if (res && (nch > 2)) { - int i; - - for (i = 1; res && (i < nch); i += 2) - res = (validate_semi(CHILD(tree, i)) - && validate_small_stmt(CHILD(tree, i + 1))); - } - return (res); -} - - -static int -validate_small_stmt(node *tree) -{ - int nch = NCH(tree); - int res = validate_numnodes(tree, 1, "small_stmt"); - - if (res) { - int ntype = TYPE(CHILD(tree, 0)); - - if ( (ntype == expr_stmt) - || (ntype == del_stmt) - || (ntype == pass_stmt) - || (ntype == flow_stmt) - || (ntype == import_stmt) - || (ntype == global_stmt) - || (ntype == nonlocal_stmt) - || (ntype == assert_stmt)) - res = validate_node(CHILD(tree, 0)); - else { - res = 0; - err_string("illegal small_stmt child type"); - } - } - else if (nch == 1) { - res = 0; - PyErr_Format(parser_error, - "Unrecognized child node of small_stmt: %d.", - TYPE(CHILD(tree, 0))); - } - return (res); -} - - -/* compound_stmt: - * if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated - */ -static int -validate_compound_stmt(node *tree) -{ - int res = (validate_ntype(tree, compound_stmt) - && validate_numnodes(tree, 1, "compound_stmt")); - int ntype; - - if (!res) - return (0); - - tree = CHILD(tree, 0); - ntype = TYPE(tree); - if ( (ntype == if_stmt) - || (ntype == while_stmt) - || (ntype == for_stmt) - || (ntype == try_stmt) - || (ntype == with_stmt) - || (ntype == funcdef) - || (ntype == async_stmt) - || (ntype == classdef) - || (ntype == decorated)) - res = validate_node(tree); - else { - res = 0; - PyErr_Format(parser_error, - "Illegal compound statement type: %d.", TYPE(tree)); - } - return (res); -} - -static int -validate_yield_or_testlist(node *tree, int tse) -{ - if (TYPE(tree) == yield_expr) { - return validate_yield_expr(tree); - } - else { - if (tse) - return validate_testlist_star_expr(tree); - else - return validate_testlist(tree); - } -} - -static int -validate_expr_stmt(node *tree) -{ - int j; - int nch = NCH(tree); - int res = (validate_ntype(tree, expr_stmt) - && is_odd(nch) - && validate_testlist_star_expr(CHILD(tree, 0))); - - if (res && nch == 3 - && TYPE(CHILD(tree, 1)) == augassign) { - res = validate_numnodes(CHILD(tree, 1), 1, "augassign") - && validate_yield_or_testlist(CHILD(tree, 2), 0); - - if (res) { - char *s = STR(CHILD(CHILD(tree, 1), 0)); - - res = (strcmp(s, "+=") == 0 - || strcmp(s, "-=") == 0 - || strcmp(s, "*=") == 0 - || strcmp(s, "/=") == 0 - || strcmp(s, "//=") == 0 - || strcmp(s, "%=") == 0 - || strcmp(s, "&=") == 0 - || strcmp(s, "|=") == 0 - || strcmp(s, "^=") == 0 - || strcmp(s, "<<=") == 0 - || strcmp(s, ">>=") == 0 - || strcmp(s, "**=") == 0); - if (!res) - err_string("illegal augmented assignment operator"); - } - } - else { - for (j = 1; res && (j < nch); j += 2) - res = validate_equal(CHILD(tree, j)) - && validate_yield_or_testlist(CHILD(tree, j + 1), 1); - } - return (res); -} - - -static int -validate_del_stmt(node *tree) -{ - return (validate_numnodes(tree, 2, "del_stmt") - && validate_name(CHILD(tree, 0), "del") - && validate_exprlist(CHILD(tree, 1))); -} - - -static int -validate_return_stmt(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, return_stmt) - && ((nch == 1) || (nch == 2)) - && validate_name(CHILD(tree, 0), "return")); - - if (res && (nch == 2)) - res = validate_testlist(CHILD(tree, 1)); - - return (res); -} - - -/* - * raise_stmt: - * - * 'raise' [test ['from' test]] - */ -static int -validate_raise_stmt(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, raise_stmt) - && ((nch == 1) || (nch == 2) || (nch == 4))); - - if (!res && !PyErr_Occurred()) - (void) validate_numnodes(tree, 2, "raise"); - - if (res) { - res = validate_name(CHILD(tree, 0), "raise"); - if (res && (nch >= 2)) - res = validate_test(CHILD(tree, 1)); - if (res && (nch == 4)) { - res = (validate_name(CHILD(tree, 2), "from") - && validate_test(CHILD(tree, 3))); - } - } - return (res); -} - - -/* yield_expr: 'yield' [yield_arg] - */ -static int -validate_yield_expr(node *tree) -{ - int nch = NCH(tree); - 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 - */ -static int -validate_yield_stmt(node *tree) -{ - return (validate_ntype(tree, yield_stmt) - && validate_numnodes(tree, 1, "yield_stmt") - && validate_yield_expr(CHILD(tree, 0))); -} - - -static int -validate_import_as_name(node *tree) -{ - int nch = NCH(tree); - int ok = validate_ntype(tree, import_as_name); - - if (ok) { - if (nch == 1) - ok = validate_name(CHILD(tree, 0), NULL); - else if (nch == 3) - ok = (validate_name(CHILD(tree, 0), NULL) - && validate_name(CHILD(tree, 1), "as") - && validate_name(CHILD(tree, 2), NULL)); - else - ok = validate_numnodes(tree, 3, "import_as_name"); - } - return ok; -} - - -/* dotted_name: NAME ("." NAME)* - */ -static int -validate_dotted_name(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, dotted_name) - && is_odd(nch) - && validate_name(CHILD(tree, 0), NULL)); - int i; - - for (i = 1; res && (i < nch); i += 2) { - res = (validate_dot(CHILD(tree, i)) - && validate_name(CHILD(tree, i+1), NULL)); - } - return res; -} - - -/* dotted_as_name: dotted_name [NAME NAME] - */ -static int -validate_dotted_as_name(node *tree) -{ - int nch = NCH(tree); - int res = validate_ntype(tree, dotted_as_name); - - if (res) { - if (nch == 1) - res = validate_dotted_name(CHILD(tree, 0)); - else if (nch == 3) - res = (validate_dotted_name(CHILD(tree, 0)) - && validate_name(CHILD(tree, 1), "as") - && validate_name(CHILD(tree, 2), NULL)); - else { - res = 0; - err_string("illegal number of children for dotted_as_name"); - } - } - return res; -} - - -/* dotted_as_name (',' dotted_as_name)* */ -static int -validate_dotted_as_names(node *tree) -{ - int nch = NCH(tree); - int res = is_odd(nch) && validate_dotted_as_name(CHILD(tree, 0)); - int i; - - for (i = 1; res && (i < nch); i += 2) - res = (validate_comma(CHILD(tree, i)) - && validate_dotted_as_name(CHILD(tree, i + 1))); - return (res); -} - - -/* import_as_name (',' import_as_name)* [','] */ -static int -validate_import_as_names(node *tree) -{ - int nch = NCH(tree); - int res = validate_import_as_name(CHILD(tree, 0)); - int i; - - for (i = 1; res && (i + 1 < nch); i += 2) - res = (validate_comma(CHILD(tree, i)) - && validate_import_as_name(CHILD(tree, i + 1))); - return (res); -} - - -/* 'import' dotted_as_names */ -static int -validate_import_name(node *tree) -{ - return (validate_ntype(tree, import_name) - && validate_numnodes(tree, 2, "import_name") - && validate_name(CHILD(tree, 0), "import") - && validate_dotted_as_names(CHILD(tree, 1))); -} - -/* Helper function to count the number of leading dots (or ellipsis tokens) in - * 'from ...module import name' - */ -static int -count_from_dots(node *tree) -{ - int i; - for (i = 1; i < NCH(tree); i++) - if (TYPE(CHILD(tree, i)) != DOT && TYPE(CHILD(tree, i)) != ELLIPSIS) - break; - return i - 1; -} - -/* import_from: ('from' ('.'* dotted_name | '.'+) - * 'import' ('*' | '(' import_as_names ')' | import_as_names)) - */ -static int -validate_import_from(node *tree) -{ - int nch = NCH(tree); - int ndots = count_from_dots(tree); - int havename = (TYPE(CHILD(tree, ndots + 1)) == dotted_name); - int offset = ndots + havename; - int res = validate_ntype(tree, import_from) - && (offset >= 1) - && (nch >= 3 + offset) - && validate_name(CHILD(tree, 0), "from") - && (!havename || validate_dotted_name(CHILD(tree, ndots + 1))) - && validate_name(CHILD(tree, offset + 1), "import"); - - if (res && TYPE(CHILD(tree, offset + 2)) == LPAR) - res = ((nch == offset + 5) - && validate_lparen(CHILD(tree, offset + 2)) - && validate_import_as_names(CHILD(tree, offset + 3)) - && validate_rparen(CHILD(tree, offset + 4))); - else if (res && TYPE(CHILD(tree, offset + 2)) != STAR) - res = validate_import_as_names(CHILD(tree, offset + 2)); - return (res); -} - - -/* import_stmt: import_name | import_from */ -static int -validate_import_stmt(node *tree) -{ - int nch = NCH(tree); - int res = validate_numnodes(tree, 1, "import_stmt"); - - if (res) { - int ntype = TYPE(CHILD(tree, 0)); - - if (ntype == import_name || ntype == import_from) - res = validate_node(CHILD(tree, 0)); - else { - res = 0; - err_string("illegal import_stmt child type"); - } - } - else if (nch == 1) { - res = 0; - PyErr_Format(parser_error, - "Unrecognized child node of import_stmt: %d.", - TYPE(CHILD(tree, 0))); - } - return (res); -} - - -/* global_stmt: - * - * 'global' NAME (',' NAME)* - */ -static int -validate_global_stmt(node *tree) -{ - int j; - int nch = NCH(tree); - int res = (validate_ntype(tree, global_stmt) - && is_even(nch) && (nch >= 2)); - - if (!res && !PyErr_Occurred()) - err_string("illegal global statement"); - - if (res) - res = (validate_name(CHILD(tree, 0), "global") - && validate_ntype(CHILD(tree, 1), NAME)); - for (j = 2; res && (j < nch); j += 2) - res = (validate_comma(CHILD(tree, j)) - && validate_ntype(CHILD(tree, j + 1), NAME)); - - return (res); -} - -/* nonlocal_stmt: - * - * 'nonlocal' NAME (',' NAME)* - */ -static int -validate_nonlocal_stmt(node *tree) -{ - int j; - int nch = NCH(tree); - int res = (validate_ntype(tree, nonlocal_stmt) - && is_even(nch) && (nch >= 2)); - - if (!res && !PyErr_Occurred()) - err_string("illegal nonlocal statement"); - - if (res) - res = (validate_name(CHILD(tree, 0), "nonlocal") - && validate_ntype(CHILD(tree, 1), NAME)); - for (j = 2; res && (j < nch); j += 2) - res = (validate_comma(CHILD(tree, j)) - && validate_ntype(CHILD(tree, j + 1), NAME)); - - return res; -} - -/* assert_stmt: - * - * 'assert' test [',' test] - */ -static int -validate_assert_stmt(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, assert_stmt) - && ((nch == 2) || (nch == 4)) - && (validate_name(CHILD(tree, 0), "assert")) - && validate_test(CHILD(tree, 1))); - - if (!res && !PyErr_Occurred()) - err_string("illegal assert statement"); - if (res && (nch > 2)) - res = (validate_comma(CHILD(tree, 2)) - && validate_test(CHILD(tree, 3))); - - return (res); -} - - -static int -validate_while(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, while_stmt) - && ((nch == 4) || (nch == 7)) - && validate_name(CHILD(tree, 0), "while") - && validate_test(CHILD(tree, 1)) - && validate_colon(CHILD(tree, 2)) - && validate_suite(CHILD(tree, 3))); - - if (res && (nch == 7)) - res = (validate_name(CHILD(tree, 4), "else") - && validate_colon(CHILD(tree, 5)) - && validate_suite(CHILD(tree, 6))); - - return (res); -} - - -static int -validate_for(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, for_stmt) - && ((nch == 6) || (nch == 9)) - && validate_name(CHILD(tree, 0), "for") - && validate_exprlist(CHILD(tree, 1)) - && validate_name(CHILD(tree, 2), "in") - && validate_testlist(CHILD(tree, 3)) - && validate_colon(CHILD(tree, 4)) - && validate_suite(CHILD(tree, 5))); - - if (res && (nch == 9)) - res = (validate_name(CHILD(tree, 6), "else") - && validate_colon(CHILD(tree, 7)) - && validate_suite(CHILD(tree, 8))); - - return (res); -} - - -/* try_stmt: - * 'try' ':' suite (except_clause ':' suite)+ ['else' ':' suite] - ['finally' ':' suite] - * | 'try' ':' suite 'finally' ':' suite - * - */ -static int -validate_try(node *tree) -{ - int nch = NCH(tree); - int pos = 3; - int res = (validate_ntype(tree, try_stmt) - && (nch >= 6) && ((nch % 3) == 0)); - - if (res) - res = (validate_name(CHILD(tree, 0), "try") - && validate_colon(CHILD(tree, 1)) - && validate_suite(CHILD(tree, 2)) - && validate_colon(CHILD(tree, nch - 2)) - && validate_suite(CHILD(tree, nch - 1))); - else if (!PyErr_Occurred()) { - const char* name = "except"; - if (TYPE(CHILD(tree, nch - 3)) != except_clause) - name = STR(CHILD(tree, nch - 3)); - - PyErr_Format(parser_error, - "Illegal number of children for try/%s node.", name); - } - /* Handle try/finally statement */ - if (res && (TYPE(CHILD(tree, pos)) == NAME) && - (strcmp(STR(CHILD(tree, pos)), "finally") == 0)) { - res = (validate_numnodes(tree, 6, "try/finally") - && validate_colon(CHILD(tree, 4)) - && validate_suite(CHILD(tree, 5))); - return (res); - } - /* try/except statement: skip past except_clause sections */ - while (res && pos < nch && (TYPE(CHILD(tree, pos)) == except_clause)) { - res = (validate_except_clause(CHILD(tree, pos)) - && validate_colon(CHILD(tree, pos + 1)) - && validate_suite(CHILD(tree, pos + 2))); - pos += 3; - } - /* skip else clause */ - if (res && pos < nch && (TYPE(CHILD(tree, pos)) == NAME) && - (strcmp(STR(CHILD(tree, pos)), "else") == 0)) { - res = (validate_colon(CHILD(tree, pos + 1)) - && validate_suite(CHILD(tree, pos + 2))); - pos += 3; - } - if (res && pos < nch) { - /* last clause must be a finally */ - res = (validate_name(CHILD(tree, pos), "finally") - && validate_numnodes(tree, pos + 3, "try/except/finally") - && validate_colon(CHILD(tree, pos + 1)) - && validate_suite(CHILD(tree, pos + 2))); - } - return (res); -} - - -static int -validate_except_clause(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, except_clause) - && ((nch == 1) || (nch == 2) || (nch == 4)) - && validate_name(CHILD(tree, 0), "except")); - - if (res && (nch > 1)) - res = validate_test(CHILD(tree, 1)); - if (res && (nch == 4)) - res = (validate_name(CHILD(tree, 2), "as") - && validate_ntype(CHILD(tree, 3), NAME)); - - return (res); -} - - -static int -validate_test(node *tree) -{ - int nch = NCH(tree); - int res = validate_ntype(tree, test) && is_odd(nch); - - if (res && (TYPE(CHILD(tree, 0)) == lambdef)) - res = ((nch == 1) - && validate_lambdef(CHILD(tree, 0))); - else if (res) { - res = validate_or_test(CHILD(tree, 0)); - res = (res && (nch == 1 || (nch == 5 && - validate_name(CHILD(tree, 1), "if") && - validate_or_test(CHILD(tree, 2)) && - validate_name(CHILD(tree, 3), "else") && - validate_test(CHILD(tree, 4))))); - } - return (res); -} - -static int -validate_test_nocond(node *tree) -{ - int nch = NCH(tree); - int res = validate_ntype(tree, test_nocond) && (nch == 1); - - if (res && (TYPE(CHILD(tree, 0)) == lambdef_nocond)) - res = (validate_lambdef_nocond(CHILD(tree, 0))); - else if (res) { - res = (validate_or_test(CHILD(tree, 0))); - } - return (res); -} - -static int -validate_or_test(node *tree) -{ - int nch = NCH(tree); - int res = validate_ntype(tree, or_test) && is_odd(nch); - - if (res) { - int pos; - res = validate_and_test(CHILD(tree, 0)); - for (pos = 1; res && (pos < nch); pos += 2) - res = (validate_name(CHILD(tree, pos), "or") - && validate_and_test(CHILD(tree, pos + 1))); - } - return (res); -} - - -static int -validate_and_test(node *tree) -{ - int pos; - int nch = NCH(tree); - int res = (validate_ntype(tree, and_test) - && is_odd(nch) - && validate_not_test(CHILD(tree, 0))); - - for (pos = 1; res && (pos < nch); pos += 2) - res = (validate_name(CHILD(tree, pos), "and") - && validate_not_test(CHILD(tree, 0))); - - return (res); -} - - -static int -validate_not_test(node *tree) -{ - int nch = NCH(tree); - int res = validate_ntype(tree, not_test) && ((nch == 1) || (nch == 2)); - - if (res) { - if (nch == 2) - res = (validate_name(CHILD(tree, 0), "not") - && validate_not_test(CHILD(tree, 1))); - else if (nch == 1) - res = validate_comparison(CHILD(tree, 0)); - } - return (res); -} - - -static int -validate_comparison(node *tree) -{ - int pos; - int nch = NCH(tree); - int res = (validate_ntype(tree, comparison) - && is_odd(nch) - && validate_expr(CHILD(tree, 0))); - - for (pos = 1; res && (pos < nch); pos += 2) - res = (validate_comp_op(CHILD(tree, pos)) - && validate_expr(CHILD(tree, pos + 1))); - - return (res); -} - - -static int -validate_comp_op(node *tree) -{ - int res = 0; - int nch = NCH(tree); - - if (!validate_ntype(tree, comp_op)) - return (0); - if (nch == 1) { - /* - * Only child will be a terminal with a well-defined symbolic name - * or a NAME with a string of either 'is' or 'in' - */ - tree = CHILD(tree, 0); - switch (TYPE(tree)) { - case LESS: - case GREATER: - case EQEQUAL: - case EQUAL: - case LESSEQUAL: - case GREATEREQUAL: - case NOTEQUAL: - res = 1; - break; - case NAME: - res = ((strcmp(STR(tree), "in") == 0) - || (strcmp(STR(tree), "is") == 0)); - if (!res) { - PyErr_Format(parser_error, - "illegal operator '%s'", STR(tree)); - } - break; - default: - err_string("illegal comparison operator type"); - break; - } - } - else if ((res = validate_numnodes(tree, 2, "comp_op")) != 0) { - res = (validate_ntype(CHILD(tree, 0), NAME) - && validate_ntype(CHILD(tree, 1), NAME) - && (((strcmp(STR(CHILD(tree, 0)), "is") == 0) - && (strcmp(STR(CHILD(tree, 1)), "not") == 0)) - || ((strcmp(STR(CHILD(tree, 0)), "not") == 0) - && (strcmp(STR(CHILD(tree, 1)), "in") == 0)))); - if (!res && !PyErr_Occurred()) - err_string("unknown comparison operator"); - } - return (res); -} - - -static int -validate_star_expr(node *tree) -{ - int res = validate_ntype(tree, star_expr); - if (!res) return res; - if (!validate_numnodes(tree, 2, "star_expr")) - return 0; - return validate_ntype(CHILD(tree, 0), STAR) && \ - validate_expr(CHILD(tree, 1)); -} - - -static int -validate_expr(node *tree) -{ - int j; - int nch = NCH(tree); - int res = (validate_ntype(tree, expr) - && is_odd(nch) - && validate_xor_expr(CHILD(tree, 0))); - - for (j = 2; res && (j < nch); j += 2) - res = (validate_xor_expr(CHILD(tree, j)) - && validate_vbar(CHILD(tree, j - 1))); - - return (res); -} - - -static int -validate_xor_expr(node *tree) -{ - int j; - int nch = NCH(tree); - int res = (validate_ntype(tree, xor_expr) - && is_odd(nch) - && validate_and_expr(CHILD(tree, 0))); - - for (j = 2; res && (j < nch); j += 2) - res = (validate_circumflex(CHILD(tree, j - 1)) - && validate_and_expr(CHILD(tree, j))); - - return (res); -} - - -static int -validate_and_expr(node *tree) -{ - int pos; - int nch = NCH(tree); - int res = (validate_ntype(tree, and_expr) - && is_odd(nch) - && validate_shift_expr(CHILD(tree, 0))); - - for (pos = 1; res && (pos < nch); pos += 2) - res = (validate_ampersand(CHILD(tree, pos)) - && validate_shift_expr(CHILD(tree, pos + 1))); - - return (res); -} - - -static int -validate_chain_two_ops(node *tree, int (*termvalid)(node *), int op1, int op2) - { - int pos = 1; - int nch = NCH(tree); - int res = (is_odd(nch) - && (*termvalid)(CHILD(tree, 0))); - - for ( ; res && (pos < nch); pos += 2) { - if (TYPE(CHILD(tree, pos)) != op1) - res = validate_ntype(CHILD(tree, pos), op2); - if (res) - res = (*termvalid)(CHILD(tree, pos + 1)); - } - return (res); -} - - -static int -validate_shift_expr(node *tree) -{ - return (validate_ntype(tree, shift_expr) - && validate_chain_two_ops(tree, validate_arith_expr, - LEFTSHIFT, RIGHTSHIFT)); -} - - -static int -validate_arith_expr(node *tree) -{ - return (validate_ntype(tree, arith_expr) - && validate_chain_two_ops(tree, validate_term, PLUS, MINUS)); -} - - -static int -validate_term(node *tree) -{ - int pos = 1; - int nch = NCH(tree); - int res = (validate_ntype(tree, term) - && is_odd(nch) - && validate_factor(CHILD(tree, 0))); - - for ( ; res && (pos < nch); pos += 2) - res = (((TYPE(CHILD(tree, pos)) == STAR) - || (TYPE(CHILD(tree, pos)) == SLASH) - || (TYPE(CHILD(tree, pos)) == DOUBLESLASH) - || (TYPE(CHILD(tree, pos)) == PERCENT)) - && validate_factor(CHILD(tree, pos + 1))); - - return (res); -} - - -/* factor: - * - * factor: ('+'|'-'|'~') factor | power - */ -static int -validate_factor(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, factor) - && (((nch == 2) - && ((TYPE(CHILD(tree, 0)) == PLUS) - || (TYPE(CHILD(tree, 0)) == MINUS) - || (TYPE(CHILD(tree, 0)) == TILDE)) - && validate_factor(CHILD(tree, 1))) - || ((nch == 1) - && validate_power(CHILD(tree, 0))))); - return (res); -} - - -/* power: - * - * power: atom_expr trailer* ['**' factor] - */ -static int -validate_power(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, power) && (nch >= 1) - && validate_atom_expr(CHILD(tree, 0))); - - if (nch > 1) { - if (nch != 3) { - err_string("illegal number of nodes for 'power'"); - return (0); - } - res = (validate_doublestar(CHILD(tree, 1)) - && validate_factor(CHILD(tree, 2))); - } - - return (res); -} - - -/* atom_expr: - * - * atom_expr: [AWAIT] atom trailer* - */ -static int -validate_atom_expr(node *tree) -{ - int start = 0; - int nch = NCH(tree); - int res; - int pos; - - res = validate_ntype(tree, atom_expr) && (nch >= 1); - if (!res) { - return (res); - } - - if (TYPE(CHILD(tree, 0)) == AWAIT) { - start = 1; - if (nch < 2) { - err_string("illegal number of nodes for 'atom_expr'"); - return (0); - } - } - - res = validate_atom(CHILD(tree, start)); - if (res) { - pos = start + 1; - while (res && (pos < nch) && (TYPE(CHILD(tree, pos)) == trailer)) - res = validate_trailer(CHILD(tree, pos++)); - } - - return (res); -} - - -static int -validate_atom(node *tree) -{ - int pos; - int nch = NCH(tree); - int res = validate_ntype(tree, atom); - - if (res && nch < 1) - res = validate_numnodes(tree, nch+1, "atom"); - if (res) { - switch (TYPE(CHILD(tree, 0))) { - case LPAR: - res = ((nch <= 3) - && (validate_rparen(CHILD(tree, nch - 1)))); - - if (res && (nch == 3)) { - if (TYPE(CHILD(tree, 1))==yield_expr) - res = validate_yield_expr(CHILD(tree, 1)); - else - res = validate_testlist_comp(CHILD(tree, 1)); - } - break; - case LSQB: - if (nch == 2) - res = validate_ntype(CHILD(tree, 1), RSQB); - else if (nch == 3) - res = (validate_testlist_comp(CHILD(tree, 1)) - && validate_ntype(CHILD(tree, 2), RSQB)); - else { - res = 0; - err_string("illegal list display atom"); - } - break; - case LBRACE: - res = ((nch <= 3) - && validate_ntype(CHILD(tree, nch - 1), RBRACE)); - - if (res && (nch == 3)) - res = validate_dictorsetmaker(CHILD(tree, 1)); - break; - case NAME: - case NUMBER: - case ELLIPSIS: - res = (nch == 1); - break; - case STRING: - for (pos = 1; res && (pos < nch); ++pos) - res = validate_ntype(CHILD(tree, pos), STRING); - break; - default: - res = 0; - break; - } - } - return (res); -} - - -/* testlist_comp: - * (test|star_expr) ( comp_for | (',' (test|star_expr))* [','] ) - */ -static int -validate_testlist_comp(node *tree) -{ - int nch = NCH(tree); - int ok; - - if (nch == 0) { - err_string("missing child nodes of testlist_comp"); - return 0; - } - - if (nch == 2 && TYPE(CHILD(tree, 1)) == comp_for) { - ok = (validate_test(CHILD(tree, 0)) - && validate_comp_for(CHILD(tree, 1))); - } - else { - ok = validate_repeating_list(tree, - testlist_comp, - validate_test_or_star_expr, - "testlist_comp"); - } - return ok; -} - -/* decorator: - * '@' dotted_name [ '(' [arglist] ')' ] NEWLINE - */ -static int -validate_decorator(node *tree) -{ - int ok; - int nch = NCH(tree); - ok = (validate_ntype(tree, decorator) && - (nch == 3 || nch == 5 || nch == 6) && - validate_at(CHILD(tree, 0)) && - validate_dotted_name(CHILD(tree, 1)) && - validate_newline(RCHILD(tree, -1))); - - if (ok && nch != 3) { - ok = (validate_lparen(CHILD(tree, 2)) && - validate_rparen(RCHILD(tree, -2))); - - if (ok && nch == 6) - ok = validate_arglist(CHILD(tree, 3)); - } - - return ok; -} - -/* decorators: - * decorator+ - */ -static int -validate_decorators(node *tree) -{ - int i, nch, ok; - nch = NCH(tree); - ok = validate_ntype(tree, decorators) && nch >= 1; - - for (i = 0; ok && i < nch; ++i) - ok = validate_decorator(CHILD(tree, i)); - - return ok; -} - -/* with_item: - * test ['as' expr] - */ -static int -validate_with_item(node *tree) -{ - int nch = NCH(tree); - int ok = (validate_ntype(tree, with_item) - && (nch == 1 || nch == 3) - && validate_test(CHILD(tree, 0))); - if (ok && nch == 3) - ok = (validate_name(CHILD(tree, 1), "as") - && validate_expr(CHILD(tree, 2))); - return ok; -} - -/* with_stmt: - * 0 1 ... -2 -1 - * 'with' with_item (',' with_item)* ':' suite - */ -static int -validate_with_stmt(node *tree) -{ - int i; - int nch = NCH(tree); - int ok = (validate_ntype(tree, with_stmt) - && (nch % 2 == 0) - && validate_name(CHILD(tree, 0), "with") - && validate_colon(RCHILD(tree, -2)) - && validate_suite(RCHILD(tree, -1))); - for (i = 1; ok && i < nch - 2; i += 2) - ok = validate_with_item(CHILD(tree, i)); - return ok; -} - -/* funcdef: 'def' NAME parameters ['->' test] ':' suite */ - -static int -validate_funcdef(node *tree) -{ - int nch = NCH(tree); - int res = validate_ntype(tree, funcdef); - if (res) { - if (nch == 5) { - res = (validate_name(CHILD(tree, 0), "def") - && validate_ntype(CHILD(tree, 1), NAME) - && validate_parameters(CHILD(tree, 2)) - && validate_colon(CHILD(tree, 3)) - && validate_suite(CHILD(tree, 4))); - } - else if (nch == 7) { - res = (validate_name(CHILD(tree, 0), "def") - && validate_ntype(CHILD(tree, 1), NAME) - && validate_parameters(CHILD(tree, 2)) - && validate_rarrow(CHILD(tree, 3)) - && validate_test(CHILD(tree, 4)) - && validate_colon(CHILD(tree, 5)) - && validate_suite(CHILD(tree, 6))); - } - else { - res = 0; - err_string("illegal number of children for funcdef"); - } - } - return res; -} - -/* async_funcdef: ASYNC funcdef */ - -static int -validate_async_funcdef(node *tree) -{ - int nch = NCH(tree); - int res = validate_ntype(tree, async_funcdef); - if (res) { - if (nch == 2) { - res = (validate_ntype(CHILD(tree, 0), ASYNC) - && validate_funcdef(CHILD(tree, 1))); - } - else { - res = 0; - err_string("illegal number of children for async_funcdef"); - } - } - return res; -} - - -/* async_stmt: ASYNC (funcdef | with_stmt | for_stmt) */ - -static int -validate_async_stmt(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, async_stmt) - && validate_ntype(CHILD(tree, 0), ASYNC)); - - if (nch != 2) { - res = 0; - err_string("illegal number of children for async_stmt"); - } else { - if (TYPE(CHILD(tree, 1)) == funcdef) { - res = validate_funcdef(CHILD(tree, 1)); - } - else if (TYPE(CHILD(tree, 1)) == with_stmt) { - res = validate_with_stmt(CHILD(tree, 1)); - } - else if (TYPE(CHILD(tree, 1)) == for_stmt) { - res = validate_for(CHILD(tree, 1)); - } - } - - return res; -} - - - -/* decorated - * decorators (classdef | funcdef) - */ -static int -validate_decorated(node *tree) -{ - int nch = NCH(tree); - int ok = (validate_ntype(tree, decorated) - && (nch == 2) - && validate_decorators(RCHILD(tree, -2))); - if (TYPE(RCHILD(tree, -1)) == funcdef) - ok = ok && validate_funcdef(RCHILD(tree, -1)); - else - ok = ok && validate_class(RCHILD(tree, -1)); - return ok; -} - -static int -validate_lambdef(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, lambdef) - && ((nch == 3) || (nch == 4)) - && validate_name(CHILD(tree, 0), "lambda") - && validate_colon(CHILD(tree, nch - 2)) - && validate_test(CHILD(tree, nch - 1))); - - if (res && (nch == 4)) - res = validate_varargslist(CHILD(tree, 1)); - else if (!res && !PyErr_Occurred()) - (void) validate_numnodes(tree, 3, "lambdef"); - - return (res); -} - - -static int -validate_lambdef_nocond(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, lambdef_nocond) - && ((nch == 3) || (nch == 4)) - && validate_name(CHILD(tree, 0), "lambda") - && validate_colon(CHILD(tree, nch - 2)) - && validate_test(CHILD(tree, nch - 1))); - - if (res && (nch == 4)) - res = validate_varargslist(CHILD(tree, 1)); - else if (!res && !PyErr_Occurred()) - (void) validate_numnodes(tree, 3, "lambdef_nocond"); - - return (res); -} - - -/* arglist: - * - * (argument ',')* (argument [','] | '*' test [',' '**' test] | '**' test) - */ -static int -validate_arglist(node *tree) -{ - int nch = NCH(tree); - int i = 0; - int ok = 1; - - if (nch <= 0) - /* raise the right error from having an invalid number of children */ - return validate_numnodes(tree, nch + 1, "arglist"); - - if (nch > 1) { - for (i=0; i= 2) { - /* skip leading (argument ',') */ - ok = (validate_argument(CHILD(tree, i)) - && validate_comma(CHILD(tree, i+1))); - if (ok) - i += 2; - else - PyErr_Clear(); - } - ok = 1; - if (nch-i > 0) { - int sym = TYPE(CHILD(tree, i)); - - if (sym == argument) { - ok = validate_argument(CHILD(tree, i)); - if (ok && i+1 != nch) { - err_string("illegal arglist specification" - " (extra stuff on end)"); - ok = 0; - } - } - else { - err_string("illegal arglist specification"); - ok = 0; - } - } - return (ok); -} - - - -/* argument: ( test [comp_for] | - * test '=' test | - * '**' test | - * '*' test ) - */ -static int -validate_argument(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, argument) - && ((nch == 1) || (nch == 2) || (nch == 3))); - - if (res) { - if (TYPE(CHILD(tree, 0)) == DOUBLESTAR) { - res = validate_test(CHILD(tree, 1)); - } - else if (TYPE(CHILD(tree, 0)) == STAR) { - res = validate_test(CHILD(tree, 1)); - } - else if (nch == 1) { - res = validate_test(CHILD(tree, 0)); - } - else if (nch == 2) { - res = (validate_test(CHILD(tree, 0)) - && validate_comp_for(CHILD(tree, 1))); - } - else if (res && (nch == 3)) { - res = (validate_test(CHILD(tree, 0)) - && validate_equal(CHILD(tree, 1)) - && validate_test(CHILD(tree, 2))); - } - } - return (res); -} - - - -/* trailer: - * - * '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME - */ -static int -validate_trailer(node *tree) -{ - int nch = NCH(tree); - int res = validate_ntype(tree, trailer) && ((nch == 2) || (nch == 3)); - - if (res) { - switch (TYPE(CHILD(tree, 0))) { - case LPAR: - res = validate_rparen(CHILD(tree, nch - 1)); - if (res && (nch == 3)) - res = validate_arglist(CHILD(tree, 1)); - break; - case LSQB: - res = (validate_numnodes(tree, 3, "trailer") - && validate_subscriptlist(CHILD(tree, 1)) - && validate_ntype(CHILD(tree, 2), RSQB)); - break; - case DOT: - res = (validate_numnodes(tree, 2, "trailer") - && validate_ntype(CHILD(tree, 1), NAME)); - break; - default: - res = 0; - break; - } - } - else { - (void) validate_numnodes(tree, 2, "trailer"); - } - return (res); -} - - -/* subscriptlist: - * - * subscript (',' subscript)* [','] - */ -static int -validate_subscriptlist(node *tree) -{ - return (validate_repeating_list(tree, subscriptlist, - validate_subscript, "subscriptlist")); -} - - -/* subscript: - * - * '.' '.' '.' | test | [test] ':' [test] [sliceop] - */ -static int -validate_subscript(node *tree) -{ - int offset = 0; - int nch = NCH(tree); - int res = validate_ntype(tree, subscript) && (nch >= 1) && (nch <= 4); - - if (!res) { - if (!PyErr_Occurred()) - err_string("invalid number of arguments for subscript node"); - return (0); - } - if (TYPE(CHILD(tree, 0)) == DOT) - /* take care of ('.' '.' '.') possibility */ - return (validate_numnodes(tree, 3, "subscript") - && validate_dot(CHILD(tree, 0)) - && validate_dot(CHILD(tree, 1)) - && validate_dot(CHILD(tree, 2))); - if (nch == 1) { - if (TYPE(CHILD(tree, 0)) == test) - res = validate_test(CHILD(tree, 0)); - else - res = validate_colon(CHILD(tree, 0)); - return (res); - } - /* Must be [test] ':' [test] [sliceop], - * but at least one of the optional components will - * be present, but we don't know which yet. - */ - if ((TYPE(CHILD(tree, 0)) != COLON) || (nch == 4)) { - res = validate_test(CHILD(tree, 0)); - offset = 1; - } - if (res) - res = validate_colon(CHILD(tree, offset)); - if (res) { - int rem = nch - ++offset; - if (rem) { - if (TYPE(CHILD(tree, offset)) == test) { - res = validate_test(CHILD(tree, offset)); - ++offset; - --rem; - } - if (res && rem) - res = validate_sliceop(CHILD(tree, offset)); - } - } - return (res); -} - - -static int -validate_sliceop(node *tree) -{ - int nch = NCH(tree); - int res = ((nch == 1) || validate_numnodes(tree, 2, "sliceop")) - && validate_ntype(tree, sliceop); - if (!res && !PyErr_Occurred()) { - res = validate_numnodes(tree, 1, "sliceop"); - } - if (res) - res = validate_colon(CHILD(tree, 0)); - if (res && (nch == 2)) - res = validate_test(CHILD(tree, 1)); - - return (res); -} - - -static int -validate_test_or_star_expr(node *n) -{ - if (TYPE(n) == test) - return validate_test(n); - return validate_star_expr(n); -} - -static int -validate_expr_or_star_expr(node *n) -{ - if (TYPE(n) == expr) - return validate_expr(n); - return validate_star_expr(n); -} - - -static int -validate_exprlist(node *tree) -{ - return (validate_repeating_list(tree, exprlist, - validate_expr_or_star_expr, "exprlist")); -} - -/* Incrementing validate functions returns nonzero iff success (like other - * validate functions, and advance *i by the length of the matched pattern. */ - -/* test ':' test */ -static int -validate_test_colon_test_inc(node *tree, int *i) -{ - return (validate_test(CHILD(tree, (*i)++)) - && validate_colon(CHILD(tree, (*i)++)) - && validate_test(CHILD(tree, (*i)++))); -} - -/* test ':' test | '**' expr */ -static int -validate_dict_element_inc(node *tree, int *i) -{ - int nch = NCH(tree); - int res = 0; - if (nch - *i >= 2) { - if (TYPE(CHILD(tree, *i+1)) == COLON) { - /* test ':' test */ - res = validate_test_colon_test_inc(tree, i); - } else { - /* '**' expr */ - res = (validate_doublestar(CHILD(tree, (*i)++)) - && validate_expr(CHILD(tree, (*i)++))); - } - } - return res; -} - -/* - * dictorsetmaker: - * - * ( ((test ':' test | '**' expr) - * (comp_for | (',' (test ':' test | '**' expr))* [','])) | - * ((test | '*' test) - * (comp_for | (',' (test | '*' test))* [','])) ) - */ -static int -validate_dictorsetmaker(node *tree) -{ - int nch = NCH(tree); - int res; - int i = 0; - - res = validate_ntype(tree, dictorsetmaker); - if (!res) - return 0; - - if (nch - i < 1) { - /* Unconditionally raise. */ - (void) validate_numnodes(tree, 1, "dictorsetmaker"); - return 0; - } - - if (nch - i >= 2 - && ((TYPE(CHILD(tree, i+1)) == COLON) || - (TYPE(CHILD(tree, i)) == DOUBLESTAR))) { - /* Dictionary display or dictionary comprehension. */ - if (nch - i >= 4 && TYPE(CHILD(tree, i+3)) == comp_for) { - /* Dictionary comprehension. */ - res = (validate_test_colon_test_inc(tree, &i) - && validate_comp_for(CHILD(tree, i++))); - if (!res) - return 0; - } else { - /* Dictionary display. */ - return validate_repeating_list_variable( - tree, - dictorsetmaker, - validate_dict_element_inc, - &i, - "dictorsetmaker"); - } - } else { - /* Set display or set comprehension. */ - if (nch - i >= 2 && TYPE(CHILD(tree, i + 1)) == comp_for) { - /* Set comprehension. */ - res = (validate_test(CHILD(tree, i++)) - && validate_comp_for(CHILD(tree, i++))); - if (!res) - return 0; - } else { - /* Set display. */ - return validate_repeating_list(tree, - dictorsetmaker, - validate_test_or_star_expr, - "dictorsetmaker"); - } - } - - if (nch - i > 0) { - err_string("Illegal trailing nodes for dictorsetmaker."); - return 0; - } - - return 1; -} - - -static int -validate_eval_input(node *tree) -{ - int pos; - int nch = NCH(tree); - int res = (validate_ntype(tree, eval_input) - && (nch >= 2) - && validate_testlist(CHILD(tree, 0)) - && validate_ntype(CHILD(tree, nch - 1), ENDMARKER)); - - for (pos = 1; res && (pos < (nch - 1)); ++pos) - res = validate_ntype(CHILD(tree, pos), NEWLINE); - - return (res); -} - - -static int -validate_node(node *tree) -{ - int nch = 0; /* num. children on current node */ - int res = 1; /* result value */ - node* next = 0; /* node to process after this one */ - - while (res && (tree != 0)) { - nch = NCH(tree); - next = 0; - switch (TYPE(tree)) { - /* - * Definition nodes. - */ - case async_funcdef: - res = validate_async_funcdef(tree); - break; - case async_stmt: - res = validate_async_stmt(tree); - break; - case funcdef: - res = validate_funcdef(tree); - break; - case with_stmt: - res = validate_with_stmt(tree); - break; - case classdef: - res = validate_class(tree); - break; - case decorated: - res = validate_decorated(tree); - break; - /* - * "Trivial" parse tree nodes. - * (Why did I call these trivial?) - */ - case stmt: - res = validate_stmt(tree); - break; - case small_stmt: - /* - * expr_stmt | del_stmt | pass_stmt | flow_stmt | - * import_stmt | global_stmt | nonlocal_stmt | assert_stmt - */ - res = validate_small_stmt(tree); - break; - case flow_stmt: - res = (validate_numnodes(tree, 1, "flow_stmt") - && ((TYPE(CHILD(tree, 0)) == break_stmt) - || (TYPE(CHILD(tree, 0)) == continue_stmt) - || (TYPE(CHILD(tree, 0)) == yield_stmt) - || (TYPE(CHILD(tree, 0)) == return_stmt) - || (TYPE(CHILD(tree, 0)) == raise_stmt))); - if (res) - next = CHILD(tree, 0); - else if (nch == 1) - err_string("illegal flow_stmt type"); - break; - case yield_stmt: - res = validate_yield_stmt(tree); - break; - /* - * Compound statements. - */ - case simple_stmt: - res = validate_simple_stmt(tree); - break; - case compound_stmt: - res = validate_compound_stmt(tree); - break; - /* - * Fundamental statements. - */ - case expr_stmt: - res = validate_expr_stmt(tree); - break; - case del_stmt: - res = validate_del_stmt(tree); - break; - case pass_stmt: - res = (validate_numnodes(tree, 1, "pass") - && validate_name(CHILD(tree, 0), "pass")); - break; - case break_stmt: - res = (validate_numnodes(tree, 1, "break") - && validate_name(CHILD(tree, 0), "break")); - break; - case continue_stmt: - res = (validate_numnodes(tree, 1, "continue") - && validate_name(CHILD(tree, 0), "continue")); - break; - case return_stmt: - res = validate_return_stmt(tree); - break; - case raise_stmt: - res = validate_raise_stmt(tree); - break; - case import_stmt: - res = validate_import_stmt(tree); - break; - case import_name: - res = validate_import_name(tree); - break; - case import_from: - res = validate_import_from(tree); - break; - case global_stmt: - res = validate_global_stmt(tree); - break; - case nonlocal_stmt: - res = validate_nonlocal_stmt(tree); - break; - case assert_stmt: - res = validate_assert_stmt(tree); - break; - case if_stmt: - res = validate_if(tree); - break; - case while_stmt: - res = validate_while(tree); - break; - case for_stmt: - res = validate_for(tree); - break; - case try_stmt: - res = validate_try(tree); - break; - case suite: - res = validate_suite(tree); - break; - /* - * Expression nodes. - */ - case testlist: - res = validate_testlist(tree); - break; - case yield_expr: - res = validate_yield_expr(tree); - break; - case test: - res = validate_test(tree); - break; - case and_test: - res = validate_and_test(tree); - break; - case not_test: - res = validate_not_test(tree); - break; - case comparison: - res = validate_comparison(tree); - break; - case exprlist: - res = validate_exprlist(tree); - break; - case comp_op: - res = validate_comp_op(tree); - break; - case expr: - res = validate_expr(tree); - break; - case xor_expr: - res = validate_xor_expr(tree); - break; - case and_expr: - res = validate_and_expr(tree); - break; - case shift_expr: - res = validate_shift_expr(tree); - break; - case arith_expr: - res = validate_arith_expr(tree); - break; - case term: - res = validate_term(tree); - break; - case factor: - res = validate_factor(tree); - break; - case power: - res = validate_power(tree); - break; - case atom: - res = validate_atom(tree); - break; - - default: - /* Hopefully never reached! */ - err_string("unrecognized node type"); - res = 0; - break; - } - tree = next; - } - return (res); -} - - -static int -validate_expr_tree(node *tree) -{ - int res = validate_eval_input(tree); - - if (!res && !PyErr_Occurred()) - err_string("could not validate expression tuple"); - - return (res); -} - - -/* file_input: - * (NEWLINE | stmt)* ENDMARKER - */ -static int -validate_file_input(node *tree) -{ - int j; - int nch = NCH(tree) - 1; - int res = ((nch >= 0) - && validate_ntype(CHILD(tree, nch), ENDMARKER)); - - for (j = 0; res && (j < nch); ++j) { - if (TYPE(CHILD(tree, j)) == stmt) - res = validate_stmt(CHILD(tree, j)); - else - res = validate_newline(CHILD(tree, j)); - } - /* This stays in to prevent any internal failures from getting to the - * user. Hopefully, this won't be needed. If a user reports getting - * this, we have some debugging to do. - */ - if (!res && !PyErr_Occurred()) - err_string("VALIDATION FAILURE: report this to the maintainer!"); - - return (res); -} - -static int -validate_encoding_decl(node *tree) -{ - int nch = NCH(tree); - int res = ((nch == 1) - && validate_file_input(CHILD(tree, 0))); - - if (!res && !PyErr_Occurred()) - err_string("Error Parsing encoding_decl"); - - return res; -} - static PyObject* pickle_constructor = NULL; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 14:36:51 2016 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 02 Jun 2016 18:36:51 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_note_that_Py?= =?utf-8?q?=5FVISIT_handles_NULL_=28closes_=2327183=29?= Message-ID: <20160602183623.893.91449.4C9EE7FE@psf.io> https://hg.python.org/cpython/rev/7c67cb3b54b4 changeset: 101602:7c67cb3b54b4 branch: 3.5 parent: 101599:ef800c30e28c user: Benjamin Peterson date: Thu Jun 02 11:35:59 2016 -0700 summary: note that Py_VISIT handles NULL (closes #27183) files: Doc/c-api/gcsupport.rst | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) 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 @@ -126,9 +126,10 @@ .. 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, :c:member:`~PyTypeObject.tp_traverse` - handlers look like:: + If *o* is not *NULL*, call the *visit* callback, with arguments *o* + and *arg*. If *visit* returns a non-zero value, then return it. + Using this macro, :c:member:`~PyTypeObject.tp_traverse` handlers + look like:: static int my_traverse(Noddy *self, visitproc visit, void *arg) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 14:36:51 2016 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 02 Jun 2016 18:36:51 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogbWVyZ2UgMy41?= Message-ID: <20160602183628.4929.12196.7AED5FD5@psf.io> https://hg.python.org/cpython/rev/00c95b0e82e4 changeset: 101604:00c95b0e82e4 parent: 101601:4a9159ea2536 parent: 101602:7c67cb3b54b4 user: Benjamin Peterson date: Thu Jun 02 11:36:16 2016 -0700 summary: merge 3.5 files: Doc/c-api/gcsupport.rst | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) 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 @@ -126,9 +126,10 @@ .. 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, :c:member:`~PyTypeObject.tp_traverse` - handlers look like:: + If *o* is not *NULL*, call the *visit* callback, with arguments *o* + and *arg*. If *visit* returns a non-zero value, then return it. + Using this macro, :c:member:`~PyTypeObject.tp_traverse` handlers + look like:: static int my_traverse(Noddy *self, visitproc visit, void *arg) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 14:36:51 2016 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 02 Jun 2016 18:36:51 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_note_that_Py?= =?utf-8?q?=5FVISIT_handles_NULL_=28closes_=2327183=29?= Message-ID: <20160602183628.2216.68302.D2CB073C@psf.io> https://hg.python.org/cpython/rev/42356e44af23 changeset: 101603:42356e44af23 branch: 2.7 parent: 101597:b0b463760b45 user: Benjamin Peterson date: Thu Jun 02 11:35:59 2016 -0700 summary: note that Py_VISIT handles NULL (closes #27183) files: Doc/c-api/gcsupport.rst | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) 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 @@ -137,9 +137,10 @@ .. 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, :c:member:`~PyTypeObject.tp_traverse` - handlers look like:: + If *o* is not *NULL*, call the *visit* callback, with arguments *o* + and *arg*. If *visit* returns a non-zero value, then return it. + Using this macro, :c:member:`~PyTypeObject.tp_traverse` handlers + look like:: static int my_traverse(Noddy *self, visitproc visit, void *arg) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 15:08:02 2016 From: python-checkins at python.org (berker.peksag) Date: Thu, 02 Jun 2016 19:08:02 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzE2MTky?= =?utf-8?q?=3A_Clarify_when_c=5Fint_is_an_alias_to_c=5Flong_in_ctypes_docu?= =?utf-8?q?mentation?= Message-ID: <20160602190759.5055.63763.330E8139@psf.io> https://hg.python.org/cpython/rev/1775abf47061 changeset: 101605:1775abf47061 branch: 3.5 parent: 101602:7c67cb3b54b4 user: Berker Peksag date: Thu Jun 02 12:17:51 2016 -0700 summary: Issue #16192: Clarify when c_int is an alias to c_long in ctypes documentation files: Doc/library/ctypes.rst | 9 ++++----- 1 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 @@ -20,11 +20,10 @@ they actually work. Since some code samples behave differently under Linux, Windows, or Mac OS X, they contain doctest directives in comments. -Note: Some code samples reference the ctypes :class:`c_int` type. This type is -an alias for the :class:`c_long` type on 32-bit systems. So, you should not be -confused if :class:`c_long` is printed if you would expect :class:`c_int` --- -they are actually the same type. - +Note: Some code samples reference the ctypes :class:`c_int` type. On platforms +where ``sizeof(long double) == sizeof(double)`` it is an alias to +:class:`c_double`. So, you should not be confused if :class:`c_long` is +printed if you would expect :class:`c_int` --- they are actually the same type. .. _ctypes-loading-dynamic-link-libraries: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 15:08:52 2016 From: python-checkins at python.org (berker.peksag) Date: Thu, 02 Jun 2016 19:08:52 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2316192=3A_Merge_from_3=2E5?= Message-ID: <20160602190759.119799.52959.6FA3E2D9@psf.io> https://hg.python.org/cpython/rev/9954e29b8678 changeset: 101606:9954e29b8678 parent: 101604:00c95b0e82e4 parent: 101605:1775abf47061 user: Berker Peksag date: Thu Jun 02 12:18:21 2016 -0700 summary: Issue #16192: Merge from 3.5 files: Doc/library/ctypes.rst | 9 ++++----- 1 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 @@ -20,11 +20,10 @@ they actually work. Since some code samples behave differently under Linux, Windows, or Mac OS X, they contain doctest directives in comments. -Note: Some code samples reference the ctypes :class:`c_int` type. This type is -an alias for the :class:`c_long` type on 32-bit systems. So, you should not be -confused if :class:`c_long` is printed if you would expect :class:`c_int` --- -they are actually the same type. - +Note: Some code samples reference the ctypes :class:`c_int` type. On platforms +where ``sizeof(long double) == sizeof(double)`` it is an alias to +:class:`c_double`. So, you should not be confused if :class:`c_long` is +printed if you would expect :class:`c_int` --- they are actually the same type. .. _ctypes-loading-dynamic-link-libraries: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 15:08:52 2016 From: python-checkins at python.org (nick.coghlan) Date: Thu, 02 Jun 2016 19:08:52 +0000 Subject: [Python-checkins] =?utf-8?q?devguide=3A_Move_core_dev_affiliation?= =?utf-8?q?_list_above_page_rationale?= Message-ID: <20160602183633.72859.22088.B35AADA5@psf.io> https://hg.python.org/devguide/rev/dd2ffafaebd1 changeset: 806:dd2ffafaebd1 user: Nick Coghlan date: Thu Jun 02 11:36:28 2016 -0700 summary: Move core dev affiliation list above page rationale Suggested by Bretty Cannon files: motivations.rst | 180 ++++++++++++++++++----------------- 1 files changed, 92 insertions(+), 88 deletions(-) diff --git a/motivations.rst b/motivations.rst --- a/motivations.rst +++ b/motivations.rst @@ -18,91 +18,13 @@ entry to the :ref:`published-motivations` section below. Guidelines relating to content and layout are included as comments in the source code for this page. -Core developers that are available for training, consulting or contract work, -or are seeking crowdfunding support for their community contributions, may also -choose to provide that information here (including linking out to commercial -sites with the relevant details). +Core developers that are available for training, consulting, contract, or +full-time work, or are seeking crowdfunding support for their community +contributions, may also choose to provide that information here (including +linking out to commercial sites with the relevant details). -Goals of this page ------------------- - -The `issue metrics`_ automatically collected by the CPython issue tracker -strongly suggest that the current core development process is bottlenecked on -core developer time - this is most clearly indicated in the first metrics graph, -which shows both the number of open issues and the number of patches awaiting -review growing steadily over time, despite CPython being one of the most -active open source projects in the world. This bottleneck then impacts not only -resolving open issues and applying submitted patches, but also the process of -identifying, nominating and mentoring new core developers. - -The core commit statistics monitored by sites like `OpenHub`_ provide a good -record as to *who* is currently handling the bulk of the review and maintenance -work, but don't provide any indication as to the factors currently influencing -people's ability to spend time on reviewing proposed changes, or mentoring new -contributors. - -This page aims to provide at least some of that missing data by encouraging -core developers to highlight professional affiliations in the following two -cases (even if not currently paid for time spent participating in the core -development process): - -* developers working for vendors that distribute a commercially supported - Python runtime -* developers working for Sponsor Members of the Python Software Foundation - -These are cases where documenting our affiliations helps to improve the -overall transparency of the core development process, as well as making it -easier for staff at these organisations to locate colleagues that can help -them to participate in and contribute effectively to supporting the core -development process. - -Core developers working for organisations with a vested interest in the -sustainability of the CPython core development process are also encouraged to -seek opportunities to spend work time on mentoring potential new core -developers, whether through the general `core mentorship program`_, through -mentoring colleagues, or through more targeted efforts like Outreachy's paid -`internships`_ and Google's `Summer of Code`_. - -Core developers that are available for consulting or contract work on behalf of -the Python Software Foundation or other organisations are also encouraged -to provide that information here, as this will help the PSF to better -facilitate funding of core development work by organisations that don't -directly employ any core developers themselves. - -Finally, some core developers seeking to increase the time they have available -to contribute to CPython may wish to pursue crowdfunding efforts that allow -their contributions to be funded directly by the community, rather than relying -on institutional sponsors allowing them to spend some or all of their work -time contributing to CPython development. - -.. _issue metrics: http://bugs.python.org/issue?@template=stats -.. _OpenHub: https://www.openhub.net/p/python/contributors -.. _core mentorship program: http://pythonmentors.com/ -.. _internships: https://www.gnome.org/outreachy/ -.. _Summer of Code: https://wiki.python.org/moin/SummerOfCode/2016 - - -Limitations on scope --------------------- - -* Specific technical areas of interest for core developers should be captured in - the :ref:`Experts Index `. - -* This specific listing is limited to CPython core developers (since it's - focused on the specific constraint that is core developer time), but it - would be possible to create a more expansive listing on the Python wiki that - also covers issue triagers, and folks seeking to become core developers. - -* Changes to the software and documentation maintained by core developers, - together with related design discussions, all take place in public venues, and - hence are inherently subject to full public review. Accordingly, core - developers are NOT required to publish their motivations and affiliations if - they do not choose to do so. This helps to ensure that core contribution - processes remain open to anyone that is in a position to sign the `Contributor - Licensing Agreement`_, the details of which are filed privately with the Python - Software Foundation, rather than publicly. - -.. _Contributor Licensing Agreement: https://www.python.org/psf/contrib/contrib-form/ +For more information on the origins and purpose of this page, see +:ref:`goals-of-the-motivations-page`. .. _published-motivations: @@ -170,7 +92,6 @@ python-committers is also the appropriate point of contact for any other questions or suggestions relating to this page. - .. topic:: Brett Cannon (Canada) * Personal site: `snarky.ca `_ @@ -178,7 +99,6 @@ * Microsoft (Software Developer) * Python Software Foundation (Fellow) - .. topic:: Nick Coghlan (Australia) * Personal site: `Curious Efficiency `_ @@ -228,7 +148,7 @@ .. topic:: Victor Stinner (France) - * `Personal website `_ + * `Personal website `__ * Red Hat (Senior Software Engineer) Victor is hacking the development version of CPython to make Python better @@ -236,6 +156,90 @@ .. topic:: Kushal Das (India) - * `Personal website `_ + * `Personal website `__ * Red Hat (Fedora Cloud Engineer) * Python Software Foundation (Fellow) + + +.. _goals-of-the-motivations-page: + +Goals of this page +------------------ + +The `issue metrics`_ automatically collected by the CPython issue tracker +strongly suggest that the current core development process is bottlenecked on +core developer time - this is most clearly indicated in the first metrics graph, +which shows both the number of open issues and the number of patches awaiting +review growing steadily over time, despite CPython being one of the most +active open source projects in the world. This bottleneck then impacts not only +resolving open issues and applying submitted patches, but also the process of +identifying, nominating and mentoring new core developers. + +The core commit statistics monitored by sites like `OpenHub`_ provide a good +record as to *who* is currently handling the bulk of the review and maintenance +work, but don't provide any indication as to the factors currently influencing +people's ability to spend time on reviewing proposed changes, or mentoring new +contributors. + +This page aims to provide at least some of that missing data by encouraging +core developers to highlight professional affiliations in the following two +cases (even if not currently paid for time spent participating in the core +development process): + +* developers working for vendors that distribute a commercially supported + Python runtime +* developers working for Sponsor Members of the Python Software Foundation + +These are cases where documenting our affiliations helps to improve the +overall transparency of the core development process, as well as making it +easier for staff at these organisations to locate colleagues that can help +them to participate in and contribute effectively to supporting the core +development process. + +Core developers working for organisations with a vested interest in the +sustainability of the CPython core development process are also encouraged to +seek opportunities to spend work time on mentoring potential new core +developers, whether through the general `core mentorship program`_, through +mentoring colleagues, or through more targeted efforts like Outreachy's paid +`internships`_ and Google's `Summer of Code`_. + +Core developers that are available for consulting or contract work on behalf of +the Python Software Foundation or other organisations are also encouraged +to provide that information here, as this will help the PSF to better +facilitate funding of core development work by organisations that don't +directly employ any core developers themselves. + +Finally, some core developers seeking to increase the time they have available +to contribute to CPython may wish to pursue crowdfunding efforts that allow +their contributions to be funded directly by the community, rather than relying +on institutional sponsors allowing them to spend some or all of their work +time contributing to CPython development. + +.. _issue metrics: http://bugs.python.org/issue?@template=stats +.. _OpenHub: https://www.openhub.net/p/python/contributors +.. _core mentorship program: http://pythonmentors.com/ +.. _internships: https://www.gnome.org/outreachy/ +.. _Summer of Code: https://wiki.python.org/moin/SummerOfCode/2016 + + +Limitations on scope +-------------------- + +* Specific technical areas of interest for core developers should be captured in + the :ref:`Experts Index `. + +* This specific listing is limited to CPython core developers (since it's + focused on the specific constraint that is core developer time), but it + would be possible to create a more expansive listing on the Python wiki that + also covers issue triagers, and folks seeking to become core developers. + +* Changes to the software and documentation maintained by core developers, + together with related design discussions, all take place in public venues, and + hence are inherently subject to full public review. Accordingly, core + developers are NOT required to publish their motivations and affiliations if + they do not choose to do so. This helps to ensure that core contribution + processes remain open to anyone that is in a position to sign the `Contributor + Licensing Agreement`_, the details of which are filed privately with the Python + Software Foundation, rather than publicly. + +.. _Contributor Licensing Agreement: https://www.python.org/psf/contrib/contrib-form/ -- Repository URL: https://hg.python.org/devguide From python-checkins at python.org Thu Jun 2 15:11:37 2016 From: python-checkins at python.org (nick.coghlan) Date: Thu, 02 Jun 2016 19:11:37 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Officially_defer_PEP_426_=28M?= =?utf-8?q?etadata_2=2E0=29?= Message-ID: <20160602191131.72888.24584.8348ED52@psf.io> https://hg.python.org/peps/rev/94c1afae202e changeset: 6346:94c1afae202e user: Nick Coghlan date: Thu Jun 02 12:11:25 2016 -0700 summary: Officially defer PEP 426 (Metadata 2.0) files: pep-0426.txt | 49 +++++++++++++++++++++++---------------- 1 files changed, 29 insertions(+), 20 deletions(-) diff --git a/pep-0426.txt b/pep-0426.txt --- a/pep-0426.txt +++ b/pep-0426.txt @@ -7,7 +7,7 @@ Donald Stufft BDFL-Delegate: Nick Coghlan Discussions-To: Distutils SIG -Status: Draft +Status: Deferred Type: Standards Track Content-Type: text/x-rst Requires: 440 @@ -39,13 +39,37 @@ several issues with the previous iteration of the standard version identification scheme. +PEP Deferral +============ + +Migrating to a new metadata format is current deferred indefinitely, with +distutils-sig instead focusing on a more incremental approach to allowing +parts of the ecosystem to be independently upgraded without breaking the world. + +Some of those incremental improvements include: + +* PEP 425, defining a compatibility tagging mechanism for binary files +* PEP 427, defining the pre-built "wheel" format +* PEP 440, covering the versioning identification and selection scheme +* PEP 503, ``/simple/`` package repository API +* PEP 508, covering dependency declarations and environment markers +* PEP 513, defining the "manylinux1" compatibility tag +* PEP 518, defining a static config file for sdist build system dependencies + +Other planned improvements in various stages of development include: + +* Supporting build systems that don't provide the `setup.py` command +* Supporting additional semantic categories for distribution contents (based on + GNU autotools) +* Support for declaring dependencies on shared system libraries + .. note:: "I" in this doc refers to Nick Coghlan. Daniel and Donald either wrote or - contributed to earlier versions, and have been providing feedback as this - JSON-based rewrite has taken shape. Daniel and Donald have also been - vetting the proposal as we go to ensure it is practical to implement for - both clients and index servers. + contributed to earlier versions, and provided feedback as the JSON-based + rewrite took shape. Daniel and Donald were also vetting the proposal as we + went to ensure it remained practical to implement for both clients and + index servers. Metadata 2.0 represents a major upgrade to the Python packaging ecosystem, and attempts to incorporate experience gained over the 15 years(!) since @@ -58,21 +82,6 @@ source packages for at least Debian and Fedora, and perhaps other platform specific distribution systems). - There will eventually be a suite of PEPs covering various aspects of - the metadata 2.0 format and related systems: - - * this PEP, covering the core metadata format - * PEP 440, covering the versioning identification and selection scheme - * PEP 459, covering several standard extensions - * PEP 496, covering environment markers - * a yet-to-be-written PEP to define v2.0 of the sdist format - * an updated wheel PEP (v1.1) to add pydist.json (and possibly convert - the wheel metadata file from Key:Value to JSON) - * an updated installation database PEP to add pydist.json - * a PEP to standardise the expected command line interface for setup.py - as an interface to an application's build system (rather than requiring - that the build system support the distutils command system) - It's going to take a while to work through all of these and make them a reality. The main change from our last attempt at this is that we're trying to design the different pieces so we can implement them -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Thu Jun 2 15:15:44 2016 From: python-checkins at python.org (r.david.murray) Date: Thu, 02 Jun 2016 19:15:44 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge=3A_=2313784=3A_fix_xml=2Esax=2Ereader_getColumn/Li?= =?utf-8?q?neNumber_docs=2E?= Message-ID: <20160602191539.877.26796.8E7F9650@psf.io> https://hg.python.org/cpython/rev/cce04851d2e2 changeset: 101609:cce04851d2e2 parent: 101606:9954e29b8678 parent: 101608:9d6a9e2ae18b user: R David Murray date: Thu Jun 02 15:15:12 2016 -0400 summary: Merge: #13784: fix xml.sax.reader getColumn/LineNumber docs. files: Doc/library/xml.sax.reader.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/xml.sax.reader.rst b/Doc/library/xml.sax.reader.rst --- a/Doc/library/xml.sax.reader.rst +++ b/Doc/library/xml.sax.reader.rst @@ -228,12 +228,12 @@ .. method:: Locator.getColumnNumber() - Return the column number where the current event ends. + Return the column number where the current event begins. .. method:: Locator.getLineNumber() - Return the line number where the current event ends. + Return the line number where the current event begins. .. method:: Locator.getPublicId() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 15:15:44 2016 From: python-checkins at python.org (r.david.murray) Date: Thu, 02 Jun 2016 19:15:44 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzEzNzg0OiBmaXgg?= =?utf-8?q?xml=2Esax=2Ereader_getColumn/LineNumber_docs=2E?= Message-ID: <20160602191539.70566.22214.B6E17E84@psf.io> https://hg.python.org/cpython/rev/97b76fe183f4 changeset: 101607:97b76fe183f4 branch: 2.7 parent: 101603:42356e44af23 user: R David Murray date: Thu Jun 02 15:13:37 2016 -0400 summary: #13784: fix xml.sax.reader getColumn/LineNumber docs. verification and patch by Emily Morehouse. files: Doc/library/xml.sax.reader.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/xml.sax.reader.rst b/Doc/library/xml.sax.reader.rst --- a/Doc/library/xml.sax.reader.rst +++ b/Doc/library/xml.sax.reader.rst @@ -229,12 +229,12 @@ .. method:: Locator.getColumnNumber() - Return the column number where the current event ends. + Return the column number where the current event begins. .. method:: Locator.getLineNumber() - Return the line number where the current event ends. + Return the line number where the current event begins. .. method:: Locator.getPublicId() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 15:15:51 2016 From: python-checkins at python.org (r.david.murray) Date: Thu, 02 Jun 2016 19:15:51 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogIzEzNzg0OiBmaXgg?= =?utf-8?q?xml=2Esax=2Ereader_getColumn/LineNumber_docs=2E?= Message-ID: <20160602191539.957.52649.CAF73C08@psf.io> https://hg.python.org/cpython/rev/9d6a9e2ae18b changeset: 101608:9d6a9e2ae18b branch: 3.5 parent: 101605:1775abf47061 user: R David Murray date: Thu Jun 02 15:14:30 2016 -0400 summary: #13784: fix xml.sax.reader getColumn/LineNumber docs. verification and patch by Emily Morehouse. files: Doc/library/xml.sax.reader.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/xml.sax.reader.rst b/Doc/library/xml.sax.reader.rst --- a/Doc/library/xml.sax.reader.rst +++ b/Doc/library/xml.sax.reader.rst @@ -228,12 +228,12 @@ .. method:: Locator.getColumnNumber() - Return the column number where the current event ends. + Return the column number where the current event begins. .. method:: Locator.getLineNumber() - Return the line number where the current event ends. + Return the line number where the current event begins. .. method:: Locator.getPublicId() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 15:21:53 2016 From: python-checkins at python.org (nick.coghlan) Date: Thu, 02 Jun 2016 19:21:53 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Defer_PEP_459_in_addition_to_?= =?utf-8?q?426?= Message-ID: <20160602192118.2056.79898.0478B97B@psf.io> https://hg.python.org/peps/rev/37875b427143 changeset: 6347:37875b427143 user: Nick Coghlan date: Thu Jun 02 12:21:13 2016 -0700 summary: Defer PEP 459 in addition to 426 files: pep-0459.txt | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/pep-0459.txt b/pep-0459.txt --- a/pep-0459.txt +++ b/pep-0459.txt @@ -5,7 +5,7 @@ Author: Nick Coghlan BDFL-Delegate: Nick Coghlan Discussions-To: Distutils SIG -Status: Draft +Status: Deferred Type: Standards Track Content-Type: text/x-rst Requires: 426 @@ -22,6 +22,12 @@ independently versioned. Changing any of the formats requires an update to this PEP, but does not require an update to the core packaging metadata. +PEP Deferral +============ + +This PEP depends on PEP 426, which has itself been deferred. See the +PEP Deferral section in that PEP for details. + .. note:: These extensions may eventually be separated out into their own PEPs, -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Thu Jun 2 15:45:03 2016 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 02 Jun 2016 19:45:03 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogcmVtb3ZlIChoaWxh?= =?utf-8?q?rious=29_defaults_for_various_constants_getpath=2Ec_needs?= Message-ID: <20160602194246.5132.25959.326E83A0@psf.io> https://hg.python.org/cpython/rev/a0d2c07f8706 changeset: 101610:a0d2c07f8706 branch: 3.5 parent: 101608:9d6a9e2ae18b user: Benjamin Peterson date: Thu Jun 02 12:41:35 2016 -0700 summary: remove (hilarious) defaults for various constants getpath.c needs files: Modules/getpath.c | 21 ++------------------- 1 files changed, 2 insertions(+), 19 deletions(-) diff --git a/Modules/getpath.c b/Modules/getpath.c --- a/Modules/getpath.c +++ b/Modules/getpath.c @@ -101,25 +101,8 @@ #endif -#ifndef VERSION -#define VERSION "2.1" -#endif - -#ifndef VPATH -#define VPATH "." -#endif - -#ifndef PREFIX -# define PREFIX "/usr/local" -#endif - -#ifndef EXEC_PREFIX -#define EXEC_PREFIX PREFIX -#endif - -#ifndef PYTHONPATH -#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \ - EXEC_PREFIX "/lib/python" VERSION "/lib-dynload" +#if !defined(PREFIX) || !defined(EXEC_PREFIX) || !defined(VERSION) || !defined(VPATH) +#error "PREFIX, EXEC_PREFIX, VERSION, and VPATH must be constant defined" #endif #ifndef LANDMARK -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 15:45:03 2016 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 02 Jun 2016 19:45:03 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogbWVyZ2UgMy41?= Message-ID: <20160602194246.5256.9123.AFB62226@psf.io> https://hg.python.org/cpython/rev/994da9fe66cb changeset: 101612:994da9fe66cb parent: 101609:cce04851d2e2 parent: 101610:a0d2c07f8706 user: Benjamin Peterson date: Thu Jun 02 12:42:40 2016 -0700 summary: merge 3.5 files: Modules/getpath.c | 21 ++------------------- 1 files changed, 2 insertions(+), 19 deletions(-) diff --git a/Modules/getpath.c b/Modules/getpath.c --- a/Modules/getpath.c +++ b/Modules/getpath.c @@ -101,25 +101,8 @@ #endif -#ifndef VERSION -#define VERSION "2.1" -#endif - -#ifndef VPATH -#define VPATH "." -#endif - -#ifndef PREFIX -# define PREFIX "/usr/local" -#endif - -#ifndef EXEC_PREFIX -#define EXEC_PREFIX PREFIX -#endif - -#ifndef PYTHONPATH -#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \ - EXEC_PREFIX "/lib/python" VERSION "/lib-dynload" +#if !defined(PREFIX) || !defined(EXEC_PREFIX) || !defined(VERSION) || !defined(VPATH) +#error "PREFIX, EXEC_PREFIX, VERSION, and VPATH must be constant defined" #endif #ifndef LANDMARK -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 15:45:03 2016 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 02 Jun 2016 19:45:03 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogcmVtb3ZlIChoaWxh?= =?utf-8?q?rious=29_defaults_for_various_constants_getpath=2Ec_needs?= Message-ID: <20160602194246.1001.72868.B2F7F3C7@psf.io> https://hg.python.org/cpython/rev/9533f28a9058 changeset: 101611:9533f28a9058 branch: 2.7 parent: 101607:97b76fe183f4 user: Benjamin Peterson date: Thu Jun 02 12:41:35 2016 -0700 summary: remove (hilarious) defaults for various constants getpath.c needs files: Modules/getpath.c | 25 ++----------------------- 1 files changed, 2 insertions(+), 23 deletions(-) diff --git a/Modules/getpath.c b/Modules/getpath.c --- a/Modules/getpath.c +++ b/Modules/getpath.c @@ -96,29 +96,8 @@ #endif -#ifndef VERSION -#define VERSION "2.1" -#endif - -#ifndef VPATH -#define VPATH "." -#endif - -#ifndef PREFIX -# ifdef __VMS -# define PREFIX "" -# else -# define PREFIX "/usr/local" -# endif -#endif - -#ifndef EXEC_PREFIX -#define EXEC_PREFIX PREFIX -#endif - -#ifndef PYTHONPATH -#define PYTHONPATH PREFIX "/lib/python" VERSION ":" \ - EXEC_PREFIX "/lib/python" VERSION "/lib-dynload" +#if !defined(PREFIX) || !defined(EXEC_PREFIX) || !defined(VERSION) || !defined(VPATH) +#error "PREFIX, EXEC_PREFIX, VERSION, and VPATH must be constant defined" #endif #ifndef LANDMARK -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 15:50:24 2016 From: python-checkins at python.org (r.david.murray) Date: Thu, 02 Jun 2016 19:50:24 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge=3A_=2320973=3A_add_total_ordering_tests_for_ipaddr?= =?utf-8?q?ess?= Message-ID: <20160602195013.4617.6911.11F4BC26@psf.io> https://hg.python.org/cpython/rev/503168ec3d4f changeset: 101614:503168ec3d4f parent: 101612:994da9fe66cb parent: 101613:ffaefb20dd06 user: R David Murray date: Thu Jun 02 15:49:41 2016 -0400 summary: Merge: #20973: add total ordering tests for ipaddress files: Lib/test/test_ipaddress.py | 33 ++++++++++++++++++++++++++ Misc/ACKS | 1 + 2 files changed, 34 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py --- a/Lib/test/test_ipaddress.py +++ b/Lib/test/test_ipaddress.py @@ -587,8 +587,16 @@ v4_objects = v4_addresses + [v4net] v6_addresses = [v6addr, v6intf] v6_objects = v6_addresses + [v6net] + objects = v4_objects + v6_objects + v4addr2 = ipaddress.IPv4Address(2) + v4net2 = ipaddress.IPv4Network(2) + v4intf2 = ipaddress.IPv4Interface(2) + v6addr2 = ipaddress.IPv6Address(2) + v6net2 = ipaddress.IPv6Network(2) + v6intf2 = ipaddress.IPv6Interface(2) + def test_foreign_type_equality(self): # __eq__ should never raise TypeError directly other = object() @@ -607,6 +615,31 @@ continue self.assertNotEqual(lhs, rhs) + def test_same_type_equality(self): + for obj in self.objects: + self.assertEqual(obj, obj) + self.assertLessEqual(obj, obj) + self.assertGreaterEqual(obj, obj) + + def test_same_type_ordering(self): + for lhs, rhs in ( + (self.v4addr, self.v4addr2), + (self.v4net, self.v4net2), + (self.v4intf, self.v4intf2), + (self.v6addr, self.v6addr2), + (self.v6net, self.v6net2), + (self.v6intf, self.v6intf2), + ): + self.assertNotEqual(lhs, rhs) + self.assertLess(lhs, rhs) + self.assertLessEqual(lhs, rhs) + self.assertGreater(rhs, lhs) + self.assertGreaterEqual(rhs, lhs) + self.assertFalse(lhs > rhs) + self.assertFalse(rhs < lhs) + self.assertFalse(lhs >= rhs) + self.assertFalse(rhs <= lhs) + def test_containment(self): for obj in self.v4_addresses: self.assertIn(obj, self.v4net) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -102,6 +102,7 @@ Anthony Baxter Mike Bayer Samuel L. Bayer +Tommy Beadle Donald Beaudry David Beazley John Beck -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 15:50:25 2016 From: python-checkins at python.org (r.david.murray) Date: Thu, 02 Jun 2016 19:50:25 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogIzIwOTczOiBhZGQg?= =?utf-8?q?total_ordering_tests_for_ipaddress?= Message-ID: <20160602195013.840.26530.1819B9C0@psf.io> https://hg.python.org/cpython/rev/ffaefb20dd06 changeset: 101613:ffaefb20dd06 branch: 3.5 parent: 101610:a0d2c07f8706 user: R David Murray date: Thu Jun 02 15:46:04 2016 -0400 summary: #20973: add total ordering tests for ipaddress Patch by Tommy Beadle. files: Lib/test/test_ipaddress.py | 33 ++++++++++++++++++++++++++ Misc/ACKS | 1 + 2 files changed, 34 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py --- a/Lib/test/test_ipaddress.py +++ b/Lib/test/test_ipaddress.py @@ -587,8 +587,16 @@ v4_objects = v4_addresses + [v4net] v6_addresses = [v6addr, v6intf] v6_objects = v6_addresses + [v6net] + objects = v4_objects + v6_objects + v4addr2 = ipaddress.IPv4Address(2) + v4net2 = ipaddress.IPv4Network(2) + v4intf2 = ipaddress.IPv4Interface(2) + v6addr2 = ipaddress.IPv6Address(2) + v6net2 = ipaddress.IPv6Network(2) + v6intf2 = ipaddress.IPv6Interface(2) + def test_foreign_type_equality(self): # __eq__ should never raise TypeError directly other = object() @@ -607,6 +615,31 @@ continue self.assertNotEqual(lhs, rhs) + def test_same_type_equality(self): + for obj in self.objects: + self.assertEqual(obj, obj) + self.assertLessEqual(obj, obj) + self.assertGreaterEqual(obj, obj) + + def test_same_type_ordering(self): + for lhs, rhs in ( + (self.v4addr, self.v4addr2), + (self.v4net, self.v4net2), + (self.v4intf, self.v4intf2), + (self.v6addr, self.v6addr2), + (self.v6net, self.v6net2), + (self.v6intf, self.v6intf2), + ): + self.assertNotEqual(lhs, rhs) + self.assertLess(lhs, rhs) + self.assertLessEqual(lhs, rhs) + self.assertGreater(rhs, lhs) + self.assertGreaterEqual(rhs, lhs) + self.assertFalse(lhs > rhs) + self.assertFalse(rhs < lhs) + self.assertFalse(lhs >= rhs) + self.assertFalse(rhs <= lhs) + def test_containment(self): for obj in self.v4_addresses: self.assertIn(obj, self.v4net) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -102,6 +102,7 @@ Anthony Baxter Mike Bayer Samuel L. Bayer +Tommy Beadle Donald Beaudry David Beazley John Beck -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 16:37:05 2016 From: python-checkins at python.org (berker.peksag) Date: Thu, 02 Jun 2016 20:37:05 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIxNzc2?= =?utf-8?q?=3A_distutils=2Eupload_now_correctly_handles_HTTPError?= Message-ID: <20160602203659.122863.43475.533A3913@psf.io> https://hg.python.org/cpython/rev/17e7d6c4f082 changeset: 101615:17e7d6c4f082 branch: 3.5 parent: 101613:ffaefb20dd06 user: Berker Peksag date: Thu Jun 02 13:45:53 2016 -0700 summary: Issue #21776: distutils.upload now correctly handles HTTPError Initial patch by Claudiu Popa. files: Lib/distutils/command/upload.py | 14 ++++---- Lib/distutils/tests/test_upload.py | 31 +++++++++++++++++- Misc/NEWS | 3 + 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/Lib/distutils/command/upload.py b/Lib/distutils/command/upload.py --- a/Lib/distutils/command/upload.py +++ b/Lib/distutils/command/upload.py @@ -181,21 +181,21 @@ result = urlopen(request) status = result.getcode() reason = result.msg + except HTTPError as e: + status = e.code + reason = e.msg except OSError as e: self.announce(str(e), log.ERROR) raise - except HTTPError as e: - status = e.code - reason = e.msg if status == 200: self.announce('Server response (%s): %s' % (status, reason), log.INFO) + if self.show_response: + text = self._read_pypi_response(result) + msg = '\n'.join(('-' * 75, text, '-' * 75)) + self.announce(msg, log.INFO) else: msg = 'Upload failed (%s): %s' % (status, reason) self.announce(msg, log.ERROR) raise DistutilsError(msg) - if self.show_response: - text = self._read_pypi_response(result) - msg = '\n'.join(('-' * 75, text, '-' * 75)) - self.announce(msg, log.INFO) diff --git a/Lib/distutils/tests/test_upload.py b/Lib/distutils/tests/test_upload.py --- a/Lib/distutils/tests/test_upload.py +++ b/Lib/distutils/tests/test_upload.py @@ -1,13 +1,16 @@ """Tests for distutils.command.upload.""" import os import unittest +import unittest.mock as mock +from urllib.request import HTTPError + from test.support import run_unittest from distutils.command import upload as upload_mod from distutils.command.upload import upload from distutils.core import Distribution from distutils.errors import DistutilsError -from distutils.log import INFO +from distutils.log import ERROR, INFO from distutils.tests.test_config import PYPIRC, PyPIRCCommandTestCase @@ -144,6 +147,32 @@ self.next_code = 404 self.assertRaises(DistutilsError, self.test_upload) + def test_wrong_exception_order(self): + tmp = self.mkdtemp() + path = os.path.join(tmp, 'xxx') + self.write_file(path) + dist_files = [('xxx', '2.6', path)] # command, pyversion, filename + self.write_file(self.rc, PYPIRC_LONG_PASSWORD) + + pkg_dir, dist = self.create_dist(dist_files=dist_files) + tests = [ + (OSError('oserror'), 'oserror', OSError), + (HTTPError('url', 400, 'httperror', {}, None), + 'Upload failed (400): httperror', DistutilsError), + ] + for exception, expected, raised_exception in tests: + with self.subTest(exception=type(exception).__name__): + with mock.patch('distutils.command.upload.urlopen', + new=mock.Mock(side_effect=exception)): + with self.assertRaises(raised_exception): + cmd = upload(dist) + cmd.ensure_finalized() + cmd.run() + results = self.get_logs(ERROR) + self.assertIn(expected, results[-1]) + self.clear_logs() + + def test_suite(): return unittest.makeSuite(uploadTestCase) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -128,6 +128,9 @@ Library ------- +- Issue #21776: distutils.upload now correctly handles HTTPError. + Initial patch by Claudiu Popa. + - Issue #27114: Fix SSLContext._load_windows_store_certs fails with PermissionError -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 16:37:05 2016 From: python-checkins at python.org (berker.peksag) Date: Thu, 02 Jun 2016 20:37:05 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2321776=3A_Merge_from_3=2E5?= Message-ID: <20160602203659.119941.13909.3C873E94@psf.io> https://hg.python.org/cpython/rev/421bc6ae9b6f changeset: 101616:421bc6ae9b6f parent: 101614:503168ec3d4f parent: 101615:17e7d6c4f082 user: Berker Peksag date: Thu Jun 02 13:47:23 2016 -0700 summary: Issue #21776: Merge from 3.5 files: Lib/distutils/command/upload.py | 14 ++++---- Lib/distutils/tests/test_upload.py | 31 +++++++++++++++++- Misc/NEWS | 3 + 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/Lib/distutils/command/upload.py b/Lib/distutils/command/upload.py --- a/Lib/distutils/command/upload.py +++ b/Lib/distutils/command/upload.py @@ -181,21 +181,21 @@ result = urlopen(request) status = result.getcode() reason = result.msg + except HTTPError as e: + status = e.code + reason = e.msg except OSError as e: self.announce(str(e), log.ERROR) raise - except HTTPError as e: - status = e.code - reason = e.msg if status == 200: self.announce('Server response (%s): %s' % (status, reason), log.INFO) + if self.show_response: + text = self._read_pypi_response(result) + msg = '\n'.join(('-' * 75, text, '-' * 75)) + self.announce(msg, log.INFO) else: msg = 'Upload failed (%s): %s' % (status, reason) self.announce(msg, log.ERROR) raise DistutilsError(msg) - if self.show_response: - text = self._read_pypi_response(result) - msg = '\n'.join(('-' * 75, text, '-' * 75)) - self.announce(msg, log.INFO) diff --git a/Lib/distutils/tests/test_upload.py b/Lib/distutils/tests/test_upload.py --- a/Lib/distutils/tests/test_upload.py +++ b/Lib/distutils/tests/test_upload.py @@ -1,13 +1,16 @@ """Tests for distutils.command.upload.""" import os import unittest +import unittest.mock as mock +from urllib.request import HTTPError + from test.support import run_unittest from distutils.command import upload as upload_mod from distutils.command.upload import upload from distutils.core import Distribution from distutils.errors import DistutilsError -from distutils.log import INFO +from distutils.log import ERROR, INFO from distutils.tests.test_config import PYPIRC, PyPIRCCommandTestCase @@ -144,6 +147,32 @@ self.next_code = 404 self.assertRaises(DistutilsError, self.test_upload) + def test_wrong_exception_order(self): + tmp = self.mkdtemp() + path = os.path.join(tmp, 'xxx') + self.write_file(path) + dist_files = [('xxx', '2.6', path)] # command, pyversion, filename + self.write_file(self.rc, PYPIRC_LONG_PASSWORD) + + pkg_dir, dist = self.create_dist(dist_files=dist_files) + tests = [ + (OSError('oserror'), 'oserror', OSError), + (HTTPError('url', 400, 'httperror', {}, None), + 'Upload failed (400): httperror', DistutilsError), + ] + for exception, expected, raised_exception in tests: + with self.subTest(exception=type(exception).__name__): + with mock.patch('distutils.command.upload.urlopen', + new=mock.Mock(side_effect=exception)): + with self.assertRaises(raised_exception): + cmd = upload(dist) + cmd.ensure_finalized() + cmd.run() + results = self.get_logs(ERROR) + self.assertIn(expected, results[-1]) + self.clear_logs() + + def test_suite(): return unittest.makeSuite(uploadTestCase) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -22,6 +22,9 @@ Library ------- +- Issue #21776: distutils.upload now correctly handles HTTPError. + Initial patch by Claudiu Popa. + - Issue #26526: Replace custom parse tree validation in the parser module with a simple DFA validator. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 16:44:19 2016 From: python-checkins at python.org (yury.selivanov) Date: Thu, 02 Jun 2016 20:44:19 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy41ICAoYXN5bmNpbyk=?= Message-ID: <20160602204416.120156.99281.4AEEC0AC@psf.io> https://hg.python.org/cpython/rev/45707b4547ea changeset: 101618:45707b4547ea parent: 101616:421bc6ae9b6f parent: 101617:ad7766f342a7 user: Yury Selivanov date: Thu Jun 02 16:44:10 2016 -0400 summary: Merge 3.5 (asyncio) files: Lib/asyncio/base_events.py | 2 +- Lib/test/test_asyncio/test_base_events.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -102,7 +102,7 @@ else: return None - if port in {None, ''}: + if port in {None, '', b''}: port = 0 elif isinstance(port, (bytes, str)): port = int(port) diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -132,6 +132,10 @@ self.assertEqual( (INET, STREAM, TCP, '', ('1.2.3.4', 0)), + base_events._ipaddr_info('1.2.3.4', b'', INET, STREAM, TCP)) + + self.assertEqual( + (INET, STREAM, TCP, '', ('1.2.3.4', 0)), base_events._ipaddr_info('1.2.3.4', '', INET, STREAM, TCP)) self.assertEqual( -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 16:44:19 2016 From: python-checkins at python.org (yury.selivanov) Date: Thu, 02 Jun 2016 20:44:19 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogYXN5bmNpbzogU3Vw?= =?utf-8?q?port_host=3Db=27=27_for_getaddrinfo?= Message-ID: <20160602204415.122933.25485.E254F1C2@psf.io> https://hg.python.org/cpython/rev/ad7766f342a7 changeset: 101617:ad7766f342a7 branch: 3.5 parent: 101615:17e7d6c4f082 user: Yury Selivanov date: Thu Jun 02 16:43:52 2016 -0400 summary: asyncio: Support host=b'' for getaddrinfo files: Lib/asyncio/base_events.py | 2 +- Lib/test/test_asyncio/test_base_events.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -102,7 +102,7 @@ else: return None - if port in {None, ''}: + if port in {None, '', b''}: port = 0 elif isinstance(port, (bytes, str)): port = int(port) diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -132,6 +132,10 @@ self.assertEqual( (INET, STREAM, TCP, '', ('1.2.3.4', 0)), + base_events._ipaddr_info('1.2.3.4', b'', INET, STREAM, TCP)) + + self.assertEqual( + (INET, STREAM, TCP, '', ('1.2.3.4', 0)), base_events._ipaddr_info('1.2.3.4', '', INET, STREAM, TCP)) self.assertEqual( -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 16:51:48 2016 From: python-checkins at python.org (yury.selivanov) Date: Thu, 02 Jun 2016 20:51:48 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_3=2E5_=28asyncio=29?= Message-ID: <20160602205144.70592.22996.A089164D@psf.io> https://hg.python.org/cpython/rev/b03b01f903e7 changeset: 101620:b03b01f903e7 parent: 101618:45707b4547ea parent: 101619:3ec208c01418 user: Yury Selivanov date: Thu Jun 02 16:51:27 2016 -0400 summary: Merge 3.5 (asyncio) files: Lib/asyncio/base_events.py | 22 +++++++++- Lib/test/test_asyncio/test_base_events.py | 20 ++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -102,10 +102,26 @@ else: return None - if port in {None, '', b''}: + if port is None: port = 0 - elif isinstance(port, (bytes, str)): - port = int(port) + elif isinstance(port, bytes): + if port == b'': + port = 0 + else: + try: + port = int(port) + except ValueError: + # Might be a service name like b"http". + port = socket.getservbyname(port.decode('ascii')) + elif isinstance(port, str): + if port == '': + port = 0 + else: + try: + port = int(port) + except ValueError: + # Might be a service name like "http". + port = socket.getservbyname(port) if hasattr(socket, 'inet_pton'): if family == socket.AF_UNSPEC: diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -146,6 +146,26 @@ (INET, STREAM, TCP, '', ('1.2.3.4', 1)), base_events._ipaddr_info('1.2.3.4', b'1', INET, STREAM, TCP)) + def test_getaddrinfo_servname(self): + INET = socket.AF_INET + STREAM = socket.SOCK_STREAM + TCP = socket.IPPROTO_TCP + + self.assertEqual( + (INET, STREAM, TCP, '', ('1.2.3.4', 80)), + base_events._ipaddr_info('1.2.3.4', 'http', INET, STREAM, TCP)) + + self.assertEqual( + (INET, STREAM, TCP, '', ('1.2.3.4', 80)), + base_events._ipaddr_info('1.2.3.4', b'http', INET, STREAM, TCP)) + + # Raises "service/proto not found". + with self.assertRaises(OSError): + base_events._ipaddr_info('1.2.3.4', 'nonsense', INET, STREAM, TCP) + + with self.assertRaises(OSError): + base_events._ipaddr_info('1.2.3.4', 'nonsense', INET, STREAM, TCP) + @patch_socket def test_ipaddr_info_no_inet_pton(self, m_socket): del m_socket.inet_pton -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 16:52:11 2016 From: python-checkins at python.org (yury.selivanov) Date: Thu, 02 Jun 2016 20:52:11 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogYXN5bmNpbzogRml4?= =?utf-8?q?_getaddrinfo_to_accept_service_names_=28for_port=29?= Message-ID: <20160602205144.2469.82193.EE4046A4@psf.io> https://hg.python.org/cpython/rev/3ec208c01418 changeset: 101619:3ec208c01418 branch: 3.5 parent: 101617:ad7766f342a7 user: Yury Selivanov date: Thu Jun 02 16:51:07 2016 -0400 summary: asyncio: Fix getaddrinfo to accept service names (for port) Patch by A. Jesse Jiryu Davis files: Lib/asyncio/base_events.py | 22 +++++++++- Lib/test/test_asyncio/test_base_events.py | 20 ++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -102,10 +102,26 @@ else: return None - if port in {None, '', b''}: + if port is None: port = 0 - elif isinstance(port, (bytes, str)): - port = int(port) + elif isinstance(port, bytes): + if port == b'': + port = 0 + else: + try: + port = int(port) + except ValueError: + # Might be a service name like b"http". + port = socket.getservbyname(port.decode('ascii')) + elif isinstance(port, str): + if port == '': + port = 0 + else: + try: + port = int(port) + except ValueError: + # Might be a service name like "http". + port = socket.getservbyname(port) if hasattr(socket, 'inet_pton'): if family == socket.AF_UNSPEC: diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -146,6 +146,26 @@ (INET, STREAM, TCP, '', ('1.2.3.4', 1)), base_events._ipaddr_info('1.2.3.4', b'1', INET, STREAM, TCP)) + def test_getaddrinfo_servname(self): + INET = socket.AF_INET + STREAM = socket.SOCK_STREAM + TCP = socket.IPPROTO_TCP + + self.assertEqual( + (INET, STREAM, TCP, '', ('1.2.3.4', 80)), + base_events._ipaddr_info('1.2.3.4', 'http', INET, STREAM, TCP)) + + self.assertEqual( + (INET, STREAM, TCP, '', ('1.2.3.4', 80)), + base_events._ipaddr_info('1.2.3.4', b'http', INET, STREAM, TCP)) + + # Raises "service/proto not found". + with self.assertRaises(OSError): + base_events._ipaddr_info('1.2.3.4', 'nonsense', INET, STREAM, TCP) + + with self.assertRaises(OSError): + base_events._ipaddr_info('1.2.3.4', 'nonsense', INET, STREAM, TCP) + @patch_socket def test_ipaddr_info_no_inet_pton(self, m_socket): del m_socket.inet_pton -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 18:07:18 2016 From: python-checkins at python.org (ethan.furman) Date: Thu, 02 Jun 2016 22:07:18 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_issue27186_--_initial_docs?= =?utf-8?q?=2C_tests=2C_and_python_version_of_os=2Efspath?= Message-ID: <20160602220648.70566.23430.A25A49E3@psf.io> https://hg.python.org/cpython/rev/59a52a9dd0dc changeset: 101621:59a52a9dd0dc user: Ethan Furman date: Thu Jun 02 15:06:09 2016 -0700 summary: issue27186 -- initial docs, tests, and python version of os.fspath files: Doc/library/os.rst | 9 +++++++++ Lib/os.py | 21 +++++++++++++++++++++ Lib/test/test_os.py | 21 +++++++++++++++++++++ 3 files changed, 51 insertions(+), 0 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -186,6 +186,15 @@ .. versionadded:: 3.2 +.. function:: fspath(path) + + Return the string representation of the path. + + If :class:`str` or :class:`bytes` is passed in, it is returned unchanged; + otherwise, the result of calling ``type(path).__fspath__`` is returned, or an + exception is raised. + + .. function:: getenv(key, default=None) Return the value of the environment variable *key* if it exists, or diff --git a/Lib/os.py b/Lib/os.py --- a/Lib/os.py +++ b/Lib/os.py @@ -1097,3 +1097,24 @@ raise TypeError("invalid fd type (%s, expected integer)" % type(fd)) import io return io.open(fd, *args, **kwargs) + +# Supply os.fspath() +def fspath(path): + """Return the string representation of the path. + + If str or bytes is passed in, it is returned unchanged. + """ + if isinstance(path, (str, bytes)): + return path + + # Work from the object's type to match method resolution of other magic + # methods. + path_type = type(path) + try: + return path_type.__fspath__(path) + except AttributeError: + if hasattr(path_type, '__fspath__'): + raise + + raise TypeError("expected str, bytes or os.PathLike object, not " + + path_type.__name__) 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 @@ -3095,5 +3095,26 @@ del iterator +class TestPEP519(unittest.TestCase): + "os.fspath()" + + def test_return_bytes(self): + for b in b'hello', b'goodbye', b'some/path/and/file': + self.assertEqual(b, os.fspath(b)) + + def test_return_string(self): + for s in 'hello', 'goodbye', 'some/path/and/file': + self.assertEqual(s, os.fspath(s)) + + def test_garbage_in_exception_out(self): + vapor = type('blah', (), {}) + for o in int, type, os, vapor(): + self.assertRaises(TypeError, os.fspath, o) + + def test_argument_required(self): + with self.assertRaises(TypeError): + os.fspath() + + if __name__ == "__main__": unittest.main() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 18:18:03 2016 From: python-checkins at python.org (berker.peksag) Date: Thu, 02 Jun 2016 22:18:03 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzE2MTky?= =?utf-8?q?=3A_Fix_copy_and_paste_mistake_noticed_by_Eryk_Sun?= Message-ID: <20160602221802.4754.6520.960A13E3@psf.io> https://hg.python.org/cpython/rev/dfde53cf07e6 changeset: 101622:dfde53cf07e6 branch: 3.5 parent: 101619:3ec208c01418 user: Berker Peksag date: Thu Jun 02 15:28:00 2016 -0700 summary: Issue #16192: Fix copy and paste mistake noticed by Eryk Sun files: Doc/library/ctypes.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -21,9 +21,9 @@ Windows, or Mac OS X, they contain doctest directives in comments. Note: Some code samples reference the ctypes :class:`c_int` type. On platforms -where ``sizeof(long double) == sizeof(double)`` it is an alias to -:class:`c_double`. So, you should not be confused if :class:`c_long` is -printed if you would expect :class:`c_int` --- they are actually the same type. +where ``sizeof(long) == sizeof(int)`` it is an alias to :class:`c_long`. +So, you should not be confused if :class:`c_long` is printed if you would expect +:class:`c_int` --- they are actually the same type. .. _ctypes-loading-dynamic-link-libraries: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 18:18:08 2016 From: python-checkins at python.org (berker.peksag) Date: Thu, 02 Jun 2016 22:18:08 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2316192=3A_Merge_from_3=2E5?= Message-ID: <20160602221807.4839.65291.7B2ACF31@psf.io> https://hg.python.org/cpython/rev/7f3ebd86464b changeset: 101623:7f3ebd86464b parent: 101621:59a52a9dd0dc parent: 101622:dfde53cf07e6 user: Berker Peksag date: Thu Jun 02 15:28:29 2016 -0700 summary: Issue #16192: Merge from 3.5 files: Doc/library/ctypes.rst | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -21,9 +21,9 @@ Windows, or Mac OS X, they contain doctest directives in comments. Note: Some code samples reference the ctypes :class:`c_int` type. On platforms -where ``sizeof(long double) == sizeof(double)`` it is an alias to -:class:`c_double`. So, you should not be confused if :class:`c_long` is -printed if you would expect :class:`c_int` --- they are actually the same type. +where ``sizeof(long) == sizeof(int)`` it is an alias to :class:`c_long`. +So, you should not be confused if :class:`c_long` is printed if you would expect +:class:`c_int` --- they are actually the same type. .. _ctypes-loading-dynamic-link-libraries: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 19:38:58 2016 From: python-checkins at python.org (r.david.murray) Date: Thu, 02 Jun 2016 23:38:58 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogIzI3MTg1OiBtb3Zl?= =?utf-8?q?_test=5Fpep292_into_test=5Fstring=2E?= Message-ID: <20160602233858.1001.50888.E8137692@psf.io> https://hg.python.org/cpython/rev/89abefdebf4d changeset: 101624:89abefdebf4d branch: 3.5 parent: 101622:dfde53cf07e6 user: R David Murray date: Thu Jun 02 19:37:47 2016 -0400 summary: #27185: move test_pep292 into test_string. This makes the Template tests discoverable. Patch by Erin Braswell. files: Lib/test/test_pep292.py | 248 ---------------------------- Lib/test/test_string.py | 240 +++++++++++++++++++++++++++ Misc/ACKS | 1 + 3 files changed, 241 insertions(+), 248 deletions(-) diff --git a/Lib/test/test_pep292.py b/Lib/test/test_pep292.py deleted file mode 100644 --- a/Lib/test/test_pep292.py +++ /dev/null @@ -1,248 +0,0 @@ -# Copyright (C) 2004 Python Software Foundation -# Author: barry at python.org (Barry Warsaw) -# License: http://www.opensource.org/licenses/PythonSoftFoundation.php - -import unittest -from string import Template - - -class Bag: - pass - -class Mapping: - def __getitem__(self, name): - obj = self - for part in name.split('.'): - try: - obj = getattr(obj, part) - except AttributeError: - raise KeyError(name) - return obj - - -class TestTemplate(unittest.TestCase): - def test_regular_templates(self): - s = Template('$who likes to eat a bag of $what worth $$100') - self.assertEqual(s.substitute(dict(who='tim', what='ham')), - 'tim likes to eat a bag of ham worth $100') - self.assertRaises(KeyError, s.substitute, dict(who='tim')) - self.assertRaises(TypeError, Template.substitute) - - def test_regular_templates_with_braces(self): - s = Template('$who likes ${what} for ${meal}') - d = dict(who='tim', what='ham', meal='dinner') - self.assertEqual(s.substitute(d), 'tim likes ham for dinner') - self.assertRaises(KeyError, s.substitute, - dict(who='tim', what='ham')) - - def test_escapes(self): - eq = self.assertEqual - s = Template('$who likes to eat a bag of $$what worth $$100') - eq(s.substitute(dict(who='tim', what='ham')), - 'tim likes to eat a bag of $what worth $100') - s = Template('$who likes $$') - eq(s.substitute(dict(who='tim', what='ham')), 'tim likes $') - - def test_percents(self): - eq = self.assertEqual - s = Template('%(foo)s $foo ${foo}') - d = dict(foo='baz') - eq(s.substitute(d), '%(foo)s baz baz') - eq(s.safe_substitute(d), '%(foo)s baz baz') - - def test_stringification(self): - eq = self.assertEqual - s = Template('tim has eaten $count bags of ham today') - d = dict(count=7) - eq(s.substitute(d), 'tim has eaten 7 bags of ham today') - eq(s.safe_substitute(d), 'tim has eaten 7 bags of ham today') - s = Template('tim has eaten ${count} bags of ham today') - eq(s.substitute(d), 'tim has eaten 7 bags of ham today') - - def test_tupleargs(self): - eq = self.assertEqual - s = Template('$who ate ${meal}') - d = dict(who=('tim', 'fred'), meal=('ham', 'kung pao')) - eq(s.substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") - eq(s.safe_substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") - - def test_SafeTemplate(self): - eq = self.assertEqual - s = Template('$who likes ${what} for ${meal}') - eq(s.safe_substitute(dict(who='tim')), 'tim likes ${what} for ${meal}') - eq(s.safe_substitute(dict(what='ham')), '$who likes ham for ${meal}') - eq(s.safe_substitute(dict(what='ham', meal='dinner')), - '$who likes ham for dinner') - eq(s.safe_substitute(dict(who='tim', what='ham')), - 'tim likes ham for ${meal}') - eq(s.safe_substitute(dict(who='tim', what='ham', meal='dinner')), - 'tim likes ham for dinner') - - def test_invalid_placeholders(self): - raises = self.assertRaises - s = Template('$who likes $') - raises(ValueError, s.substitute, dict(who='tim')) - s = Template('$who likes ${what)') - raises(ValueError, s.substitute, dict(who='tim')) - s = Template('$who likes $100') - raises(ValueError, s.substitute, dict(who='tim')) - - def test_idpattern_override(self): - class PathPattern(Template): - idpattern = r'[_a-z][._a-z0-9]*' - m = Mapping() - m.bag = Bag() - m.bag.foo = Bag() - m.bag.foo.who = 'tim' - m.bag.what = 'ham' - s = PathPattern('$bag.foo.who likes to eat a bag of $bag.what') - self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') - - def test_pattern_override(self): - class MyPattern(Template): - pattern = r""" - (?P@{2}) | - @(?P[_a-z][._a-z0-9]*) | - @{(?P[_a-z][._a-z0-9]*)} | - (?P@) - """ - m = Mapping() - m.bag = Bag() - m.bag.foo = Bag() - m.bag.foo.who = 'tim' - m.bag.what = 'ham' - s = MyPattern('@bag.foo.who likes to eat a bag of @bag.what') - self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') - - class BadPattern(Template): - pattern = r""" - (?P.*) | - (?P@{2}) | - @(?P[_a-z][._a-z0-9]*) | - @{(?P[_a-z][._a-z0-9]*)} | - (?P@) | - """ - s = BadPattern('@bag.foo.who likes to eat a bag of @bag.what') - self.assertRaises(ValueError, s.substitute, {}) - self.assertRaises(ValueError, s.safe_substitute, {}) - - def test_braced_override(self): - class MyTemplate(Template): - pattern = r""" - \$(?: - (?P$) | - (?P[_a-z][_a-z0-9]*) | - @@(?P[_a-z][_a-z0-9]*)@@ | - (?P) | - ) - """ - - tmpl = 'PyCon in $@@location@@' - t = MyTemplate(tmpl) - self.assertRaises(KeyError, t.substitute, {}) - val = t.substitute({'location': 'Cleveland'}) - self.assertEqual(val, 'PyCon in Cleveland') - - def test_braced_override_safe(self): - class MyTemplate(Template): - pattern = r""" - \$(?: - (?P$) | - (?P[_a-z][_a-z0-9]*) | - @@(?P[_a-z][_a-z0-9]*)@@ | - (?P) | - ) - """ - - tmpl = 'PyCon in $@@location@@' - t = MyTemplate(tmpl) - self.assertEqual(t.safe_substitute(), tmpl) - val = t.safe_substitute({'location': 'Cleveland'}) - self.assertEqual(val, 'PyCon in Cleveland') - - def test_invalid_with_no_lines(self): - # The error formatting for invalid templates - # has a special case for no data that the default - # pattern can't trigger (always has at least '$') - # So we craft a pattern that is always invalid - # with no leading data. - class MyTemplate(Template): - pattern = r""" - (?P) | - unreachable( - (?P) | - (?P) | - (?P) - ) - """ - s = MyTemplate('') - with self.assertRaises(ValueError) as err: - s.substitute({}) - self.assertIn('line 1, col 1', str(err.exception)) - - def test_unicode_values(self): - s = Template('$who likes $what') - d = dict(who='t\xffm', what='f\xfe\fed') - self.assertEqual(s.substitute(d), 't\xffm likes f\xfe\x0ced') - - def test_keyword_arguments(self): - eq = self.assertEqual - s = Template('$who likes $what') - eq(s.substitute(who='tim', what='ham'), 'tim likes ham') - eq(s.substitute(dict(who='tim'), what='ham'), 'tim likes ham') - eq(s.substitute(dict(who='fred', what='kung pao'), - who='tim', what='ham'), - 'tim likes ham') - s = Template('the mapping is $mapping') - eq(s.substitute(dict(foo='none'), mapping='bozo'), - 'the mapping is bozo') - eq(s.substitute(dict(mapping='one'), mapping='two'), - 'the mapping is two') - - s = Template('the self is $self') - eq(s.substitute(self='bozo'), 'the self is bozo') - - def test_keyword_arguments_safe(self): - eq = self.assertEqual - raises = self.assertRaises - s = Template('$who likes $what') - eq(s.safe_substitute(who='tim', what='ham'), 'tim likes ham') - eq(s.safe_substitute(dict(who='tim'), what='ham'), 'tim likes ham') - eq(s.safe_substitute(dict(who='fred', what='kung pao'), - who='tim', what='ham'), - 'tim likes ham') - s = Template('the mapping is $mapping') - eq(s.safe_substitute(dict(foo='none'), mapping='bozo'), - 'the mapping is bozo') - eq(s.safe_substitute(dict(mapping='one'), mapping='two'), - 'the mapping is two') - d = dict(mapping='one') - raises(TypeError, s.substitute, d, {}) - raises(TypeError, s.safe_substitute, d, {}) - - s = Template('the self is $self') - eq(s.safe_substitute(self='bozo'), 'the self is bozo') - - def test_delimiter_override(self): - eq = self.assertEqual - raises = self.assertRaises - class AmpersandTemplate(Template): - delimiter = '&' - s = AmpersandTemplate('this &gift is for &{who} &&') - eq(s.substitute(gift='bud', who='you'), 'this bud is for you &') - raises(KeyError, s.substitute) - eq(s.safe_substitute(gift='bud', who='you'), 'this bud is for you &') - eq(s.safe_substitute(), 'this &gift is for &{who} &') - s = AmpersandTemplate('this &gift is for &{who} &') - raises(ValueError, s.substitute, dict(gift='bud', who='you')) - eq(s.safe_substitute(), 'this &gift is for &{who} &') - - class PieDelims(Template): - delimiter = '@' - s = PieDelims('@who likes to eat a bag of @{what} worth $100') - self.assertEqual(s.substitute(dict(who='tim', what='ham')), - 'tim likes to eat a bag of ham worth $100') - - -if __name__ == '__main__': - unittest.main() diff --git a/Lib/test/test_string.py b/Lib/test/test_string.py --- a/Lib/test/test_string.py +++ b/Lib/test/test_string.py @@ -187,5 +187,245 @@ self.assertIn("recursion", str(err.exception)) +# Template tests (formerly housed in test_pep292.py) + +class Bag: + pass + +class Mapping: + def __getitem__(self, name): + obj = self + for part in name.split('.'): + try: + obj = getattr(obj, part) + except AttributeError: + raise KeyError(name) + return obj + + +class TestTemplate(unittest.TestCase): + def test_regular_templates(self): + s = string.Template('$who likes to eat a bag of $what worth $$100') + self.assertEqual(s.substitute(dict(who='tim', what='ham')), + 'tim likes to eat a bag of ham worth $100') + self.assertRaises(KeyError, s.substitute, dict(who='tim')) + self.assertRaises(TypeError, string.Template.substitute) + + def test_regular_templates_with_braces(self): + s = string.Template('$who likes ${what} for ${meal}') + d = dict(who='tim', what='ham', meal='dinner') + self.assertEqual(s.substitute(d), 'tim likes ham for dinner') + self.assertRaises(KeyError, s.substitute, + dict(who='tim', what='ham')) + + def test_escapes(self): + eq = self.assertEqual + s = string.Template('$who likes to eat a bag of $$what worth $$100') + eq(s.substitute(dict(who='tim', what='ham')), + 'tim likes to eat a bag of $what worth $100') + s = string.Template('$who likes $$') + eq(s.substitute(dict(who='tim', what='ham')), 'tim likes $') + + def test_percents(self): + eq = self.assertEqual + s = string.Template('%(foo)s $foo ${foo}') + d = dict(foo='baz') + eq(s.substitute(d), '%(foo)s baz baz') + eq(s.safe_substitute(d), '%(foo)s baz baz') + + def test_stringification(self): + eq = self.assertEqual + s = string.Template('tim has eaten $count bags of ham today') + d = dict(count=7) + eq(s.substitute(d), 'tim has eaten 7 bags of ham today') + eq(s.safe_substitute(d), 'tim has eaten 7 bags of ham today') + s = string.Template('tim has eaten ${count} bags of ham today') + eq(s.substitute(d), 'tim has eaten 7 bags of ham today') + + def test_tupleargs(self): + eq = self.assertEqual + s = string.Template('$who ate ${meal}') + d = dict(who=('tim', 'fred'), meal=('ham', 'kung pao')) + eq(s.substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") + eq(s.safe_substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") + + def test_SafeTemplate(self): + eq = self.assertEqual + s = string.Template('$who likes ${what} for ${meal}') + eq(s.safe_substitute(dict(who='tim')), 'tim likes ${what} for ${meal}') + eq(s.safe_substitute(dict(what='ham')), '$who likes ham for ${meal}') + eq(s.safe_substitute(dict(what='ham', meal='dinner')), + '$who likes ham for dinner') + eq(s.safe_substitute(dict(who='tim', what='ham')), + 'tim likes ham for ${meal}') + eq(s.safe_substitute(dict(who='tim', what='ham', meal='dinner')), + 'tim likes ham for dinner') + + def test_invalid_placeholders(self): + raises = self.assertRaises + s = string.Template('$who likes $') + raises(ValueError, s.substitute, dict(who='tim')) + s = string.Template('$who likes ${what)') + raises(ValueError, s.substitute, dict(who='tim')) + s = string.Template('$who likes $100') + raises(ValueError, s.substitute, dict(who='tim')) + + def test_idpattern_override(self): + class PathPattern(string.Template): + idpattern = r'[_a-z][._a-z0-9]*' + m = Mapping() + m.bag = Bag() + m.bag.foo = Bag() + m.bag.foo.who = 'tim' + m.bag.what = 'ham' + s = PathPattern('$bag.foo.who likes to eat a bag of $bag.what') + self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') + + def test_pattern_override(self): + class MyPattern(string.Template): + pattern = r""" + (?P@{2}) | + @(?P[_a-z][._a-z0-9]*) | + @{(?P[_a-z][._a-z0-9]*)} | + (?P@) + """ + m = Mapping() + m.bag = Bag() + m.bag.foo = Bag() + m.bag.foo.who = 'tim' + m.bag.what = 'ham' + s = MyPattern('@bag.foo.who likes to eat a bag of @bag.what') + self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') + + class BadPattern(string.Template): + pattern = r""" + (?P.*) | + (?P@{2}) | + @(?P[_a-z][._a-z0-9]*) | + @{(?P[_a-z][._a-z0-9]*)} | + (?P@) | + """ + s = BadPattern('@bag.foo.who likes to eat a bag of @bag.what') + self.assertRaises(ValueError, s.substitute, {}) + self.assertRaises(ValueError, s.safe_substitute, {}) + + def test_braced_override(self): + class MyTemplate(string.Template): + pattern = r""" + \$(?: + (?P$) | + (?P[_a-z][_a-z0-9]*) | + @@(?P[_a-z][_a-z0-9]*)@@ | + (?P) | + ) + """ + + tmpl = 'PyCon in $@@location@@' + t = MyTemplate(tmpl) + self.assertRaises(KeyError, t.substitute, {}) + val = t.substitute({'location': 'Cleveland'}) + self.assertEqual(val, 'PyCon in Cleveland') + + def test_braced_override_safe(self): + class MyTemplate(string.Template): + pattern = r""" + \$(?: + (?P$) | + (?P[_a-z][_a-z0-9]*) | + @@(?P[_a-z][_a-z0-9]*)@@ | + (?P) | + ) + """ + + tmpl = 'PyCon in $@@location@@' + t = MyTemplate(tmpl) + self.assertEqual(t.safe_substitute(), tmpl) + val = t.safe_substitute({'location': 'Cleveland'}) + self.assertEqual(val, 'PyCon in Cleveland') + + def test_invalid_with_no_lines(self): + # The error formatting for invalid templates + # has a special case for no data that the default + # pattern can't trigger (always has at least '$') + # So we craft a pattern that is always invalid + # with no leading data. + class MyTemplate(string.Template): + pattern = r""" + (?P) | + unreachable( + (?P) | + (?P) | + (?P) + ) + """ + s = MyTemplate('') + with self.assertRaises(ValueError) as err: + s.substitute({}) + self.assertIn('line 1, col 1', str(err.exception)) + + def test_unicode_values(self): + s = string.Template('$who likes $what') + d = dict(who='t\xffm', what='f\xfe\fed') + self.assertEqual(s.substitute(d), 't\xffm likes f\xfe\x0ced') + + def test_keyword_arguments(self): + eq = self.assertEqual + s = string.Template('$who likes $what') + eq(s.substitute(who='tim', what='ham'), 'tim likes ham') + eq(s.substitute(dict(who='tim'), what='ham'), 'tim likes ham') + eq(s.substitute(dict(who='fred', what='kung pao'), + who='tim', what='ham'), + 'tim likes ham') + s = string.Template('the mapping is $mapping') + eq(s.substitute(dict(foo='none'), mapping='bozo'), + 'the mapping is bozo') + eq(s.substitute(dict(mapping='one'), mapping='two'), + 'the mapping is two') + + s = string.Template('the self is $self') + eq(s.substitute(self='bozo'), 'the self is bozo') + + def test_keyword_arguments_safe(self): + eq = self.assertEqual + raises = self.assertRaises + s = string.Template('$who likes $what') + eq(s.safe_substitute(who='tim', what='ham'), 'tim likes ham') + eq(s.safe_substitute(dict(who='tim'), what='ham'), 'tim likes ham') + eq(s.safe_substitute(dict(who='fred', what='kung pao'), + who='tim', what='ham'), + 'tim likes ham') + s = string.Template('the mapping is $mapping') + eq(s.safe_substitute(dict(foo='none'), mapping='bozo'), + 'the mapping is bozo') + eq(s.safe_substitute(dict(mapping='one'), mapping='two'), + 'the mapping is two') + d = dict(mapping='one') + raises(TypeError, s.substitute, d, {}) + raises(TypeError, s.safe_substitute, d, {}) + + s = string.Template('the self is $self') + eq(s.safe_substitute(self='bozo'), 'the self is bozo') + + def test_delimiter_override(self): + eq = self.assertEqual + raises = self.assertRaises + class AmpersandTemplate(string.Template): + delimiter = '&' + s = AmpersandTemplate('this &gift is for &{who} &&') + eq(s.substitute(gift='bud', who='you'), 'this bud is for you &') + raises(KeyError, s.substitute) + eq(s.safe_substitute(gift='bud', who='you'), 'this bud is for you &') + eq(s.safe_substitute(), 'this &gift is for &{who} &') + s = AmpersandTemplate('this &gift is for &{who} &') + raises(ValueError, s.substitute, dict(gift='bud', who='you')) + eq(s.safe_substitute(), 'this &gift is for &{who} &') + + class PieDelims(string.Template): + delimiter = '@' + s = PieDelims('@who likes to eat a bag of @{what} worth $100') + self.assertEqual(s.substitute(dict(who='tim', what='ham')), + 'tim likes to eat a bag of ham worth $100') + + if __name__ == "__main__": unittest.main() diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -175,6 +175,7 @@ Georg Brandl Christopher Brannon Terrence Brannon +Erin Braswell Sven Brauch Germ?n M. Bravo Erik Bray -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 19:38:58 2016 From: python-checkins at python.org (r.david.murray) Date: Thu, 02 Jun 2016 23:38:58 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge=3A_=2327185=3A_move_test=5Fpep292_into_test=5Fstri?= =?utf-8?b?bmcu?= Message-ID: <20160602233858.4929.29788.7004D29D@psf.io> https://hg.python.org/cpython/rev/c2d3d8c3e0bf changeset: 101625:c2d3d8c3e0bf parent: 101623:7f3ebd86464b parent: 101624:89abefdebf4d user: R David Murray date: Thu Jun 02 19:38:20 2016 -0400 summary: Merge: #27185: move test_pep292 into test_string. files: Lib/test/test_pep292.py | 248 ---------------------------- Lib/test/test_string.py | 240 +++++++++++++++++++++++++++ Misc/ACKS | 1 + 3 files changed, 241 insertions(+), 248 deletions(-) diff --git a/Lib/test/test_pep292.py b/Lib/test/test_pep292.py deleted file mode 100644 --- a/Lib/test/test_pep292.py +++ /dev/null @@ -1,248 +0,0 @@ -# Copyright (C) 2004 Python Software Foundation -# Author: barry at python.org (Barry Warsaw) -# License: http://www.opensource.org/licenses/PythonSoftFoundation.php - -import unittest -from string import Template - - -class Bag: - pass - -class Mapping: - def __getitem__(self, name): - obj = self - for part in name.split('.'): - try: - obj = getattr(obj, part) - except AttributeError: - raise KeyError(name) - return obj - - -class TestTemplate(unittest.TestCase): - def test_regular_templates(self): - s = Template('$who likes to eat a bag of $what worth $$100') - self.assertEqual(s.substitute(dict(who='tim', what='ham')), - 'tim likes to eat a bag of ham worth $100') - self.assertRaises(KeyError, s.substitute, dict(who='tim')) - self.assertRaises(TypeError, Template.substitute) - - def test_regular_templates_with_braces(self): - s = Template('$who likes ${what} for ${meal}') - d = dict(who='tim', what='ham', meal='dinner') - self.assertEqual(s.substitute(d), 'tim likes ham for dinner') - self.assertRaises(KeyError, s.substitute, - dict(who='tim', what='ham')) - - def test_escapes(self): - eq = self.assertEqual - s = Template('$who likes to eat a bag of $$what worth $$100') - eq(s.substitute(dict(who='tim', what='ham')), - 'tim likes to eat a bag of $what worth $100') - s = Template('$who likes $$') - eq(s.substitute(dict(who='tim', what='ham')), 'tim likes $') - - def test_percents(self): - eq = self.assertEqual - s = Template('%(foo)s $foo ${foo}') - d = dict(foo='baz') - eq(s.substitute(d), '%(foo)s baz baz') - eq(s.safe_substitute(d), '%(foo)s baz baz') - - def test_stringification(self): - eq = self.assertEqual - s = Template('tim has eaten $count bags of ham today') - d = dict(count=7) - eq(s.substitute(d), 'tim has eaten 7 bags of ham today') - eq(s.safe_substitute(d), 'tim has eaten 7 bags of ham today') - s = Template('tim has eaten ${count} bags of ham today') - eq(s.substitute(d), 'tim has eaten 7 bags of ham today') - - def test_tupleargs(self): - eq = self.assertEqual - s = Template('$who ate ${meal}') - d = dict(who=('tim', 'fred'), meal=('ham', 'kung pao')) - eq(s.substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") - eq(s.safe_substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") - - def test_SafeTemplate(self): - eq = self.assertEqual - s = Template('$who likes ${what} for ${meal}') - eq(s.safe_substitute(dict(who='tim')), 'tim likes ${what} for ${meal}') - eq(s.safe_substitute(dict(what='ham')), '$who likes ham for ${meal}') - eq(s.safe_substitute(dict(what='ham', meal='dinner')), - '$who likes ham for dinner') - eq(s.safe_substitute(dict(who='tim', what='ham')), - 'tim likes ham for ${meal}') - eq(s.safe_substitute(dict(who='tim', what='ham', meal='dinner')), - 'tim likes ham for dinner') - - def test_invalid_placeholders(self): - raises = self.assertRaises - s = Template('$who likes $') - raises(ValueError, s.substitute, dict(who='tim')) - s = Template('$who likes ${what)') - raises(ValueError, s.substitute, dict(who='tim')) - s = Template('$who likes $100') - raises(ValueError, s.substitute, dict(who='tim')) - - def test_idpattern_override(self): - class PathPattern(Template): - idpattern = r'[_a-z][._a-z0-9]*' - m = Mapping() - m.bag = Bag() - m.bag.foo = Bag() - m.bag.foo.who = 'tim' - m.bag.what = 'ham' - s = PathPattern('$bag.foo.who likes to eat a bag of $bag.what') - self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') - - def test_pattern_override(self): - class MyPattern(Template): - pattern = r""" - (?P@{2}) | - @(?P[_a-z][._a-z0-9]*) | - @{(?P[_a-z][._a-z0-9]*)} | - (?P@) - """ - m = Mapping() - m.bag = Bag() - m.bag.foo = Bag() - m.bag.foo.who = 'tim' - m.bag.what = 'ham' - s = MyPattern('@bag.foo.who likes to eat a bag of @bag.what') - self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') - - class BadPattern(Template): - pattern = r""" - (?P.*) | - (?P@{2}) | - @(?P[_a-z][._a-z0-9]*) | - @{(?P[_a-z][._a-z0-9]*)} | - (?P@) | - """ - s = BadPattern('@bag.foo.who likes to eat a bag of @bag.what') - self.assertRaises(ValueError, s.substitute, {}) - self.assertRaises(ValueError, s.safe_substitute, {}) - - def test_braced_override(self): - class MyTemplate(Template): - pattern = r""" - \$(?: - (?P$) | - (?P[_a-z][_a-z0-9]*) | - @@(?P[_a-z][_a-z0-9]*)@@ | - (?P) | - ) - """ - - tmpl = 'PyCon in $@@location@@' - t = MyTemplate(tmpl) - self.assertRaises(KeyError, t.substitute, {}) - val = t.substitute({'location': 'Cleveland'}) - self.assertEqual(val, 'PyCon in Cleveland') - - def test_braced_override_safe(self): - class MyTemplate(Template): - pattern = r""" - \$(?: - (?P$) | - (?P[_a-z][_a-z0-9]*) | - @@(?P[_a-z][_a-z0-9]*)@@ | - (?P) | - ) - """ - - tmpl = 'PyCon in $@@location@@' - t = MyTemplate(tmpl) - self.assertEqual(t.safe_substitute(), tmpl) - val = t.safe_substitute({'location': 'Cleveland'}) - self.assertEqual(val, 'PyCon in Cleveland') - - def test_invalid_with_no_lines(self): - # The error formatting for invalid templates - # has a special case for no data that the default - # pattern can't trigger (always has at least '$') - # So we craft a pattern that is always invalid - # with no leading data. - class MyTemplate(Template): - pattern = r""" - (?P) | - unreachable( - (?P) | - (?P) | - (?P) - ) - """ - s = MyTemplate('') - with self.assertRaises(ValueError) as err: - s.substitute({}) - self.assertIn('line 1, col 1', str(err.exception)) - - def test_unicode_values(self): - s = Template('$who likes $what') - d = dict(who='t\xffm', what='f\xfe\fed') - self.assertEqual(s.substitute(d), 't\xffm likes f\xfe\x0ced') - - def test_keyword_arguments(self): - eq = self.assertEqual - s = Template('$who likes $what') - eq(s.substitute(who='tim', what='ham'), 'tim likes ham') - eq(s.substitute(dict(who='tim'), what='ham'), 'tim likes ham') - eq(s.substitute(dict(who='fred', what='kung pao'), - who='tim', what='ham'), - 'tim likes ham') - s = Template('the mapping is $mapping') - eq(s.substitute(dict(foo='none'), mapping='bozo'), - 'the mapping is bozo') - eq(s.substitute(dict(mapping='one'), mapping='two'), - 'the mapping is two') - - s = Template('the self is $self') - eq(s.substitute(self='bozo'), 'the self is bozo') - - def test_keyword_arguments_safe(self): - eq = self.assertEqual - raises = self.assertRaises - s = Template('$who likes $what') - eq(s.safe_substitute(who='tim', what='ham'), 'tim likes ham') - eq(s.safe_substitute(dict(who='tim'), what='ham'), 'tim likes ham') - eq(s.safe_substitute(dict(who='fred', what='kung pao'), - who='tim', what='ham'), - 'tim likes ham') - s = Template('the mapping is $mapping') - eq(s.safe_substitute(dict(foo='none'), mapping='bozo'), - 'the mapping is bozo') - eq(s.safe_substitute(dict(mapping='one'), mapping='two'), - 'the mapping is two') - d = dict(mapping='one') - raises(TypeError, s.substitute, d, {}) - raises(TypeError, s.safe_substitute, d, {}) - - s = Template('the self is $self') - eq(s.safe_substitute(self='bozo'), 'the self is bozo') - - def test_delimiter_override(self): - eq = self.assertEqual - raises = self.assertRaises - class AmpersandTemplate(Template): - delimiter = '&' - s = AmpersandTemplate('this &gift is for &{who} &&') - eq(s.substitute(gift='bud', who='you'), 'this bud is for you &') - raises(KeyError, s.substitute) - eq(s.safe_substitute(gift='bud', who='you'), 'this bud is for you &') - eq(s.safe_substitute(), 'this &gift is for &{who} &') - s = AmpersandTemplate('this &gift is for &{who} &') - raises(ValueError, s.substitute, dict(gift='bud', who='you')) - eq(s.safe_substitute(), 'this &gift is for &{who} &') - - class PieDelims(Template): - delimiter = '@' - s = PieDelims('@who likes to eat a bag of @{what} worth $100') - self.assertEqual(s.substitute(dict(who='tim', what='ham')), - 'tim likes to eat a bag of ham worth $100') - - -if __name__ == '__main__': - unittest.main() diff --git a/Lib/test/test_string.py b/Lib/test/test_string.py --- a/Lib/test/test_string.py +++ b/Lib/test/test_string.py @@ -187,5 +187,245 @@ self.assertIn("recursion", str(err.exception)) +# Template tests (formerly housed in test_pep292.py) + +class Bag: + pass + +class Mapping: + def __getitem__(self, name): + obj = self + for part in name.split('.'): + try: + obj = getattr(obj, part) + except AttributeError: + raise KeyError(name) + return obj + + +class TestTemplate(unittest.TestCase): + def test_regular_templates(self): + s = string.Template('$who likes to eat a bag of $what worth $$100') + self.assertEqual(s.substitute(dict(who='tim', what='ham')), + 'tim likes to eat a bag of ham worth $100') + self.assertRaises(KeyError, s.substitute, dict(who='tim')) + self.assertRaises(TypeError, string.Template.substitute) + + def test_regular_templates_with_braces(self): + s = string.Template('$who likes ${what} for ${meal}') + d = dict(who='tim', what='ham', meal='dinner') + self.assertEqual(s.substitute(d), 'tim likes ham for dinner') + self.assertRaises(KeyError, s.substitute, + dict(who='tim', what='ham')) + + def test_escapes(self): + eq = self.assertEqual + s = string.Template('$who likes to eat a bag of $$what worth $$100') + eq(s.substitute(dict(who='tim', what='ham')), + 'tim likes to eat a bag of $what worth $100') + s = string.Template('$who likes $$') + eq(s.substitute(dict(who='tim', what='ham')), 'tim likes $') + + def test_percents(self): + eq = self.assertEqual + s = string.Template('%(foo)s $foo ${foo}') + d = dict(foo='baz') + eq(s.substitute(d), '%(foo)s baz baz') + eq(s.safe_substitute(d), '%(foo)s baz baz') + + def test_stringification(self): + eq = self.assertEqual + s = string.Template('tim has eaten $count bags of ham today') + d = dict(count=7) + eq(s.substitute(d), 'tim has eaten 7 bags of ham today') + eq(s.safe_substitute(d), 'tim has eaten 7 bags of ham today') + s = string.Template('tim has eaten ${count} bags of ham today') + eq(s.substitute(d), 'tim has eaten 7 bags of ham today') + + def test_tupleargs(self): + eq = self.assertEqual + s = string.Template('$who ate ${meal}') + d = dict(who=('tim', 'fred'), meal=('ham', 'kung pao')) + eq(s.substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") + eq(s.safe_substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") + + def test_SafeTemplate(self): + eq = self.assertEqual + s = string.Template('$who likes ${what} for ${meal}') + eq(s.safe_substitute(dict(who='tim')), 'tim likes ${what} for ${meal}') + eq(s.safe_substitute(dict(what='ham')), '$who likes ham for ${meal}') + eq(s.safe_substitute(dict(what='ham', meal='dinner')), + '$who likes ham for dinner') + eq(s.safe_substitute(dict(who='tim', what='ham')), + 'tim likes ham for ${meal}') + eq(s.safe_substitute(dict(who='tim', what='ham', meal='dinner')), + 'tim likes ham for dinner') + + def test_invalid_placeholders(self): + raises = self.assertRaises + s = string.Template('$who likes $') + raises(ValueError, s.substitute, dict(who='tim')) + s = string.Template('$who likes ${what)') + raises(ValueError, s.substitute, dict(who='tim')) + s = string.Template('$who likes $100') + raises(ValueError, s.substitute, dict(who='tim')) + + def test_idpattern_override(self): + class PathPattern(string.Template): + idpattern = r'[_a-z][._a-z0-9]*' + m = Mapping() + m.bag = Bag() + m.bag.foo = Bag() + m.bag.foo.who = 'tim' + m.bag.what = 'ham' + s = PathPattern('$bag.foo.who likes to eat a bag of $bag.what') + self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') + + def test_pattern_override(self): + class MyPattern(string.Template): + pattern = r""" + (?P@{2}) | + @(?P[_a-z][._a-z0-9]*) | + @{(?P[_a-z][._a-z0-9]*)} | + (?P@) + """ + m = Mapping() + m.bag = Bag() + m.bag.foo = Bag() + m.bag.foo.who = 'tim' + m.bag.what = 'ham' + s = MyPattern('@bag.foo.who likes to eat a bag of @bag.what') + self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') + + class BadPattern(string.Template): + pattern = r""" + (?P.*) | + (?P@{2}) | + @(?P[_a-z][._a-z0-9]*) | + @{(?P[_a-z][._a-z0-9]*)} | + (?P@) | + """ + s = BadPattern('@bag.foo.who likes to eat a bag of @bag.what') + self.assertRaises(ValueError, s.substitute, {}) + self.assertRaises(ValueError, s.safe_substitute, {}) + + def test_braced_override(self): + class MyTemplate(string.Template): + pattern = r""" + \$(?: + (?P$) | + (?P[_a-z][_a-z0-9]*) | + @@(?P[_a-z][_a-z0-9]*)@@ | + (?P) | + ) + """ + + tmpl = 'PyCon in $@@location@@' + t = MyTemplate(tmpl) + self.assertRaises(KeyError, t.substitute, {}) + val = t.substitute({'location': 'Cleveland'}) + self.assertEqual(val, 'PyCon in Cleveland') + + def test_braced_override_safe(self): + class MyTemplate(string.Template): + pattern = r""" + \$(?: + (?P$) | + (?P[_a-z][_a-z0-9]*) | + @@(?P[_a-z][_a-z0-9]*)@@ | + (?P) | + ) + """ + + tmpl = 'PyCon in $@@location@@' + t = MyTemplate(tmpl) + self.assertEqual(t.safe_substitute(), tmpl) + val = t.safe_substitute({'location': 'Cleveland'}) + self.assertEqual(val, 'PyCon in Cleveland') + + def test_invalid_with_no_lines(self): + # The error formatting for invalid templates + # has a special case for no data that the default + # pattern can't trigger (always has at least '$') + # So we craft a pattern that is always invalid + # with no leading data. + class MyTemplate(string.Template): + pattern = r""" + (?P) | + unreachable( + (?P) | + (?P) | + (?P) + ) + """ + s = MyTemplate('') + with self.assertRaises(ValueError) as err: + s.substitute({}) + self.assertIn('line 1, col 1', str(err.exception)) + + def test_unicode_values(self): + s = string.Template('$who likes $what') + d = dict(who='t\xffm', what='f\xfe\fed') + self.assertEqual(s.substitute(d), 't\xffm likes f\xfe\x0ced') + + def test_keyword_arguments(self): + eq = self.assertEqual + s = string.Template('$who likes $what') + eq(s.substitute(who='tim', what='ham'), 'tim likes ham') + eq(s.substitute(dict(who='tim'), what='ham'), 'tim likes ham') + eq(s.substitute(dict(who='fred', what='kung pao'), + who='tim', what='ham'), + 'tim likes ham') + s = string.Template('the mapping is $mapping') + eq(s.substitute(dict(foo='none'), mapping='bozo'), + 'the mapping is bozo') + eq(s.substitute(dict(mapping='one'), mapping='two'), + 'the mapping is two') + + s = string.Template('the self is $self') + eq(s.substitute(self='bozo'), 'the self is bozo') + + def test_keyword_arguments_safe(self): + eq = self.assertEqual + raises = self.assertRaises + s = string.Template('$who likes $what') + eq(s.safe_substitute(who='tim', what='ham'), 'tim likes ham') + eq(s.safe_substitute(dict(who='tim'), what='ham'), 'tim likes ham') + eq(s.safe_substitute(dict(who='fred', what='kung pao'), + who='tim', what='ham'), + 'tim likes ham') + s = string.Template('the mapping is $mapping') + eq(s.safe_substitute(dict(foo='none'), mapping='bozo'), + 'the mapping is bozo') + eq(s.safe_substitute(dict(mapping='one'), mapping='two'), + 'the mapping is two') + d = dict(mapping='one') + raises(TypeError, s.substitute, d, {}) + raises(TypeError, s.safe_substitute, d, {}) + + s = string.Template('the self is $self') + eq(s.safe_substitute(self='bozo'), 'the self is bozo') + + def test_delimiter_override(self): + eq = self.assertEqual + raises = self.assertRaises + class AmpersandTemplate(string.Template): + delimiter = '&' + s = AmpersandTemplate('this &gift is for &{who} &&') + eq(s.substitute(gift='bud', who='you'), 'this bud is for you &') + raises(KeyError, s.substitute) + eq(s.safe_substitute(gift='bud', who='you'), 'this bud is for you &') + eq(s.safe_substitute(), 'this &gift is for &{who} &') + s = AmpersandTemplate('this &gift is for &{who} &') + raises(ValueError, s.substitute, dict(gift='bud', who='you')) + eq(s.safe_substitute(), 'this &gift is for &{who} &') + + class PieDelims(string.Template): + delimiter = '@' + s = PieDelims('@who likes to eat a bag of @{what} worth $100') + self.assertEqual(s.substitute(dict(who='tim', what='ham')), + 'tim likes to eat a bag of ham worth $100') + + if __name__ == "__main__": unittest.main() diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -176,6 +176,7 @@ Georg Brandl Christopher Brannon Terrence Brannon +Erin Braswell Sven Brauch Germ?n M. Bravo Erik Bray -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 19:44:53 2016 From: python-checkins at python.org (gregory.p.smith) Date: Thu, 02 Jun 2016 23:44:53 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI1NzAy?= =?utf-8?q?=3A_A_--with-lto_configure_option_has_been_added_that_will?= Message-ID: <20160602234450.1088.59348.9E1E990C@psf.io> https://hg.python.org/cpython/rev/f710dac07312 changeset: 101626:f710dac07312 branch: 2.7 parent: 101611:9533f28a9058 user: Gregory P. Smith [Google Inc.] date: Thu Jun 02 23:44:40 2016 +0000 summary: Issue #25702: A --with-lto configure option has been added that will enable link time optimizations at build time during a make profile-opt. Some compilers and toolchains are known to not produce stable code when using LTO, be sure to test things thoroughly before relying on it. It can provide a few % speed up over profile-opt alone. files: Makefile.pre.in | 4 +- Misc/NEWS | 6 ++++ configure | 47 +++++++++++++++++++++++++++++++++++++ configure.ac | 34 ++++++++++++++++++++++++++ 4 files changed, 89 insertions(+), 2 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -451,7 +451,7 @@ $(MAKE) profile-removal build_all_generate_profile: - $(MAKE) all CFLAGS="$(CFLAGS) $(PGO_PROF_GEN_FLAG)" LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG)" LIBS="$(LIBS)" + $(MAKE) all CFLAGS="$(CFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) $(PGO_PROF_GEN_FLAG) @LTOFLAGS@" LIBS="$(LIBS)" run_profile_task: : # FIXME: can't run for a cross build @@ -461,7 +461,7 @@ $(LLVM_PROF_MERGER) build_all_use_profile: - $(MAKE) all CFLAGS="$(CFLAGS) $(PGO_PROF_USE_FLAG)" + $(MAKE) all CFLAGS="$(CFLAGS) $(PGO_PROF_USE_FLAG) @LTOFLAGS@" LDFLAGS="$(LDFLAGS) @LTOFLAGS@" # Compile and run with gcov .PHONY=coverage coverage-lcov coverage-report diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,12 @@ Core and Builtins ----------------- +- Issue #25702: A --with-lto configure option has been added that will + enable link time optimizations at build time during a make profile-opt. + Some compilers and toolchains are known to not produce stable code when + using LTO, be sure to test things thoroughly before relying on it. + It can provide a few % speed up over profile-opt alone. + - Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N" format unit. diff --git a/configure b/configure --- a/configure +++ b/configure @@ -667,6 +667,7 @@ LLVM_PROF_MERGER PGO_PROF_USE_FLAG PGO_PROF_GEN_FLAG +LTOFLAGS UNIVERSAL_ARCH_FLAGS BASECFLAGS OPT @@ -796,6 +797,7 @@ enable_shared enable_profiling with_pydebug +with_lto enable_toolbox_glue with_libs with_system_expat @@ -1477,6 +1479,8 @@ compiler --with-suffix=.exe set executable suffix --with-pydebug build with Py_DEBUG defined + --with-lto Enable Link Time Optimization in PGO builds. + Disabled by default. --with-libs='lib1 ...' link against additional libs --with-system-expat build pyexpat module using an installed expat library @@ -6366,6 +6370,49 @@ fi +# Enable LTO flags + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-lto" >&5 +$as_echo_n "checking for --with-lto... " >&6; } + +# Check whether --with-lto was given. +if test "${with_lto+set}" = set; then : + withval=$with_lto; +if test "$withval" != no +then + Py_LTO='true' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; +else + Py_LTO='false' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; }; +fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + +if test "$Py_LTO" = 'true' ; then + case $CC in + *clang*) + # Any changes made here should be reflected in the GCC+Darwin case below + LTOFLAGS="-flto" + ;; + *gcc*) + case $ac_sys_system in + Darwin*) + LTOFLAGS="-flto" + ;; + *) + LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none" + ;; + esac + ;; + esac +fi + + # Enable PGO flags. diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -1377,6 +1377,40 @@ fi +# Enable LTO flags +AC_SUBST(LTOFLAGS) +AC_MSG_CHECKING(for --with-lto) +AC_ARG_WITH(lto, AS_HELP_STRING([--with-lto], [Enable Link Time Optimization in PGO builds. Disabled by default.]), +[ +if test "$withval" != no +then + Py_LTO='true' + AC_MSG_RESULT(yes); +else + Py_LTO='false' + AC_MSG_RESULT(no); +fi], +[AC_MSG_RESULT(no)]) +if test "$Py_LTO" = 'true' ; then + case $CC in + *clang*) + # Any changes made here should be reflected in the GCC+Darwin case below + LTOFLAGS="-flto" + ;; + *gcc*) + case $ac_sys_system in + Darwin*) + LTOFLAGS="-flto" + ;; + *) + LTOFLAGS="-flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none" + ;; + esac + ;; + esac +fi + + # Enable PGO flags. AC_SUBST(PGO_PROF_GEN_FLAG) AC_SUBST(PGO_PROF_USE_FLAG) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 19:50:14 2016 From: python-checkins at python.org (gregory.p.smith) Date: Thu, 02 Jun 2016 23:50:14 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Exclude_unitte?= =?utf-8?q?sts_from_the_make_profile-opt_training_run_that_either?= Message-ID: <20160602235013.4754.89826.5FF78C98@psf.io> https://hg.python.org/cpython/rev/70ed9af54aab changeset: 101627:70ed9af54aab branch: 2.7 user: Gregory P. Smith [Google Inc.] date: Thu Jun 02 23:50:07 2016 +0000 summary: Exclude unittests from the make profile-opt training run that either take a rediculious amount of time to run, fail or provide little use to the profile feedback. (similar to what is already done in 3.5 and by major Linux distro builds own profiling runs) files: Makefile.pre.in | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -210,7 +210,9 @@ TCLTK_LIBS= @TCLTK_LIBS@ # The task to run while instrument when building the profile-opt target -PROFILE_TASK=-m test.regrtest --pgo +# We exclude unittests with -x that take a rediculious amount of time to +# run in the instrumented training build or do not provide much value. +PROFILE_TASK=-m test.regrtest --pgo -x test_asyncore test_gdb test_multiprocessing test_subprocess # report files for gcov / lcov coverage report COVERAGE_INFO= $(abs_builddir)/coverage.info -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 20:06:30 2016 From: python-checkins at python.org (r.david.murray) Date: Fri, 03 Jun 2016 00:06:30 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogIzI2ODI5OiBDbGFy?= =?utf-8?q?ify_that_namespace_is_copied_to_a_new_=5F=5Fdict=5F=5F_in_insta?= =?utf-8?q?nce_creation=2E?= Message-ID: <20160603000629.4951.64934.E7D71A67@psf.io> https://hg.python.org/cpython/rev/754118f8b3ce changeset: 101628:754118f8b3ce branch: 3.5 parent: 101624:89abefdebf4d user: R David Murray date: Thu Jun 02 20:05:43 2016 -0400 summary: #26829: Clarify that namespace is copied to a new __dict__ in instance creation. Patch by Emily Morehouse. files: Doc/library/functions.rst | 5 +++-- Doc/reference/datamodel.rst | 5 +++++ Misc/ACKS | 1 + 3 files changed, 9 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 @@ -1449,8 +1449,9 @@ class name and becomes the :attr:`~class.__name__` attribute; the *bases* tuple itemizes the base classes and becomes the :attr:`~class.__bases__` attribute; and the *dict* dictionary is the namespace containing definitions - for class body and becomes the :attr:`~object.__dict__` attribute. For - example, the following two statements create identical :class:`type` objects: + for class body and is copied to a standard dictionary to become the + :attr:`~object.__dict__` attribute. For example, the following two + statements create identical :class:`type` objects: >>> class X: ... a = 1 diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1734,6 +1734,11 @@ included in the class definition (if any) and the resulting object is bound in the local namespace as the defined class. +When a new class is created by ``type.__new__``, the object provided as the +namespace parameter is copied to a standard Python dictionary and the original +object is discarded. The new copy becomes the :attr:`~object.__dict__` attribute +of the class object. + .. seealso:: :pep:`3135` - New super diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -999,6 +999,7 @@ Paul Moore Ross Moore Ben Morgan +Emily Morehouse Derek Morr James A Morrison Martin Morrison -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 20:06:32 2016 From: python-checkins at python.org (r.david.murray) Date: Fri, 03 Jun 2016 00:06:32 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge=3A_=2326829=3A_Clarify_that_namespace_is_copied_to?= =?utf-8?q?_a_new_=5F=5Fdict=5F=5F_in_instance?= Message-ID: <20160603000630.70387.98373.22293DD9@psf.io> https://hg.python.org/cpython/rev/5a4ace14b350 changeset: 101629:5a4ace14b350 parent: 101625:c2d3d8c3e0bf parent: 101628:754118f8b3ce user: R David Murray date: Thu Jun 02 20:06:13 2016 -0400 summary: Merge: #26829: Clarify that namespace is copied to a new __dict__ in instance creation. files: Doc/library/functions.rst | 5 +++-- Doc/reference/datamodel.rst | 5 +++++ Misc/ACKS | 1 + 3 files changed, 9 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 @@ -1449,8 +1449,9 @@ class name and becomes the :attr:`~class.__name__` attribute; the *bases* tuple itemizes the base classes and becomes the :attr:`~class.__bases__` attribute; and the *dict* dictionary is the namespace containing definitions - for class body and becomes the :attr:`~object.__dict__` attribute. For - example, the following two statements create identical :class:`type` objects: + for class body and is copied to a standard dictionary to become the + :attr:`~object.__dict__` attribute. For example, the following two + statements create identical :class:`type` objects: >>> class X: ... a = 1 diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -1735,6 +1735,11 @@ included in the class definition (if any) and the resulting object is bound in the local namespace as the defined class. +When a new class is created by ``type.__new__``, the object provided as the +namespace parameter is copied to a standard Python dictionary and the original +object is discarded. The new copy becomes the :attr:`~object.__dict__` attribute +of the class object. + .. seealso:: :pep:`3135` - New super diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1007,6 +1007,7 @@ Paul Moore Ross Moore Ben Morgan +Emily Morehouse Derek Morr James A Morrison Martin Morrison -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 20:16:09 2016 From: python-checkins at python.org (gregory.p.smith) Date: Fri, 03 Jun 2016 00:16:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2325931=3A_Don=27t_?= =?utf-8?q?defining_socketserver=2EForking*_names_on_platforms_such?= Message-ID: <20160603001609.4712.70008.167E5CC0@psf.io> https://hg.python.org/cpython/rev/d772400a1211 changeset: 101630:d772400a1211 user: Gregory P. Smith [Google Inc.] date: Fri Jun 03 00:13:36 2016 +0000 summary: Issue #25931: Don't defining socketserver.Forking* names on platforms such as Windows that do not support os.fork(). files: Lib/socketserver.py | 17 +++++++++++------ Misc/NEWS | 3 +++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Lib/socketserver.py b/Lib/socketserver.py --- a/Lib/socketserver.py +++ b/Lib/socketserver.py @@ -134,10 +134,12 @@ import dummy_threading as threading from time import monotonic as time -__all__ = ["BaseServer", "TCPServer", "UDPServer", "ForkingUDPServer", - "ForkingTCPServer", "ThreadingUDPServer", "ThreadingTCPServer", +__all__ = ["BaseServer", "TCPServer", "UDPServer", + "ThreadingUDPServer", "ThreadingTCPServer", "BaseRequestHandler", "StreamRequestHandler", - "DatagramRequestHandler", "ThreadingMixIn", "ForkingMixIn"] + "DatagramRequestHandler", "ThreadingMixIn"] +if hasattr(os, "fork"): + __all__.extend(["ForkingUDPServer","ForkingTCPServer", "ForkingMixIn"]) if hasattr(socket, "AF_UNIX"): __all__.extend(["UnixStreamServer","UnixDatagramServer", "ThreadingUnixStreamServer", @@ -537,7 +539,9 @@ # No need to close anything. pass -class ForkingMixIn: +if hasattr(os, "fork"): + # Non-standard indentation on this statement to avoid reindenting the body. + class ForkingMixIn: """Mix-in class to handle each request in a new process.""" @@ -647,8 +651,9 @@ t.start() -class ForkingUDPServer(ForkingMixIn, UDPServer): pass -class ForkingTCPServer(ForkingMixIn, TCPServer): pass +if hasattr(os, "fork"): + class ForkingUDPServer(ForkingMixIn, UDPServer): pass + class ForkingTCPServer(ForkingMixIn, TCPServer): pass class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass class ThreadingTCPServer(ThreadingMixIn, TCPServer): pass diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -22,6 +22,9 @@ Library ------- +- Issue #25931: Don't defining socketserver.Forking* names on platforms such + as Windows that do not support os.fork(). + - Issue #21776: distutils.upload now correctly handles HTTPError. Initial patch by Claudiu Popa. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 20:16:09 2016 From: python-checkins at python.org (gregory.p.smith) Date: Fri, 03 Jun 2016 00:16:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Reindent_properly=2E?= Message-ID: <20160603001609.2056.10093.B713203F@psf.io> https://hg.python.org/cpython/rev/470058bcec44 changeset: 101631:470058bcec44 user: Gregory P. Smith [Google Inc.] date: Fri Jun 03 00:16:02 2016 +0000 summary: Reindent properly. files: Lib/socketserver.py | 138 +++++++++++++++---------------- 1 files changed, 68 insertions(+), 70 deletions(-) diff --git a/Lib/socketserver.py b/Lib/socketserver.py --- a/Lib/socketserver.py +++ b/Lib/socketserver.py @@ -540,87 +540,85 @@ pass if hasattr(os, "fork"): - # Non-standard indentation on this statement to avoid reindenting the body. - class ForkingMixIn: + class ForkingMixIn: + """Mix-in class to handle each request in a new process.""" - """Mix-in class to handle each request in a new process.""" + timeout = 300 + active_children = None + max_children = 40 - timeout = 300 - active_children = None - max_children = 40 + def collect_children(self): + """Internal routine to wait for children that have exited.""" + if self.active_children is None: + return - def collect_children(self): - """Internal routine to wait for children that have exited.""" - if self.active_children is None: - return + # If we're above the max number of children, wait and reap them until + # we go back below threshold. Note that we use waitpid(-1) below to be + # able to collect children in size() syscalls instead + # of size(): the downside is that this might reap children + # which we didn't spawn, which is why we only resort to this when we're + # above max_children. + while len(self.active_children) >= self.max_children: + try: + pid, _ = os.waitpid(-1, 0) + self.active_children.discard(pid) + except ChildProcessError: + # we don't have any children, we're done + self.active_children.clear() + except OSError: + break - # If we're above the max number of children, wait and reap them until - # we go back below threshold. Note that we use waitpid(-1) below to be - # able to collect children in size() syscalls instead - # of size(): the downside is that this might reap children - # which we didn't spawn, which is why we only resort to this when we're - # above max_children. - while len(self.active_children) >= self.max_children: - try: - pid, _ = os.waitpid(-1, 0) - self.active_children.discard(pid) - except ChildProcessError: - # we don't have any children, we're done - self.active_children.clear() - except OSError: - break + # Now reap all defunct children. + for pid in self.active_children.copy(): + try: + pid, _ = os.waitpid(pid, os.WNOHANG) + # if the child hasn't exited yet, pid will be 0 and ignored by + # discard() below + self.active_children.discard(pid) + except ChildProcessError: + # someone else reaped it + self.active_children.discard(pid) + except OSError: + pass - # Now reap all defunct children. - for pid in self.active_children.copy(): - try: - pid, _ = os.waitpid(pid, os.WNOHANG) - # if the child hasn't exited yet, pid will be 0 and ignored by - # discard() below - self.active_children.discard(pid) - except ChildProcessError: - # someone else reaped it - self.active_children.discard(pid) - except OSError: - pass + def handle_timeout(self): + """Wait for zombies after self.timeout seconds of inactivity. - def handle_timeout(self): - """Wait for zombies after self.timeout seconds of inactivity. + May be extended, do not override. + """ + self.collect_children() - May be extended, do not override. - """ - self.collect_children() + def service_actions(self): + """Collect the zombie child processes regularly in the ForkingMixIn. - def service_actions(self): - """Collect the zombie child processes regularly in the ForkingMixIn. + service_actions is called in the BaseServer's serve_forver loop. + """ + self.collect_children() - service_actions is called in the BaseServer's serve_forver loop. - """ - self.collect_children() - - def process_request(self, request, client_address): - """Fork a new subprocess to process the request.""" - pid = os.fork() - if pid: - # Parent process - if self.active_children is None: - self.active_children = set() - self.active_children.add(pid) - self.close_request(request) - return - else: - # Child process. - # This must never return, hence os._exit()! - status = 1 - try: - self.finish_request(request, client_address) - status = 0 - except Exception: - self.handle_error(request, client_address) - finally: + def process_request(self, request, client_address): + """Fork a new subprocess to process the request.""" + pid = os.fork() + if pid: + # Parent process + if self.active_children is None: + self.active_children = set() + self.active_children.add(pid) + self.close_request(request) + return + else: + # Child process. + # This must never return, hence os._exit()! + status = 1 try: - self.shutdown_request(request) + self.finish_request(request, client_address) + status = 0 + except Exception: + self.handle_error(request, client_address) finally: - os._exit(status) + try: + self.shutdown_request(request) + finally: + os._exit(status) class ThreadingMixIn: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 20:31:36 2016 From: python-checkins at python.org (gregory.p.smith) Date: Fri, 03 Jun 2016 00:31:36 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Document_that_?= =?utf-8?q?CalledProcessError=2Ereturncode_is_the_negative?= Message-ID: <20160603003132.1088.45637.8BFD1EB9@psf.io> https://hg.python.org/cpython/rev/7b12180481da changeset: 101632:7b12180481da branch: 3.5 parent: 101628:754118f8b3ce user: Gregory P. Smith [Google Inc.] date: Fri Jun 03 00:31:21 2016 +0000 summary: Document that CalledProcessError.returncode is the negative signal number when the process died due to a signal. files: Doc/library/subprocess.rst | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -188,7 +188,8 @@ .. attribute:: returncode - Exit status of the child process. + Exit status of the child process. If the process exited due to a + signal, this will be the negative signal number. .. attribute:: cmd -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 20:33:09 2016 From: python-checkins at python.org (gregory.p.smith) Date: Fri, 03 Jun 2016 00:33:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogbWVyZ2UgMy41?= Message-ID: <20160603003308.5003.62428.748ADEE4@psf.io> https://hg.python.org/cpython/rev/19d77132f38d changeset: 101633:19d77132f38d parent: 101631:470058bcec44 parent: 101632:7b12180481da user: Gregory P. Smith [Google Inc.] date: Fri Jun 03 00:33:02 2016 +0000 summary: merge 3.5 files: Doc/library/subprocess.rst | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -188,7 +188,8 @@ .. attribute:: returncode - Exit status of the child process. + Exit status of the child process. If the process exited due to a + signal, this will be the negative signal number. .. attribute:: cmd -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 20:59:55 2016 From: python-checkins at python.org (gregory.p.smith) Date: Fri, 03 Jun 2016 00:59:55 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_typo_fix?= Message-ID: <20160603005948.70683.90435.5EE492C9@psf.io> https://hg.python.org/cpython/rev/9c8be3b89964 changeset: 101634:9c8be3b89964 user: Gregory P. Smith [Google Inc.] date: Fri Jun 03 00:57:26 2016 +0000 summary: typo fix files: Misc/NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -22,7 +22,7 @@ Library ------- -- Issue #25931: Don't defining socketserver.Forking* names on platforms such +- Issue #25931: Don't define socketserver.Forking* names on platforms such as Windows that do not support os.fork(). - Issue #21776: distutils.upload now correctly handles HTTPError. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 2 22:03:25 2016 From: python-checkins at python.org (berker.peksag) Date: Fri, 03 Jun 2016 02:03:25 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Issue_=2327191=3A_Improve_mar?= =?utf-8?q?kup_of_PEP_8=2C_patch_by_Ian_Lee?= Message-ID: <20160603020325.15728.77511.42F22441@psf.io> https://hg.python.org/peps/rev/bf7f369fb49a changeset: 6348:bf7f369fb49a user: Berker Peksag date: Thu Jun 02 19:13:50 2016 -0700 summary: Issue #27191: Improve markup of PEP 8, patch by Ian Lee files: pep-0008.txt | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pep-0008.txt b/pep-0008.txt --- a/pep-0008.txt +++ b/pep-0008.txt @@ -1183,8 +1183,8 @@ do_stuff_in_transaction(conn) The latter example doesn't provide any information to indicate that - the __enter__ and __exit__ methods are doing something other than - closing the connection after a transaction. Being explicit is + the ``__enter__`` and ``__exit__`` methods are doing something other + than closing the connection after a transaction. Being explicit is important in this case. - Be consistent in return statements. Either all return statements in -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Fri Jun 3 01:26:22 2016 From: python-checkins at python.org (gregory.p.smith) Date: Fri, 03 Jun 2016 05:26:22 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue25931=3A_fix_tests_br?= =?utf-8?q?oken_by_the_conditional_define_of_socketserver=2EForking*?= Message-ID: <20160603052622.69987.41738.F097F880@psf.io> https://hg.python.org/cpython/rev/3145242bc81f changeset: 101635:3145242bc81f user: Gregory P. Smith [Google Inc.] date: Fri Jun 03 05:26:14 2016 +0000 summary: Issue25931: fix tests broken by the conditional define of socketserver.Forking* files: Lib/test/test_socketserver.py | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py --- a/Lib/test/test_socketserver.py +++ b/Lib/test/test_socketserver.py @@ -44,7 +44,7 @@ else: raise RuntimeError("timed out on %r" % (sock,)) -if HAVE_UNIX_SOCKETS: +if HAVE_UNIX_SOCKETS and HAVE_FORKING: class ForkingUnixStreamServer(socketserver.ForkingMixIn, socketserver.UnixStreamServer): pass @@ -368,11 +368,12 @@ self.done.wait() -class ForkingErrorTestServer(socketserver.ForkingMixIn, BaseErrorTestServer): - def wait_done(self): - [child] = self.active_children - os.waitpid(child, 0) - self.active_children.clear() +if HAVE_FORKING: + class ForkingErrorTestServer(socketserver.ForkingMixIn, BaseErrorTestServer): + def wait_done(self): + [child] = self.active_children + os.waitpid(child, 0) + self.active_children.clear() class MiscTestCase(unittest.TestCase): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 01:45:05 2016 From: python-checkins at python.org (gregory.p.smith) Date: Fri, 03 Jun 2016 05:45:05 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_issue25931=3A_document_tha?= =?utf-8?q?t_socketserver=2EForking*_are_unavailable_on_platforms?= Message-ID: <20160603054505.5068.16998.5C4C3374@psf.io> https://hg.python.org/cpython/rev/015b86646d8e changeset: 101636:015b86646d8e user: Gregory P. Smith [Google Inc.] date: Fri Jun 03 05:44:47 2016 +0000 summary: issue25931: document that socketserver.Forking* are unavailable on platforms lacking os.fork(). files: Doc/library/socketserver.rst | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst --- a/Doc/library/socketserver.rst +++ b/Doc/library/socketserver.rst @@ -112,6 +112,8 @@ :class:`UDPServer`. Setting the various attributes also changes the behavior of the underlying server mechanism. + :class:`ForkingMixIn` and the Forking classes mentioned below are + only available on POSIX platforms that support :func:`~os.fork`. .. class:: ForkingTCPServer ForkingUDPServer @@ -619,3 +621,5 @@ The :class:`ForkingMixIn` class is used in the same way, except that the server will spawn a new process for each request. +Available only on POSIX platforms that support :func:`~os.fork`. + -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 01:48:33 2016 From: python-checkins at python.org (gregory.p.smith) Date: Fri, 03 Jun 2016 05:48:33 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogaXNzdWUyNTkzMTog?= =?utf-8?q?document_that_socketserver=2EForking*_are_unavailable_on_platfo?= =?utf-8?q?rms?= Message-ID: <20160603054833.5598.240.ABBDF956@psf.io> https://hg.python.org/cpython/rev/a4c0208b10df changeset: 101637:a4c0208b10df branch: 2.7 parent: 101627:70ed9af54aab user: Gregory P. Smith [Google Inc.] date: Fri Jun 03 05:48:23 2016 +0000 summary: issue25931: document that socketserver.Forking* are unavailable on platforms that support os.fork. files: Doc/library/socketserver.rst | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst --- a/Doc/library/socketserver.rst +++ b/Doc/library/socketserver.rst @@ -116,6 +116,9 @@ :class:`UDPServer`. Setting the various attributes also changes the behavior of the underlying server mechanism. + :class:`ForkingMixIn` and the Forking classes mentioned below are + only available on POSIX platforms that support :func:`~os.fork`. + .. class:: ForkingTCPServer ForkingUDPServer @@ -612,3 +615,4 @@ The :class:`ForkingMixIn` class is used in the same way, except that the server will spawn a new process for each request. +Available only on POSIX platforms that support :func:`~os.fork`. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 02:14:20 2016 From: python-checkins at python.org (gregory.p.smith) Date: Fri, 03 Jun 2016 06:14:20 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327167=3A_Clarify_?= =?utf-8?q?the_subprocess=2ECalledProcessError_error_message_text?= Message-ID: <20160603061417.69829.22022.B70FAF6F@psf.io> https://hg.python.org/cpython/rev/f2d13349ea5d changeset: 101638:f2d13349ea5d parent: 101636:015b86646d8e user: Gregory P. Smith [Google Inc.] date: Fri Jun 03 06:14:06 2016 +0000 summary: Issue #27167: Clarify the subprocess.CalledProcessError error message text when the child process died due to a signal. files: Lib/subprocess.py | 19 +++++++++++++++---- Lib/test/test_subprocess.py | 19 +++++++++++++++++++ Misc/NEWS | 3 +++ 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -372,9 +372,11 @@ class CalledProcessError(SubprocessError): - """This exception is raised when a process run by check_call() or - check_output() returns a non-zero exit status. - The exit status will be stored in the returncode attribute; + """Raised when a check_call() or check_output() process returns non-zero. + + The exit status will be stored in the returncode attribute, negative + if it represents a signal number. + check_output() will also store the output in the output attribute. """ def __init__(self, returncode, cmd, output=None, stderr=None): @@ -384,7 +386,16 @@ self.stderr = stderr def __str__(self): - return "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode) + if self.returncode and self.returncode < 0: + try: + return "Command '%s' died with %r." % ( + self.cmd, signal.Signals(-self.returncode)) + except ValueError: + return "Command '%s' died with unknown signal %d." % ( + self.cmd, -self.returncode) + else: + return "Command '%s' returned non-zero exit status %d." % ( + self.cmd, self.returncode) @property def stdout(self): 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 @@ -1427,6 +1427,25 @@ p.wait() self.assertEqual(-p.returncode, signal.SIGABRT) + def test_CalledProcessError_str_signal(self): + err = subprocess.CalledProcessError(-int(signal.SIGABRT), "fake cmd") + error_string = str(err) + # We're relying on the repr() of the signal.Signals intenum to provide + # the word signal, the signal name and the numeric value. + self.assertIn("signal", error_string.lower()) + self.assertIn("SIGABRT", error_string) + self.assertIn(str(signal.SIGABRT), error_string) + + def test_CalledProcessError_str_unknown_signal(self): + err = subprocess.CalledProcessError(-9876543, "fake cmd") + error_string = str(err) + self.assertIn("unknown signal 9876543.", error_string) + + def test_CalledProcessError_str_non_zero(self): + err = subprocess.CalledProcessError(2, "fake cmd") + error_string = str(err) + self.assertIn("non-zero exit status 2.", error_string) + def test_preexec(self): # DISCLAIMER: Setting environment variables is *not* a good use # of a preexec_fn. This is merely a test. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -22,6 +22,9 @@ Library ------- +- Issue #27167: Clarify the subprocess.CalledProcessError error message text + when the child process died due to a signal. + - Issue #25931: Don't define socketserver.Forking* names on platforms such as Windows that do not support os.fork(). -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 02:19:47 2016 From: python-checkins at python.org (gregory.p.smith) Date: Fri, 03 Jun 2016 06:19:47 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_issue27167=3A_make_the_tes?= =?utf-8?q?t_not_care_about_the_exact_signal_name_in_the?= Message-ID: <20160603061943.38592.62513.011E6982@psf.io> https://hg.python.org/cpython/rev/1022d09d11e5 changeset: 101639:1022d09d11e5 user: Gregory P. Smith [Google Inc.] date: Fri Jun 03 06:19:35 2016 +0000 summary: issue27167: make the test not care about the exact signal name in the error message as some numbers map to multiple names. files: Lib/test/test_subprocess.py | 4 +++- 1 files changed, 3 insertions(+), 1 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 @@ -1433,7 +1433,9 @@ # We're relying on the repr() of the signal.Signals intenum to provide # the word signal, the signal name and the numeric value. self.assertIn("signal", error_string.lower()) - self.assertIn("SIGABRT", error_string) + # We're not being specific about the signal name as some signals have + # multiple names and which name is revealed can vary. + self.assertIn("SIG", error_string) self.assertIn(str(signal.SIGABRT), error_string) def test_CalledProcessError_str_unknown_signal(self): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 02:39:19 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 03 Jun 2016 06:39:19 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI3MTg1?= =?utf-8?q?=3A_Rename_test=5Fstring=2Epy_to_test=5Fstring=5Fmerged=2Epy=2E?= Message-ID: <20160603063918.14697.51817.DD380A66@psf.io> https://hg.python.org/cpython/rev/27f5eb630499 changeset: 101640:27f5eb630499 branch: 2.7 parent: 101637:a4c0208b10df user: Serhiy Storchaka date: Fri Jun 03 09:24:01 2016 +0300 summary: Issue #27185: Rename test_string.py to test_string_merged.py. files: Lib/test/test_string_merged.py | 0 1 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_string.py b/Lib/test/test_string_merged.py rename from Lib/test/test_string.py rename to Lib/test/test_string_merged.py -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 02:39:19 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 03 Jun 2016 06:39:19 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf-8?q?_Issue_=2327185=3A_Merge_test=5Fpep292=2Epy_into_test=5Fstring?= =?utf-8?b?X21lcmdlZC5weS4=?= Message-ID: <20160603063918.5598.55964.0E6DEABC@psf.io> https://hg.python.org/cpython/rev/7dac80e0dd5e changeset: 101642:7dac80e0dd5e branch: 2.7 parent: 101640:27f5eb630499 parent: 101641:8218b1309178 user: Serhiy Storchaka date: Fri Jun 03 09:36:15 2016 +0300 summary: Issue #27185: Merge test_pep292.py into test_string_merged.py. files: Lib/test/test_pep292.py | 234 --------------------- Lib/test/test_string_merged.py | 231 ++++++++++++++++++++- 2 files changed, 226 insertions(+), 239 deletions(-) diff --git a/Lib/test/test_pep292.py b/Lib/test/test_pep292.py deleted file mode 100644 --- a/Lib/test/test_pep292.py +++ /dev/null @@ -1,234 +0,0 @@ -# Copyright (C) 2004 Python Software Foundation -# Author: barry at python.org (Barry Warsaw) -# License: http://www.opensource.org/licenses/PythonSoftFoundation.php - -import unittest -from string import Template - - -class Bag: - pass - -class Mapping: - def __getitem__(self, name): - obj = self - for part in name.split('.'): - try: - obj = getattr(obj, part) - except AttributeError: - raise KeyError(name) - return obj - - -class TestTemplate(unittest.TestCase): - def test_regular_templates(self): - s = Template('$who likes to eat a bag of $what worth $$100') - self.assertEqual(s.substitute(dict(who='tim', what='ham')), - 'tim likes to eat a bag of ham worth $100') - self.assertRaises(KeyError, s.substitute, dict(who='tim')) - self.assertRaises(TypeError, Template.substitute) - - def test_regular_templates_with_braces(self): - s = Template('$who likes ${what} for ${meal}') - d = dict(who='tim', what='ham', meal='dinner') - self.assertEqual(s.substitute(d), 'tim likes ham for dinner') - self.assertRaises(KeyError, s.substitute, - dict(who='tim', what='ham')) - - def test_escapes(self): - eq = self.assertEqual - s = Template('$who likes to eat a bag of $$what worth $$100') - eq(s.substitute(dict(who='tim', what='ham')), - 'tim likes to eat a bag of $what worth $100') - s = Template('$who likes $$') - eq(s.substitute(dict(who='tim', what='ham')), 'tim likes $') - - def test_percents(self): - eq = self.assertEqual - s = Template('%(foo)s $foo ${foo}') - d = dict(foo='baz') - eq(s.substitute(d), '%(foo)s baz baz') - eq(s.safe_substitute(d), '%(foo)s baz baz') - - def test_stringification(self): - eq = self.assertEqual - s = Template('tim has eaten $count bags of ham today') - d = dict(count=7) - eq(s.substitute(d), 'tim has eaten 7 bags of ham today') - eq(s.safe_substitute(d), 'tim has eaten 7 bags of ham today') - s = Template('tim has eaten ${count} bags of ham today') - eq(s.substitute(d), 'tim has eaten 7 bags of ham today') - - def test_tupleargs(self): - eq = self.assertEqual - s = Template('$who ate ${meal}') - d = dict(who=('tim', 'fred'), meal=('ham', 'kung pao')) - eq(s.substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") - eq(s.safe_substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") - - def test_SafeTemplate(self): - eq = self.assertEqual - s = Template('$who likes ${what} for ${meal}') - eq(s.safe_substitute(dict(who='tim')), 'tim likes ${what} for ${meal}') - eq(s.safe_substitute(dict(what='ham')), '$who likes ham for ${meal}') - eq(s.safe_substitute(dict(what='ham', meal='dinner')), - '$who likes ham for dinner') - eq(s.safe_substitute(dict(who='tim', what='ham')), - 'tim likes ham for ${meal}') - eq(s.safe_substitute(dict(who='tim', what='ham', meal='dinner')), - 'tim likes ham for dinner') - - def test_invalid_placeholders(self): - raises = self.assertRaises - s = Template('$who likes $') - raises(ValueError, s.substitute, dict(who='tim')) - s = Template('$who likes ${what)') - raises(ValueError, s.substitute, dict(who='tim')) - s = Template('$who likes $100') - raises(ValueError, s.substitute, dict(who='tim')) - - def test_idpattern_override(self): - class PathPattern(Template): - idpattern = r'[_a-z][._a-z0-9]*' - m = Mapping() - m.bag = Bag() - m.bag.foo = Bag() - m.bag.foo.who = 'tim' - m.bag.what = 'ham' - s = PathPattern('$bag.foo.who likes to eat a bag of $bag.what') - self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') - - def test_pattern_override(self): - class MyPattern(Template): - pattern = r""" - (?P@{2}) | - @(?P[_a-z][._a-z0-9]*) | - @{(?P[_a-z][._a-z0-9]*)} | - (?P@) - """ - m = Mapping() - m.bag = Bag() - m.bag.foo = Bag() - m.bag.foo.who = 'tim' - m.bag.what = 'ham' - s = MyPattern('@bag.foo.who likes to eat a bag of @bag.what') - self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') - - class BadPattern(Template): - pattern = r""" - (?P.*) | - (?P@{2}) | - @(?P[_a-z][._a-z0-9]*) | - @{(?P[_a-z][._a-z0-9]*)} | - (?P@) | - """ - s = BadPattern('@bag.foo.who likes to eat a bag of @bag.what') - self.assertRaises(ValueError, s.substitute, {}) - self.assertRaises(ValueError, s.safe_substitute, {}) - - def test_braced_override(self): - class MyTemplate(Template): - pattern = r""" - \$(?: - (?P$) | - (?P[_a-z][_a-z0-9]*) | - @@(?P[_a-z][_a-z0-9]*)@@ | - (?P) | - ) - """ - - tmpl = 'PyCon in $@@location@@' - t = MyTemplate(tmpl) - self.assertRaises(KeyError, t.substitute, {}) - val = t.substitute({'location': 'Cleveland'}) - self.assertEqual(val, 'PyCon in Cleveland') - - def test_braced_override_safe(self): - class MyTemplate(Template): - pattern = r""" - \$(?: - (?P$) | - (?P[_a-z][_a-z0-9]*) | - @@(?P[_a-z][_a-z0-9]*)@@ | - (?P) | - ) - """ - - tmpl = 'PyCon in $@@location@@' - t = MyTemplate(tmpl) - self.assertEqual(t.safe_substitute(), tmpl) - val = t.safe_substitute({'location': 'Cleveland'}) - self.assertEqual(val, 'PyCon in Cleveland') - - def test_unicode_values(self): - s = Template('$who likes $what') - d = dict(who=u't\xffm', what=u'f\xfe\fed') - self.assertEqual(s.substitute(d), u't\xffm likes f\xfe\x0ced') - - def test_keyword_arguments(self): - eq = self.assertEqual - s = Template('$who likes $what') - eq(s.substitute(who='tim', what='ham'), 'tim likes ham') - eq(s.substitute(dict(who='tim'), what='ham'), 'tim likes ham') - eq(s.substitute(dict(who='fred', what='kung pao'), - who='tim', what='ham'), - 'tim likes ham') - s = Template('the mapping is $mapping') - eq(s.substitute(dict(foo='none'), mapping='bozo'), - 'the mapping is bozo') - eq(s.substitute(dict(mapping='one'), mapping='two'), - 'the mapping is two') - - s = Template('the self is $self') - eq(s.substitute(self='bozo'), 'the self is bozo') - - def test_keyword_arguments_safe(self): - eq = self.assertEqual - raises = self.assertRaises - s = Template('$who likes $what') - eq(s.safe_substitute(who='tim', what='ham'), 'tim likes ham') - eq(s.safe_substitute(dict(who='tim'), what='ham'), 'tim likes ham') - eq(s.safe_substitute(dict(who='fred', what='kung pao'), - who='tim', what='ham'), - 'tim likes ham') - s = Template('the mapping is $mapping') - eq(s.safe_substitute(dict(foo='none'), mapping='bozo'), - 'the mapping is bozo') - eq(s.safe_substitute(dict(mapping='one'), mapping='two'), - 'the mapping is two') - d = dict(mapping='one') - raises(TypeError, s.substitute, d, {}) - raises(TypeError, s.safe_substitute, d, {}) - - s = Template('the self is $self') - eq(s.safe_substitute(self='bozo'), 'the self is bozo') - - def test_delimiter_override(self): - eq = self.assertEqual - raises = self.assertRaises - class AmpersandTemplate(Template): - delimiter = '&' - s = AmpersandTemplate('this &gift is for &{who} &&') - eq(s.substitute(gift='bud', who='you'), 'this bud is for you &') - raises(KeyError, s.substitute) - eq(s.safe_substitute(gift='bud', who='you'), 'this bud is for you &') - eq(s.safe_substitute(), 'this &gift is for &{who} &') - s = AmpersandTemplate('this &gift is for &{who} &') - raises(ValueError, s.substitute, dict(gift='bud', who='you')) - eq(s.safe_substitute(), 'this &gift is for &{who} &') - - class PieDelims(Template): - delimiter = '@' - s = PieDelims('@who likes to eat a bag of @{what} worth $100') - self.assertEqual(s.substitute(dict(who='tim', what='ham')), - 'tim likes to eat a bag of ham worth $100') - - -def test_main(): - from test import test_support - test_classes = [TestTemplate,] - test_support.run_unittest(*test_classes) - - -if __name__ == '__main__': - test_main() diff --git a/Lib/test/test_string_merged.py b/Lib/test/test_string_merged.py --- a/Lib/test/test_string_merged.py +++ b/Lib/test/test_string_merged.py @@ -1,4 +1,6 @@ -import unittest, string +import unittest +import string +from string import Template from test import test_support, string_tests from UserList import UserList @@ -59,8 +61,6 @@ self.fail('exception not raised') - - class ModuleTest(unittest.TestCase): def test_attrs(self): @@ -219,8 +219,229 @@ self.assertTrue(type(b""), str) self.assertTrue(type(br""), str) + +# Template tests (formerly housed in test_pep292.py) + +class Bag: + pass + +class Mapping: + def __getitem__(self, name): + obj = self + for part in name.split('.'): + try: + obj = getattr(obj, part) + except AttributeError: + raise KeyError(name) + return obj + + +class TestTemplate(unittest.TestCase): + def test_regular_templates(self): + s = Template('$who likes to eat a bag of $what worth $$100') + self.assertEqual(s.substitute(dict(who='tim', what='ham')), + 'tim likes to eat a bag of ham worth $100') + self.assertRaises(KeyError, s.substitute, dict(who='tim')) + self.assertRaises(TypeError, Template.substitute) + + def test_regular_templates_with_braces(self): + s = Template('$who likes ${what} for ${meal}') + d = dict(who='tim', what='ham', meal='dinner') + self.assertEqual(s.substitute(d), 'tim likes ham for dinner') + self.assertRaises(KeyError, s.substitute, + dict(who='tim', what='ham')) + + def test_escapes(self): + eq = self.assertEqual + s = Template('$who likes to eat a bag of $$what worth $$100') + eq(s.substitute(dict(who='tim', what='ham')), + 'tim likes to eat a bag of $what worth $100') + s = Template('$who likes $$') + eq(s.substitute(dict(who='tim', what='ham')), 'tim likes $') + + def test_percents(self): + eq = self.assertEqual + s = Template('%(foo)s $foo ${foo}') + d = dict(foo='baz') + eq(s.substitute(d), '%(foo)s baz baz') + eq(s.safe_substitute(d), '%(foo)s baz baz') + + def test_stringification(self): + eq = self.assertEqual + s = Template('tim has eaten $count bags of ham today') + d = dict(count=7) + eq(s.substitute(d), 'tim has eaten 7 bags of ham today') + eq(s.safe_substitute(d), 'tim has eaten 7 bags of ham today') + s = Template('tim has eaten ${count} bags of ham today') + eq(s.substitute(d), 'tim has eaten 7 bags of ham today') + + def test_tupleargs(self): + eq = self.assertEqual + s = Template('$who ate ${meal}') + d = dict(who=('tim', 'fred'), meal=('ham', 'kung pao')) + eq(s.substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") + eq(s.safe_substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") + + def test_SafeTemplate(self): + eq = self.assertEqual + s = Template('$who likes ${what} for ${meal}') + eq(s.safe_substitute(dict(who='tim')), 'tim likes ${what} for ${meal}') + eq(s.safe_substitute(dict(what='ham')), '$who likes ham for ${meal}') + eq(s.safe_substitute(dict(what='ham', meal='dinner')), + '$who likes ham for dinner') + eq(s.safe_substitute(dict(who='tim', what='ham')), + 'tim likes ham for ${meal}') + eq(s.safe_substitute(dict(who='tim', what='ham', meal='dinner')), + 'tim likes ham for dinner') + + def test_invalid_placeholders(self): + raises = self.assertRaises + s = Template('$who likes $') + raises(ValueError, s.substitute, dict(who='tim')) + s = Template('$who likes ${what)') + raises(ValueError, s.substitute, dict(who='tim')) + s = Template('$who likes $100') + raises(ValueError, s.substitute, dict(who='tim')) + + def test_idpattern_override(self): + class PathPattern(Template): + idpattern = r'[_a-z][._a-z0-9]*' + m = Mapping() + m.bag = Bag() + m.bag.foo = Bag() + m.bag.foo.who = 'tim' + m.bag.what = 'ham' + s = PathPattern('$bag.foo.who likes to eat a bag of $bag.what') + self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') + + def test_pattern_override(self): + class MyPattern(Template): + pattern = r""" + (?P@{2}) | + @(?P[_a-z][._a-z0-9]*) | + @{(?P[_a-z][._a-z0-9]*)} | + (?P@) + """ + m = Mapping() + m.bag = Bag() + m.bag.foo = Bag() + m.bag.foo.who = 'tim' + m.bag.what = 'ham' + s = MyPattern('@bag.foo.who likes to eat a bag of @bag.what') + self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') + + class BadPattern(Template): + pattern = r""" + (?P.*) | + (?P@{2}) | + @(?P[_a-z][._a-z0-9]*) | + @{(?P[_a-z][._a-z0-9]*)} | + (?P@) | + """ + s = BadPattern('@bag.foo.who likes to eat a bag of @bag.what') + self.assertRaises(ValueError, s.substitute, {}) + self.assertRaises(ValueError, s.safe_substitute, {}) + + def test_braced_override(self): + class MyTemplate(Template): + pattern = r""" + \$(?: + (?P$) | + (?P[_a-z][_a-z0-9]*) | + @@(?P[_a-z][_a-z0-9]*)@@ | + (?P) | + ) + """ + + tmpl = 'PyCon in $@@location@@' + t = MyTemplate(tmpl) + self.assertRaises(KeyError, t.substitute, {}) + val = t.substitute({'location': 'Cleveland'}) + self.assertEqual(val, 'PyCon in Cleveland') + + def test_braced_override_safe(self): + class MyTemplate(Template): + pattern = r""" + \$(?: + (?P$) | + (?P[_a-z][_a-z0-9]*) | + @@(?P[_a-z][_a-z0-9]*)@@ | + (?P) | + ) + """ + + tmpl = 'PyCon in $@@location@@' + t = MyTemplate(tmpl) + self.assertEqual(t.safe_substitute(), tmpl) + val = t.safe_substitute({'location': 'Cleveland'}) + self.assertEqual(val, 'PyCon in Cleveland') + + def test_unicode_values(self): + s = Template('$who likes $what') + d = dict(who=u't\xffm', what=u'f\xfe\fed') + self.assertEqual(s.substitute(d), u't\xffm likes f\xfe\x0ced') + + def test_keyword_arguments(self): + eq = self.assertEqual + s = Template('$who likes $what') + eq(s.substitute(who='tim', what='ham'), 'tim likes ham') + eq(s.substitute(dict(who='tim'), what='ham'), 'tim likes ham') + eq(s.substitute(dict(who='fred', what='kung pao'), + who='tim', what='ham'), + 'tim likes ham') + s = Template('the mapping is $mapping') + eq(s.substitute(dict(foo='none'), mapping='bozo'), + 'the mapping is bozo') + eq(s.substitute(dict(mapping='one'), mapping='two'), + 'the mapping is two') + + s = Template('the self is $self') + eq(s.substitute(self='bozo'), 'the self is bozo') + + def test_keyword_arguments_safe(self): + eq = self.assertEqual + raises = self.assertRaises + s = Template('$who likes $what') + eq(s.safe_substitute(who='tim', what='ham'), 'tim likes ham') + eq(s.safe_substitute(dict(who='tim'), what='ham'), 'tim likes ham') + eq(s.safe_substitute(dict(who='fred', what='kung pao'), + who='tim', what='ham'), + 'tim likes ham') + s = Template('the mapping is $mapping') + eq(s.safe_substitute(dict(foo='none'), mapping='bozo'), + 'the mapping is bozo') + eq(s.safe_substitute(dict(mapping='one'), mapping='two'), + 'the mapping is two') + d = dict(mapping='one') + raises(TypeError, s.substitute, d, {}) + raises(TypeError, s.safe_substitute, d, {}) + + s = Template('the self is $self') + eq(s.safe_substitute(self='bozo'), 'the self is bozo') + + def test_delimiter_override(self): + eq = self.assertEqual + raises = self.assertRaises + class AmpersandTemplate(Template): + delimiter = '&' + s = AmpersandTemplate('this &gift is for &{who} &&') + eq(s.substitute(gift='bud', who='you'), 'this bud is for you &') + raises(KeyError, s.substitute) + eq(s.safe_substitute(gift='bud', who='you'), 'this bud is for you &') + eq(s.safe_substitute(), 'this &gift is for &{who} &') + s = AmpersandTemplate('this &gift is for &{who} &') + raises(ValueError, s.substitute, dict(gift='bud', who='you')) + eq(s.safe_substitute(), 'this &gift is for &{who} &') + + class PieDelims(Template): + delimiter = '@' + s = PieDelims('@who likes to eat a bag of @{what} worth $100') + self.assertEqual(s.substitute(dict(who='tim', what='ham')), + 'tim likes to eat a bag of ham worth $100') + + def test_main(): - test_support.run_unittest(StringTest, ModuleTest, BytesAliasTest) + test_support.run_unittest(StringTest, ModuleTest, BytesAliasTest, TestTemplate) -if __name__ == "__main__": +if __name__ == '__main__': test_main() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 02:39:20 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 03 Jun 2016 06:39:20 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI3MTg1?= =?utf-8?q?=3A_Rename_test=5Fstring=5Fmerged=2Epy_back_to_test=5Fstring=2E?= =?utf-8?b?cHku?= Message-ID: <20160603063919.69887.51532.FA00238A@psf.io> https://hg.python.org/cpython/rev/e2e309fb2b1e changeset: 101643:e2e309fb2b1e branch: 2.7 user: Serhiy Storchaka date: Fri Jun 03 09:37:39 2016 +0300 summary: Issue #27185: Rename test_string_merged.py back to test_string.py. files: Lib/test/test_string.py | 0 1 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_string_merged.py b/Lib/test/test_string.py rename from Lib/test/test_string_merged.py rename to Lib/test/test_string.py -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 02:39:20 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 03 Jun 2016 06:39:20 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI3MTg1?= =?utf-8?q?=3A_Rename_test=5Fpep292=2Epy_to_test=5Fstring=5Fmerged=2Epy=2E?= Message-ID: <20160603063918.102735.41552.0F5CE70D@psf.io> https://hg.python.org/cpython/rev/8218b1309178 changeset: 101641:8218b1309178 branch: 2.7 parent: 101637:a4c0208b10df user: Serhiy Storchaka date: Fri Jun 03 09:24:40 2016 +0300 summary: Issue #27185: Rename test_pep292.py to test_string_merged.py. files: Lib/test/test_string_merged.py | 0 1 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_pep292.py b/Lib/test/test_string_merged.py rename from Lib/test/test_pep292.py rename to Lib/test/test_string_merged.py -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 02:50:11 2016 From: python-checkins at python.org (senthil.kumaran) Date: Fri, 03 Jun 2016 06:50:11 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_issue8519_-_Re?= =?utf-8?q?ference_termios_and_ioctl_manual_pages_in_the_library?= Message-ID: <20160603065007.88807.67994.E2F004D2@psf.io> https://hg.python.org/cpython/rev/f53a0566a290 changeset: 101644:f53a0566a290 branch: 3.5 parent: 101632:7b12180481da user: Senthil Kumaran date: Thu Jun 02 23:49:05 2016 -0700 summary: issue8519 - Reference termios and ioctl manual pages in the library documentation. files: Doc/library/fcntl.rst | 4 +++- Doc/library/termios.rst | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Doc/library/fcntl.rst b/Doc/library/fcntl.rst --- a/Doc/library/fcntl.rst +++ b/Doc/library/fcntl.rst @@ -12,7 +12,9 @@ pair: UNIX; I/O control This module performs file control and I/O control on file descriptors. It is an -interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. +interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. For a +complete description of these calls, see :manpage:`fcntl(2)` and +:manpage:`ioctl(2)` Unix manual pages. 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 diff --git a/Doc/library/termios.rst b/Doc/library/termios.rst --- a/Doc/library/termios.rst +++ b/Doc/library/termios.rst @@ -10,10 +10,10 @@ pair: POSIX; I/O control pair: tty; I/O control -This module provides an interface to the POSIX calls for tty I/O control. For a -complete description of these calls, see the POSIX or Unix manual pages. It is -only available for those Unix versions that support POSIX *termios* style tty -I/O control (and then only if configured at installation time). +This module provides an interface to the POSIX calls for tty I/O control. For a +complete description of these calls, see :manpage:`termios(2)` Unix manual +page. It is only available for those Unix versions that support POSIX +*termios* style tty I/O control configured during installation. 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 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 02:50:11 2016 From: python-checkins at python.org (senthil.kumaran) Date: Fri, 03 Jun 2016 06:50:11 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_=5Bmerge_from_3=2E5=5D_-_issue8519_-_Reference_termios_a?= =?utf-8?q?nd_ioctl_manual_pages_in_the?= Message-ID: <20160603065008.56903.49992.9D25EC8E@psf.io> https://hg.python.org/cpython/rev/8db146bec24b changeset: 101645:8db146bec24b parent: 101639:1022d09d11e5 parent: 101644:f53a0566a290 user: Senthil Kumaran date: Thu Jun 02 23:50:02 2016 -0700 summary: [merge from 3.5] - issue8519 - Reference termios and ioctl manual pages in the library documentation. files: Doc/library/fcntl.rst | 4 +++- Doc/library/termios.rst | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Doc/library/fcntl.rst b/Doc/library/fcntl.rst --- a/Doc/library/fcntl.rst +++ b/Doc/library/fcntl.rst @@ -12,7 +12,9 @@ pair: UNIX; I/O control This module performs file control and I/O control on file descriptors. It is an -interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. +interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. For a +complete description of these calls, see :manpage:`fcntl(2)` and +:manpage:`ioctl(2)` Unix manual pages. 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 diff --git a/Doc/library/termios.rst b/Doc/library/termios.rst --- a/Doc/library/termios.rst +++ b/Doc/library/termios.rst @@ -10,10 +10,10 @@ pair: POSIX; I/O control pair: tty; I/O control -This module provides an interface to the POSIX calls for tty I/O control. For a -complete description of these calls, see the POSIX or Unix manual pages. It is -only available for those Unix versions that support POSIX *termios* style tty -I/O control (and then only if configured at installation time). +This module provides an interface to the POSIX calls for tty I/O control. For a +complete description of these calls, see :manpage:`termios(2)` Unix manual +page. It is only available for those Unix versions that support POSIX +*termios* style tty I/O control configured during installation. 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 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 02:51:27 2016 From: python-checkins at python.org (senthil.kumaran) Date: Fri, 03 Jun 2016 06:51:27 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogW2JhY2twb3J0IHRv?= =?utf-8?q?_2=2E7=5D_-_issue8519_-_Reference_termios_and_ioctl_manual_page?= =?utf-8?q?s_in_the?= Message-ID: <20160603065126.15826.69118.2C0E3CF6@psf.io> https://hg.python.org/cpython/rev/55886a6aed4b changeset: 101646:55886a6aed4b branch: 2.7 parent: 101643:e2e309fb2b1e user: Senthil Kumaran date: Thu Jun 02 23:51:22 2016 -0700 summary: [backport to 2.7] - issue8519 - Reference termios and ioctl manual pages in the library documentation. files: Doc/library/fcntl.rst | 4 +++- Doc/library/termios.rst | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Doc/library/fcntl.rst b/Doc/library/fcntl.rst --- a/Doc/library/fcntl.rst +++ b/Doc/library/fcntl.rst @@ -12,7 +12,9 @@ pair: UNIX; I/O control This module performs file control and I/O control on file descriptors. It is an -interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. +interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. For a +complete description of these calls, see :manpage:`fcntl(2)` and +:manpage:`ioctl(2)` Unix manual pages. 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 diff --git a/Doc/library/termios.rst b/Doc/library/termios.rst --- a/Doc/library/termios.rst +++ b/Doc/library/termios.rst @@ -11,10 +11,10 @@ pair: POSIX; I/O control pair: tty; I/O control -This module provides an interface to the POSIX calls for tty I/O control. For a -complete description of these calls, see the POSIX or Unix manual pages. It is -only available for those Unix versions that support POSIX *termios* style tty -I/O control (and then only if configured at installation time). +This module provides an interface to the POSIX calls for tty I/O control. For a +complete description of these calls, see :manpage:`termios(2)` Unix manual +page. It is only available for those Unix versions that support POSIX +*termios* style tty I/O control configured during installation. 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 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 03:04:34 2016 From: python-checkins at python.org (senthil.kumaran) Date: Fri, 03 Jun 2016 07:04:34 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_issue27113_-_D?= =?utf-8?q?ocument_=22check=5Fsame=5Fthread=22_parameter_in_sqlite3=2Econn?= =?utf-8?q?ect_api=2E?= Message-ID: <20160603070432.38499.97095.BE8CC82B@psf.io> https://hg.python.org/cpython/rev/af1752e51a89 changeset: 101647:af1752e51a89 branch: 3.5 parent: 101644:f53a0566a290 user: Senthil Kumaran date: Fri Jun 03 00:03:48 2016 -0700 summary: issue27113 - Document "check_same_thread" parameter in sqlite3.connect api. Patch contributed by Dave Sawyer. files: Doc/library/sqlite3.rst | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -190,6 +190,11 @@ any combination of :const:`PARSE_DECLTYPES` and :const:`PARSE_COLNAMES` to turn type detection on. + By default, *check_same_thread* is :const:`True` and only the creating thread may + use the connection. If set :const:`False`, the returned connection may be shared + across multiple threads. When using multiple threads with the same connection + writing operations should be serialized by the user to avoid data corruption. + By default, the :mod:`sqlite3` module uses its :class:`Connection` class for the connect call. You can, however, subclass the :class:`Connection` class and make :func:`connect` use your class instead by providing your class for the *factory* -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 03:04:34 2016 From: python-checkins at python.org (senthil.kumaran) Date: Fri, 03 Jun 2016 07:04:34 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_=5Bmerge_from_3=2E5=5D_-_issue27113_-_Document_=22check?= =?utf-8?q?=5Fsame=5Fthread=22_parameter_in?= Message-ID: <20160603070433.56886.77399.DA63368A@psf.io> https://hg.python.org/cpython/rev/17c8da643065 changeset: 101648:17c8da643065 parent: 101645:8db146bec24b parent: 101647:af1752e51a89 user: Senthil Kumaran date: Fri Jun 03 00:04:28 2016 -0700 summary: [merge from 3.5] - issue27113 - Document "check_same_thread" parameter in sqlite3.connect api. Patch contributed by Dave Sawyer. files: Doc/library/sqlite3.rst | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -190,6 +190,11 @@ any combination of :const:`PARSE_DECLTYPES` and :const:`PARSE_COLNAMES` to turn type detection on. + By default, *check_same_thread* is :const:`True` and only the creating thread may + use the connection. If set :const:`False`, the returned connection may be shared + across multiple threads. When using multiple threads with the same connection + writing operations should be serialized by the user to avoid data corruption. + By default, the :mod:`sqlite3` module uses its :class:`Connection` class for the connect call. You can, however, subclass the :class:`Connection` class and make :func:`connect` use your class instead by providing your class for the *factory* -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 03:49:05 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 03 Jun 2016 07:49:05 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MTg1?= =?utf-8?q?=3A_Rename_test=5Fstring=5Fmerged=2Epy_back_to_test=5Fstring=2E?= =?utf-8?b?cHku?= Message-ID: <20160603074905.90935.92545.4FCFCF6D@psf.io> https://hg.python.org/cpython/rev/36f5229e45a6 changeset: 101652:36f5229e45a6 branch: 3.5 user: Serhiy Storchaka date: Fri Jun 03 10:38:24 2016 +0300 summary: Issue #27185: Rename test_string_merged.py back to test_string.py. files: Lib/test/test_string.py | 0 1 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_string_merged.py b/Lib/test/test_string.py rename from Lib/test/test_string_merged.py rename to Lib/test/test_string.py -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 03:49:05 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 03 Jun 2016 07:49:05 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MTg1?= =?utf-8?q?=3A_Rename_test=5Fstring=2Epy_to_test=5Fstring=5Fmerged=2Epy=2E?= Message-ID: <20160603074904.4795.18451.D710EBBF@psf.io> https://hg.python.org/cpython/rev/70e19b014d2f changeset: 101649:70e19b014d2f branch: 3.5 parent: 101622:dfde53cf07e6 user: Serhiy Storchaka date: Fri Jun 03 10:30:25 2016 +0300 summary: Issue #27185: Rename test_string.py to test_string_merged.py. files: Lib/test/test_string_merged.py | 0 1 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_string.py b/Lib/test/test_string_merged.py rename from Lib/test/test_string.py rename to Lib/test/test_string_merged.py -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 03:49:05 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 03 Jun 2016 07:49:05 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNSk6?= =?utf-8?q?_Merge_heads?= Message-ID: <20160603074905.14677.91989.5345125F@psf.io> https://hg.python.org/cpython/rev/1bd79ae95a4b changeset: 101653:1bd79ae95a4b branch: 3.5 parent: 101632:7b12180481da parent: 101652:36f5229e45a6 user: Serhiy Storchaka date: Fri Jun 03 10:44:12 2016 +0300 summary: Merge heads files: Lib/test/test_string.py | 62 ++++++++++++++-------------- 1 files changed, 32 insertions(+), 30 deletions(-) diff --git a/Lib/test/test_string.py b/Lib/test/test_string.py --- a/Lib/test/test_string.py +++ b/Lib/test/test_string.py @@ -1,4 +1,6 @@ -import unittest, string +import unittest +import string +from string import Template class ModuleTest(unittest.TestCase): @@ -205,14 +207,14 @@ class TestTemplate(unittest.TestCase): def test_regular_templates(self): - s = string.Template('$who likes to eat a bag of $what worth $$100') + s = Template('$who likes to eat a bag of $what worth $$100') self.assertEqual(s.substitute(dict(who='tim', what='ham')), 'tim likes to eat a bag of ham worth $100') self.assertRaises(KeyError, s.substitute, dict(who='tim')) - self.assertRaises(TypeError, string.Template.substitute) + self.assertRaises(TypeError, Template.substitute) def test_regular_templates_with_braces(self): - s = string.Template('$who likes ${what} for ${meal}') + s = Template('$who likes ${what} for ${meal}') d = dict(who='tim', what='ham', meal='dinner') self.assertEqual(s.substitute(d), 'tim likes ham for dinner') self.assertRaises(KeyError, s.substitute, @@ -220,38 +222,38 @@ def test_escapes(self): eq = self.assertEqual - s = string.Template('$who likes to eat a bag of $$what worth $$100') + s = Template('$who likes to eat a bag of $$what worth $$100') eq(s.substitute(dict(who='tim', what='ham')), 'tim likes to eat a bag of $what worth $100') - s = string.Template('$who likes $$') + s = Template('$who likes $$') eq(s.substitute(dict(who='tim', what='ham')), 'tim likes $') def test_percents(self): eq = self.assertEqual - s = string.Template('%(foo)s $foo ${foo}') + s = Template('%(foo)s $foo ${foo}') d = dict(foo='baz') eq(s.substitute(d), '%(foo)s baz baz') eq(s.safe_substitute(d), '%(foo)s baz baz') def test_stringification(self): eq = self.assertEqual - s = string.Template('tim has eaten $count bags of ham today') + s = Template('tim has eaten $count bags of ham today') d = dict(count=7) eq(s.substitute(d), 'tim has eaten 7 bags of ham today') eq(s.safe_substitute(d), 'tim has eaten 7 bags of ham today') - s = string.Template('tim has eaten ${count} bags of ham today') + s = Template('tim has eaten ${count} bags of ham today') eq(s.substitute(d), 'tim has eaten 7 bags of ham today') def test_tupleargs(self): eq = self.assertEqual - s = string.Template('$who ate ${meal}') + s = Template('$who ate ${meal}') d = dict(who=('tim', 'fred'), meal=('ham', 'kung pao')) eq(s.substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") eq(s.safe_substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") def test_SafeTemplate(self): eq = self.assertEqual - s = string.Template('$who likes ${what} for ${meal}') + s = Template('$who likes ${what} for ${meal}') eq(s.safe_substitute(dict(who='tim')), 'tim likes ${what} for ${meal}') eq(s.safe_substitute(dict(what='ham')), '$who likes ham for ${meal}') eq(s.safe_substitute(dict(what='ham', meal='dinner')), @@ -263,15 +265,15 @@ def test_invalid_placeholders(self): raises = self.assertRaises - s = string.Template('$who likes $') + s = Template('$who likes $') raises(ValueError, s.substitute, dict(who='tim')) - s = string.Template('$who likes ${what)') + s = Template('$who likes ${what)') raises(ValueError, s.substitute, dict(who='tim')) - s = string.Template('$who likes $100') + s = Template('$who likes $100') raises(ValueError, s.substitute, dict(who='tim')) def test_idpattern_override(self): - class PathPattern(string.Template): + class PathPattern(Template): idpattern = r'[_a-z][._a-z0-9]*' m = Mapping() m.bag = Bag() @@ -282,7 +284,7 @@ self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') def test_pattern_override(self): - class MyPattern(string.Template): + class MyPattern(Template): pattern = r""" (?P@{2}) | @(?P[_a-z][._a-z0-9]*) | @@ -297,7 +299,7 @@ s = MyPattern('@bag.foo.who likes to eat a bag of @bag.what') self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') - class BadPattern(string.Template): + class BadPattern(Template): pattern = r""" (?P.*) | (?P@{2}) | @@ -310,7 +312,7 @@ self.assertRaises(ValueError, s.safe_substitute, {}) def test_braced_override(self): - class MyTemplate(string.Template): + class MyTemplate(Template): pattern = r""" \$(?: (?P$) | @@ -327,7 +329,7 @@ self.assertEqual(val, 'PyCon in Cleveland') def test_braced_override_safe(self): - class MyTemplate(string.Template): + class MyTemplate(Template): pattern = r""" \$(?: (?P$) | @@ -349,7 +351,7 @@ # pattern can't trigger (always has at least '$') # So we craft a pattern that is always invalid # with no leading data. - class MyTemplate(string.Template): + class MyTemplate(Template): pattern = r""" (?P) | unreachable( @@ -364,37 +366,37 @@ self.assertIn('line 1, col 1', str(err.exception)) def test_unicode_values(self): - s = string.Template('$who likes $what') + s = Template('$who likes $what') d = dict(who='t\xffm', what='f\xfe\fed') self.assertEqual(s.substitute(d), 't\xffm likes f\xfe\x0ced') def test_keyword_arguments(self): eq = self.assertEqual - s = string.Template('$who likes $what') + s = Template('$who likes $what') eq(s.substitute(who='tim', what='ham'), 'tim likes ham') eq(s.substitute(dict(who='tim'), what='ham'), 'tim likes ham') eq(s.substitute(dict(who='fred', what='kung pao'), who='tim', what='ham'), 'tim likes ham') - s = string.Template('the mapping is $mapping') + s = Template('the mapping is $mapping') eq(s.substitute(dict(foo='none'), mapping='bozo'), 'the mapping is bozo') eq(s.substitute(dict(mapping='one'), mapping='two'), 'the mapping is two') - s = string.Template('the self is $self') + s = Template('the self is $self') eq(s.substitute(self='bozo'), 'the self is bozo') def test_keyword_arguments_safe(self): eq = self.assertEqual raises = self.assertRaises - s = string.Template('$who likes $what') + s = Template('$who likes $what') eq(s.safe_substitute(who='tim', what='ham'), 'tim likes ham') eq(s.safe_substitute(dict(who='tim'), what='ham'), 'tim likes ham') eq(s.safe_substitute(dict(who='fred', what='kung pao'), who='tim', what='ham'), 'tim likes ham') - s = string.Template('the mapping is $mapping') + s = Template('the mapping is $mapping') eq(s.safe_substitute(dict(foo='none'), mapping='bozo'), 'the mapping is bozo') eq(s.safe_substitute(dict(mapping='one'), mapping='two'), @@ -403,13 +405,13 @@ raises(TypeError, s.substitute, d, {}) raises(TypeError, s.safe_substitute, d, {}) - s = string.Template('the self is $self') + s = Template('the self is $self') eq(s.safe_substitute(self='bozo'), 'the self is bozo') def test_delimiter_override(self): eq = self.assertEqual raises = self.assertRaises - class AmpersandTemplate(string.Template): + class AmpersandTemplate(Template): delimiter = '&' s = AmpersandTemplate('this &gift is for &{who} &&') eq(s.substitute(gift='bud', who='you'), 'this bud is for you &') @@ -420,12 +422,12 @@ raises(ValueError, s.substitute, dict(gift='bud', who='you')) eq(s.safe_substitute(), 'this &gift is for &{who} &') - class PieDelims(string.Template): + class PieDelims(Template): delimiter = '@' s = PieDelims('@who likes to eat a bag of @{what} worth $100') self.assertEqual(s.substitute(dict(who='tim', what='ham')), 'tim likes to eat a bag of ham worth $100') -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 03:49:05 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 03 Jun 2016 07:49:05 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MTg1?= =?utf-8?q?=3A_Rename_test=5Fpep292=2Epy_to_test=5Fstring=5Fmerged=2Epy=2E?= Message-ID: <20160603074905.88788.99663.8FC65E59@psf.io> https://hg.python.org/cpython/rev/0da07e73451d changeset: 101650:0da07e73451d branch: 3.5 parent: 101622:dfde53cf07e6 user: Serhiy Storchaka date: Fri Jun 03 10:32:36 2016 +0300 summary: Issue #27185: Rename test_pep292.py to test_string_merged.py. files: Lib/test/test_string_merged.py | 0 1 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_pep292.py b/Lib/test/test_string_merged.py rename from Lib/test/test_pep292.py rename to Lib/test/test_string_merged.py -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 03:49:05 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 03 Jun 2016 07:49:05 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNSk6?= =?utf-8?q?_Issue_=2327185=3A_Merge_test=5Fpep292=2Epy_into_test=5Fstring?= =?utf-8?b?X21lcmdlZC5weS4=?= Message-ID: <20160603074905.5207.96016.9A358312@psf.io> https://hg.python.org/cpython/rev/14a036c696e8 changeset: 101651:14a036c696e8 branch: 3.5 parent: 101649:70e19b014d2f parent: 101650:0da07e73451d user: Serhiy Storchaka date: Fri Jun 03 10:38:02 2016 +0300 summary: Issue #27185: Merge test_pep292.py into test_string_merged.py. files: Lib/test/test_pep292.py | 248 --------------------- Lib/test/test_string_merged.py | 246 ++++++++++++++++++++- 2 files changed, 244 insertions(+), 250 deletions(-) diff --git a/Lib/test/test_pep292.py b/Lib/test/test_pep292.py deleted file mode 100644 --- a/Lib/test/test_pep292.py +++ /dev/null @@ -1,248 +0,0 @@ -# Copyright (C) 2004 Python Software Foundation -# Author: barry at python.org (Barry Warsaw) -# License: http://www.opensource.org/licenses/PythonSoftFoundation.php - -import unittest -from string import Template - - -class Bag: - pass - -class Mapping: - def __getitem__(self, name): - obj = self - for part in name.split('.'): - try: - obj = getattr(obj, part) - except AttributeError: - raise KeyError(name) - return obj - - -class TestTemplate(unittest.TestCase): - def test_regular_templates(self): - s = Template('$who likes to eat a bag of $what worth $$100') - self.assertEqual(s.substitute(dict(who='tim', what='ham')), - 'tim likes to eat a bag of ham worth $100') - self.assertRaises(KeyError, s.substitute, dict(who='tim')) - self.assertRaises(TypeError, Template.substitute) - - def test_regular_templates_with_braces(self): - s = Template('$who likes ${what} for ${meal}') - d = dict(who='tim', what='ham', meal='dinner') - self.assertEqual(s.substitute(d), 'tim likes ham for dinner') - self.assertRaises(KeyError, s.substitute, - dict(who='tim', what='ham')) - - def test_escapes(self): - eq = self.assertEqual - s = Template('$who likes to eat a bag of $$what worth $$100') - eq(s.substitute(dict(who='tim', what='ham')), - 'tim likes to eat a bag of $what worth $100') - s = Template('$who likes $$') - eq(s.substitute(dict(who='tim', what='ham')), 'tim likes $') - - def test_percents(self): - eq = self.assertEqual - s = Template('%(foo)s $foo ${foo}') - d = dict(foo='baz') - eq(s.substitute(d), '%(foo)s baz baz') - eq(s.safe_substitute(d), '%(foo)s baz baz') - - def test_stringification(self): - eq = self.assertEqual - s = Template('tim has eaten $count bags of ham today') - d = dict(count=7) - eq(s.substitute(d), 'tim has eaten 7 bags of ham today') - eq(s.safe_substitute(d), 'tim has eaten 7 bags of ham today') - s = Template('tim has eaten ${count} bags of ham today') - eq(s.substitute(d), 'tim has eaten 7 bags of ham today') - - def test_tupleargs(self): - eq = self.assertEqual - s = Template('$who ate ${meal}') - d = dict(who=('tim', 'fred'), meal=('ham', 'kung pao')) - eq(s.substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") - eq(s.safe_substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") - - def test_SafeTemplate(self): - eq = self.assertEqual - s = Template('$who likes ${what} for ${meal}') - eq(s.safe_substitute(dict(who='tim')), 'tim likes ${what} for ${meal}') - eq(s.safe_substitute(dict(what='ham')), '$who likes ham for ${meal}') - eq(s.safe_substitute(dict(what='ham', meal='dinner')), - '$who likes ham for dinner') - eq(s.safe_substitute(dict(who='tim', what='ham')), - 'tim likes ham for ${meal}') - eq(s.safe_substitute(dict(who='tim', what='ham', meal='dinner')), - 'tim likes ham for dinner') - - def test_invalid_placeholders(self): - raises = self.assertRaises - s = Template('$who likes $') - raises(ValueError, s.substitute, dict(who='tim')) - s = Template('$who likes ${what)') - raises(ValueError, s.substitute, dict(who='tim')) - s = Template('$who likes $100') - raises(ValueError, s.substitute, dict(who='tim')) - - def test_idpattern_override(self): - class PathPattern(Template): - idpattern = r'[_a-z][._a-z0-9]*' - m = Mapping() - m.bag = Bag() - m.bag.foo = Bag() - m.bag.foo.who = 'tim' - m.bag.what = 'ham' - s = PathPattern('$bag.foo.who likes to eat a bag of $bag.what') - self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') - - def test_pattern_override(self): - class MyPattern(Template): - pattern = r""" - (?P@{2}) | - @(?P[_a-z][._a-z0-9]*) | - @{(?P[_a-z][._a-z0-9]*)} | - (?P@) - """ - m = Mapping() - m.bag = Bag() - m.bag.foo = Bag() - m.bag.foo.who = 'tim' - m.bag.what = 'ham' - s = MyPattern('@bag.foo.who likes to eat a bag of @bag.what') - self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') - - class BadPattern(Template): - pattern = r""" - (?P.*) | - (?P@{2}) | - @(?P[_a-z][._a-z0-9]*) | - @{(?P[_a-z][._a-z0-9]*)} | - (?P@) | - """ - s = BadPattern('@bag.foo.who likes to eat a bag of @bag.what') - self.assertRaises(ValueError, s.substitute, {}) - self.assertRaises(ValueError, s.safe_substitute, {}) - - def test_braced_override(self): - class MyTemplate(Template): - pattern = r""" - \$(?: - (?P$) | - (?P[_a-z][_a-z0-9]*) | - @@(?P[_a-z][_a-z0-9]*)@@ | - (?P) | - ) - """ - - tmpl = 'PyCon in $@@location@@' - t = MyTemplate(tmpl) - self.assertRaises(KeyError, t.substitute, {}) - val = t.substitute({'location': 'Cleveland'}) - self.assertEqual(val, 'PyCon in Cleveland') - - def test_braced_override_safe(self): - class MyTemplate(Template): - pattern = r""" - \$(?: - (?P$) | - (?P[_a-z][_a-z0-9]*) | - @@(?P[_a-z][_a-z0-9]*)@@ | - (?P) | - ) - """ - - tmpl = 'PyCon in $@@location@@' - t = MyTemplate(tmpl) - self.assertEqual(t.safe_substitute(), tmpl) - val = t.safe_substitute({'location': 'Cleveland'}) - self.assertEqual(val, 'PyCon in Cleveland') - - def test_invalid_with_no_lines(self): - # The error formatting for invalid templates - # has a special case for no data that the default - # pattern can't trigger (always has at least '$') - # So we craft a pattern that is always invalid - # with no leading data. - class MyTemplate(Template): - pattern = r""" - (?P) | - unreachable( - (?P) | - (?P) | - (?P) - ) - """ - s = MyTemplate('') - with self.assertRaises(ValueError) as err: - s.substitute({}) - self.assertIn('line 1, col 1', str(err.exception)) - - def test_unicode_values(self): - s = Template('$who likes $what') - d = dict(who='t\xffm', what='f\xfe\fed') - self.assertEqual(s.substitute(d), 't\xffm likes f\xfe\x0ced') - - def test_keyword_arguments(self): - eq = self.assertEqual - s = Template('$who likes $what') - eq(s.substitute(who='tim', what='ham'), 'tim likes ham') - eq(s.substitute(dict(who='tim'), what='ham'), 'tim likes ham') - eq(s.substitute(dict(who='fred', what='kung pao'), - who='tim', what='ham'), - 'tim likes ham') - s = Template('the mapping is $mapping') - eq(s.substitute(dict(foo='none'), mapping='bozo'), - 'the mapping is bozo') - eq(s.substitute(dict(mapping='one'), mapping='two'), - 'the mapping is two') - - s = Template('the self is $self') - eq(s.substitute(self='bozo'), 'the self is bozo') - - def test_keyword_arguments_safe(self): - eq = self.assertEqual - raises = self.assertRaises - s = Template('$who likes $what') - eq(s.safe_substitute(who='tim', what='ham'), 'tim likes ham') - eq(s.safe_substitute(dict(who='tim'), what='ham'), 'tim likes ham') - eq(s.safe_substitute(dict(who='fred', what='kung pao'), - who='tim', what='ham'), - 'tim likes ham') - s = Template('the mapping is $mapping') - eq(s.safe_substitute(dict(foo='none'), mapping='bozo'), - 'the mapping is bozo') - eq(s.safe_substitute(dict(mapping='one'), mapping='two'), - 'the mapping is two') - d = dict(mapping='one') - raises(TypeError, s.substitute, d, {}) - raises(TypeError, s.safe_substitute, d, {}) - - s = Template('the self is $self') - eq(s.safe_substitute(self='bozo'), 'the self is bozo') - - def test_delimiter_override(self): - eq = self.assertEqual - raises = self.assertRaises - class AmpersandTemplate(Template): - delimiter = '&' - s = AmpersandTemplate('this &gift is for &{who} &&') - eq(s.substitute(gift='bud', who='you'), 'this bud is for you &') - raises(KeyError, s.substitute) - eq(s.safe_substitute(gift='bud', who='you'), 'this bud is for you &') - eq(s.safe_substitute(), 'this &gift is for &{who} &') - s = AmpersandTemplate('this &gift is for &{who} &') - raises(ValueError, s.substitute, dict(gift='bud', who='you')) - eq(s.safe_substitute(), 'this &gift is for &{who} &') - - class PieDelims(Template): - delimiter = '@' - s = PieDelims('@who likes to eat a bag of @{what} worth $100') - self.assertEqual(s.substitute(dict(who='tim', what='ham')), - 'tim likes to eat a bag of ham worth $100') - - -if __name__ == '__main__': - unittest.main() diff --git a/Lib/test/test_string_merged.py b/Lib/test/test_string_merged.py --- a/Lib/test/test_string_merged.py +++ b/Lib/test/test_string_merged.py @@ -1,4 +1,6 @@ -import unittest, string +import unittest +import string +from string import Template class ModuleTest(unittest.TestCase): @@ -187,5 +189,245 @@ self.assertIn("recursion", str(err.exception)) -if __name__ == "__main__": +# Template tests (formerly housed in test_pep292.py) + +class Bag: + pass + +class Mapping: + def __getitem__(self, name): + obj = self + for part in name.split('.'): + try: + obj = getattr(obj, part) + except AttributeError: + raise KeyError(name) + return obj + + +class TestTemplate(unittest.TestCase): + def test_regular_templates(self): + s = Template('$who likes to eat a bag of $what worth $$100') + self.assertEqual(s.substitute(dict(who='tim', what='ham')), + 'tim likes to eat a bag of ham worth $100') + self.assertRaises(KeyError, s.substitute, dict(who='tim')) + self.assertRaises(TypeError, Template.substitute) + + def test_regular_templates_with_braces(self): + s = Template('$who likes ${what} for ${meal}') + d = dict(who='tim', what='ham', meal='dinner') + self.assertEqual(s.substitute(d), 'tim likes ham for dinner') + self.assertRaises(KeyError, s.substitute, + dict(who='tim', what='ham')) + + def test_escapes(self): + eq = self.assertEqual + s = Template('$who likes to eat a bag of $$what worth $$100') + eq(s.substitute(dict(who='tim', what='ham')), + 'tim likes to eat a bag of $what worth $100') + s = Template('$who likes $$') + eq(s.substitute(dict(who='tim', what='ham')), 'tim likes $') + + def test_percents(self): + eq = self.assertEqual + s = Template('%(foo)s $foo ${foo}') + d = dict(foo='baz') + eq(s.substitute(d), '%(foo)s baz baz') + eq(s.safe_substitute(d), '%(foo)s baz baz') + + def test_stringification(self): + eq = self.assertEqual + s = Template('tim has eaten $count bags of ham today') + d = dict(count=7) + eq(s.substitute(d), 'tim has eaten 7 bags of ham today') + eq(s.safe_substitute(d), 'tim has eaten 7 bags of ham today') + s = Template('tim has eaten ${count} bags of ham today') + eq(s.substitute(d), 'tim has eaten 7 bags of ham today') + + def test_tupleargs(self): + eq = self.assertEqual + s = Template('$who ate ${meal}') + d = dict(who=('tim', 'fred'), meal=('ham', 'kung pao')) + eq(s.substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") + eq(s.safe_substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") + + def test_SafeTemplate(self): + eq = self.assertEqual + s = Template('$who likes ${what} for ${meal}') + eq(s.safe_substitute(dict(who='tim')), 'tim likes ${what} for ${meal}') + eq(s.safe_substitute(dict(what='ham')), '$who likes ham for ${meal}') + eq(s.safe_substitute(dict(what='ham', meal='dinner')), + '$who likes ham for dinner') + eq(s.safe_substitute(dict(who='tim', what='ham')), + 'tim likes ham for ${meal}') + eq(s.safe_substitute(dict(who='tim', what='ham', meal='dinner')), + 'tim likes ham for dinner') + + def test_invalid_placeholders(self): + raises = self.assertRaises + s = Template('$who likes $') + raises(ValueError, s.substitute, dict(who='tim')) + s = Template('$who likes ${what)') + raises(ValueError, s.substitute, dict(who='tim')) + s = Template('$who likes $100') + raises(ValueError, s.substitute, dict(who='tim')) + + def test_idpattern_override(self): + class PathPattern(Template): + idpattern = r'[_a-z][._a-z0-9]*' + m = Mapping() + m.bag = Bag() + m.bag.foo = Bag() + m.bag.foo.who = 'tim' + m.bag.what = 'ham' + s = PathPattern('$bag.foo.who likes to eat a bag of $bag.what') + self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') + + def test_pattern_override(self): + class MyPattern(Template): + pattern = r""" + (?P@{2}) | + @(?P[_a-z][._a-z0-9]*) | + @{(?P[_a-z][._a-z0-9]*)} | + (?P@) + """ + m = Mapping() + m.bag = Bag() + m.bag.foo = Bag() + m.bag.foo.who = 'tim' + m.bag.what = 'ham' + s = MyPattern('@bag.foo.who likes to eat a bag of @bag.what') + self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') + + class BadPattern(Template): + pattern = r""" + (?P.*) | + (?P@{2}) | + @(?P[_a-z][._a-z0-9]*) | + @{(?P[_a-z][._a-z0-9]*)} | + (?P@) | + """ + s = BadPattern('@bag.foo.who likes to eat a bag of @bag.what') + self.assertRaises(ValueError, s.substitute, {}) + self.assertRaises(ValueError, s.safe_substitute, {}) + + def test_braced_override(self): + class MyTemplate(Template): + pattern = r""" + \$(?: + (?P$) | + (?P[_a-z][_a-z0-9]*) | + @@(?P[_a-z][_a-z0-9]*)@@ | + (?P) | + ) + """ + + tmpl = 'PyCon in $@@location@@' + t = MyTemplate(tmpl) + self.assertRaises(KeyError, t.substitute, {}) + val = t.substitute({'location': 'Cleveland'}) + self.assertEqual(val, 'PyCon in Cleveland') + + def test_braced_override_safe(self): + class MyTemplate(Template): + pattern = r""" + \$(?: + (?P$) | + (?P[_a-z][_a-z0-9]*) | + @@(?P[_a-z][_a-z0-9]*)@@ | + (?P) | + ) + """ + + tmpl = 'PyCon in $@@location@@' + t = MyTemplate(tmpl) + self.assertEqual(t.safe_substitute(), tmpl) + val = t.safe_substitute({'location': 'Cleveland'}) + self.assertEqual(val, 'PyCon in Cleveland') + + def test_invalid_with_no_lines(self): + # The error formatting for invalid templates + # has a special case for no data that the default + # pattern can't trigger (always has at least '$') + # So we craft a pattern that is always invalid + # with no leading data. + class MyTemplate(Template): + pattern = r""" + (?P) | + unreachable( + (?P) | + (?P) | + (?P) + ) + """ + s = MyTemplate('') + with self.assertRaises(ValueError) as err: + s.substitute({}) + self.assertIn('line 1, col 1', str(err.exception)) + + def test_unicode_values(self): + s = Template('$who likes $what') + d = dict(who='t\xffm', what='f\xfe\fed') + self.assertEqual(s.substitute(d), 't\xffm likes f\xfe\x0ced') + + def test_keyword_arguments(self): + eq = self.assertEqual + s = Template('$who likes $what') + eq(s.substitute(who='tim', what='ham'), 'tim likes ham') + eq(s.substitute(dict(who='tim'), what='ham'), 'tim likes ham') + eq(s.substitute(dict(who='fred', what='kung pao'), + who='tim', what='ham'), + 'tim likes ham') + s = Template('the mapping is $mapping') + eq(s.substitute(dict(foo='none'), mapping='bozo'), + 'the mapping is bozo') + eq(s.substitute(dict(mapping='one'), mapping='two'), + 'the mapping is two') + + s = Template('the self is $self') + eq(s.substitute(self='bozo'), 'the self is bozo') + + def test_keyword_arguments_safe(self): + eq = self.assertEqual + raises = self.assertRaises + s = Template('$who likes $what') + eq(s.safe_substitute(who='tim', what='ham'), 'tim likes ham') + eq(s.safe_substitute(dict(who='tim'), what='ham'), 'tim likes ham') + eq(s.safe_substitute(dict(who='fred', what='kung pao'), + who='tim', what='ham'), + 'tim likes ham') + s = Template('the mapping is $mapping') + eq(s.safe_substitute(dict(foo='none'), mapping='bozo'), + 'the mapping is bozo') + eq(s.safe_substitute(dict(mapping='one'), mapping='two'), + 'the mapping is two') + d = dict(mapping='one') + raises(TypeError, s.substitute, d, {}) + raises(TypeError, s.safe_substitute, d, {}) + + s = Template('the self is $self') + eq(s.safe_substitute(self='bozo'), 'the self is bozo') + + def test_delimiter_override(self): + eq = self.assertEqual + raises = self.assertRaises + class AmpersandTemplate(Template): + delimiter = '&' + s = AmpersandTemplate('this &gift is for &{who} &&') + eq(s.substitute(gift='bud', who='you'), 'this bud is for you &') + raises(KeyError, s.substitute) + eq(s.safe_substitute(gift='bud', who='you'), 'this bud is for you &') + eq(s.safe_substitute(), 'this &gift is for &{who} &') + s = AmpersandTemplate('this &gift is for &{who} &') + raises(ValueError, s.substitute, dict(gift='bud', who='you')) + eq(s.safe_substitute(), 'this &gift is for &{who} &') + + class PieDelims(Template): + delimiter = '@' + s = PieDelims('@who likes to eat a bag of @{what} worth $100') + self.assertEqual(s.substitute(dict(who='tim', what='ham')), + 'tim likes to eat a bag of ham worth $100') + + +if __name__ == '__main__': unittest.main() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 03:49:11 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 03 Jun 2016 07:49:11 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Null_merge?= Message-ID: <20160603074911.4912.70472.2F9F148E@psf.io> https://hg.python.org/cpython/rev/19488e23dcdb changeset: 101657:19488e23dcdb parent: 101656:04fb6c0f3db3 parent: 101655:749129a53888 user: Serhiy Storchaka date: Fri Jun 03 10:48:43 2016 +0300 summary: Null merge files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 03:49:11 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 03 Jun 2016 07:49:11 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNSk6?= =?utf-8?q?_Merge_heads?= Message-ID: <20160603074910.5426.51749.E926E27D@psf.io> https://hg.python.org/cpython/rev/749129a53888 changeset: 101655:749129a53888 branch: 3.5 parent: 101653:1bd79ae95a4b parent: 101647:af1752e51a89 user: Serhiy Storchaka date: Fri Jun 03 10:47:38 2016 +0300 summary: Merge heads files: Doc/library/fcntl.rst | 4 +++- Doc/library/sqlite3.rst | 5 +++++ Doc/library/termios.rst | 8 ++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Doc/library/fcntl.rst b/Doc/library/fcntl.rst --- a/Doc/library/fcntl.rst +++ b/Doc/library/fcntl.rst @@ -12,7 +12,9 @@ pair: UNIX; I/O control This module performs file control and I/O control on file descriptors. It is an -interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. +interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. For a +complete description of these calls, see :manpage:`fcntl(2)` and +:manpage:`ioctl(2)` Unix manual pages. 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 diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -190,6 +190,11 @@ any combination of :const:`PARSE_DECLTYPES` and :const:`PARSE_COLNAMES` to turn type detection on. + By default, *check_same_thread* is :const:`True` and only the creating thread may + use the connection. If set :const:`False`, the returned connection may be shared + across multiple threads. When using multiple threads with the same connection + writing operations should be serialized by the user to avoid data corruption. + By default, the :mod:`sqlite3` module uses its :class:`Connection` class for the connect call. You can, however, subclass the :class:`Connection` class and make :func:`connect` use your class instead by providing your class for the *factory* diff --git a/Doc/library/termios.rst b/Doc/library/termios.rst --- a/Doc/library/termios.rst +++ b/Doc/library/termios.rst @@ -10,10 +10,10 @@ pair: POSIX; I/O control pair: tty; I/O control -This module provides an interface to the POSIX calls for tty I/O control. For a -complete description of these calls, see the POSIX or Unix manual pages. It is -only available for those Unix versions that support POSIX *termios* style tty -I/O control (and then only if configured at installation time). +This module provides an interface to the POSIX calls for tty I/O control. For a +complete description of these calls, see :manpage:`termios(2)` Unix manual +page. It is only available for those Unix versions that support POSIX +*termios* style tty I/O control configured during installation. 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 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 03:49:11 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 03 Jun 2016 07:49:11 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?q?=29=3A_Merge_heads?= Message-ID: <20160603074911.102872.90125.8ADD7282@psf.io> https://hg.python.org/cpython/rev/04fb6c0f3db3 changeset: 101656:04fb6c0f3db3 parent: 101654:278074563d70 parent: 101648:17c8da643065 user: Serhiy Storchaka date: Fri Jun 03 10:48:13 2016 +0300 summary: Merge heads files: Doc/library/fcntl.rst | 4 +++- Doc/library/sqlite3.rst | 5 +++++ Doc/library/termios.rst | 8 ++++---- Lib/subprocess.py | 19 +++++++++++++++---- Lib/test/test_subprocess.py | 21 +++++++++++++++++++++ Misc/NEWS | 3 +++ 6 files changed, 51 insertions(+), 9 deletions(-) diff --git a/Doc/library/fcntl.rst b/Doc/library/fcntl.rst --- a/Doc/library/fcntl.rst +++ b/Doc/library/fcntl.rst @@ -12,7 +12,9 @@ pair: UNIX; I/O control This module performs file control and I/O control on file descriptors. It is an -interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. +interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. For a +complete description of these calls, see :manpage:`fcntl(2)` and +:manpage:`ioctl(2)` Unix manual pages. 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 diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -190,6 +190,11 @@ any combination of :const:`PARSE_DECLTYPES` and :const:`PARSE_COLNAMES` to turn type detection on. + By default, *check_same_thread* is :const:`True` and only the creating thread may + use the connection. If set :const:`False`, the returned connection may be shared + across multiple threads. When using multiple threads with the same connection + writing operations should be serialized by the user to avoid data corruption. + By default, the :mod:`sqlite3` module uses its :class:`Connection` class for the connect call. You can, however, subclass the :class:`Connection` class and make :func:`connect` use your class instead by providing your class for the *factory* diff --git a/Doc/library/termios.rst b/Doc/library/termios.rst --- a/Doc/library/termios.rst +++ b/Doc/library/termios.rst @@ -10,10 +10,10 @@ pair: POSIX; I/O control pair: tty; I/O control -This module provides an interface to the POSIX calls for tty I/O control. For a -complete description of these calls, see the POSIX or Unix manual pages. It is -only available for those Unix versions that support POSIX *termios* style tty -I/O control (and then only if configured at installation time). +This module provides an interface to the POSIX calls for tty I/O control. For a +complete description of these calls, see :manpage:`termios(2)` Unix manual +page. It is only available for those Unix versions that support POSIX +*termios* style tty I/O control configured during installation. 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 diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -372,9 +372,11 @@ class CalledProcessError(SubprocessError): - """This exception is raised when a process run by check_call() or - check_output() returns a non-zero exit status. - The exit status will be stored in the returncode attribute; + """Raised when a check_call() or check_output() process returns non-zero. + + The exit status will be stored in the returncode attribute, negative + if it represents a signal number. + check_output() will also store the output in the output attribute. """ def __init__(self, returncode, cmd, output=None, stderr=None): @@ -384,7 +386,16 @@ self.stderr = stderr def __str__(self): - return "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode) + if self.returncode and self.returncode < 0: + try: + return "Command '%s' died with %r." % ( + self.cmd, signal.Signals(-self.returncode)) + except ValueError: + return "Command '%s' died with unknown signal %d." % ( + self.cmd, -self.returncode) + else: + return "Command '%s' returned non-zero exit status %d." % ( + self.cmd, self.returncode) @property def stdout(self): 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 @@ -1427,6 +1427,27 @@ p.wait() self.assertEqual(-p.returncode, signal.SIGABRT) + def test_CalledProcessError_str_signal(self): + err = subprocess.CalledProcessError(-int(signal.SIGABRT), "fake cmd") + error_string = str(err) + # We're relying on the repr() of the signal.Signals intenum to provide + # the word signal, the signal name and the numeric value. + self.assertIn("signal", error_string.lower()) + # We're not being specific about the signal name as some signals have + # multiple names and which name is revealed can vary. + self.assertIn("SIG", error_string) + self.assertIn(str(signal.SIGABRT), error_string) + + def test_CalledProcessError_str_unknown_signal(self): + err = subprocess.CalledProcessError(-9876543, "fake cmd") + error_string = str(err) + self.assertIn("unknown signal 9876543.", error_string) + + def test_CalledProcessError_str_non_zero(self): + err = subprocess.CalledProcessError(2, "fake cmd") + error_string = str(err) + self.assertIn("non-zero exit status 2.", error_string) + def test_preexec(self): # DISCLAIMER: Setting environment variables is *not* a good use # of a preexec_fn. This is merely a test. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -22,6 +22,9 @@ Library ------- +- Issue #27167: Clarify the subprocess.CalledProcessError error message text + when the child process died due to a signal. + - Issue #25931: Don't define socketserver.Forking* names on platforms such as Windows that do not support os.fork(). -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 03:49:11 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 03 Jun 2016 07:49:11 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy41Lg==?= Message-ID: <20160603074910.70075.25758.2CB67DC9@psf.io> https://hg.python.org/cpython/rev/278074563d70 changeset: 101654:278074563d70 parent: 101636:015b86646d8e parent: 101653:1bd79ae95a4b user: Serhiy Storchaka date: Fri Jun 03 10:45:56 2016 +0300 summary: Merge 3.5. files: Lib/test/test_string.py | 62 ++++++++++++++-------------- 1 files changed, 32 insertions(+), 30 deletions(-) diff --git a/Lib/test/test_string.py b/Lib/test/test_string.py --- a/Lib/test/test_string.py +++ b/Lib/test/test_string.py @@ -1,4 +1,6 @@ -import unittest, string +import unittest +import string +from string import Template class ModuleTest(unittest.TestCase): @@ -205,14 +207,14 @@ class TestTemplate(unittest.TestCase): def test_regular_templates(self): - s = string.Template('$who likes to eat a bag of $what worth $$100') + s = Template('$who likes to eat a bag of $what worth $$100') self.assertEqual(s.substitute(dict(who='tim', what='ham')), 'tim likes to eat a bag of ham worth $100') self.assertRaises(KeyError, s.substitute, dict(who='tim')) - self.assertRaises(TypeError, string.Template.substitute) + self.assertRaises(TypeError, Template.substitute) def test_regular_templates_with_braces(self): - s = string.Template('$who likes ${what} for ${meal}') + s = Template('$who likes ${what} for ${meal}') d = dict(who='tim', what='ham', meal='dinner') self.assertEqual(s.substitute(d), 'tim likes ham for dinner') self.assertRaises(KeyError, s.substitute, @@ -220,38 +222,38 @@ def test_escapes(self): eq = self.assertEqual - s = string.Template('$who likes to eat a bag of $$what worth $$100') + s = Template('$who likes to eat a bag of $$what worth $$100') eq(s.substitute(dict(who='tim', what='ham')), 'tim likes to eat a bag of $what worth $100') - s = string.Template('$who likes $$') + s = Template('$who likes $$') eq(s.substitute(dict(who='tim', what='ham')), 'tim likes $') def test_percents(self): eq = self.assertEqual - s = string.Template('%(foo)s $foo ${foo}') + s = Template('%(foo)s $foo ${foo}') d = dict(foo='baz') eq(s.substitute(d), '%(foo)s baz baz') eq(s.safe_substitute(d), '%(foo)s baz baz') def test_stringification(self): eq = self.assertEqual - s = string.Template('tim has eaten $count bags of ham today') + s = Template('tim has eaten $count bags of ham today') d = dict(count=7) eq(s.substitute(d), 'tim has eaten 7 bags of ham today') eq(s.safe_substitute(d), 'tim has eaten 7 bags of ham today') - s = string.Template('tim has eaten ${count} bags of ham today') + s = Template('tim has eaten ${count} bags of ham today') eq(s.substitute(d), 'tim has eaten 7 bags of ham today') def test_tupleargs(self): eq = self.assertEqual - s = string.Template('$who ate ${meal}') + s = Template('$who ate ${meal}') d = dict(who=('tim', 'fred'), meal=('ham', 'kung pao')) eq(s.substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") eq(s.safe_substitute(d), "('tim', 'fred') ate ('ham', 'kung pao')") def test_SafeTemplate(self): eq = self.assertEqual - s = string.Template('$who likes ${what} for ${meal}') + s = Template('$who likes ${what} for ${meal}') eq(s.safe_substitute(dict(who='tim')), 'tim likes ${what} for ${meal}') eq(s.safe_substitute(dict(what='ham')), '$who likes ham for ${meal}') eq(s.safe_substitute(dict(what='ham', meal='dinner')), @@ -263,15 +265,15 @@ def test_invalid_placeholders(self): raises = self.assertRaises - s = string.Template('$who likes $') + s = Template('$who likes $') raises(ValueError, s.substitute, dict(who='tim')) - s = string.Template('$who likes ${what)') + s = Template('$who likes ${what)') raises(ValueError, s.substitute, dict(who='tim')) - s = string.Template('$who likes $100') + s = Template('$who likes $100') raises(ValueError, s.substitute, dict(who='tim')) def test_idpattern_override(self): - class PathPattern(string.Template): + class PathPattern(Template): idpattern = r'[_a-z][._a-z0-9]*' m = Mapping() m.bag = Bag() @@ -282,7 +284,7 @@ self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') def test_pattern_override(self): - class MyPattern(string.Template): + class MyPattern(Template): pattern = r""" (?P@{2}) | @(?P[_a-z][._a-z0-9]*) | @@ -297,7 +299,7 @@ s = MyPattern('@bag.foo.who likes to eat a bag of @bag.what') self.assertEqual(s.substitute(m), 'tim likes to eat a bag of ham') - class BadPattern(string.Template): + class BadPattern(Template): pattern = r""" (?P.*) | (?P@{2}) | @@ -310,7 +312,7 @@ self.assertRaises(ValueError, s.safe_substitute, {}) def test_braced_override(self): - class MyTemplate(string.Template): + class MyTemplate(Template): pattern = r""" \$(?: (?P$) | @@ -327,7 +329,7 @@ self.assertEqual(val, 'PyCon in Cleveland') def test_braced_override_safe(self): - class MyTemplate(string.Template): + class MyTemplate(Template): pattern = r""" \$(?: (?P$) | @@ -349,7 +351,7 @@ # pattern can't trigger (always has at least '$') # So we craft a pattern that is always invalid # with no leading data. - class MyTemplate(string.Template): + class MyTemplate(Template): pattern = r""" (?P) | unreachable( @@ -364,37 +366,37 @@ self.assertIn('line 1, col 1', str(err.exception)) def test_unicode_values(self): - s = string.Template('$who likes $what') + s = Template('$who likes $what') d = dict(who='t\xffm', what='f\xfe\fed') self.assertEqual(s.substitute(d), 't\xffm likes f\xfe\x0ced') def test_keyword_arguments(self): eq = self.assertEqual - s = string.Template('$who likes $what') + s = Template('$who likes $what') eq(s.substitute(who='tim', what='ham'), 'tim likes ham') eq(s.substitute(dict(who='tim'), what='ham'), 'tim likes ham') eq(s.substitute(dict(who='fred', what='kung pao'), who='tim', what='ham'), 'tim likes ham') - s = string.Template('the mapping is $mapping') + s = Template('the mapping is $mapping') eq(s.substitute(dict(foo='none'), mapping='bozo'), 'the mapping is bozo') eq(s.substitute(dict(mapping='one'), mapping='two'), 'the mapping is two') - s = string.Template('the self is $self') + s = Template('the self is $self') eq(s.substitute(self='bozo'), 'the self is bozo') def test_keyword_arguments_safe(self): eq = self.assertEqual raises = self.assertRaises - s = string.Template('$who likes $what') + s = Template('$who likes $what') eq(s.safe_substitute(who='tim', what='ham'), 'tim likes ham') eq(s.safe_substitute(dict(who='tim'), what='ham'), 'tim likes ham') eq(s.safe_substitute(dict(who='fred', what='kung pao'), who='tim', what='ham'), 'tim likes ham') - s = string.Template('the mapping is $mapping') + s = Template('the mapping is $mapping') eq(s.safe_substitute(dict(foo='none'), mapping='bozo'), 'the mapping is bozo') eq(s.safe_substitute(dict(mapping='one'), mapping='two'), @@ -403,13 +405,13 @@ raises(TypeError, s.substitute, d, {}) raises(TypeError, s.safe_substitute, d, {}) - s = string.Template('the self is $self') + s = Template('the self is $self') eq(s.safe_substitute(self='bozo'), 'the self is bozo') def test_delimiter_override(self): eq = self.assertEqual raises = self.assertRaises - class AmpersandTemplate(string.Template): + class AmpersandTemplate(Template): delimiter = '&' s = AmpersandTemplate('this &gift is for &{who} &&') eq(s.substitute(gift='bud', who='you'), 'this bud is for you &') @@ -420,12 +422,12 @@ raises(ValueError, s.substitute, dict(gift='bud', who='you')) eq(s.safe_substitute(), 'this &gift is for &{who} &') - class PieDelims(string.Template): + class PieDelims(Template): delimiter = '@' s = PieDelims('@who likes to eat a bag of @{what} worth $100') self.assertEqual(s.substitute(dict(who='tim', what='ham')), 'tim likes to eat a bag of ham worth $100') -if __name__ == "__main__": +if __name__ == '__main__': unittest.main() -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Fri Jun 3 04:50:36 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 03 Jun 2016 08:50:36 +0000 Subject: [Python-checkins] Daily reference leaks (3145242bc81f): sum=5 Message-ID: <20160603085035.103054.45594.25211F01@psf.io> results for 3145242bc81f on branch "default" -------------------------------------------- test_asyncio leaked [3, 0, 0] memory blocks, sum=3 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_fork leaked [0, 0, -2] memory blocks, sum=-2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflognzCcvn', '--timeout', '7200'] From lp_benchmark_robot at intel.com Fri Jun 3 10:05:58 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 3 Jun 2016 15:05:58 +0100 Subject: [Python-checkins] UGLY Benchmark Results for Python Default 2016-06-03 Message-ID: <1d0a9880-72e5-469a-a3a1-0fe7d3f5d529@irsmsx106.ger.corp.intel.com> Results for project Python default, build date 2016-06-03 02:02:23 +0000 commit: 9c8be3b89964 previous commit: 1bd3daae351d revision date: 2016-06-03 00:57:26 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.22% 1.62% 6.61% 17.65% :-| pybench 0.36% -0.20% 1.47% 8.30% :-( regex_v8 2.62% -1.95% -4.55% -2.99% :-| nbody 0.80% 0.35% 1.05% 8.48% :-| json_dump_v2 0.32% -0.49% -0.39% 12.45% :-| normal_startup 0.80% -0.12% -0.84% 6.15% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/ugly-benchmark-results-for-python-default-2016-06-03/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Fri Jun 3 13:33:18 2016 From: python-checkins at python.org (r.david.murray) Date: Fri, 03 Jun 2016 17:33:18 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogIzIyNzk3OiBjbGFy?= =?utf-8?q?ify_when_URLErrors_are_raised_by_urlopen=2E?= Message-ID: <20160603173318.13306.16757.B0B648E5@psf.io> https://hg.python.org/cpython/rev/aed4b9981fca changeset: 101658:aed4b9981fca branch: 3.5 parent: 101655:749129a53888 user: R David Murray date: Fri Jun 03 13:29:17 2016 -0400 summary: #22797: clarify when URLErrors are raised by urlopen. files: Doc/library/urllib.request.rst | 2 +- 1 files changed, 1 insertions(+), 1 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 @@ -83,7 +83,7 @@ :class:`URLopener` and :class:`FancyURLopener` classes, this function returns a :class:`urllib.response.addinfourl` object. - Raises :exc:`~urllib.error.URLError` on errors. + Raises :exc:`~urllib.error.URLError` on protocol errors. Note that ``None`` may be returned if no handler handles the request (though the default installed global :class:`OpenerDirector` uses -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 13:33:38 2016 From: python-checkins at python.org (terry.reedy) Date: Fri, 03 Jun 2016 17:33:38 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgMjA1Njc6?= =?utf-8?q?_Revise_idle=5Ftest/README=2Etxt_and_some_tests_to_match_new_ad?= =?utf-8?q?vice=2E?= Message-ID: <20160603173322.91039.55896.7F85D015@psf.io> https://hg.python.org/cpython/rev/8090931ba850 changeset: 101660:8090931ba850 branch: 2.7 parent: 101646:55886a6aed4b user: Terry Jan Reedy date: Fri Jun 03 13:33:09 2016 -0400 summary: Issue 20567: Revise idle_test/README.txt and some tests to match new advice. files: Lib/idlelib/idle_test/README.txt | 13 +++- Lib/idlelib/idle_test/test_autocomplete.py | 3 +- Lib/idlelib/idle_test/test_autoexpand.py | 2 +- Lib/idlelib/idle_test/test_configdialog.py | 3 +- Lib/idlelib/idle_test/test_formatparagraph.py | 3 +- Lib/idlelib/idle_test/test_textview.py | 5 +- Lib/idlelib/idle_test/test_widgetredir.py | 24 +++++----- 7 files changed, 27 insertions(+), 26 deletions(-) diff --git a/Lib/idlelib/idle_test/README.txt b/Lib/idlelib/idle_test/README.txt --- a/Lib/idlelib/idle_test/README.txt +++ b/Lib/idlelib/idle_test/README.txt @@ -51,17 +51,20 @@ This will typically be setUpClass. To avoid interfering with other gui tests, all gui objects must be destroyed and -deleted by the end of the test. Widgets, such as a Tk root, created in a setUpX -function, should be destroyed in the corresponding tearDownX. Module and class -widget attributes should also be deleted.. +deleted by the end of the test. The Tk root created in a setUpX function should +be destroyed in the corresponding tearDownX and the module or class attribute +deleted. Others widgets should descend from the single root and the attributes +deleted BEFORE root is destroyed. See https://bugs.python.org/issue20567. @classmethod def setUpClass(cls): requires('gui') cls.root = tk.Tk() + cls.text = tk.Text(root) @classmethod def tearDownClass(cls): + del cls.text cls.root.destroy() del cls.root @@ -69,13 +72,15 @@ See https://bugs.python.org/issue18910 Requires('gui') causes the test(s) it guards to be skipped if any of -a few conditions are met: +these conditions are met: - The tests are being run by regrtest.py, and it was started without enabling the "gui" resource with the "-u" command line option. - The tests are being run on Windows by a service that is not allowed to interact with the graphical environment. + + - The tests are being run on Linux and X window is not available. - The tests are being run on Mac OSX in a process that cannot make a window manager connection. diff --git a/Lib/idlelib/idle_test/test_autocomplete.py b/Lib/idlelib/idle_test/test_autocomplete.py --- a/Lib/idlelib/idle_test/test_autocomplete.py +++ b/Lib/idlelib/idle_test/test_autocomplete.py @@ -33,9 +33,8 @@ @classmethod def tearDownClass(cls): + del cls.editor, cls.text cls.root.destroy() - del cls.text - del cls.editor del cls.root def setUp(self): diff --git a/Lib/idlelib/idle_test/test_autoexpand.py b/Lib/idlelib/idle_test/test_autoexpand.py --- a/Lib/idlelib/idle_test/test_autoexpand.py +++ b/Lib/idlelib/idle_test/test_autoexpand.py @@ -25,10 +25,10 @@ @classmethod def tearDownClass(cls): + del cls.text, cls.auto_expand if hasattr(cls, 'tk'): cls.tk.destroy() del cls.tk - del cls.text, cls.auto_expand def tearDown(self): self.text.delete('1.0', 'end') diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py --- a/Lib/idlelib/idle_test/test_configdialog.py +++ b/Lib/idlelib/idle_test/test_configdialog.py @@ -24,9 +24,8 @@ del cls.root def test_dialog(self): - d=ConfigDialog(self.root, 'Test', _utest=True) + d = ConfigDialog(self.root, 'Test', _utest=True) d.remove_var_callbacks() - d.destroy() if __name__ == '__main__': diff --git a/Lib/idlelib/idle_test/test_formatparagraph.py b/Lib/idlelib/idle_test/test_formatparagraph.py --- a/Lib/idlelib/idle_test/test_formatparagraph.py +++ b/Lib/idlelib/idle_test/test_formatparagraph.py @@ -276,10 +276,9 @@ @classmethod def tearDownClass(cls): + del cls.text, cls.formatter cls.root.destroy() del cls.root - del cls.text - del cls.formatter def test_short_line(self): self.text.insert('1.0', "Short line\n") diff --git a/Lib/idlelib/idle_test/test_textview.py b/Lib/idlelib/idle_test/test_textview.py --- a/Lib/idlelib/idle_test/test_textview.py +++ b/Lib/idlelib/idle_test/test_textview.py @@ -23,10 +23,9 @@ @classmethod def tearDownClass(cls): + del cls.TV cls.root.destroy() - TV = cls.TV - del cls.root, cls.TV - del TV.transient, TV.grab_set, TV.wait_window + del cls.root def setUp(self): TV = self.TV diff --git a/Lib/idlelib/idle_test/test_widgetredir.py b/Lib/idlelib/idle_test/test_widgetredir.py --- a/Lib/idlelib/idle_test/test_widgetredir.py +++ b/Lib/idlelib/idle_test/test_widgetredir.py @@ -14,14 +14,14 @@ @classmethod def setUpClass(cls): requires('gui') - cls.tk = Tk() - cls.text = Text(cls.tk) + cls.root = Tk() + cls.text = Text(cls.root) @classmethod def tearDownClass(cls): - cls.text.destroy() - cls.tk.destroy() - del cls.text, cls.tk + del cls.text + cls.root.destroy() + del cls.root def test_init(self): redir = WidgetRedirector(self.text) @@ -43,14 +43,14 @@ @classmethod def setUpClass(cls): requires('gui') - cls.tk = Tk() - cls.text = Text(cls.tk) + cls.root = Tk() + cls.text = Text(cls.root) @classmethod def tearDownClass(cls): - cls.text.destroy() - cls.tk.destroy() - del cls.text, cls.tk + del cls.text + cls.root.destroy() + del cls.root def setUp(self): self.redir = WidgetRedirector(self.text) @@ -108,13 +108,13 @@ def test_command_dispatch(self): # Test that .__init__ causes redirection of tk calls # through redir.dispatch - self.tk.call(self.text._w, 'insert', 'hello') + self.root.call(self.text._w, 'insert', 'hello') self.assertEqual(self.func.args, ('hello',)) self.assertEqual(self.text.get('1.0', 'end'), '\n') # Ensure that called through redir .dispatch and not through # self.text.insert by having mock raise TclError. self.func.__init__(TclError()) - self.assertEqual(self.tk.call(self.text._w, 'insert', 'boo'), '') + self.assertEqual(self.root.call(self.text._w, 'insert', 'boo'), '') -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 13:38:19 2016 From: python-checkins at python.org (r.david.murray) Date: Fri, 03 Jun 2016 17:38:19 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_3=2E5?= =?utf-8?q?=29=3A_Merge=3A_=2322797=3A_clarify_when_URLErrors_are_raised_b?= =?utf-8?q?y_urlopen=2E?= Message-ID: <20160603173318.11776.41413.C1EEF847@psf.io> https://hg.python.org/cpython/rev/d085b4f779af changeset: 101659:d085b4f779af branch: 3.5 parent: 101657:19488e23dcdb parent: 101658:aed4b9981fca user: R David Murray date: Fri Jun 03 13:32:48 2016 -0400 summary: Merge: #22797: clarify when URLErrors are raised by urlopen. files: Doc/library/urllib.request.rst | 2 +- 1 files changed, 1 insertions(+), 1 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 @@ -83,7 +83,7 @@ :class:`URLopener` and :class:`FancyURLopener` classes, this function returns a :class:`urllib.response.addinfourl` object. - Raises :exc:`~urllib.error.URLError` on errors. + Raises :exc:`~urllib.error.URLError` on protocol errors. Note that ``None`` may be returned if no handler handles the request (though the default installed global :class:`OpenerDirector` uses -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 14:43:28 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 03 Jun 2016 18:43:28 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2326983=3A_float=28?= =?utf-8?q?=29_now_always_return_an_instance_of_exact_float=2E?= Message-ID: <20160603184326.21460.32790.E8CD7707@psf.io> https://hg.python.org/cpython/rev/050e5f803999 changeset: 101661:050e5f803999 parent: 101657:19488e23dcdb user: Serhiy Storchaka date: Fri Jun 03 21:42:55 2016 +0300 summary: Issue #26983: float() now always return an instance of exact float. The deprecation warning is emitted if __float__ returns an instance of a strict subclass of float. In a future versions of Python this can be an error. files: Lib/test/test_float.py | 21 +++++++---- Lib/test/test_getargs2.py | 6 ++- Misc/NEWS | 5 ++ Objects/abstract.c | 30 ++++++++++++++--- Objects/floatobject.c | 46 +++++++++++++++++--------- 5 files changed, 76 insertions(+), 32 deletions(-) diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py --- a/Lib/test/test_float.py +++ b/Lib/test/test_float.py @@ -161,11 +161,12 @@ def __float__(self): return float(str(self)) + 1 - self.assertAlmostEqual(float(Foo1()), 42.) - self.assertAlmostEqual(float(Foo2()), 42.) - self.assertAlmostEqual(float(Foo3(21)), 42.) + self.assertEqual(float(Foo1()), 42.) + self.assertEqual(float(Foo2()), 42.) + with self.assertWarns(DeprecationWarning): + self.assertEqual(float(Foo3(21)), 42.) self.assertRaises(TypeError, float, Foo4(42)) - self.assertAlmostEqual(float(FooStr('8')), 9.) + self.assertEqual(float(FooStr('8')), 9.) class Foo5: def __float__(self): @@ -176,10 +177,14 @@ class F: def __float__(self): return OtherFloatSubclass(42.) - self.assertAlmostEqual(float(F()), 42.) - self.assertIs(type(float(F())), OtherFloatSubclass) - self.assertAlmostEqual(FloatSubclass(F()), 42.) - self.assertIs(type(FloatSubclass(F())), FloatSubclass) + with self.assertWarns(DeprecationWarning): + self.assertEqual(float(F()), 42.) + with self.assertWarns(DeprecationWarning): + self.assertIs(type(float(F())), float) + with self.assertWarns(DeprecationWarning): + self.assertEqual(FloatSubclass(F()), 42.) + with self.assertWarns(DeprecationWarning): + self.assertIs(type(FloatSubclass(F())), FloatSubclass) def test_is_integer(self): self.assertFalse((1.1).is_integer()) diff --git a/Lib/test/test_getargs2.py b/Lib/test/test_getargs2.py --- a/Lib/test/test_getargs2.py +++ b/Lib/test/test_getargs2.py @@ -365,7 +365,8 @@ self.assertEqual(getargs_f(FloatSubclass(7.5)), 7.5) self.assertEqual(getargs_f(FloatSubclass2(7.5)), 7.5) self.assertRaises(TypeError, getargs_f, BadFloat()) - self.assertEqual(getargs_f(BadFloat2()), 4.25) + with self.assertWarns(DeprecationWarning): + self.assertEqual(getargs_f(BadFloat2()), 4.25) self.assertEqual(getargs_f(BadFloat3(7.5)), 7.5) for x in (FLT_MIN, -FLT_MIN, FLT_MAX, -FLT_MAX, INF, -INF): @@ -390,7 +391,8 @@ self.assertEqual(getargs_d(FloatSubclass(7.5)), 7.5) self.assertEqual(getargs_d(FloatSubclass2(7.5)), 7.5) self.assertRaises(TypeError, getargs_d, BadFloat()) - self.assertEqual(getargs_d(BadFloat2()), 4.25) + with self.assertWarns(DeprecationWarning): + self.assertEqual(getargs_d(BadFloat2()), 4.25) self.assertEqual(getargs_d(BadFloat3(7.5)), 7.5) for x in (DBL_MIN, -DBL_MIN, DBL_MAX, -DBL_MAX, INF, -INF): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,11 @@ Core and Builtins ----------------- +- Issue #26983: float() now always return an instance of exact float. + The deprecation warning is emitted if __float__ returns an instance of + a strict subclass of float. In a future versions of Python this can + be an error. + - Issue #27097: Python interpreter is now about 7% faster due to optimized instruction decoding. Based on patch by Demur Rumed. diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -1351,21 +1351,39 @@ if (o == NULL) return null_error(); + if (PyFloat_CheckExact(o)) { + Py_INCREF(o); + return o; + } m = o->ob_type->tp_as_number; if (m && m->nb_float) { /* This should include subclasses of float */ PyObject *res = m->nb_float(o); - if (res && !PyFloat_Check(res)) { + double val; + if (!res || PyFloat_CheckExact(res)) { + return res; + } + if (!PyFloat_Check(res)) { PyErr_Format(PyExc_TypeError, - "__float__ returned non-float (type %.200s)", - res->ob_type->tp_name); + "%.50s.__float__ returned non-float (type %.50s)", + o->ob_type->tp_name, res->ob_type->tp_name); Py_DECREF(res); return NULL; } - return res; + /* Issue #26983: warn if 'res' not of exact type float. */ + if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, + "%.50s.__float__ returned non-float (type %.50s). " + "The ability to return an instance of a strict subclass of float " + "is deprecated, and may be removed in a future version of Python.", + o->ob_type->tp_name, res->ob_type->tp_name)) { + Py_DECREF(res); + return NULL; + } + val = PyFloat_AS_DOUBLE(res); + Py_DECREF(res); + return PyFloat_FromDouble(val); } if (PyFloat_Check(o)) { /* A float subclass with nb_float == NULL */ - PyFloatObject *po = (PyFloatObject *)o; - return PyFloat_FromDouble(po->ob_fval); + return PyFloat_FromDouble(PyFloat_AS_DOUBLE(o)); } return PyFloat_FromString(o); } diff --git a/Objects/floatobject.c b/Objects/floatobject.c --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -215,35 +215,49 @@ PyFloat_AsDouble(PyObject *op) { PyNumberMethods *nb; - PyFloatObject *fo; + PyObject *res; double val; - if (op && PyFloat_Check(op)) - return PyFloat_AS_DOUBLE((PyFloatObject*) op); - if (op == NULL) { PyErr_BadArgument(); return -1; } - if ((nb = Py_TYPE(op)->tp_as_number) == NULL || nb->nb_float == NULL) { - PyErr_SetString(PyExc_TypeError, "a float is required"); + if (PyFloat_Check(op)) { + return PyFloat_AS_DOUBLE(op); + } + + nb = Py_TYPE(op)->tp_as_number; + if (nb == NULL || nb->nb_float == NULL) { + PyErr_Format(PyExc_TypeError, "must be real number, not %.50s", + op->ob_type->tp_name); return -1; } - fo = (PyFloatObject*) (*nb->nb_float) (op); - if (fo == NULL) - return -1; - if (!PyFloat_Check(fo)) { - Py_DECREF(fo); - PyErr_SetString(PyExc_TypeError, - "nb_float should return float object"); + res = (*nb->nb_float) (op); + if (res == NULL) { return -1; } + if (!PyFloat_CheckExact(res)) { + if (!PyFloat_Check(res)) { + PyErr_Format(PyExc_TypeError, + "%.50s.__float__ returned non-float (type %.50s)", + op->ob_type->tp_name, res->ob_type->tp_name); + Py_DECREF(res); + return -1; + } + if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1, + "%.50s.__float__ returned non-float (type %.50s). " + "The ability to return an instance of a strict subclass of float " + "is deprecated, and may be removed in a future version of Python.", + op->ob_type->tp_name, res->ob_type->tp_name)) { + Py_DECREF(res); + return -1; + } + } - val = PyFloat_AS_DOUBLE(fo); - Py_DECREF(fo); - + val = PyFloat_AS_DOUBLE(res); + Py_DECREF(res); return val; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 15:28:17 2016 From: python-checkins at python.org (gregory.p.smith) Date: Fri, 03 Jun 2016 19:28:17 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_signal=2C_socket=2C_and_ss?= =?utf-8?q?l_module_IntEnum_constant_name_lookups_now_return_a?= Message-ID: <20160603191500.69802.92042.83B6DA50@psf.io> https://hg.python.org/cpython/rev/365b5e6163a6 changeset: 101662:365b5e6163a6 user: Gregory P. Smith [Google Inc.] date: Fri Jun 03 19:14:52 2016 +0000 summary: signal, socket, and ssl module IntEnum constant name lookups now return a consistent name for values having multiple names. Ex: signal.Signals(6) now refers to itself as signal.SIGALRM rather than flipping between that and signal.SIGIOT based on the interpreter's hash randomization seed. This helps finish issue27167. files: Lib/enum.py | 10 ++++++- Lib/test/test_enum.py | 36 +++++++++++++++++++++++++++++++ Misc/NEWS | 5 ++++ 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/Lib/enum.py b/Lib/enum.py --- a/Lib/enum.py +++ b/Lib/enum.py @@ -550,8 +550,14 @@ source = vars(source) else: source = module_globals - members = {name: value for name, value in source.items() - if filter(name)} + # We use an OrderedDict of sorted source keys so that the + # _value2member_map is populated in the same order every time + # for a consistent reverse mapping of number to name when there + # are multiple names for the same number rather than varying + # between runs due to hash randomization of the module dictionary. + members = OrderedDict((name, source[name]) + for name in sorted(source.keys()) + if filter(name)) cls = cls(name, members, module=module) cls.__reduce_ex__ = _reduce_ex_by_name module_globals.update(cls.__members__) diff --git a/Lib/test/test_enum.py b/Lib/test/test_enum.py --- a/Lib/test/test_enum.py +++ b/Lib/test/test_enum.py @@ -1768,5 +1768,41 @@ support.check__all__(self, enum) +# These are unordered here on purpose to ensure that declaration order +# makes no difference. +CONVERT_TEST_NAME_D = 5 +CONVERT_TEST_NAME_C = 5 +CONVERT_TEST_NAME_B = 5 +CONVERT_TEST_NAME_A = 5 # This one should sort first. +CONVERT_TEST_NAME_E = 5 +CONVERT_TEST_NAME_F = 5 + +class TestIntEnumConvert(unittest.TestCase): + def test_convert_value_lookup_priority(self): + test_type = enum.IntEnum._convert( + 'UnittestConvert', 'test.test_enum', + filter=lambda x: x.startswith('CONVERT_TEST_')) + # We don't want the reverse lookup value to vary when there are + # multiple possible names for a given value. It should always + # report the first lexigraphical name in that case. + self.assertEqual(test_type(5).name, 'CONVERT_TEST_NAME_A') + + def test_convert(self): + test_type = enum.IntEnum._convert( + 'UnittestConvert', 'test.test_enum', + filter=lambda x: x.startswith('CONVERT_TEST_')) + # Ensure that test_type has all of the desired names and values. + self.assertEqual(test_type.CONVERT_TEST_NAME_F, + test_type.CONVERT_TEST_NAME_A) + self.assertEqual(test_type.CONVERT_TEST_NAME_B, 5) + self.assertEqual(test_type.CONVERT_TEST_NAME_C, 5) + self.assertEqual(test_type.CONVERT_TEST_NAME_D, 5) + self.assertEqual(test_type.CONVERT_TEST_NAME_E, 5) + # Ensure that test_type only picked up names matching the filter. + self.assertEqual([name for name in dir(test_type) + if name[0:2] not in ('CO', '__')], + [], msg='Names other than CONVERT_TEST_* found.') + + if __name__ == '__main__': unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,11 @@ Library ------- +- signal, socket, and ssl module IntEnum constant name lookups now return a + consistent name for values having multiple names. Ex: signal.Signals(6) + now refers to itself as signal.SIGALRM rather than flipping between that + and signal.SIGIOT based on the interpreter's hash randomization seed. + - Issue #27167: Clarify the subprocess.CalledProcessError error message text when the child process died due to a signal. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 15:51:00 2016 From: python-checkins at python.org (r.david.murray) Date: Fri, 03 Jun 2016 19:51:00 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_psuedo_merge=3A_=2322797?= =?utf-8?q?=3A_clarify_when_URLErrors_are_raised_by_urlopen=2E?= Message-ID: <20160603195057.69987.46876.9C43325D@psf.io> https://hg.python.org/cpython/rev/8b6b6add8e47 changeset: 101663:8b6b6add8e47 user: R David Murray date: Fri Jun 03 15:40:29 2016 -0400 summary: psuedo merge: #22797: clarify when URLErrors are raised by urlopen. I'm not sure how my previous merge commit got screwed up, hopefully this one will do the right thing. files: Doc/library/urllib.request.rst | 2 +- 1 files changed, 1 insertions(+), 1 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 @@ -83,7 +83,7 @@ :class:`URLopener` and :class:`FancyURLopener` classes, this function returns a :class:`urllib.response.addinfourl` object. - Raises :exc:`~urllib.error.URLError` on errors. + Raises :exc:`~urllib.error.URLError` on protocol errors. Note that ``None`` may be returned if no handler handles the request (though the default installed global :class:`OpenerDirector` uses -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 17:07:10 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 03 Jun 2016 21:07:10 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327073=3A_Removed_?= =?utf-8?q?redundant_checks_in_long=5Fadd_and_long=5Fsub=2E?= Message-ID: <20160603210702.38702.68365.5DE651D2@psf.io> https://hg.python.org/cpython/rev/c21bf38a9d07 changeset: 101664:c21bf38a9d07 user: Serhiy Storchaka date: Sat Jun 04 00:06:45 2016 +0300 summary: Issue #27073: Removed redundant checks in long_add and long_sub. Patch by Oren Milman. files: Objects/longobject.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Objects/longobject.c b/Objects/longobject.c --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -3022,8 +3022,14 @@ if (Py_SIZE(a) < 0) { if (Py_SIZE(b) < 0) { z = x_add(a, b); - if (z != NULL && Py_SIZE(z) != 0) + if (z != NULL) { + /* x_add received at least one multiple-digit int, + and thus z must be a multiple-digit int. + That also means z is not an element of + small_ints, so negating it in-place is safe. */ + assert(Py_REFCNT(z) == 1); Py_SIZE(z) = -(Py_SIZE(z)); + } } else z = x_sub(b, a); @@ -3054,8 +3060,10 @@ z = x_sub(a, b); else z = x_add(a, b); - if (z != NULL && Py_SIZE(z) != 0) + if (z != NULL) { + assert(Py_SIZE(z) == 0 || Py_REFCNT(z) == 1); Py_SIZE(z) = -(Py_SIZE(z)); + } } else { if (Py_SIZE(b) < 0) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 17:53:53 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 03 Jun 2016 21:53:53 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Null_merge?= Message-ID: <20160603215353.26844.68100.0DBDABAD@psf.io> https://hg.python.org/cpython/rev/37975d542715 changeset: 101665:37975d542715 parent: 101664:c21bf38a9d07 parent: 101659:d085b4f779af user: Serhiy Storchaka date: Sat Jun 04 00:53:32 2016 +0300 summary: Null merge files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 18:21:29 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 03 Jun 2016 22:21:29 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_first_step_in_?= =?utf-8?q?backout_of_bad_default-=3E3=2E5_merge_d085b4f779af=2E__Create_n?= =?utf-8?q?ew_head?= Message-ID: <20160603222128.3175.95888.4E769FE5@psf.io> https://hg.python.org/cpython/rev/48469527e407 changeset: 101666:48469527e407 branch: 3.5 parent: 101658:aed4b9981fca user: Ned Deily date: Fri Jun 03 15:17:13 2016 -0700 summary: first step in backout of bad default->3.5 merge d085b4f779af. Create new head and fix whitespace. files: Lib/test/test_warnings/data/import_warning.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_warnings/data/import_warning.py b/Lib/test/test_warnings/data/import_warning.py --- a/Lib/test/test_warnings/data/import_warning.py +++ b/Lib/test/test_warnings/data/import_warning.py @@ -1,3 +1,3 @@ import warnings -warnings.warn('module-level warning', DeprecationWarning, stacklevel=2) \ No newline at end of file +warnings.warn('module-level warning', DeprecationWarning, stacklevel=2) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 18:21:40 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 03 Jun 2016 22:21:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNSk6?= =?utf-8?q?_final_step_in_backout_of_bad_default-=3E3=2E5_merge_d085b4f779?= =?utf-8?q?af=2E_merge_3=2E5_heads?= Message-ID: <20160603222130.79788.2692.8ADA00AC@psf.io> https://hg.python.org/cpython/rev/8f395bdff416 changeset: 101667:8f395bdff416 branch: 3.5 parent: 101666:48469527e407 parent: 101659:d085b4f779af user: Ned Deily date: Fri Jun 03 15:20:13 2016 -0700 summary: final step in backout of bad default->3.5 merge d085b4f779af. merge 3.5 heads files: -- Repository URL: https://hg.python.org/cpython From rdmurray at bitdance.com Fri Jun 3 18:29:03 2016 From: rdmurray at bitdance.com (R. David Murray) Date: Fri, 03 Jun 2016 18:29:03 -0400 Subject: [Python-checkins] [Python-Dev] FIXED: I broke the 3.5 branch, apparently In-Reply-To: <5e613f77-0f91-1c14-e4dc-39dbfb1cdd4f@mrabarnett.plus.com> References: <20160603215031.E2C37B14024@webabinitio.net> <5e613f77-0f91-1c14-e4dc-39dbfb1cdd4f@mrabarnett.plus.com> Message-ID: <20160603222904.960CFB14024@webabinitio.net> On Fri, 03 Jun 2016 23:21:25 +0100, MRAB wrote: > On 2016-06-03 22:50, R. David Murray wrote: > > I don't understand how it happened, but apparently I got a merge commit > > backward and merged 3.6 into 3.5 and pushed it without realizing what > > had happened. If anyone has any clue how to reverse this cleanly, > > please let me know. (There are a couple people at the sprints looking > > in to it, but the mercurial guys aren't here so we are short on experts). > > > > My apologies for the mess :( > > > There's a lot about undoing changes here: > > http://hgbook.red-bean.com/read/finding-and-fixing-mistakes.html Ned Deily has fixed the problem. --David From python-checkins at python.org Fri Jun 3 18:45:01 2016 From: python-checkins at python.org (brett.cannon) Date: Fri, 03 Jun 2016 22:45:01 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Add_a_=2Egitignore_in_prepara?= =?utf-8?q?tion_for_moving_to_GitHub?= Message-ID: <20160603224501.15129.45106.4D2B92EF@psf.io> https://hg.python.org/peps/rev/cb333e7f1507 changeset: 6349:cb333e7f1507 user: Brett Cannon date: Fri Jun 03 15:44:32 2016 -0700 summary: Add a .gitignore in preparation for moving to GitHub files: .gitignore | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/.gitignore b/.gitignore new file mode 100644 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +pep-0000.txt +pep-????.html +__pycache__ +*.pyc +*.pyo +*~ +*env -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Fri Jun 3 19:24:04 2016 From: python-checkins at python.org (ned.deily) Date: Fri, 03 Jun 2016 23:24:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_final_final_step_in_backout_of_bad_default-=3E3=2E5_merg?= =?utf-8?q?e_d085b4f779af=3A_null_merge?= Message-ID: <20160603232401.79494.61853.4391BE79@psf.io> https://hg.python.org/cpython/rev/dfb61cd916e3 changeset: 101668:dfb61cd916e3 parent: 101665:37975d542715 parent: 101667:8f395bdff416 user: Ned Deily date: Fri Jun 03 16:22:33 2016 -0700 summary: final final step in backout of bad default->3.5 merge d085b4f779af: null merge 3.5->default files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 19:29:55 2016 From: python-checkins at python.org (r.david.murray) Date: Fri, 03 Jun 2016 23:29:55 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogIzE2NDg0OiBGaXgg?= =?utf-8?q?pydoc_doc_links_to_modules_whose_names_are_mixed_case=2E?= Message-ID: <20160603232955.13742.32624.39A8EABD@psf.io> https://hg.python.org/cpython/rev/64e7c8531131 changeset: 101669:64e7c8531131 branch: 3.5 parent: 101667:8f395bdff416 user: R David Murray date: Fri Jun 03 19:28:35 2016 -0400 summary: #16484: Fix pydoc doc links to modules whose names are mixed case. Patch by Sean Rodman, test by Kaushik N. files: Lib/pydoc.py | 12 ++++++------ Lib/test/test_pydoc.py | 14 ++++++++++++++ Misc/ACKS | 1 + 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Lib/pydoc.py b/Lib/pydoc.py --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -354,7 +354,7 @@ class Doc: PYTHONDOCS = os.environ.get("PYTHONDOCS", - "http://docs.python.org/%d.%d/library" + "https://docs.python.org/%d.%d/library" % sys.version_info[:2]) def document(self, object, name=None, *args): @@ -383,7 +383,9 @@ docmodule = docclass = docroutine = docother = docproperty = docdata = fail - def getdocloc(self, object): + def getdocloc(self, object, + basedir=os.path.join(sys.base_exec_prefix, "lib", + "python%d.%d" % sys.version_info[:2])): """Return the location of module docs or None""" try: @@ -393,8 +395,6 @@ docloc = os.environ.get("PYTHONDOCS", self.PYTHONDOCS) - basedir = os.path.join(sys.base_exec_prefix, "lib", - "python%d.%d" % sys.version_info[:2]) if (isinstance(object, type(os)) and (object.__name__ in ('errno', 'exceptions', 'gc', 'imp', 'marshal', 'posix', 'signal', 'sys', @@ -403,9 +403,9 @@ not file.startswith(os.path.join(basedir, 'site-packages')))) and object.__name__ not in ('xml.etree', 'test.pydoc_mod')): if docloc.startswith("http://"): - docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__) + docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__.lower()) else: - docloc = os.path.join(docloc, object.__name__ + ".html") + docloc = os.path.join(docloc, object.__name__.lower() + ".html") else: docloc = None return docloc diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -18,6 +18,7 @@ import unittest import urllib.parse import xml.etree +import xml.etree.ElementTree import textwrap from io import StringIO from collections import namedtuple @@ -352,6 +353,14 @@ loc = "
Module Docs" return output.strip(), loc +def get_pydoc_link(module): + "Returns a documentation web link of a module" + dirname = os.path.dirname + basedir = os.path.join(dirname(dirname(__file__))) + doc = pydoc.TextDoc() + loc = doc.getdocloc(module, basedir=basedir) + return loc + def get_pydoc_text(module): "Returns pydoc generated output as text" doc = pydoc.TextDoc() @@ -443,6 +452,11 @@ doc = pydoc.render_doc(BinaryInteger) self.assertIn('', doc) + def test_mixed_case_module_names_are_lower_cased(self): + # issue16484 + doc_link = get_pydoc_link(xml.etree.ElementTree) + self.assertIn('xml.etree.elementtree', doc_link) + def test_issue8225(self): # Test issue8225 to ensure no doc link appears for xml.etree result, doc_loc = get_pydoc_text(xml.etree) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1018,6 +1018,7 @@ R. David Murray Matti M?ki J?rg M?ller +Kaushik N Dale Nagata John Nagle Takahiro Nakayama -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 19:29:58 2016 From: python-checkins at python.org (r.david.murray) Date: Fri, 03 Jun 2016 23:29:58 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge=3A_=2316484=3A_Fix_pydoc_doc_links_to_modules_whos?= =?utf-8?q?e_names_are_mixed_case=2E?= Message-ID: <20160603232955.13617.64757.4E8CB576@psf.io> https://hg.python.org/cpython/rev/912b9aad0b45 changeset: 101670:912b9aad0b45 parent: 101668:dfb61cd916e3 parent: 101669:64e7c8531131 user: R David Murray date: Fri Jun 03 19:29:18 2016 -0400 summary: Merge: #16484: Fix pydoc doc links to modules whose names are mixed case. files: Lib/pydoc.py | 12 ++++++------ Lib/test/test_pydoc.py | 14 ++++++++++++++ Misc/ACKS | 1 + 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Lib/pydoc.py b/Lib/pydoc.py --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -366,7 +366,7 @@ class Doc: PYTHONDOCS = os.environ.get("PYTHONDOCS", - "http://docs.python.org/%d.%d/library" + "https://docs.python.org/%d.%d/library" % sys.version_info[:2]) def document(self, object, name=None, *args): @@ -395,7 +395,9 @@ docmodule = docclass = docroutine = docother = docproperty = docdata = fail - def getdocloc(self, object): + def getdocloc(self, object, + basedir=os.path.join(sys.base_exec_prefix, "lib", + "python%d.%d" % sys.version_info[:2])): """Return the location of module docs or None""" try: @@ -405,8 +407,6 @@ docloc = os.environ.get("PYTHONDOCS", self.PYTHONDOCS) - basedir = os.path.join(sys.base_exec_prefix, "lib", - "python%d.%d" % sys.version_info[:2]) if (isinstance(object, type(os)) and (object.__name__ in ('errno', 'exceptions', 'gc', 'imp', 'marshal', 'posix', 'signal', 'sys', @@ -415,9 +415,9 @@ not file.startswith(os.path.join(basedir, 'site-packages')))) and object.__name__ not in ('xml.etree', 'test.pydoc_mod')): if docloc.startswith("http://"): - docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__) + docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__.lower()) else: - docloc = os.path.join(docloc, object.__name__ + ".html") + docloc = os.path.join(docloc, object.__name__.lower() + ".html") else: docloc = None return docloc diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -18,6 +18,7 @@ import unittest import urllib.parse import xml.etree +import xml.etree.ElementTree import textwrap from io import StringIO from collections import namedtuple @@ -352,6 +353,14 @@ loc = "
Module Docs" return output.strip(), loc +def get_pydoc_link(module): + "Returns a documentation web link of a module" + dirname = os.path.dirname + basedir = os.path.join(dirname(dirname(__file__))) + doc = pydoc.TextDoc() + loc = doc.getdocloc(module, basedir=basedir) + return loc + def get_pydoc_text(module): "Returns pydoc generated output as text" doc = pydoc.TextDoc() @@ -443,6 +452,11 @@ doc = pydoc.render_doc(BinaryInteger) self.assertIn('', doc) + def test_mixed_case_module_names_are_lower_cased(self): + # issue16484 + doc_link = get_pydoc_link(xml.etree.ElementTree) + self.assertIn('xml.etree.elementtree', doc_link) + def test_issue8225(self): # Test issue8225 to ensure no doc link appears for xml.etree result, doc_loc = get_pydoc_text(xml.etree) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1026,6 +1026,7 @@ R. David Murray Matti M?ki J?rg M?ller +Kaushik N Dale Nagata John Nagle Takahiro Nakayama -- Repository URL: https://hg.python.org/cpython From tjreedy at udel.edu Fri Jun 3 19:10:07 2016 From: tjreedy at udel.edu (Terry Reedy) Date: Fri, 03 Jun 2016 19:10:07 -0400 Subject: [Python-checkins] cpython (merge 3.5 -> 3.5): final step in backout of bad default->3.5 merge d085b4f779af. merge 3.5 heads In-Reply-To: <20160603222130.79788.2692.8ADA00AC@psf.io> References: <20160603222130.79788.2692.8ADA00AC@psf.io> Message-ID: <95dda924-4eef-43f7-ade8-ab1ae340db67@udel.edu> On 6/3/2016 6:21 PM, ned.deily wrote: > https://hg.python.org/cpython/rev/8f395bdff416 > changeset: 101667:8f395bdff416 > branch: 3.5 > parent: 101666:48469527e407 > parent: 101659:d085b4f779af > user: Ned Deily > date: Fri Jun 03 15:20:13 2016 -0700 > summary: > final step in backout of bad default->3.5 merge d085b4f779af. merge 3.5 heads As near as I can tell, this head merge within 3.5 still needs to be merged into default. From tjreedy at udel.edu Fri Jun 3 19:12:36 2016 From: tjreedy at udel.edu (Terry Reedy) Date: Fri, 03 Jun 2016 19:12:36 -0400 Subject: [Python-checkins] [Python-Dev] FIXED: I broke the 3.5 branch, apparently In-Reply-To: <20160603222904.960CFB14024@webabinitio.net> References: <20160603215031.E2C37B14024@webabinitio.net> <5e613f77-0f91-1c14-e4dc-39dbfb1cdd4f@mrabarnett.plus.com> <20160603222904.960CFB14024@webabinitio.net> Message-ID: <6f440801-3e6a-d97d-51ca-90be7861c42f@udel.edu> On 6/3/2016 6:29 PM, R. David Murray wrote: > On Fri, 03 Jun 2016 23:21:25 +0100, MRAB wrote: >> On 2016-06-03 22:50, R. David Murray wrote: >>> I don't understand how it happened, but apparently I got a merge commit >>> backward and merged 3.6 into 3.5 and pushed it without realizing what >>> had happened. If anyone has any clue how to reverse this cleanly, >>> please let me know. (There are a couple people at the sprints looking >>> in to it, but the mercurial guys aren't here so we are short on experts). >>> >>> My apologies for the mess :( >>> >> There's a lot about undoing changes here: >> >> http://hgbook.red-bean.com/read/finding-and-fixing-mistakes.html > > Ned Deily has fixed the problem. I don't think so. There is still a merge needed, plus someone committed something that deleted most of idlelib and some other files and changed 100s of others. I am still trying to figure out what is what for idlelib. From python-checkins at python.org Fri Jun 3 20:18:21 2016 From: python-checkins at python.org (r.david.murray) Date: Sat, 04 Jun 2016 00:18:21 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Clean_up_urlopen_doc_strin?= =?utf-8?q?g=2E?= Message-ID: <20160604001820.13518.63514.08F435BD@psf.io> https://hg.python.org/cpython/rev/b4df20312b78 changeset: 101671:b4df20312b78 user: R David Murray date: Fri Jun 03 20:16:06 2016 -0400 summary: Clean up urlopen doc string. Clarifies what is returned when and that the methods are common between the two. Patch by Alexander Liu as part of #22797. files: Lib/urllib/request.py | 12 ++++++------ Misc/ACKS | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -173,12 +173,7 @@ The *cadefault* parameter is ignored. For http and https urls, this function returns a http.client.HTTPResponse - object which has the following HTTPResponse Objects methods. - - For ftp, file, and data urls and requests explicitly handled by legacy - URLopener and FancyURLopener classes, this function returns a - urllib.response.addinfourl object which can work as context manager and has - methods such as: + object which has the following HTTPResponse Objects methods: * geturl() - return the URL of the resource retrieved, commonly used to determine if a redirect was followed @@ -190,6 +185,11 @@ * getcode() - return the HTTP status code of the response. Raises URLError on errors. + For ftp, file, and data urls and requests explicitly handled by legacy + URLopener and FancyURLopener classes, this function returns a + urllib.response.addinfourl object which can work as context manager and + also support the geturl(), info(), getcode() methods listed above. + Note that *None& may be returned if no handler handles the request (though the default installed global OpenerDirector uses UnknownHandler to ensure this never happens). diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -884,6 +884,7 @@ Gregor Lingl Everett Lipman Mirko Liss +Alexander Liu Nick Lockwood Stephanie Lockwood Martin von L?wis -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 20:34:25 2016 From: python-checkins at python.org (gregory.p.smith) Date: Sat, 04 Jun 2016 00:34:25 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Fixes_Issue_?= =?utf-8?q?=2326373=3A_subprocess=2EPopen=2Ecommunicate_now_correctly_igno?= =?utf-8?q?res?= Message-ID: <20160604003425.21244.18705.FD0C7B26@psf.io> https://hg.python.org/cpython/rev/883cfb3e28f9 changeset: 101672:883cfb3e28f9 branch: 3.5 parent: 101669:64e7c8531131 user: Gregory P. Smith [Google Inc.] date: Sat Jun 04 00:22:17 2016 +0000 summary: Fixes Issue #26373: subprocess.Popen.communicate now correctly ignores BrokenPipeError when the child process dies before .communicate() is called in more (all?) circumstances. files: Lib/subprocess.py | 23 +++++++++-- Lib/test/test_subprocess.py | 47 +++++++++++++++++++++++++ Misc/NEWS | 4 ++ 3 files changed, 69 insertions(+), 5 deletions(-) diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -1011,8 +1011,7 @@ try: self.stdin.write(input) except BrokenPipeError: - # communicate() must ignore broken pipe error - pass + pass # communicate() must ignore broken pipe errors. except OSError as e: if e.errno == errno.EINVAL and self.poll() is not None: # Issue #19612: On Windows, stdin.write() fails with EINVAL @@ -1020,7 +1019,15 @@ pass else: raise - self.stdin.close() + try: + self.stdin.close() + except BrokenPipeError: + pass # communicate() must ignore broken pipe errors. + except OSError as e: + if e.errno == errno.EINVAL and self.poll() is not None: + pass + else: + raise def communicate(self, input=None, timeout=None): """Interact with process: Send data to stdin. Read data from @@ -1661,9 +1668,15 @@ if self.stdin and not self._communication_started: # Flush stdio buffer. This might block, if the user has # been writing to .stdin in an uncontrolled fashion. - self.stdin.flush() + try: + self.stdin.flush() + except BrokenPipeError: + pass # communicate() must ignore BrokenPipeError. if not input: - self.stdin.close() + try: + self.stdin.close() + except BrokenPipeError: + pass # communicate() must ignore BrokenPipeError. stdout = None stderr = None 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 @@ -1,4 +1,5 @@ import unittest +from unittest import mock from test.support import script_helper from test import support import subprocess @@ -1240,6 +1241,52 @@ fds_after_exception = os.listdir(fd_directory) self.assertEqual(fds_before_popen, fds_after_exception) + def test_communicate_BrokenPipeError_stdin_close(self): + # By not setting stdout or stderr or a timeout we force the fast path + # that just calls _stdin_write() internally due to our mock. + proc = subprocess.Popen([sys.executable, '-c', 'pass']) + with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin: + mock_proc_stdin.close.side_effect = BrokenPipeError + proc.communicate() # Should swallow BrokenPipeError from close. + mock_proc_stdin.close.assert_called_with() + + def test_communicate_BrokenPipeError_stdin_write(self): + # By not setting stdout or stderr or a timeout we force the fast path + # that just calls _stdin_write() internally due to our mock. + proc = subprocess.Popen([sys.executable, '-c', 'pass']) + with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin: + mock_proc_stdin.write.side_effect = BrokenPipeError + proc.communicate(b'stuff') # Should swallow the BrokenPipeError. + mock_proc_stdin.write.assert_called_once_with(b'stuff') + mock_proc_stdin.close.assert_called_once_with() + + def test_communicate_BrokenPipeError_stdin_flush(self): + # Setting stdin and stdout forces the ._communicate() code path. + # python -h exits faster than python -c pass (but spams stdout). + proc = subprocess.Popen([sys.executable, '-h'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE) + with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin, \ + open('/dev/null', 'wb') as dev_null: + mock_proc_stdin.flush.side_effect = BrokenPipeError + # because _communicate registers a selector using proc.stdin... + mock_proc_stdin.fileno.return_value = dev_null.fileno() + # _communicate() should swallow BrokenPipeError from flush. + proc.communicate(b'stuff') + mock_proc_stdin.flush.assert_called_once_with() + + def test_communicate_BrokenPipeError_stdin_close_with_timeout(self): + # Setting stdin and stdout forces the ._communicate() code path. + # python -h exits faster than python -c pass (but spams stdout). + proc = subprocess.Popen([sys.executable, '-h'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE) + with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin: + mock_proc_stdin.close.side_effect = BrokenPipeError + # _communicate() should swallow BrokenPipeError from close. + proc.communicate(timeout=999) + mock_proc_stdin.close.assert_called_once_with() + class RunFuncTestCase(BaseTestCase): def run_python(self, code, **kwargs): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -128,6 +128,10 @@ Library ------- +- Issue #26373: subprocess.Popen.communicate now correctly ignores + BrokenPipeError when the child process dies before .communicate() + is called in more/all circumstances. + - Issue #21776: distutils.upload now correctly handles HTTPError. Initial patch by Claudiu Popa. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 20:34:26 2016 From: python-checkins at python.org (gregory.p.smith) Date: Sat, 04 Jun 2016 00:34:26 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_merge_from_3=2E5_-_Fixes_Issue_=2326373=3A_subprocess=2E?= =?utf-8?q?Popen=2Ecommunicate?= Message-ID: <20160604003425.1363.52727.86190433@psf.io> https://hg.python.org/cpython/rev/78e81de6d447 changeset: 101673:78e81de6d447 parent: 101671:b4df20312b78 parent: 101672:883cfb3e28f9 user: Gregory P. Smith [Google Inc.] date: Sat Jun 04 00:34:15 2016 +0000 summary: merge from 3.5 - Fixes Issue #26373: subprocess.Popen.communicate now correctly ignores BrokenPipeError when the child process dies before .communicate() is called in more (all?) circumstances. files: Lib/subprocess.py | 23 +++++++++-- Lib/test/test_subprocess.py | 47 +++++++++++++++++++++++++ Misc/NEWS | 4 ++ 3 files changed, 69 insertions(+), 5 deletions(-) diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -1036,8 +1036,7 @@ try: self.stdin.write(input) except BrokenPipeError: - # communicate() must ignore broken pipe error - pass + pass # communicate() must ignore broken pipe errors. except OSError as e: if e.errno == errno.EINVAL and self.poll() is not None: # Issue #19612: On Windows, stdin.write() fails with EINVAL @@ -1045,7 +1044,15 @@ pass else: raise - self.stdin.close() + try: + self.stdin.close() + except BrokenPipeError: + pass # communicate() must ignore broken pipe errors. + except OSError as e: + if e.errno == errno.EINVAL and self.poll() is not None: + pass + else: + raise def communicate(self, input=None, timeout=None): """Interact with process: Send data to stdin. Read data from @@ -1691,9 +1698,15 @@ if self.stdin and not self._communication_started: # Flush stdio buffer. This might block, if the user has # been writing to .stdin in an uncontrolled fashion. - self.stdin.flush() + try: + self.stdin.flush() + except BrokenPipeError: + pass # communicate() must ignore BrokenPipeError. if not input: - self.stdin.close() + try: + self.stdin.close() + except BrokenPipeError: + pass # communicate() must ignore BrokenPipeError. stdout = None stderr = None 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 @@ -1,4 +1,5 @@ import unittest +from unittest import mock from test import support import subprocess import sys @@ -1237,6 +1238,52 @@ fds_after_exception = os.listdir(fd_directory) self.assertEqual(fds_before_popen, fds_after_exception) + def test_communicate_BrokenPipeError_stdin_close(self): + # By not setting stdout or stderr or a timeout we force the fast path + # that just calls _stdin_write() internally due to our mock. + proc = subprocess.Popen([sys.executable, '-c', 'pass']) + with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin: + mock_proc_stdin.close.side_effect = BrokenPipeError + proc.communicate() # Should swallow BrokenPipeError from close. + mock_proc_stdin.close.assert_called_with() + + def test_communicate_BrokenPipeError_stdin_write(self): + # By not setting stdout or stderr or a timeout we force the fast path + # that just calls _stdin_write() internally due to our mock. + proc = subprocess.Popen([sys.executable, '-c', 'pass']) + with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin: + mock_proc_stdin.write.side_effect = BrokenPipeError + proc.communicate(b'stuff') # Should swallow the BrokenPipeError. + mock_proc_stdin.write.assert_called_once_with(b'stuff') + mock_proc_stdin.close.assert_called_once_with() + + def test_communicate_BrokenPipeError_stdin_flush(self): + # Setting stdin and stdout forces the ._communicate() code path. + # python -h exits faster than python -c pass (but spams stdout). + proc = subprocess.Popen([sys.executable, '-h'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE) + with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin, \ + open('/dev/null', 'wb') as dev_null: + mock_proc_stdin.flush.side_effect = BrokenPipeError + # because _communicate registers a selector using proc.stdin... + mock_proc_stdin.fileno.return_value = dev_null.fileno() + # _communicate() should swallow BrokenPipeError from flush. + proc.communicate(b'stuff') + mock_proc_stdin.flush.assert_called_once_with() + + def test_communicate_BrokenPipeError_stdin_close_with_timeout(self): + # Setting stdin and stdout forces the ._communicate() code path. + # python -h exits faster than python -c pass (but spams stdout). + proc = subprocess.Popen([sys.executable, '-h'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE) + with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin: + mock_proc_stdin.close.side_effect = BrokenPipeError + # _communicate() should swallow BrokenPipeError from close. + proc.communicate(timeout=999) + mock_proc_stdin.close.assert_called_once_with() + class RunFuncTestCase(BaseTestCase): def run_python(self, code, **kwargs): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,10 @@ Library ------- +- Issue #26373: subprocess.Popen.communicate now correctly ignores + BrokenPipeError when the child process dies before .communicate() + is called in more/all circumstances. + - signal, socket, and ssl module IntEnum constant name lookups now return a consistent name for values having multiple names. Ex: signal.Signals(6) now refers to itself as signal.SIGALRM rather than flipping between that -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 20:51:15 2016 From: python-checkins at python.org (ned.deily) Date: Sat, 04 Jun 2016 00:51:15 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2324225=3A_Fix_addi?= =?utf-8?q?tional_renamed_module_references=2E?= Message-ID: <20160604005115.52309.86203.4179CF9F@psf.io> https://hg.python.org/cpython/rev/5dcc52d6829f changeset: 101674:5dcc52d6829f user: Ned Deily date: Fri Jun 03 17:50:44 2016 -0700 summary: Issue #24225: Fix additional renamed module references. files: Lib/idlelib/macosx.py | 2 +- Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py | 2 +- Tools/scripts/idle3 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py --- a/Lib/idlelib/macosx.py +++ b/Lib/idlelib/macosx.py @@ -155,7 +155,7 @@ if end > 0: menu.delete(0, end) windows.add_windows_to_menu(menu) - Windows.register_callback(postwindowsmenu) + windows.register_callback(postwindowsmenu) def about_dialog(event=None): "Handle Help 'About IDLE' event." diff --git a/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py b/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py --- a/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py +++ b/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py @@ -70,6 +70,6 @@ # Now it is safe to import idlelib. from idlelib import macosxSupport macosxSupport._appbundle = True -from idlelib.PyShell import main +from idlelib.pyshell import main if __name__ == '__main__': main() diff --git a/Tools/scripts/idle3 b/Tools/scripts/idle3 --- a/Tools/scripts/idle3 +++ b/Tools/scripts/idle3 @@ -1,5 +1,5 @@ #! /usr/bin/env python3 -from idlelib.PyShell import main +from idlelib.pyshell import main if __name__ == '__main__': main() -- Repository URL: https://hg.python.org/cpython From tjreedy at udel.edu Fri Jun 3 21:42:24 2016 From: tjreedy at udel.edu (Terry Reedy) Date: Fri, 03 Jun 2016 21:42:24 -0400 Subject: [Python-checkins] [Python-Dev] FIXED: I broke the 3.5 branch, apparently In-Reply-To: <6f440801-3e6a-d97d-51ca-90be7861c42f@udel.edu> References: <20160603215031.E2C37B14024@webabinitio.net> <5e613f77-0f91-1c14-e4dc-39dbfb1cdd4f@mrabarnett.plus.com> <20160603222904.960CFB14024@webabinitio.net> <6f440801-3e6a-d97d-51ca-90be7861c42f@udel.edu> Message-ID: <4b9c07b9-06dc-ee97-4f0f-94a837a3da93@udel.edu> On 6/3/2016 7:12 PM, Terry Reedy wrote: > There is still a merge needed, done > something that deleted most of idlelib and some other files and changed > 100s of others. I am still trying to figure out what is what for idlelib. It appears that the only thing that got a bit messed up were pending changes in my 3.5 working directory, but I had saved a diff, so I reverted and applied the diff. From python-checkins at python.org Fri Jun 3 22:28:21 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 04 Jun 2016 02:28:21 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_20567=3A_Revise_idle=5Ftest/README=2Etxt_and_some_?= =?utf-8?q?tests_to_match_new_advice=2E?= Message-ID: <20160604022821.23569.1085.B27E8D6D@psf.io> https://hg.python.org/cpython/rev/d8e5e3da4d57 changeset: 101676:d8e5e3da4d57 parent: 101674:5dcc52d6829f parent: 101675:813bb6a4c693 user: Terry Jan Reedy date: Fri Jun 03 22:28:05 2016 -0400 summary: Issue 20567: Revise idle_test/README.txt and some tests to match new advice. files: Lib/idlelib/idle_test/README.txt | 28 +++++---- Lib/idlelib/idle_test/test_autocomplete.py | 3 +- Lib/idlelib/idle_test/test_autoexpand.py | 2 +- Lib/idlelib/idle_test/test_paragraph.py | 3 +- Lib/idlelib/idle_test/test_percolator.py | 4 +- Lib/idlelib/idle_test/test_redirector.py | 24 ++++---- Lib/idlelib/idle_test/test_replace.py | 3 +- Lib/idlelib/idle_test/test_textview.py | 3 +- Lib/idlelib/idle_test/test_undo.py | 3 +- 9 files changed, 39 insertions(+), 34 deletions(-) diff --git a/Lib/idlelib/idle_test/README.txt b/Lib/idlelib/idle_test/README.txt --- a/Lib/idlelib/idle_test/README.txt +++ b/Lib/idlelib/idle_test/README.txt @@ -56,40 +56,44 @@ To guard a test class, put "requires('gui')" in its setUpClass function. -To avoid interfering with other GUI tests, all GUI objects must be -destroyed and deleted by the end of the test. Widgets, such as a Tk -root, created in a setUpX function, should be destroyed in the -corresponding tearDownX. Module and class widget attributes should also -be deleted. +To avoid interfering with other gui tests, all gui objects must be destroyed and +deleted by the end of the test. The Tk root created in a setUpX function should +be destroyed in the corresponding tearDownX and the module or class attribute +deleted. Others widgets should descend from the single root and the attributes +deleted BEFORE root is destroyed. See https://bugs.python.org/issue20567. @classmethod def setUpClass(cls): requires('gui') cls.root = tk.Tk() + cls.text = tk.Text(root) @classmethod def tearDownClass(cls): + del cls.text cls.root.destroy() del cls.root Requires('gui') causes the test(s) it guards to be skipped if any of -a few conditions are met: - +these conditions are met: + - The tests are being run by regrtest.py, and it was started without enabling the "gui" resource with the "-u" command line option. - + - The tests are being run on Windows by a service that is not allowed to interact with the graphical environment. - + + - The tests are being run on Linux and X Windows is not available. + - The tests are being run on Mac OSX in a process that cannot make a window manager connection. - + - tkinter.Tk cannot be successfully instantiated for some reason. - + - test.support.use_resources has been set by something other than regrtest.py and does not contain "gui". - + Tests of non-GUI operations should avoid creating tk widgets. Incidental uses of tk variables and messageboxes can be replaced by the mock classes in idle_test/mock_tk.py. The mock text handles some uses of the diff --git a/Lib/idlelib/idle_test/test_autocomplete.py b/Lib/idlelib/idle_test/test_autocomplete.py --- a/Lib/idlelib/idle_test/test_autocomplete.py +++ b/Lib/idlelib/idle_test/test_autocomplete.py @@ -33,9 +33,8 @@ @classmethod def tearDownClass(cls): + del cls.editor, cls.text cls.root.destroy() - del cls.text - del cls.editor del cls.root def setUp(self): diff --git a/Lib/idlelib/idle_test/test_autoexpand.py b/Lib/idlelib/idle_test/test_autoexpand.py --- a/Lib/idlelib/idle_test/test_autoexpand.py +++ b/Lib/idlelib/idle_test/test_autoexpand.py @@ -25,10 +25,10 @@ @classmethod def tearDownClass(cls): + del cls.text, cls.auto_expand if hasattr(cls, 'tk'): cls.tk.destroy() del cls.tk - del cls.text, cls.auto_expand def tearDown(self): self.text.delete('1.0', 'end') diff --git a/Lib/idlelib/idle_test/test_paragraph.py b/Lib/idlelib/idle_test/test_paragraph.py --- a/Lib/idlelib/idle_test/test_paragraph.py +++ b/Lib/idlelib/idle_test/test_paragraph.py @@ -276,10 +276,9 @@ @classmethod def tearDownClass(cls): + del cls.text, cls.formatter cls.root.destroy() del cls.root - del cls.text - del cls.formatter def test_short_line(self): self.text.insert('1.0', "Short line\n") diff --git a/Lib/idlelib/idle_test/test_percolator.py b/Lib/idlelib/idle_test/test_percolator.py --- a/Lib/idlelib/idle_test/test_percolator.py +++ b/Lib/idlelib/idle_test/test_percolator.py @@ -40,9 +40,9 @@ @classmethod def tearDownClass(cls): - cls.text.destroy() + del cls.text cls.root.destroy() - del cls.text, cls.root + del cls.root def setUp(self): self.percolator = Percolator(self.text) diff --git a/Lib/idlelib/idle_test/test_redirector.py b/Lib/idlelib/idle_test/test_redirector.py --- a/Lib/idlelib/idle_test/test_redirector.py +++ b/Lib/idlelib/idle_test/test_redirector.py @@ -14,14 +14,14 @@ @classmethod def setUpClass(cls): requires('gui') - cls.tk = Tk() - cls.text = Text(cls.tk) + cls.root = Tk() + cls.text = Text(cls.root) @classmethod def tearDownClass(cls): - cls.text.destroy() - cls.tk.destroy() - del cls.text, cls.tk + del cls.text + cls.root.destroy() + del cls.root def test_init(self): redir = WidgetRedirector(self.text) @@ -43,14 +43,15 @@ @classmethod def setUpClass(cls): requires('gui') - cls.tk = Tk() - cls.text = Text(cls.tk) + cls.root = Tk() + cls.text = Text(cls.root) @classmethod def tearDownClass(cls): cls.text.destroy() - cls.tk.destroy() - del cls.text, cls.tk + del cls.text + cls.root.destroy() + del cls.root def setUp(self): self.redir = WidgetRedirector(self.text) @@ -108,14 +109,13 @@ def test_command_dispatch(self): # Test that .__init__ causes redirection of tk calls # through redir.dispatch - self.tk.call(self.text._w, 'insert', 'hello') + self.root.call(self.text._w, 'insert', 'hello') self.assertEqual(self.func.args, ('hello',)) self.assertEqual(self.text.get('1.0', 'end'), '\n') # Ensure that called through redir .dispatch and not through # self.text.insert by having mock raise TclError. self.func.__init__(TclError()) - self.assertEqual(self.tk.call(self.text._w, 'insert', 'boo'), '') - + self.assertEqual(self.root.call(self.text._w, 'insert', 'boo'), '') if __name__ == '__main__': diff --git a/Lib/idlelib/idle_test/test_replace.py b/Lib/idlelib/idle_test/test_replace.py --- a/Lib/idlelib/idle_test/test_replace.py +++ b/Lib/idlelib/idle_test/test_replace.py @@ -31,8 +31,9 @@ @classmethod def tearDownClass(cls): se.tkMessageBox = orig_mbox + del cls.text, cls.dialog, cls.engine cls.root.destroy() - del cls.text, cls.dialog, cls.engine, cls.root + del cls.root def setUp(self): self.text.insert('insert', 'This is a sample sTring') diff --git a/Lib/idlelib/idle_test/test_textview.py b/Lib/idlelib/idle_test/test_textview.py --- a/Lib/idlelib/idle_test/test_textview.py +++ b/Lib/idlelib/idle_test/test_textview.py @@ -22,7 +22,8 @@ root = Tk() def tearDownModule(): - global root + global root, TV + del TV root.destroy() # pyflakes falsely sees root as undefined del root diff --git a/Lib/idlelib/idle_test/test_undo.py b/Lib/idlelib/idle_test/test_undo.py --- a/Lib/idlelib/idle_test/test_undo.py +++ b/Lib/idlelib/idle_test/test_undo.py @@ -23,8 +23,9 @@ @classmethod def tearDownClass(cls): cls.percolator.redir.close() + del cls.percolator, cls.text cls.root.destroy() - del cls.percolator, cls.text, cls.root + del cls.root def setUp(self): self.delegator = UndoDelegator() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 22:28:22 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 04 Jun 2016 02:28:22 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgMjA1Njc6?= =?utf-8?q?_Revise_idle=5Ftest/README=2Etxt_and_some_tests_to_match_new_ad?= =?utf-8?q?vice=2E?= Message-ID: <20160604022821.1153.7579.656E162B@psf.io> https://hg.python.org/cpython/rev/813bb6a4c693 changeset: 101675:813bb6a4c693 branch: 3.5 parent: 101672:883cfb3e28f9 user: Terry Jan Reedy date: Fri Jun 03 22:19:17 2016 -0400 summary: Issue 20567: Revise idle_test/README.txt and some tests to match new advice. files: Lib/idlelib/idle_test/README.txt | 28 +++++---- Lib/idlelib/idle_test/test_autocomplete.py | 3 +- Lib/idlelib/idle_test/test_autoexpand.py | 2 +- Lib/idlelib/idle_test/test_formatparagraph.py | 3 +- Lib/idlelib/idle_test/test_percolator.py | 4 +- Lib/idlelib/idle_test/test_replacedialog.py | 3 +- Lib/idlelib/idle_test/test_textview.py | 3 +- Lib/idlelib/idle_test/test_undodelegator.py | 3 +- Lib/idlelib/idle_test/test_widgetredir.py | 24 ++++---- 9 files changed, 39 insertions(+), 34 deletions(-) diff --git a/Lib/idlelib/idle_test/README.txt b/Lib/idlelib/idle_test/README.txt --- a/Lib/idlelib/idle_test/README.txt +++ b/Lib/idlelib/idle_test/README.txt @@ -56,40 +56,44 @@ To guard a test class, put "requires('gui')" in its setUpClass function. -To avoid interfering with other GUI tests, all GUI objects must be -destroyed and deleted by the end of the test. Widgets, such as a Tk -root, created in a setUpX function, should be destroyed in the -corresponding tearDownX. Module and class widget attributes should also -be deleted. +To avoid interfering with other gui tests, all gui objects must be destroyed and +deleted by the end of the test. The Tk root created in a setUpX function should +be destroyed in the corresponding tearDownX and the module or class attribute +deleted. Others widgets should descend from the single root and the attributes +deleted BEFORE root is destroyed. See https://bugs.python.org/issue20567. @classmethod def setUpClass(cls): requires('gui') cls.root = tk.Tk() + cls.text = tk.Text(root) @classmethod def tearDownClass(cls): + del cls.text cls.root.destroy() del cls.root Requires('gui') causes the test(s) it guards to be skipped if any of -a few conditions are met: - +these conditions are met: + - The tests are being run by regrtest.py, and it was started without enabling the "gui" resource with the "-u" command line option. - + - The tests are being run on Windows by a service that is not allowed to interact with the graphical environment. - + + - The tests are being run on Linux and X Windows is not available. + - The tests are being run on Mac OSX in a process that cannot make a window manager connection. - + - tkinter.Tk cannot be successfully instantiated for some reason. - + - test.support.use_resources has been set by something other than regrtest.py and does not contain "gui". - + Tests of non-GUI operations should avoid creating tk widgets. Incidental uses of tk variables and messageboxes can be replaced by the mock classes in idle_test/mock_tk.py. The mock text handles some uses of the diff --git a/Lib/idlelib/idle_test/test_autocomplete.py b/Lib/idlelib/idle_test/test_autocomplete.py --- a/Lib/idlelib/idle_test/test_autocomplete.py +++ b/Lib/idlelib/idle_test/test_autocomplete.py @@ -33,9 +33,8 @@ @classmethod def tearDownClass(cls): + del cls.editor, cls.text cls.root.destroy() - del cls.text - del cls.editor del cls.root def setUp(self): diff --git a/Lib/idlelib/idle_test/test_autoexpand.py b/Lib/idlelib/idle_test/test_autoexpand.py --- a/Lib/idlelib/idle_test/test_autoexpand.py +++ b/Lib/idlelib/idle_test/test_autoexpand.py @@ -25,10 +25,10 @@ @classmethod def tearDownClass(cls): + del cls.text, cls.auto_expand if hasattr(cls, 'tk'): cls.tk.destroy() del cls.tk - del cls.text, cls.auto_expand def tearDown(self): self.text.delete('1.0', 'end') diff --git a/Lib/idlelib/idle_test/test_formatparagraph.py b/Lib/idlelib/idle_test/test_formatparagraph.py --- a/Lib/idlelib/idle_test/test_formatparagraph.py +++ b/Lib/idlelib/idle_test/test_formatparagraph.py @@ -276,10 +276,9 @@ @classmethod def tearDownClass(cls): + del cls.text, cls.formatter cls.root.destroy() del cls.root - del cls.text - del cls.formatter def test_short_line(self): self.text.insert('1.0', "Short line\n") diff --git a/Lib/idlelib/idle_test/test_percolator.py b/Lib/idlelib/idle_test/test_percolator.py --- a/Lib/idlelib/idle_test/test_percolator.py +++ b/Lib/idlelib/idle_test/test_percolator.py @@ -40,9 +40,9 @@ @classmethod def tearDownClass(cls): - cls.text.destroy() + del cls.text cls.root.destroy() - del cls.text, cls.root + del cls.root def setUp(self): self.percolator = Percolator(self.text) diff --git a/Lib/idlelib/idle_test/test_replacedialog.py b/Lib/idlelib/idle_test/test_replacedialog.py --- a/Lib/idlelib/idle_test/test_replacedialog.py +++ b/Lib/idlelib/idle_test/test_replacedialog.py @@ -31,8 +31,9 @@ @classmethod def tearDownClass(cls): se.tkMessageBox = orig_mbox + del cls.text, cls.dialog, cls.engine cls.root.destroy() - del cls.text, cls.dialog, cls.engine, cls.root + del cls.root def setUp(self): self.text.insert('insert', 'This is a sample sTring') diff --git a/Lib/idlelib/idle_test/test_textview.py b/Lib/idlelib/idle_test/test_textview.py --- a/Lib/idlelib/idle_test/test_textview.py +++ b/Lib/idlelib/idle_test/test_textview.py @@ -22,7 +22,8 @@ root = Tk() def tearDownModule(): - global root + global root, TV + del TV root.destroy() # pyflakes falsely sees root as undefined del root diff --git a/Lib/idlelib/idle_test/test_undodelegator.py b/Lib/idlelib/idle_test/test_undodelegator.py --- a/Lib/idlelib/idle_test/test_undodelegator.py +++ b/Lib/idlelib/idle_test/test_undodelegator.py @@ -23,8 +23,9 @@ @classmethod def tearDownClass(cls): cls.percolator.redir.close() + del cls.percolator, cls.text cls.root.destroy() - del cls.percolator, cls.text, cls.root + del cls.root def setUp(self): self.delegator = UndoDelegator() diff --git a/Lib/idlelib/idle_test/test_widgetredir.py b/Lib/idlelib/idle_test/test_widgetredir.py --- a/Lib/idlelib/idle_test/test_widgetredir.py +++ b/Lib/idlelib/idle_test/test_widgetredir.py @@ -14,14 +14,14 @@ @classmethod def setUpClass(cls): requires('gui') - cls.tk = Tk() - cls.text = Text(cls.tk) + cls.root = Tk() + cls.text = Text(cls.root) @classmethod def tearDownClass(cls): - cls.text.destroy() - cls.tk.destroy() - del cls.text, cls.tk + del cls.text + cls.root.destroy() + del cls.root def test_init(self): redir = WidgetRedirector(self.text) @@ -43,14 +43,14 @@ @classmethod def setUpClass(cls): requires('gui') - cls.tk = Tk() - cls.text = Text(cls.tk) + cls.root = Tk() + cls.text = Text(cls.root) @classmethod def tearDownClass(cls): - cls.text.destroy() - cls.tk.destroy() - del cls.text, cls.tk + del cls.text + cls.root.destroy() + del cls.root def setUp(self): self.redir = WidgetRedirector(self.text) @@ -108,13 +108,13 @@ def test_command_dispatch(self): # Test that .__init__ causes redirection of tk calls # through redir.dispatch - self.tk.call(self.text._w, 'insert', 'hello') + self.root.call(self.text._w, 'insert', 'hello') self.assertEqual(self.func.args, ('hello',)) self.assertEqual(self.text.get('1.0', 'end'), '\n') # Ensure that called through redir .dispatch and not through # self.text.insert by having mock raise TclError. self.func.__init__(TclError()) - self.assertEqual(self.tk.call(self.text._w, 'insert', 'boo'), '') + self.assertEqual(self.root.call(self.text._w, 'insert', 'boo'), '') -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 23:58:51 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 04 Jun 2016 03:58:51 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MTk2?= =?utf-8?q?=3A_Stop_=27application_destroyed=27_warnings_when_running_IDLE?= =?utf-8?q?_tests=2E?= Message-ID: <20160604035851.15269.35317.33E8F578@psf.io> https://hg.python.org/cpython/rev/0207c6203f84 changeset: 101677:0207c6203f84 branch: 3.5 parent: 101675:813bb6a4c693 user: Terry Jan Reedy date: Fri Jun 03 23:53:56 2016 -0400 summary: Issue #27196: Stop 'application destroyed' warnings when running IDLE tests. The update_idletasks solution was provided by Serhiy Storchaka. files: Lib/idlelib/idle_test/README.txt | 6 ++++++ Lib/idlelib/idle_test/test_configdialog.py | 9 +++++---- Lib/idlelib/idle_test/test_parenmatch.py | 9 ++++++--- Lib/idlelib/idle_test/test_textview.py | 3 ++- Lib/idlelib/idle_test/test_widgetredir.py | 5 +++-- 5 files changed, 22 insertions(+), 10 deletions(-) diff --git a/Lib/idlelib/idle_test/README.txt b/Lib/idlelib/idle_test/README.txt --- a/Lib/idlelib/idle_test/README.txt +++ b/Lib/idlelib/idle_test/README.txt @@ -71,9 +71,15 @@ @classmethod def tearDownClass(cls): del cls.text + cls.root.update_idletasks() cls.root.destroy() del cls.root +The update_idletasks call is sometimes needed to prevent the following warning +either when running a test alone or as part of the test suite (#27196). + can't invoke "event" command: application has been destroyed + ... + "ttk::ThemeChanged" Requires('gui') causes the test(s) it guards to be skipped if any of these conditions are met: diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py --- a/Lib/idlelib/idle_test/test_configdialog.py +++ b/Lib/idlelib/idle_test/test_configdialog.py @@ -1,7 +1,7 @@ -'''Unittests for idlelib/configHandler.py +'''Test idlelib.configHandler. -Coverage: 46% just by creating dialog. The other half is change code. - +Coverage: 46% just by creating dialog. +The other half is code for working with user customizations. ''' import unittest from test.support import requires @@ -20,11 +20,12 @@ @classmethod def tearDownClass(cls): + cls.root.update_idletasks() cls.root.destroy() del cls.root def test_dialog(self): - d=ConfigDialog(self.root, 'Test', _utest=True) + d = ConfigDialog(self.root, 'Test', _utest=True) d.remove_var_callbacks() d.destroy() diff --git a/Lib/idlelib/idle_test/test_parenmatch.py b/Lib/idlelib/idle_test/test_parenmatch.py --- a/Lib/idlelib/idle_test/test_parenmatch.py +++ b/Lib/idlelib/idle_test/test_parenmatch.py @@ -1,6 +1,8 @@ -"""Test idlelib.ParenMatch.""" -# This must currently be a gui test because ParenMatch methods use -# several text methods not defined on idlelib.idle_test.mock_tk.Text. +'''Test idlelib.ParenMatch. + +This must currently be a gui test because ParenMatch methods use +several text methods not defined on idlelib.idle_test.mock_tk.Text. +''' from test.support import requires requires('gui') @@ -29,6 +31,7 @@ @classmethod def tearDownClass(cls): del cls.text, cls.editwin + cls.root.update_idletasks() cls.root.destroy() del cls.root diff --git a/Lib/idlelib/idle_test/test_textview.py b/Lib/idlelib/idle_test/test_textview.py --- a/Lib/idlelib/idle_test/test_textview.py +++ b/Lib/idlelib/idle_test/test_textview.py @@ -1,4 +1,4 @@ -'''Test the functions and main class method of textView.py. +'''Test idlelib.textView. Since all methods and functions create (or destroy) a TextViewer, which is a widget containing multiple widgets, all tests must be gui tests. @@ -24,6 +24,7 @@ def tearDownModule(): global root, TV del TV + root.update_idletasks() root.destroy() # pyflakes falsely sees root as undefined del root diff --git a/Lib/idlelib/idle_test/test_widgetredir.py b/Lib/idlelib/idle_test/test_widgetredir.py --- a/Lib/idlelib/idle_test/test_widgetredir.py +++ b/Lib/idlelib/idle_test/test_widgetredir.py @@ -1,7 +1,7 @@ -"""Unittest for idlelib.WidgetRedirector +'''Test idlelib.WidgetRedirector. 100% coverage -""" +''' from test.support import requires import unittest from idlelib.idle_test.mock_idle import Func @@ -49,6 +49,7 @@ @classmethod def tearDownClass(cls): del cls.text + cls.root.update_idletasks() cls.root.destroy() del cls.root -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 3 23:58:51 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 04 Jun 2016 03:58:51 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_issue_=2327196_from_3=2E5=3A_Stop_IDLE_test_=27app?= =?utf-8?q?lication_destroyed=27_warnings=2E?= Message-ID: <20160604035851.120100.14862.0624EE9C@psf.io> https://hg.python.org/cpython/rev/2d864ac472f0 changeset: 101678:2d864ac472f0 parent: 101676:d8e5e3da4d57 parent: 101677:0207c6203f84 user: Terry Jan Reedy date: Fri Jun 03 23:58:37 2016 -0400 summary: Merge issue #27196 from 3.5: Stop IDLE test 'application destroyed' warnings. files: Lib/idlelib/idle_test/README.txt | 6 ++++++ Lib/idlelib/idle_test/test_configdialog.py | 6 +++--- Lib/idlelib/idle_test/test_parenmatch.py | 9 ++++++--- Lib/idlelib/idle_test/test_redirector.py | 6 +++--- Lib/idlelib/idle_test/test_textview.py | 3 ++- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/Lib/idlelib/idle_test/README.txt b/Lib/idlelib/idle_test/README.txt --- a/Lib/idlelib/idle_test/README.txt +++ b/Lib/idlelib/idle_test/README.txt @@ -71,9 +71,15 @@ @classmethod def tearDownClass(cls): del cls.text + cls.root.update_idletasks() cls.root.destroy() del cls.root +The update_idletasks call is sometimes needed to prevent the following warning +either when running a test alone or as part of the test suite (#27196). + can't invoke "event" command: application has been destroyed + ... + "ttk::ThemeChanged" Requires('gui') causes the test(s) it guards to be skipped if any of these conditions are met: diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py --- a/Lib/idlelib/idle_test/test_configdialog.py +++ b/Lib/idlelib/idle_test/test_configdialog.py @@ -1,7 +1,6 @@ -'''Unittests for idlelib/config.py +'''Test idlelib.configdialog. Coverage: 46% just by creating dialog. The other half is change code. - ''' import unittest from test.support import requires @@ -20,11 +19,12 @@ @classmethod def tearDownClass(cls): + cls.root.update_idletasks() cls.root.destroy() del cls.root def test_dialog(self): - d=ConfigDialog(self.root, 'Test', _utest=True) + d = ConfigDialog(self.root, 'Test', _utest=True) d.remove_var_callbacks() d.destroy() diff --git a/Lib/idlelib/idle_test/test_parenmatch.py b/Lib/idlelib/idle_test/test_parenmatch.py --- a/Lib/idlelib/idle_test/test_parenmatch.py +++ b/Lib/idlelib/idle_test/test_parenmatch.py @@ -1,6 +1,8 @@ -"""Test idlelib.parenmatch.""" -# This must currently be a gui test because ParenMatch methods use -# several text methods not defined on idlelib.idle_test.mock_tk.Text. +'''Test idlelib.parenmatch. + +This must currently be a gui test because ParenMatch methods use +several text methods not defined on idlelib.idle_test.mock_tk.Text. +''' from test.support import requires requires('gui') @@ -29,6 +31,7 @@ @classmethod def tearDownClass(cls): del cls.text, cls.editwin + cls.root.update_idletasks() cls.root.destroy() del cls.root diff --git a/Lib/idlelib/idle_test/test_redirector.py b/Lib/idlelib/idle_test/test_redirector.py --- a/Lib/idlelib/idle_test/test_redirector.py +++ b/Lib/idlelib/idle_test/test_redirector.py @@ -1,7 +1,7 @@ -"""Unittest for idlelib.redirector +'''Test idlelib.redirector. 100% coverage -""" +''' from test.support import requires import unittest from idlelib.idle_test.mock_idle import Func @@ -48,8 +48,8 @@ @classmethod def tearDownClass(cls): - cls.text.destroy() del cls.text + cls.root.update_idletasks() cls.root.destroy() del cls.root diff --git a/Lib/idlelib/idle_test/test_textview.py b/Lib/idlelib/idle_test/test_textview.py --- a/Lib/idlelib/idle_test/test_textview.py +++ b/Lib/idlelib/idle_test/test_textview.py @@ -1,4 +1,4 @@ -'''Test the functions and main class method of textview.py. +'''Test idlelib.textview. Since all methods and functions create (or destroy) a TextViewer, which is a widget containing multiple widgets, all tests must be gui tests. @@ -24,6 +24,7 @@ def tearDownModule(): global root, TV del TV + root.update_idletasks() root.destroy() # pyflakes falsely sees root as undefined del root -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 01:22:20 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 04 Jun 2016 05:22:20 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_check_the_resu?= =?utf-8?q?lt_of_PyByteArray=5FResize_in_readline=28=29_=28closes_=2327211?= =?utf-8?q?=29?= Message-ID: <20160604052220.20572.46968.F1A4F878@psf.io> https://hg.python.org/cpython/rev/afbd4473947a changeset: 101679:afbd4473947a branch: 2.7 parent: 101660:8090931ba850 user: Benjamin Peterson date: Fri Jun 03 22:20:44 2016 -0700 summary: check the result of PyByteArray_Resize in readline() (closes #27211) files: Misc/NEWS | 2 ++ Modules/_io/iobase.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -89,6 +89,8 @@ Library ------- +- Issue #27211: Fix possible memory corruption in io.IOBase.readline(). + - Issue #27114: Fix SSLContext._load_windows_store_certs fails with PermissionError diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c --- a/Modules/_io/iobase.c +++ b/Modules/_io/iobase.c @@ -529,7 +529,10 @@ } old_size = PyByteArray_GET_SIZE(buffer); - PyByteArray_Resize(buffer, old_size + PyBytes_GET_SIZE(b)); + if (PyByteArray_Resize(buffer, old_size + PyBytes_GET_SIZE(b)) < 0) { + Py_DECREF(b); + goto fail; + } memcpy(PyByteArray_AS_STRING(buffer) + old_size, PyBytes_AS_STRING(b), PyBytes_GET_SIZE(b)); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 01:31:32 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 04 Jun 2016 05:31:32 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Fix_typos_in_c?= =?utf-8?q?ode_comment_and_documentation?= Message-ID: <20160604053131.20938.44871.D5235602@psf.io> https://hg.python.org/cpython/rev/2e0eec77028e changeset: 101680:2e0eec77028e branch: 3.5 parent: 101677:0207c6203f84 user: Martin Panter date: Sat Jun 04 04:57:19 2016 +0000 summary: Fix typos in code comment and documentation files: Doc/library/asyncio-sync.rst | 2 +- Doc/library/marshal.rst | 2 +- Doc/library/urllib.request.rst | 2 +- Lib/asyncio/locks.py | 2 +- Misc/NEWS | 2 +- Python/symtable.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Doc/library/asyncio-sync.rst b/Doc/library/asyncio-sync.rst --- a/Doc/library/asyncio-sync.rst +++ b/Doc/library/asyncio-sync.rst @@ -52,7 +52,7 @@ :meth:`acquire` is a coroutine and should be called with ``yield from``. Locks also support the context management protocol. ``(yield from lock)`` - should be used as context manager expression. + should be used as the context manager expression. This class is :ref:`not thread safe `. diff --git a/Doc/library/marshal.rst b/Doc/library/marshal.rst --- a/Doc/library/marshal.rst +++ b/Doc/library/marshal.rst @@ -40,7 +40,7 @@ point numbers, complex numbers, strings, bytes, bytearrays, tuples, lists, sets, frozensets, dictionaries, and code objects, where it should be understood that tuples, lists, sets, frozensets and dictionaries are only supported as long as -the values contained therein are themselves supported. +the values contained therein are themselves supported. The singletons :const:`None`, :const:`Ellipsis` and :exc:`StopIteration` can also be marshalled and unmarshalled. For format *version* lower than 3, recursive lists, sets and dictionaries cannot 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 @@ -59,7 +59,7 @@ The *cadefault* parameter is ignored. - This function always returns an object which can work as + This function always returns an object which can work as a :term:`context manager` and has methods such as * :meth:`~urllib.response.addinfourl.geturl` --- return the URL of the resource retrieved, diff --git a/Lib/asyncio/locks.py b/Lib/asyncio/locks.py --- a/Lib/asyncio/locks.py +++ b/Lib/asyncio/locks.py @@ -111,7 +111,7 @@ acquire() is a coroutine and should be called with 'yield from'. Locks also support the context management protocol. '(yield from lock)' - should be used as context manager expression. + should be used as the context manager expression. Usage: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -7778,7 +7778,7 @@ - Issue #16176: Properly identify Windows 8 via platform.platform() - Issue #16088: BaseHTTPRequestHandler's send_error method includes a - Content-Length header in it's response now. Patch by Antoine Pitrou. + Content-Length header in its response now. Patch by Antoine Pitrou. - Issue #16114: The subprocess module no longer provides a misleading error message stating that args[0] did not exist when either the cwd or executable diff --git a/Python/symtable.c b/Python/symtable.c --- a/Python/symtable.c +++ b/Python/symtable.c @@ -854,7 +854,7 @@ /* Copy the bound and global dictionaries. - These dictionary are used by all blocks enclosed by the + These dictionaries are used by all blocks enclosed by the current block. The analyze_block() call modifies these dictionaries. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 01:31:32 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 04 Jun 2016 05:31:32 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2322797=3A_Synchron?= =?utf-8?q?ize_urlopen=28=29_doc_string_with_RST_documentation?= Message-ID: <20160604053132.21347.36366.1FF3E8B0@psf.io> https://hg.python.org/cpython/rev/2d69d0419879 changeset: 101683:2d69d0419879 user: Martin Panter date: Sat Jun 04 05:06:34 2016 +0000 summary: Issue #22797: Synchronize urlopen() doc string with RST documentation files: Lib/urllib/request.py | 19 ++++++++++++------- 1 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -172,8 +172,8 @@ The *cadefault* parameter is ignored. - For http and https urls, this function returns a http.client.HTTPResponse - object which has the following HTTPResponse Objects methods: + This function always returns an object which can work as a context + manager and has methods such as * geturl() - return the URL of the resource retrieved, commonly used to determine if a redirect was followed @@ -185,12 +185,17 @@ * getcode() - return the HTTP status code of the response. Raises URLError on errors. - For ftp, file, and data urls and requests explicitly handled by legacy + For HTTP and HTTPS URLs, this function returns a http.client.HTTPResponse + object slightly modified. In addition to the three new methods above, the + msg attribute contains the same information as the reason attribute --- + the reason phrase returned by the server --- instead of the response + headers as it is specified in the documentation for HTTPResponse. + + For FTP, file, and data URLs and requests explicitly handled by legacy URLopener and FancyURLopener classes, this function returns a - urllib.response.addinfourl object which can work as a context manager and - also support the geturl(), info(), getcode() methods listed above. - - Note that *None& may be returned if no handler handles the request (though + urllib.response.addinfourl object. + + Note that None may be returned if no handler handles the request (though the default installed global OpenerDirector uses UnknownHandler to ensure this never happens). -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 01:31:33 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 04 Jun 2016 05:31:33 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_More_typo_fixes_for_3=2E6?= Message-ID: <20160604053132.13681.71747.9DCBDDEE@psf.io> https://hg.python.org/cpython/rev/065fcfb2ad40 changeset: 101682:065fcfb2ad40 user: Martin Panter date: Sat Jun 04 05:06:25 2016 +0000 summary: More typo fixes for 3.6 files: Lib/trace.py | 2 +- Lib/urllib/request.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/trace.py b/Lib/trace.py --- a/Lib/trace.py +++ b/Lib/trace.py @@ -224,7 +224,7 @@ :param show_missing: Show lines that had no hits. :param summary: Include coverage summary per module. - :param coverdir: If None, the results of each module are placed in it's + :param coverdir: If None, the results of each module are placed in its directory, otherwise it is included in the directory specified. """ diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -187,7 +187,7 @@ For ftp, file, and data urls and requests explicitly handled by legacy URLopener and FancyURLopener classes, this function returns a - urllib.response.addinfourl object which can work as context manager and + urllib.response.addinfourl object which can work as a context manager and also support the geturl(), info(), getcode() methods listed above. Note that *None& may be returned if no handler handles the request (though -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 01:31:33 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 04 Jun 2016 05:31:33 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_typo_fixes_from_3=2E5?= Message-ID: <20160604053132.100738.91448.0EE54E28@psf.io> https://hg.python.org/cpython/rev/4e5cde79d6f3 changeset: 101681:4e5cde79d6f3 parent: 101678:2d864ac472f0 parent: 101680:2e0eec77028e user: Martin Panter date: Sat Jun 04 05:26:40 2016 +0000 summary: Merge typo fixes from 3.5 files: Doc/library/asyncio-sync.rst | 2 +- Doc/library/marshal.rst | 2 +- Doc/library/urllib.request.rst | 2 +- Lib/asyncio/locks.py | 2 +- Misc/NEWS | 2 +- Python/symtable.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Doc/library/asyncio-sync.rst b/Doc/library/asyncio-sync.rst --- a/Doc/library/asyncio-sync.rst +++ b/Doc/library/asyncio-sync.rst @@ -52,7 +52,7 @@ :meth:`acquire` is a coroutine and should be called with ``yield from``. Locks also support the context management protocol. ``(yield from lock)`` - should be used as context manager expression. + should be used as the context manager expression. This class is :ref:`not thread safe `. diff --git a/Doc/library/marshal.rst b/Doc/library/marshal.rst --- a/Doc/library/marshal.rst +++ b/Doc/library/marshal.rst @@ -40,7 +40,7 @@ point numbers, complex numbers, strings, bytes, bytearrays, tuples, lists, sets, frozensets, dictionaries, and code objects, where it should be understood that tuples, lists, sets, frozensets and dictionaries are only supported as long as -the values contained therein are themselves supported. +the values contained therein are themselves supported. The singletons :const:`None`, :const:`Ellipsis` and :exc:`StopIteration` can also be marshalled and unmarshalled. For format *version* lower than 3, recursive lists, sets and dictionaries cannot 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 @@ -59,7 +59,7 @@ The *cadefault* parameter is ignored. - This function always returns an object which can work as + This function always returns an object which can work as a :term:`context manager` and has methods such as * :meth:`~urllib.response.addinfourl.geturl` --- return the URL of the resource retrieved, diff --git a/Lib/asyncio/locks.py b/Lib/asyncio/locks.py --- a/Lib/asyncio/locks.py +++ b/Lib/asyncio/locks.py @@ -111,7 +111,7 @@ acquire() is a coroutine and should be called with 'yield from'. Locks also support the context management protocol. '(yield from lock)' - should be used as context manager expression. + should be used as the context manager expression. Usage: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -8520,7 +8520,7 @@ - Issue #16176: Properly identify Windows 8 via platform.platform() - Issue #16088: BaseHTTPRequestHandler's send_error method includes a - Content-Length header in it's response now. Patch by Antoine Pitrou. + Content-Length header in its response now. Patch by Antoine Pitrou. - Issue #16114: The subprocess module no longer provides a misleading error message stating that args[0] did not exist when either the cwd or executable diff --git a/Python/symtable.c b/Python/symtable.c --- a/Python/symtable.c +++ b/Python/symtable.c @@ -854,7 +854,7 @@ /* Copy the bound and global dictionaries. - These dictionary are used by all blocks enclosed by the + These dictionaries are used by all blocks enclosed by the current block. The analyze_block() call modifies these dictionaries. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 01:31:33 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 04 Jun 2016 05:31:33 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Fix_typo_in_co?= =?utf-8?q?de_comment?= Message-ID: <20160604053132.13470.84645.D510CA08@psf.io> https://hg.python.org/cpython/rev/ca24bce2a031 changeset: 101684:ca24bce2a031 branch: 2.7 parent: 101679:afbd4473947a user: Martin Panter date: Sat Jun 04 04:57:19 2016 +0000 summary: Fix typo in code comment files: Python/symtable.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Python/symtable.c b/Python/symtable.c --- a/Python/symtable.c +++ b/Python/symtable.c @@ -738,7 +738,7 @@ /* Copy the bound and global dictionaries. - These dictionary are used by all blocks enclosed by the + These dictionaries are used by all blocks enclosed by the current block. The analyze_block() call modifies these dictionaries. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 01:39:18 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 04 Jun 2016 05:39:18 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_fix_indentatio?= =?utf-8?q?n_of_comment?= Message-ID: <20160604053917.119910.63491.E122F967@psf.io> https://hg.python.org/cpython/rev/566cbc844574 changeset: 101685:566cbc844574 branch: 3.5 parent: 101677:0207c6203f84 user: Benjamin Peterson date: Fri Jun 03 22:37:48 2016 -0700 summary: fix indentation of comment files: Include/frameobject.h | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Include/frameobject.h b/Include/frameobject.h --- a/Include/frameobject.h +++ b/Include/frameobject.h @@ -28,13 +28,13 @@ PyObject **f_stacktop; PyObject *f_trace; /* Trace function */ - /* 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 - functions 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 + functions in ceval.c for details of their use. */ PyObject *f_exc_type, *f_exc_value, *f_exc_traceback; /* Borrowed reference to a generator, or NULL */ PyObject *f_gen; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 01:39:18 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 04 Jun 2016 05:39:18 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogbWVyZ2UgMy41?= Message-ID: <20160604053917.1118.24761.509E8A37@psf.io> https://hg.python.org/cpython/rev/249c1b2f852f changeset: 101686:249c1b2f852f parent: 101678:2d864ac472f0 parent: 101685:566cbc844574 user: Benjamin Peterson date: Fri Jun 03 22:38:10 2016 -0700 summary: merge 3.5 files: Include/frameobject.h | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Include/frameobject.h b/Include/frameobject.h --- a/Include/frameobject.h +++ b/Include/frameobject.h @@ -28,13 +28,13 @@ PyObject **f_stacktop; PyObject *f_trace; /* Trace function */ - /* 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 - functions 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 + functions in ceval.c for details of their use. */ PyObject *f_exc_type, *f_exc_value, *f_exc_traceback; /* Borrowed reference to a generator, or NULL */ PyObject *f_gen; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 01:39:18 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 04 Jun 2016 05:39:18 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNSk6?= =?utf-8?q?_merge_heads?= Message-ID: <20160604053918.51915.14186.08710BC7@psf.io> https://hg.python.org/cpython/rev/fade8610a729 changeset: 101687:fade8610a729 branch: 3.5 parent: 101685:566cbc844574 parent: 101680:2e0eec77028e user: Benjamin Peterson date: Fri Jun 03 22:38:37 2016 -0700 summary: merge heads files: Doc/library/asyncio-sync.rst | 2 +- Doc/library/marshal.rst | 2 +- Doc/library/urllib.request.rst | 2 +- Lib/asyncio/locks.py | 2 +- Misc/NEWS | 2 +- Python/symtable.c | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Doc/library/asyncio-sync.rst b/Doc/library/asyncio-sync.rst --- a/Doc/library/asyncio-sync.rst +++ b/Doc/library/asyncio-sync.rst @@ -52,7 +52,7 @@ :meth:`acquire` is a coroutine and should be called with ``yield from``. Locks also support the context management protocol. ``(yield from lock)`` - should be used as context manager expression. + should be used as the context manager expression. This class is :ref:`not thread safe `. diff --git a/Doc/library/marshal.rst b/Doc/library/marshal.rst --- a/Doc/library/marshal.rst +++ b/Doc/library/marshal.rst @@ -40,7 +40,7 @@ point numbers, complex numbers, strings, bytes, bytearrays, tuples, lists, sets, frozensets, dictionaries, and code objects, where it should be understood that tuples, lists, sets, frozensets and dictionaries are only supported as long as -the values contained therein are themselves supported. +the values contained therein are themselves supported. The singletons :const:`None`, :const:`Ellipsis` and :exc:`StopIteration` can also be marshalled and unmarshalled. For format *version* lower than 3, recursive lists, sets and dictionaries cannot 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 @@ -59,7 +59,7 @@ The *cadefault* parameter is ignored. - This function always returns an object which can work as + This function always returns an object which can work as a :term:`context manager` and has methods such as * :meth:`~urllib.response.addinfourl.geturl` --- return the URL of the resource retrieved, diff --git a/Lib/asyncio/locks.py b/Lib/asyncio/locks.py --- a/Lib/asyncio/locks.py +++ b/Lib/asyncio/locks.py @@ -111,7 +111,7 @@ acquire() is a coroutine and should be called with 'yield from'. Locks also support the context management protocol. '(yield from lock)' - should be used as context manager expression. + should be used as the context manager expression. Usage: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -7778,7 +7778,7 @@ - Issue #16176: Properly identify Windows 8 via platform.platform() - Issue #16088: BaseHTTPRequestHandler's send_error method includes a - Content-Length header in it's response now. Patch by Antoine Pitrou. + Content-Length header in its response now. Patch by Antoine Pitrou. - Issue #16114: The subprocess module no longer provides a misleading error message stating that args[0] did not exist when either the cwd or executable diff --git a/Python/symtable.c b/Python/symtable.c --- a/Python/symtable.c +++ b/Python/symtable.c @@ -854,7 +854,7 @@ /* Copy the bound and global dictionaries. - These dictionary are used by all blocks enclosed by the + These dictionaries are used by all blocks enclosed by the current block. The analyze_block() call modifies these dictionaries. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 01:39:18 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 04 Jun 2016 05:39:18 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?q?=29=3A_merge_heads?= Message-ID: <20160604053918.21399.22731.CE256892@psf.io> https://hg.python.org/cpython/rev/9e820058b97e changeset: 101688:9e820058b97e parent: 101686:249c1b2f852f parent: 101683:2d69d0419879 user: Benjamin Peterson date: Fri Jun 03 22:38:42 2016 -0700 summary: merge heads files: Doc/library/asyncio-sync.rst | 2 +- Doc/library/marshal.rst | 2 +- Doc/library/urllib.request.rst | 2 +- Lib/asyncio/locks.py | 2 +- Lib/trace.py | 2 +- Lib/urllib/request.py | 19 ++++++++++++------- Misc/NEWS | 2 +- Python/symtable.c | 2 +- 8 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Doc/library/asyncio-sync.rst b/Doc/library/asyncio-sync.rst --- a/Doc/library/asyncio-sync.rst +++ b/Doc/library/asyncio-sync.rst @@ -52,7 +52,7 @@ :meth:`acquire` is a coroutine and should be called with ``yield from``. Locks also support the context management protocol. ``(yield from lock)`` - should be used as context manager expression. + should be used as the context manager expression. This class is :ref:`not thread safe `. diff --git a/Doc/library/marshal.rst b/Doc/library/marshal.rst --- a/Doc/library/marshal.rst +++ b/Doc/library/marshal.rst @@ -40,7 +40,7 @@ point numbers, complex numbers, strings, bytes, bytearrays, tuples, lists, sets, frozensets, dictionaries, and code objects, where it should be understood that tuples, lists, sets, frozensets and dictionaries are only supported as long as -the values contained therein are themselves supported. +the values contained therein are themselves supported. The singletons :const:`None`, :const:`Ellipsis` and :exc:`StopIteration` can also be marshalled and unmarshalled. For format *version* lower than 3, recursive lists, sets and dictionaries cannot 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 @@ -59,7 +59,7 @@ The *cadefault* parameter is ignored. - This function always returns an object which can work as + This function always returns an object which can work as a :term:`context manager` and has methods such as * :meth:`~urllib.response.addinfourl.geturl` --- return the URL of the resource retrieved, diff --git a/Lib/asyncio/locks.py b/Lib/asyncio/locks.py --- a/Lib/asyncio/locks.py +++ b/Lib/asyncio/locks.py @@ -111,7 +111,7 @@ acquire() is a coroutine and should be called with 'yield from'. Locks also support the context management protocol. '(yield from lock)' - should be used as context manager expression. + should be used as the context manager expression. Usage: diff --git a/Lib/trace.py b/Lib/trace.py --- a/Lib/trace.py +++ b/Lib/trace.py @@ -224,7 +224,7 @@ :param show_missing: Show lines that had no hits. :param summary: Include coverage summary per module. - :param coverdir: If None, the results of each module are placed in it's + :param coverdir: If None, the results of each module are placed in its directory, otherwise it is included in the directory specified. """ diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -172,8 +172,8 @@ The *cadefault* parameter is ignored. - For http and https urls, this function returns a http.client.HTTPResponse - object which has the following HTTPResponse Objects methods: + This function always returns an object which can work as a context + manager and has methods such as * geturl() - return the URL of the resource retrieved, commonly used to determine if a redirect was followed @@ -185,12 +185,17 @@ * getcode() - return the HTTP status code of the response. Raises URLError on errors. - For ftp, file, and data urls and requests explicitly handled by legacy + For HTTP and HTTPS URLs, this function returns a http.client.HTTPResponse + object slightly modified. In addition to the three new methods above, the + msg attribute contains the same information as the reason attribute --- + the reason phrase returned by the server --- instead of the response + headers as it is specified in the documentation for HTTPResponse. + + For FTP, file, and data URLs and requests explicitly handled by legacy URLopener and FancyURLopener classes, this function returns a - urllib.response.addinfourl object which can work as context manager and - also support the geturl(), info(), getcode() methods listed above. - - Note that *None& may be returned if no handler handles the request (though + urllib.response.addinfourl object. + + Note that None may be returned if no handler handles the request (though the default installed global OpenerDirector uses UnknownHandler to ensure this never happens). diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -8520,7 +8520,7 @@ - Issue #16176: Properly identify Windows 8 via platform.platform() - Issue #16088: BaseHTTPRequestHandler's send_error method includes a - Content-Length header in it's response now. Patch by Antoine Pitrou. + Content-Length header in its response now. Patch by Antoine Pitrou. - Issue #16114: The subprocess module no longer provides a misleading error message stating that args[0] did not exist when either the cwd or executable diff --git a/Python/symtable.c b/Python/symtable.c --- a/Python/symtable.c +++ b/Python/symtable.c @@ -854,7 +854,7 @@ /* Copy the bound and global dictionaries. - These dictionary are used by all blocks enclosed by the + These dictionaries are used by all blocks enclosed by the current block. The analyze_block() call modifies these dictionaries. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 01:39:19 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 04 Jun 2016 05:39:19 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogbWVyZ2UgMy41?= Message-ID: <20160604053918.1408.76420.856F468B@psf.io> https://hg.python.org/cpython/rev/38c8599a1623 changeset: 101689:38c8599a1623 parent: 101688:9e820058b97e parent: 101687:fade8610a729 user: Benjamin Peterson date: Fri Jun 03 22:38:47 2016 -0700 summary: merge 3.5 files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 02:32:47 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 04 Jun 2016 06:32:47 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_IDLE_test_READ?= =?utf-8?b?TUU6ICdndWknIHRvICdHVUknLCBleGNlcHQgaW4gIidndWknIiBhbmQgJy11?= =?utf-8?b?Z3VpJy4=?= Message-ID: <20160604063247.21051.58744.AFE68402@psf.io> https://hg.python.org/cpython/rev/6e0fe366e1f7 changeset: 101690:6e0fe366e1f7 branch: 2.7 parent: 101684:ca24bce2a031 user: Terry Jan Reedy date: Sat Jun 04 02:32:09 2016 -0400 summary: IDLE test README: 'gui' to 'GUI', except in "'gui'" and '-ugui'. files: Lib/idlelib/idle_test/README.txt | 26 ++++++++++---------- 1 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Lib/idlelib/idle_test/README.txt b/Lib/idlelib/idle_test/README.txt --- a/Lib/idlelib/idle_test/README.txt +++ b/Lib/idlelib/idle_test/README.txt @@ -42,15 +42,15 @@ 2. GUI Tests -When run as part of the Python test suite, Idle gui tests need to run -test.support.requires('gui') (test.test_support in 2.7). A test is a gui test +When run as part of the Python test suite, Idle GUI tests need to run +test.test_support.requires('gui') (test.support in 3.x). A test is a GUI test if it creates a Tk root or master object either directly or indirectly by instantiating a tkinter or idle class. For the benefit of test processes that -either have no graphical environment available or are not allowed to use it, gui +either have no graphical environment available or are not allowed to use it, GUI tests must be 'guarded' by "requires('gui')" in a setUp function or method. This will typically be setUpClass. -To avoid interfering with other gui tests, all gui objects must be destroyed and +To avoid interfering with other GUI tests, all GUI objects must be destroyed and deleted by the end of the test. The Tk root created in a setUpX function should be destroyed in the corresponding tearDownX and the module or class attribute deleted. Others widgets should descend from the single root and the attributes @@ -73,24 +73,24 @@ Requires('gui') causes the test(s) it guards to be skipped if any of these conditions are met: - + - The tests are being run by regrtest.py, and it was started without enabling the "gui" resource with the "-u" command line option. - + - The tests are being run on Windows by a service that is not allowed to interact with the graphical environment. - - The tests are being run on Linux and X window is not available. - + - The tests are being run on Linux and X Windows is not available. + - The tests are being run on Mac OSX in a process that cannot make a window manager connection. - + - tkinter.Tk cannot be successfully instantiated for some reason. - + - test.support.use_resources has been set by something other than regrtest.py and does not contain "gui". - -Tests of non-gui operations should avoid creating tk widgets. Incidental uses of + +Tests of non-GUI operations should avoid creating tk widgets. Incidental uses of tk variables and messageboxes can be replaced by the mock classes in idle_test/mock_tk.py. The mock text handles some uses of the tk Text widget. @@ -105,7 +105,7 @@ htest follows. The following command lines also run all test methods, including -gui tests, in test_xyz.py. (Both '-m idlelib' and '-m idlelib.idle' start +GUI tests, in test_xyz.py. (Both '-m idlelib' and '-m idlelib.idle' start Idle and so cannot run tests.) python -m idlelib.xyz -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 02:32:49 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 04 Jun 2016 06:32:49 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_with_3=2E5?= Message-ID: <20160604063247.1235.1361.44CC6D38@psf.io> https://hg.python.org/cpython/rev/042c19239da6 changeset: 101692:042c19239da6 parent: 101689:38c8599a1623 parent: 101691:b826a259a51b user: Terry Jan Reedy date: Sat Jun 04 02:32:32 2016 -0400 summary: Merge with 3.5 files: Lib/idlelib/idle_test/README.txt | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/idle_test/README.txt b/Lib/idlelib/idle_test/README.txt --- a/Lib/idlelib/idle_test/README.txt +++ b/Lib/idlelib/idle_test/README.txt @@ -56,7 +56,7 @@ To guard a test class, put "requires('gui')" in its setUpClass function. -To avoid interfering with other gui tests, all gui objects must be destroyed and +To avoid interfering with other GUI tests, all GUI objects must be destroyed and deleted by the end of the test. The Tk root created in a setUpX function should be destroyed in the corresponding tearDownX and the module or class attribute deleted. Others widgets should descend from the single root and the attributes @@ -116,7 +116,7 @@ option is needed in xyx.py files when an htest follows. The following command lines also run all test methods, including -gui tests, in test_xyz.py. (Both '-m idlelib' and '-m idlelib.idle' +GUI tests, in test_xyz.py. (Both '-m idlelib' and '-m idlelib.idle' start Idle and so cannot run tests.) python -m idlelib.xyz -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 02:32:49 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 04 Jun 2016 06:32:49 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_IDLE_test_READ?= =?utf-8?b?TUU6ICdndWknIHRvICdHVUknLCBleGNlcHQgaW4gIidndWknIiBhbmQgJy11?= =?utf-8?b?Z3VpJy4=?= Message-ID: <20160604063247.51964.29633.0B4752E8@psf.io> https://hg.python.org/cpython/rev/b826a259a51b changeset: 101691:b826a259a51b branch: 3.5 parent: 101687:fade8610a729 user: Terry Jan Reedy date: Sat Jun 04 02:32:18 2016 -0400 summary: IDLE test README: 'gui' to 'GUI', except in "'gui'" and '-ugui'. files: Lib/idlelib/idle_test/README.txt | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/idle_test/README.txt b/Lib/idlelib/idle_test/README.txt --- a/Lib/idlelib/idle_test/README.txt +++ b/Lib/idlelib/idle_test/README.txt @@ -56,7 +56,7 @@ To guard a test class, put "requires('gui')" in its setUpClass function. -To avoid interfering with other gui tests, all gui objects must be destroyed and +To avoid interfering with other GUI tests, all GUI objects must be destroyed and deleted by the end of the test. The Tk root created in a setUpX function should be destroyed in the corresponding tearDownX and the module or class attribute deleted. Others widgets should descend from the single root and the attributes @@ -116,7 +116,7 @@ option is needed in xyx.py files when an htest follows. The following command lines also run all test methods, including -gui tests, in test_xyz.py. (Both '-m idlelib' and '-m idlelib.idle' +GUI tests, in test_xyz.py. (Both '-m idlelib' and '-m idlelib.idle' start Idle and so cannot run tests.) python -m idlelib.xyz -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 03:15:59 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 04 Jun 2016 07:15:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Clarify_deprec?= =?utf-8?q?ation_of_ElementTree=2EXMLParser=28html=3D=2E=2E=2E=29_paramete?= =?utf-8?q?r?= Message-ID: <20160604071558.100905.52432.51967860@psf.io> https://hg.python.org/cpython/rev/833fb1ab68e3 changeset: 101693:833fb1ab68e3 branch: 3.5 parent: 101691:b826a259a51b user: Martin Panter date: Sat Jun 04 07:12:51 2016 +0000 summary: Clarify deprecation of ElementTree.XMLParser(html=...) parameter files: Lib/xml/etree/ElementTree.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py --- a/Lib/xml/etree/ElementTree.py +++ b/Lib/xml/etree/ElementTree.py @@ -1454,7 +1454,7 @@ class XMLParser: """Element structure builder for XML source data based on the expat parser. - *html* are predefined HTML entities (not supported currently), + *html* are predefined HTML entities (deprecated and not supported), *target* is an optional target object which defaults to an instance of the standard TreeBuilder class, *encoding* is an optional encoding string which if given, overrides the encoding specified in the XML file: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 03:15:59 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 04 Jun 2016 07:15:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_Element_Tree_doc_string_from_3=2E5?= Message-ID: <20160604071558.119933.6189.37748A99@psf.io> https://hg.python.org/cpython/rev/8428d15cbeff changeset: 101694:8428d15cbeff parent: 101692:042c19239da6 parent: 101693:833fb1ab68e3 user: Martin Panter date: Sat Jun 04 07:13:38 2016 +0000 summary: Merge Element Tree doc string from 3.5 files: Lib/xml/etree/ElementTree.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py --- a/Lib/xml/etree/ElementTree.py +++ b/Lib/xml/etree/ElementTree.py @@ -1424,7 +1424,7 @@ class XMLParser: """Element structure builder for XML source data based on the expat parser. - *html* are predefined HTML entities (not supported currently), + *html* are predefined HTML entities (deprecated and not supported), *target* is an optional target object which defaults to an instance of the standard TreeBuilder class, *encoding* is an optional encoding string which if given, overrides the encoding specified in the XML file: -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Sat Jun 4 04:45:23 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 04 Jun 2016 08:45:23 +0000 Subject: [Python-checkins] Daily reference leaks (38c8599a1623): sum=9 Message-ID: <20160604084522.15161.30454.1C36BE26@psf.io> results for 38c8599a1623 on branch "default" -------------------------------------------- test_collections leaked [4, 0, 0] memory blocks, sum=4 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [-1, 0, 2] memory blocks, sum=1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogjJwE8k', '--timeout', '7200'] From python-checkins at python.org Sat Jun 4 12:41:27 2016 From: python-checkins at python.org (ned.deily) Date: Sat, 04 Jun 2016 16:41:27 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_27216=3A_Fix_typo_=28noticed_by_Alex_Chan=29=2E?= Message-ID: <20160604164127.21525.31156.70169CE6@psf.io> https://hg.python.org/cpython/rev/7fda2d76d947 changeset: 101697:7fda2d76d947 parent: 101694:8428d15cbeff parent: 101696:5160d59a8f1c user: Ned Deily date: Sat Jun 04 09:41:05 2016 -0700 summary: Issue 27216: Fix typo (noticed by Alex Chan). files: Doc/library/os.path.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst --- a/Doc/library/os.path.rst +++ b/Doc/library/os.path.rst @@ -214,7 +214,7 @@ .. function:: islink(path) Return ``True`` if *path* refers to a directory entry that is a symbolic link. - Always ``False`` if symbolic links are not supported by the python runtime. + Always ``False`` if symbolic links are not supported by the Python runtime. .. function:: ismount(path) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 12:41:27 2016 From: python-checkins at python.org (ned.deily) Date: Sat, 04 Jun 2016 16:41:27 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgMjcyMTY6?= =?utf-8?q?_Fix_typo_=28noticed_by_Alex_Chan=29=2E?= Message-ID: <20160604164126.21070.97515.5195ECEF@psf.io> https://hg.python.org/cpython/rev/7c20ea2bdb3f changeset: 101695:7c20ea2bdb3f branch: 2.7 parent: 101690:6e0fe366e1f7 user: Ned Deily date: Sat Jun 04 09:39:42 2016 -0700 summary: Issue 27216: Fix typo (noticed by Alex Chan). files: Doc/library/os.path.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst --- a/Doc/library/os.path.rst +++ b/Doc/library/os.path.rst @@ -185,7 +185,7 @@ .. function:: islink(path) Return ``True`` if *path* refers to a directory entry that is a symbolic link. - Always ``False`` if symbolic links are not supported by the python runtime. + Always ``False`` if symbolic links are not supported by the Python runtime. .. function:: ismount(path) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 12:41:28 2016 From: python-checkins at python.org (ned.deily) Date: Sat, 04 Jun 2016 16:41:28 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgMjcyMTY6?= =?utf-8?q?_Fix_typo_=28noticed_by_Alex_Chan=29=2E?= Message-ID: <20160604164126.100911.65392.D3BCA31D@psf.io> https://hg.python.org/cpython/rev/5160d59a8f1c changeset: 101696:5160d59a8f1c branch: 3.5 parent: 101693:833fb1ab68e3 user: Ned Deily date: Sat Jun 04 09:40:40 2016 -0700 summary: Issue 27216: Fix typo (noticed by Alex Chan). files: Doc/library/os.path.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst --- a/Doc/library/os.path.rst +++ b/Doc/library/os.path.rst @@ -214,7 +214,7 @@ .. function:: islink(path) Return ``True`` if *path* refers to a directory entry that is a symbolic link. - Always ``False`` if symbolic links are not supported by the python runtime. + Always ``False`` if symbolic links are not supported by the Python runtime. .. function:: ismount(path) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 13:19:52 2016 From: python-checkins at python.org (ethan.furman) Date: Sat, 04 Jun 2016 17:19:52 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_issue27182=3A_update_fsenc?= =?utf-8?q?ode_and_fsdecode_for_os=2Epath=28=29=3B_patch_by_Dusty_Phillips?= Message-ID: <20160604171952.23588.82085.612EAA40@psf.io> https://hg.python.org/cpython/rev/00991aa5fdb5 changeset: 101698:00991aa5fdb5 user: Ethan Furman date: Sat Jun 04 10:19:27 2016 -0700 summary: issue27182: update fsencode and fsdecode for os.path(); patch by Dusty Phillips files: Lib/os.py | 22 ++++++++++++++-------- Lib/test/test_os.py | 15 +++++++++++++++ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/Lib/os.py b/Lib/os.py --- a/Lib/os.py +++ b/Lib/os.py @@ -877,29 +877,35 @@ def fsencode(filename): """ - Encode filename to the filesystem encoding with 'surrogateescape' error - handler, return bytes unchanged. On Windows, use 'strict' error handler if - the file system encoding is 'mbcs' (which is the default encoding). + Encode filename (an os.PathLike, bytes, or str) to the filesystem + encoding with 'surrogateescape' error handler, return bytes unchanged. + On Windows, use 'strict' error handler if the file system encoding is + 'mbcs' (which is the default encoding). """ + filename = fspath(filename) if isinstance(filename, bytes): return filename elif isinstance(filename, str): return filename.encode(encoding, errors) else: - raise TypeError("expect bytes or str, not %s" % type(filename).__name__) + raise TypeError("expected str, bytes or os.PathLike object, not " + + path_type.__name__) def fsdecode(filename): """ - Decode filename from the filesystem encoding with 'surrogateescape' error - handler, return str unchanged. On Windows, use 'strict' error handler if - the file system encoding is 'mbcs' (which is the default encoding). + Decode filename (an os.PathLike, bytes, or str) from the filesystem + encoding with 'surrogateescape' error handler, return str unchanged. On + Windows, use 'strict' error handler if the file system encoding is + 'mbcs' (which is the default encoding). """ + filename = fspath(filename) if isinstance(filename, str): return filename elif isinstance(filename, bytes): return filename.decode(encoding, errors) else: - raise TypeError("expect bytes or str, not %s" % type(filename).__name__) + raise TypeError("expected str, bytes or os.PathLike object, not " + + path_type.__name__) return fsencode, fsdecode 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 @@ -3106,6 +3106,21 @@ for s in 'hello', 'goodbye', 'some/path/and/file': self.assertEqual(s, os.fspath(s)) + def test_fsencode_fsdecode_return_pathlike(self): + class Pathlike: + def __init__(self, path): + self.path = path + + def __fspath__(self): + return self.path + + for p in "path/like/object", b"path/like/object": + pathlike = Pathlike(p) + + self.assertEqual(p, os.fspath(pathlike)) + self.assertEqual(b"path/like/object", os.fsencode(pathlike)) + self.assertEqual("path/like/object", os.fsdecode(pathlike)) + def test_garbage_in_exception_out(self): vapor = type('blah', (), {}) for o in int, type, os, vapor(): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 13:24:56 2016 From: python-checkins at python.org (kushal.das) Date: Sat, 04 Jun 2016 17:24:56 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2319234=3A_Merge_from_3=2E5?= Message-ID: <20160604172456.1118.27425.82454D2C@psf.io> https://hg.python.org/cpython/rev/3c745b656dca changeset: 101700:3c745b656dca parent: 101697:7fda2d76d947 parent: 101699:d83007ab69e2 user: Kushal Das date: Sat Jun 04 10:21:36 2016 -0700 summary: Issue #19234: Merge from 3.5 files: Doc/library/socket.rst | 5 ++--- 1 files changed, 2 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 @@ -931,14 +931,13 @@ .. method:: socket.fileno() - Return the socket's file descriptor (a small integer). This is useful with - :func:`select.select`. + Return the socket's file descriptor (a small integer), or -1 on failure. This + is useful with :func:`select.select`. Under Windows the small integer returned by this method cannot be used where a file descriptor can be used (such as :func:`os.fdopen`). Unix does not have this limitation. - .. method:: socket.get_inheritable() Get the :ref:`inheritable flag ` of the socket's file -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 13:24:56 2016 From: python-checkins at python.org (kushal.das) Date: Sat, 04 Jun 2016 17:24:56 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzE5MjM0?= =?utf-8?q?=3A_Documents_socket=2Efileno=28=29_returns_-1_on_failure?= Message-ID: <20160604172456.100658.61329.7D1DF8D5@psf.io> https://hg.python.org/cpython/rev/d83007ab69e2 changeset: 101699:d83007ab69e2 branch: 3.5 parent: 101696:5160d59a8f1c user: Kushal Das date: Sat Jun 04 10:20:12 2016 -0700 summary: Issue #19234: Documents socket.fileno() returns -1 on failure files: Doc/library/socket.rst | 5 ++--- 1 files changed, 2 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 @@ -927,14 +927,13 @@ .. method:: socket.fileno() - Return the socket's file descriptor (a small integer). This is useful with - :func:`select.select`. + Return the socket's file descriptor (a small integer), or -1 on failure. This + is useful with :func:`select.select`. Under Windows the small integer returned by this method cannot be used where a file descriptor can be used (such as :func:`os.fdopen`). Unix does not have this limitation. - .. method:: socket.get_inheritable() Get the :ref:`inheritable flag ` of the socket's file -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 13:24:57 2016 From: python-checkins at python.org (kushal.das) Date: Sat, 04 Jun 2016 17:24:57 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?q?=29=3A_NULL_merge?= Message-ID: <20160604172456.52104.57629.EAB59E8E@psf.io> https://hg.python.org/cpython/rev/416441e4afab changeset: 101701:416441e4afab parent: 101700:3c745b656dca parent: 101698:00991aa5fdb5 user: Kushal Das date: Sat Jun 04 10:24:12 2016 -0700 summary: NULL merge files: Lib/os.py | 22 ++++++++++++++-------- Lib/test/test_os.py | 15 +++++++++++++++ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/Lib/os.py b/Lib/os.py --- a/Lib/os.py +++ b/Lib/os.py @@ -877,29 +877,35 @@ def fsencode(filename): """ - Encode filename to the filesystem encoding with 'surrogateescape' error - handler, return bytes unchanged. On Windows, use 'strict' error handler if - the file system encoding is 'mbcs' (which is the default encoding). + Encode filename (an os.PathLike, bytes, or str) to the filesystem + encoding with 'surrogateescape' error handler, return bytes unchanged. + On Windows, use 'strict' error handler if the file system encoding is + 'mbcs' (which is the default encoding). """ + filename = fspath(filename) if isinstance(filename, bytes): return filename elif isinstance(filename, str): return filename.encode(encoding, errors) else: - raise TypeError("expect bytes or str, not %s" % type(filename).__name__) + raise TypeError("expected str, bytes or os.PathLike object, not " + + path_type.__name__) def fsdecode(filename): """ - Decode filename from the filesystem encoding with 'surrogateescape' error - handler, return str unchanged. On Windows, use 'strict' error handler if - the file system encoding is 'mbcs' (which is the default encoding). + Decode filename (an os.PathLike, bytes, or str) from the filesystem + encoding with 'surrogateescape' error handler, return str unchanged. On + Windows, use 'strict' error handler if the file system encoding is + 'mbcs' (which is the default encoding). """ + filename = fspath(filename) if isinstance(filename, str): return filename elif isinstance(filename, bytes): return filename.decode(encoding, errors) else: - raise TypeError("expect bytes or str, not %s" % type(filename).__name__) + raise TypeError("expected str, bytes or os.PathLike object, not " + + path_type.__name__) return fsencode, fsdecode 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 @@ -3106,6 +3106,21 @@ for s in 'hello', 'goodbye', 'some/path/and/file': self.assertEqual(s, os.fspath(s)) + def test_fsencode_fsdecode_return_pathlike(self): + class Pathlike: + def __init__(self, path): + self.path = path + + def __fspath__(self): + return self.path + + for p in "path/like/object", b"path/like/object": + pathlike = Pathlike(p) + + self.assertEqual(p, os.fspath(pathlike)) + self.assertEqual(b"path/like/object", os.fsencode(pathlike)) + self.assertEqual("path/like/object", os.fsdecode(pathlike)) + def test_garbage_in_exception_out(self): vapor = type('blah', (), {}) for o in int, type, os, vapor(): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 13:42:44 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Jun 2016 17:42:44 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzIwMDQx?= =?utf-8?q?=3A_Fixed_TypeError_when_frame=2Ef=5Ftrace_is_set_to_None=2E?= Message-ID: <20160604174244.21442.93395.27913F64@psf.io> https://hg.python.org/cpython/rev/4d916be61d46 changeset: 101702:4d916be61d46 branch: 2.7 parent: 101695:7c20ea2bdb3f user: Serhiy Storchaka date: Sat Jun 04 20:30:43 2016 +0300 summary: Issue #20041: Fixed TypeError when frame.f_trace is set to None. Patch by Xavier de Gaye. files: Lib/test/test_sys_settrace.py | 9 +++++++++ Misc/NEWS | 3 +++ Objects/frameobject.c | 8 +++----- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py --- a/Lib/test/test_sys_settrace.py +++ b/Lib/test/test_sys_settrace.py @@ -386,6 +386,15 @@ (257, 'line'), (257, 'return')]) + def test_17_none_f_trace(self): + # Issue 20041: fix TypeError when f_trace is set to None. + def func(): + sys._getframe().f_trace = None + lineno = 2 + self.run_and_compare(func, + [(0, 'call'), + (1, 'line')]) + class RaisingTraceFuncTestCase(unittest.TestCase): def trace(self, frame, event, arg): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #20041: Fixed TypeError when frame.f_trace is set to None. + Patch by Xavier de Gaye. + - Issue #25702: A --with-lto configure option has been added that will enable link time optimizations at build time during a make profile-opt. Some compilers and toolchains are known to not produce stable code when diff --git a/Objects/frameobject.c b/Objects/frameobject.c --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -364,15 +364,13 @@ static int frame_settrace(PyFrameObject *f, PyObject* v, void *closure) { - PyObject* old_value; - /* We rely on f_lineno being accurate when f_trace is set. */ f->f_lineno = PyFrame_GetLineNumber(f); - old_value = f->f_trace; + if (v == Py_None) + v = NULL; Py_XINCREF(v); - f->f_trace = v; - Py_XDECREF(old_value); + Py_XSETREF(f->f_trace, v); return 0; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 13:42:44 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Jun 2016 17:42:44 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIwMDQx?= =?utf-8?q?=3A_Fixed_TypeError_when_frame=2Ef=5Ftrace_is_set_to_None=2E?= Message-ID: <20160604174244.21285.64097.EFC84D7D@psf.io> https://hg.python.org/cpython/rev/74ad78d2dd8d changeset: 101703:74ad78d2dd8d branch: 3.5 parent: 101699:d83007ab69e2 user: Serhiy Storchaka date: Sat Jun 04 20:32:36 2016 +0300 summary: Issue #20041: Fixed TypeError when frame.f_trace is set to None. Patch by Xavier de Gaye. files: Lib/test/test_sys_settrace.py | 9 +++++++++ Misc/NEWS | 3 +++ Objects/frameobject.c | 8 +++----- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py --- a/Lib/test/test_sys_settrace.py +++ b/Lib/test/test_sys_settrace.py @@ -388,6 +388,15 @@ (257, 'line'), (257, 'return')]) + def test_17_none_f_trace(self): + # Issue 20041: fix TypeError when f_trace is set to None. + def func(): + sys._getframe().f_trace = None + lineno = 2 + self.run_and_compare(func, + [(0, 'call'), + (1, 'line')]) + class RaisingTraceFuncTestCase(unittest.TestCase): def setUp(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #20041: Fixed TypeError when frame.f_trace is set to None. + Patch by Xavier de Gaye. + - Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N" format unit. diff --git a/Objects/frameobject.c b/Objects/frameobject.c --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -349,15 +349,13 @@ static int frame_settrace(PyFrameObject *f, PyObject* v, void *closure) { - PyObject* old_value; - /* We rely on f_lineno being accurate when f_trace is set. */ f->f_lineno = PyFrame_GetLineNumber(f); - old_value = f->f_trace; + if (v == Py_None) + v = NULL; Py_XINCREF(v); - f->f_trace = v; - Py_XDECREF(old_value); + Py_XSETREF(f->f_trace, v); return 0; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 13:42:45 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Jun 2016 17:42:45 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2320041=3A_Fixed_TypeError_when_frame=2Ef=5Ftrace?= =?utf-8?q?_is_set_to_None=2E?= Message-ID: <20160604174244.1392.96464.8F6362F3@psf.io> https://hg.python.org/cpython/rev/f993dbeb2ad2 changeset: 101704:f993dbeb2ad2 parent: 101701:416441e4afab parent: 101703:74ad78d2dd8d user: Serhiy Storchaka date: Sat Jun 04 20:33:33 2016 +0300 summary: Issue #20041: Fixed TypeError when frame.f_trace is set to None. Patch by Xavier de Gaye. files: Lib/test/test_sys_settrace.py | 9 +++++++++ Misc/NEWS | 3 +++ Objects/frameobject.c | 2 ++ 3 files changed, 14 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_sys_settrace.py b/Lib/test/test_sys_settrace.py --- a/Lib/test/test_sys_settrace.py +++ b/Lib/test/test_sys_settrace.py @@ -388,6 +388,15 @@ (257, 'line'), (257, 'return')]) + def test_17_none_f_trace(self): + # Issue 20041: fix TypeError when f_trace is set to None. + def func(): + sys._getframe().f_trace = None + lineno = 2 + self.run_and_compare(func, + [(0, 'call'), + (1, 'line')]) + class RaisingTraceFuncTestCase(unittest.TestCase): def setUp(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -120,6 +120,9 @@ Core and Builtins ----------------- +- Issue #20041: Fixed TypeError when frame.f_trace is set to None. + Patch by Xavier de Gaye. + - Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N" format unit. diff --git a/Objects/frameobject.c b/Objects/frameobject.c --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -344,6 +344,8 @@ /* We rely on f_lineno being accurate when f_trace is set. */ f->f_lineno = PyFrame_GetLineNumber(f); + if (v == Py_None) + v = NULL; Py_XINCREF(v); Py_XSETREF(f->f_trace, v); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 15:05:30 2016 From: python-checkins at python.org (gregory.p.smith) Date: Sat, 04 Jun 2016 19:05:30 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_issue26372_-_use_os=2Edevnull_instead_of_/dev/null?= Message-ID: <20160604190530.1220.4985.B4638146@psf.io> https://hg.python.org/cpython/rev/52e331b86f2b changeset: 101706:52e331b86f2b parent: 101704:f993dbeb2ad2 parent: 101705:3a560525ca50 user: Gregory P. Smith [Google Inc.] date: Sat Jun 04 19:05:17 2016 +0000 summary: issue26372 - use os.devnull instead of /dev/null files: Lib/test/test_subprocess.py | 2 +- 1 files changed, 1 insertions(+), 1 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 @@ -1264,7 +1264,7 @@ stdin=subprocess.PIPE, stdout=subprocess.PIPE) with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin, \ - open('/dev/null', 'wb') as dev_null: + open(os.devnull, 'wb') as dev_null: mock_proc_stdin.flush.side_effect = BrokenPipeError # because _communicate registers a selector using proc.stdin... mock_proc_stdin.fileno.return_value = dev_null.fileno() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 15:05:30 2016 From: python-checkins at python.org (gregory.p.smith) Date: Sat, 04 Jun 2016 19:05:30 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_issue26372_-_u?= =?utf-8?q?se_os=2Edevnull_instead_of_/dev/null?= Message-ID: <20160604190530.930.99788.C5BCD328@psf.io> https://hg.python.org/cpython/rev/3a560525ca50 changeset: 101705:3a560525ca50 branch: 3.5 parent: 101703:74ad78d2dd8d user: Gregory P. Smith [Google Inc.] date: Sat Jun 04 19:04:43 2016 +0000 summary: issue26372 - use os.devnull instead of /dev/null files: Lib/test/test_subprocess.py | 2 +- 1 files changed, 1 insertions(+), 1 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 @@ -1267,7 +1267,7 @@ stdin=subprocess.PIPE, stdout=subprocess.PIPE) with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin, \ - open('/dev/null', 'wb') as dev_null: + open(os.devnull, 'wb') as dev_null: mock_proc_stdin.flush.side_effect = BrokenPipeError # because _communicate registers a selector using proc.stdin... mock_proc_stdin.fileno.return_value = dev_null.fileno() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 15:06:51 2016 From: python-checkins at python.org (ethan.furman) Date: Sat, 04 Jun 2016 19:06:51 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_issue27186=3A__add_C_versi?= =?utf-8?q?on_of_os=2Efspath=28=29=3B_patch_by_Jelle_Zijlstra?= Message-ID: <20160604190651.21244.42205.8E6C8086@psf.io> https://hg.python.org/cpython/rev/780cbe18082e changeset: 101707:780cbe18082e user: Ethan Furman date: Sat Jun 04 12:06:26 2016 -0700 summary: issue27186: add C version of os.fspath(); patch by Jelle Zijlstra files: Include/Python.h | 1 + Include/osmodule.h | 15 ++++++ Lib/os.py | 35 +++++++------- Lib/test/test_os.py | 7 +++ Modules/clinic/posixmodule.c.h | 34 ++++++++++++++- Modules/posixmodule.c | 51 ++++++++++++++++++++++ 6 files changed, 125 insertions(+), 18 deletions(-) diff --git a/Include/Python.h b/Include/Python.h --- a/Include/Python.h +++ b/Include/Python.h @@ -116,6 +116,7 @@ #include "pylifecycle.h" #include "ceval.h" #include "sysmodule.h" +#include "osmodule.h" #include "intrcheck.h" #include "import.h" diff --git a/Include/osmodule.h b/Include/osmodule.h new file mode 100644 --- /dev/null +++ b/Include/osmodule.h @@ -0,0 +1,15 @@ + +/* os module interface */ + +#ifndef Py_OSMODULE_H +#define Py_OSMODULE_H +#ifdef __cplusplus +extern "C" { +#endif + +PyAPI_FUNC(PyObject *) PyOS_FSPath(PyObject *path); + +#ifdef __cplusplus +} +#endif +#endif /* !Py_OSMODULE_H */ diff --git a/Lib/os.py b/Lib/os.py --- a/Lib/os.py +++ b/Lib/os.py @@ -1104,23 +1104,24 @@ import io return io.open(fd, *args, **kwargs) -# Supply os.fspath() -def fspath(path): - """Return the string representation of the path. +# Supply os.fspath() if not defined in C +if not _exists('fspath'): + def fspath(path): + """Return the string representation of the path. - If str or bytes is passed in, it is returned unchanged. - """ - if isinstance(path, (str, bytes)): - return path + If str or bytes is passed in, it is returned unchanged. + """ + if isinstance(path, (str, bytes)): + return path - # Work from the object's type to match method resolution of other magic - # methods. - path_type = type(path) - try: - return path_type.__fspath__(path) - except AttributeError: - if hasattr(path_type, '__fspath__'): - raise + # Work from the object's type to match method resolution of other magic + # methods. + path_type = type(path) + try: + return path_type.__fspath__(path) + except AttributeError: + if hasattr(path_type, '__fspath__'): + raise - raise TypeError("expected str, bytes or os.PathLike object, not " - + path_type.__name__) + raise TypeError("expected str, bytes or os.PathLike object, not " + + path_type.__name__) 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 @@ -3121,6 +3121,13 @@ self.assertEqual(b"path/like/object", os.fsencode(pathlike)) self.assertEqual("path/like/object", os.fsdecode(pathlike)) + def test_fspathlike(self): + class PathLike(object): + def __fspath__(self): + return '#feelthegil' + + self.assertEqual('#feelthegil', os.fspath(PathLike())) + def test_garbage_in_exception_out(self): vapor = type('blah', (), {}) for o in int, type, os, vapor(): diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h --- a/Modules/clinic/posixmodule.c.h +++ b/Modules/clinic/posixmodule.c.h @@ -5321,6 +5321,38 @@ #endif /* defined(MS_WINDOWS) */ +PyDoc_STRVAR(os_fspath__doc__, +"fspath($module, /, path)\n" +"--\n" +"\n" +"Return the file system path representation of the object.\n" +"\n" +"If the object is str or bytes, then allow it to pass through with\n" +"an incremented refcount. If the object defines __fspath__(), then\n" +"return the result of that method. All other types raise a TypeError."); + +#define OS_FSPATH_METHODDEF \ + {"fspath", (PyCFunction)os_fspath, METH_VARARGS|METH_KEYWORDS, os_fspath__doc__}, + +static PyObject * +os_fspath_impl(PyModuleDef *module, PyObject *path); + +static PyObject * +os_fspath(PyModuleDef *module, PyObject *args, PyObject *kwargs) +{ + PyObject *return_value = NULL; + static char *_keywords[] = {"path", NULL}; + PyObject *path; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:fspath", _keywords, + &path)) + goto exit; + return_value = os_fspath_impl(module, path); + +exit: + return return_value; +} + #ifndef OS_TTYNAME_METHODDEF #define OS_TTYNAME_METHODDEF #endif /* !defined(OS_TTYNAME_METHODDEF) */ @@ -5792,4 +5824,4 @@ #ifndef OS_SET_HANDLE_INHERITABLE_METHODDEF #define OS_SET_HANDLE_INHERITABLE_METHODDEF #endif /* !defined(OS_SET_HANDLE_INHERITABLE_METHODDEF) */ -/*[clinic end generated code: output=a5c9bef9ad11a20b input=a9049054013a1b77]*/ +/*[clinic end generated code: output=e64e246b8270abda input=a9049054013a1b77]*/ diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -12284,6 +12284,56 @@ return NULL; } +/* + Return the file system path representation of the object. + + If the object is str or bytes, then allow it to pass through with + an incremented refcount. If the object defines __fspath__(), then + return the result of that method. All other types raise a TypeError. +*/ +PyObject * +PyOS_FSPath(PyObject *path) +{ + _Py_IDENTIFIER(__fspath__); + PyObject *func = NULL; + PyObject *path_repr = NULL; + + if (PyUnicode_Check(path) || PyBytes_Check(path)) { + Py_INCREF(path); + return path; + } + + func = _PyObject_LookupSpecial(path, &PyId___fspath__); + if (NULL == func) { + return PyErr_Format(PyExc_TypeError, + "expected str, bytes or os.PathLike object, " + "not %S", + path->ob_type); + } + + path_repr = PyObject_CallFunctionObjArgs(func, NULL); + Py_DECREF(func); + return path_repr; +} + +/*[clinic input] +os.fspath + + path: object + +Return the file system path representation of the object. + +If the object is str or bytes, then allow it to pass through with +an incremented refcount. If the object defines __fspath__(), then +return the result of that method. All other types raise a TypeError. +[clinic start generated code]*/ + +static PyObject * +os_fspath_impl(PyModuleDef *module, PyObject *path) +/*[clinic end generated code: output=51ef0c2772c1932a input=652c7c37e4be1c13]*/ +{ + return PyOS_FSPath(path); +} #include "clinic/posixmodule.c.h" @@ -12484,6 +12534,7 @@ {"scandir", (PyCFunction)posix_scandir, METH_VARARGS | METH_KEYWORDS, posix_scandir__doc__}, + OS_FSPATH_METHODDEF {NULL, NULL} /* Sentinel */ }; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 15:21:14 2016 From: python-checkins at python.org (ned.deily) Date: Sat, 04 Jun 2016 19:21:14 +0000 Subject: [Python-checkins] =?utf-8?q?devguide=3A_Update_devguide_setup_ins?= =?utf-8?q?tructions_for_OS_X?= Message-ID: <20160604192114.13521.50166.21F259DB@psf.io> https://hg.python.org/devguide/rev/0d21df4ddaca changeset: 807:0d21df4ddaca user: Ned Deily date: Sat Jun 04 12:21:07 2016 -0700 summary: Update devguide setup instructions for OS X files: setup.rst | 65 +++++++++++++++++++++++++++++------------- 1 files changed, 45 insertions(+), 20 deletions(-) diff --git a/setup.rst b/setup.rst --- a/setup.rst +++ b/setup.rst @@ -108,44 +108,69 @@ distribution, but the appropriate commands for some popular distributions are below. -Fedora, Red Hat Enterprise Linux and other ``yum`` based systems:: +On **Fedora**, **Red Hat Enterprise Linux** and other ``yum`` based systems:: $ sudo yum install yum-utils $ sudo yum-builddep python3 -Fedora and other ``DNF`` based systems:: +On **Fedora** and other ``DNF`` based systems:: $ sudo dnf install dnf-plugins-core # install this to use 'dnf builddep' $ sudo dnf builddep python3 -Debian, Ubuntu and other ``apt`` based systems, try to get the dependencies for -the Python version that you're working on e.g.:: +On **Debian**, **Ubuntu**, and other ``apt`` based systems, try to get the +dependencies for the Python version that you're working on e.g.:: - $ sudo apt-get build-dep python3.4 + $ sudo apt-get build-dep python3.5 If that package is not available for your system, try reducing the minor version until you find a package that is available. -For Mac OS X systems, it is generally easiest to use the C compiler and other -development utilities provided by Apple's Xcode Developer Tools. There are -specific versions supported by Apple for each major release of OS X. For -current releases, Xcode is available as a no-cost download from Apple's App -Store. Xcode versions for older releases are available through -`the Apple Developer web site `_. -Note that while the Xcode IDE application itself is not needed to build Python, -the development components packaged inside it may be. You should also install -the Xcode Command Line Tools component to ensure build tools and system header -files are installed in their conventional locations (``/usr/bin`` and -``/usr/include``). How the command line tools are installed varies by OS X -and Xcode release. In earlier releases, there may be a separate installer -download. For OS X 10.7 and 10.8, there is an option in the Xcode app -Preferences menu. For OS X 10.9 (Mavericks), run the following:: +On **Mac OS X systems**, use the C compiler and other +development utilities provided by Apple's Xcode Developer Tools. +The Developer Tools are not shipped with OS X. + +For **OS X 10.9 and later**, +the Developer Tools can be downloaded and installed automatically; +you do not need to download the complete Xcode application. +If necessary, run the following:: $ xcode-select --install +This will also ensure that the system header files are installed into ``/usr/include``. + +For **older releases of OS X**, you will need to download either the correct +version of the Command Line Tools, if available, or install them from the +full Xcode app or package for that OS X release. Older versions may be +available either as a no-cost download through Apple's App Store or from +`the Apple Developer web site `_. + +.. _Homebrew: http://brew.sh + +.. _MacPorts: https://www.macports.org + Also note that OS X does not include several libraries used by the Python standard library, including ``libzma``, so expect to see some extension module -build failures unless you install local copies of them. +build failures unless you install local copies of them. As of OS X 10.11, +Apple no longer provides header files for the deprecated system version of +OpenSSL which means that you will not be able to build the ``_ssl`` extension. +One solution is to install these libraries from a third-party package +manager, like Homebrew_ or MacPorts_, and then add the appropriate paths +for the header and library files to your ``configure`` command. For example, +with Homebrew:: + + $ brew install openssl xz + $ CPPFLAGS="-I$(brew --prefix openssl)/include" \ + LDFLAGS="-L$(brew --prefix openssl)/lib" \ + ./configure --with-pydebug + +or MacPorts:: + + $ sudo port install openssl xz + $ CPPFLAGS="-I/opt/local/include" \ + LDFLAGS="-L/opt/local/lib" \ + ./configure --with-pydebug + There will sometimes be optional modules added for a new release which won't yet be identified in the OS level build dependencies. In those cases, -- Repository URL: https://hg.python.org/devguide From python-checkins at python.org Sat Jun 4 15:42:16 2016 From: python-checkins at python.org (zach.ware) Date: Sat, 04 Jun 2016 19:42:16 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI2ODA5?= =?utf-8?q?=3A_Add_=5F=5Fall=5F=5F_to_string_module=2E__Patch_by_Emanuel_B?= =?utf-8?q?arry?= Message-ID: <20160604194214.13538.41548.88CA9326@psf.io> https://hg.python.org/cpython/rev/8136f9623d7f changeset: 101708:8136f9623d7f branch: 3.5 parent: 101705:3a560525ca50 user: Zachary Ware date: Sat Jun 04 14:35:05 2016 -0500 summary: Issue #26809: Add __all__ to string module. Patch by Emanuel Barry files: Lib/string.py | 10 +++++++--- Misc/NEWS | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Lib/string.py b/Lib/string.py --- a/Lib/string.py +++ b/Lib/string.py @@ -14,6 +14,10 @@ """ +__all__ = ["ascii_letters", "ascii_lowercase", "ascii_uppercase", "capwords", + "digits", "hexdigits", "octdigits", "printable", "punctuation", + "whitespace", "Formatter", "Template"] + import _string # Some strings for ctype-style character classification @@ -46,7 +50,7 @@ #################################################################### import re as _re -from collections import ChainMap +from collections import ChainMap as _ChainMap class _TemplateMetaclass(type): pattern = r""" @@ -104,7 +108,7 @@ if not args: mapping = kws elif kws: - mapping = ChainMap(kws, args[0]) + mapping = _ChainMap(kws, args[0]) else: mapping = args[0] # Helper function for .sub() @@ -134,7 +138,7 @@ if not args: mapping = kws elif kws: - mapping = ChainMap(kws, args[0]) + mapping = _ChainMap(kws, args[0]) else: mapping = args[0] # Helper function for .sub() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -131,6 +131,8 @@ Library ------- +- Issue #26809: Add ``__all__`` to :mod:`string`. Patch by Emanuel Barry. + - Issue #26373: subprocess.Popen.communicate now correctly ignores BrokenPipeError when the child process dies before .communicate() is called in more/all circumstances. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 15:42:16 2016 From: python-checkins at python.org (zach.ware) Date: Sat, 04 Jun 2016 19:42:16 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Closes_=2326809=3A_Merge_with_3=2E5?= Message-ID: <20160604194214.119955.92809.E732261A@psf.io> https://hg.python.org/cpython/rev/21ae58b77924 changeset: 101709:21ae58b77924 parent: 101707:780cbe18082e parent: 101708:8136f9623d7f user: Zachary Ware date: Sat Jun 04 14:41:42 2016 -0500 summary: Closes #26809: Merge with 3.5 files: Lib/string.py | 10 +++++++--- Misc/NEWS | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Lib/string.py b/Lib/string.py --- a/Lib/string.py +++ b/Lib/string.py @@ -14,6 +14,10 @@ """ +__all__ = ["ascii_letters", "ascii_lowercase", "ascii_uppercase", "capwords", + "digits", "hexdigits", "octdigits", "printable", "punctuation", + "whitespace", "Formatter", "Template"] + import _string # Some strings for ctype-style character classification @@ -46,7 +50,7 @@ #################################################################### import re as _re -from collections import ChainMap +from collections import ChainMap as _ChainMap class _TemplateMetaclass(type): pattern = r""" @@ -104,7 +108,7 @@ if not args: mapping = kws elif kws: - mapping = ChainMap(kws, args[0]) + mapping = _ChainMap(kws, args[0]) else: mapping = args[0] # Helper function for .sub() @@ -131,7 +135,7 @@ if not args: mapping = kws elif kws: - mapping = ChainMap(kws, args[0]) + mapping = _ChainMap(kws, args[0]) else: mapping = args[0] # Helper function for .sub() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,8 @@ Library ------- +- Issue #26809: Add ``__all__`` to :mod:`string`. Patch by Emanuel Barry. + - Issue #26373: subprocess.Popen.communicate now correctly ignores BrokenPipeError when the child process dies before .communicate() is called in more/all circumstances. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 15:50:02 2016 From: python-checkins at python.org (ethan.furman) Date: Sat, 04 Jun 2016 19:50:02 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_issue27186=3A_add_PathLike?= =?utf-8?q?_ABC?= Message-ID: <20160604195001.119988.12831.3B3D3BF7@psf.io> https://hg.python.org/cpython/rev/e672cf63d08a changeset: 101710:e672cf63d08a user: Ethan Furman date: Sat Jun 04 12:49:35 2016 -0700 summary: issue27186: add PathLike ABC files: Lib/os.py | 17 ++++++++++++++++- Lib/test/test_os.py | 2 ++ 2 files changed, 18 insertions(+), 1 deletions(-) diff --git a/Lib/os.py b/Lib/os.py --- a/Lib/os.py +++ b/Lib/os.py @@ -22,7 +22,7 @@ """ #' - +import abc import sys, errno import stat as st @@ -1125,3 +1125,18 @@ raise TypeError("expected str, bytes or os.PathLike object, not " + path_type.__name__) + +class PathLike(abc.ABC): + """ + Abstract base class for implementing the file system path protocol. + """ + @abc.abstractmethod + def __fspath__(self): + """ + Return the file system path representation of the object. + """ + raise NotImplementedError + + @classmethod + def __subclasshook__(cls, subclass): + return hasattr(subclass, '__fspath__') 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 @@ -3127,6 +3127,8 @@ return '#feelthegil' self.assertEqual('#feelthegil', os.fspath(PathLike())) + self.assertTrue(issubclass(PathLike, os.PathLike)) + self.assertTrue(isinstance(PathLike(), os.PathLike)) def test_garbage_in_exception_out(self): vapor = type('blah', (), {}) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 15:56:12 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 04 Jun 2016 19:56:12 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Revise_and_syn?= =?utf-8?q?chronize_idle=5Ftest=2Etest=5Fconfigdialog=2E?= Message-ID: <20160604195611.15139.74400.C0870F0A@psf.io> https://hg.python.org/cpython/rev/ab974f1ebebe changeset: 101711:ab974f1ebebe branch: 3.5 parent: 101708:8136f9623d7f user: Terry Jan Reedy date: Sat Jun 04 15:54:44 2016 -0400 summary: Revise and synchronize idle_test.test_configdialog. files: Lib/idlelib/idle_test/test_configdialog.py | 16 ++++----- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py --- a/Lib/idlelib/idle_test/test_configdialog.py +++ b/Lib/idlelib/idle_test/test_configdialog.py @@ -1,22 +1,21 @@ -'''Test idlelib.configHandler. +'''Test idlelib.configDialog. Coverage: 46% just by creating dialog. The other half is code for working with user customizations. ''' +from idlelib.configDialog import ConfigDialog # always test import +from test.support import requires +requires('gui') +from tkinter import Tk import unittest -from test.support import requires -from tkinter import Tk -from idlelib.configDialog import ConfigDialog -from idlelib.macosxSupport import _initializeTkVariantTests - +from idlelib import macosxSupport as macosx class ConfigDialogTest(unittest.TestCase): @classmethod def setUpClass(cls): - requires('gui') cls.root = Tk() - _initializeTkVariantTests(cls.root) + macosx._initializeTkVariantTests(cls.root) @classmethod def tearDownClass(cls): @@ -27,7 +26,6 @@ def test_dialog(self): d = ConfigDialog(self.root, 'Test', _utest=True) d.remove_var_callbacks() - d.destroy() if __name__ == '__main__': -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 15:56:12 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 04 Jun 2016 19:56:12 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge=3A_Revise_and_synchronize_idle=5Ftest=2Etest=5Fcon?= =?utf-8?q?figdialog=2E?= Message-ID: <20160604195612.13501.62278.F4952DFF@psf.io> https://hg.python.org/cpython/rev/f5d243646fd4 changeset: 101712:f5d243646fd4 parent: 101710:e672cf63d08a parent: 101711:ab974f1ebebe user: Terry Jan Reedy date: Sat Jun 04 15:55:53 2016 -0400 summary: Merge: Revise and synchronize idle_test.test_configdialog. files: Lib/idlelib/idle_test/test_configdialog.py | 17 ++++----- 1 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py --- a/Lib/idlelib/idle_test/test_configdialog.py +++ b/Lib/idlelib/idle_test/test_configdialog.py @@ -1,21 +1,21 @@ '''Test idlelib.configdialog. -Coverage: 46% just by creating dialog. The other half is change code. +Coverage: 46% just by creating dialog. +The other half is code for working with user customizations. ''' +from idlelib.configdialog import ConfigDialog # always test import +from test.support import requires +requires('gui') +from tkinter import Tk import unittest -from test.support import requires -from tkinter import Tk -from idlelib.configdialog import ConfigDialog -from idlelib.macosx import _initializeTkVariantTests - +from idlelib import macosx class ConfigDialogTest(unittest.TestCase): @classmethod def setUpClass(cls): - requires('gui') cls.root = Tk() - _initializeTkVariantTests(cls.root) + macosx._initializeTkVariantTests(cls.root) @classmethod def tearDownClass(cls): @@ -26,7 +26,6 @@ def test_dialog(self): d = ConfigDialog(self.root, 'Test', _utest=True) d.remove_var_callbacks() - d.destroy() if __name__ == '__main__': -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 16:16:29 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 04 Jun 2016 20:16:29 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI0NzU5?= =?utf-8?q?=3A_Add_=27private=27_notice_for_idlelib=2Eidle=5Ftest=2E?= Message-ID: <20160604201628.21399.48965.2D5F0A03@psf.io> https://hg.python.org/cpython/rev/d75a25b3abe1 changeset: 101714:d75a25b3abe1 branch: 3.5 parent: 101711:ab974f1ebebe user: Terry Jan Reedy date: Sat Jun 04 16:15:58 2016 -0400 summary: Issue #24759: Add 'private' notice for idlelib.idle_test. files: Lib/idlelib/idle_test/__init__.py | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/idle_test/__init__.py b/Lib/idlelib/idle_test/__init__.py --- a/Lib/idlelib/idle_test/__init__.py +++ b/Lib/idlelib/idle_test/__init__.py @@ -1,3 +1,9 @@ +'''idlelib.idle_test is a private implementation of test.test_idle, +which tests the IDLE application as part of the stdlib test suite. +Run IDLE tests alone with "python -m test.test_idle". +This package and its contained modules are subject to change and +any direct use is at your own risk. +''' from os.path import dirname def load_tests(loader, standard_tests, pattern): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 16:16:29 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 04 Jun 2016 20:16:29 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI0NzU5?= =?utf-8?q?=3A_Add_=27private=27_notice_for_idlelib=2Eidle=5Ftest=2E?= Message-ID: <20160604201628.15024.80269.97A6CC11@psf.io> https://hg.python.org/cpython/rev/e6560f018845 changeset: 101713:e6560f018845 branch: 2.7 parent: 101702:4d916be61d46 user: Terry Jan Reedy date: Sat Jun 04 16:15:53 2016 -0400 summary: Issue #24759: Add 'private' notice for idlelib.idle_test. files: Lib/idlelib/idle_test/__init__.py | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/idle_test/__init__.py b/Lib/idlelib/idle_test/__init__.py --- a/Lib/idlelib/idle_test/__init__.py +++ b/Lib/idlelib/idle_test/__init__.py @@ -1,3 +1,9 @@ +'''idlelib.idle_test is a private implementation of test.test_idle, +which tests the IDLE application as part of the stdlib test suite. +Run IDLE tests alone with "python -m test.test_idle". +This package and its contained modules are subject to change and +any direct use is at your own risk. +''' from os.path import dirname def load_tests(loader, standard_tests, pattern): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 16:16:31 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 04 Jun 2016 20:16:31 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_with_3=2E5?= Message-ID: <20160604201629.1215.96532.570E3E1D@psf.io> https://hg.python.org/cpython/rev/bf1b0bfc5e43 changeset: 101715:bf1b0bfc5e43 parent: 101712:f5d243646fd4 parent: 101714:d75a25b3abe1 user: Terry Jan Reedy date: Sat Jun 04 16:16:10 2016 -0400 summary: Merge with 3.5 files: Lib/idlelib/idle_test/__init__.py | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/idle_test/__init__.py b/Lib/idlelib/idle_test/__init__.py --- a/Lib/idlelib/idle_test/__init__.py +++ b/Lib/idlelib/idle_test/__init__.py @@ -1,3 +1,9 @@ +'''idlelib.idle_test is a private implementation of test.test_idle, +which tests the IDLE application as part of the stdlib test suite. +Run IDLE tests alone with "python -m test.test_idle". +This package and its contained modules are subject to change and +any direct use is at your own risk. +''' from os.path import dirname def load_tests(loader, standard_tests, pattern): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 16:31:31 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Jun 2016 20:31:31 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzIxOTE2?= =?utf-8?q?=3A_Added_tests_for_the_turtle_module=2E?= Message-ID: <20160604203131.119819.26568.66116E6D@psf.io> https://hg.python.org/cpython/rev/f0b94cfcea45 changeset: 101716:f0b94cfcea45 branch: 2.7 parent: 101702:4d916be61d46 user: Serhiy Storchaka date: Sat Jun 04 23:27:14 2016 +0300 summary: Issue #21916: Added tests for the turtle module. Patch by ingrid, Gregory Loyse and Jelle Zijlstra. files: Lib/test/test_turtle.py | 400 ++++++++++++++++++++++++++++ Misc/NEWS | 3 + 2 files changed, 403 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_turtle.py b/Lib/test/test_turtle.py new file mode 100644 --- /dev/null +++ b/Lib/test/test_turtle.py @@ -0,0 +1,400 @@ +import unittest +from test import test_support as support + +turtle = support.import_module('turtle') +Vec2D = turtle.Vec2D + +test_config = """\ +width = 0.75 +height = 0.8 +canvwidth = 500 +canvheight = 200 +leftright = 100 +topbottom = 100 +mode = world +colormode = 255 +delay = 100 +undobuffersize = 10000 +shape = circle +pencolor = red +fillcolor = blue +resizemode = auto +visible = None +language = english +exampleturtle = turtle +examplescreen = screen +title = Python Turtle Graphics +using_IDLE = '' +""" + +test_config_two = """\ +# Comments! +# Testing comments! +pencolor = red +fillcolor = blue +visible = False +language = english +# Some more +# comments +using_IDLE = False +""" + +invalid_test_config = """ +pencolor = red +fillcolor: blue +visible = False +""" + + +class TurtleConfigTest(unittest.TestCase): + + def get_cfg_file(self, cfg_str): + self.addCleanup(support.unlink, support.TESTFN) + with open(support.TESTFN, 'w') as f: + f.write(cfg_str) + return support.TESTFN + + def test_config_dict(self): + + cfg_name = self.get_cfg_file(test_config) + parsed_cfg = turtle.config_dict(cfg_name) + + expected = { + 'width' : 0.75, + 'height' : 0.8, + 'canvwidth' : 500, + 'canvheight': 200, + 'leftright': 100, + 'topbottom': 100, + 'mode': 'world', + 'colormode': 255, + 'delay': 100, + 'undobuffersize': 10000, + 'shape': 'circle', + 'pencolor' : 'red', + 'fillcolor' : 'blue', + 'resizemode' : 'auto', + 'visible' : None, + 'language': 'english', + 'exampleturtle': 'turtle', + 'examplescreen': 'screen', + 'title': 'Python Turtle Graphics', + 'using_IDLE': '', + } + + self.assertEqual(parsed_cfg, expected) + + def test_partial_config_dict_with_commments(self): + + cfg_name = self.get_cfg_file(test_config_two) + parsed_cfg = turtle.config_dict(cfg_name) + + expected = { + 'pencolor': 'red', + 'fillcolor': 'blue', + 'visible': False, + 'language': 'english', + 'using_IDLE': False, + } + + self.assertEqual(parsed_cfg, expected) + + def test_config_dict_invalid(self): + + cfg_name = self.get_cfg_file(invalid_test_config) + + with support.captured_stdout() as stdout: + parsed_cfg = turtle.config_dict(cfg_name) + + err_msg = stdout.getvalue() + + self.assertIn('Bad line in config-file ', err_msg) + self.assertIn('fillcolor: blue', err_msg) + + self.assertEqual(parsed_cfg, { + 'pencolor': 'red', + 'visible': False, + }) + + +class VectorComparisonMixin: + + def assertVectorsAlmostEqual(self, vec1, vec2): + if len(vec1) != len(vec2): + self.fail("Tuples are not of equal size") + for idx, (i, j) in enumerate(zip(vec1, vec2)): + self.assertAlmostEqual( + i, j, msg='values at index {} do not match'.format(idx)) + + +class TestVec2D(VectorComparisonMixin, unittest.TestCase): + + def _assert_arithmetic_cases(self, test_cases, lambda_operator): + for test_case in test_cases: + ((first, second), expected) = test_case + + op1 = Vec2D(*first) + op2 = Vec2D(*second) + + result = lambda_operator(op1, op2) + + expected = Vec2D(*expected) + + self.assertVectorsAlmostEqual(result, expected) + + def test_vector_addition(self): + + test_cases = [ + (((0, 0), (1, 1)), (1.0, 1.0)), + (((-1, 0), (2, 2)), (1, 2)), + (((1.5, 0), (1, 1)), (2.5, 1)), + ] + + self._assert_arithmetic_cases(test_cases, lambda x, y: x + y) + + def test_vector_subtraction(self): + + test_cases = [ + (((0, 0), (1, 1)), (-1, -1)), + (((10.625, 0.125), (10, 0)), (0.625, 0.125)), + ] + + self._assert_arithmetic_cases(test_cases, lambda x, y: x - y) + + def test_vector_multiply(self): + + vec1 = Vec2D(10, 10) + vec2 = Vec2D(0.5, 3) + answer = vec1 * vec2 + expected = 35 + self.assertAlmostEqual(answer, expected) + + vec = Vec2D(0.5, 3) + answer = vec * 10 + expected = Vec2D(5, 30) + self.assertVectorsAlmostEqual(answer, expected) + + def test_vector_negative(self): + vec = Vec2D(10, -10) + expected = (-10, 10) + self.assertVectorsAlmostEqual(-vec, expected) + + def test_distance(self): + vec = Vec2D(6, 8) + expected = 10 + self.assertEqual(abs(vec), expected) + + vec = Vec2D(0, 0) + expected = 0 + self.assertEqual(abs(vec), expected) + + vec = Vec2D(2.5, 6) + expected = 6.5 + self.assertEqual(abs(vec), expected) + + def test_rotate(self): + + cases = [ + (((0, 0), 0), (0, 0)), + (((0, 1), 90), (-1, 0)), + (((0, 1), -90), (1, 0)), + (((1, 0), 180), (-1, 0)), + (((1, 0), 360), (1, 0)), + ] + + for case in cases: + (vec, rot), expected = case + vec = Vec2D(*vec) + got = vec.rotate(rot) + self.assertVectorsAlmostEqual(got, expected) + + +class TestTNavigator(VectorComparisonMixin, unittest.TestCase): + + def setUp(self): + self.nav = turtle.TNavigator() + + def test_goto(self): + self.nav.goto(100, -100) + self.assertAlmostEqual(self.nav.xcor(), 100) + self.assertAlmostEqual(self.nav.ycor(), -100) + + def test_pos(self): + self.assertEqual(self.nav.pos(), self.nav._position) + self.nav.goto(100, -100) + self.assertEqual(self.nav.pos(), self.nav._position) + + def test_left(self): + self.assertEqual(self.nav._orient, (1.0, 0)) + self.nav.left(90) + self.assertVectorsAlmostEqual(self.nav._orient, (0.0, 1.0)) + + def test_right(self): + self.assertEqual(self.nav._orient, (1.0, 0)) + self.nav.right(90) + self.assertVectorsAlmostEqual(self.nav._orient, (0, -1.0)) + + def test_reset(self): + self.nav.goto(100, -100) + self.assertAlmostEqual(self.nav.xcor(), 100) + self.assertAlmostEqual(self.nav.ycor(), -100) + self.nav.reset() + self.assertAlmostEqual(self.nav.xcor(), 0) + self.assertAlmostEqual(self.nav.ycor(), 0) + + def test_forward(self): + self.nav.forward(150) + expected = Vec2D(150, 0) + self.assertVectorsAlmostEqual(self.nav.position(), expected) + + self.nav.reset() + self.nav.left(90) + self.nav.forward(150) + expected = Vec2D(0, 150) + self.assertVectorsAlmostEqual(self.nav.position(), expected) + + self.assertRaises(TypeError, self.nav.forward, 'skldjfldsk') + + def test_backwards(self): + self.nav.back(200) + expected = Vec2D(-200, 0) + self.assertVectorsAlmostEqual(self.nav.position(), expected) + + self.nav.reset() + self.nav.right(90) + self.nav.back(200) + expected = Vec2D(0, 200) + self.assertVectorsAlmostEqual(self.nav.position(), expected) + + def test_distance(self): + self.nav.forward(100) + expected = 100 + self.assertAlmostEqual(self.nav.distance(Vec2D(0,0)), expected) + + def test_radians_and_degrees(self): + self.nav.left(90) + self.assertAlmostEqual(self.nav.heading(), 90) + self.nav.radians() + self.assertAlmostEqual(self.nav.heading(), 1.57079633) + self.nav.degrees() + self.assertAlmostEqual(self.nav.heading(), 90) + + def test_towards(self): + + coordinates = [ + # coordinates, expected + ((100, 0), 0.0), + ((100, 100), 45.0), + ((0, 100), 90.0), + ((-100, 100), 135.0), + ((-100, 0), 180.0), + ((-100, -100), 225.0), + ((0, -100), 270.0), + ((100, -100), 315.0), + ] + + for (x, y), expected in coordinates: + self.assertEqual(self.nav.towards(x, y), expected) + self.assertEqual(self.nav.towards((x, y)), expected) + self.assertEqual(self.nav.towards(Vec2D(x, y)), expected) + + def test_heading(self): + + self.nav.left(90) + self.assertAlmostEqual(self.nav.heading(), 90) + self.nav.left(45) + self.assertAlmostEqual(self.nav.heading(), 135) + self.nav.right(1.6) + self.assertAlmostEqual(self.nav.heading(), 133.4) + self.assertRaises(TypeError, self.nav.right, 'sdkfjdsf') + self.nav.reset() + + rotations = [10, 20, 170, 300] + result = sum(rotations) % 360 + for num in rotations: + self.nav.left(num) + self.assertEqual(self.nav.heading(), result) + self.nav.reset() + + result = (360-sum(rotations)) % 360 + for num in rotations: + self.nav.right(num) + self.assertEqual(self.nav.heading(), result) + self.nav.reset() + + rotations = [10, 20, -170, 300, -210, 34.3, -50.2, -10, -29.98, 500] + sum_so_far = 0 + for num in rotations: + if num < 0: + self.nav.right(abs(num)) + else: + self.nav.left(num) + sum_so_far += num + self.assertAlmostEqual(self.nav.heading(), sum_so_far % 360) + + def test_setheading(self): + self.nav.setheading(102.32) + self.assertAlmostEqual(self.nav.heading(), 102.32) + self.nav.setheading(-123.23) + self.assertAlmostEqual(self.nav.heading(), (-123.23) % 360) + self.nav.setheading(-1000.34) + self.assertAlmostEqual(self.nav.heading(), (-1000.34) % 360) + self.nav.setheading(300000) + self.assertAlmostEqual(self.nav.heading(), 300000%360) + + def test_positions(self): + self.nav.forward(100) + self.nav.left(90) + self.nav.forward(-200) + self.assertVectorsAlmostEqual(self.nav.pos(), (100.0, -200.0)) + + def test_setx_and_sety(self): + self.nav.setx(-1023.2334) + self.nav.sety(193323.234) + self.assertVectorsAlmostEqual(self.nav.pos(), (-1023.2334, 193323.234)) + + def test_home(self): + self.nav.left(30) + self.nav.forward(-100000) + self.nav.home() + self.assertVectorsAlmostEqual(self.nav.pos(), (0,0)) + self.assertAlmostEqual(self.nav.heading(), 0) + + def test_distance_method(self): + self.assertAlmostEqual(self.nav.distance(30, 40), 50) + vec = Vec2D(0.22, .001) + self.assertAlmostEqual(self.nav.distance(vec), 0.22000227271553355) + another_turtle = turtle.TNavigator() + another_turtle.left(90) + another_turtle.forward(10000) + self.assertAlmostEqual(self.nav.distance(another_turtle), 10000) + + +class TestTPen(unittest.TestCase): + + def test_pendown_and_penup(self): + + tpen = turtle.TPen() + + self.assertTrue(tpen.isdown()) + tpen.penup() + self.assertFalse(tpen.isdown()) + tpen.pendown() + self.assertTrue(tpen.isdown()) + + def test_showturtle_hideturtle_and_isvisible(self): + + tpen = turtle.TPen() + + self.assertTrue(tpen.isvisible()) + tpen.hideturtle() + self.assertFalse(tpen.isvisible()) + tpen.showturtle() + self.assertTrue(tpen.isvisible()) + + +def test_main(): + support.run_unittest(TurtleConfigTest, TestVec2D, TestTNavigator, TestTPen) + +if __name__ == '__main__': + test_main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -296,6 +296,9 @@ Tests ----- +- Issue #21916: Added tests for the turtle module. Patch by ingrid, + Gregory Loyse and Jelle Zijlstra. + - Issue #25940: Changed test_ssl to use self-signed.pythontest.net. This avoids relying on svn.python.org, which recently changed root certificate. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 16:31:32 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Jun 2016 20:31:32 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf-8?q?_Merge_heads?= Message-ID: <20160604203132.13384.33123.070BF10E@psf.io> https://hg.python.org/cpython/rev/bf551ee0781a changeset: 101719:bf551ee0781a branch: 2.7 parent: 101716:f0b94cfcea45 parent: 101713:e6560f018845 user: Serhiy Storchaka date: Sat Jun 04 23:30:24 2016 +0300 summary: Merge heads files: Lib/idlelib/idle_test/__init__.py | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/idle_test/__init__.py b/Lib/idlelib/idle_test/__init__.py --- a/Lib/idlelib/idle_test/__init__.py +++ b/Lib/idlelib/idle_test/__init__.py @@ -1,3 +1,9 @@ +'''idlelib.idle_test is a private implementation of test.test_idle, +which tests the IDLE application as part of the stdlib test suite. +Run IDLE tests alone with "python -m test.test_idle". +This package and its contained modules are subject to change and +any direct use is at your own risk. +''' from os.path import dirname def load_tests(loader, standard_tests, pattern): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 16:31:32 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Jun 2016 20:31:32 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Null_merge?= Message-ID: <20160604203132.21201.61649.1709F058@psf.io> https://hg.python.org/cpython/rev/6e6afc4aee57 changeset: 101722:6e6afc4aee57 parent: 101721:f5a9a6504230 parent: 101720:b7d65f384cf5 user: Serhiy Storchaka date: Sat Jun 04 23:31:05 2016 +0300 summary: Null merge files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 16:31:32 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Jun 2016 20:31:32 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?q?=29=3A_Merge_heads?= Message-ID: <20160604203132.13672.82585.BA0CA25F@psf.io> https://hg.python.org/cpython/rev/f5a9a6504230 changeset: 101721:f5a9a6504230 parent: 101718:3d1a23984a6e parent: 101715:bf1b0bfc5e43 user: Serhiy Storchaka date: Sat Jun 04 23:30:53 2016 +0300 summary: Merge heads files: Lib/idlelib/idle_test/__init__.py | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/idle_test/__init__.py b/Lib/idlelib/idle_test/__init__.py --- a/Lib/idlelib/idle_test/__init__.py +++ b/Lib/idlelib/idle_test/__init__.py @@ -1,3 +1,9 @@ +'''idlelib.idle_test is a private implementation of test.test_idle, +which tests the IDLE application as part of the stdlib test suite. +Run IDLE tests alone with "python -m test.test_idle". +This package and its contained modules are subject to change and +any direct use is at your own risk. +''' from os.path import dirname def load_tests(loader, standard_tests, pattern): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 16:31:36 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Jun 2016 20:31:36 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNSk6?= =?utf-8?q?_Merge_heads?= Message-ID: <20160604203132.1411.93817.B8C99FEC@psf.io> https://hg.python.org/cpython/rev/b7d65f384cf5 changeset: 101720:b7d65f384cf5 branch: 3.5 parent: 101717:3b9e96440a70 parent: 101714:d75a25b3abe1 user: Serhiy Storchaka date: Sat Jun 04 23:30:45 2016 +0300 summary: Merge heads files: Lib/idlelib/idle_test/__init__.py | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/idle_test/__init__.py b/Lib/idlelib/idle_test/__init__.py --- a/Lib/idlelib/idle_test/__init__.py +++ b/Lib/idlelib/idle_test/__init__.py @@ -1,3 +1,9 @@ +'''idlelib.idle_test is a private implementation of test.test_idle, +which tests the IDLE application as part of the stdlib test suite. +Run IDLE tests alone with "python -m test.test_idle". +This package and its contained modules are subject to change and +any direct use is at your own risk. +''' from os.path import dirname def load_tests(loader, standard_tests, pattern): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 16:31:36 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Jun 2016 20:31:36 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2321916=3A_Added_tests_for_the_turtle_module=2E?= Message-ID: <20160604203132.100840.82680.411FB33F@psf.io> https://hg.python.org/cpython/rev/3d1a23984a6e changeset: 101718:3d1a23984a6e parent: 101712:f5d243646fd4 parent: 101717:3b9e96440a70 user: Serhiy Storchaka date: Sat Jun 04 23:28:40 2016 +0300 summary: Issue #21916: Added tests for the turtle module. Patch by ingrid, Gregory Loyse and Jelle Zijlstra. files: Lib/test/test_turtle.py | 400 ++++++++++++++++++++++++++++ Misc/NEWS | 3 + 2 files changed, 403 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_turtle.py b/Lib/test/test_turtle.py new file mode 100644 --- /dev/null +++ b/Lib/test/test_turtle.py @@ -0,0 +1,400 @@ +import unittest +from test import support + +turtle = support.import_module('turtle') +Vec2D = turtle.Vec2D + +test_config = """\ +width = 0.75 +height = 0.8 +canvwidth = 500 +canvheight = 200 +leftright = 100 +topbottom = 100 +mode = world +colormode = 255 +delay = 100 +undobuffersize = 10000 +shape = circle +pencolor = red +fillcolor = blue +resizemode = auto +visible = None +language = english +exampleturtle = turtle +examplescreen = screen +title = Python Turtle Graphics +using_IDLE = '' +""" + +test_config_two = """\ +# Comments! +# Testing comments! +pencolor = red +fillcolor = blue +visible = False +language = english +# Some more +# comments +using_IDLE = False +""" + +invalid_test_config = """ +pencolor = red +fillcolor: blue +visible = False +""" + + +class TurtleConfigTest(unittest.TestCase): + + def get_cfg_file(self, cfg_str): + self.addCleanup(support.unlink, support.TESTFN) + with open(support.TESTFN, 'w') as f: + f.write(cfg_str) + return support.TESTFN + + def test_config_dict(self): + + cfg_name = self.get_cfg_file(test_config) + parsed_cfg = turtle.config_dict(cfg_name) + + expected = { + 'width' : 0.75, + 'height' : 0.8, + 'canvwidth' : 500, + 'canvheight': 200, + 'leftright': 100, + 'topbottom': 100, + 'mode': 'world', + 'colormode': 255, + 'delay': 100, + 'undobuffersize': 10000, + 'shape': 'circle', + 'pencolor' : 'red', + 'fillcolor' : 'blue', + 'resizemode' : 'auto', + 'visible' : None, + 'language': 'english', + 'exampleturtle': 'turtle', + 'examplescreen': 'screen', + 'title': 'Python Turtle Graphics', + 'using_IDLE': '', + } + + self.assertEqual(parsed_cfg, expected) + + def test_partial_config_dict_with_commments(self): + + cfg_name = self.get_cfg_file(test_config_two) + parsed_cfg = turtle.config_dict(cfg_name) + + expected = { + 'pencolor': 'red', + 'fillcolor': 'blue', + 'visible': False, + 'language': 'english', + 'using_IDLE': False, + } + + self.assertEqual(parsed_cfg, expected) + + def test_config_dict_invalid(self): + + cfg_name = self.get_cfg_file(invalid_test_config) + + with support.captured_stdout() as stdout: + parsed_cfg = turtle.config_dict(cfg_name) + + err_msg = stdout.getvalue() + + self.assertIn('Bad line in config-file ', err_msg) + self.assertIn('fillcolor: blue', err_msg) + + self.assertEqual(parsed_cfg, { + 'pencolor': 'red', + 'visible': False, + }) + + +class VectorComparisonMixin: + + def assertVectorsAlmostEqual(self, vec1, vec2): + if len(vec1) != len(vec2): + self.fail("Tuples are not of equal size") + for idx, (i, j) in enumerate(zip(vec1, vec2)): + self.assertAlmostEqual( + i, j, msg='values at index {} do not match'.format(idx)) + + +class TestVec2D(VectorComparisonMixin, unittest.TestCase): + + def _assert_arithmetic_cases(self, test_cases, lambda_operator): + for test_case in test_cases: + with self.subTest(case=test_case): + + ((first, second), expected) = test_case + + op1 = Vec2D(*first) + op2 = Vec2D(*second) + + result = lambda_operator(op1, op2) + + expected = Vec2D(*expected) + + self.assertVectorsAlmostEqual(result, expected) + + def test_vector_addition(self): + + test_cases = [ + (((0, 0), (1, 1)), (1.0, 1.0)), + (((-1, 0), (2, 2)), (1, 2)), + (((1.5, 0), (1, 1)), (2.5, 1)), + ] + + self._assert_arithmetic_cases(test_cases, lambda x, y: x + y) + + def test_vector_subtraction(self): + + test_cases = [ + (((0, 0), (1, 1)), (-1, -1)), + (((10.625, 0.125), (10, 0)), (0.625, 0.125)), + ] + + self._assert_arithmetic_cases(test_cases, lambda x, y: x - y) + + def test_vector_multiply(self): + + vec1 = Vec2D(10, 10) + vec2 = Vec2D(0.5, 3) + answer = vec1 * vec2 + expected = 35 + self.assertAlmostEqual(answer, expected) + + vec = Vec2D(0.5, 3) + answer = vec * 10 + expected = Vec2D(5, 30) + self.assertVectorsAlmostEqual(answer, expected) + + def test_vector_negative(self): + vec = Vec2D(10, -10) + expected = (-10, 10) + self.assertVectorsAlmostEqual(-vec, expected) + + def test_distance(self): + vec = Vec2D(6, 8) + expected = 10 + self.assertEqual(abs(vec), expected) + + vec = Vec2D(0, 0) + expected = 0 + self.assertEqual(abs(vec), expected) + + vec = Vec2D(2.5, 6) + expected = 6.5 + self.assertEqual(abs(vec), expected) + + def test_rotate(self): + + cases = [ + (((0, 0), 0), (0, 0)), + (((0, 1), 90), (-1, 0)), + (((0, 1), -90), (1, 0)), + (((1, 0), 180), (-1, 0)), + (((1, 0), 360), (1, 0)), + ] + + for case in cases: + with self.subTest(case=case): + (vec, rot), expected = case + vec = Vec2D(*vec) + got = vec.rotate(rot) + self.assertVectorsAlmostEqual(got, expected) + + +class TestTNavigator(VectorComparisonMixin, unittest.TestCase): + + def setUp(self): + self.nav = turtle.TNavigator() + + def test_goto(self): + self.nav.goto(100, -100) + self.assertAlmostEqual(self.nav.xcor(), 100) + self.assertAlmostEqual(self.nav.ycor(), -100) + + def test_pos(self): + self.assertEqual(self.nav.pos(), self.nav._position) + self.nav.goto(100, -100) + self.assertEqual(self.nav.pos(), self.nav._position) + + def test_left(self): + self.assertEqual(self.nav._orient, (1.0, 0)) + self.nav.left(90) + self.assertVectorsAlmostEqual(self.nav._orient, (0.0, 1.0)) + + def test_right(self): + self.assertEqual(self.nav._orient, (1.0, 0)) + self.nav.right(90) + self.assertVectorsAlmostEqual(self.nav._orient, (0, -1.0)) + + def test_reset(self): + self.nav.goto(100, -100) + self.assertAlmostEqual(self.nav.xcor(), 100) + self.assertAlmostEqual(self.nav.ycor(), -100) + self.nav.reset() + self.assertAlmostEqual(self.nav.xcor(), 0) + self.assertAlmostEqual(self.nav.ycor(), 0) + + def test_forward(self): + self.nav.forward(150) + expected = Vec2D(150, 0) + self.assertVectorsAlmostEqual(self.nav.position(), expected) + + self.nav.reset() + self.nav.left(90) + self.nav.forward(150) + expected = Vec2D(0, 150) + self.assertVectorsAlmostEqual(self.nav.position(), expected) + + self.assertRaises(TypeError, self.nav.forward, 'skldjfldsk') + + def test_backwards(self): + self.nav.back(200) + expected = Vec2D(-200, 0) + self.assertVectorsAlmostEqual(self.nav.position(), expected) + + self.nav.reset() + self.nav.right(90) + self.nav.back(200) + expected = Vec2D(0, 200) + self.assertVectorsAlmostEqual(self.nav.position(), expected) + + def test_distance(self): + self.nav.forward(100) + expected = 100 + self.assertAlmostEqual(self.nav.distance(Vec2D(0,0)), expected) + + def test_radians_and_degrees(self): + self.nav.left(90) + self.assertAlmostEqual(self.nav.heading(), 90) + self.nav.radians() + self.assertAlmostEqual(self.nav.heading(), 1.57079633) + self.nav.degrees() + self.assertAlmostEqual(self.nav.heading(), 90) + + def test_towards(self): + + coordinates = [ + # coordinates, expected + ((100, 0), 0.0), + ((100, 100), 45.0), + ((0, 100), 90.0), + ((-100, 100), 135.0), + ((-100, 0), 180.0), + ((-100, -100), 225.0), + ((0, -100), 270.0), + ((100, -100), 315.0), + ] + + for (x, y), expected in coordinates: + self.assertEqual(self.nav.towards(x, y), expected) + self.assertEqual(self.nav.towards((x, y)), expected) + self.assertEqual(self.nav.towards(Vec2D(x, y)), expected) + + def test_heading(self): + + self.nav.left(90) + self.assertAlmostEqual(self.nav.heading(), 90) + self.nav.left(45) + self.assertAlmostEqual(self.nav.heading(), 135) + self.nav.right(1.6) + self.assertAlmostEqual(self.nav.heading(), 133.4) + self.assertRaises(TypeError, self.nav.right, 'sdkfjdsf') + self.nav.reset() + + rotations = [10, 20, 170, 300] + result = sum(rotations) % 360 + for num in rotations: + self.nav.left(num) + self.assertEqual(self.nav.heading(), result) + self.nav.reset() + + result = (360-sum(rotations)) % 360 + for num in rotations: + self.nav.right(num) + self.assertEqual(self.nav.heading(), result) + self.nav.reset() + + rotations = [10, 20, -170, 300, -210, 34.3, -50.2, -10, -29.98, 500] + sum_so_far = 0 + for num in rotations: + if num < 0: + self.nav.right(abs(num)) + else: + self.nav.left(num) + sum_so_far += num + self.assertAlmostEqual(self.nav.heading(), sum_so_far % 360) + + def test_setheading(self): + self.nav.setheading(102.32) + self.assertAlmostEqual(self.nav.heading(), 102.32) + self.nav.setheading(-123.23) + self.assertAlmostEqual(self.nav.heading(), (-123.23) % 360) + self.nav.setheading(-1000.34) + self.assertAlmostEqual(self.nav.heading(), (-1000.34) % 360) + self.nav.setheading(300000) + self.assertAlmostEqual(self.nav.heading(), 300000%360) + + def test_positions(self): + self.nav.forward(100) + self.nav.left(90) + self.nav.forward(-200) + self.assertVectorsAlmostEqual(self.nav.pos(), (100.0, -200.0)) + + def test_setx_and_sety(self): + self.nav.setx(-1023.2334) + self.nav.sety(193323.234) + self.assertVectorsAlmostEqual(self.nav.pos(), (-1023.2334, 193323.234)) + + def test_home(self): + self.nav.left(30) + self.nav.forward(-100000) + self.nav.home() + self.assertVectorsAlmostEqual(self.nav.pos(), (0,0)) + self.assertAlmostEqual(self.nav.heading(), 0) + + def test_distance_method(self): + self.assertAlmostEqual(self.nav.distance(30, 40), 50) + vec = Vec2D(0.22, .001) + self.assertAlmostEqual(self.nav.distance(vec), 0.22000227271553355) + another_turtle = turtle.TNavigator() + another_turtle.left(90) + another_turtle.forward(10000) + self.assertAlmostEqual(self.nav.distance(another_turtle), 10000) + + +class TestTPen(unittest.TestCase): + + def test_pendown_and_penup(self): + + tpen = turtle.TPen() + + self.assertTrue(tpen.isdown()) + tpen.penup() + self.assertFalse(tpen.isdown()) + tpen.pendown() + self.assertTrue(tpen.isdown()) + + def test_showturtle_hideturtle_and_isvisible(self): + + tpen = turtle.TPen() + + self.assertTrue(tpen.isvisible()) + tpen.hideturtle() + self.assertFalse(tpen.isvisible()) + tpen.showturtle() + self.assertTrue(tpen.isvisible()) + + +if __name__ == '__main__': + unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1238,6 +1238,9 @@ Tests ----- +- Issue #21916: Added tests for the turtle module. Patch by ingrid, + Gregory Loyse and Jelle Zijlstra. + - Issue #26295: When using "python3 -m test --testdir=TESTDIR", regrtest doesn't add "test." prefix to test module names. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 16:31:36 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Jun 2016 20:31:36 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIxOTE2?= =?utf-8?q?=3A_Added_tests_for_the_turtle_module=2E?= Message-ID: <20160604203131.13470.1372.93C171B2@psf.io> https://hg.python.org/cpython/rev/3b9e96440a70 changeset: 101717:3b9e96440a70 branch: 3.5 parent: 101711:ab974f1ebebe user: Serhiy Storchaka date: Sat Jun 04 23:27:26 2016 +0300 summary: Issue #21916: Added tests for the turtle module. Patch by ingrid, Gregory Loyse and Jelle Zijlstra. files: Lib/test/test_turtle.py | 400 ++++++++++++++++++++++++++++ Misc/NEWS | 3 + 2 files changed, 403 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_turtle.py b/Lib/test/test_turtle.py new file mode 100644 --- /dev/null +++ b/Lib/test/test_turtle.py @@ -0,0 +1,400 @@ +import unittest +from test import support + +turtle = support.import_module('turtle') +Vec2D = turtle.Vec2D + +test_config = """\ +width = 0.75 +height = 0.8 +canvwidth = 500 +canvheight = 200 +leftright = 100 +topbottom = 100 +mode = world +colormode = 255 +delay = 100 +undobuffersize = 10000 +shape = circle +pencolor = red +fillcolor = blue +resizemode = auto +visible = None +language = english +exampleturtle = turtle +examplescreen = screen +title = Python Turtle Graphics +using_IDLE = '' +""" + +test_config_two = """\ +# Comments! +# Testing comments! +pencolor = red +fillcolor = blue +visible = False +language = english +# Some more +# comments +using_IDLE = False +""" + +invalid_test_config = """ +pencolor = red +fillcolor: blue +visible = False +""" + + +class TurtleConfigTest(unittest.TestCase): + + def get_cfg_file(self, cfg_str): + self.addCleanup(support.unlink, support.TESTFN) + with open(support.TESTFN, 'w') as f: + f.write(cfg_str) + return support.TESTFN + + def test_config_dict(self): + + cfg_name = self.get_cfg_file(test_config) + parsed_cfg = turtle.config_dict(cfg_name) + + expected = { + 'width' : 0.75, + 'height' : 0.8, + 'canvwidth' : 500, + 'canvheight': 200, + 'leftright': 100, + 'topbottom': 100, + 'mode': 'world', + 'colormode': 255, + 'delay': 100, + 'undobuffersize': 10000, + 'shape': 'circle', + 'pencolor' : 'red', + 'fillcolor' : 'blue', + 'resizemode' : 'auto', + 'visible' : None, + 'language': 'english', + 'exampleturtle': 'turtle', + 'examplescreen': 'screen', + 'title': 'Python Turtle Graphics', + 'using_IDLE': '', + } + + self.assertEqual(parsed_cfg, expected) + + def test_partial_config_dict_with_commments(self): + + cfg_name = self.get_cfg_file(test_config_two) + parsed_cfg = turtle.config_dict(cfg_name) + + expected = { + 'pencolor': 'red', + 'fillcolor': 'blue', + 'visible': False, + 'language': 'english', + 'using_IDLE': False, + } + + self.assertEqual(parsed_cfg, expected) + + def test_config_dict_invalid(self): + + cfg_name = self.get_cfg_file(invalid_test_config) + + with support.captured_stdout() as stdout: + parsed_cfg = turtle.config_dict(cfg_name) + + err_msg = stdout.getvalue() + + self.assertIn('Bad line in config-file ', err_msg) + self.assertIn('fillcolor: blue', err_msg) + + self.assertEqual(parsed_cfg, { + 'pencolor': 'red', + 'visible': False, + }) + + +class VectorComparisonMixin: + + def assertVectorsAlmostEqual(self, vec1, vec2): + if len(vec1) != len(vec2): + self.fail("Tuples are not of equal size") + for idx, (i, j) in enumerate(zip(vec1, vec2)): + self.assertAlmostEqual( + i, j, msg='values at index {} do not match'.format(idx)) + + +class TestVec2D(VectorComparisonMixin, unittest.TestCase): + + def _assert_arithmetic_cases(self, test_cases, lambda_operator): + for test_case in test_cases: + with self.subTest(case=test_case): + + ((first, second), expected) = test_case + + op1 = Vec2D(*first) + op2 = Vec2D(*second) + + result = lambda_operator(op1, op2) + + expected = Vec2D(*expected) + + self.assertVectorsAlmostEqual(result, expected) + + def test_vector_addition(self): + + test_cases = [ + (((0, 0), (1, 1)), (1.0, 1.0)), + (((-1, 0), (2, 2)), (1, 2)), + (((1.5, 0), (1, 1)), (2.5, 1)), + ] + + self._assert_arithmetic_cases(test_cases, lambda x, y: x + y) + + def test_vector_subtraction(self): + + test_cases = [ + (((0, 0), (1, 1)), (-1, -1)), + (((10.625, 0.125), (10, 0)), (0.625, 0.125)), + ] + + self._assert_arithmetic_cases(test_cases, lambda x, y: x - y) + + def test_vector_multiply(self): + + vec1 = Vec2D(10, 10) + vec2 = Vec2D(0.5, 3) + answer = vec1 * vec2 + expected = 35 + self.assertAlmostEqual(answer, expected) + + vec = Vec2D(0.5, 3) + answer = vec * 10 + expected = Vec2D(5, 30) + self.assertVectorsAlmostEqual(answer, expected) + + def test_vector_negative(self): + vec = Vec2D(10, -10) + expected = (-10, 10) + self.assertVectorsAlmostEqual(-vec, expected) + + def test_distance(self): + vec = Vec2D(6, 8) + expected = 10 + self.assertEqual(abs(vec), expected) + + vec = Vec2D(0, 0) + expected = 0 + self.assertEqual(abs(vec), expected) + + vec = Vec2D(2.5, 6) + expected = 6.5 + self.assertEqual(abs(vec), expected) + + def test_rotate(self): + + cases = [ + (((0, 0), 0), (0, 0)), + (((0, 1), 90), (-1, 0)), + (((0, 1), -90), (1, 0)), + (((1, 0), 180), (-1, 0)), + (((1, 0), 360), (1, 0)), + ] + + for case in cases: + with self.subTest(case=case): + (vec, rot), expected = case + vec = Vec2D(*vec) + got = vec.rotate(rot) + self.assertVectorsAlmostEqual(got, expected) + + +class TestTNavigator(VectorComparisonMixin, unittest.TestCase): + + def setUp(self): + self.nav = turtle.TNavigator() + + def test_goto(self): + self.nav.goto(100, -100) + self.assertAlmostEqual(self.nav.xcor(), 100) + self.assertAlmostEqual(self.nav.ycor(), -100) + + def test_pos(self): + self.assertEqual(self.nav.pos(), self.nav._position) + self.nav.goto(100, -100) + self.assertEqual(self.nav.pos(), self.nav._position) + + def test_left(self): + self.assertEqual(self.nav._orient, (1.0, 0)) + self.nav.left(90) + self.assertVectorsAlmostEqual(self.nav._orient, (0.0, 1.0)) + + def test_right(self): + self.assertEqual(self.nav._orient, (1.0, 0)) + self.nav.right(90) + self.assertVectorsAlmostEqual(self.nav._orient, (0, -1.0)) + + def test_reset(self): + self.nav.goto(100, -100) + self.assertAlmostEqual(self.nav.xcor(), 100) + self.assertAlmostEqual(self.nav.ycor(), -100) + self.nav.reset() + self.assertAlmostEqual(self.nav.xcor(), 0) + self.assertAlmostEqual(self.nav.ycor(), 0) + + def test_forward(self): + self.nav.forward(150) + expected = Vec2D(150, 0) + self.assertVectorsAlmostEqual(self.nav.position(), expected) + + self.nav.reset() + self.nav.left(90) + self.nav.forward(150) + expected = Vec2D(0, 150) + self.assertVectorsAlmostEqual(self.nav.position(), expected) + + self.assertRaises(TypeError, self.nav.forward, 'skldjfldsk') + + def test_backwards(self): + self.nav.back(200) + expected = Vec2D(-200, 0) + self.assertVectorsAlmostEqual(self.nav.position(), expected) + + self.nav.reset() + self.nav.right(90) + self.nav.back(200) + expected = Vec2D(0, 200) + self.assertVectorsAlmostEqual(self.nav.position(), expected) + + def test_distance(self): + self.nav.forward(100) + expected = 100 + self.assertAlmostEqual(self.nav.distance(Vec2D(0,0)), expected) + + def test_radians_and_degrees(self): + self.nav.left(90) + self.assertAlmostEqual(self.nav.heading(), 90) + self.nav.radians() + self.assertAlmostEqual(self.nav.heading(), 1.57079633) + self.nav.degrees() + self.assertAlmostEqual(self.nav.heading(), 90) + + def test_towards(self): + + coordinates = [ + # coordinates, expected + ((100, 0), 0.0), + ((100, 100), 45.0), + ((0, 100), 90.0), + ((-100, 100), 135.0), + ((-100, 0), 180.0), + ((-100, -100), 225.0), + ((0, -100), 270.0), + ((100, -100), 315.0), + ] + + for (x, y), expected in coordinates: + self.assertEqual(self.nav.towards(x, y), expected) + self.assertEqual(self.nav.towards((x, y)), expected) + self.assertEqual(self.nav.towards(Vec2D(x, y)), expected) + + def test_heading(self): + + self.nav.left(90) + self.assertAlmostEqual(self.nav.heading(), 90) + self.nav.left(45) + self.assertAlmostEqual(self.nav.heading(), 135) + self.nav.right(1.6) + self.assertAlmostEqual(self.nav.heading(), 133.4) + self.assertRaises(TypeError, self.nav.right, 'sdkfjdsf') + self.nav.reset() + + rotations = [10, 20, 170, 300] + result = sum(rotations) % 360 + for num in rotations: + self.nav.left(num) + self.assertEqual(self.nav.heading(), result) + self.nav.reset() + + result = (360-sum(rotations)) % 360 + for num in rotations: + self.nav.right(num) + self.assertEqual(self.nav.heading(), result) + self.nav.reset() + + rotations = [10, 20, -170, 300, -210, 34.3, -50.2, -10, -29.98, 500] + sum_so_far = 0 + for num in rotations: + if num < 0: + self.nav.right(abs(num)) + else: + self.nav.left(num) + sum_so_far += num + self.assertAlmostEqual(self.nav.heading(), sum_so_far % 360) + + def test_setheading(self): + self.nav.setheading(102.32) + self.assertAlmostEqual(self.nav.heading(), 102.32) + self.nav.setheading(-123.23) + self.assertAlmostEqual(self.nav.heading(), (-123.23) % 360) + self.nav.setheading(-1000.34) + self.assertAlmostEqual(self.nav.heading(), (-1000.34) % 360) + self.nav.setheading(300000) + self.assertAlmostEqual(self.nav.heading(), 300000%360) + + def test_positions(self): + self.nav.forward(100) + self.nav.left(90) + self.nav.forward(-200) + self.assertVectorsAlmostEqual(self.nav.pos(), (100.0, -200.0)) + + def test_setx_and_sety(self): + self.nav.setx(-1023.2334) + self.nav.sety(193323.234) + self.assertVectorsAlmostEqual(self.nav.pos(), (-1023.2334, 193323.234)) + + def test_home(self): + self.nav.left(30) + self.nav.forward(-100000) + self.nav.home() + self.assertVectorsAlmostEqual(self.nav.pos(), (0,0)) + self.assertAlmostEqual(self.nav.heading(), 0) + + def test_distance_method(self): + self.assertAlmostEqual(self.nav.distance(30, 40), 50) + vec = Vec2D(0.22, .001) + self.assertAlmostEqual(self.nav.distance(vec), 0.22000227271553355) + another_turtle = turtle.TNavigator() + another_turtle.left(90) + another_turtle.forward(10000) + self.assertAlmostEqual(self.nav.distance(another_turtle), 10000) + + +class TestTPen(unittest.TestCase): + + def test_pendown_and_penup(self): + + tpen = turtle.TPen() + + self.assertTrue(tpen.isdown()) + tpen.penup() + self.assertFalse(tpen.isdown()) + tpen.pendown() + self.assertTrue(tpen.isdown()) + + def test_showturtle_hideturtle_and_isvisible(self): + + tpen = turtle.TPen() + + self.assertTrue(tpen.isvisible()) + tpen.hideturtle() + self.assertFalse(tpen.isvisible()) + tpen.showturtle() + self.assertTrue(tpen.isvisible()) + + +if __name__ == '__main__': + unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -538,6 +538,9 @@ Tests ----- +- Issue #21916: Added tests for the turtle module. Patch by ingrid, + Gregory Loyse and Jelle Zijlstra. + - Issue #26523: The multiprocessing thread pool (multiprocessing.dummy.Pool) was untested. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 16:48:07 2016 From: python-checkins at python.org (ethan.furman) Date: Sat, 04 Jun 2016 20:48:07 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_issue27186=3A_fix_fsencode?= =?utf-8?q?/fsdecode_and_update_tests=3B_patch_by_Jelle_Zijlstra?= Message-ID: <20160604204807.13742.58104.3FB66E47@psf.io> https://hg.python.org/cpython/rev/76b2ddaee6bd changeset: 101723:76b2ddaee6bd user: Ethan Furman date: Sat Jun 04 13:47:39 2016 -0700 summary: issue27186: fix fsencode/fsdecode and update tests; patch by Jelle Zijlstra files: Lib/os.py | 4 ++-- Lib/test/test_os.py | 21 ++++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Lib/os.py b/Lib/os.py --- a/Lib/os.py +++ b/Lib/os.py @@ -889,7 +889,7 @@ return filename.encode(encoding, errors) else: raise TypeError("expected str, bytes or os.PathLike object, not " - + path_type.__name__) + + type(filename).__name__) def fsdecode(filename): """ @@ -905,7 +905,7 @@ return filename.decode(encoding, errors) else: raise TypeError("expected str, bytes or os.PathLike object, not " - + path_type.__name__) + + type(filename).__name__) return fsencode, fsdecode 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 @@ -3107,29 +3107,36 @@ self.assertEqual(s, os.fspath(s)) def test_fsencode_fsdecode_return_pathlike(self): - class Pathlike: + class PathLike: def __init__(self, path): self.path = path - def __fspath__(self): return self.path for p in "path/like/object", b"path/like/object": - pathlike = Pathlike(p) + pathlike = PathLike(p) self.assertEqual(p, os.fspath(pathlike)) self.assertEqual(b"path/like/object", os.fsencode(pathlike)) self.assertEqual("path/like/object", os.fsdecode(pathlike)) def test_fspathlike(self): - class PathLike(object): + class PathLike: + def __init__(self, path=''): + self.path = path def __fspath__(self): - return '#feelthegil' - - self.assertEqual('#feelthegil', os.fspath(PathLike())) + return self.path + + self.assertEqual('#feelthegil', os.fspath(PathLike('#feelthegil'))) self.assertTrue(issubclass(PathLike, os.PathLike)) self.assertTrue(isinstance(PathLike(), os.PathLike)) + message = 'expected str, bytes or os.PathLike object, not' + for fn in (os.fsencode, os.fsdecode): + for obj in PathLike(None), None: + with self.assertRaisesRegex(TypeError, message): + fn(obj) + def test_garbage_in_exception_out(self): vapor = type('blah', (), {}) for o in int, type, os, vapor(): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 17:39:13 2016 From: python-checkins at python.org (ethan.furman) Date: Sat, 04 Jun 2016 21:39:13 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_issue27186=3A_add_open/io?= =?utf-8?q?=2Eopen=3B_patch_by_Jelle_Zijlstra?= Message-ID: <20160604213912.23501.66488.A6D18168@psf.io> https://hg.python.org/cpython/rev/254125a265d2 changeset: 101724:254125a265d2 user: Ethan Furman date: Sat Jun 04 14:38:43 2016 -0700 summary: issue27186: add open/io.open; patch by Jelle Zijlstra files: Doc/library/functions.rst | 10 ++-- Lib/_pyio.py | 2 + Lib/test/test_io.py | 26 ++++++++++++++ Modules/_io/_iomodule.c | 48 ++++++++++++++++++--------- 4 files changed, 65 insertions(+), 21 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -878,11 +878,11 @@ Open *file* and return a corresponding :term:`file object`. If the file cannot be opened, an :exc:`OSError` is raised. - *file* is either a string or bytes object giving the pathname (absolute or - relative to the current working directory) of the file to be opened or - an integer file descriptor of the file to be wrapped. (If a file descriptor - is given, it is closed when the returned I/O object is closed, unless - *closefd* is set to ``False``.) + *file* is either a string, bytes, or :class:`os.PathLike` object giving the + pathname (absolute or relative to the current working directory) of the file + to be opened or an integer file descriptor of the file to be 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. diff --git a/Lib/_pyio.py b/Lib/_pyio.py --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -161,6 +161,8 @@ opened in a text mode, and for bytes a BytesIO can be used like a file opened in a binary mode. """ + if not isinstance(file, int): + file = os.fspath(file) if not isinstance(file, (str, bytes, int)): raise TypeError("invalid file: %r" % file) if not isinstance(mode, str): 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 @@ -844,6 +844,32 @@ self.assertEqual(getattr(stream, method)(buffer), 5) self.assertEqual(bytes(buffer), b"12345") + def test_fspath_support(self): + class PathLike: + def __init__(self, path): + self.path = path + + def __fspath__(self): + return self.path + + def check_path_succeeds(path): + with self.open(path, "w") as f: + f.write("egg\n") + + with self.open(path, "r") as f: + self.assertEqual(f.read(), "egg\n") + + check_path_succeeds(PathLike(support.TESTFN)) + check_path_succeeds(PathLike(support.TESTFN.encode('utf-8'))) + + bad_path = PathLike(TypeError) + with self.assertRaisesRegex(TypeError, 'invalid file'): + self.open(bad_path, 'w') + + # ensure that refcounting is correct with some error conditions + with self.assertRaisesRegex(ValueError, 'read/write/append mode'): + self.open(PathLike(support.TESTFN), 'rwxa') + class CIOTest(IOTest): diff --git a/Modules/_io/_iomodule.c b/Modules/_io/_iomodule.c --- a/Modules/_io/_iomodule.c +++ b/Modules/_io/_iomodule.c @@ -238,21 +238,33 @@ int text = 0, binary = 0, universal = 0; char rawmode[6], *m; - int line_buffering; + int line_buffering, is_number; long isatty; - PyObject *raw, *modeobj = NULL, *buffer, *wrapper, *result = NULL; + PyObject *raw, *modeobj = NULL, *buffer, *wrapper, *result = NULL, *path_or_fd = NULL; _Py_IDENTIFIER(_blksize); _Py_IDENTIFIER(isatty); _Py_IDENTIFIER(mode); _Py_IDENTIFIER(close); - if (!PyUnicode_Check(file) && - !PyBytes_Check(file) && - !PyNumber_Check(file)) { + is_number = PyNumber_Check(file); + + if (is_number) { + path_or_fd = file; + Py_INCREF(path_or_fd); + } else { + path_or_fd = PyOS_FSPath(file); + if (path_or_fd == NULL) { + return NULL; + } + } + + if (!is_number && + !PyUnicode_Check(path_or_fd) && + !PyBytes_Check(path_or_fd)) { PyErr_Format(PyExc_TypeError, "invalid file: %R", file); - return NULL; + goto error; } /* Decode mode */ @@ -293,7 +305,7 @@ if (strchr(mode+i+1, c)) { invalid_mode: PyErr_Format(PyExc_ValueError, "invalid mode: '%s'", mode); - return NULL; + goto error; } } @@ -311,51 +323,54 @@ if (creating || writing || appending || updating) { PyErr_SetString(PyExc_ValueError, "mode U cannot be combined with x', 'w', 'a', or '+'"); - return NULL; + goto error; } if (PyErr_WarnEx(PyExc_DeprecationWarning, "'U' mode is deprecated", 1) < 0) - return NULL; + goto error; reading = 1; } if (text && binary) { PyErr_SetString(PyExc_ValueError, "can't have text and binary mode at once"); - return NULL; + goto error; } if (creating + reading + writing + appending > 1) { PyErr_SetString(PyExc_ValueError, "must have exactly one of create/read/write/append mode"); - return NULL; + goto error; } if (binary && encoding != NULL) { PyErr_SetString(PyExc_ValueError, "binary mode doesn't take an encoding argument"); - return NULL; + goto error; } if (binary && errors != NULL) { PyErr_SetString(PyExc_ValueError, "binary mode doesn't take an errors argument"); - return NULL; + goto error; } if (binary && newline != NULL) { PyErr_SetString(PyExc_ValueError, "binary mode doesn't take a newline argument"); - return NULL; + goto error; } /* Create the Raw file stream */ raw = PyObject_CallFunction((PyObject *)&PyFileIO_Type, - "OsiO", file, rawmode, closefd, opener); + "OsiO", path_or_fd, rawmode, closefd, opener); if (raw == NULL) - return NULL; + goto error; result = raw; + Py_DECREF(path_or_fd); + path_or_fd = NULL; + modeobj = PyUnicode_FromString(mode); if (modeobj == NULL) goto error; @@ -461,6 +476,7 @@ Py_XDECREF(close_result); Py_DECREF(result); } + Py_XDECREF(path_or_fd); Py_XDECREF(modeobj); return NULL; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 17:44:26 2016 From: python-checkins at python.org (nick.coghlan) Date: Sat, 04 Jun 2016 21:44:26 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2319611=3A_handle_i?= =?utf-8?q?mplicit_parameters_in_inspect=2Esignature?= Message-ID: <20160604214426.13769.50115.3D159CAE@psf.io> https://hg.python.org/cpython/rev/6247dd0f230e changeset: 101725:6247dd0f230e user: Nick Coghlan date: Sat Jun 04 14:40:03 2016 -0700 summary: Issue #19611: handle implicit parameters in inspect.signature inspect.signature now reports the implicit ``.0`` parameters generated by the compiler for comprehension and generator expression scopes as if they were positional-only parameters called ``implicit0``. Patch by Jelle Zijlstra. files: Doc/library/inspect.rst | 10 ++++++++++ Lib/inspect.py | 14 ++++++++++++++ Lib/test/test_inspect.py | 26 ++++++++++++++++++++++++++ Misc/ACKS | 1 + Misc/NEWS | 5 +++++ 5 files changed, 56 insertions(+), 0 deletions(-) diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -625,6 +625,16 @@ The name of the parameter as a string. The name must be a valid Python identifier. + .. impl-detail:: + + CPython generates implicit parameter names of the form ``.0`` on the + code objects used to implement comprehensions and generator + expressions. + + .. versionchanged:: 3.6 + These parameter names are exposed by this module as names like + ``implicit0``. + .. attribute:: Parameter.default The default value for the parameter. If the parameter has no default diff --git a/Lib/inspect.py b/Lib/inspect.py --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -2396,6 +2396,20 @@ if not isinstance(name, str): raise TypeError("name must be a str, not a {!r}".format(name)) + if name[0] == '.' and name[1:].isdigit(): + # These are implicit arguments generated by comprehensions. In + # order to provide a friendlier interface to users, we recast + # their name as "implicitN" and treat them as positional-only. + # See issue 19611. + if kind != _POSITIONAL_OR_KEYWORD: + raise ValueError( + 'implicit arguments must be passed in as {}'.format( + _POSITIONAL_OR_KEYWORD + ) + ) + self._kind = _POSITIONAL_ONLY + name = 'implicit{}'.format(name[1:]) + if not name.isidentifier(): raise ValueError('{!r} is not a valid parameter name'.format(name)) 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 @@ -2903,6 +2903,10 @@ 'is not a valid parameter name'): inspect.Parameter('$', kind=inspect.Parameter.VAR_KEYWORD) + with self.assertRaisesRegex(ValueError, + 'is not a valid parameter name'): + inspect.Parameter('.a', kind=inspect.Parameter.VAR_KEYWORD) + with self.assertRaisesRegex(ValueError, 'cannot have default values'): inspect.Parameter('a', default=42, kind=inspect.Parameter.VAR_KEYWORD) @@ -2986,6 +2990,17 @@ with self.assertRaisesRegex(TypeError, 'name must be a str'): inspect.Parameter(None, kind=inspect.Parameter.POSITIONAL_ONLY) + @cpython_only + def test_signature_parameter_implicit(self): + with self.assertRaisesRegex(ValueError, + 'implicit arguments must be passed in as'): + inspect.Parameter('.0', kind=inspect.Parameter.POSITIONAL_ONLY) + + param = inspect.Parameter( + '.0', kind=inspect.Parameter.POSITIONAL_OR_KEYWORD) + self.assertEqual(param.kind, inspect.Parameter.POSITIONAL_ONLY) + self.assertEqual(param.name, 'implicit0') + def test_signature_parameter_immutability(self): p = inspect.Parameter('spam', kind=inspect.Parameter.KEYWORD_ONLY) @@ -3234,6 +3249,17 @@ ba = sig.bind(args=1) self.assertEqual(ba.arguments, {'kwargs': {'args': 1}}) + @cpython_only + def test_signature_bind_implicit_arg(self): + # Issue #19611: getcallargs should work with set comprehensions + def make_set(): + return {z * z for z in range(5)} + setcomp_code = make_set.__code__.co_consts[1] + setcomp_func = types.FunctionType(setcomp_code, {}) + + iterator = iter(range(5)) + self.assertEqual(self.call(setcomp_func, iterator), {0, 1, 4, 9, 16}) + class TestBoundArguments(unittest.TestCase): def test_signature_bound_arguments_unhashable(self): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1665,6 +1665,7 @@ Cheng Zhang Kai Zhu Tarek Ziad? +Jelle Zijlstra Gennadiy Zlobin Doug Zongker Peter ?strand diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,11 @@ Library ------- +- Issue #19611: :mod:`inspect` now reports the implicit ``.0`` parameters + generated by the compiler for comprehension and generator expression scopes + as if they were positional-only parameters called ``implicit0``. + Patch by Jelle Zijlstra. + - Issue #26809: Add ``__all__`` to :mod:`string`. Patch by Emanuel Barry. - Issue #26373: subprocess.Popen.communicate now correctly ignores -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 18:44:09 2016 From: python-checkins at python.org (matthias.klose) Date: Sat, 04 Jun 2016 22:44:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogIC0gbWVyZ2UgMy41?= Message-ID: <20160604224409.20593.65349.5D5A09EF@psf.io> https://hg.python.org/cpython/rev/3a5a442597f1 changeset: 101727:3a5a442597f1 parent: 101725:6247dd0f230e parent: 101726:d00837de03d7 user: doko at ubuntu.com date: Sun Jun 05 00:44:01 2016 +0200 summary: - merge 3.5 files: Lib/distutils/command/build_ext.py | 2 +- Misc/NEWS | 3 +++ 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -748,7 +748,7 @@ if sysconfig.get_config_var('Py_ENABLE_SHARED'): pythonlib = 'python{}.{}{}'.format( sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff, - sys.abiflags) + sysconfig.get_config_var('ABIFLAGS')) return ext.libraries + [pythonlib] else: return ext.libraries diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1286,6 +1286,9 @@ Build ----- +- Issue #26884: Fix linking extension modules for cross builds. + Patch by Xavier de Gaye. + - Issue #26932: Fixed support of RTLD_* constants defined as enum values, not via macros (in particular on Android). Patch by Chi Hsuan Yen. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 18:44:09 2016 From: python-checkins at python.org (matthias.klose) Date: Sat, 04 Jun 2016 22:44:09 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogLSBJc3N1ZSAjMjY4?= =?utf-8?q?84=3A_Fix_linking_extension_modules_for_cross_builds=2E?= Message-ID: <20160604224409.21667.21524.9D875D8B@psf.io> https://hg.python.org/cpython/rev/d00837de03d7 changeset: 101726:d00837de03d7 branch: 3.5 parent: 101720:b7d65f384cf5 user: doko at ubuntu.com date: Sun Jun 05 00:41:58 2016 +0200 summary: - Issue #26884: Fix linking extension modules for cross builds. Patch by Xavier de Gaye. files: Lib/distutils/command/build_ext.py | 2 +- Misc/NEWS | 3 +++ 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -748,7 +748,7 @@ if sysconfig.get_config_var('Py_ENABLE_SHARED'): pythonlib = 'python{}.{}{}'.format( sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff, - sys.abiflags) + sysconfig.get_config_var('ABIFLAGS')) return ext.libraries + [pythonlib] else: return ext.libraries diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -561,6 +561,9 @@ Build ----- +- Issue #26884: Fix linking extension modules for cross builds. + Patch by Xavier de Gaye. + - Issue #22359: Disable the rules for running _freeze_importlib and pgen when cross-compiling. The output of these programs is normally saved with the source code anyway, and is still regenerated when doing a native build. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 18:53:23 2016 From: python-checkins at python.org (ethan.furman) Date: Sat, 04 Jun 2016 22:53:23 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_add_Dusty_Phillips_to_ACKS?= Message-ID: <20160604225322.1307.9234.56A79CD8@psf.io> https://hg.python.org/cpython/rev/bd0146a73f9e changeset: 101728:bd0146a73f9e user: Ethan Furman date: Sat Jun 04 15:53:08 2016 -0700 summary: add Dusty Phillips to ACKS files: Misc/ACKS | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1141,6 +1141,7 @@ Geoff Philbrick Gavrie Philipson Adrian Phillips +Dusty Phillips Christopher J. Phoenix Neale Pickett Jim St. Pierre -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 19:18:02 2016 From: python-checkins at python.org (matthias.klose) Date: Sat, 04 Jun 2016 23:18:02 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_-_Issue_=2321272=3A_Use_?= =?utf-8?q?=5Fsysconfigdata=2Epy_to_initialize_distutils=2Esysconfig=2E?= Message-ID: <20160604231802.21809.92451.F28BF9B8@psf.io> https://hg.python.org/cpython/rev/3fa8aebed636 changeset: 101729:3fa8aebed636 user: doko at ubuntu.com date: Sun Jun 05 01:17:57 2016 +0200 summary: - Issue #21272: Use _sysconfigdata.py to initialize distutils.sysconfig. files: Lib/distutils/sysconfig.py | 35 ++----------------------- Misc/NEWS | 2 + 2 files changed, 6 insertions(+), 31 deletions(-) diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -415,38 +415,11 @@ def _init_posix(): """Initialize the module as appropriate for POSIX systems.""" - g = {} - # load the installed Makefile: - try: - filename = get_makefile_filename() - parse_makefile(filename, g) - except OSError as msg: - my_msg = "invalid Python installation: unable to open %s" % filename - if hasattr(msg, "strerror"): - my_msg = my_msg + " (%s)" % msg.strerror - - raise DistutilsPlatformError(my_msg) - - # load the installed pyconfig.h: - try: - filename = get_config_h_filename() - with open(filename) as file: - parse_config_h(file, g) - except OSError as msg: - my_msg = "invalid Python installation: unable to open %s" % filename - if hasattr(msg, "strerror"): - my_msg = my_msg + " (%s)" % msg.strerror - - raise DistutilsPlatformError(my_msg) - - # On AIX, there are wrong paths to the linker scripts in the Makefile - # -- these paths are relative to the Python source, but when installed - # the scripts are in another directory. - if python_build: - g['LDSHARED'] = g['BLDSHARED'] - + # _sysconfigdata is generated at build time, see the sysconfig module + from _sysconfigdata import build_time_vars global _config_vars - _config_vars = g + _config_vars = {} + _config_vars.update(build_time_vars) def _init_nt(): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,8 @@ Library ------- +- Issue #21272: Use _sysconfigdata.py to initialize distutils.sysconfig. + - Issue #19611: :mod:`inspect` now reports the implicit ``.0`` parameters generated by the compiler for comprehension and generator expression scopes as if they were positional-only parameters called ``implicit0``. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 19:24:17 2016 From: python-checkins at python.org (kushal.das) Date: Sat, 04 Jun 2016 23:24:17 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fixes_whitespace_issue?= Message-ID: <20160604232417.100756.70123.8FEB934B@psf.io> https://hg.python.org/cpython/rev/6ccba4febf0d changeset: 101731:6ccba4febf0d user: Kushal Das date: Sat Jun 04 16:24:05 2016 -0700 summary: Fixes whitespace issue files: Lib/test/test_wsgiref.py | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_wsgiref.py b/Lib/test/test_wsgiref.py --- a/Lib/test/test_wsgiref.py +++ b/Lib/test/test_wsgiref.py @@ -704,4 +704,3 @@ if __name__ == "__main__": unittest.main() - -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 19:24:16 2016 From: python-checkins at python.org (kushal.das) Date: Sat, 04 Jun 2016 23:24:16 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2325548=3A_Showing_?= =?utf-8?q?memory_address_of_class_objects_in_repl?= Message-ID: <20160604232416.15269.43561.0C8DB321@psf.io> https://hg.python.org/cpython/rev/af29d89083b3 changeset: 101730:af29d89083b3 user: Kushal Das date: Sat Jun 04 16:21:13 2016 -0700 summary: Issue #25548: Showing memory address of class objects in repl files: Lib/ctypes/test/test_structures.py | 10 ++-- Lib/statistics.py | 8 +- Lib/test/test_class.py | 10 ++++ Lib/test/test_cmd_line_script.py | 9 +++- Lib/test/test_defaultdict.py | 2 +- Lib/test/test_descr.py | 4 +- Lib/test/test_descrtut.py | 31 +++++++------- Lib/test/test_doctest.py | 2 +- Lib/test/test_doctest3.txt | 2 +- Lib/test/test_functools.py | 33 +++++---------- Lib/test/test_generators.py | 37 +++++++++-------- Lib/test/test_genexps.py | 5 +- Lib/test/test_metaclass.py | 9 ++- Lib/test/test_pprint.py | 9 +-- Lib/test/test_reprlib.py | 6 +- Lib/test/test_statistics.py | 2 +- Lib/test/test_wsgiref.py | 7 +- Lib/test/test_xmlrpc.py | 4 +- Misc/NEWS | 2 + Objects/typeobject.c | 6 +- 20 files changed, 106 insertions(+), 92 deletions(-) diff --git a/Lib/ctypes/test/test_structures.py b/Lib/ctypes/test/test_structures.py --- a/Lib/ctypes/test/test_structures.py +++ b/Lib/ctypes/test/test_structures.py @@ -320,14 +320,14 @@ cls, msg = self.get_except(Person, b"Someone", (1, 2)) self.assertEqual(cls, RuntimeError) - self.assertEqual(msg, - "(Phone) : " - "expected bytes, int found") + self.assertRegex(msg, + r"\(Phone\) : " + r"expected bytes, int found") cls, msg = self.get_except(Person, b"Someone", (b"a", b"b", b"c")) self.assertEqual(cls, RuntimeError) - self.assertEqual(msg, - "(Phone) : too many initializers") + self.assertRegex(msg, + r"\(Phone\) : too many initializers") def test_huge_field_name(self): # issue12881: segfault with large structure field names diff --git a/Lib/statistics.py b/Lib/statistics.py --- a/Lib/statistics.py +++ b/Lib/statistics.py @@ -131,23 +131,23 @@ -------- >>> _sum([3, 2.25, 4.5, -0.5, 1.0], 0.75) - (, Fraction(11, 1), 5) + (, Fraction(11, 1), 5) Some sources of round-off error will be avoided: >>> _sum([1e50, 1, -1e50] * 1000) # Built-in sum returns zero. - (, Fraction(1000, 1), 3000) + (, Fraction(1000, 1), 3000) Fractions and Decimals are also supported: >>> from fractions import Fraction as F >>> _sum([F(2, 3), F(7, 5), F(1, 4), F(5, 6)]) - (, Fraction(63, 20), 4) + (, Fraction(63, 20), 4) >>> from decimal import Decimal as D >>> data = [D("0.1375"), D("0.2108"), D("0.3061"), D("0.0419")] >>> _sum(data) - (, Fraction(6963, 10000), 4) + (, Fraction(6963, 10000), 4) Mixed types are currently treated as an error, except that int is allowed. diff --git a/Lib/test/test_class.py b/Lib/test/test_class.py --- a/Lib/test/test_class.py +++ b/Lib/test/test_class.py @@ -568,5 +568,15 @@ a = A(hash(A.f)^(-1)) hash(a.f) + def test_class_repr(self): + # We should get the address of the object + class A: + pass + + result = repr(A) + self.assertRegex(result, + ".A'" + " at 0x.+>") + if __name__ == '__main__': unittest.main() diff --git a/Lib/test/test_cmd_line_script.py b/Lib/test/test_cmd_line_script.py --- a/Lib/test/test_cmd_line_script.py +++ b/Lib/test/test_cmd_line_script.py @@ -127,7 +127,10 @@ print(printed_package) print(printed_argv0) print(printed_cwd) - self.assertIn(printed_loader.encode('utf-8'), data) + expected = printed_loader.encode('utf-8') + idx = expected.find(b"at 0x") + expected = expected[:idx] + self.assertIn(expected, data) self.assertIn(printed_file.encode('utf-8'), data) self.assertIn(printed_package.encode('utf-8'), data) self.assertIn(printed_argv0.encode('utf-8'), data) @@ -158,6 +161,8 @@ def test_dash_c_loader(self): rc, out, err = assert_python_ok("-c", "print(__loader__)") expected = repr(importlib.machinery.BuiltinImporter).encode("utf-8") + idx = expected.find(b"at 0x") + expected = expected[:idx] self.assertIn(expected, out) def test_stdin_loader(self): @@ -171,6 +176,8 @@ finally: out = kill_python(p) expected = repr(importlib.machinery.BuiltinImporter).encode("utf-8") + idx = expected.find(b"at 0x") + expected = expected[:idx] self.assertIn(expected, out) @contextlib.contextmanager diff --git a/Lib/test/test_defaultdict.py b/Lib/test/test_defaultdict.py --- a/Lib/test/test_defaultdict.py +++ b/Lib/test/test_defaultdict.py @@ -65,7 +65,7 @@ d2 = defaultdict(int) self.assertEqual(d2.default_factory, int) d2[12] = 42 - self.assertEqual(repr(d2), "defaultdict(, {12: 42})") + self.assertRegex(repr(d2), r"defaultdict\(, {12: 42}\)") def foo(): return 43 d3 = defaultdict(foo) self.assertTrue(d3.default_factory is foo) diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -4544,9 +4544,9 @@ pass foo = Foo() self.assertRegex(repr(foo.method), # access via instance - r">") + r">") self.assertRegex(repr(Foo.method), # access via the class - r">") + r">") class MyCallable: diff --git a/Lib/test/test_descrtut.py b/Lib/test/test_descrtut.py --- a/Lib/test/test_descrtut.py +++ b/Lib/test/test_descrtut.py @@ -37,16 +37,16 @@ Here's the new type at work: >>> print(defaultdict) # show our type - + >>> print(type(defaultdict)) # its metatype - + >>> a = defaultdict(default=0.0) # create an instance >>> print(a) # show the instance {} >>> print(type(a)) # show its type - + >>> print(a.__class__) # show its class - + >>> print(type(a) is a.__class__) # its type is its class True >>> a[1] = 3.25 # modify the instance @@ -149,11 +149,11 @@ For instance of built-in types, x.__class__ is now the same as type(x): >>> type([]) - + >>> [].__class__ - + >>> list - + >>> isinstance([], list) True >>> isinstance([], dict) @@ -258,19 +258,19 @@ ... print("classmethod", cls, y) >>> C.foo(1) - classmethod 1 + classmethod 1 >>> c = C() >>> c.foo(1) - classmethod 1 + classmethod 1 >>> class D(C): ... pass >>> D.foo(1) - classmethod 1 + classmethod 1 >>> d = D() >>> d.foo(1) - classmethod 1 + classmethod 1 This prints "classmethod __main__.D 1" both times; in other words, the class passed as the first argument of foo() is the class involved in the @@ -286,11 +286,11 @@ >>> E.foo(1) E.foo() called - classmethod 1 + classmethod 1 >>> e = E() >>> e.foo(1) E.foo() called - classmethod 1 + classmethod 1 In this example, the call to C.foo() from E.foo() will see class C as its first argument, not class E. This is to be expected, since the call @@ -350,7 +350,7 @@ >>> del property # unmask the builtin >>> property - + >>> class C(object): ... def __init__(self): @@ -478,7 +478,8 @@ # business is used the name can change depending on how the test is # invoked. from test import support, test_descrtut - support.run_doctest(test_descrtut, verbose) + import doctest + support.run_doctest(test_descrtut, verbose, optionflags=doctest.ELLIPSIS) # This part isn't needed for regrtest, but for running the test directly. if __name__ == "__main__": diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py --- a/Lib/test/test_doctest.py +++ b/Lib/test/test_doctest.py @@ -2338,7 +2338,7 @@ `__file__` global, which is set to the name of the file containing the tests: - >>> suite = doctest.DocFileSuite('test_doctest3.txt') + >>> suite = doctest.DocFileSuite('test_doctest3.txt', optionflags=doctest.ELLIPSIS) >>> suite.run(unittest.TestResult()) diff --git a/Lib/test/test_doctest3.txt b/Lib/test/test_doctest3.txt --- a/Lib/test/test_doctest3.txt +++ b/Lib/test/test_doctest3.txt @@ -2,4 +2,4 @@ Here we check that `__file__` is provided: >>> type(__file__) - + diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -1697,13 +1697,10 @@ c.Container.register(P) with self.assertRaises(RuntimeError) as re_one: g(p) - self.assertIn( - str(re_one.exception), - (("Ambiguous dispatch: " - "or "), - ("Ambiguous dispatch: " - "or ")), - ) + self.assertIn("Ambiguous dispatch:", str(re_one.exception)) + self.assertIn(" " - "or "), - ("Ambiguous dispatch: " - "or ")), - ) + self.assertIn("Ambiguous dispatch:", str(re_two.exception)) + self.assertIn(" " - "or "), - ("Ambiguous dispatch: " - "or ")), - ) + self.assertIn("Ambiguous dispatch:", str(re_three.exception)) + self.assertIn(">> type(g) - + >>> i = g() >>> type(i) - + >>> [s for s in dir(i) if not s.startswith('_')] ['close', 'gi_code', 'gi_frame', 'gi_running', 'gi_yieldfrom', 'send', 'throw'] >>> from test.support import HAVE_DOCSTRINGS @@ -691,7 +691,7 @@ >>> i.gi_running 0 >>> type(i.gi_frame) - + >>> i.gi_running = 42 Traceback (most recent call last): ... @@ -1066,27 +1066,27 @@ >>> def f(): ... yield >>> type(f()) - + >>> def f(): ... if 0: ... yield >>> type(f()) - + >>> def f(): ... if 0: ... yield 1 >>> type(f()) - + >>> def f(): ... if "": ... yield None >>> type(f()) - + >>> def f(): ... return @@ -1110,7 +1110,7 @@ ... x = 1 ... return >>> type(f()) - + >>> def f(): ... if 0: @@ -1118,7 +1118,7 @@ ... yield 1 ... >>> type(f()) - + >>> def f(): ... if 0: @@ -1128,7 +1128,7 @@ ... def f(self): ... yield 2 >>> type(f()) - + >>> def f(): ... if 0: @@ -1136,7 +1136,7 @@ ... if 0: ... yield 2 >>> type(f()) - + This one caused a crash (see SF bug 567538): @@ -1791,7 +1791,7 @@ >>> def f(): list(i for i in [(yield 26)]) >>> type(f()) - + A yield expression with augmented assignment. @@ -2047,25 +2047,25 @@ >>> def f(): x += yield >>> type(f()) - + >>> def f(): x = yield >>> type(f()) - + >>> def f(): lambda x=(yield): 1 >>> type(f()) - + >>> def f(): x=(i for i in (yield) if (yield)) >>> type(f()) - + >>> def f(d): d[(yield "a")] = d[(yield "b")] = 27 >>> data = [1,2] >>> g = f(data) >>> type(g) - + >>> g.send(None) 'a' >>> data @@ -2174,8 +2174,9 @@ # so this works as expected in both ways of running regrtest. def test_main(verbose=None): from test import support, test_generators + import doctest support.run_unittest(__name__) - support.run_doctest(test_generators, verbose) + support.run_doctest(test_generators, verbose, optionflags=doctest.ELLIPSIS) # This part isn't needed for regrtest, but for running the test directly. if __name__ == "__main__": diff --git a/Lib/test/test_genexps.py b/Lib/test/test_genexps.py --- a/Lib/test/test_genexps.py +++ b/Lib/test/test_genexps.py @@ -27,7 +27,7 @@ >>> g = (i*i for i in range(4)) >>> type(g) - + >>> list(g) [0, 1, 4, 9] @@ -269,7 +269,8 @@ def test_main(verbose=None): from test import support from test import test_genexps - support.run_doctest(test_genexps, verbose) + import doctest + support.run_doctest(test_genexps, verbose, optionflags=doctest.ELLIPSIS) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): diff --git a/Lib/test/test_metaclass.py b/Lib/test/test_metaclass.py --- a/Lib/test/test_metaclass.py +++ b/Lib/test/test_metaclass.py @@ -78,7 +78,7 @@ >>> class C(object, metaclass=M, other="haha"): ... pass ... - Prepare called: ('C', (,)) {'other': 'haha'} + Prepare called: ('C', (,)) {'other': 'haha'} New called: {'other': 'haha'} >>> C.__class__ is M True @@ -104,7 +104,7 @@ >>> kwds = {'metaclass': M, 'other': 'haha'} >>> class C(*bases, **kwds): pass ... - Prepare called: ('C', (,)) {'other': 'haha'} + Prepare called: ('C', (,)) {'other': 'haha'} New called: {'other': 'haha'} >>> C.__class__ is M True @@ -114,7 +114,7 @@ >>> kwds = {'other': 'haha'} >>> class C(B, metaclass=M, *bases, **kwds): pass ... - Prepare called: ('C', (, )) {'other': 'haha'} + Prepare called: ('C', (, )) {'other': 'haha'} New called: {'other': 'haha'} >>> C.__class__ is M True @@ -259,7 +259,8 @@ def test_main(verbose=False): from test import support from test import test_metaclass - support.run_doctest(test_metaclass, verbose) + import doctest + support.run_doctest(test_metaclass, verbose, optionflags=doctest.ELLIPSIS) if __name__ == "__main__": test_main(verbose=True) diff --git a/Lib/test/test_pprint.py b/Lib/test/test_pprint.py --- a/Lib/test/test_pprint.py +++ b/Lib/test/test_pprint.py @@ -848,12 +848,11 @@ def test_default_dict(self): d = collections.defaultdict(int) - self.assertEqual(pprint.pformat(d, width=1), "defaultdict(, {})") + self.assertRegex(pprint.pformat(d, width=1), r"defaultdict\(, {}\)") words = 'the quick brown fox jumped over a lazy dog'.split() d = collections.defaultdict(int, zip(words, itertools.count())) - self.assertEqual(pprint.pformat(d), -"""\ -defaultdict(, + self.assertRegex(pprint.pformat(d), +r"""defaultdict\(, {'a': 6, 'brown': 2, 'dog': 8, @@ -862,7 +861,7 @@ 'lazy': 7, 'over': 5, 'quick': 1, - 'the': 0})""") + 'the': 0}\)""") def test_counter(self): d = collections.Counter() diff --git a/Lib/test/test_reprlib.py b/Lib/test/test_reprlib.py --- a/Lib/test/test_reprlib.py +++ b/Lib/test/test_reprlib.py @@ -292,8 +292,8 @@ ''') importlib.invalidate_caches() from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import foo - eq(repr(foo.foo), - "" % foo.__name__) + self.assertRegex(repr(foo.foo), + r"" % foo.__name__) @unittest.skip('need a suitable object') def test_object(self): @@ -310,7 +310,7 @@ importlib.invalidate_caches() from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import bar # Module name may be prefixed with "test.", depending on how run. - self.assertEqual(repr(bar.bar), "" % bar.__name__) + self.assertRegex(repr(bar.bar), r"" % bar.__name__) def test_instance(self): self._check_path_limitations('baz') diff --git a/Lib/test/test_statistics.py b/Lib/test/test_statistics.py --- a/Lib/test/test_statistics.py +++ b/Lib/test/test_statistics.py @@ -659,7 +659,7 @@ @unittest.skipIf(sys.flags.optimize >= 2, "Docstrings are omitted with -OO and above") def test_doc_tests(self): - failed, tried = doctest.testmod(statistics) + failed, tried = doctest.testmod(statistics, optionflags=doctest.ELLIPSIS) self.assertGreater(tried, 0) self.assertEqual(failed, 0) diff --git a/Lib/test/test_wsgiref.py b/Lib/test/test_wsgiref.py --- a/Lib/test/test_wsgiref.py +++ b/Lib/test/test_wsgiref.py @@ -161,10 +161,10 @@ self.assertTrue(out.endswith( b"A server error occurred. Please contact the administrator." )) - self.assertEqual( + self.assertRegex( err.splitlines()[-2], - "AssertionError: Headers (('Content-Type', 'text/plain')) must" - " be of type list: " + r"AssertionError: Headers \(\('Content-Type', 'text/plain'\)\) must" + r" be of type list: " ) def test_status_validation_errors(self): @@ -704,3 +704,4 @@ if __name__ == "__main__": unittest.main() + diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py --- a/Lib/test/test_xmlrpc.py +++ b/Lib/test/test_xmlrpc.py @@ -775,8 +775,8 @@ # 'method "this_is_not_exists" is not supported'>}] self.assertEqual(result.results[0]['faultCode'], 1) - self.assertEqual(result.results[0]['faultString'], - ':method "this_is_not_exists" ' + self.assertRegex(result.results[0]['faultString'], + ':method "this_is_not_exists" ' 'is not supported') except (xmlrpclib.ProtocolError, OSError) as e: # ignore failures due to non-blocking socket 'unavailable' errors diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -73,6 +73,8 @@ - Issue #21271: New keyword only parameters in reset_mock call. +- Issue #25548: Showing memory address of class objects in repl. + IDLE ---- diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -859,9 +859,9 @@ } if (mod != NULL && _PyUnicode_CompareWithId(mod, &PyId_builtins)) - rtn = PyUnicode_FromFormat("", mod, name); - else - rtn = PyUnicode_FromFormat("", type->tp_name); + rtn = PyUnicode_FromFormat("", mod, name, type); + else + rtn = PyUnicode_FromFormat("", type->tp_name, type); Py_XDECREF(mod); Py_DECREF(name); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 19:38:36 2016 From: python-checkins at python.org (matthias.klose) Date: Sat, 04 Jun 2016 23:38:36 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_-_Issue_=2321277=3A_Don=27?= =?utf-8?q?t_try_to_link_=5Fctypes_with_a_ffi=5Fconvenience_library=2E?= Message-ID: <20160604233836.15113.35602.A96920F1@psf.io> https://hg.python.org/cpython/rev/0a8509023c09 changeset: 101732:0a8509023c09 user: doko at ubuntu.com date: Sun Jun 05 01:38:29 2016 +0200 summary: - Issue #21277: Don't try to link _ctypes with a ffi_convenience library. files: Misc/NEWS | 2 ++ setup.py | 2 +- 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1290,6 +1290,8 @@ Build ----- +- Issue #21277: Don't try to link _ctypes with a ffi_convenience library. + - Issue #26884: Fix linking extension modules for cross builds. Patch by Xavier de Gaye. diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -2007,7 +2007,7 @@ break ffi_lib = None if ffi_inc is not None: - for lib_name in ('ffi_convenience', 'ffi_pic', 'ffi'): + for lib_name in ('ffi', 'ffi_pic'): if (self.compiler.find_library_file(lib_dirs, lib_name)): ffi_lib = lib_name break -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 20:24:44 2016 From: python-checkins at python.org (ned.deily) Date: Sun, 05 Jun 2016 00:24:44 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI2OTMw?= =?utf-8?q?=3A_Update_OS_X_32-bit-only_installer_builds_to_use_OpenSSL_1?= =?utf-8?b?LjAuMmgu?= Message-ID: <20160605002443.13567.58603.5E0119B4@psf.io> https://hg.python.org/cpython/rev/d858eadf2602 changeset: 101733:d858eadf2602 branch: 2.7 parent: 101719:bf551ee0781a user: Ned Deily date: Sat Jun 04 17:19:54 2016 -0700 summary: Issue #26930: Update OS X 32-bit-only installer builds to use OpenSSL 1.0.2h. files: Mac/BuildScript/build-installer.py | 6 +++--- Misc/NEWS | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py --- a/Mac/BuildScript/build-installer.py +++ b/Mac/BuildScript/build-installer.py @@ -242,9 +242,9 @@ result.extend([ dict( - name="OpenSSL 1.0.2g", - url="https://www.openssl.org/source/openssl-1.0.2g.tar.gz", - checksum='f3c710c045cdee5fd114feb69feba7aa', + name="OpenSSL 1.0.2h", + url="https://www.openssl.org/source/openssl-1.0.2h.tar.gz", + checksum='9392e65072ce4b614c1392eefc1f23d0', patches=[ "openssl_sdk_makedepend.patch", ], diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -336,8 +336,8 @@ - Issue #25696: Fix installation of Python on UNIX with make -j9. -- Issue #26465: Update OS X 10.5+ 32-bit-only installer to build - and link with OpenSSL 1.0.2g. +- Issue #26930: Update OS X 10.5+ 32-bit-only installer to build + and link with OpenSSL 1.0.2h. - Issue #26268: Update Windows builds to use OpenSSL 1.0.2f. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 20:24:44 2016 From: python-checkins at python.org (ned.deily) Date: Sun, 05 Jun 2016 00:24:44 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI2OTMw?= =?utf-8?q?=3A_Update_OS_X_32-bit-only_installer_builds_to_use_OpenSSL_1?= =?utf-8?b?LjAuMmgu?= Message-ID: <20160605002444.100796.13374.BE191F16@psf.io> https://hg.python.org/cpython/rev/5462d455215a changeset: 101734:5462d455215a branch: 3.5 parent: 101726:d00837de03d7 user: Ned Deily date: Sat Jun 04 17:21:21 2016 -0700 summary: Issue #26930: Update OS X 32-bit-only installer builds to use OpenSSL 1.0.2h. files: Mac/BuildScript/build-installer.py | 6 +++--- Misc/NEWS | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py --- a/Mac/BuildScript/build-installer.py +++ b/Mac/BuildScript/build-installer.py @@ -242,9 +242,9 @@ result.extend([ dict( - name="OpenSSL 1.0.2g", - url="https://www.openssl.org/source/openssl-1.0.2g.tar.gz", - checksum='f3c710c045cdee5fd114feb69feba7aa', + name="OpenSSL 1.0.2h", + url="https://www.openssl.org/source/openssl-1.0.2h.tar.gz", + checksum='9392e65072ce4b614c1392eefc1f23d0', patches=[ "openssl_sdk_makedepend.patch", ], diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -603,8 +603,8 @@ - Issue #25696: Fix installation of Python on UNIX with make -j9. -- Issue #26465: Update OS X 10.5+ 32-bit-only installer to build - and link with OpenSSL 1.0.2g. +- Issue #26930: Update OS X 10.5+ 32-bit-only installer to build + and link with OpenSSL 1.0.2h. - Issue #26268: Update Windows builds to use OpenSSL 1.0.2f. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 20:24:44 2016 From: python-checkins at python.org (ned.deily) Date: Sun, 05 Jun 2016 00:24:44 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2326930=3A_merge_from_3=2E5?= Message-ID: <20160605002444.13521.57015.631333B3@psf.io> https://hg.python.org/cpython/rev/edf5ae3162ef changeset: 101735:edf5ae3162ef parent: 101732:0a8509023c09 parent: 101734:5462d455215a user: Ned Deily date: Sat Jun 04 17:24:01 2016 -0700 summary: Issue #26930: merge from 3.5 files: Mac/BuildScript/build-installer.py | 6 +++--- Misc/NEWS | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py --- a/Mac/BuildScript/build-installer.py +++ b/Mac/BuildScript/build-installer.py @@ -242,9 +242,9 @@ result.extend([ dict( - name="OpenSSL 1.0.2g", - url="https://www.openssl.org/source/openssl-1.0.2g.tar.gz", - checksum='f3c710c045cdee5fd114feb69feba7aa', + name="OpenSSL 1.0.2h", + url="https://www.openssl.org/source/openssl-1.0.2h.tar.gz", + checksum='9392e65072ce4b614c1392eefc1f23d0', patches=[ "openssl_sdk_makedepend.patch", ], diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -122,6 +122,12 @@ The Windows launcher ``py.exe`` no longer prefers an installed Python 2 version over Python 3 by default when used interactively. +Build +----- + +- Issue #26930: Update OS X 10.5+ 32-bit-only installer to build + and link with OpenSSL 1.0.2h. + What's New in Python 3.6.0 alpha 1? =================================== -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 22:58:52 2016 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 05 Jun 2016 02:58:52 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_merge_from_3=2E5=2E_=28moves_the_issue26372_tests_to_the?= =?utf-8?q?_proper_class=29?= Message-ID: <20160605025852.119910.3026.ED6E0749@psf.io> https://hg.python.org/cpython/rev/e89eb7935ca9 changeset: 101737:e89eb7935ca9 parent: 101735:edf5ae3162ef parent: 101736:97bdba07e361 user: Gregory P. Smith [Google Inc.] date: Sun Jun 05 02:58:38 2016 +0000 summary: merge from 3.5. (moves the issue26372 tests to the proper class) files: Lib/test/test_subprocess.py | 92 ++++++++++++------------ 1 files changed, 46 insertions(+), 46 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 @@ -1238,52 +1238,6 @@ fds_after_exception = os.listdir(fd_directory) self.assertEqual(fds_before_popen, fds_after_exception) - def test_communicate_BrokenPipeError_stdin_close(self): - # By not setting stdout or stderr or a timeout we force the fast path - # that just calls _stdin_write() internally due to our mock. - proc = subprocess.Popen([sys.executable, '-c', 'pass']) - with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin: - mock_proc_stdin.close.side_effect = BrokenPipeError - proc.communicate() # Should swallow BrokenPipeError from close. - mock_proc_stdin.close.assert_called_with() - - def test_communicate_BrokenPipeError_stdin_write(self): - # By not setting stdout or stderr or a timeout we force the fast path - # that just calls _stdin_write() internally due to our mock. - proc = subprocess.Popen([sys.executable, '-c', 'pass']) - with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin: - mock_proc_stdin.write.side_effect = BrokenPipeError - proc.communicate(b'stuff') # Should swallow the BrokenPipeError. - mock_proc_stdin.write.assert_called_once_with(b'stuff') - mock_proc_stdin.close.assert_called_once_with() - - def test_communicate_BrokenPipeError_stdin_flush(self): - # Setting stdin and stdout forces the ._communicate() code path. - # python -h exits faster than python -c pass (but spams stdout). - proc = subprocess.Popen([sys.executable, '-h'], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE) - with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin, \ - open(os.devnull, 'wb') as dev_null: - mock_proc_stdin.flush.side_effect = BrokenPipeError - # because _communicate registers a selector using proc.stdin... - mock_proc_stdin.fileno.return_value = dev_null.fileno() - # _communicate() should swallow BrokenPipeError from flush. - proc.communicate(b'stuff') - mock_proc_stdin.flush.assert_called_once_with() - - def test_communicate_BrokenPipeError_stdin_close_with_timeout(self): - # Setting stdin and stdout forces the ._communicate() code path. - # python -h exits faster than python -c pass (but spams stdout). - proc = subprocess.Popen([sys.executable, '-h'], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE) - with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin: - mock_proc_stdin.close.side_effect = BrokenPipeError - # _communicate() should swallow BrokenPipeError from close. - proc.communicate(timeout=999) - mock_proc_stdin.close.assert_called_once_with() - class RunFuncTestCase(BaseTestCase): def run_python(self, code, **kwargs): @@ -2470,6 +2424,52 @@ if not gc_enabled: gc.disable() + def test_communicate_BrokenPipeError_stdin_close(self): + # By not setting stdout or stderr or a timeout we force the fast path + # that just calls _stdin_write() internally due to our mock. + proc = subprocess.Popen([sys.executable, '-c', 'pass']) + with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin: + mock_proc_stdin.close.side_effect = BrokenPipeError + proc.communicate() # Should swallow BrokenPipeError from close. + mock_proc_stdin.close.assert_called_with() + + def test_communicate_BrokenPipeError_stdin_write(self): + # By not setting stdout or stderr or a timeout we force the fast path + # that just calls _stdin_write() internally due to our mock. + proc = subprocess.Popen([sys.executable, '-c', 'pass']) + with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin: + mock_proc_stdin.write.side_effect = BrokenPipeError + proc.communicate(b'stuff') # Should swallow the BrokenPipeError. + mock_proc_stdin.write.assert_called_once_with(b'stuff') + mock_proc_stdin.close.assert_called_once_with() + + def test_communicate_BrokenPipeError_stdin_flush(self): + # Setting stdin and stdout forces the ._communicate() code path. + # python -h exits faster than python -c pass (but spams stdout). + proc = subprocess.Popen([sys.executable, '-h'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE) + with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin, \ + open(os.devnull, 'wb') as dev_null: + mock_proc_stdin.flush.side_effect = BrokenPipeError + # because _communicate registers a selector using proc.stdin... + mock_proc_stdin.fileno.return_value = dev_null.fileno() + # _communicate() should swallow BrokenPipeError from flush. + proc.communicate(b'stuff') + mock_proc_stdin.flush.assert_called_once_with() + + def test_communicate_BrokenPipeError_stdin_close_with_timeout(self): + # Setting stdin and stdout forces the ._communicate() code path. + # python -h exits faster than python -c pass (but spams stdout). + proc = subprocess.Popen([sys.executable, '-h'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE) + with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin: + mock_proc_stdin.close.side_effect = BrokenPipeError + # _communicate() should swallow BrokenPipeError from close. + proc.communicate(timeout=999) + mock_proc_stdin.close.assert_called_once_with() + @unittest.skipUnless(mswindows, "Windows specific tests") class Win32ProcessTestCase(BaseTestCase): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 22:58:51 2016 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 05 Jun 2016 02:58:51 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Move_the_Broke?= =?utf-8?q?nPipeError_tests_to_the_POSIXProcessTestCase_class?= Message-ID: <20160605025851.100824.62349.2F8CF4F5@psf.io> https://hg.python.org/cpython/rev/97bdba07e361 changeset: 101736:97bdba07e361 branch: 3.5 parent: 101734:5462d455215a user: Gregory P. Smith [Google Inc.] date: Sun Jun 05 02:57:47 2016 +0000 summary: Move the BrokenPipeError tests to the POSIXProcessTestCase class instead of the generic ProcessTestCase class as they are posix specific. files: Lib/test/test_subprocess.py | 92 ++++++++++++------------ 1 files changed, 46 insertions(+), 46 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 @@ -1241,52 +1241,6 @@ fds_after_exception = os.listdir(fd_directory) self.assertEqual(fds_before_popen, fds_after_exception) - def test_communicate_BrokenPipeError_stdin_close(self): - # By not setting stdout or stderr or a timeout we force the fast path - # that just calls _stdin_write() internally due to our mock. - proc = subprocess.Popen([sys.executable, '-c', 'pass']) - with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin: - mock_proc_stdin.close.side_effect = BrokenPipeError - proc.communicate() # Should swallow BrokenPipeError from close. - mock_proc_stdin.close.assert_called_with() - - def test_communicate_BrokenPipeError_stdin_write(self): - # By not setting stdout or stderr or a timeout we force the fast path - # that just calls _stdin_write() internally due to our mock. - proc = subprocess.Popen([sys.executable, '-c', 'pass']) - with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin: - mock_proc_stdin.write.side_effect = BrokenPipeError - proc.communicate(b'stuff') # Should swallow the BrokenPipeError. - mock_proc_stdin.write.assert_called_once_with(b'stuff') - mock_proc_stdin.close.assert_called_once_with() - - def test_communicate_BrokenPipeError_stdin_flush(self): - # Setting stdin and stdout forces the ._communicate() code path. - # python -h exits faster than python -c pass (but spams stdout). - proc = subprocess.Popen([sys.executable, '-h'], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE) - with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin, \ - open(os.devnull, 'wb') as dev_null: - mock_proc_stdin.flush.side_effect = BrokenPipeError - # because _communicate registers a selector using proc.stdin... - mock_proc_stdin.fileno.return_value = dev_null.fileno() - # _communicate() should swallow BrokenPipeError from flush. - proc.communicate(b'stuff') - mock_proc_stdin.flush.assert_called_once_with() - - def test_communicate_BrokenPipeError_stdin_close_with_timeout(self): - # Setting stdin and stdout forces the ._communicate() code path. - # python -h exits faster than python -c pass (but spams stdout). - proc = subprocess.Popen([sys.executable, '-h'], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE) - with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin: - mock_proc_stdin.close.side_effect = BrokenPipeError - # _communicate() should swallow BrokenPipeError from close. - proc.communicate(timeout=999) - mock_proc_stdin.close.assert_called_once_with() - class RunFuncTestCase(BaseTestCase): def run_python(self, code, **kwargs): @@ -2448,6 +2402,52 @@ if not gc_enabled: gc.disable() + def test_communicate_BrokenPipeError_stdin_close(self): + # By not setting stdout or stderr or a timeout we force the fast path + # that just calls _stdin_write() internally due to our mock. + proc = subprocess.Popen([sys.executable, '-c', 'pass']) + with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin: + mock_proc_stdin.close.side_effect = BrokenPipeError + proc.communicate() # Should swallow BrokenPipeError from close. + mock_proc_stdin.close.assert_called_with() + + def test_communicate_BrokenPipeError_stdin_write(self): + # By not setting stdout or stderr or a timeout we force the fast path + # that just calls _stdin_write() internally due to our mock. + proc = subprocess.Popen([sys.executable, '-c', 'pass']) + with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin: + mock_proc_stdin.write.side_effect = BrokenPipeError + proc.communicate(b'stuff') # Should swallow the BrokenPipeError. + mock_proc_stdin.write.assert_called_once_with(b'stuff') + mock_proc_stdin.close.assert_called_once_with() + + def test_communicate_BrokenPipeError_stdin_flush(self): + # Setting stdin and stdout forces the ._communicate() code path. + # python -h exits faster than python -c pass (but spams stdout). + proc = subprocess.Popen([sys.executable, '-h'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE) + with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin, \ + open(os.devnull, 'wb') as dev_null: + mock_proc_stdin.flush.side_effect = BrokenPipeError + # because _communicate registers a selector using proc.stdin... + mock_proc_stdin.fileno.return_value = dev_null.fileno() + # _communicate() should swallow BrokenPipeError from flush. + proc.communicate(b'stuff') + mock_proc_stdin.flush.assert_called_once_with() + + def test_communicate_BrokenPipeError_stdin_close_with_timeout(self): + # Setting stdin and stdout forces the ._communicate() code path. + # python -h exits faster than python -c pass (but spams stdout). + proc = subprocess.Popen([sys.executable, '-h'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE) + with proc, mock.patch.object(proc, 'stdin') as mock_proc_stdin: + mock_proc_stdin.close.side_effect = BrokenPipeError + # _communicate() should swallow BrokenPipeError from close. + proc.communicate(timeout=999) + mock_proc_stdin.close.assert_called_once_with() + @unittest.skipUnless(mswindows, "Windows specific tests") class Win32ProcessTestCase(BaseTestCase): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 23:08:12 2016 From: python-checkins at python.org (senthil.kumaran) Date: Sun, 05 Jun 2016 03:08:12 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Issue27203_-_F?= =?utf-8?q?ix_doctests_Doc/faq/programming=2Erst=2E?= Message-ID: <20160605030812.52151.55981.EEF90298@psf.io> https://hg.python.org/cpython/rev/fea14da8442d changeset: 101738:fea14da8442d branch: 3.5 parent: 101736:97bdba07e361 user: Senthil Kumaran date: Sat Jun 04 20:07:34 2016 -0700 summary: Issue27203 - Fix doctests Doc/faq/programming.rst. Patch contributed by Jelle Zijlstra. files: Doc/faq/programming.rst | 28 ++++++++++++++++++++-------- 1 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst --- a/Doc/faq/programming.rst +++ b/Doc/faq/programming.rst @@ -1171,16 +1171,28 @@ >>> A = [[None] * 2] * 3 -This looks correct if you print it:: +This looks correct if you print it: + +.. testsetup:: + + A = [[None] * 2] * 3 + +.. doctest:: >>> A [[None, None], [None, None], [None, None]] But when you assign a value, it shows up in multiple places: - >>> A[0][0] = 5 - >>> A - [[5, None], [5, None], [5, None]] +.. testsetup:: + + A = [[None] * 2] * 3 + +.. doctest:: + + >>> A[0][0] = 5 + >>> A + [[5, None], [5, None], [5, None]] The reason is that replicating a list with ``*`` doesn't create copies, it only creates references to the existing objects. The ``*3`` creates a list @@ -1664,9 +1676,9 @@ next freshly created object is allocated at the same position in memory. This is illustrated by this example: ->>> id(1000) +>>> id(1000) # doctest: +SKIP 13901272 ->>> id(2000) +>>> id(2000) # doctest: +SKIP 13901272 The two ids belong to different integer objects that are created before, and @@ -1675,9 +1687,9 @@ to the object: >>> a = 1000; b = 2000 ->>> id(a) +>>> id(a) # doctest: +SKIP 13901272 ->>> id(b) +>>> id(b) # doctest: +SKIP 13891296 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 23:08:12 2016 From: python-checkins at python.org (senthil.kumaran) Date: Sun, 05 Jun 2016 03:08:12 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_=5Bmerge_from_3=2E5=5D_-_Issue27203_-_Fix_doctests_Doc/f?= =?utf-8?q?aq/programming=2Erst=2E?= Message-ID: <20160605030812.20551.46628.314ABBD1@psf.io> https://hg.python.org/cpython/rev/4a072fff6945 changeset: 101739:4a072fff6945 parent: 101737:e89eb7935ca9 parent: 101738:fea14da8442d user: Senthil Kumaran date: Sat Jun 04 20:08:10 2016 -0700 summary: [merge from 3.5] - Issue27203 - Fix doctests Doc/faq/programming.rst. Patch contributed by Jelle Zijlstra. files: Doc/faq/programming.rst | 28 ++++++++++++++++++++-------- 1 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst --- a/Doc/faq/programming.rst +++ b/Doc/faq/programming.rst @@ -1172,16 +1172,28 @@ >>> A = [[None] * 2] * 3 -This looks correct if you print it:: +This looks correct if you print it: + +.. testsetup:: + + A = [[None] * 2] * 3 + +.. doctest:: >>> A [[None, None], [None, None], [None, None]] But when you assign a value, it shows up in multiple places: - >>> A[0][0] = 5 - >>> A - [[5, None], [5, None], [5, None]] +.. testsetup:: + + A = [[None] * 2] * 3 + +.. doctest:: + + >>> A[0][0] = 5 + >>> A + [[5, None], [5, None], [5, None]] The reason is that replicating a list with ``*`` doesn't create copies, it only creates references to the existing objects. The ``*3`` creates a list @@ -1665,9 +1677,9 @@ next freshly created object is allocated at the same position in memory. This is illustrated by this example: ->>> id(1000) +>>> id(1000) # doctest: +SKIP 13901272 ->>> id(2000) +>>> id(2000) # doctest: +SKIP 13901272 The two ids belong to different integer objects that are created before, and @@ -1676,9 +1688,9 @@ to the object: >>> a = 1000; b = 2000 ->>> id(a) +>>> id(a) # doctest: +SKIP 13901272 ->>> id(b) +>>> id(b) # doctest: +SKIP 13891296 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 23:53:40 2016 From: python-checkins at python.org (senthil.kumaran) Date: Sun, 05 Jun 2016 03:53:40 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_issue27202_-_E?= =?utf-8?q?xclude_2=2Ex_release_notes_from_python3_make_doctests=2E?= Message-ID: <20160605035340.15161.93337.0B045BE4@psf.io> https://hg.python.org/cpython/rev/70af472451cb changeset: 101740:70af472451cb branch: 3.5 parent: 101738:fea14da8442d user: Senthil Kumaran date: Sat Jun 04 20:52:57 2016 -0700 summary: issue27202 - Exclude 2.x release notes from python3 make doctests. Patch contributed by Jelle Zijlstra. files: Doc/conf.py | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Doc/conf.py b/Doc/conf.py --- a/Doc/conf.py +++ b/Doc/conf.py @@ -36,8 +36,9 @@ # Require Sphinx 1.2 for build. needs_sphinx = '1.2' -# Ignore any .rst files in the venv/ directory. -exclude_patterns = ['venv/*'] +# Ignore any .rst files in the venv/ directory, and don't attempt to run tests +# in the 2.x release notes. +exclude_patterns = ['venv/*', 'whatsnew/2.*.rst'] # Options for HTML output -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 4 23:53:41 2016 From: python-checkins at python.org (senthil.kumaran) Date: Sun, 05 Jun 2016 03:53:41 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_=5Bmerge_from_3=2E5=5D_-_issue27202_-_Exclude_2=2Ex_rele?= =?utf-8?q?ase_notes_from_python3_make?= Message-ID: <20160605035340.13571.24506.0273B200@psf.io> https://hg.python.org/cpython/rev/2bb806539ca6 changeset: 101741:2bb806539ca6 parent: 101739:4a072fff6945 parent: 101740:70af472451cb user: Senthil Kumaran date: Sat Jun 04 20:53:38 2016 -0700 summary: [merge from 3.5] - issue27202 - Exclude 2.x release notes from python3 make doctests. Patch contributed by Jelle Zijlstra. files: Doc/conf.py | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Doc/conf.py b/Doc/conf.py --- a/Doc/conf.py +++ b/Doc/conf.py @@ -36,8 +36,9 @@ # Require Sphinx 1.2 for build. needs_sphinx = '1.2' -# Ignore any .rst files in the venv/ directory. -exclude_patterns = ['venv/*'] +# Ignore any .rst files in the venv/ directory, and don't attempt to run tests +# in the 2.x release notes. +exclude_patterns = ['venv/*', 'whatsnew/2.*.rst'] # Options for HTML output -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 00:26:22 2016 From: python-checkins at python.org (berker.peksag) Date: Sun, 05 Jun 2016 04:26:22 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fix_typos_in_datetime_docu?= =?utf-8?q?mentation=2E?= Message-ID: <20160605042622.120019.8599.02FC0FAB@psf.io> https://hg.python.org/cpython/rev/ba2d03425bcb changeset: 101742:ba2d03425bcb user: Berker Peksag date: Sat Jun 04 21:36:53 2016 -0700 summary: Fix typos in datetime documentation. files: Doc/library/datetime.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -1466,9 +1466,9 @@ >>> from datetime import time - >>> time(hours=12, minute=34, second=56, microsecond=123456).isoformat(timespec='minutes') + >>> time(hour=12, minute=34, second=56, microsecond=123456).isoformat(timespec='minutes') '12:34' - >>> dt = time(hours=12, minute=34, second=56, microsecond=0) + >>> dt = time(hour=12, minute=34, second=56, microsecond=0) >>> dt.isoformat(timespec='microseconds') '12:34:56.000000' >>> dt.isoformat(timespec='auto') -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 00:37:45 2016 From: python-checkins at python.org (berker.peksag) Date: Sun, 05 Jun 2016 04:37:45 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2317888=3A_Merge_from_3=2E5?= Message-ID: <20160605043745.13672.42978.D4DBAB9B@psf.io> https://hg.python.org/cpython/rev/1f8181e66b36 changeset: 101744:1f8181e66b36 parent: 101742:ba2d03425bcb parent: 101743:3136c67eac4d user: Berker Peksag date: Sat Jun 04 21:48:16 2016 -0700 summary: Issue #17888: Merge from 3.5 files: Doc/bugs.rst | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Doc/bugs.rst b/Doc/bugs.rst --- a/Doc/bugs.rst +++ b/Doc/bugs.rst @@ -1,13 +1,16 @@ .. _reporting-bugs: -************** -Reporting Bugs -************** +***************** +Dealing with Bugs +***************** Python is a mature programming language which has established a reputation for stability. In order to maintain this reputation, the developers would like to know of any deficiencies you find in Python. +It can be sometimes faster to fix bugs yourself and contribute patches to +Python as it streamlines the process and involves less people. Learn how to +:ref:`contribute `. Documentation bugs ================== @@ -73,6 +76,7 @@ Information about writing a good bug report. Some of this is specific to the Mozilla project, but describes general good practices. +.. _contributing-to-python: Getting started contributing to Python yourself =============================================== -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 00:37:47 2016 From: python-checkins at python.org (berker.peksag) Date: Sun, 05 Jun 2016 04:37:47 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzE3ODg4?= =?utf-8?q?=3A_Add_a_note_about_contributing_to_Python_docs?= Message-ID: <20160605043745.13538.44214.DC44371D@psf.io> https://hg.python.org/cpython/rev/3136c67eac4d changeset: 101743:3136c67eac4d branch: 3.5 parent: 101740:70af472451cb user: Berker Peksag date: Sat Jun 04 21:47:44 2016 -0700 summary: Issue #17888: Add a note about contributing to Python docs Patch by Terry Chia and Laura Rupprecht. files: Doc/bugs.rst | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Doc/bugs.rst b/Doc/bugs.rst --- a/Doc/bugs.rst +++ b/Doc/bugs.rst @@ -1,13 +1,16 @@ .. _reporting-bugs: -************** -Reporting Bugs -************** +***************** +Dealing with Bugs +***************** Python is a mature programming language which has established a reputation for stability. In order to maintain this reputation, the developers would like to know of any deficiencies you find in Python. +It can be sometimes faster to fix bugs yourself and contribute patches to +Python as it streamlines the process and involves less people. Learn how to +:ref:`contribute `. Documentation bugs ================== @@ -73,6 +76,7 @@ Information about writing a good bug report. Some of this is specific to the Mozilla project, but describes general good practices. +.. _contributing-to-python: Getting started contributing to Python yourself =============================================== -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 01:23:20 2016 From: python-checkins at python.org (senthil.kumaran) Date: Sun, 05 Jun 2016 05:23:20 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_=5Bmerge_from_3=2E5=5D_-_issue27202_-_Fix_the_mistake_in?= =?utf-8?q?_changesets_70af472451cb?= Message-ID: <20160605052320.13629.88899.DA06253C@psf.io> https://hg.python.org/cpython/rev/31573473a50e changeset: 101746:31573473a50e parent: 101744:1f8181e66b36 parent: 101745:378c1d09b256 user: Senthil Kumaran date: Sat Jun 04 22:23:18 2016 -0700 summary: [merge from 3.5] - issue27202 - Fix the mistake in changesets 70af472451cb (3.5) and 2bb806539ca6 (3.6) exclude_patterns in Sphinx conf.py will exclude the .rsts from the build. It was incorrect exclude 2.x rsts in that. This fix contributed again Jelle Zijlstra, excludes doctests in whatsnew/2.7.rst from being exercised by using doctests skip option. files: Doc/conf.py | 5 +-- Doc/whatsnew/2.7.rst | 34 ++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/Doc/conf.py b/Doc/conf.py --- a/Doc/conf.py +++ b/Doc/conf.py @@ -36,9 +36,8 @@ # Require Sphinx 1.2 for build. needs_sphinx = '1.2' -# Ignore any .rst files in the venv/ directory, and don't attempt to run tests -# in the 2.x release notes. -exclude_patterns = ['venv/*', 'whatsnew/2.*.rst'] +# Ignore any .rst files in the venv/ directory. +exclude_patterns = ['venv/*'] # Options for HTML output 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 @@ -613,6 +613,9 @@ The :class:`memoryview` object provides a view of another object's memory content that matches the :class:`bytes` type's interface. +.. doctest:: + :options: +SKIP + >>> import string >>> m = memoryview(string.letters) >>> m @@ -628,6 +631,9 @@ The content of the view can be converted to a string of bytes or a list of integers: +.. doctest:: + :options: +SKIP + >>> m2.tobytes() 'abcdefghijklmnopqrstuvwxyz' >>> m2.tolist() @@ -637,6 +643,9 @@ :class:`memoryview` objects allow modifying the underlying object if it's a mutable object. +.. doctest:: + :options: +SKIP + >>> m2[0] = 75 Traceback (most recent call last): File "", line 1, in @@ -671,6 +680,9 @@ ``{}`` continues to represent an empty dictionary; use ``set()`` for an empty set. + .. doctest:: + :options: +SKIP + >>> {1, 2, 3, 4, 5} set([1, 2, 3, 4, 5]) >>> set() # empty set @@ -684,6 +696,9 @@ 3.x, generalizing list/generator comprehensions to use the literal syntax for sets and dictionaries. + .. doctest:: + :options: +SKIP + >>> {x: x*x for x in range(6)} {0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25} >>> {('a'*x) for x in range(6)} @@ -1052,7 +1067,7 @@ >>> for letter in 'here is a sample of english text': ... c[letter] += 1 ... - >>> c + >>> c # doctest: +SKIP Counter({' ': 6, 'e': 5, 's': 3, 'a': 2, 'i': 2, 'h': 2, 'l': 2, 't': 2, 'g': 1, 'f': 1, 'm': 1, 'o': 1, 'n': 1, 'p': 1, 'r': 1, 'x': 1}) @@ -1638,12 +1653,18 @@ worked around the old behaviour. For example, Python 2.6.4 or 2.5 will return the following: + .. doctest:: + :options: +SKIP + >>> import urlparse >>> urlparse.urlsplit('invented://host/filename?query') ('invented', '', '//host/filename?query', '', '') Python 2.7 (and Python 2.6.5) will return: + .. doctest:: + :options: +SKIP + >>> import urlparse >>> urlparse.urlsplit('invented://host/filename?query') ('invented', 'host', '/filename?query', '', '') @@ -1652,7 +1673,10 @@ returns a named tuple instead of a standard tuple.) The :mod:`urlparse` module also supports IPv6 literal addresses as defined by - :rfc:`2732` (contributed by Senthil Kumaran; :issue:`2987`). :: + :rfc:`2732` (contributed by Senthil Kumaran; :issue:`2987`). + + .. doctest:: + :options: +SKIP >>> urlparse.urlparse('http://[1080::8:800:200C:417A]/foo') ParseResult(scheme='http', netloc='[1080::8:800:200C:417A]', @@ -2475,12 +2499,18 @@ worked around the old behaviour. For example, Python 2.6.4 or 2.5 will return the following: + .. doctest:: + :options: +SKIP + >>> import urlparse >>> urlparse.urlsplit('invented://host/filename?query') ('invented', '', '//host/filename?query', '', '') Python 2.7 (and Python 2.6.5) will return: + .. doctest:: + :options: +SKIP + >>> import urlparse >>> urlparse.urlsplit('invented://host/filename?query') ('invented', 'host', '/filename?query', '', '') -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 01:23:21 2016 From: python-checkins at python.org (senthil.kumaran) Date: Sun, 05 Jun 2016 05:23:21 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_issue27202_-_F?= =?utf-8?q?ix_the_mistake_in_changesets_70af472451cb_=283=2E5=29_and_2bb80?= =?utf-8?q?6539ca6?= Message-ID: <20160605052320.992.85747.B8122BF2@psf.io> https://hg.python.org/cpython/rev/378c1d09b256 changeset: 101745:378c1d09b256 branch: 3.5 parent: 101743:3136c67eac4d user: Senthil Kumaran date: Sat Jun 04 22:22:26 2016 -0700 summary: issue27202 - Fix the mistake in changesets 70af472451cb (3.5) and 2bb806539ca6 (3.6) exclude_patterns in Sphinx conf.py will exclude the .rsts from the build. It was incorrect exclude 2.x rsts in that. This fix contributed again Jelle Zijlstra, excludes doctests in whatsnew/2.7.rst from being exercised by using doctests skip option. files: Doc/conf.py | 5 +-- Doc/whatsnew/2.7.rst | 34 ++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/Doc/conf.py b/Doc/conf.py --- a/Doc/conf.py +++ b/Doc/conf.py @@ -36,9 +36,8 @@ # Require Sphinx 1.2 for build. needs_sphinx = '1.2' -# Ignore any .rst files in the venv/ directory, and don't attempt to run tests -# in the 2.x release notes. -exclude_patterns = ['venv/*', 'whatsnew/2.*.rst'] +# Ignore any .rst files in the venv/ directory. +exclude_patterns = ['venv/*'] # Options for HTML output 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 @@ -613,6 +613,9 @@ The :class:`memoryview` object provides a view of another object's memory content that matches the :class:`bytes` type's interface. +.. doctest:: + :options: +SKIP + >>> import string >>> m = memoryview(string.letters) >>> m @@ -628,6 +631,9 @@ The content of the view can be converted to a string of bytes or a list of integers: +.. doctest:: + :options: +SKIP + >>> m2.tobytes() 'abcdefghijklmnopqrstuvwxyz' >>> m2.tolist() @@ -637,6 +643,9 @@ :class:`memoryview` objects allow modifying the underlying object if it's a mutable object. +.. doctest:: + :options: +SKIP + >>> m2[0] = 75 Traceback (most recent call last): File "", line 1, in @@ -671,6 +680,9 @@ ``{}`` continues to represent an empty dictionary; use ``set()`` for an empty set. + .. doctest:: + :options: +SKIP + >>> {1, 2, 3, 4, 5} set([1, 2, 3, 4, 5]) >>> set() # empty set @@ -684,6 +696,9 @@ 3.x, generalizing list/generator comprehensions to use the literal syntax for sets and dictionaries. + .. doctest:: + :options: +SKIP + >>> {x: x*x for x in range(6)} {0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25} >>> {('a'*x) for x in range(6)} @@ -1052,7 +1067,7 @@ >>> for letter in 'here is a sample of english text': ... c[letter] += 1 ... - >>> c + >>> c # doctest: +SKIP Counter({' ': 6, 'e': 5, 's': 3, 'a': 2, 'i': 2, 'h': 2, 'l': 2, 't': 2, 'g': 1, 'f': 1, 'm': 1, 'o': 1, 'n': 1, 'p': 1, 'r': 1, 'x': 1}) @@ -1638,12 +1653,18 @@ worked around the old behaviour. For example, Python 2.6.4 or 2.5 will return the following: + .. doctest:: + :options: +SKIP + >>> import urlparse >>> urlparse.urlsplit('invented://host/filename?query') ('invented', '', '//host/filename?query', '', '') Python 2.7 (and Python 2.6.5) will return: + .. doctest:: + :options: +SKIP + >>> import urlparse >>> urlparse.urlsplit('invented://host/filename?query') ('invented', 'host', '/filename?query', '', '') @@ -1652,7 +1673,10 @@ returns a named tuple instead of a standard tuple.) The :mod:`urlparse` module also supports IPv6 literal addresses as defined by - :rfc:`2732` (contributed by Senthil Kumaran; :issue:`2987`). :: + :rfc:`2732` (contributed by Senthil Kumaran; :issue:`2987`). + + .. doctest:: + :options: +SKIP >>> urlparse.urlparse('http://[1080::8:800:200C:417A]/foo') ParseResult(scheme='http', netloc='[1080::8:800:200C:417A]', @@ -2475,12 +2499,18 @@ worked around the old behaviour. For example, Python 2.6.4 or 2.5 will return the following: + .. doctest:: + :options: +SKIP + >>> import urlparse >>> urlparse.urlsplit('invented://host/filename?query') ('invented', '', '//host/filename?query', '', '') Python 2.7 (and Python 2.6.5) will return: + .. doctest:: + :options: +SKIP + >>> import urlparse >>> urlparse.urlsplit('invented://host/filename?query') ('invented', 'host', '/filename?query', '', '') -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 02:59:09 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 05 Jun 2016 06:59:09 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI0Mjkx?= =?utf-8?q?=3A_Avoid_WSGIRequestHandler_doing_partial_writes?= Message-ID: <20160605065909.15269.47533.C3EC3667@psf.io> https://hg.python.org/cpython/rev/a57703119f40 changeset: 101747:a57703119f40 branch: 3.5 parent: 101745:378c1d09b256 user: Martin Panter date: Sun Jun 05 06:28:55 2016 +0000 summary: Issue #24291: Avoid WSGIRequestHandler doing partial writes If the underlying send() method indicates a partial write, such as when the call is interrupted to handle a signal, the server would silently drop the remaining data. Also add deprecated support for SimpleHandler.stdout.write() doing partial writes. files: Doc/library/wsgiref.rst | 3 + Lib/test/test_wsgiref.py | 81 +++++++++++++++++++++++- Lib/wsgiref/handlers.py | 12 +++- Lib/wsgiref/simple_server.py | 17 +++- Misc/NEWS | 5 + 5 files changed, 111 insertions(+), 7 deletions(-) diff --git a/Doc/library/wsgiref.rst b/Doc/library/wsgiref.rst --- a/Doc/library/wsgiref.rst +++ b/Doc/library/wsgiref.rst @@ -515,6 +515,9 @@ streams are stored in the :attr:`stdin`, :attr:`stdout`, :attr:`stderr`, and :attr:`environ` attributes. + The :meth:`~io.BufferedIOBase.write` method of *stdout* should write + each chunk in full, like :class:`io.BufferedIOBase`. + .. class:: BaseHandler() diff --git a/Lib/test/test_wsgiref.py b/Lib/test/test_wsgiref.py --- a/Lib/test/test_wsgiref.py +++ b/Lib/test/test_wsgiref.py @@ -1,18 +1,22 @@ from unittest import mock +from test import support +from test.test_httpservers import NoLogRequestHandler from unittest import TestCase from wsgiref.util import setup_testing_defaults from wsgiref.headers import Headers -from wsgiref.handlers import BaseHandler, BaseCGIHandler +from wsgiref.handlers import BaseHandler, BaseCGIHandler, SimpleHandler from wsgiref import util from wsgiref.validate import validator from wsgiref.simple_server import WSGIServer, WSGIRequestHandler from wsgiref.simple_server import make_server +from http.client import HTTPConnection from io import StringIO, BytesIO, BufferedReader from socketserver import BaseServer from platform import python_implementation import os import re +import signal import sys import unittest @@ -245,6 +249,56 @@ ], out.splitlines()) + def test_interrupted_write(self): + # BaseHandler._write() and _flush() have to write all data, even if + # it takes multiple send() calls. Test this by interrupting a send() + # call with a Unix signal. + threading = support.import_module("threading") + pthread_kill = support.get_attribute(signal, "pthread_kill") + + def app(environ, start_response): + start_response("200 OK", []) + return [bytes(support.SOCK_MAX_SIZE)] + + class WsgiHandler(NoLogRequestHandler, WSGIRequestHandler): + pass + + server = make_server(support.HOST, 0, app, handler_class=WsgiHandler) + self.addCleanup(server.server_close) + interrupted = threading.Event() + + def signal_handler(signum, frame): + interrupted.set() + + original = signal.signal(signal.SIGUSR1, signal_handler) + self.addCleanup(signal.signal, signal.SIGUSR1, original) + received = None + main_thread = threading.get_ident() + + def run_client(): + http = HTTPConnection(*server.server_address) + http.request("GET", "/") + with http.getresponse() as response: + response.read(100) + # The main thread should now be blocking in a send() system + # call. But in theory, it could get interrupted by other + # signals, and then retried. So keep sending the signal in a + # loop, in case an earlier signal happens to be delivered at + # an inconvenient moment. + while True: + pthread_kill(main_thread, signal.SIGUSR1) + if interrupted.wait(timeout=float(1)): + break + nonlocal received + received = len(response.read()) + http.close() + + background = threading.Thread(target=run_client) + background.start() + server.handle_request() + background.join() + self.assertEqual(received, support.SOCK_MAX_SIZE - 100) + class UtilityTests(TestCase): @@ -701,6 +755,31 @@ h.run(error_app) self.assertEqual(side_effects['close_called'], True) + def testPartialWrite(self): + written = bytearray() + + class PartialWriter: + def write(self, b): + partial = b[:7] + written.extend(partial) + return len(partial) + + def flush(self): + pass + + environ = {"SERVER_PROTOCOL": "HTTP/1.0"} + h = SimpleHandler(BytesIO(), PartialWriter(), sys.stderr, environ) + msg = "should not do partial writes" + with self.assertWarnsRegex(DeprecationWarning, msg): + h.run(hello_app) + self.assertEqual(b"HTTP/1.0 200 OK\r\n" + b"Content-Type: text/plain\r\n" + b"Date: Mon, 05 Jun 2006 18:49:54 GMT\r\n" + b"Content-Length: 13\r\n" + b"\r\n" + b"Hello, world!", + written) + if __name__ == "__main__": unittest.main() diff --git a/Lib/wsgiref/handlers.py b/Lib/wsgiref/handlers.py --- a/Lib/wsgiref/handlers.py +++ b/Lib/wsgiref/handlers.py @@ -450,7 +450,17 @@ self.environ.update(self.base_env) def _write(self,data): - self.stdout.write(data) + result = self.stdout.write(data) + if result is None or result == len(data): + return + from warnings import warn + warn("SimpleHandler.stdout.write() should not do partial writes", + DeprecationWarning) + while True: + data = data[result:] + if not data: + break + result = self.stdout.write(data) def _flush(self): self.stdout.flush() diff --git a/Lib/wsgiref/simple_server.py b/Lib/wsgiref/simple_server.py --- a/Lib/wsgiref/simple_server.py +++ b/Lib/wsgiref/simple_server.py @@ -11,6 +11,7 @@ """ from http.server import BaseHTTPRequestHandler, HTTPServer +from io import BufferedWriter import sys import urllib.parse from wsgiref.handlers import SimpleHandler @@ -126,11 +127,17 @@ if not self.parse_request(): # An error code has been sent, just exit return - handler = ServerHandler( - self.rfile, self.wfile, self.get_stderr(), self.get_environ() - ) - handler.request_handler = self # backpointer for logging - handler.run(self.server.get_app()) + # Avoid passing the raw file object wfile, which can do partial + # writes (Issue 24291) + stdout = BufferedWriter(self.wfile) + try: + handler = ServerHandler( + self.rfile, stdout, self.get_stderr(), self.get_environ() + ) + handler.request_handler = self # backpointer for logging + handler.run(self.server.get_app()) + finally: + stdout.detach() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -131,6 +131,11 @@ Library ------- +- Issue #24291: Fix wsgiref.simple_server.WSGIRequestHandler to completely + write data to the client. Previously it could do partial writes and + truncate data. Also, wsgiref.handler.ServerHandler can now handle stdout + doing partial writes, but this is deprecated. + - Issue #26809: Add ``__all__`` to :mod:`string`. Patch by Emanuel Barry. - Issue #26373: subprocess.Popen.communicate now correctly ignores -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 02:59:09 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 05 Jun 2016 06:59:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2324291=3A_Merge_wsgi_partial_write_fix_from_3=2E?= =?utf-8?q?5?= Message-ID: <20160605065909.13521.82130.C30AE6BC@psf.io> https://hg.python.org/cpython/rev/d8f021944e0b changeset: 101748:d8f021944e0b parent: 101746:31573473a50e parent: 101747:a57703119f40 user: Martin Panter date: Sun Jun 05 06:56:51 2016 +0000 summary: Issue #24291: Merge wsgi partial write fix from 3.5 files: Doc/library/wsgiref.rst | 3 + Lib/test/test_wsgiref.py | 81 +++++++++++++++++++++++- Lib/wsgiref/handlers.py | 12 +++- Lib/wsgiref/simple_server.py | 17 +++- Misc/NEWS | 5 + 5 files changed, 111 insertions(+), 7 deletions(-) diff --git a/Doc/library/wsgiref.rst b/Doc/library/wsgiref.rst --- a/Doc/library/wsgiref.rst +++ b/Doc/library/wsgiref.rst @@ -515,6 +515,9 @@ streams are stored in the :attr:`stdin`, :attr:`stdout`, :attr:`stderr`, and :attr:`environ` attributes. + The :meth:`~io.BufferedIOBase.write` method of *stdout* should write + each chunk in full, like :class:`io.BufferedIOBase`. + .. class:: BaseHandler() diff --git a/Lib/test/test_wsgiref.py b/Lib/test/test_wsgiref.py --- a/Lib/test/test_wsgiref.py +++ b/Lib/test/test_wsgiref.py @@ -1,18 +1,22 @@ from unittest import mock +from test import support +from test.test_httpservers import NoLogRequestHandler from unittest import TestCase from wsgiref.util import setup_testing_defaults from wsgiref.headers import Headers -from wsgiref.handlers import BaseHandler, BaseCGIHandler +from wsgiref.handlers import BaseHandler, BaseCGIHandler, SimpleHandler from wsgiref import util from wsgiref.validate import validator from wsgiref.simple_server import WSGIServer, WSGIRequestHandler from wsgiref.simple_server import make_server +from http.client import HTTPConnection from io import StringIO, BytesIO, BufferedReader from socketserver import BaseServer from platform import python_implementation import os import re +import signal import sys import unittest @@ -245,6 +249,56 @@ ], out.splitlines()) + def test_interrupted_write(self): + # BaseHandler._write() and _flush() have to write all data, even if + # it takes multiple send() calls. Test this by interrupting a send() + # call with a Unix signal. + threading = support.import_module("threading") + pthread_kill = support.get_attribute(signal, "pthread_kill") + + def app(environ, start_response): + start_response("200 OK", []) + return [bytes(support.SOCK_MAX_SIZE)] + + class WsgiHandler(NoLogRequestHandler, WSGIRequestHandler): + pass + + server = make_server(support.HOST, 0, app, handler_class=WsgiHandler) + self.addCleanup(server.server_close) + interrupted = threading.Event() + + def signal_handler(signum, frame): + interrupted.set() + + original = signal.signal(signal.SIGUSR1, signal_handler) + self.addCleanup(signal.signal, signal.SIGUSR1, original) + received = None + main_thread = threading.get_ident() + + def run_client(): + http = HTTPConnection(*server.server_address) + http.request("GET", "/") + with http.getresponse() as response: + response.read(100) + # The main thread should now be blocking in a send() system + # call. But in theory, it could get interrupted by other + # signals, and then retried. So keep sending the signal in a + # loop, in case an earlier signal happens to be delivered at + # an inconvenient moment. + while True: + pthread_kill(main_thread, signal.SIGUSR1) + if interrupted.wait(timeout=float(1)): + break + nonlocal received + received = len(response.read()) + http.close() + + background = threading.Thread(target=run_client) + background.start() + server.handle_request() + background.join() + self.assertEqual(received, support.SOCK_MAX_SIZE - 100) + class UtilityTests(TestCase): @@ -701,6 +755,31 @@ h.run(error_app) self.assertEqual(side_effects['close_called'], True) + def testPartialWrite(self): + written = bytearray() + + class PartialWriter: + def write(self, b): + partial = b[:7] + written.extend(partial) + return len(partial) + + def flush(self): + pass + + environ = {"SERVER_PROTOCOL": "HTTP/1.0"} + h = SimpleHandler(BytesIO(), PartialWriter(), sys.stderr, environ) + msg = "should not do partial writes" + with self.assertWarnsRegex(DeprecationWarning, msg): + h.run(hello_app) + self.assertEqual(b"HTTP/1.0 200 OK\r\n" + b"Content-Type: text/plain\r\n" + b"Date: Mon, 05 Jun 2006 18:49:54 GMT\r\n" + b"Content-Length: 13\r\n" + b"\r\n" + b"Hello, world!", + written) + if __name__ == "__main__": unittest.main() diff --git a/Lib/wsgiref/handlers.py b/Lib/wsgiref/handlers.py --- a/Lib/wsgiref/handlers.py +++ b/Lib/wsgiref/handlers.py @@ -450,7 +450,17 @@ self.environ.update(self.base_env) def _write(self,data): - self.stdout.write(data) + result = self.stdout.write(data) + if result is None or result == len(data): + return + from warnings import warn + warn("SimpleHandler.stdout.write() should not do partial writes", + DeprecationWarning) + while True: + data = data[result:] + if not data: + break + result = self.stdout.write(data) def _flush(self): self.stdout.flush() diff --git a/Lib/wsgiref/simple_server.py b/Lib/wsgiref/simple_server.py --- a/Lib/wsgiref/simple_server.py +++ b/Lib/wsgiref/simple_server.py @@ -11,6 +11,7 @@ """ from http.server import BaseHTTPRequestHandler, HTTPServer +from io import BufferedWriter import sys import urllib.parse from wsgiref.handlers import SimpleHandler @@ -126,11 +127,17 @@ if not self.parse_request(): # An error code has been sent, just exit return - handler = ServerHandler( - self.rfile, self.wfile, self.get_stderr(), self.get_environ() - ) - handler.request_handler = self # backpointer for logging - handler.run(self.server.get_app()) + # Avoid passing the raw file object wfile, which can do partial + # writes (Issue 24291) + stdout = BufferedWriter(self.wfile) + try: + handler = ServerHandler( + self.rfile, stdout, self.get_stderr(), self.get_environ() + ) + handler.request_handler = self # backpointer for logging + handler.run(self.server.get_app()) + finally: + stdout.detach() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,11 @@ Library ------- +- Issue #24291: Fix wsgiref.simple_server.WSGIRequestHandler to completely + write data to the client. Previously it could do partial writes and + truncate data. Also, wsgiref.handler.ServerHandler can now handle stdout + doing partial writes, but this is deprecated. + - Issue #21272: Use _sysconfigdata.py to initialize distutils.sysconfig. - Issue #19611: :mod:`inspect` now reports the implicit ``.0`` parameters -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 03:38:16 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 05 Jun 2016 07:38:16 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIxOTE2?= =?utf-8?q?=3A_Added_more_tests_for_the_turtle_module=2E?= Message-ID: <20160605073815.23417.19306.1F851D2A@psf.io> https://hg.python.org/cpython/rev/5c1befa401ca changeset: 101749:5c1befa401ca branch: 3.5 parent: 101747:a57703119f40 user: Serhiy Storchaka date: Sun Jun 05 10:32:57 2016 +0300 summary: Issue #21916: Added more tests for the turtle module. Original patch by Jelle Zijlstra. files: Lib/test/test_turtle.py | 36 +++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_turtle.py b/Lib/test/test_turtle.py --- a/Lib/test/test_turtle.py +++ b/Lib/test/test_turtle.py @@ -1,3 +1,4 @@ +import pickle import unittest from test import support @@ -129,6 +130,41 @@ class TestVec2D(VectorComparisonMixin, unittest.TestCase): + def test_constructor(self): + vec = Vec2D(0.5, 2) + self.assertEqual(vec[0], 0.5) + self.assertEqual(vec[1], 2) + self.assertIsInstance(vec, Vec2D) + + self.assertRaises(TypeError, Vec2D) + self.assertRaises(TypeError, Vec2D, 0) + self.assertRaises(TypeError, Vec2D, (0, 1)) + self.assertRaises(TypeError, Vec2D, vec) + self.assertRaises(TypeError, Vec2D, 0, 1, 2) + + def test_repr(self): + vec = Vec2D(0.567, 1.234) + self.assertEqual(repr(vec), '(0.57,1.23)') + + def test_equality(self): + vec1 = Vec2D(0, 1) + vec2 = Vec2D(0.0, 1) + vec3 = Vec2D(42, 1) + self.assertEqual(vec1, vec2) + self.assertEqual(vec1, tuple(vec1)) + self.assertEqual(tuple(vec1), vec1) + self.assertNotEqual(vec1, vec3) + self.assertNotEqual(vec2, vec3) + + def test_pickling(self): + vec = Vec2D(0.5, 2) + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + with self.subTest(proto=proto): + pickled = pickle.dumps(vec, protocol=proto) + unpickled = pickle.loads(pickled) + self.assertEqual(unpickled, vec) + self.assertIsInstance(unpickled, Vec2D) + def _assert_arithmetic_cases(self, test_cases, lambda_operator): for test_case in test_cases: with self.subTest(case=test_case): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 03:38:16 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 05 Jun 2016 07:38:16 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzIxOTE2?= =?utf-8?q?=3A_Added_more_tests_for_the_turtle_module=2E?= Message-ID: <20160605073816.1234.16077.7ADDE3C1@psf.io> https://hg.python.org/cpython/rev/41fa38ea46ba changeset: 101750:41fa38ea46ba branch: 2.7 parent: 101733:d858eadf2602 user: Serhiy Storchaka date: Sun Jun 05 10:35:34 2016 +0300 summary: Issue #21916: Added more tests for the turtle module. Original patch by Jelle Zijlstra. files: Lib/test/test_turtle.py | 35 +++++++++++++++++++++++++++++ 1 files changed, 35 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_turtle.py b/Lib/test/test_turtle.py --- a/Lib/test/test_turtle.py +++ b/Lib/test/test_turtle.py @@ -1,3 +1,4 @@ +import pickle import unittest from test import test_support as support @@ -129,6 +130,40 @@ class TestVec2D(VectorComparisonMixin, unittest.TestCase): + def test_constructor(self): + vec = Vec2D(0.5, 2) + self.assertEqual(vec[0], 0.5) + self.assertEqual(vec[1], 2) + self.assertIsInstance(vec, Vec2D) + + self.assertRaises(TypeError, Vec2D) + self.assertRaises(TypeError, Vec2D, 0) + self.assertRaises(TypeError, Vec2D, (0, 1)) + self.assertRaises(TypeError, Vec2D, vec) + self.assertRaises(TypeError, Vec2D, 0, 1, 2) + + def test_repr(self): + vec = Vec2D(0.567, 1.234) + self.assertEqual(repr(vec), '(0.57,1.23)') + + def test_equality(self): + vec1 = Vec2D(0, 1) + vec2 = Vec2D(0.0, 1) + vec3 = Vec2D(42, 1) + self.assertEqual(vec1, vec2) + self.assertEqual(vec1, tuple(vec1)) + self.assertEqual(tuple(vec1), vec1) + self.assertNotEqual(vec1, vec3) + self.assertNotEqual(vec2, vec3) + + def test_pickling(self): + vec = Vec2D(0.5, 2) + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + pickled = pickle.dumps(vec, protocol=proto) + unpickled = pickle.loads(pickled) + self.assertEqual(unpickled, vec) + self.assertIsInstance(unpickled, Vec2D) + def _assert_arithmetic_cases(self, test_cases, lambda_operator): for test_case in test_cases: ((first, second), expected) = test_case -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 03:38:21 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 05 Jun 2016 07:38:21 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2321916=3A_Added_more_tests_for_the_turtle_module?= =?utf-8?q?=2E?= Message-ID: <20160605073821.1215.67598.EA3469FC@psf.io> https://hg.python.org/cpython/rev/356f411e8c5c changeset: 101751:356f411e8c5c parent: 101748:d8f021944e0b parent: 101749:5c1befa401ca user: Serhiy Storchaka date: Sun Jun 05 10:37:19 2016 +0300 summary: Issue #21916: Added more tests for the turtle module. Original patch by Jelle Zijlstra. files: Lib/test/test_turtle.py | 36 +++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_turtle.py b/Lib/test/test_turtle.py --- a/Lib/test/test_turtle.py +++ b/Lib/test/test_turtle.py @@ -1,3 +1,4 @@ +import pickle import unittest from test import support @@ -129,6 +130,41 @@ class TestVec2D(VectorComparisonMixin, unittest.TestCase): + def test_constructor(self): + vec = Vec2D(0.5, 2) + self.assertEqual(vec[0], 0.5) + self.assertEqual(vec[1], 2) + self.assertIsInstance(vec, Vec2D) + + self.assertRaises(TypeError, Vec2D) + self.assertRaises(TypeError, Vec2D, 0) + self.assertRaises(TypeError, Vec2D, (0, 1)) + self.assertRaises(TypeError, Vec2D, vec) + self.assertRaises(TypeError, Vec2D, 0, 1, 2) + + def test_repr(self): + vec = Vec2D(0.567, 1.234) + self.assertEqual(repr(vec), '(0.57,1.23)') + + def test_equality(self): + vec1 = Vec2D(0, 1) + vec2 = Vec2D(0.0, 1) + vec3 = Vec2D(42, 1) + self.assertEqual(vec1, vec2) + self.assertEqual(vec1, tuple(vec1)) + self.assertEqual(tuple(vec1), vec1) + self.assertNotEqual(vec1, vec3) + self.assertNotEqual(vec2, vec3) + + def test_pickling(self): + vec = Vec2D(0.5, 2) + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + with self.subTest(proto=proto): + pickled = pickle.dumps(vec, protocol=proto) + unpickled = pickle.loads(pickled) + self.assertEqual(unpickled, vec) + self.assertIsInstance(unpickled, Vec2D) + def _assert_arithmetic_cases(self, test_cases, lambda_operator): for test_case in test_cases: with self.subTest(case=test_case): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 04:07:10 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 05 Jun 2016 08:07:10 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MjI1?= =?utf-8?q?=3A_Fixed_a_reference_leak_in_type=5Fnew_when_setting_=5F=5Fnew?= =?utf-8?b?X18gZmFpbHMu?= Message-ID: <20160605080710.13642.7444.3E2D837B@psf.io> https://hg.python.org/cpython/rev/33b53734805b changeset: 101752:33b53734805b branch: 3.5 parent: 101749:5c1befa401ca user: Serhiy Storchaka date: Sun Jun 05 10:48:36 2016 +0300 summary: Issue #27225: Fixed a reference leak in type_new when setting __new__ fails. Patch by Xiang Zhang. files: Objects/typeobject.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2575,8 +2575,10 @@ tmp = PyStaticMethod_New(tmp); if (tmp == NULL) goto error; - if (_PyDict_SetItemId(dict, &PyId___new__, tmp) < 0) + if (_PyDict_SetItemId(dict, &PyId___new__, tmp) < 0) { + Py_DECREF(tmp); goto error; + } Py_DECREF(tmp); } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 04:07:16 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 05 Jun 2016 08:07:16 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327225=3A_Fixed_a_reference_leak_in_type=5Fnew_w?= =?utf-8?q?hen_setting_=5F=5Fnew=5F=5F_fails=2E?= Message-ID: <20160605080715.13710.32041.981DEAE3@psf.io> https://hg.python.org/cpython/rev/31ad7885e2e5 changeset: 101753:31ad7885e2e5 parent: 101751:356f411e8c5c parent: 101752:33b53734805b user: Serhiy Storchaka date: Sun Jun 05 10:50:16 2016 +0300 summary: Issue #27225: Fixed a reference leak in type_new when setting __new__ fails. Patch by Xiang Zhang. files: Objects/typeobject.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2580,8 +2580,10 @@ tmp = PyStaticMethod_New(tmp); if (tmp == NULL) goto error; - if (_PyDict_SetItemId(dict, &PyId___new__, tmp) < 0) + if (_PyDict_SetItemId(dict, &PyId___new__, tmp) < 0) { + Py_DECREF(tmp); goto error; + } Py_DECREF(tmp); } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 04:07:16 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 05 Jun 2016 08:07:16 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI3MjI1?= =?utf-8?q?=3A_Fixed_a_reference_leak_in_type=5Fnew_when_setting_=5F=5Fnew?= =?utf-8?b?X18gZmFpbHMu?= Message-ID: <20160605080715.15161.33284.A95EB438@psf.io> https://hg.python.org/cpython/rev/db24d51c69d3 changeset: 101754:db24d51c69d3 branch: 2.7 parent: 101750:41fa38ea46ba user: Serhiy Storchaka date: Sun Jun 05 11:06:42 2016 +0300 summary: Issue #27225: Fixed a reference leak in type_new when setting __new__ fails. Original patch by Xiang Zhang. files: Objects/typeobject.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2430,7 +2430,11 @@ Py_DECREF(type); return NULL; } - PyDict_SetItemString(dict, "__new__", tmp); + if (PyDict_SetItemString(dict, "__new__", tmp) < 0) { + Py_DECREF(tmp); + Py_DECREF(type); + return NULL; + } Py_DECREF(tmp); } -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Sun Jun 5 04:50:56 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 05 Jun 2016 08:50:56 +0000 Subject: [Python-checkins] Daily reference leaks (31573473a50e): sum=2 Message-ID: <20160605085055.15222.50828.4F2882F4@psf.io> results for 31573473a50e on branch "default" -------------------------------------------- test_collections leaked [0, 4, -4] memory blocks, sum=0 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_fork leaked [0, 0, -2] memory blocks, sum=-2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflog4YDzDE', '--timeout', '7200'] From python-checkins at python.org Sun Jun 5 08:36:53 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 05 Jun 2016 12:36:53 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MTY0?= =?utf-8?q?=3A_Allow_decompressing_raw_Deflate_streams_with_predefined_zdi?= =?utf-8?q?ct?= Message-ID: <20160605123653.20938.52716.429387F9@psf.io> https://hg.python.org/cpython/rev/d91b951e676f changeset: 101755:d91b951e676f branch: 3.5 parent: 101752:33b53734805b user: Martin Panter date: Sun Jun 05 10:48:34 2016 +0000 summary: Issue #27164: Allow decompressing raw Deflate streams with predefined zdict Based on patch by Xiang Zhang. files: Lib/test/test_zlib.py | 9 ++++ Misc/NEWS | 3 + Modules/zlibmodule.c | 62 ++++++++++++++++++++++--------- 3 files changed, 56 insertions(+), 18 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 @@ -553,6 +553,15 @@ self.assertEqual(dco.unconsumed_tail, b'') self.assertEqual(dco.unused_data, remainder) + # issue27164 + def test_decompress_raw_with_dictionary(self): + zdict = b'abcdefghijklmnopqrstuvwxyz' + co = zlib.compressobj(wbits=-zlib.MAX_WBITS, zdict=zdict) + comp = co.compress(zdict) + co.flush() + dco = zlib.decompressobj(wbits=-zlib.MAX_WBITS, zdict=zdict) + uncomp = dco.decompress(comp) + dco.flush() + self.assertEqual(zdict, uncomp) + def test_flush_with_freed_input(self): # Issue #16411: decompressor accesses input to last decompress() call # in flush(), even if this object has been freed in the meanwhile. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -131,6 +131,9 @@ Library ------- +- Issue #27164: In the zlib module, allow decompressing raw Deflate streams + with a predefined zdict. Based on patch by Xiang Zhang. + - Issue #24291: Fix wsgiref.simple_server.WSGIRequestHandler to completely write data to the client. Previously it could do partial writes and truncate data. Also, wsgiref.handler.ServerHandler can now handle stdout diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -22,6 +22,10 @@ #define LEAVE_ZLIB(obj) #endif +#if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1221 +#define AT_LEAST_ZLIB_1_2_2_1 +#endif + /* The following parameters are copied from zutil.h, version 0.95 */ #define DEFLATED 8 #if MAX_MEM_LEVEL >= 8 @@ -474,6 +478,31 @@ return (PyObject*)self; } +static int +set_inflate_zdict(compobject *self) +{ + Py_buffer zdict_buf; + int err; + + if (PyObject_GetBuffer(self->zdict, &zdict_buf, PyBUF_SIMPLE) == -1) { + return -1; + } + if ((size_t)zdict_buf.len > UINT_MAX) { + PyErr_SetString(PyExc_OverflowError, + "zdict length does not fit in an unsigned int"); + PyBuffer_Release(&zdict_buf); + return -1; + } + err = inflateSetDictionary(&(self->zst), + zdict_buf.buf, (unsigned int)zdict_buf.len); + PyBuffer_Release(&zdict_buf); + if (err != Z_OK) { + zlib_error(self->zst, err, "while setting zdict"); + return -1; + } + return 0; +} + /*[clinic input] zlib.decompressobj @@ -515,6 +544,20 @@ switch(err) { case (Z_OK): self->is_initialised = 1; + if (self->zdict != NULL && wbits < 0) { +#ifdef AT_LEAST_ZLIB_1_2_2_1 + if (set_inflate_zdict(self) < 0) { + Py_DECREF(self); + return NULL; + } +#else + PyErr_Format(ZlibError, + "zlib version %s does not allow raw inflate with dictionary", + ZLIB_VERSION); + Py_DECREF(self); + return NULL; +#endif + } return (PyObject*)self; case(Z_STREAM_ERROR): Py_DECREF(self); @@ -741,29 +784,12 @@ Py_END_ALLOW_THREADS if (err == Z_NEED_DICT && self->zdict != NULL) { - Py_buffer zdict_buf; - if (PyObject_GetBuffer(self->zdict, &zdict_buf, PyBUF_SIMPLE) == -1) { + if (set_inflate_zdict(self) < 0) { Py_DECREF(RetVal); RetVal = NULL; goto error; } - if ((size_t)zdict_buf.len > UINT_MAX) { - PyErr_SetString(PyExc_OverflowError, - "zdict length does not fit in an unsigned int"); - PyBuffer_Release(&zdict_buf); - Py_CLEAR(RetVal); - goto error; - } - - err = inflateSetDictionary(&(self->zst), - zdict_buf.buf, (unsigned int)zdict_buf.len); - PyBuffer_Release(&zdict_buf); - if (err != Z_OK) { - zlib_error(self->zst, err, "while decompressing data"); - Py_CLEAR(RetVal); - goto error; - } /* Repeat the call to inflate. */ Py_BEGIN_ALLOW_THREADS err = inflate(&(self->zst), Z_SYNC_FLUSH); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 08:36:54 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 05 Jun 2016 12:36:54 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327164=3A_Merge_raw_Deflate_zdict_support_from_3?= =?utf-8?q?=2E5?= Message-ID: <20160605123653.64218.16240.859DAFE1@psf.io> https://hg.python.org/cpython/rev/470954641f3b changeset: 101756:470954641f3b parent: 101753:31ad7885e2e5 parent: 101755:d91b951e676f user: Martin Panter date: Sun Jun 05 12:07:48 2016 +0000 summary: Issue #27164: Merge raw Deflate zdict support from 3.5 files: Lib/test/test_zlib.py | 9 ++++ Misc/NEWS | 3 + Modules/zlibmodule.c | 62 ++++++++++++++++++++++--------- 3 files changed, 56 insertions(+), 18 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 @@ -557,6 +557,15 @@ self.assertEqual(dco.unconsumed_tail, b'') self.assertEqual(dco.unused_data, remainder) + # issue27164 + def test_decompress_raw_with_dictionary(self): + zdict = b'abcdefghijklmnopqrstuvwxyz' + co = zlib.compressobj(wbits=-zlib.MAX_WBITS, zdict=zdict) + comp = co.compress(zdict) + co.flush() + dco = zlib.decompressobj(wbits=-zlib.MAX_WBITS, zdict=zdict) + uncomp = dco.decompress(comp) + dco.flush() + self.assertEqual(zdict, uncomp) + def test_flush_with_freed_input(self): # Issue #16411: decompressor accesses input to last decompress() call # in flush(), even if this object has been freed in the meanwhile. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,9 @@ Library ------- +- Issue #27164: In the zlib module, allow decompressing raw Deflate streams + with a predefined zdict. Based on patch by Xiang Zhang. + - Issue #24291: Fix wsgiref.simple_server.WSGIRequestHandler to completely write data to the client. Previously it could do partial writes and truncate data. Also, wsgiref.handler.ServerHandler can now handle stdout diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -22,6 +22,10 @@ #define LEAVE_ZLIB(obj) #endif +#if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1221 +#define AT_LEAST_ZLIB_1_2_2_1 +#endif + /* The following parameters are copied from zutil.h, version 0.95 */ #define DEFLATED 8 #if MAX_MEM_LEVEL >= 8 @@ -473,6 +477,31 @@ return (PyObject*)self; } +static int +set_inflate_zdict(compobject *self) +{ + Py_buffer zdict_buf; + int err; + + if (PyObject_GetBuffer(self->zdict, &zdict_buf, PyBUF_SIMPLE) == -1) { + return -1; + } + if ((size_t)zdict_buf.len > UINT_MAX) { + PyErr_SetString(PyExc_OverflowError, + "zdict length does not fit in an unsigned int"); + PyBuffer_Release(&zdict_buf); + return -1; + } + err = inflateSetDictionary(&(self->zst), + zdict_buf.buf, (unsigned int)zdict_buf.len); + PyBuffer_Release(&zdict_buf); + if (err != Z_OK) { + zlib_error(self->zst, err, "while setting zdict"); + return -1; + } + return 0; +} + /*[clinic input] zlib.decompressobj @@ -514,6 +543,20 @@ switch(err) { case (Z_OK): self->is_initialised = 1; + if (self->zdict != NULL && wbits < 0) { +#ifdef AT_LEAST_ZLIB_1_2_2_1 + if (set_inflate_zdict(self) < 0) { + Py_DECREF(self); + return NULL; + } +#else + PyErr_Format(ZlibError, + "zlib version %s does not allow raw inflate with dictionary", + ZLIB_VERSION); + Py_DECREF(self); + return NULL; +#endif + } return (PyObject*)self; case(Z_STREAM_ERROR): Py_DECREF(self); @@ -740,29 +783,12 @@ Py_END_ALLOW_THREADS if (err == Z_NEED_DICT && self->zdict != NULL) { - Py_buffer zdict_buf; - if (PyObject_GetBuffer(self->zdict, &zdict_buf, PyBUF_SIMPLE) == -1) { + if (set_inflate_zdict(self) < 0) { Py_DECREF(RetVal); RetVal = NULL; goto error; } - if ((size_t)zdict_buf.len > UINT_MAX) { - PyErr_SetString(PyExc_OverflowError, - "zdict length does not fit in an unsigned int"); - PyBuffer_Release(&zdict_buf); - Py_CLEAR(RetVal); - goto error; - } - - err = inflateSetDictionary(&(self->zst), - zdict_buf.buf, (unsigned int)zdict_buf.len); - PyBuffer_Release(&zdict_buf); - if (err != Z_OK) { - zlib_error(self->zst, err, "while decompressing data"); - Py_CLEAR(RetVal); - goto error; - } /* Repeat the call to inflate. */ Py_BEGIN_ALLOW_THREADS err = inflate(&(self->zst), Z_SYNC_FLUSH); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 15:07:56 2016 From: python-checkins at python.org (ned.deily) Date: Sun, 05 Jun 2016 19:07:56 +0000 Subject: [Python-checkins] =?utf-8?q?devguide=3A_Issue_=2325941=3A_Add_=22?= =?utf-8?q?How_To_Review_A_Patch=22_section_to_the_devguide=2E?= Message-ID: <20160605190755.20572.9213.4EE09332@psf.io> https://hg.python.org/devguide/rev/8b3f4473432e changeset: 808:8b3f4473432e user: Ned Deily date: Sun Jun 05 12:07:18 2016 -0700 summary: Issue #25941: Add "How To Review A Patch" section to the devguide. (Patch by Camilla Montonen) files: patch.rst | 40 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 40 insertions(+), 0 deletions(-) diff --git a/patch.rst b/patch.rst --- a/patch.rst +++ b/patch.rst @@ -161,6 +161,46 @@ is then expected that you post a new patch addressing these comments, and the review process will thus iterate until a satisfactory solution has emerged. +How to Review a Patch +''''''''''''''''''''' + +One of the bottlenecks in the Python development +process is the lack of patch reviews. +If you browse the bug tracker, you will see that numerous issues +have a patch, but cannot be commited to the main source code repository, +because no one has reviewed the proposed patch. +Reviewing a patch can be just as informative as providing a patch and it will allow +you to give constructive comments on another developer's work. +This guide provides a checklist for submitting a patch review. +It is a common misconception that in order to be useful, a patch review has to +be perfect. This is not the case at all! It is helpful to just test the patch and/or +play around with the code and leave comments in the bug tracker. + +1. If you have not already done so, get a copy of the CPython repository + by following the :ref:`setup guide `, build it and run the tests. + +2. Check the bug tracker to see what steps are necessary to reproduce + the issue and confirm that you can reproduce the issue in your version + of the Python REPL (the interactive shell prompt), which you can launch + by executing ./python inside the repository. + +3. Apply the patch you saved from the bug tracker. If you are not sure how + to apply a patch, please check the :ref:`Lifecycle of a Patch ` documentation. + +4. If the patch affects any C file, run the build again. + +5. Launch the Python REPL (the interactive shell prompt) and check if + you can reproduce the issue. Now that the patch has been applied, the issue + should be fixed (in theory, but mistakes do happen! A good review aims to + catch these before the code is committed to the Python repository). You should + also try to see if there are any corner cases in this or related issue that the author + of the patch may have missed. + +6. If you have time, run the entire test suite. If you are pressed for time, + run the tests for the module(s) where changes were applied. + However, please be aware that if you are recommending a patch as 'commit-ready', + you should always make sure the entire test suite passes. + Committing/Rejecting -------------------- -- Repository URL: https://hg.python.org/devguide From python-checkins at python.org Sun Jun 5 20:40:42 2016 From: python-checkins at python.org (ned.deily) Date: Mon, 06 Jun 2016 00:40:42 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2326014=3A_merge_from_3=2E5?= Message-ID: <20160606004042.24586.36569.12467DB7@psf.io> https://hg.python.org/cpython/rev/7583d65da2ad changeset: 101759:7583d65da2ad parent: 101756:470954641f3b parent: 101758:f5fd646b265b user: Ned Deily date: Sun Jun 05 17:39:58 2016 -0700 summary: Issue #26014: merge from 3.5 files: Doc/distributing/index.rst | 2 +- Doc/distutils/index.rst | 6 +++++- Doc/install/index.rst | 5 +++++ Doc/library/distutils.rst | 2 +- Misc/NEWS | 4 ++++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Doc/distributing/index.rst b/Doc/distributing/index.rst --- a/Doc/distributing/index.rst +++ b/Doc/distributing/index.rst @@ -61,7 +61,7 @@ extensions, to be installed on a system without needing to be built locally. -.. _setuptools: https://setuptools.pypa.io/en/latest/setuptools.html +.. _setuptools: https://setuptools.readthedocs.io/en/latest/ .. _wheel: https://wheel.readthedocs.org Open source licensing and collaboration diff --git a/Doc/distutils/index.rst b/Doc/distutils/index.rst --- a/Doc/distutils/index.rst +++ b/Doc/distutils/index.rst @@ -7,6 +7,11 @@ :Authors: Greg Ward, Anthony Baxter :Email: distutils-sig at python.org +.. seealso:: + + :ref:`distributing-index` + The up to date module distribution documentations + This document describes the Python Distribution Utilities ("Distutils") from the module developer's point of view, describing how to use the Distutils to make Python modules and extensions easily available to a wider audience with @@ -20,7 +25,6 @@ recommendations section `__ in the Python Packaging User Guide for more information. - .. toctree:: :maxdepth: 2 :numbered: diff --git a/Doc/install/index.rst b/Doc/install/index.rst --- a/Doc/install/index.rst +++ b/Doc/install/index.rst @@ -10,6 +10,11 @@ .. TODO: Fill in XXX comments +.. seealso:: + + :ref:`installing-index` + The up to date module installation documentations + .. The audience for this document includes people who don't know anything about Python and aren't about to learn the language just in order to install and maintain it for their users, i.e. system administrators. diff --git a/Doc/library/distutils.rst b/Doc/library/distutils.rst --- a/Doc/library/distutils.rst +++ b/Doc/library/distutils.rst @@ -15,7 +15,7 @@ Most Python users will *not* want to use this module directly, but instead use the cross-version tools maintained by the Python Packaging Authority. In particular, -`setuptools `__ is an +`setuptools `__ is an enhanced alternative to :mod:`distutils` that provides: * support for declaring project dependencies diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1258,6 +1258,10 @@ - Issue #24952: Clarify the default size argument of stack_size() in the "threading" and "_thread" modules. Patch from Mattip. +- Issue #26014: Update 3.x packaging documentation: + * "See also" links to the new docs are now provided in the legacy pages + * links to setuptools documentation have been updated + Tests ----- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 20:40:42 2016 From: python-checkins at python.org (ned.deily) Date: Mon, 06 Jun 2016 00:40:42 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI2MDE0?= =?utf-8?q?=3A_Update_3=2Ex_packaging_documentation=3A?= Message-ID: <20160606004042.15161.23578.A5A9F0AF@psf.io> https://hg.python.org/cpython/rev/f5fd646b265b changeset: 101758:f5fd646b265b branch: 3.5 parent: 101755:d91b951e676f user: Ned Deily date: Sun Jun 05 17:38:48 2016 -0700 summary: Issue #26014: Update 3.x packaging documentation: - "See also" links to the new docs are now provided in the legacy pages - links to setuptools documentation have been updated (original patch by Susan Sun) files: Doc/distributing/index.rst | 2 +- Doc/distutils/index.rst | 6 +++++- Doc/install/index.rst | 5 +++++ Doc/library/distutils.rst | 2 +- Misc/NEWS | 4 ++++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Doc/distributing/index.rst b/Doc/distributing/index.rst --- a/Doc/distributing/index.rst +++ b/Doc/distributing/index.rst @@ -61,7 +61,7 @@ extensions, to be installed on a system without needing to be built locally. -.. _setuptools: https://setuptools.pypa.io/en/latest/setuptools.html +.. _setuptools: https://setuptools.readthedocs.io/en/latest/ .. _wheel: https://wheel.readthedocs.org Open source licensing and collaboration diff --git a/Doc/distutils/index.rst b/Doc/distutils/index.rst --- a/Doc/distutils/index.rst +++ b/Doc/distutils/index.rst @@ -7,6 +7,11 @@ :Authors: Greg Ward, Anthony Baxter :Email: distutils-sig at python.org +.. seealso:: + + :ref:`distributing-index` + The up to date module distribution documentations + This document describes the Python Distribution Utilities ("Distutils") from the module developer's point of view, describing how to use the Distutils to make Python modules and extensions easily available to a wider audience with @@ -20,7 +25,6 @@ recommendations section `__ in the Python Packaging User Guide for more information. - .. toctree:: :maxdepth: 2 :numbered: diff --git a/Doc/install/index.rst b/Doc/install/index.rst --- a/Doc/install/index.rst +++ b/Doc/install/index.rst @@ -10,6 +10,11 @@ .. TODO: Fill in XXX comments +.. seealso:: + + :ref:`installing-index` + The up to date module installation documentations + .. The audience for this document includes people who don't know anything about Python and aren't about to learn the language just in order to install and maintain it for their users, i.e. system administrators. diff --git a/Doc/library/distutils.rst b/Doc/library/distutils.rst --- a/Doc/library/distutils.rst +++ b/Doc/library/distutils.rst @@ -15,7 +15,7 @@ Most Python users will *not* want to use this module directly, but instead use the cross-version tools maintained by the Python Packaging Authority. In particular, -`setuptools `__ is an +`setuptools `__ is an enhanced alternative to :mod:`distutils` that provides: * support for declaring project dependencies diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -543,6 +543,10 @@ - Issue #25500: Fix documentation to not claim that __import__ is searched for in the global scope. +- Issue #26014: Update 3.x packaging documentation: + * "See also" links to the new docs are now provided in the legacy pages + * links to setuptools documentation have been updated + Tests ----- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 20:40:42 2016 From: python-checkins at python.org (ned.deily) Date: Mon, 06 Jun 2016 00:40:42 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI2MDE0?= =?utf-8?q?=3A_Guide_2=2E7_users_to_the_new_packaging_documentation=3A?= Message-ID: <20160606004042.21667.91107.7BAC9C3D@psf.io> https://hg.python.org/cpython/rev/71fc5b246f5b changeset: 101757:71fc5b246f5b branch: 2.7 parent: 101754:db24d51c69d3 user: Ned Deily date: Sun Jun 05 17:35:43 2016 -0700 summary: Issue #26014: Guide 2.7 users to the new packaging documentation: - the top-level 2.7 docs page now links to the newer doc pages (installing and distribution) rather than the legacy ones - the legacy install and distutils pages are now labeled as "legacy" - the library/distutils page is updated to match the 3.x version - "See also" links to the new docs are now provided in the legacy pages - links to setuptools documentation have been updated (original patch by Susan Sun) files: Doc/distributing/index.rst | 2 +- Doc/distutils/index.rst | 11 +++- Doc/install/index.rst | 11 +++- Doc/library/distutils.rst | 40 +++++++++----- Doc/tools/templates/indexcontent.html | 8 +- Misc/NEWS | 6 ++ 6 files changed, 53 insertions(+), 25 deletions(-) diff --git a/Doc/distributing/index.rst b/Doc/distributing/index.rst --- a/Doc/distributing/index.rst +++ b/Doc/distributing/index.rst @@ -61,7 +61,7 @@ extensions, to be installed on a system without needing to be built locally. -.. _setuptools: https://setuptools.pypa.io/en/latest/setuptools.html +.. _setuptools: https://setuptools.readthedocs.io/en/latest/ .. _wheel: https://wheel.readthedocs.org Open source licensing and collaboration diff --git a/Doc/distutils/index.rst b/Doc/distutils/index.rst --- a/Doc/distutils/index.rst +++ b/Doc/distutils/index.rst @@ -1,12 +1,17 @@ .. _distutils-index: -############################### - Distributing Python Modules -############################### +############################################## + Distributing Python Modules (Legacy version) +############################################## :Authors: Greg Ward, Anthony Baxter :Email: distutils-sig at python.org +.. seealso:: + + :ref:`distributing-index` + The up to date module distribution documentations + This document describes the Python Distribution Utilities ("Distutils") from the module developer's point of view, describing how to use the Distutils to make Python modules and extensions easily available to a wider audience with diff --git a/Doc/install/index.rst b/Doc/install/index.rst --- a/Doc/install/index.rst +++ b/Doc/install/index.rst @@ -2,14 +2,19 @@ .. _install-index: -***************************** - Installing Python Modules -***************************** +******************************************** + Installing Python Modules (Legacy version) +******************************************** :Author: Greg Ward .. TODO: Fill in XXX comments +.. seealso:: + + :ref:`installing-index` + The up to date module installation documentations + .. The audience for this document includes people who don't know anything about Python and aren't about to learn the language just in order to install and maintain it for their users, i.e. system administrators. diff --git a/Doc/library/distutils.rst b/Doc/library/distutils.rst --- a/Doc/library/distutils.rst +++ b/Doc/library/distutils.rst @@ -1,10 +1,9 @@ - :mod:`distutils` --- Building and installing Python modules =========================================================== .. module:: distutils - :synopsis: Support for building and installing Python modules into an existing Python - installation. + :synopsis: Support for building and installing Python modules into an + existing Python installation. .. sectionauthor:: Fred L. Drake, Jr. @@ -13,18 +12,31 @@ 100%-pure Python, or may be extension modules written in C, or may be collections of Python packages which include modules coded in both Python and C. -This package is discussed in two separate chapters: +Most Python users will *not* want to use this module directly, but instead +use the cross-version tools maintained by the Python Packaging Authority. In +particular, +`setuptools `__ is an +enhanced alternative to :mod:`distutils` that provides: +* support for declaring project dependencies +* additional mechanisms for configuring which files to include in source + releases (including plugins for integration with version control systems) +* the ability to declare project "entry points", which can be used as the + basis for application plugin systems +* the ability to automatically generate Windows command line executables at + installation time rather than needing to prebuild them +* consistent behaviour across all supported Python versions -.. seealso:: +The recommended `pip `__ installer runs all +``setup.py`` scripts with ``setuptools``, even if the script itself only +imports ``distutils``. Refer to the +`Python Packaging User Guide `_ for more +information. - :ref:`distutils-index` - The manual for developers and packagers of Python modules. This describes how - to prepare :mod:`distutils`\ -based packages so that they may be easily - installed into an existing Python installation. +For the benefits of packaging tool authors and users seeking a deeper +understanding of the details of the current packaging and distribution +system, the legacy :mod:`distutils` based user documentation and API +reference remain available: - :ref:`install-index` - An "administrators" manual which includes information on installing modules into - an existing Python installation. You do not need to be a Python programmer to - read this manual. - +* :ref:`install-index` +* :ref:`distutils-index` diff --git a/Doc/tools/templates/indexcontent.html b/Doc/tools/templates/indexcontent.html --- a/Doc/tools/templates/indexcontent.html +++ b/Doc/tools/templates/indexcontent.html @@ -16,14 +16,14 @@ + + - - diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -293,6 +293,12 @@ functions together, and add more details such as what underlying Readline functions and variables are accessed. +- Issue #26014: Guide users to the newer packaging documentation as was done + for Python 3.x. In particular, the top-level 2.7 documentation page now + links to the newer installer and distributions pages rather than the + legacy install and Distutils pages; these are still linked to in the + library/distutils doc page. + Tests ----- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 21:33:05 2016 From: python-checkins at python.org (terry.reedy) Date: Mon, 06 Jun 2016 01:33:05 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327156=3A_Remove_m?= =?utf-8?q?ore_unused_idlelib_code=2E?= Message-ID: <20160606013305.13672.81136.C72ABA3B@psf.io> https://hg.python.org/cpython/rev/166784c40be8 changeset: 101760:166784c40be8 user: Terry Jan Reedy date: Sun Jun 05 21:32:45 2016 -0400 summary: Issue #27156: Remove more unused idlelib code. files: Lib/idlelib/macosx.py | 10 ---------- Lib/idlelib/stackviewer.py | 3 --- 2 files changed, 0 insertions(+), 13 deletions(-) diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py --- a/Lib/idlelib/macosx.py +++ b/Lib/idlelib/macosx.py @@ -5,16 +5,6 @@ import tkinter import warnings -def runningAsOSXApp(): - warnings.warn("runningAsOSXApp() is deprecated, use isAquaTk()", - DeprecationWarning, stacklevel=2) - return isAquaTk() - -def isCarbonAquaTk(root): - warnings.warn("isCarbonAquaTk(root) is deprecated, use isCarbonTk()", - DeprecationWarning, stacklevel=2) - return isCarbonTk() - _tk_type = None def _initializeTkVariantTests(root): diff --git a/Lib/idlelib/stackviewer.py b/Lib/idlelib/stackviewer.py --- a/Lib/idlelib/stackviewer.py +++ b/Lib/idlelib/stackviewer.py @@ -120,9 +120,6 @@ sublist.append(item) return sublist - def keys(self): # unused, left for possible 3rd party use - return list(self.object.keys()) - def _stack_viewer(parent): root = tk.Tk() root.title("Test StackViewer") -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 22:30:49 2016 From: python-checkins at python.org (martin.panter) Date: Mon, 06 Jun 2016 02:30:49 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327107=3A_Add_exce?= =?utf-8?q?ption_classes_to_mailbox=2E=5F=5Fall=5F=5F=2C_by_Jacek_Ko=C5=82?= =?utf-8?q?odziej?= Message-ID: <20160606023049.21718.5786.5C6FBC70@psf.io> https://hg.python.org/cpython/rev/4705b7597c86 changeset: 101762:4705b7597c86 user: Martin Panter date: Mon Jun 06 01:56:09 2016 +0000 summary: Issue #27107: Add exception classes to mailbox.__all__, by Jacek Ko?odziej files: Lib/mailbox.py | 7 ++++--- Lib/test/test_mailbox.py | 8 +++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Lib/mailbox.py b/Lib/mailbox.py --- a/Lib/mailbox.py +++ b/Lib/mailbox.py @@ -23,9 +23,10 @@ except ImportError: fcntl = None -__all__ = [ 'Mailbox', 'Maildir', 'mbox', 'MH', 'Babyl', 'MMDF', - 'Message', 'MaildirMessage', 'mboxMessage', 'MHMessage', - 'BabylMessage', 'MMDFMessage'] +__all__ = ['Mailbox', 'Maildir', 'mbox', 'MH', 'Babyl', 'MMDF', + 'Message', 'MaildirMessage', 'mboxMessage', 'MHMessage', + 'BabylMessage', 'MMDFMessage', 'Error', 'NoSuchMailboxError', + 'NotEmptyError', 'ExternalClashError', 'FormatError'] linesep = os.linesep.encode('ascii') diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py --- a/Lib/test/test_mailbox.py +++ b/Lib/test/test_mailbox.py @@ -2268,12 +2268,18 @@ """) +class MiscTestCase(unittest.TestCase): + def test__all__(self): + blacklist = {"linesep"} + support.check__all__(self, mailbox, blacklist=blacklist) + + def test_main(): tests = (TestMailboxSuperclass, TestMaildir, TestMbox, TestMMDF, TestMH, TestBabyl, TestMessage, TestMaildirMessage, TestMboxMessage, TestMHMessage, TestBabylMessage, TestMMDFMessage, TestMessageConversion, TestProxyFile, TestPartialFile, - MaildirTestCase, TestFakeMailBox) + MaildirTestCase, TestFakeMailBox, MiscTestCase) support.run_unittest(*tests) support.reap_children() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 22:30:49 2016 From: python-checkins at python.org (martin.panter) Date: Mon, 06 Jun 2016 02:30:49 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327105=3A_Add_cgi?= =?utf-8?b?LnRlc3QoKSB0byBfX2FsbF9fLCBiYXNlZCBvbiBKYWNlayBLb8WCb2R6aWVq?= =?utf-8?q?=E2=80=99s_patch?= Message-ID: <20160606023049.21285.21266.9DCA56C1@psf.io> https://hg.python.org/cpython/rev/74ed6f3fb8d2 changeset: 101761:74ed6f3fb8d2 user: Martin Panter date: Mon Jun 06 01:53:28 2016 +0000 summary: Issue #27105: Add cgi.test() to __all__, based on Jacek Ko?odziej?s patch files: Lib/cgi.py | 2 +- Lib/test/test_cgi.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletions(-) diff --git a/Lib/cgi.py b/Lib/cgi.py --- a/Lib/cgi.py +++ b/Lib/cgi.py @@ -45,7 +45,7 @@ __all__ = ["MiniFieldStorage", "FieldStorage", "parse", "parse_qs", "parse_qsl", "parse_multipart", - "parse_header", "print_exception", "print_environ", + "parse_header", "test", "print_exception", "print_environ", "print_form", "print_directory", "print_arguments", "print_environ_usage", "escape"] diff --git a/Lib/test/test_cgi.py b/Lib/test/test_cgi.py --- a/Lib/test/test_cgi.py +++ b/Lib/test/test_cgi.py @@ -7,6 +7,7 @@ import warnings from collections import namedtuple from io import StringIO, BytesIO +from test import support class HackedSysModule: # The regression test will have real values in sys.argv, which @@ -473,6 +474,11 @@ cgi.parse_header('form-data; name="files"; filename="fo\\"o;bar"'), ("form-data", {"name": "files", "filename": 'fo"o;bar'})) + def test_all(self): + blacklist = {"logfile", "logfp", "initlog", "dolog", "nolog", + "closelog", "log", "maxlen", "valid_boundary"} + support.check__all__(self, cgi, blacklist=blacklist) + BOUNDARY = "---------------------------721837373350705526688164684" -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 22:30:50 2016 From: python-checkins at python.org (martin.panter) Date: Mon, 06 Jun 2016 02:30:50 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327109=3A_Add_Inva?= =?utf-8?q?lidFileException_to_=5F=5Fall=5F=5F=2C_by_Jacek_Ko=C5=82odziej?= Message-ID: <20160606023050.112293.81872.A5EDB7D6@psf.io> https://hg.python.org/cpython/rev/450171f53e81 changeset: 101764:450171f53e81 user: Martin Panter date: Mon Jun 06 02:00:50 2016 +0000 summary: Issue #27109: Add InvalidFileException to __all__, by Jacek Ko?odziej files: Lib/plistlib.py | 2 +- Lib/test/test_plistlib.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Lib/plistlib.py b/Lib/plistlib.py --- a/Lib/plistlib.py +++ b/Lib/plistlib.py @@ -47,7 +47,7 @@ """ __all__ = [ "readPlist", "writePlist", "readPlistFromBytes", "writePlistToBytes", - "Plist", "Data", "Dict", "FMT_XML", "FMT_BINARY", + "Plist", "Data", "Dict", "InvalidFileException", "FMT_XML", "FMT_BINARY", "load", "dump", "loads", "dumps" ] diff --git a/Lib/test/test_plistlib.py b/Lib/test/test_plistlib.py --- a/Lib/test/test_plistlib.py +++ b/Lib/test/test_plistlib.py @@ -526,8 +526,14 @@ self.assertEqual(cur, in_data) +class MiscTestCase(unittest.TestCase): + def test__all__(self): + blacklist = {"PlistFormat", "PLISTHEADER"} + support.check__all__(self, plistlib, blacklist=blacklist) + + def test_main(): - support.run_unittest(TestPlistlib, TestPlistlibDeprecated) + support.run_unittest(TestPlistlib, TestPlistlibDeprecated, MiscTestCase) if __name__ == '__main__': -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 22:30:50 2016 From: python-checkins at python.org (martin.panter) Date: Mon, 06 Jun 2016 02:30:50 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327108=3A_Add_miss?= =?utf-8?q?ing_names_to_mimetypes=2E=5F=5Fall=5F=5F=2C_by_Jacek_Ko=C5=82od?= =?utf-8?q?ziej?= Message-ID: <20160606023049.36831.50265.2F4B5E74@psf.io> https://hg.python.org/cpython/rev/2057b0af1c52 changeset: 101763:2057b0af1c52 user: Martin Panter date: Mon Jun 06 01:59:19 2016 +0000 summary: Issue #27108: Add missing names to mimetypes.__all__, by Jacek Ko?odziej files: Lib/mimetypes.py | 6 ++++-- Lib/test/test_mimetypes.py | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Lib/mimetypes.py b/Lib/mimetypes.py --- a/Lib/mimetypes.py +++ b/Lib/mimetypes.py @@ -33,8 +33,10 @@ _winreg = None __all__ = [ - "guess_type","guess_extension","guess_all_extensions", - "add_type","read_mime_types","init" + "knownfiles", "inited", "MimeTypes", + "guess_type", "guess_all_extensions", "guess_extension", + "add_type", "init", "read_mime_types", + "suffix_map", "encodings_map", "types_map", "common_types" ] knownfiles = [ diff --git a/Lib/test/test_mimetypes.py b/Lib/test/test_mimetypes.py --- a/Lib/test/test_mimetypes.py +++ b/Lib/test/test_mimetypes.py @@ -101,5 +101,11 @@ eq(self.db.guess_type("image.jpg"), ("image/jpeg", None)) eq(self.db.guess_type("image.png"), ("image/png", None)) + +class MiscTestCase(unittest.TestCase): + def test__all__(self): + support.check__all__(self, mimetypes) + + if __name__ == "__main__": unittest.main() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 22:30:51 2016 From: python-checkins at python.org (martin.panter) Date: Mon, 06 Jun 2016 02:30:51 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2323883=3A_News_upd?= =?utf-8?q?ates_for_=5F=5Fall=5F=5F_attributes?= Message-ID: <20160606023050.21465.58931.DC52B956@psf.io> https://hg.python.org/cpython/rev/a36c7f87eba9 changeset: 101766:a36c7f87eba9 user: Martin Panter date: Mon Jun 06 02:09:08 2016 +0000 summary: Issue #23883: News updates for __all__ attributes files: Doc/whatsnew/3.6.rst | 8 +++++--- Misc/NEWS | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -609,10 +609,12 @@ :exc:`PendingDeprecationWarning`. * The following modules have had missing APIs added to their :attr:`__all__` - attributes to match the documented APIs: :mod:`calendar`, :mod:`csv`, + attributes to match the documented APIs: + :mod:`calendar`, :mod:`cgi`, :mod:`csv`, :mod:`~xml.etree.ElementTree`, :mod:`enum`, - :mod:`fileinput`, :mod:`ftplib`, :mod:`logging`, - :mod:`optparse`, :mod:`subprocess`, :mod:`tarfile`, :mod:`threading` and + :mod:`fileinput`, :mod:`ftplib`, :mod:`logging`, :mod:`mailbox`, + :mod:`mimetypes`, :mod:`optparse`, :mod:`plistlib`, :mod:`smtpd`, + :mod:`subprocess`, :mod:`tarfile`, :mod:`threading` and :mod:`wave`. This means they will export new symbols when ``import *`` is used. See :issue:`23883`. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,10 @@ Library ------- +- Issue #23883: Added missing APIs to __all__ to match the documented APIs + for the following modules: cgi, mailbox, mimetypes, plistlib and smtpd. + Patches by Jacek Ko?odziej. + - Issue #27164: In the zlib module, allow decompressing raw Deflate streams with a predefined zdict. Based on patch by Xiang Zhang. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 22:30:51 2016 From: python-checkins at python.org (martin.panter) Date: Mon, 06 Jun 2016 02:30:51 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327110=3A_Add_smtp?= =?utf-8?b?ZC5TTVRQQ2hhbm5lbCB0byBfX2FsbF9fLCBieSBKYWNlayBLb8WCb2R6aWVq?= Message-ID: <20160606023050.15024.64331.7CC7F328@psf.io> https://hg.python.org/cpython/rev/bcc0c3fd4a40 changeset: 101765:bcc0c3fd4a40 user: Martin Panter date: Mon Jun 06 02:03:11 2016 +0000 summary: Issue #27110: Add smtpd.SMTPChannel to __all__, by Jacek Ko?odziej files: Lib/smtpd.py | 5 ++++- Lib/test/test_smtpd.py | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletions(-) diff --git a/Lib/smtpd.py b/Lib/smtpd.py --- a/Lib/smtpd.py +++ b/Lib/smtpd.py @@ -89,7 +89,10 @@ from warnings import warn from email._header_value_parser import get_addr_spec, get_angle_addr -__all__ = ["SMTPServer","DebuggingServer","PureProxy","MailmanProxy"] +__all__ = [ + "SMTPChannel", "SMTPServer", "DebuggingServer", "PureProxy", + "MailmanProxy", +] program = sys.argv[0] __version__ = 'Python SMTP proxy version 0.3' diff --git a/Lib/test/test_smtpd.py b/Lib/test/test_smtpd.py --- a/Lib/test/test_smtpd.py +++ b/Lib/test/test_smtpd.py @@ -998,5 +998,16 @@ self.write_line(b'test\r\n.') self.assertEqual(self.channel.socket.last[0:3], b'250') + +class MiscTestCase(unittest.TestCase): + def test__all__(self): + blacklist = { + "program", "Devnull", "DEBUGSTREAM", "NEWLINE", "COMMASPACE", + "DATA_SIZE_DEFAULT", "usage", "Options", "parseargs", + + } + support.check__all__(self, smtpd, blacklist=blacklist) + + if __name__ == "__main__": unittest.main() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 5 22:53:38 2016 From: python-checkins at python.org (martin.panter) Date: Mon, 06 Jun 2016 02:53:38 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327107=3A_mailbox?= =?utf-8?q?=2Efcntl_=3D_None_on_Windows?= Message-ID: <20160606025338.23531.40607.BD255FD4@psf.io> https://hg.python.org/cpython/rev/d62e57958e7c changeset: 101767:d62e57958e7c user: Martin Panter date: Mon Jun 06 02:49:54 2016 +0000 summary: Issue #27107: mailbox.fcntl = None on Windows files: Lib/test/test_mailbox.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py --- a/Lib/test/test_mailbox.py +++ b/Lib/test/test_mailbox.py @@ -2270,7 +2270,7 @@ class MiscTestCase(unittest.TestCase): def test__all__(self): - blacklist = {"linesep"} + blacklist = {"linesep", "fcntl"} support.check__all__(self, mailbox, blacklist=blacklist) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 6 06:00:26 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Mon, 06 Jun 2016 10:00:26 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2326983=3A_Fixed_te?= =?utf-8?q?st=5Fformat_failure=2E?= Message-ID: <20160606100024.36882.36632.008CF17A@psf.io> https://hg.python.org/cpython/rev/6216fb8afa53 changeset: 101768:6216fb8afa53 user: Serhiy Storchaka date: Mon Jun 06 13:00:03 2016 +0300 summary: Issue #26983: Fixed test_format failure. Patch by SilentGhost. files: Lib/test/test_format.py | 2 +- 1 files changed, 1 insertions(+), 1 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 @@ -274,7 +274,7 @@ test_exc('%d', '1', TypeError, "%d format: a number is required, not str") test_exc('%x', '1', TypeError, "%x format: an integer is required, not str") test_exc('%x', 3.14, TypeError, "%x format: an integer is required, not float") - test_exc('%g', '1', TypeError, "a float is required") + test_exc('%g', '1', TypeError, "must be real number, not str") test_exc('no format', '1', TypeError, "not all arguments converted during string formatting") test_exc('%c', -1, OverflowError, "%c arg not in range(0x110000)") -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Mon Jun 6 11:38:37 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Mon, 6 Jun 2016 16:38:37 +0100 Subject: [Python-checkins] UGLY Benchmark Results for Python Default 2016-06-06 Message-ID: <285b900f-3ece-4ee1-9d9b-045d420ebc7e@irsmsx106.ger.corp.intel.com> Results for project Python default, build date 2016-06-06 02:02:13 +0000 commit: 166784c40be8 previous commit: 9c8be3b89964 revision date: 2016-06-06 01:32:45 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.25% 4.73% 11.03% 16.77% :-| pybench 0.13% 0.07% 1.54% 7.87% :-( regex_v8 2.73% 1.64% -2.83% 3.54% :-| nbody 0.11% 0.45% 1.34% 7.81% :-| json_dump_v2 0.36% -1.56% -1.96% 15.62% :-| normal_startup 0.95% 0.09% -0.47% 5.96% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/ugly-benchmark-results-for-python-default-2016-06-06/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Mon Jun 6 11:49:24 2016 From: python-checkins at python.org (guido.van.rossum) Date: Mon, 06 Jun 2016 15:49:24 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Fix_an_indentation_error_in_t?= =?utf-8?q?he_rST_for_NewType_=28Ryan_Gonzalez=29=2E?= Message-ID: <20160606154916.21761.93397.ACC89C00@psf.io> https://hg.python.org/peps/rev/aea4abe0f395 changeset: 6350:aea4abe0f395 user: Guido van Rossum date: Mon Jun 06 08:49:12 2016 -0700 summary: Fix an indentation error in the rST for NewType (Ryan Gonzalez). files: pep-0484.txt | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pep-0484.txt b/pep-0484.txt --- a/pep-0484.txt +++ b/pep-0484.txt @@ -1191,9 +1191,9 @@ checker ``Derived = NewType('Derived', Base)`` is roughly equivalent to a definition:: -class Derived(Base): - def __init__(self, _x: Base) -> None: - ... + class Derived(Base): + def __init__(self, _x: Base) -> None: + ... While at runtime, ``NewType('Derived', Base)`` returns a dummy function that simply returns its argument. Type checkers require explicit casts -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Mon Jun 6 16:43:51 2016 From: python-checkins at python.org (guido.van.rossum) Date: Mon, 06 Jun 2016 20:43:51 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_The_type_of_an_empty_tuple_is?= =?utf-8?q?_spelled_Tuple=5B=28=29=5D=2E_Fixes_upstream_=23231=2E?= Message-ID: <20160606204349.83329.93805.31EFC75B@psf.io> https://hg.python.org/peps/rev/7e629341aee5 changeset: 6351:7e629341aee5 user: Guido van Rossum date: Mon Jun 06 13:43:37 2016 -0700 summary: The type of an empty tuple is spelled Tuple[()]. Fixes upstream #231. files: pep-0484.txt | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/pep-0484.txt b/pep-0484.txt --- a/pep-0484.txt +++ b/pep-0484.txt @@ -1507,6 +1507,7 @@ * Tuple, used by listing the element types, for example ``Tuple[int, int, str]``. + The empty tuple can be typed as ``Tuple[()]``. Arbitrary-length homogeneous tuples can be expressed using one type and ellipsis, for example ``Tuple[int, ...]``. (The ``...`` here are part of the syntax, a literal ellipsis.) -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Mon Jun 6 20:45:36 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 07 Jun 2016 00:45:36 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MjI5?= =?utf-8?q?=3A_Fix_in-tree_cross-build_rule=2C_by_Xavier_de_Gaye?= Message-ID: <20160607004535.20769.93854.C64B262D@psf.io> https://hg.python.org/cpython/rev/619f7a2aa40a changeset: 101769:619f7a2aa40a branch: 3.5 parent: 101758:f5fd646b265b user: Martin Panter date: Tue Jun 07 00:27:17 2016 +0000 summary: Issue #27229: Fix in-tree cross-build rule, by Xavier de Gaye files: Makefile.pre.in | 7 +++++-- Misc/NEWS | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -793,13 +793,16 @@ if test "$(cross_compiling)" != "yes"; then \ $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C); \ else \ - cp $(srcdir)/Include/graminit.h $(GRAMMAR_H); \ + # Avoid copying the file onto itself for an in-tree build \ + cp $(srcdir)/Include/graminit.h $(GRAMMAR_H).tmp; \ + mv $(GRAMMAR_H).tmp $(GRAMMAR_H); \ fi $(GRAMMAR_C): $(GRAMMAR_H) if test "$(cross_compiling)" != "yes"; then \ touch $(GRAMMAR_C); \ else \ - cp $(srcdir)/Python/graminit.c $(GRAMMAR_C); \ + cp $(srcdir)/Python/graminit.c $(GRAMMAR_C).tmp; \ + mv $(GRAMMAR_C).tmp $(GRAMMAR_C); \ fi $(PGEN): $(PGENOBJS) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -581,6 +581,9 @@ source code anyway, and is still regenerated when doing a native build. Patch by Xavier de Gaye. +- Issue #27229: Fix the cross-compiling pgen rule for in-tree builds. Patch + by Xavier de Gaye. + - Issue #21668: Link audioop, _datetime, _ctypes_test modules to libm, except on Mac OS X. Patch written by Xavier de Gaye. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 6 20:45:37 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 07 Jun 2016 00:45:37 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327229=3A_Merge_cross-compiling_fix_from_3=2E5?= Message-ID: <20160607004536.13623.70227.D98C6833@psf.io> https://hg.python.org/cpython/rev/9902230b101f changeset: 101770:9902230b101f parent: 101768:6216fb8afa53 parent: 101769:619f7a2aa40a user: Martin Panter date: Tue Jun 07 00:30:49 2016 +0000 summary: Issue #27229: Merge cross-compiling fix from 3.5 files: Makefile.pre.in | 7 +++++-- Misc/NEWS | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -793,13 +793,16 @@ if test "$(cross_compiling)" != "yes"; then \ $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C); \ else \ - cp $(srcdir)/Include/graminit.h $(GRAMMAR_H); \ + # Avoid copying the file onto itself for an in-tree build \ + cp $(srcdir)/Include/graminit.h $(GRAMMAR_H).tmp; \ + mv $(GRAMMAR_H).tmp $(GRAMMAR_H); \ fi $(GRAMMAR_C): $(GRAMMAR_H) if test "$(cross_compiling)" != "yes"; then \ touch $(GRAMMAR_C); \ else \ - cp $(srcdir)/Python/graminit.c $(GRAMMAR_C); \ + cp $(srcdir)/Python/graminit.c $(GRAMMAR_C).tmp; \ + mv $(GRAMMAR_C).tmp $(GRAMMAR_C); \ fi $(PGEN): $(PGENOBJS) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -137,6 +137,9 @@ Build ----- +- Issue #27229: Fix the cross-compiling pgen rule for in-tree builds. Patch + by Xavier de Gaye. + - Issue #26930: Update OS X 10.5+ 32-bit-only installer to build and link with OpenSSL 1.0.2h. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 6 20:45:37 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 07 Jun 2016 00:45:37 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI3MjI5?= =?utf-8?q?=3A_Fix_in-tree_cross-build_rule=2C_by_Xavier_de_Gaye?= Message-ID: <20160607004537.83602.79242.D240E0F8@psf.io> https://hg.python.org/cpython/rev/ffed402528c7 changeset: 101771:ffed402528c7 branch: 2.7 parent: 101757:71fc5b246f5b user: Martin Panter date: Tue Jun 07 00:27:17 2016 +0000 summary: Issue #27229: Fix in-tree cross-build rule, by Xavier de Gaye files: Makefile.pre.in | 7 +++++-- Misc/NEWS | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -685,13 +685,16 @@ if test "$(cross_compiling)" != "yes"; then \ $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C); \ else \ - cp $(srcdir)/Include/graminit.h $(GRAMMAR_H); \ + # Avoid copying the file onto itself for an in-tree build \ + cp $(srcdir)/Include/graminit.h $(GRAMMAR_H).tmp; \ + mv $(GRAMMAR_H).tmp $(GRAMMAR_H); \ fi $(GRAMMAR_C): $(GRAMMAR_H) if test "$(cross_compiling)" != "yes"; then \ touch $(GRAMMAR_C); \ else \ - cp $(srcdir)/Python/graminit.c $(GRAMMAR_C); \ + cp $(srcdir)/Python/graminit.c $(GRAMMAR_C).tmp; \ + mv $(GRAMMAR_C).tmp $(GRAMMAR_C); \ fi $(PGEN): $(PGENOBJS) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -321,6 +321,9 @@ - Issue #19450: Update Windows builds to use SQLite 3.8.11.0. +- Issue #27229: Fix the cross-compiling pgen rule for in-tree builds. Patch + by Xavier de Gaye. + - Issue #17603: Avoid error about nonexistant fileblocks.o file by using a lower-level check for st_blocks in struct stat. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 6 21:11:48 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 07 Jun 2016 01:11:48 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI3MjI5?= =?utf-8?q?=3A_Comment_in_middle_of_shell_command_fails_on_BSD_and_OS_X?= Message-ID: <20160607011147.13742.59838.4BDA3CD7@psf.io> https://hg.python.org/cpython/rev/ec214654708f changeset: 101772:ec214654708f branch: 2.7 user: Martin Panter date: Tue Jun 07 01:07:32 2016 +0000 summary: Issue #27229: Comment in middle of shell command fails on BSD and OS X 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 @@ -682,10 +682,10 @@ $(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGEN) @$(MKDIR_P) Include + # Avoid copying the file onto itself for an in-tree build if test "$(cross_compiling)" != "yes"; then \ $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C); \ else \ - # Avoid copying the file onto itself for an in-tree build \ cp $(srcdir)/Include/graminit.h $(GRAMMAR_H).tmp; \ mv $(GRAMMAR_H).tmp $(GRAMMAR_H); \ fi -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 6 21:11:47 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 07 Jun 2016 01:11:47 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327229=3A_Merge_makefile_fix_from_3=2E5?= Message-ID: <20160607011147.39709.12353.7FB90486@psf.io> https://hg.python.org/cpython/rev/b7a4c076ba40 changeset: 101774:b7a4c076ba40 parent: 101770:9902230b101f parent: 101773:de5b85f96266 user: Martin Panter date: Tue Jun 07 01:08:48 2016 +0000 summary: Issue #27229: Merge makefile fix from 3.5 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 @@ -790,10 +790,10 @@ $(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGEN) @$(MKDIR_P) Include + # Avoid copying the file onto itself for an in-tree build if test "$(cross_compiling)" != "yes"; then \ $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C); \ else \ - # Avoid copying the file onto itself for an in-tree build \ cp $(srcdir)/Include/graminit.h $(GRAMMAR_H).tmp; \ mv $(GRAMMAR_H).tmp $(GRAMMAR_H); \ fi -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 6 21:11:48 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 07 Jun 2016 01:11:48 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MjI5?= =?utf-8?q?=3A_Comment_in_middle_of_shell_command_fails_on_BSD_and_OS_X?= Message-ID: <20160607011147.21201.9559.D4E10CF0@psf.io> https://hg.python.org/cpython/rev/de5b85f96266 changeset: 101773:de5b85f96266 branch: 3.5 parent: 101769:619f7a2aa40a user: Martin Panter date: Tue Jun 07 01:07:32 2016 +0000 summary: Issue #27229: Comment in middle of shell command fails on BSD and OS X 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 @@ -790,10 +790,10 @@ $(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGEN) @$(MKDIR_P) Include + # Avoid copying the file onto itself for an in-tree build if test "$(cross_compiling)" != "yes"; then \ $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C); \ else \ - # Avoid copying the file onto itself for an in-tree build \ cp $(srcdir)/Include/graminit.h $(GRAMMAR_H).tmp; \ mv $(GRAMMAR_H).tmp $(GRAMMAR_H); \ fi -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Tue Jun 7 04:50:51 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 07 Jun 2016 08:50:51 +0000 Subject: [Python-checkins] Daily reference leaks (b7a4c076ba40): sum=7 Message-ID: <20160607085048.32949.20341.7BC96B91@psf.io> results for b7a4c076ba40 on branch "default" -------------------------------------------- test_collections leaked [2, 0, 0] references, sum=2 test_collections leaked [5, 0, -4] memory blocks, sum=1 test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogTbJacO', '--timeout', '7200'] From python-checkins at python.org Tue Jun 7 05:27:27 2016 From: python-checkins at python.org (victor.stinner) Date: Tue, 07 Jun 2016 09:27:27 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogb3MudXJhbmRvbSgp?= =?utf-8?q?_doesn=27t_block_on_Linux_anymore?= Message-ID: <20160607092719.20690.56940.56D626B8@psf.io> https://hg.python.org/cpython/rev/9de508dc4837 changeset: 101775:9de508dc4837 branch: 3.5 parent: 101773:de5b85f96266 user: Victor Stinner date: Tue Jun 07 11:21:42 2016 +0200 summary: os.urandom() doesn't block on Linux anymore Issue #26839: On Linux, os.urandom() now calls getrandom() with GRND_NONBLOCK to fall back on reading /dev/urandom if the urandom entropy pool is not initialized yet. Patch written by Colm Buckley. files: Doc/library/os.rst | 13 ++++++++++--- Misc/ACKS | 1 + Misc/NEWS | 4 ++++ Python/random.c | 24 +++++++++++++++++++++--- configure | 8 +++++--- configure.ac | 7 ++++--- pyconfig.h.in | 3 +++ 7 files changed, 48 insertions(+), 12 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -3733,14 +3733,21 @@ This function returns random bytes from an OS-specific randomness source. The returned data should be unpredictable enough for cryptographic applications, - though its exact quality depends on the OS implementation. On a Unix-like - system this will query ``/dev/urandom``, and on Windows it will use - ``CryptGenRandom()``. If a randomness source is not found, + though its exact quality depends on the OS implementation. + + On Linux, ``getrandom()`` syscall is used if available and the urandom + entropy pool is initialized (``getrandom()`` does not block). + On a Unix-like system this will query ``/dev/urandom``. On Windows, it + will use ``CryptGenRandom()``. If a randomness source is not found, :exc:`NotImplementedError` will be raised. For an easy-to-use interface to the random number generator provided by your platform, please see :class:`random.SystemRandom`. + .. versionchanged:: 3.5.2 + On Linux, if ``getrandom()`` blocks (the urandom entropy pool is not + initialized yet), fall back on reading ``/dev/urandom``. + .. versionchanged:: 3.5 On Linux 3.17 and newer, the ``getrandom()`` syscall is now used when available. On OpenBSD 5.6 and newer, the C ``getentropy()`` diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -200,6 +200,7 @@ Floris Bruynooghe Matt Bryant Stan Bubrouski +Colm Buckley Erik de Bueger Jan-Hein B?hrman Lars Buitinck diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -131,6 +131,10 @@ Library ------- +- Issue #26839: On Linux, :func:`os.urandom` now calls ``getrandom()`` with + ``GRND_NONBLOCK`` to fall back on reading ``/dev/urandom`` if the urandom + entropy pool is not initialized yet. Patch written by Colm Buckley. + - Issue #27164: In the zlib module, allow decompressing raw Deflate streams with a predefined zdict. Based on patch by Xiang Zhang. diff --git a/Python/random.c b/Python/random.c --- a/Python/random.c +++ b/Python/random.c @@ -6,6 +6,9 @@ # ifdef HAVE_SYS_STAT_H # include # endif +# ifdef HAVE_LINUX_RANDOM_H +# include +# endif # ifdef HAVE_GETRANDOM # include # elif defined(HAVE_GETRANDOM_SYSCALL) @@ -122,9 +125,13 @@ /* Is getrandom() supported by the running kernel? * Need Linux kernel 3.17 or newer, or Solaris 11.3 or newer */ static int getrandom_works = 1; - /* Use non-blocking /dev/urandom device. On Linux at boot, the getrandom() - * syscall blocks until /dev/urandom is initialized with enough entropy. */ - const int flags = 0; + + /* getrandom() on Linux will block if called before the kernel has + * initialized the urandom entropy pool. This will cause Python + * to hang on startup if called very early in the boot process - + * see https://bugs.python.org/issue26839. To avoid this, use the + * GRND_NONBLOCK flag. */ + const int flags = GRND_NONBLOCK; int n; if (!getrandom_works) @@ -168,6 +175,17 @@ getrandom_works = 0; return 0; } + if (errno == EAGAIN) { + /* If we failed with EAGAIN, the entropy pool was + * uninitialized. In this case, we return failure to fall + * back to reading from /dev/urandom. + * + * Note: In this case the data read will not be random so + * should not be used for cryptographic purposes. Retaining + * the existing semantics for practical purposes. */ + getrandom_works = 0; + return 0; + } if (errno == EINTR) { if (PyErr_CheckSignals()) { diff --git a/configure b/configure --- a/configure +++ b/configure @@ -2876,6 +2876,7 @@ ac_config_headers="$ac_config_headers pyconfig.h" + ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then @@ -7568,7 +7569,7 @@ sys/stat.h sys/syscall.h sys/sys_domain.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 alloca.h endian.h \ +bluetooth/bluetooth.h linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \ sys/endian.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` @@ -16325,12 +16326,13 @@ #include #include + #include int main() { char buffer[1]; const size_t buflen = sizeof(buffer); - const int flags = 0; - /* ignore the result, Python checks for ENOSYS at runtime */ + const int flags = GRND_NONBLOCK; + /* ignore the result, Python checks for ENOSYS and EAGAIN at runtime */ (void)syscall(SYS_getrandom, buffer, buflen, flags); return 0; } diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -1881,7 +1881,7 @@ sys/stat.h sys/syscall.h sys/sys_domain.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 alloca.h endian.h \ +bluetooth/bluetooth.h linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \ sys/endian.h) AC_HEADER_DIRENT AC_HEADER_MAJOR @@ -5240,12 +5240,13 @@ AC_LANG_SOURCE([[ #include #include + #include int main() { char buffer[1]; const size_t buflen = sizeof(buffer); - const int flags = 0; - /* ignore the result, Python checks for ENOSYS at runtime */ + const int flags = GRND_NONBLOCK; + /* ignore the result, Python checks for ENOSYS and EAGAIN at runtime */ (void)syscall(SYS_getrandom, buffer, buflen, flags); return 0; } diff --git a/pyconfig.h.in b/pyconfig.h.in --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -546,6 +546,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_TIPC_H +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_RANDOM_H + /* Define to 1 if you have the `lockf' function. */ #undef HAVE_LOCKF -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 7 05:27:27 2016 From: python-checkins at python.org (victor.stinner) Date: Tue, 07 Jun 2016 09:27:27 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy41IChvcy51cmFuZG9tKQ==?= Message-ID: <20160607092720.21051.37973.AA30736A@psf.io> https://hg.python.org/cpython/rev/f477ce0d2345 changeset: 101776:f477ce0d2345 parent: 101774:b7a4c076ba40 parent: 101775:9de508dc4837 user: Victor Stinner date: Tue Jun 07 11:25:43 2016 +0200 summary: Merge 3.5 (os.urandom) files: Doc/library/os.rst | 13 ++++++++++--- Misc/ACKS | 1 + Misc/NEWS | 4 ++++ Python/random.c | 24 +++++++++++++++++++++--- configure | 8 +++++--- configure.ac | 7 ++++--- pyconfig.h.in | 3 +++ 7 files changed, 48 insertions(+), 12 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -3768,14 +3768,21 @@ This function returns random bytes from an OS-specific randomness source. The returned data should be unpredictable enough for cryptographic applications, - though its exact quality depends on the OS implementation. On a Unix-like - system this will query ``/dev/urandom``, and on Windows it will use - ``CryptGenRandom()``. If a randomness source is not found, + though its exact quality depends on the OS implementation. + + On Linux, ``getrandom()`` syscall is used if available and the urandom + entropy pool is initialized (``getrandom()`` does not block). + On a Unix-like system this will query ``/dev/urandom``. On Windows, it + will use ``CryptGenRandom()``. If a randomness source is not found, :exc:`NotImplementedError` will be raised. For an easy-to-use interface to the random number generator provided by your platform, please see :class:`random.SystemRandom`. + .. versionchanged:: 3.5.2 + On Linux, if ``getrandom()`` blocks (the urandom entropy pool is not + initialized yet), fall back on reading ``/dev/urandom``. + .. versionchanged:: 3.5 On Linux 3.17 and newer, the ``getrandom()`` syscall is now used when available. On OpenBSD 5.6 and newer, the C ``getentropy()`` diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -201,6 +201,7 @@ Floris Bruynooghe Matt Bryant Stan Bubrouski +Colm Buckley Erik de Bueger Jan-Hein B?hrman Lars Buitinck diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,10 @@ Library ------- +- Issue #26839: On Linux, :func:`os.urandom` now calls ``getrandom()`` with + ``GRND_NONBLOCK`` to fall back on reading ``/dev/urandom`` if the urandom + entropy pool is not initialized yet. Patch written by Colm Buckley. + - Issue #23883: Added missing APIs to __all__ to match the documented APIs for the following modules: cgi, mailbox, mimetypes, plistlib and smtpd. Patches by Jacek Ko?odziej. diff --git a/Python/random.c b/Python/random.c --- a/Python/random.c +++ b/Python/random.c @@ -6,6 +6,9 @@ # ifdef HAVE_SYS_STAT_H # include # endif +# ifdef HAVE_LINUX_RANDOM_H +# include +# endif # ifdef HAVE_GETRANDOM # include # elif defined(HAVE_GETRANDOM_SYSCALL) @@ -122,9 +125,13 @@ /* Is getrandom() supported by the running kernel? * Need Linux kernel 3.17 or newer, or Solaris 11.3 or newer */ static int getrandom_works = 1; - /* Use non-blocking /dev/urandom device. On Linux at boot, the getrandom() - * syscall blocks until /dev/urandom is initialized with enough entropy. */ - const int flags = 0; + + /* getrandom() on Linux will block if called before the kernel has + * initialized the urandom entropy pool. This will cause Python + * to hang on startup if called very early in the boot process - + * see https://bugs.python.org/issue26839. To avoid this, use the + * GRND_NONBLOCK flag. */ + const int flags = GRND_NONBLOCK; int n; if (!getrandom_works) @@ -168,6 +175,17 @@ getrandom_works = 0; return 0; } + if (errno == EAGAIN) { + /* If we failed with EAGAIN, the entropy pool was + * uninitialized. In this case, we return failure to fall + * back to reading from /dev/urandom. + * + * Note: In this case the data read will not be random so + * should not be used for cryptographic purposes. Retaining + * the existing semantics for practical purposes. */ + getrandom_works = 0; + return 0; + } if (errno == EINTR) { if (PyErr_CheckSignals()) { diff --git a/configure b/configure --- a/configure +++ b/configure @@ -2876,6 +2876,7 @@ ac_config_headers="$ac_config_headers pyconfig.h" + ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then @@ -7568,7 +7569,7 @@ sys/stat.h sys/syscall.h sys/sys_domain.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 alloca.h endian.h \ +bluetooth/bluetooth.h linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \ sys/endian.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` @@ -16431,12 +16432,13 @@ #include #include + #include int main() { char buffer[1]; const size_t buflen = sizeof(buffer); - const int flags = 0; - /* ignore the result, Python checks for ENOSYS at runtime */ + const int flags = GRND_NONBLOCK; + /* ignore the result, Python checks for ENOSYS and EAGAIN at runtime */ (void)syscall(SYS_getrandom, buffer, buflen, flags); return 0; } diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -1881,7 +1881,7 @@ sys/stat.h sys/syscall.h sys/sys_domain.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 alloca.h endian.h \ +bluetooth/bluetooth.h linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \ sys/endian.h) AC_HEADER_DIRENT AC_HEADER_MAJOR @@ -5246,12 +5246,13 @@ AC_LANG_SOURCE([[ #include #include + #include int main() { char buffer[1]; const size_t buflen = sizeof(buffer); - const int flags = 0; - /* ignore the result, Python checks for ENOSYS at runtime */ + const int flags = GRND_NONBLOCK; + /* ignore the result, Python checks for ENOSYS and EAGAIN at runtime */ (void)syscall(SYS_getrandom, buffer, buflen, flags); return 0; } diff --git a/pyconfig.h.in b/pyconfig.h.in --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -574,6 +574,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_TIPC_H +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_RANDOM_H + /* Define to 1 if you have the `lockf' function. */ #undef HAVE_LOCKF -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Tue Jun 7 08:55:40 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 7 Jun 2016 13:55:40 +0100 Subject: [Python-checkins] GOOD Benchmark Results for Python Default 2016-06-07 Message-ID: Results for project Python default, build date 2016-06-07 02:02:11 +0000 commit: b7a4c076ba40 previous commit: 166784c40be8 revision date: 2016-06-07 01:08:48 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.20% 2.04% 12.84% 12.77% :-| pybench 0.15% 0.10% 1.64% 7.31% :-( regex_v8 2.74% 0.18% -2.65% 3.63% :-| nbody 0.86% -0.54% 0.81% 9.06% :-| json_dump_v2 0.36% 0.82% -1.12% 12.09% :-| normal_startup 0.83% 0.31% -0.02% 5.11% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-default-2016-06-07/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Tue Jun 7 15:36:04 2016 From: python-checkins at python.org (terry.reedy) Date: Tue, 07 Jun 2016 19:36:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Items_for_NEWS_and_idlelib/NEWS=2Etxt=2E?= Message-ID: <20160607193559.33062.79909.EA51A958@psf.io> https://hg.python.org/cpython/rev/cbb5c5da28f2 changeset: 101779:cbb5c5da28f2 parent: 101776:f477ce0d2345 parent: 101778:b941282513a3 user: Terry Jan Reedy date: Tue Jun 07 15:35:37 2016 -0400 summary: Items for NEWS and idlelib/NEWS.txt. files: Lib/idlelib/NEWS.txt | 23 +++++++++++++++++++++++ Misc/NEWS | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -2,6 +2,29 @@ =========================== *Release date: 2016-09-??* +- Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory + is a private implementation of test.test_idle and tool for maintainers. + +- Issue #27196: Stop 'ThemeChanged' warnings when running IDLE tests. + These persisted after other warnings were suppressed in #20567. + Apply Serhiy Storchaka's update_idletasks solution to four test files. + Record this additional advice in idle_test/README.txt + +- Issue #20567: Revise idle_test/README.txt with advice about avoiding + tk warning messages from tests. Apply advice to several IDLE tests. + +- Issue # 24225: Update idlelib/README.txt with new file names + and event handlers. + +- Issue #27156: Remove obsolete code not used by IDLE. Replacements: + 1. help.txt, replaced by help.html, is out-of-date and should not be used. + Its dedicated viewer has be replaced by the html viewer in help.py. + 2. 'import idlever; I = idlever.IDLE_VERSION' is the same as + 'import sys; I = version[:version.index(' ')]' + 3. After 'ob = stackviewer.VariablesTreeItem(*args)', + 'ob.keys()' == 'list(ob.object.keys). + 4. In macosc, runningAsOSXAPP == isAquaTk; idCarbonAquaTk == isCarbonTk + - Issue #27117: Make colorizer htest and turtledemo work with dark themes. Move code for configuring text widget colors to a new function. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -94,6 +94,29 @@ IDLE ---- +- Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory + is a private implementation of test.test_idle and tool for maintainers. + +- Issue #27196: Stop 'ThemeChanged' warnings when running IDLE tests. + These persisted after other warnings were suppressed in #20567. + Apply Serhiy Storchaka's update_idletasks solution to four test files. + Record this additional advice in idle_test/README.txt + +- Issue #20567: Revise idle_test/README.txt with advice about avoiding + tk warning messages from tests. Apply advice to several IDLE tests. + +- Issue # 24225: Update idlelib/README.txt with new file names + and event handlers. + +- Issue #27156: Remove obsolete code not used by IDLE. Replacements: + 1. help.txt, replaced by help.html, is out-of-date and should not be used. + Its dedicated viewer has be replaced by the html viewer in help.py. + 2. 'import idlever; I = idlever.IDLE_VERSION' is the same as + 'import sys; I = version[:version.index(' ')]' + 3. After 'ob = stackviewer.VariablesTreeItem(*args)', + 'ob.keys()' == 'list(ob.object.keys). + 4. In macosc, runningAsOSXAPP == isAquaTk; idCarbonAquaTk == isCarbonTk + - Issue #27117: Make colorizer htest and turtledemo work with dark themes. Move code for configuring text widget colors to a new function. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 7 15:36:03 2016 From: python-checkins at python.org (terry.reedy) Date: Tue, 07 Jun 2016 19:36:03 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Items_for_NEWS?= =?utf-8?q?_and_idlelib/NEWS=2Etxt=2E?= Message-ID: <20160607193559.83667.88489.31F335C0@psf.io> https://hg.python.org/cpython/rev/ef9966e9d759 changeset: 101777:ef9966e9d759 branch: 2.7 parent: 101772:ec214654708f user: Terry Jan Reedy date: Tue Jun 07 15:33:47 2016 -0400 summary: Items for NEWS and idlelib/NEWS.txt. files: Lib/idlelib/NEWS.txt | 3 +++ Misc/NEWS | 4 +++- 2 files changed, 6 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -2,6 +2,9 @@ ========================== *Release date: 2015-06-30?* +- Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory + is a private implementation of test.test_idle and tool for maintainers. + - Issue #26673: When tk reports font size as 0, change to size 10. Such fonts on Linux prevented the configuration dialog from opening. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -18,7 +18,7 @@ Some compilers and toolchains are known to not produce stable code when using LTO, be sure to test things thoroughly before relying on it. It can provide a few % speed up over profile-opt alone. - + - Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N" format unit. @@ -263,6 +263,8 @@ IDLE ---- +- Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory + is a private implementation of test.test_idle and tool for maintainers. - Issue #26673: When tk reports font size as 0, change to size 10. Such fonts on Linux prevented the configuration dialog from opening. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 7 15:36:27 2016 From: python-checkins at python.org (terry.reedy) Date: Tue, 07 Jun 2016 19:36:27 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Items_for_NEWS?= =?utf-8?q?_and_idlelib/NEWS=2Etxt=2E?= Message-ID: <20160607193559.1613.32244.A624C7AA@psf.io> https://hg.python.org/cpython/rev/b941282513a3 changeset: 101778:b941282513a3 branch: 3.5 parent: 101775:9de508dc4837 user: Terry Jan Reedy date: Tue Jun 07 15:33:53 2016 -0400 summary: Items for NEWS and idlelib/NEWS.txt. files: Lib/idlelib/NEWS.txt | 11 +++++++++++ Misc/NEWS | 11 +++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -2,6 +2,17 @@ ========================= *Release date: 2016-06-30?* +- Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory + is a private implementation of test.test_idle and tool for maintainers. + +- Issue #27196: Stop 'ThemeChangef' warnings when running IDLE tests. + These persisted after other warnings were suppressed in #20567. + Apply Serhiy Storchaka's update_idletasks solution to four test files. + Record this additional advice in idle_test/README.txt + +- Issue #20567: Revise idle_test/README.txt with advice about avoiding + tk warning messages from tests. Apply advice to several IDLE tests. + - Issue #27117: Make colorizer htest and turtledemo work with dark themes. Move code for configuring text widget colors to a new function. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -498,6 +498,17 @@ IDLE ---- +- Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory + is a private implementation of test.test_idle and tool for maintainers. + +- Issue #27196: Stop 'ThemeChanged' warnings when running IDLE tests. + These persisted after other warnings were suppressed in #20567. + Apply Serhiy Storchaka's update_idletasks solution to four test files. + Record this additional advice in idle_test/README.txt + +- Issue #20567: Revise idle_test/README.txt with advice about avoiding + tk warning messages from tests. Apply advice to several IDLE tests. + - Issue #27117: Make colorizer htest and turtledemo work with dark themes. Move code for configuring text widget colors to a new function. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 7 16:20:59 2016 From: python-checkins at python.org (vinay.sajip) Date: Tue, 07 Jun 2016 20:20:59 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogRml4ZWQgIzI3MjUx?= =?utf-8?q?=3A_corrected_string/bytes_handling_in_credentials=2E?= Message-ID: <20160607202052.11838.46040.CF6460D5@psf.io> https://hg.python.org/cpython/rev/11ebd14076b4 changeset: 101780:11ebd14076b4 branch: 3.5 parent: 101778:b941282513a3 user: Vinay Sajip date: Tue Jun 07 21:19:55 2016 +0100 summary: Fixed #27251: corrected string/bytes handling in credentials. files: Lib/logging/handlers.py | 4 ++-- Lib/test/test_logging.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -1156,8 +1156,8 @@ h.putheader("Content-length", str(len(data))) if self.credentials: import base64 - s = ('u%s:%s' % self.credentials).encode('utf-8') - s = 'Basic ' + base64.b64encode(s).strip() + s = ('%s:%s' % self.credentials).encode('utf-8') + s = 'Basic ' + base64.b64encode(s).strip().decode('ascii') h.putheader('Authorization', s) h.endheaders() if self.method == "POST": 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 @@ -1672,7 +1672,8 @@ secure_client = secure and sslctx self.h_hdlr = logging.handlers.HTTPHandler(host, '/frob', secure=secure_client, - context=context) + context=context, + credentials=('foo', 'bar')) self.log_data = None root_logger.addHandler(self.h_hdlr) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 7 16:20:59 2016 From: python-checkins at python.org (vinay.sajip) Date: Tue, 07 Jun 2016 20:20:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Fixed_=2327251=3A_merged_fix_from_3=2E5=2E?= Message-ID: <20160607202052.18996.85262.4A52814F@psf.io> https://hg.python.org/cpython/rev/12d939477b4f changeset: 101781:12d939477b4f parent: 101779:cbb5c5da28f2 parent: 101780:11ebd14076b4 user: Vinay Sajip date: Tue Jun 07 21:20:39 2016 +0100 summary: Fixed #27251: merged fix from 3.5. files: Lib/logging/handlers.py | 4 ++-- Lib/test/test_logging.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py --- a/Lib/logging/handlers.py +++ b/Lib/logging/handlers.py @@ -1165,8 +1165,8 @@ h.putheader("Content-length", str(len(data))) if self.credentials: import base64 - s = ('u%s:%s' % self.credentials).encode('utf-8') - s = 'Basic ' + base64.b64encode(s).strip() + s = ('%s:%s' % self.credentials).encode('utf-8') + s = 'Basic ' + base64.b64encode(s).strip().decode('ascii') h.putheader('Authorization', s) h.endheaders() if self.method == "POST": 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 @@ -1672,7 +1672,8 @@ secure_client = secure and sslctx self.h_hdlr = logging.handlers.HTTPHandler(host, '/frob', secure=secure_client, - context=context) + context=context, + credentials=('foo', 'bar')) self.log_data = None root_logger.addHandler(self.h_hdlr) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 7 16:25:29 2016 From: python-checkins at python.org (barry.warsaw) Date: Tue, 07 Jun 2016 20:25:29 +0000 Subject: [Python-checkins] =?utf-8?b?cGVwczogUmVsYXggX19hbGxfXyBsb2NhdGlv?= =?utf-8?q?n=2E?= Message-ID: <20160607202522.20859.85548.93FE263B@psf.io> https://hg.python.org/peps/rev/cf8e888b9555 changeset: 6352:cf8e888b9555 user: Barry Warsaw date: Tue Jun 07 16:25:19 2016 -0400 summary: Relax __all__ location. Put all module level dunders together in the same location, and remove the redundant version bookkeeping information. Closes #27187. Patch by Ian Lee. files: pep-0008.txt | 23 ++++++++--------------- 1 files changed, 8 insertions(+), 15 deletions(-) diff --git a/pep-0008.txt b/pep-0008.txt --- a/pep-0008.txt +++ b/pep-0008.txt @@ -365,8 +365,6 @@ You should put a blank line between each group of imports. - Put any relevant ``__all__`` specification after the imports. - - Absolute imports are recommended, as they are usually more readable and tend to be better behaved (or at least give better error messages) if the import system is incorrectly configured (such as @@ -415,6 +413,14 @@ public and internal interfaces still apply. +Dunder Variables +---------------- + +All relevant dunder variables (e.g. ``__all__``, ``__author__``, +``__version__``, etc) should be placed after the module docstring and +before any imports, separated by a blank line above and below. + + String Quotes ============= @@ -689,19 +695,6 @@ the same line. -Version Bookkeeping -=================== - -If you have to have Subversion, CVS, or RCS crud in your source file, -do it as follows. :: - - __version__ = "$Revision$" - # $Source$ - -These lines should be included after the module's docstring, before -any other code, separated by a blank line above and below. - - Naming Conventions ================== -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Tue Jun 7 20:44:18 2016 From: python-checkins at python.org (eric.snow) Date: Wed, 08 Jun 2016 00:44:18 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Add_PEP_520=3A_Ordered_Class_?= =?utf-8?q?Definition_Namespace?= Message-ID: <20160608004418.17996.38581.8A2CAE06@psf.io> https://hg.python.org/peps/rev/d4db663f019f changeset: 6353:d4db663f019f user: Eric Snow date: Tue Jun 07 17:44:13 2016 -0700 summary: Add PEP 520: Ordered Class Definition Namespace files: pep-0520.txt | 219 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 219 insertions(+), 0 deletions(-) diff --git a/pep-0520.txt b/pep-0520.txt new file mode 100644 --- /dev/null +++ b/pep-0520.txt @@ -0,0 +1,219 @@ +PEP: 520 +Title: Ordered Class Definition Namespace +Version: $Revision$ +Last-Modified: $Date$ +Author: Eric Snow +Status: Draft +Type: Standards Track +Content-Type: text/x-rst +Created: 7-Jun-2016 +Python-Version: 3.6 +Post-History: 7-Jun-2016 + + +Abstract +======== + +This PEP changes the default class definition namespace to ``OrderedDict``. +Furthermore, the order in which the attributes are defined in each class +body will now be preserved in ``type.__definition_order__``. This allows +introspection of the original definition order, e.g. by class decorators. + +Note: just to be clear, this PEP is *not* about changing ``__dict__`` for +classes to ``OrderedDict``. + + +Motivation +========== + +Currently the namespace used during execution of a class body defaults +to ``dict``. If the metaclass defines ``__prepare__()`` then the result +of calling it is used. Thus, before this PEP, if you needed your class +definition namespace to be ``OrderedDict`` you had to use a metaclass. + +Metaclasses introduce an extra level of complexity to code and in some +cases (e.g. conflicts) are a problem. So reducing the need for them is +worth doing when the opportunity presents itself. Given that we now have +a C implementation of ``OrderedDict`` and that ``OrderedDict`` is the +common use case for ``__prepare__()``, we have such an opportunity by +defaulting to ``OrderedDict``. + +The usefulness of ``OrderedDict``-by-default is greatly increased if the +definition order is directly introspectable on classes afterward, +particularly by code that is independent of the original class definition. +One of the original motivating use cases for this PEP is generic class +decorators that make use of the definition order. + +Changing the default class definition namespace has been discussed a +number of times, including on the mailing lists and in PEP 422 and +PEP 487 (see the References section below). + + +Specification +============= + +* the default class *definition* namespace is now ``OrderdDict`` +* the order in which class attributes are defined is preserved in the + new ``__definition_order__`` attribute on each class +* "dunder" attributes (e.g. ``__init__``, ``__module__``) are ignored +* ``__definition_order__`` is a tuple +* ``__definition_order__`` is a read-only attribute +* ``__definition_order__`` is always set: + + 1. if ``__definition_order__`` is defined in the class body then the + value is used as-is, though the attribute will still be read-only + 2. types that do not have a class definition (e.g. builtins) have + their ``__definition_order__`` set to ``None`` + 3. types for which `__prepare__()`` returned something other than + ``OrderedDict`` (or a subclass) have their ``__definition_order__`` + set to ``None`` (except where #1 applies) + +The following code demonstrates roughly equivalent semantics:: + + class Meta(type): + def __prepare__(cls, *args, **kwargs): + return OrderedDict() + + class Spam(metaclass=Meta): + ham = None + eggs = 5 + __definition_order__ = tuple(k for k in locals() + if (!k.startswith('__') or + !k.endswith('__'))) + +Note that [pep487_] proposes a similar solution, albeit as part of a +broader proposal. + +Why a tuple? +------------ + +Use of a tuple reflects the fact that we are exposing the order in +which attributes on the class were *defined*. Since the definition +is already complete by the time ``definition_order__`` is set, the +content and order of the value won't be changing. Thus we use a type +that communicates that state of immutability. + +Why a read-only attribute? +-------------------------- + +As with the use of tuple, making ``__definition_order__`` a read-only +attribute communicates the fact that the information it represents is +complete. Since it represents the state of a particular one-time event +(execution of the class definition body), allowing the value to be +replaced would reduce confidence that the attribute corresponds to the +original class body. + +If a use case for a writable (or mutable) ``__definition_order__`` +arises, the restriction may be loosened later. Presently this seems +unlikely and furthermore it is usually best to go immutable-by-default. + +Note that ``__definition_order__`` is centered on the class definition +body. The use cases for dealing with the class namespace (``__dict__``) +post-definition are a separate matter. ``__definition_order__`` would +be a significantly misleading name for a supporting feature. + +See [nick_concern_] for more discussion. + +Why ignore "dunder" names? +-------------------------- + +Names starting and ending with "__" are reserved for use by the +interpreter. In practice they should not be relevant to the users of +``__definition_order__``. Instead, for early everyone they would only +be clutter, causing the same extra work for everyone. + +Why is __definition_order__ even necessary? +------------------------------------------- + +Since the definition order is not preserved in ``__dict__``, it would be +lost once class definition execution completes. Classes *could* +explicitly set the attribute as the last thing in the body. However, +then independent decorators could only make use of classes that had done +so. Instead, ``__definition_order__`` preserves this one bit of info +from the class body so that it is universally available. + + +Compatibility +============= + +This PEP does not break backward compatibility, except in the case that +someone relies *strictly* on ``dict`` as the class definition namespace. +This shouldn't be a problem. + + +Changes +============= + +In addition to the class syntax, the following expose the new behavior: + +* builtins.__build_class__ +* types.prepare_class +* types.new_class + + +Other Python Implementations +============================ + +Pending feedback, the impact on Python implementations is expected to +be minimal. If a Python implementation cannot support switching to +`OrderedDict``-by-default then it can always set ``__definition_order__`` +to ``None``. + + +Implementation +============== + +The implementation is found in the tracker. [impl_] + + +Alternatives +============ + +type.__dict__ as OrderedDict +---------------------------- + +Instead of storing the definition order in ``__definition_order__``, +the now-ordered definition namespace could be copied into a new +``OrderedDict``. This would mostly provide the same semantics. + +However, using ``OrderedDict`` for ``type,__dict__`` would obscure the +relationship with the definition namespace, making it less useful. +Additionally, doing this would require significant changes to the +semantics of the concrete ``dict`` C-API. + +A "namespace" Keyword Arg for Class Definition +---------------------------------------------- + +PEP 422 introduced a new "namespace" keyword arg to class definitions +that effectively replaces the need to ``__prepare__()``. [pep422_] +However, the proposal was withdrawn in favor of the simpler PEP 487. + + +References +========== + +.. [impl] issue #24254 + (https://bugs.python.org/issue24254) + +.. [nick_concern] Nick's concerns about mutability + (https://mail.python.org/pipermail/python-dev/2016-June/144883.html) + +.. [pep422] PEP 422 + (https://www.python.org/dev/peps/pep-0422/#order-preserving-classes) + +.. [pep487] PEP 487 + (https://www.python.org/dev/peps/pep-0487/#defining-arbitrary-namespaces) + +.. [orig] original discussion + (https://mail.python.org/pipermail/python-ideas/2013-February/019690.html) + +.. [followup1] follow-up 1 + (https://mail.python.org/pipermail/python-dev/2013-June/127103.html) + +.. [followup2] follow-up 2 + (https://mail.python.org/pipermail/python-dev/2015-May/140137.html) + + +Copyright +=========== +This document has been placed in the public domain. -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Tue Jun 7 20:47:36 2016 From: python-checkins at python.org (eric.snow) Date: Wed, 08 Jun 2016 00:47:36 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Add_the_typical_footer_to_PEP?= =?utf-8?q?_520=2E?= Message-ID: <20160608004730.33238.57942.A005D567@psf.io> https://hg.python.org/peps/rev/39edc5bca8da changeset: 6354:39edc5bca8da user: Eric Snow date: Tue Jun 07 17:47:24 2016 -0700 summary: Add the typical footer to PEP 520. files: pep-0520.txt | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/pep-0520.txt b/pep-0520.txt --- a/pep-0520.txt +++ b/pep-0520.txt @@ -217,3 +217,14 @@ 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: https://hg.python.org/peps From python-checkins at python.org Tue Jun 7 23:09:32 2016 From: python-checkins at python.org (eric.snow) Date: Wed, 08 Jun 2016 03:09:32 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Minor_clean_up_of_PEP_520=2E?= Message-ID: <20160608030932.20820.23141.3F3B6B52@psf.io> https://hg.python.org/peps/rev/ea566ba82216 changeset: 6355:ea566ba82216 user: Eric Snow date: Tue Jun 07 20:09:27 2016 -0700 summary: Minor clean up of PEP 520. files: pep-0520.txt | 22 ++++++++++++---------- 1 files changed, 12 insertions(+), 10 deletions(-) diff --git a/pep-0520.txt b/pep-0520.txt --- a/pep-0520.txt +++ b/pep-0520.txt @@ -16,8 +16,9 @@ This PEP changes the default class definition namespace to ``OrderedDict``. Furthermore, the order in which the attributes are defined in each class -body will now be preserved in ``type.__definition_order__``. This allows -introspection of the original definition order, e.g. by class decorators. +body will now be preserved in the ``__definition_order__`` attribute of +the class. This allows introspection of the original definition order, +e.g. by class decorators. Note: just to be clear, this PEP is *not* about changing ``__dict__`` for classes to ``OrderedDict``. @@ -62,9 +63,9 @@ 1. if ``__definition_order__`` is defined in the class body then the value is used as-is, though the attribute will still be read-only - 2. types that do not have a class definition (e.g. builtins) have + 2. classes that do not have a class definition (e.g. builtins) have their ``__definition_order__`` set to ``None`` - 3. types for which `__prepare__()`` returned something other than + 3. classes for which `__prepare__()`` returned something other than ``OrderedDict`` (or a subclass) have their ``__definition_order__`` set to ``None`` (except where #1 applies) @@ -78,8 +79,8 @@ ham = None eggs = 5 __definition_order__ = tuple(k for k in locals() - if (!k.startswith('__') or - !k.endswith('__'))) + if (not k.startswith('__') or + not k.endswith('__'))) Note that [pep487_] proposes a similar solution, albeit as part of a broader proposal. @@ -169,14 +170,15 @@ Alternatives ============ -type.__dict__ as OrderedDict ----------------------------- +.__dict__ as OrderedDict +------------------------------- Instead of storing the definition order in ``__definition_order__``, the now-ordered definition namespace could be copied into a new -``OrderedDict``. This would mostly provide the same semantics. +``OrderedDict``. This would then be used as the mapping proxied as +``__dict__``. Doing so would mostly provide the same semantics. -However, using ``OrderedDict`` for ``type,__dict__`` would obscure the +However, using ``OrderedDict`` for ``__dict__`` would obscure the relationship with the definition namespace, making it less useful. Additionally, doing this would require significant changes to the semantics of the concrete ``dict`` C-API. -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Tue Jun 7 23:17:03 2016 From: python-checkins at python.org (eric.snow) Date: Wed, 08 Jun 2016 03:17:03 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Fix_PEP_520_typos=2E?= Message-ID: <20160608031702.3687.54153.06B52C7C@psf.io> https://hg.python.org/peps/rev/ddf3758db956 changeset: 6356:ddf3758db956 user: Eric Snow date: Tue Jun 07 20:16:56 2016 -0700 summary: Fix PEP 520 typos. files: pep-0520.txt | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pep-0520.txt b/pep-0520.txt --- a/pep-0520.txt +++ b/pep-0520.txt @@ -120,13 +120,13 @@ Names starting and ending with "__" are reserved for use by the interpreter. In practice they should not be relevant to the users of -``__definition_order__``. Instead, for early everyone they would only +``__definition_order__``. Instead, for nearly everyone they would only be clutter, causing the same extra work for everyone. Why is __definition_order__ even necessary? ------------------------------------------- -Since the definition order is not preserved in ``__dict__``, it would be +Since the definition order is not preserved in ``__dict__``, it is lost once class definition execution completes. Classes *could* explicitly set the attribute as the last thing in the body. However, then independent decorators could only make use of classes that had done -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Wed Jun 8 04:27:40 2016 From: python-checkins at python.org (victor.stinner) Date: Wed, 08 Jun 2016 08:27:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbjogcHlfZ2V0cmFuZG9tKCk6IHVz?= =?utf-8?q?e_char*_instead_of_void*_for_the_destination?= Message-ID: <20160608082739.39367.46976.6FF7E3CD@psf.io> https://hg.python.org/cpython/rev/7e3860ea539e changeset: 101782:7e3860ea539e user: Victor Stinner date: Wed Jun 08 10:16:50 2016 +0200 summary: py_getrandom(): use char* instead of void* for the destination Fix a "gcc -pedantic" warning on "buffer += n" because buffer type is void*. files: Python/random.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Python/random.c b/Python/random.c --- a/Python/random.c +++ b/Python/random.c @@ -132,11 +132,14 @@ * see https://bugs.python.org/issue26839. To avoid this, use the * GRND_NONBLOCK flag. */ const int flags = GRND_NONBLOCK; + + char *dest; int n; if (!getrandom_works) return 0; + dest = buffer; while (0 < size) { #ifdef sun /* Issue #26735: On Solaris, getrandom() is limited to returning up @@ -150,11 +153,11 @@ #ifdef HAVE_GETRANDOM if (raise) { Py_BEGIN_ALLOW_THREADS - n = getrandom(buffer, n, flags); + n = getrandom(dest, n, flags); Py_END_ALLOW_THREADS } else { - n = getrandom(buffer, n, flags); + n = getrandom(dest, n, flags); } #else /* On Linux, use the syscall() function because the GNU libc doesn't @@ -162,11 +165,11 @@ * https://sourceware.org/bugzilla/show_bug.cgi?id=17252 */ if (raise) { Py_BEGIN_ALLOW_THREADS - n = syscall(SYS_getrandom, buffer, n, flags); + n = syscall(SYS_getrandom, dest, n, flags); Py_END_ALLOW_THREADS } else { - n = syscall(SYS_getrandom, buffer, n, flags); + n = syscall(SYS_getrandom, dest, n, flags); } #endif @@ -204,7 +207,7 @@ return -1; } - buffer += n; + dest += n; size -= n; } return 1; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 04:27:48 2016 From: python-checkins at python.org (victor.stinner) Date: Wed, 08 Jun 2016 08:27:48 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_odict=3A_Remove_useless_?= =?utf-8?q?=22=3B=22_after_function_definition?= Message-ID: <20160608082739.18996.1859.516D500B@psf.io> https://hg.python.org/cpython/rev/3130e17404ec changeset: 101783:3130e17404ec user: Victor Stinner date: Wed Jun 08 10:18:18 2016 +0200 summary: odict: Remove useless ";" after function definition Fix a "gcc -pendatic" warning. files: Objects/odictobject.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Objects/odictobject.c b/Objects/odictobject.c --- a/Objects/odictobject.c +++ b/Objects/odictobject.c @@ -1462,7 +1462,7 @@ ++tstate->trash_delete_nesting; Py_TRASHCAN_SAFE_END(self) -}; +} /* tp_repr */ @@ -1539,7 +1539,7 @@ Py_XDECREF(pieces); Py_ReprLeave((PyObject *)self); return result; -}; +} /* tp_doc */ @@ -1611,7 +1611,7 @@ } else { Py_RETURN_NOTIMPLEMENTED; } -}; +} /* tp_iter */ @@ -1619,7 +1619,7 @@ odict_iter(PyODictObject *od) { return odictiter_new(od, _odict_ITER_KEYS); -}; +} /* tp_init */ @@ -1645,7 +1645,7 @@ Py_DECREF(res); return 0; } -}; +} /* tp_new */ @@ -1720,7 +1720,7 @@ PyObject * PyODict_New(void) { return odict_new(&PyODict_Type, NULL, NULL); -}; +} static int _PyODict_SetItem_KnownHash(PyObject *od, PyObject *key, PyObject *value, @@ -1738,7 +1738,7 @@ } } return res; -}; +} int PyODict_SetItem(PyObject *od, PyObject *key, PyObject *value) @@ -1747,7 +1747,7 @@ if (hash == -1) return -1; return _PyODict_SetItem_KnownHash(od, key, value, hash); -}; +} int PyODict_DelItem(PyObject *od, PyObject *key) @@ -1760,7 +1760,7 @@ if (res < 0) return -1; return _PyDict_DelItem_KnownHash(od, key, hash); -}; +} /* ------------------------------------------- -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Wed Jun 8 04:52:06 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 08 Jun 2016 08:52:06 +0000 Subject: [Python-checkins] Daily reference leaks (12d939477b4f): sum=8 Message-ID: <20160608085204.33062.56209.1163AAD1@psf.io> results for 12d939477b4f on branch "default" -------------------------------------------- test_collections leaked [4, 0, 0] memory blocks, sum=4 test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogpRziG6', '--timeout', '7200'] From python-checkins at python.org Wed Jun 8 05:50:49 2016 From: python-checkins at python.org (martin.panter) Date: Wed, 08 Jun 2016 09:50:49 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzIxMzEz?= =?utf-8?q?=3A_Tolerate_truncated_buildinfo_in_sys=2Eversion?= Message-ID: <20160608095045.39289.13685.544B9DD8@psf.io> https://hg.python.org/cpython/rev/b86e259271b3 changeset: 101784:b86e259271b3 branch: 2.7 parent: 101777:ef9966e9d759 user: Martin Panter date: Wed Jun 08 06:12:22 2016 +0000 summary: Issue #21313: Tolerate truncated buildinfo in sys.version files: Lib/platform.py | 15 +++++++++++---- Lib/test/test_platform.py | 16 ++++++++++++++++ Misc/NEWS | 3 +++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Lib/platform.py b/Lib/platform.py --- a/Lib/platform.py +++ b/Lib/platform.py @@ -1314,9 +1314,11 @@ ### Various APIs for extracting information from sys.version _sys_version_parser = re.compile( - r'([\w.+]+)\s*' - '\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*' - '\[([^\]]+)\]?') + r'([\w.+]+)\s*' # "version" + r'\(#?([^,]+)' # "(#buildno" + r'(?:,\s*([\w ]*)' # ", builddate" + r'(?:,\s*([\w :]*))?)?\)\s*' # ", buildtime)" + r'\[([^\]]+)\]?') # "[compiler]" _ironpython_sys_version_parser = re.compile( r'IronPython\s*' @@ -1395,6 +1397,8 @@ 'failed to parse Jython sys.version: %s' % repr(sys_version)) version, buildno, builddate, buildtime, _ = match.groups() + if builddate is None: + builddate = '' compiler = sys.platform elif "PyPy" in sys_version: @@ -1417,7 +1421,10 @@ version, buildno, builddate, buildtime, compiler = \ match.groups() name = 'CPython' - builddate = builddate + ' ' + buildtime + if builddate is None: + builddate = '' + elif buildtime: + builddate = builddate + ' ' + buildtime if hasattr(sys, 'subversion'): # sys.subversion was added in Python 2.5 diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -67,6 +67,22 @@ ('IronPython', '1.0.60816', '', '', '', '', '.NET 2.0.50727.42')), ('IronPython 1.0 (1.0.61005.1977) on .NET 2.0.50727.42', ('IronPython', '1.0.0', '', '', '', '', '.NET 2.0.50727.42')), + ('2.4.3 (truncation, date, t) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', 'date t', 'GCC')), + ('2.4.3 (truncation, date, ) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', 'date', 'GCC')), + ('2.4.3 (truncation, date,) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', 'date', 'GCC')), + ('2.4.3 (truncation, date) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', 'date', 'GCC')), + ('2.4.3 (truncation, d) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', 'd', 'GCC')), + ('2.4.3 (truncation, ) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', '', 'GCC')), + ('2.4.3 (truncation,) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', '', 'GCC')), + ('2.4.3 (truncation) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', '', 'GCC')), ): # branch and revision are not "parsed", but fetched # from sys.subversion. Ignore them diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -92,6 +92,9 @@ Library ------- +- Issue #21313: Fix the "platform" module to tolerate when sys.version + contains truncated build information. + - Issue #27211: Fix possible memory corruption in io.IOBase.readline(). - Issue #27114: Fix SSLContext._load_windows_store_certs fails with -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 05:50:49 2016 From: python-checkins at python.org (martin.panter) Date: Wed, 08 Jun 2016 09:50:49 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI1NzM4?= =?utf-8?q?=3A_Don=E2=80=99t_send_message_body_for_205_Reset_Content?= Message-ID: <20160608095046.39704.2753.107100E7@psf.io> https://hg.python.org/cpython/rev/b1041ddb1391 changeset: 101787:b1041ddb1391 branch: 2.7 parent: 101784:b86e259271b3 user: Martin Panter date: Wed Jun 08 07:16:14 2016 +0000 summary: Issue #25738: Don?t send message body for 205 Reset Content Patch by Susumu Koshiba. files: Doc/library/basehttpserver.rst | 5 ++- Lib/BaseHTTPServer.py | 21 +++++++++-- Lib/test/test_httpservers.py | 38 ++++++++++++++++++++++ Misc/ACKS | 1 + Misc/NEWS | 5 ++ 5 files changed, 64 insertions(+), 6 deletions(-) diff --git a/Doc/library/basehttpserver.rst b/Doc/library/basehttpserver.rst --- a/Doc/library/basehttpserver.rst +++ b/Doc/library/basehttpserver.rst @@ -197,7 +197,10 @@ Sends and logs a complete error reply to the client. The numeric *code* specifies the HTTP error code, with *message* as optional, more specific text. A complete set of headers is sent, followed by text composed using the - :attr:`error_message_format` class variable. + :attr:`error_message_format` class variable. The body will be empty + if the method is HEAD or the response code is one of the following: + ``1xx``, ``204 No Content``, ``205 Reset Content``, + ``304 Not Modified``. .. method:: send_response(code[, message]) diff --git a/Lib/BaseHTTPServer.py b/Lib/BaseHTTPServer.py --- a/Lib/BaseHTTPServer.py +++ b/Lib/BaseHTTPServer.py @@ -362,14 +362,25 @@ message = short explain = long self.log_error("code %d, message %s", code, message) - # using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201) - content = (self.error_message_format % - {'code': code, 'message': _quote_html(message), 'explain': explain}) self.send_response(code, message) - self.send_header("Content-Type", self.error_content_type) self.send_header('Connection', 'close') + + # Message body is omitted for cases described in: + # - RFC7230: 3.3. 1xx, 204(No Content), 304(Not Modified) + # - RFC7231: 6.3.6. 205(Reset Content) + content = None + if code >= 200 and code not in (204, 205, 304): + # HTML encode to prevent Cross Site Scripting attacks + # (see bug #1100201) + content = (self.error_message_format % { + 'code': code, + 'message': _quote_html(message), + 'explain': explain + }) + self.send_header("Content-Type", self.error_content_type) self.end_headers() - if self.command != 'HEAD' and code >= 200 and code not in (204, 304): + + if self.command != 'HEAD' and content: self.wfile.write(content) error_message_format = DEFAULT_ERROR_MESSAGE diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -178,6 +178,12 @@ self.send_header('Connection', 'close') self.end_headers() + def do_SEND_ERROR(self): + self.send_error(int(self.path[1:])) + + def do_HEAD(self): + self.send_error(int(self.path[1:])) + def setUp(self): BaseTestCase.setUp(self) self.con = httplib.HTTPConnection('localhost', self.PORT) @@ -276,6 +282,38 @@ res = self.con.getresponse() self.assertEqual(res.status, 999) + def test_send_error(self): + allow_transfer_encoding_codes = (205, 304) + for code in (101, 102, 204, 205, 304): + self.con.request('SEND_ERROR', '/{}'.format(code)) + res = self.con.getresponse() + self.assertEqual(code, res.status) + self.assertEqual(None, res.getheader('Content-Length')) + self.assertEqual(None, res.getheader('Content-Type')) + if code not in allow_transfer_encoding_codes: + self.assertEqual(None, res.getheader('Transfer-Encoding')) + + data = res.read() + self.assertEqual(b'', data) + + def test_head_via_send_error(self): + allow_transfer_encoding_codes = (205, 304) + for code in (101, 200, 204, 205, 304): + self.con.request('HEAD', '/{}'.format(code)) + res = self.con.getresponse() + self.assertEqual(code, res.status) + if code == 200: + self.assertEqual(None, res.getheader('Content-Length')) + self.assertIn('text/html', res.getheader('Content-Type')) + else: + self.assertEqual(None, res.getheader('Content-Length')) + self.assertEqual(None, res.getheader('Content-Type')) + if code not in allow_transfer_encoding_codes: + self.assertEqual(None, res.getheader('Transfer-Encoding')) + + data = res.read() + self.assertEqual(b'', data) + class SimpleHTTPServerTestCase(BaseTestCase): class request_handler(NoLogRequestHandler, SimpleHTTPRequestHandler): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -741,6 +741,7 @@ ???? ????????? Vlad Korolev Anna Koroliuk +Susumu Koshiba Joseph Koshy Daniel Kozan Jerzy Kozera diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -92,6 +92,11 @@ Library ------- +- Issue #25738: Stop BaseHTTPServer.BaseHTTPRequestHandler.send_error() from + sending a message body for 205 Reset Content. Also, don't send the + Content-Type header field in responses that don't have a body. Based on + patch by Susumu Koshiba. + - Issue #21313: Fix the "platform" module to tolerate when sys.version contains truncated build information. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 05:50:56 2016 From: python-checkins at python.org (martin.panter) Date: Wed, 08 Jun 2016 09:50:56 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIxMzEz?= =?utf-8?q?=3A_Tolerate_truncated_buildinfo_in_sys=2Eversion?= Message-ID: <20160608095045.17677.88769.9ADCE04F@psf.io> https://hg.python.org/cpython/rev/4deec876db0d changeset: 101785:4deec876db0d branch: 3.5 parent: 101780:11ebd14076b4 user: Martin Panter date: Wed Jun 08 06:12:22 2016 +0000 summary: Issue #21313: Tolerate truncated buildinfo in sys.version files: Lib/platform.py | 15 +++++++++++---- Lib/test/test_platform.py | 16 ++++++++++++++++ Misc/NEWS | 3 +++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Lib/platform.py b/Lib/platform.py --- a/Lib/platform.py +++ b/Lib/platform.py @@ -1146,9 +1146,11 @@ ### Various APIs for extracting information from sys.version _sys_version_parser = re.compile( - r'([\w.+]+)\s*' - '\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*' - '\[([^\]]+)\]?', re.ASCII) + r'([\w.+]+)\s*' # "version" + r'\(#?([^,]+)' # "(#buildno" + r'(?:,\s*([\w ]*)' # ", builddate" + r'(?:,\s*([\w :]*))?)?\)\s*' # ", buildtime)" + r'\[([^\]]+)\]?', re.ASCII) # "[compiler]" _ironpython_sys_version_parser = re.compile( r'IronPython\s*' @@ -1227,6 +1229,8 @@ 'failed to parse Jython sys.version: %s' % repr(sys_version)) version, buildno, builddate, buildtime, _ = match.groups() + if builddate is None: + builddate = '' compiler = sys.platform elif "PyPy" in sys_version: @@ -1249,7 +1253,10 @@ version, buildno, builddate, buildtime, compiler = \ match.groups() name = 'CPython' - builddate = builddate + ' ' + buildtime + if builddate is None: + builddate = '' + elif buildtime: + builddate = builddate + ' ' + buildtime if hasattr(sys, '_mercurial'): _, branch, revision = sys._mercurial diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -76,6 +76,22 @@ ('IronPython', '1.0.60816', '', '', '', '', '.NET 2.0.50727.42')), ('IronPython 1.0 (1.0.61005.1977) on .NET 2.0.50727.42', ('IronPython', '1.0.0', '', '', '', '', '.NET 2.0.50727.42')), + ('2.4.3 (truncation, date, t) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', 'date t', 'GCC')), + ('2.4.3 (truncation, date, ) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', 'date', 'GCC')), + ('2.4.3 (truncation, date,) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', 'date', 'GCC')), + ('2.4.3 (truncation, date) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', 'date', 'GCC')), + ('2.4.3 (truncation, d) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', 'd', 'GCC')), + ('2.4.3 (truncation, ) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', '', 'GCC')), + ('2.4.3 (truncation,) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', '', 'GCC')), + ('2.4.3 (truncation) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', '', 'GCC')), ): # branch and revision are not "parsed", but fetched # from sys._mercurial. Ignore them diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -131,6 +131,9 @@ Library ------- +- Issue #21313: Fix the "platform" module to tolerate when sys.version + contains truncated build information. + - Issue #26839: On Linux, :func:`os.urandom` now calls ``getrandom()`` with ``GRND_NONBLOCK`` to fall back on reading ``/dev/urandom`` if the urandom entropy pool is not initialized yet. Patch written by Colm Buckley. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 05:50:56 2016 From: python-checkins at python.org (martin.panter) Date: Wed, 08 Jun 2016 09:50:56 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2325738=3A_Merge_HTTP_server_from_3=2E5?= Message-ID: <20160608095046.17546.5453.C69BF729@psf.io> https://hg.python.org/cpython/rev/de5e1eb4a88d changeset: 101789:de5e1eb4a88d parent: 101788:aec5a3fc4890 parent: 101786:1dc495007b8f user: Martin Panter date: Wed Jun 08 09:45:58 2016 +0000 summary: Issue #25738: Merge HTTP server from 3.5 files: Doc/library/http.server.rst | 4 +- Lib/http/server.py | 33 ++++++++++------- Lib/test/test_httpservers.py | 44 ++++++++++++++++++++++++ Misc/ACKS | 1 + Misc/NEWS | 5 ++ 5 files changed, 73 insertions(+), 14 deletions(-) diff --git a/Doc/library/http.server.rst b/Doc/library/http.server.rst --- a/Doc/library/http.server.rst +++ b/Doc/library/http.server.rst @@ -191,7 +191,9 @@ a complete set of headers, as the response body. The :attr:`responses` attribute holds the default values for *message* and *explain* that will be used if no value is provided; for unknown codes the default value - for both is the string ``???``. + for both is the string ``???``. The body will be empty if the method is + HEAD or the response code is one of the following: ``1xx``, + ``204 No Content``, ``205 Reset Content``, ``304 Not Modified``. .. versionchanged:: 3.4 The error response includes a Content-Length header. diff --git a/Lib/http/server.py b/Lib/http/server.py --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -446,23 +446,30 @@ if explain is None: explain = longmsg self.log_error("code %d, message %s", code, message) - # HTML encode to prevent Cross Site Scripting attacks (see bug #1100201) - content = (self.error_message_format % { - 'code': code, - 'message': html.escape(message, quote=False), - 'explain': html.escape(explain, quote=False) - }) - body = content.encode('UTF-8', 'replace') self.send_response(code, message) - self.send_header("Content-Type", self.error_content_type) self.send_header('Connection', 'close') - self.send_header('Content-Length', int(len(body))) + + # Message body is omitted for cases described in: + # - RFC7230: 3.3. 1xx, 204(No Content), 304(Not Modified) + # - RFC7231: 6.3.6. 205(Reset Content) + body = None + if (code >= 200 and + code not in (HTTPStatus.NO_CONTENT, + HTTPStatus.RESET_CONTENT, + HTTPStatus.NOT_MODIFIED)): + # HTML encode to prevent Cross Site Scripting attacks + # (see bug #1100201) + content = (self.error_message_format % { + 'code': code, + 'message': html.escape(message, quote=False), + 'explain': html.escape(explain, quote=False) + }) + body = content.encode('UTF-8', 'replace') + self.send_header("Content-Type", self.error_content_type) + self.send_header('Content-Length', int(len(body))) self.end_headers() - if (self.command != 'HEAD' and - code >= 200 and - code not in ( - HTTPStatus.NO_CONTENT, HTTPStatus.NOT_MODIFIED)): + if self.command != 'HEAD' and body: self.wfile.write(body) def send_response(self, code, message=None): diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -116,6 +116,12 @@ body = self.headers['x-special-incoming'].encode('utf-8') self.wfile.write(body) + def do_SEND_ERROR(self): + self.send_error(int(self.path[1:])) + + def do_HEAD(self): + self.send_error(int(self.path[1:])) + def setUp(self): BaseTestCase.setUp(self) self.con = http.client.HTTPConnection(self.HOST, self.PORT) @@ -237,6 +243,44 @@ data = res.read() self.assertEqual(int(res.getheader('Content-Length')), len(data)) + def test_send_error(self): + allow_transfer_encoding_codes = (HTTPStatus.NOT_MODIFIED, + HTTPStatus.RESET_CONTENT) + for code in (HTTPStatus.NO_CONTENT, HTTPStatus.NOT_MODIFIED, + HTTPStatus.PROCESSING, HTTPStatus.RESET_CONTENT, + HTTPStatus.SWITCHING_PROTOCOLS): + self.con.request('SEND_ERROR', '/{}'.format(code)) + res = self.con.getresponse() + self.assertEqual(code, res.status) + self.assertEqual(None, res.getheader('Content-Length')) + self.assertEqual(None, res.getheader('Content-Type')) + if code not in allow_transfer_encoding_codes: + self.assertEqual(None, res.getheader('Transfer-Encoding')) + + data = res.read() + self.assertEqual(b'', data) + + def test_head_via_send_error(self): + allow_transfer_encoding_codes = (HTTPStatus.NOT_MODIFIED, + HTTPStatus.RESET_CONTENT) + for code in (HTTPStatus.OK, HTTPStatus.NO_CONTENT, + HTTPStatus.NOT_MODIFIED, HTTPStatus.RESET_CONTENT, + HTTPStatus.SWITCHING_PROTOCOLS): + self.con.request('HEAD', '/{}'.format(code)) + res = self.con.getresponse() + self.assertEqual(code, res.status) + if code == HTTPStatus.OK: + self.assertTrue(int(res.getheader('Content-Length')) > 0) + self.assertIn('text/html', res.getheader('Content-Type')) + else: + self.assertEqual(None, res.getheader('Content-Length')) + self.assertEqual(None, res.getheader('Content-Type')) + if code not in allow_transfer_encoding_codes: + self.assertEqual(None, res.getheader('Transfer-Encoding')) + + data = res.read() + self.assertEqual(b'', data) + class RequestHandlerLoggingTestCase(BaseTestCase): class request_handler(BaseHTTPRequestHandler): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -787,6 +787,7 @@ Peter A. Koren ???? ????????? Vlad Korolev +Susumu Koshiba Joseph Koshy Daniel Kozan Jerzy Kozera diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,11 @@ Library ------- +- Issue #25738: Stop http.server.BaseHTTPRequestHandler.send_error() from + sending a message body for 205 Reset Content. Also, don't send Content + header fields in responses that don't have a body. Patch by Susumu + Koshiba. + - Issue #21313: Fix the "platform" module to tolerate when sys.version contains truncated build information. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 05:50:56 2016 From: python-checkins at python.org (martin.panter) Date: Wed, 08 Jun 2016 09:50:56 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2321313=3A_Merge_version_parsing_from_3=2E5?= Message-ID: <20160608095046.3671.58847.CF96D97A@psf.io> https://hg.python.org/cpython/rev/aec5a3fc4890 changeset: 101788:aec5a3fc4890 parent: 101783:3130e17404ec parent: 101785:4deec876db0d user: Martin Panter date: Wed Jun 08 09:44:21 2016 +0000 summary: Issue #21313: Merge version parsing from 3.5 files: Lib/platform.py | 15 +++++++++++---- Lib/test/test_platform.py | 16 ++++++++++++++++ Misc/NEWS | 3 +++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Lib/platform.py b/Lib/platform.py --- a/Lib/platform.py +++ b/Lib/platform.py @@ -1146,9 +1146,11 @@ ### Various APIs for extracting information from sys.version _sys_version_parser = re.compile( - r'([\w.+]+)\s*' - '\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*' - '\[([^\]]+)\]?', re.ASCII) + r'([\w.+]+)\s*' # "version" + r'\(#?([^,]+)' # "(#buildno" + r'(?:,\s*([\w ]*)' # ", builddate" + r'(?:,\s*([\w :]*))?)?\)\s*' # ", buildtime)" + r'\[([^\]]+)\]?', re.ASCII) # "[compiler]" _ironpython_sys_version_parser = re.compile( r'IronPython\s*' @@ -1227,6 +1229,8 @@ 'failed to parse Jython sys.version: %s' % repr(sys_version)) version, buildno, builddate, buildtime, _ = match.groups() + if builddate is None: + builddate = '' compiler = sys.platform elif "PyPy" in sys_version: @@ -1249,7 +1253,10 @@ version, buildno, builddate, buildtime, compiler = \ match.groups() name = 'CPython' - builddate = builddate + ' ' + buildtime + if builddate is None: + builddate = '' + elif buildtime: + builddate = builddate + ' ' + buildtime if hasattr(sys, '_mercurial'): _, branch, revision = sys._mercurial diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -76,6 +76,22 @@ ('IronPython', '1.0.60816', '', '', '', '', '.NET 2.0.50727.42')), ('IronPython 1.0 (1.0.61005.1977) on .NET 2.0.50727.42', ('IronPython', '1.0.0', '', '', '', '', '.NET 2.0.50727.42')), + ('2.4.3 (truncation, date, t) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', 'date t', 'GCC')), + ('2.4.3 (truncation, date, ) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', 'date', 'GCC')), + ('2.4.3 (truncation, date,) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', 'date', 'GCC')), + ('2.4.3 (truncation, date) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', 'date', 'GCC')), + ('2.4.3 (truncation, d) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', 'd', 'GCC')), + ('2.4.3 (truncation, ) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', '', 'GCC')), + ('2.4.3 (truncation,) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', '', 'GCC')), + ('2.4.3 (truncation) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', '', 'GCC')), ): # branch and revision are not "parsed", but fetched # from sys._mercurial. Ignore them diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,9 @@ Library ------- +- Issue #21313: Fix the "platform" module to tolerate when sys.version + contains truncated build information. + - Issue #26839: On Linux, :func:`os.urandom` now calls ``getrandom()`` with ``GRND_NONBLOCK`` to fall back on reading ``/dev/urandom`` if the urandom entropy pool is not initialized yet. Patch written by Colm Buckley. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 05:50:56 2016 From: python-checkins at python.org (martin.panter) Date: Wed, 08 Jun 2016 09:50:56 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI1NzM4?= =?utf-8?q?=3A_Don=E2=80=99t_send_message_body_for_205_Reset_Content?= Message-ID: <20160608095045.11922.34032.7555CB66@psf.io> https://hg.python.org/cpython/rev/1dc495007b8f changeset: 101786:1dc495007b8f branch: 3.5 user: Martin Panter date: Wed Jun 08 08:29:13 2016 +0000 summary: Issue #25738: Don?t send message body for 205 Reset Content Patch by Susumu Koshiba. files: Doc/library/http.server.rst | 4 +- Lib/http/server.py | 30 ++++++++++----- Lib/test/test_httpservers.py | 44 ++++++++++++++++++++++++ Misc/ACKS | 1 + Misc/NEWS | 5 ++ 5 files changed, 73 insertions(+), 11 deletions(-) diff --git a/Doc/library/http.server.rst b/Doc/library/http.server.rst --- a/Doc/library/http.server.rst +++ b/Doc/library/http.server.rst @@ -191,7 +191,9 @@ a complete set of headers, as the response body. The :attr:`responses` attribute holds the default values for *message* and *explain* that will be used if no value is provided; for unknown codes the default value - for both is the string ``???``. + for both is the string ``???``. The body will be empty if the method is + HEAD or the response code is one of the following: ``1xx``, + ``204 No Content``, ``205 Reset Content``, ``304 Not Modified``. .. versionchanged:: 3.4 The error response includes a Content-Length header. diff --git a/Lib/http/server.py b/Lib/http/server.py --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -450,20 +450,30 @@ if explain is None: explain = longmsg self.log_error("code %d, message %s", code, message) - # using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201) - content = (self.error_message_format % - {'code': code, 'message': _quote_html(message), 'explain': _quote_html(explain)}) - body = content.encode('UTF-8', 'replace') self.send_response(code, message) - self.send_header("Content-Type", self.error_content_type) self.send_header('Connection', 'close') - self.send_header('Content-Length', int(len(body))) + + # Message body is omitted for cases described in: + # - RFC7230: 3.3. 1xx, 204(No Content), 304(Not Modified) + # - RFC7231: 6.3.6. 205(Reset Content) + body = None + if (code >= 200 and + code not in (HTTPStatus.NO_CONTENT, + HTTPStatus.RESET_CONTENT, + HTTPStatus.NOT_MODIFIED)): + # HTML encode to prevent Cross Site Scripting attacks + # (see bug #1100201) + content = (self.error_message_format % { + 'code': code, + 'message': _quote_html(message), + 'explain': _quote_html(explain) + }) + body = content.encode('UTF-8', 'replace') + self.send_header("Content-Type", self.error_content_type) + self.send_header('Content-Length', int(len(body))) self.end_headers() - if (self.command != 'HEAD' and - code >= 200 and - code not in ( - HTTPStatus.NO_CONTENT, HTTPStatus.NOT_MODIFIED)): + if self.command != 'HEAD' and body: self.wfile.write(body) def send_response(self, code, message=None): diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -115,6 +115,12 @@ body = self.headers['x-special-incoming'].encode('utf-8') self.wfile.write(body) + def do_SEND_ERROR(self): + self.send_error(int(self.path[1:])) + + def do_HEAD(self): + self.send_error(int(self.path[1:])) + def setUp(self): BaseTestCase.setUp(self) self.con = http.client.HTTPConnection(self.HOST, self.PORT) @@ -236,6 +242,44 @@ data = res.read() self.assertEqual(int(res.getheader('Content-Length')), len(data)) + def test_send_error(self): + allow_transfer_encoding_codes = (HTTPStatus.NOT_MODIFIED, + HTTPStatus.RESET_CONTENT) + for code in (HTTPStatus.NO_CONTENT, HTTPStatus.NOT_MODIFIED, + HTTPStatus.PROCESSING, HTTPStatus.RESET_CONTENT, + HTTPStatus.SWITCHING_PROTOCOLS): + self.con.request('SEND_ERROR', '/{}'.format(code)) + res = self.con.getresponse() + self.assertEqual(code, res.status) + self.assertEqual(None, res.getheader('Content-Length')) + self.assertEqual(None, res.getheader('Content-Type')) + if code not in allow_transfer_encoding_codes: + self.assertEqual(None, res.getheader('Transfer-Encoding')) + + data = res.read() + self.assertEqual(b'', data) + + def test_head_via_send_error(self): + allow_transfer_encoding_codes = (HTTPStatus.NOT_MODIFIED, + HTTPStatus.RESET_CONTENT) + for code in (HTTPStatus.OK, HTTPStatus.NO_CONTENT, + HTTPStatus.NOT_MODIFIED, HTTPStatus.RESET_CONTENT, + HTTPStatus.SWITCHING_PROTOCOLS): + self.con.request('HEAD', '/{}'.format(code)) + res = self.con.getresponse() + self.assertEqual(code, res.status) + if code == HTTPStatus.OK: + self.assertTrue(int(res.getheader('Content-Length')) > 0) + self.assertIn('text/html', res.getheader('Content-Type')) + else: + self.assertEqual(None, res.getheader('Content-Length')) + self.assertEqual(None, res.getheader('Content-Type')) + if code not in allow_transfer_encoding_codes: + self.assertEqual(None, res.getheader('Transfer-Encoding')) + + data = res.read() + self.assertEqual(b'', data) + class RequestHandlerLoggingTestCase(BaseTestCase): class request_handler(BaseHTTPRequestHandler): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -781,6 +781,7 @@ Peter A. Koren ???? ????????? Vlad Korolev +Susumu Koshiba Joseph Koshy Daniel Kozan Jerzy Kozera diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -131,6 +131,11 @@ Library ------- +- Issue #25738: Stop http.server.BaseHTTPRequestHandler.send_error() from + sending a message body for 205 Reset Content. Also, don't send Content + header fields in responses that don't have a body. Patch by Susumu + Koshiba. + - Issue #21313: Fix the "platform" module to tolerate when sys.version contains truncated build information. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 06:43:15 2016 From: python-checkins at python.org (xavier.degaye) Date: Wed, 08 Jun 2016 10:43:15 +0000 Subject: [Python-checkins] =?utf-8?q?test=3A_Verifying_commit_access=2E?= Message-ID: <20160608104313.1563.43668.4B664128@psf.io> https://hg.python.org/test/rev/a3208053a209 changeset: 232:a3208053a209 user: Xavier de Gaye date: Wed Jun 08 12:38:08 2016 +0200 summary: Verifying commit access. files: a | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/a b/a --- a/a +++ b/a @@ -10,3 +10,4 @@ snthdiueoa (obviously it should have gone this direction the first time) spam eggs 42 +hello there -- Repository URL: https://hg.python.org/test From python-checkins at python.org Wed Jun 8 07:57:34 2016 From: python-checkins at python.org (berker.peksag) Date: Wed, 08 Jun 2016 11:57:34 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2321593=3A_Merge_from_3=2E5?= Message-ID: <20160608115732.83355.49021.FCB8710B@psf.io> https://hg.python.org/cpython/rev/243b95782059 changeset: 101791:243b95782059 parent: 101789:de5e1eb4a88d parent: 101790:48bb48e7499d user: Berker Peksag date: Wed Jun 08 14:57:24 2016 +0300 summary: Issue #21593: Merge from 3.5 files: Doc/library/re.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/re.rst b/Doc/library/re.rst --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -811,8 +811,8 @@ .. method:: regex.search(string[, pos[, endpos]]) - Scan through *string* looking for a location where this regular expression - produces a match, and return a corresponding :ref:`match object + Scan through *string* looking for the first location where this regular + expression produces a match, and return a corresponding :ref:`match object `. Return ``None`` if no position in the string matches the pattern; note that this is different from finding a zero-length match at some point in the string. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 07:57:35 2016 From: python-checkins at python.org (berker.peksag) Date: Wed, 08 Jun 2016 11:57:35 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIxNTkz?= =?utf-8?q?=3A_Clarify_that_re=2Esearch=28=29_returns_the_first_match?= Message-ID: <20160608115732.19147.19210.63D38A8A@psf.io> https://hg.python.org/cpython/rev/48bb48e7499d changeset: 101790:48bb48e7499d branch: 3.5 parent: 101786:1dc495007b8f user: Berker Peksag date: Wed Jun 08 14:56:56 2016 +0300 summary: Issue #21593: Clarify that re.search() returns the first match files: Doc/library/re.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/re.rst b/Doc/library/re.rst --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -811,8 +811,8 @@ .. method:: regex.search(string[, pos[, endpos]]) - Scan through *string* looking for a location where this regular expression - produces a match, and return a corresponding :ref:`match object + Scan through *string* looking for the first location where this regular + expression produces a match, and return a corresponding :ref:`match object `. Return ``None`` if no position in the string matches the pattern; note that this is different from finding a zero-length match at some point in the string. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 09:36:19 2016 From: python-checkins at python.org (martin.panter) Date: Wed, 08 Jun 2016 13:36:19 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5=3B_no_changes_to_3=2E6?= Message-ID: <20160608133613.26461.5692.BC03ADB8@psf.io> https://hg.python.org/cpython/rev/e04daecf4992 changeset: 101793:e04daecf4992 parent: 101791:243b95782059 parent: 101792:39a72018dd76 user: Martin Panter date: Wed Jun 08 12:45:30 2016 +0000 summary: Merge from 3.5; no changes to 3.6 files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 09:36:19 2016 From: python-checkins at python.org (martin.panter) Date: Wed, 08 Jun 2016 13:36:19 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIzMjc1?= =?utf-8?q?=3A_Backport_target_list_assignment_documentation_fixes?= Message-ID: <20160608133613.26509.76354.E65467D6@psf.io> https://hg.python.org/cpython/rev/39a72018dd76 changeset: 101792:39a72018dd76 branch: 3.5 parent: 101790:48bb48e7499d user: Martin Panter date: Wed Jun 08 12:44:30 2016 +0000 summary: Issue #23275: Backport target list assignment documentation fixes files: Doc/reference/simple_stmts.rst | 29 ++++++++++----------- 1 files changed, 14 insertions(+), 15 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 @@ -85,7 +85,7 @@ target_list: `target` ("," `target`)* [","] target: `identifier` : | "(" `target_list` ")" - : | "[" `target_list` "]" + : | "[" [`target_list`] "]" : | `attributeref` : | `subscription` : | `slicing` @@ -115,21 +115,25 @@ Assignment of an object to a target list, optionally enclosed in parentheses or square brackets, is recursively defined as follows. -* If the target list is a single target: The object is assigned to that target. +* If the target list is empty: The object must also be an empty iterable. -* If the target list is a comma-separated list of targets: The object must be an - iterable with the same number of items as there are targets in the target list, - and the items are assigned, from left to right, to the corresponding targets. +* If the target list is a single target in parentheses: The object is assigned + to that target. + +* If the target list is a comma-separated list of targets, or a single target + in square brackets: The object must be an iterable with the same number of + items as there are targets in the target list, and the items are assigned, + from left to right, to the corresponding targets. * If the target list contains one target prefixed with an asterisk, called a - "starred" target: The object must be a sequence with at least as many items + "starred" target: The object must be an iterable with at least as many items as there are targets in the target list, minus one. The first items of the - sequence are assigned, from left to right, to the targets before the starred - target. The final items of the sequence are assigned to the targets after - the starred target. A list of the remaining items in the sequence is then + iterable are assigned, from left to right, to the targets before the starred + target. The final items of the iterable are assigned to the targets after + the starred target. A list of the remaining items in the iterable is then assigned to the starred target (the list can be empty). - * Else: The object must be a sequence with the same number of items as there + * Else: The object must be an iterable with the same number of items as there are targets in the target list, and the items are assigned, from left to right, to the corresponding targets. @@ -150,11 +154,6 @@ count for the object previously bound to the name to reach zero, causing the object to be deallocated and its destructor (if it has one) to be called. -* If the target is a target list enclosed in parentheses or in square brackets: - The object must be an iterable with the same number of items as there are - targets in the target list, and its items are assigned, from left to right, - to the corresponding targets. - .. index:: pair: attribute; assignment * If the target is an attribute reference: The primary expression in the -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 09:36:19 2016 From: python-checkins at python.org (martin.panter) Date: Wed, 08 Jun 2016 13:36:19 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzIzMjc1?= =?utf-8?q?=3A_Backport_empty_square_bracket_assignment_documentation_fix?= Message-ID: <20160608133613.39458.78203.8FE63A27@psf.io> https://hg.python.org/cpython/rev/8700f4d09b28 changeset: 101794:8700f4d09b28 branch: 2.7 parent: 101787:b1041ddb1391 user: Martin Panter date: Wed Jun 08 12:44:30 2016 +0000 summary: Issue #23275: Backport empty square bracket assignment documentation fix files: Doc/reference/simple_stmts.rst | 2 +- 1 files changed, 1 insertions(+), 1 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 @@ -87,7 +87,7 @@ target_list: `target` ("," `target`)* [","] target: `identifier` : | "(" `target_list` ")" - : | "[" `target_list` "]" + : | "[" [`target_list`] "]" : | `attributeref` : | `subscription` : | `slicing` -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 09:36:24 2016 From: python-checkins at python.org (martin.panter) Date: Wed, 08 Jun 2016 13:36:24 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fix_RST_conflicts_with_Idl?= =?utf-8?q?e_news_entries?= Message-ID: <20160608133614.3687.1250.E3511B2E@psf.io> https://hg.python.org/cpython/rev/2fcfa9badfcd changeset: 101795:2fcfa9badfcd parent: 101793:e04daecf4992 user: Martin Panter date: Wed Jun 08 13:32:49 2016 +0000 summary: Fix RST conflicts with Idle news entries files: Doc/tools/susp-ignored.csv | 1 + Misc/NEWS | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Doc/tools/susp-ignored.csv b/Doc/tools/susp-ignored.csv --- a/Doc/tools/susp-ignored.csv +++ b/Doc/tools/susp-ignored.csv @@ -272,6 +272,7 @@ whatsnew/3.2,,:gz,">>> with tarfile.open(name='myarchive.tar.gz', mode='w:gz') as tf:" whatsnew/3.2,,:location,zope9-location = ${zope9:location} whatsnew/3.2,,:prefix,zope-conf = ${custom:prefix}/etc/zope.conf +whatsnew/changelog,,:version,import sys; I = version[:version.index(' ')] whatsnew/changelog,,:gz,": TarFile opened with external fileobj and ""w:gz"" mode didn't" whatsnew/changelog,,::,": Use ""127.0.0.1"" or ""::1"" instead of ""localhost"" as much as" library/tarfile,149,:xz,'x:xz' diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -113,22 +113,22 @@ - Issue #20567: Revise idle_test/README.txt with advice about avoiding tk warning messages from tests. Apply advice to several IDLE tests. -- Issue # 24225: Update idlelib/README.txt with new file names +- Issue #24225: Update idlelib/README.txt with new file names and event handlers. - Issue #27156: Remove obsolete code not used by IDLE. Replacements: 1. help.txt, replaced by help.html, is out-of-date and should not be used. Its dedicated viewer has be replaced by the html viewer in help.py. - 2. 'import idlever; I = idlever.IDLE_VERSION' is the same as - 'import sys; I = version[:version.index(' ')]' - 3. After 'ob = stackviewer.VariablesTreeItem(*args)', - 'ob.keys()' == 'list(ob.object.keys). + 2. ?`import idlever; I = idlever.IDLE_VERSION`? is the same as + ?`import sys; I = version[:version.index(' ')]`? + 3. After ?`ob = stackviewer.VariablesTreeItem(*args)`?, + ?`ob.keys() == list(ob.object.keys)`?. 4. In macosc, runningAsOSXAPP == isAquaTk; idCarbonAquaTk == isCarbonTk - Issue #27117: Make colorizer htest and turtledemo work with dark themes. Move code for configuring text widget colors to a new function. -- Issue #24225: Rename many idlelib/*.py and idle_test/test_*.py files. +- Issue #24225: Rename many `idlelib/*.py` and `idle_test/test_*.py` files. Edit files to replace old names with new names when the old name referred to the module rather than the class it contained. See the issue and IDLE section in What's New in 3.6 for more. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 10:44:04 2016 From: python-checkins at python.org (barry.warsaw) Date: Wed, 08 Jun 2016 14:44:04 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Clarify_dunders=2E?= Message-ID: <20160608144356.32904.90371.CA8AF6ED@psf.io> https://hg.python.org/peps/rev/c451868df657 changeset: 6357:c451868df657 user: Barry Warsaw date: Wed Jun 08 10:43:53 2016 -0400 summary: Clarify dunders. files: pep-0008.txt | 29 ++++++++++++++++++++++++----- 1 files changed, 24 insertions(+), 5 deletions(-) diff --git a/pep-0008.txt b/pep-0008.txt --- a/pep-0008.txt +++ b/pep-0008.txt @@ -413,12 +413,31 @@ public and internal interfaces still apply. -Dunder Variables ----------------- +Module level dunder names +------------------------- -All relevant dunder variables (e.g. ``__all__``, ``__author__``, -``__version__``, etc) should be placed after the module docstring and -before any imports, separated by a blank line above and below. +Module level "dunders" (i.e. names with two leading and two trailing +underscores) such as ``__all__``, ``__author__``, ``__version__``, +etc. should be placed after the module docstring but before any import +statements *except* ``from __future__`` imports. Python mandates that +future-imports must appear in the module before any other code except +docstrings. + +For example:: + + """This is the example module. + + This module does stuff. + """ + + from __future__ import barry_as_FLUFL + + __all__ = ['a', 'b', 'c'] + __version__ = '0.1' + __author__ = 'Cardinal Biggles' + + import os + import sys String Quotes -- Repository URL: https://hg.python.org/peps From lp_benchmark_robot at intel.com Wed Jun 8 11:34:36 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 8 Jun 2016 16:34:36 +0100 Subject: [Python-checkins] BAD Benchmark Results for Python Default 2016-06-08 Message-ID: <0cd1bd08-4900-4e4c-a6c6-d946f58b8c30@irsmsx101.ger.corp.intel.com> Results for project Python default, build date 2016-06-08 02:02:15 +0000 commit: 12d939477b4f previous commit: b7a4c076ba40 revision date: 2016-06-07 20:20:39 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.20% -0.47% 12.44% 13.26% :-| pybench 0.09% -0.12% 1.53% 7.47% :-( regex_v8 2.61% -1.01% -3.69% 4.33% :-| nbody 0.11% 0.79% 1.60% 5.81% :-| json_dump_v2 0.33% 0.69% -0.42% 12.25% :-| normal_startup 1.03% -0.42% -0.33% 5.53% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/bad-benchmark-results-for-python-default-2016-06-08/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Wed Jun 8 12:34:10 2016 From: python-checkins at python.org (yury.selivanov) Date: Wed, 08 Jun 2016 16:34:10 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy41IChpc3N1ZSAjMjcxMzYsIGFzeW5jaW8p?= Message-ID: <20160608163403.3509.80845.EC33397E@psf.io> https://hg.python.org/cpython/rev/e46b23b6a068 changeset: 101797:e46b23b6a068 parent: 101795:2fcfa9badfcd parent: 101796:3f49e89be8a9 user: Yury Selivanov date: Wed Jun 08 12:33:59 2016 -0400 summary: Merge 3.5 (issue #27136, asyncio) files: Lib/asyncio/base_events.py | 116 ++++----- Lib/asyncio/proactor_events.py | 9 +- Lib/asyncio/selector_events.py | 24 +- Lib/test/test_asyncio/test_base_events.py | 91 +++---- Lib/test/test_asyncio/test_events.py | 19 - Lib/test/test_asyncio/test_selector_events.py | 20 +- 6 files changed, 116 insertions(+), 163 deletions(-) diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -16,10 +16,8 @@ import collections import concurrent.futures -import functools import heapq import inspect -import ipaddress import itertools import logging import os @@ -86,12 +84,14 @@ _SOCKET_TYPE_MASK |= socket.SOCK_CLOEXEC - at functools.lru_cache(maxsize=1024, typed=True) def _ipaddr_info(host, port, family, type, proto): - # Try to skip getaddrinfo if "host" is already an IP. Since getaddrinfo - # blocks on an exclusive lock on some platforms, users might handle name - # resolution in their own code and pass in resolved IPs. - if proto not in {0, socket.IPPROTO_TCP, socket.IPPROTO_UDP} or host is None: + # Try to skip getaddrinfo if "host" is already an IP. Users might have + # handled name resolution in their own code and pass in resolved IPs. + if not hasattr(socket, 'inet_pton'): + return + + if proto not in {0, socket.IPPROTO_TCP, socket.IPPROTO_UDP} or \ + host is None: return None type &= ~_SOCKET_TYPE_MASK @@ -123,59 +123,42 @@ # Might be a service name like "http". port = socket.getservbyname(port) - if hasattr(socket, 'inet_pton'): - if family == socket.AF_UNSPEC: - afs = [socket.AF_INET, socket.AF_INET6] - else: - afs = [family] + if family == socket.AF_UNSPEC: + afs = [socket.AF_INET, socket.AF_INET6] + else: + afs = [family] - for af in afs: - # Linux's inet_pton doesn't accept an IPv6 zone index after host, - # like '::1%lo0', so strip it. If we happen to make an invalid - # address look valid, we fail later in sock.connect or sock.bind. - try: - if af == socket.AF_INET6: - socket.inet_pton(af, host.partition('%')[0]) - else: - socket.inet_pton(af, host) - return af, type, proto, '', (host, port) - except OSError: - pass - - # "host" is not an IP address. + if isinstance(host, bytes): + host = host.decode('idna') + if '%' in host: + # Linux's inet_pton doesn't accept an IPv6 zone index after host, + # like '::1%lo0'. return None - # No inet_pton. (On Windows it's only available since Python 3.4.) - # Even though getaddrinfo with AI_NUMERICHOST would be non-blocking, it - # still requires a lock on some platforms, and waiting for that lock could - # block the event loop. Use ipaddress instead, it's just text parsing. - try: - addr = ipaddress.IPv4Address(host) - except ValueError: + for af in afs: try: - addr = ipaddress.IPv6Address(host.partition('%')[0]) - except ValueError: - return None + socket.inet_pton(af, host) + # The host has already been resolved. + return af, type, proto, '', (host, port) + except OSError: + pass - af = socket.AF_INET if addr.version == 4 else socket.AF_INET6 - if family not in (socket.AF_UNSPEC, af): - # "host" is wrong IP version for "family". - return None + # "host" is not an IP address. + return None - return af, type, proto, '', (host, port) - -def _check_resolved_address(sock, address): - # Ensure that the address is already resolved to avoid the trap of hanging - # the entire event loop when the address requires doing a DNS lookup. - - if hasattr(socket, 'AF_UNIX') and sock.family == socket.AF_UNIX: - return - +def _ensure_resolved(address, *, family=0, type=socket.SOCK_STREAM, proto=0, + flags=0, loop): host, port = address[:2] - if _ipaddr_info(host, port, sock.family, sock.type, sock.proto) is None: - raise ValueError("address must be resolved (IP address)," - " got host %r" % host) + info = _ipaddr_info(host, port, family, type, proto) + if info is not None: + # "host" is already a resolved IP. + fut = loop.create_future() + fut.set_result([info]) + return fut + else: + return loop.getaddrinfo(host, port, family=family, type=type, + proto=proto, flags=flags) def _run_until_complete_cb(fut): @@ -603,12 +586,7 @@ def getaddrinfo(self, host, port, *, family=0, type=0, proto=0, flags=0): - info = _ipaddr_info(host, port, family, type, proto) - if info is not None: - fut = self.create_future() - fut.set_result([info]) - return fut - elif self._debug: + if self._debug: return self.run_in_executor(None, self._getaddrinfo_debug, host, port, family, type, proto, flags) else: @@ -657,14 +635,14 @@ raise ValueError( 'host/port and sock can not be specified at the same time') - f1 = self.getaddrinfo( - host, port, family=family, - type=socket.SOCK_STREAM, proto=proto, flags=flags) + f1 = _ensure_resolved((host, port), family=family, + type=socket.SOCK_STREAM, proto=proto, + flags=flags, loop=self) fs = [f1] if local_addr is not None: - f2 = self.getaddrinfo( - *local_addr, family=family, - type=socket.SOCK_STREAM, proto=proto, flags=flags) + f2 = _ensure_resolved(local_addr, family=family, + type=socket.SOCK_STREAM, proto=proto, + flags=flags, loop=self) fs.append(f2) else: f2 = None @@ -799,9 +777,9 @@ assert isinstance(addr, tuple) and len(addr) == 2, ( '2-tuple is expected') - infos = yield from self.getaddrinfo( - *addr, family=family, type=socket.SOCK_DGRAM, - proto=proto, flags=flags) + infos = yield from _ensure_resolved( + addr, family=family, type=socket.SOCK_DGRAM, + proto=proto, flags=flags, loop=self) if not infos: raise OSError('getaddrinfo() returned empty list') @@ -889,9 +867,9 @@ @coroutine def _create_server_getaddrinfo(self, host, port, family, flags): - infos = yield from self.getaddrinfo(host, port, family=family, + infos = yield from _ensure_resolved((host, port), family=family, type=socket.SOCK_STREAM, - flags=flags) + flags=flags, loop=self) if not infos: raise OSError('getaddrinfo({!r}) returned empty list'.format(host)) return infos diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py --- a/Lib/asyncio/proactor_events.py +++ b/Lib/asyncio/proactor_events.py @@ -441,14 +441,7 @@ return self._proactor.send(sock, data) def sock_connect(self, sock, address): - try: - base_events._check_resolved_address(sock, address) - except ValueError as err: - fut = self.create_future() - fut.set_exception(err) - return fut - else: - return self._proactor.connect(sock, address) + return self._proactor.connect(sock, address) def sock_accept(self, sock): return self._proactor.accept(sock) diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -385,24 +385,28 @@ def sock_connect(self, sock, address): """Connect to a remote socket at address. - The address must be already resolved to avoid the trap of hanging the - entire event loop when the address requires doing a DNS lookup. For - example, it must be an IP address, not a hostname, for AF_INET and - AF_INET6 address families. Use getaddrinfo() to resolve the hostname - asynchronously. - This method is a coroutine. """ if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") + fut = self.create_future() + if hasattr(socket, 'AF_UNIX') and sock.family == socket.AF_UNIX: + self._sock_connect(fut, sock, address) + else: + resolved = base_events._ensure_resolved(address, loop=self) + resolved.add_done_callback( + lambda resolved: self._on_resolved(fut, sock, resolved)) + + return fut + + def _on_resolved(self, fut, sock, resolved): try: - base_events._check_resolved_address(sock, address) - except ValueError as err: - fut.set_exception(err) + _, _, _, _, address = resolved.result()[0] + except Exception as exc: + fut.set_exception(exc) else: self._sock_connect(fut, sock, address) - return fut def _sock_connect(self, fut, sock, address): fd = sock.fileno() diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -45,6 +45,7 @@ m_socket.socket = mock.MagicMock() m_socket.socket.return_value = test_utils.mock_nonblocking_socket() + m_socket.getaddrinfo._is_coroutine = False return m_socket @@ -56,14 +57,6 @@ class BaseEventTests(test_utils.TestCase): - def setUp(self): - super().setUp() - base_events._ipaddr_info.cache_clear() - - def tearDown(self): - base_events._ipaddr_info.cache_clear() - super().tearDown() - def test_ipaddr_info(self): UNSPEC = socket.AF_UNSPEC INET = socket.AF_INET @@ -79,6 +72,10 @@ self.assertEqual( (INET, STREAM, TCP, '', ('1.2.3.4', 1)), + base_events._ipaddr_info(b'1.2.3.4', 1, INET, STREAM, TCP)) + + self.assertEqual( + (INET, STREAM, TCP, '', ('1.2.3.4', 1)), base_events._ipaddr_info('1.2.3.4', 1, UNSPEC, STREAM, TCP)) self.assertEqual( @@ -116,8 +113,7 @@ base_events._ipaddr_info('::3', 1, INET, STREAM, TCP)) # IPv6 address with zone index. - self.assertEqual( - (INET6, STREAM, TCP, '', ('::3%lo0', 1)), + self.assertIsNone( base_events._ipaddr_info('::3%lo0', 1, INET6, STREAM, TCP)) def test_port_parameter_types(self): @@ -169,31 +165,10 @@ @patch_socket def test_ipaddr_info_no_inet_pton(self, m_socket): del m_socket.inet_pton - self.test_ipaddr_info() - - def test_check_resolved_address(self): - sock = socket.socket(socket.AF_INET) - with sock: - base_events._check_resolved_address(sock, ('1.2.3.4', 1)) - - sock = socket.socket(socket.AF_INET6) - with sock: - base_events._check_resolved_address(sock, ('::3', 1)) - base_events._check_resolved_address(sock, ('::3%lo0', 1)) - with self.assertRaises(ValueError): - base_events._check_resolved_address(sock, ('foo', 1)) - - def test_check_resolved_sock_type(self): - # Ensure we ignore extra flags in sock.type. - if hasattr(socket, 'SOCK_NONBLOCK'): - sock = socket.socket(type=socket.SOCK_STREAM | socket.SOCK_NONBLOCK) - with sock: - base_events._check_resolved_address(sock, ('1.2.3.4', 1)) - - if hasattr(socket, 'SOCK_CLOEXEC'): - sock = socket.socket(type=socket.SOCK_STREAM | socket.SOCK_CLOEXEC) - with sock: - base_events._check_resolved_address(sock, ('1.2.3.4', 1)) + self.assertIsNone(base_events._ipaddr_info('1.2.3.4', 1, + socket.AF_INET, + socket.SOCK_STREAM, + socket.IPPROTO_TCP)) class BaseEventLoopTests(test_utils.TestCase): @@ -1042,11 +1017,6 @@ self.loop = asyncio.new_event_loop() self.set_event_loop(self.loop) - def tearDown(self): - # Clear mocked constants like AF_INET from the cache. - base_events._ipaddr_info.cache_clear() - super().tearDown() - @patch_socket def test_create_connection_multiple_errors(self, m_socket): @@ -1195,10 +1165,7 @@ if not allow_inet_pton: del m_socket.inet_pton - def getaddrinfo(*args, **kw): - self.fail('should not have called getaddrinfo') - - m_socket.getaddrinfo = getaddrinfo + m_socket.getaddrinfo = socket.getaddrinfo sock = m_socket.socket.return_value self.loop.add_reader = mock.Mock() @@ -1210,9 +1177,9 @@ t, p = self.loop.run_until_complete(coro) try: sock.connect.assert_called_with(('1.2.3.4', 80)) - m_socket.socket.assert_called_with(family=m_socket.AF_INET, - proto=m_socket.IPPROTO_TCP, - type=m_socket.SOCK_STREAM) + _, kwargs = m_socket.socket.call_args + self.assertEqual(kwargs['family'], m_socket.AF_INET) + self.assertEqual(kwargs['type'], m_socket.SOCK_STREAM) finally: t.close() test_utils.run_briefly(self.loop) # allow transport to close @@ -1221,10 +1188,15 @@ coro = self.loop.create_connection(asyncio.Protocol, '::2', 80) t, p = self.loop.run_until_complete(coro) try: - sock.connect.assert_called_with(('::2', 80)) - m_socket.socket.assert_called_with(family=m_socket.AF_INET6, - proto=m_socket.IPPROTO_TCP, - type=m_socket.SOCK_STREAM) + # Without inet_pton we use getaddrinfo, which transforms ('::2', 80) + # to ('::0.0.0.2', 80, 0, 0). The last 0s are flow info, scope id. + [address] = sock.connect.call_args[0] + host, port = address[:2] + self.assertRegex(host, r'::(0\.)*2') + self.assertEqual(port, 80) + _, kwargs = m_socket.socket.call_args + self.assertEqual(kwargs['family'], m_socket.AF_INET6) + self.assertEqual(kwargs['type'], m_socket.SOCK_STREAM) finally: t.close() test_utils.run_briefly(self.loop) # allow transport to close @@ -1256,6 +1228,21 @@ self.assertRaises( OSError, self.loop.run_until_complete, coro) + @patch_socket + def test_create_connection_bluetooth(self, m_socket): + # See http://bugs.python.org/issue27136, fallback to getaddrinfo when + # we can't recognize an address is resolved, e.g. a Bluetooth address. + addr = ('00:01:02:03:04:05', 1) + + def getaddrinfo(host, port, *args, **kw): + assert (host, port) == addr + return [(999, 1, 999, '', (addr, 1))] + + m_socket.getaddrinfo = getaddrinfo + sock = m_socket.socket() + coro = self.loop.sock_connect(sock, addr) + self.loop.run_until_complete(coro) + def test_create_connection_ssl_server_hostname_default(self): self.loop.getaddrinfo = mock.Mock() @@ -1369,7 +1356,7 @@ getaddrinfo = self.loop.getaddrinfo = mock.Mock() getaddrinfo.return_value = [] - f = self.loop.create_server(MyProto, '0.0.0.0', 0) + f = self.loop.create_server(MyProto, 'python.org', 0) self.assertRaises(OSError, self.loop.run_until_complete, f) @patch_socket diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -1610,25 +1610,6 @@ {'clock_resolution': self.loop._clock_resolution, 'selector': self.loop._selector.__class__.__name__}) - def test_sock_connect_address(self): - addresses = [(socket.AF_INET, ('www.python.org', 80))] - if support.IPV6_ENABLED: - addresses.extend(( - (socket.AF_INET6, ('www.python.org', 80)), - (socket.AF_INET6, ('www.python.org', 80, 0, 0)), - )) - - for family, address in addresses: - for sock_type in (socket.SOCK_STREAM, socket.SOCK_DGRAM): - sock = socket.socket(family, sock_type) - with sock: - sock.setblocking(False) - connect = self.loop.sock_connect(sock, address) - with self.assertRaises(ValueError) as cm: - self.loop.run_until_complete(connect) - self.assertIn('address must be resolved', - str(cm.exception)) - def test_remove_fds_after_closing(self): loop = self.create_event_loop() callback = lambda: None diff --git a/Lib/test/test_asyncio/test_selector_events.py b/Lib/test/test_asyncio/test_selector_events.py --- a/Lib/test/test_asyncio/test_selector_events.py +++ b/Lib/test/test_asyncio/test_selector_events.py @@ -343,9 +343,11 @@ f = self.loop.sock_connect(sock, ('127.0.0.1', 8080)) self.assertIsInstance(f, asyncio.Future) - self.assertEqual( - (f, sock, ('127.0.0.1', 8080)), - self.loop._sock_connect.call_args[0]) + self.loop._run_once() + future_in, sock_in, address_in = self.loop._sock_connect.call_args[0] + self.assertEqual(future_in, f) + self.assertEqual(sock_in, sock) + self.assertEqual(address_in, ('127.0.0.1', 8080)) def test_sock_connect_timeout(self): # asyncio issue #205: sock_connect() must unregister the socket on @@ -359,6 +361,7 @@ # first call to sock_connect() registers the socket fut = self.loop.sock_connect(sock, ('127.0.0.1', 80)) + self.loop._run_once() self.assertTrue(sock.connect.called) self.assertTrue(self.loop.add_writer.called) self.assertEqual(len(fut._callbacks), 1) @@ -376,7 +379,10 @@ sock = mock.Mock() sock.fileno.return_value = 10 - self.loop._sock_connect(f, sock, ('127.0.0.1', 8080)) + resolved = self.loop.create_future() + resolved.set_result([(socket.AF_INET, socket.SOCK_STREAM, + socket.IPPROTO_TCP, '', ('127.0.0.1', 8080))]) + self.loop._sock_connect(f, sock, resolved) self.assertTrue(f.done()) self.assertIsNone(f.result()) self.assertTrue(sock.connect.called) @@ -402,9 +408,13 @@ sock.connect.side_effect = BlockingIOError sock.getsockopt.return_value = 0 address = ('127.0.0.1', 8080) + resolved = self.loop.create_future() + resolved.set_result([(socket.AF_INET, socket.SOCK_STREAM, + socket.IPPROTO_TCP, '', address)]) f = asyncio.Future(loop=self.loop) - self.loop._sock_connect(f, sock, address) + self.loop._sock_connect(f, sock, resolved) + self.loop._run_once() self.assertTrue(self.loop.add_writer.called) self.assertEqual(10, self.loop.add_writer.call_args[0][0]) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 12:34:15 2016 From: python-checkins at python.org (yury.selivanov) Date: Wed, 08 Jun 2016 16:34:15 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MTM2?= =?utf-8?q?=3A_Fix_DNS_static_resolution=3B_don=27t_use_it_in_getaddrinfo?= Message-ID: <20160608163403.83498.75381.3956512B@psf.io> https://hg.python.org/cpython/rev/3f49e89be8a9 changeset: 101796:3f49e89be8a9 branch: 3.5 parent: 101792:39a72018dd76 user: Yury Selivanov date: Wed Jun 08 12:33:31 2016 -0400 summary: Issue #27136: Fix DNS static resolution; don't use it in getaddrinfo Patch by A. Jesse Jiryu Davis files: Lib/asyncio/base_events.py | 116 ++++----- Lib/asyncio/proactor_events.py | 9 +- Lib/asyncio/selector_events.py | 24 +- Lib/test/test_asyncio/test_base_events.py | 91 +++---- Lib/test/test_asyncio/test_events.py | 19 - Lib/test/test_asyncio/test_selector_events.py | 20 +- 6 files changed, 116 insertions(+), 163 deletions(-) diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py --- a/Lib/asyncio/base_events.py +++ b/Lib/asyncio/base_events.py @@ -16,10 +16,8 @@ import collections import concurrent.futures -import functools import heapq import inspect -import ipaddress import itertools import logging import os @@ -86,12 +84,14 @@ _SOCKET_TYPE_MASK |= socket.SOCK_CLOEXEC - at functools.lru_cache(maxsize=1024, typed=True) def _ipaddr_info(host, port, family, type, proto): - # Try to skip getaddrinfo if "host" is already an IP. Since getaddrinfo - # blocks on an exclusive lock on some platforms, users might handle name - # resolution in their own code and pass in resolved IPs. - if proto not in {0, socket.IPPROTO_TCP, socket.IPPROTO_UDP} or host is None: + # Try to skip getaddrinfo if "host" is already an IP. Users might have + # handled name resolution in their own code and pass in resolved IPs. + if not hasattr(socket, 'inet_pton'): + return + + if proto not in {0, socket.IPPROTO_TCP, socket.IPPROTO_UDP} or \ + host is None: return None type &= ~_SOCKET_TYPE_MASK @@ -123,59 +123,42 @@ # Might be a service name like "http". port = socket.getservbyname(port) - if hasattr(socket, 'inet_pton'): - if family == socket.AF_UNSPEC: - afs = [socket.AF_INET, socket.AF_INET6] - else: - afs = [family] + if family == socket.AF_UNSPEC: + afs = [socket.AF_INET, socket.AF_INET6] + else: + afs = [family] - for af in afs: - # Linux's inet_pton doesn't accept an IPv6 zone index after host, - # like '::1%lo0', so strip it. If we happen to make an invalid - # address look valid, we fail later in sock.connect or sock.bind. - try: - if af == socket.AF_INET6: - socket.inet_pton(af, host.partition('%')[0]) - else: - socket.inet_pton(af, host) - return af, type, proto, '', (host, port) - except OSError: - pass - - # "host" is not an IP address. + if isinstance(host, bytes): + host = host.decode('idna') + if '%' in host: + # Linux's inet_pton doesn't accept an IPv6 zone index after host, + # like '::1%lo0'. return None - # No inet_pton. (On Windows it's only available since Python 3.4.) - # Even though getaddrinfo with AI_NUMERICHOST would be non-blocking, it - # still requires a lock on some platforms, and waiting for that lock could - # block the event loop. Use ipaddress instead, it's just text parsing. - try: - addr = ipaddress.IPv4Address(host) - except ValueError: + for af in afs: try: - addr = ipaddress.IPv6Address(host.partition('%')[0]) - except ValueError: - return None + socket.inet_pton(af, host) + # The host has already been resolved. + return af, type, proto, '', (host, port) + except OSError: + pass - af = socket.AF_INET if addr.version == 4 else socket.AF_INET6 - if family not in (socket.AF_UNSPEC, af): - # "host" is wrong IP version for "family". - return None + # "host" is not an IP address. + return None - return af, type, proto, '', (host, port) - -def _check_resolved_address(sock, address): - # Ensure that the address is already resolved to avoid the trap of hanging - # the entire event loop when the address requires doing a DNS lookup. - - if hasattr(socket, 'AF_UNIX') and sock.family == socket.AF_UNIX: - return - +def _ensure_resolved(address, *, family=0, type=socket.SOCK_STREAM, proto=0, + flags=0, loop): host, port = address[:2] - if _ipaddr_info(host, port, sock.family, sock.type, sock.proto) is None: - raise ValueError("address must be resolved (IP address)," - " got host %r" % host) + info = _ipaddr_info(host, port, family, type, proto) + if info is not None: + # "host" is already a resolved IP. + fut = loop.create_future() + fut.set_result([info]) + return fut + else: + return loop.getaddrinfo(host, port, family=family, type=type, + proto=proto, flags=flags) def _run_until_complete_cb(fut): @@ -602,12 +585,7 @@ def getaddrinfo(self, host, port, *, family=0, type=0, proto=0, flags=0): - info = _ipaddr_info(host, port, family, type, proto) - if info is not None: - fut = self.create_future() - fut.set_result([info]) - return fut - elif self._debug: + if self._debug: return self.run_in_executor(None, self._getaddrinfo_debug, host, port, family, type, proto, flags) else: @@ -656,14 +634,14 @@ raise ValueError( 'host/port and sock can not be specified at the same time') - f1 = self.getaddrinfo( - host, port, family=family, - type=socket.SOCK_STREAM, proto=proto, flags=flags) + f1 = _ensure_resolved((host, port), family=family, + type=socket.SOCK_STREAM, proto=proto, + flags=flags, loop=self) fs = [f1] if local_addr is not None: - f2 = self.getaddrinfo( - *local_addr, family=family, - type=socket.SOCK_STREAM, proto=proto, flags=flags) + f2 = _ensure_resolved(local_addr, family=family, + type=socket.SOCK_STREAM, proto=proto, + flags=flags, loop=self) fs.append(f2) else: f2 = None @@ -798,9 +776,9 @@ assert isinstance(addr, tuple) and len(addr) == 2, ( '2-tuple is expected') - infos = yield from self.getaddrinfo( - *addr, family=family, type=socket.SOCK_DGRAM, - proto=proto, flags=flags) + infos = yield from _ensure_resolved( + addr, family=family, type=socket.SOCK_DGRAM, + proto=proto, flags=flags, loop=self) if not infos: raise OSError('getaddrinfo() returned empty list') @@ -888,9 +866,9 @@ @coroutine def _create_server_getaddrinfo(self, host, port, family, flags): - infos = yield from self.getaddrinfo(host, port, family=family, + infos = yield from _ensure_resolved((host, port), family=family, type=socket.SOCK_STREAM, - flags=flags) + flags=flags, loop=self) if not infos: raise OSError('getaddrinfo({!r}) returned empty list'.format(host)) return infos diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py --- a/Lib/asyncio/proactor_events.py +++ b/Lib/asyncio/proactor_events.py @@ -440,14 +440,7 @@ return self._proactor.send(sock, data) def sock_connect(self, sock, address): - try: - base_events._check_resolved_address(sock, address) - except ValueError as err: - fut = self.create_future() - fut.set_exception(err) - return fut - else: - return self._proactor.connect(sock, address) + return self._proactor.connect(sock, address) def sock_accept(self, sock): return self._proactor.accept(sock) diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -385,24 +385,28 @@ def sock_connect(self, sock, address): """Connect to a remote socket at address. - The address must be already resolved to avoid the trap of hanging the - entire event loop when the address requires doing a DNS lookup. For - example, it must be an IP address, not a hostname, for AF_INET and - AF_INET6 address families. Use getaddrinfo() to resolve the hostname - asynchronously. - This method is a coroutine. """ if self._debug and sock.gettimeout() != 0: raise ValueError("the socket must be non-blocking") + fut = self.create_future() + if hasattr(socket, 'AF_UNIX') and sock.family == socket.AF_UNIX: + self._sock_connect(fut, sock, address) + else: + resolved = base_events._ensure_resolved(address, loop=self) + resolved.add_done_callback( + lambda resolved: self._on_resolved(fut, sock, resolved)) + + return fut + + def _on_resolved(self, fut, sock, resolved): try: - base_events._check_resolved_address(sock, address) - except ValueError as err: - fut.set_exception(err) + _, _, _, _, address = resolved.result()[0] + except Exception as exc: + fut.set_exception(exc) else: self._sock_connect(fut, sock, address) - return fut def _sock_connect(self, fut, sock, address): fd = sock.fileno() diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -45,6 +45,7 @@ m_socket.socket = mock.MagicMock() m_socket.socket.return_value = test_utils.mock_nonblocking_socket() + m_socket.getaddrinfo._is_coroutine = False return m_socket @@ -56,14 +57,6 @@ class BaseEventTests(test_utils.TestCase): - def setUp(self): - super().setUp() - base_events._ipaddr_info.cache_clear() - - def tearDown(self): - base_events._ipaddr_info.cache_clear() - super().tearDown() - def test_ipaddr_info(self): UNSPEC = socket.AF_UNSPEC INET = socket.AF_INET @@ -79,6 +72,10 @@ self.assertEqual( (INET, STREAM, TCP, '', ('1.2.3.4', 1)), + base_events._ipaddr_info(b'1.2.3.4', 1, INET, STREAM, TCP)) + + self.assertEqual( + (INET, STREAM, TCP, '', ('1.2.3.4', 1)), base_events._ipaddr_info('1.2.3.4', 1, UNSPEC, STREAM, TCP)) self.assertEqual( @@ -116,8 +113,7 @@ base_events._ipaddr_info('::3', 1, INET, STREAM, TCP)) # IPv6 address with zone index. - self.assertEqual( - (INET6, STREAM, TCP, '', ('::3%lo0', 1)), + self.assertIsNone( base_events._ipaddr_info('::3%lo0', 1, INET6, STREAM, TCP)) def test_port_parameter_types(self): @@ -169,31 +165,10 @@ @patch_socket def test_ipaddr_info_no_inet_pton(self, m_socket): del m_socket.inet_pton - self.test_ipaddr_info() - - def test_check_resolved_address(self): - sock = socket.socket(socket.AF_INET) - with sock: - base_events._check_resolved_address(sock, ('1.2.3.4', 1)) - - sock = socket.socket(socket.AF_INET6) - with sock: - base_events._check_resolved_address(sock, ('::3', 1)) - base_events._check_resolved_address(sock, ('::3%lo0', 1)) - with self.assertRaises(ValueError): - base_events._check_resolved_address(sock, ('foo', 1)) - - def test_check_resolved_sock_type(self): - # Ensure we ignore extra flags in sock.type. - if hasattr(socket, 'SOCK_NONBLOCK'): - sock = socket.socket(type=socket.SOCK_STREAM | socket.SOCK_NONBLOCK) - with sock: - base_events._check_resolved_address(sock, ('1.2.3.4', 1)) - - if hasattr(socket, 'SOCK_CLOEXEC'): - sock = socket.socket(type=socket.SOCK_STREAM | socket.SOCK_CLOEXEC) - with sock: - base_events._check_resolved_address(sock, ('1.2.3.4', 1)) + self.assertIsNone(base_events._ipaddr_info('1.2.3.4', 1, + socket.AF_INET, + socket.SOCK_STREAM, + socket.IPPROTO_TCP)) class BaseEventLoopTests(test_utils.TestCase): @@ -1042,11 +1017,6 @@ self.loop = asyncio.new_event_loop() self.set_event_loop(self.loop) - def tearDown(self): - # Clear mocked constants like AF_INET from the cache. - base_events._ipaddr_info.cache_clear() - super().tearDown() - @patch_socket def test_create_connection_multiple_errors(self, m_socket): @@ -1195,10 +1165,7 @@ if not allow_inet_pton: del m_socket.inet_pton - def getaddrinfo(*args, **kw): - self.fail('should not have called getaddrinfo') - - m_socket.getaddrinfo = getaddrinfo + m_socket.getaddrinfo = socket.getaddrinfo sock = m_socket.socket.return_value self.loop.add_reader = mock.Mock() @@ -1210,9 +1177,9 @@ t, p = self.loop.run_until_complete(coro) try: sock.connect.assert_called_with(('1.2.3.4', 80)) - m_socket.socket.assert_called_with(family=m_socket.AF_INET, - proto=m_socket.IPPROTO_TCP, - type=m_socket.SOCK_STREAM) + _, kwargs = m_socket.socket.call_args + self.assertEqual(kwargs['family'], m_socket.AF_INET) + self.assertEqual(kwargs['type'], m_socket.SOCK_STREAM) finally: t.close() test_utils.run_briefly(self.loop) # allow transport to close @@ -1221,10 +1188,15 @@ coro = self.loop.create_connection(asyncio.Protocol, '::2', 80) t, p = self.loop.run_until_complete(coro) try: - sock.connect.assert_called_with(('::2', 80)) - m_socket.socket.assert_called_with(family=m_socket.AF_INET6, - proto=m_socket.IPPROTO_TCP, - type=m_socket.SOCK_STREAM) + # Without inet_pton we use getaddrinfo, which transforms ('::2', 80) + # to ('::0.0.0.2', 80, 0, 0). The last 0s are flow info, scope id. + [address] = sock.connect.call_args[0] + host, port = address[:2] + self.assertRegex(host, r'::(0\.)*2') + self.assertEqual(port, 80) + _, kwargs = m_socket.socket.call_args + self.assertEqual(kwargs['family'], m_socket.AF_INET6) + self.assertEqual(kwargs['type'], m_socket.SOCK_STREAM) finally: t.close() test_utils.run_briefly(self.loop) # allow transport to close @@ -1256,6 +1228,21 @@ self.assertRaises( OSError, self.loop.run_until_complete, coro) + @patch_socket + def test_create_connection_bluetooth(self, m_socket): + # See http://bugs.python.org/issue27136, fallback to getaddrinfo when + # we can't recognize an address is resolved, e.g. a Bluetooth address. + addr = ('00:01:02:03:04:05', 1) + + def getaddrinfo(host, port, *args, **kw): + assert (host, port) == addr + return [(999, 1, 999, '', (addr, 1))] + + m_socket.getaddrinfo = getaddrinfo + sock = m_socket.socket() + coro = self.loop.sock_connect(sock, addr) + self.loop.run_until_complete(coro) + def test_create_connection_ssl_server_hostname_default(self): self.loop.getaddrinfo = mock.Mock() @@ -1369,7 +1356,7 @@ getaddrinfo = self.loop.getaddrinfo = mock.Mock() getaddrinfo.return_value = [] - f = self.loop.create_server(MyProto, '0.0.0.0', 0) + f = self.loop.create_server(MyProto, 'python.org', 0) self.assertRaises(OSError, self.loop.run_until_complete, f) @patch_socket diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -1610,25 +1610,6 @@ {'clock_resolution': self.loop._clock_resolution, 'selector': self.loop._selector.__class__.__name__}) - def test_sock_connect_address(self): - addresses = [(socket.AF_INET, ('www.python.org', 80))] - if support.IPV6_ENABLED: - addresses.extend(( - (socket.AF_INET6, ('www.python.org', 80)), - (socket.AF_INET6, ('www.python.org', 80, 0, 0)), - )) - - for family, address in addresses: - for sock_type in (socket.SOCK_STREAM, socket.SOCK_DGRAM): - sock = socket.socket(family, sock_type) - with sock: - sock.setblocking(False) - connect = self.loop.sock_connect(sock, address) - with self.assertRaises(ValueError) as cm: - self.loop.run_until_complete(connect) - self.assertIn('address must be resolved', - str(cm.exception)) - def test_remove_fds_after_closing(self): loop = self.create_event_loop() callback = lambda: None diff --git a/Lib/test/test_asyncio/test_selector_events.py b/Lib/test/test_asyncio/test_selector_events.py --- a/Lib/test/test_asyncio/test_selector_events.py +++ b/Lib/test/test_asyncio/test_selector_events.py @@ -343,9 +343,11 @@ f = self.loop.sock_connect(sock, ('127.0.0.1', 8080)) self.assertIsInstance(f, asyncio.Future) - self.assertEqual( - (f, sock, ('127.0.0.1', 8080)), - self.loop._sock_connect.call_args[0]) + self.loop._run_once() + future_in, sock_in, address_in = self.loop._sock_connect.call_args[0] + self.assertEqual(future_in, f) + self.assertEqual(sock_in, sock) + self.assertEqual(address_in, ('127.0.0.1', 8080)) def test_sock_connect_timeout(self): # asyncio issue #205: sock_connect() must unregister the socket on @@ -359,6 +361,7 @@ # first call to sock_connect() registers the socket fut = self.loop.sock_connect(sock, ('127.0.0.1', 80)) + self.loop._run_once() self.assertTrue(sock.connect.called) self.assertTrue(self.loop.add_writer.called) self.assertEqual(len(fut._callbacks), 1) @@ -376,7 +379,10 @@ sock = mock.Mock() sock.fileno.return_value = 10 - self.loop._sock_connect(f, sock, ('127.0.0.1', 8080)) + resolved = self.loop.create_future() + resolved.set_result([(socket.AF_INET, socket.SOCK_STREAM, + socket.IPPROTO_TCP, '', ('127.0.0.1', 8080))]) + self.loop._sock_connect(f, sock, resolved) self.assertTrue(f.done()) self.assertIsNone(f.result()) self.assertTrue(sock.connect.called) @@ -402,9 +408,13 @@ sock.connect.side_effect = BlockingIOError sock.getsockopt.return_value = 0 address = ('127.0.0.1', 8080) + resolved = self.loop.create_future() + resolved.set_result([(socket.AF_INET, socket.SOCK_STREAM, + socket.IPPROTO_TCP, '', address)]) f = asyncio.Future(loop=self.loop) - self.loop._sock_connect(f, sock, address) + self.loop._sock_connect(f, sock, resolved) + self.loop._run_once() self.assertTrue(self.loop.add_writer.called) self.assertEqual(10, self.loop.add_writer.call_args[0][0]) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 12:48:46 2016 From: python-checkins at python.org (yury.selivanov) Date: Wed, 08 Jun 2016 16:48:46 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy41IChhc3luY2lvLCBpc3N1ZSAjMjcxMzYp?= Message-ID: <20160608164840.17984.39061.2CEB30B0@psf.io> https://hg.python.org/cpython/rev/44767f603535 changeset: 101799:44767f603535 parent: 101797:e46b23b6a068 parent: 101798:149fbdbe4729 user: Yury Selivanov date: Wed Jun 08 12:48:34 2016 -0400 summary: Merge 3.5 (asyncio, issue #27136) files: Doc/library/asyncio-eventloop.rst | 47 +++++++++--------- 1 files changed, 24 insertions(+), 23 deletions(-) diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -492,7 +492,10 @@ .. coroutinemethod:: BaseEventLoop.sock_recv(sock, nbytes) - Receive data from the socket. The return value is a bytes object + Receive data from the socket. Modeled after blocking + :meth:`socket.socket.recv` method. + + The return value is a bytes object representing the data received. The maximum amount of data to be received at once is specified by *nbytes*. @@ -501,13 +504,12 @@ This method is a :ref:`coroutine `. - .. seealso:: - - The :meth:`socket.socket.recv` method. - .. coroutinemethod:: BaseEventLoop.sock_sendall(sock, data) - Send data to the socket. The socket must be connected to a remote socket. + Send data to the socket. Modeled after blocking + :meth:`socket.socket.sendall` method. + + The socket must be connected to a remote socket. This method continues to send data from *data* until either all data has been sent or an error occurs. ``None`` is returned on success. On error, an exception is raised, and there is no way to determine how much data, if @@ -518,35 +520,35 @@ This method is a :ref:`coroutine `. - .. seealso:: - - The :meth:`socket.socket.sendall` method. - .. coroutinemethod:: BaseEventLoop.sock_connect(sock, address) - Connect to a remote socket at *address*. - - The *address* must be already resolved to avoid the trap of hanging the - entire event loop when the address requires doing a DNS lookup. For - example, it must be an IP address, not a hostname, for - :py:data:`~socket.AF_INET` and :py:data:`~socket.AF_INET6` address families. - Use :meth:`getaddrinfo` to resolve the hostname asynchronously. + Connect to a remote socket at *address*. Modeled after + blocking :meth:`socket.socket.connect` method. With :class:`SelectorEventLoop` event loop, the socket *sock* must be non-blocking. This method is a :ref:`coroutine `. + .. versionchanged:: 3.5.2 + ``address`` no longer needs to be resolved. ``sock_connect`` + will try to check if the *address* is already resolved by calling + :func:`socket.inet_pton`. If not, + :meth:`BaseEventLoop.getaddrinfo` will be used to resolve the + *address*. + .. seealso:: - The :meth:`BaseEventLoop.create_connection` method, the - :func:`open_connection` function and the :meth:`socket.socket.connect` - method. + :meth:`BaseEventLoop.create_connection` + and :func:`asyncio.open_connection() `. .. coroutinemethod:: BaseEventLoop.sock_accept(sock) - Accept a connection. The socket must be bound to an address and listening + Accept a connection. Modeled after blocking + :meth:`socket.socket.accept`. + + The socket must be bound to an address and listening for connections. The return value is a pair ``(conn, address)`` where *conn* is a *new* socket object usable to send and receive data on the connection, and *address* is the address bound to the socket on the other end of the @@ -558,8 +560,7 @@ .. seealso:: - The :meth:`BaseEventLoop.create_server` method, the :func:`start_server` - function and the :meth:`socket.socket.accept` method. + :meth:`BaseEventLoop.create_server` and :func:`start_server`. Resolve host name -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 12:48:48 2016 From: python-checkins at python.org (yury.selivanov) Date: Wed, 08 Jun 2016 16:48:48 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MTM2?= =?utf-8?q?=3A_Update_asyncio_docs?= Message-ID: <20160608164840.26461.88172.C0C7AFAE@psf.io> https://hg.python.org/cpython/rev/149fbdbe4729 changeset: 101798:149fbdbe4729 branch: 3.5 parent: 101796:3f49e89be8a9 user: Yury Selivanov date: Wed Jun 08 12:48:15 2016 -0400 summary: Issue #27136: Update asyncio docs files: Doc/library/asyncio-eventloop.rst | 47 +++++++++--------- 1 files changed, 24 insertions(+), 23 deletions(-) diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -491,7 +491,10 @@ .. coroutinemethod:: BaseEventLoop.sock_recv(sock, nbytes) - Receive data from the socket. The return value is a bytes object + Receive data from the socket. Modeled after blocking + :meth:`socket.socket.recv` method. + + The return value is a bytes object representing the data received. The maximum amount of data to be received at once is specified by *nbytes*. @@ -500,13 +503,12 @@ This method is a :ref:`coroutine `. - .. seealso:: - - The :meth:`socket.socket.recv` method. - .. coroutinemethod:: BaseEventLoop.sock_sendall(sock, data) - Send data to the socket. The socket must be connected to a remote socket. + Send data to the socket. Modeled after blocking + :meth:`socket.socket.sendall` method. + + The socket must be connected to a remote socket. This method continues to send data from *data* until either all data has been sent or an error occurs. ``None`` is returned on success. On error, an exception is raised, and there is no way to determine how much data, if @@ -517,35 +519,35 @@ This method is a :ref:`coroutine `. - .. seealso:: - - The :meth:`socket.socket.sendall` method. - .. coroutinemethod:: BaseEventLoop.sock_connect(sock, address) - Connect to a remote socket at *address*. - - The *address* must be already resolved to avoid the trap of hanging the - entire event loop when the address requires doing a DNS lookup. For - example, it must be an IP address, not a hostname, for - :py:data:`~socket.AF_INET` and :py:data:`~socket.AF_INET6` address families. - Use :meth:`getaddrinfo` to resolve the hostname asynchronously. + Connect to a remote socket at *address*. Modeled after + blocking :meth:`socket.socket.connect` method. With :class:`SelectorEventLoop` event loop, the socket *sock* must be non-blocking. This method is a :ref:`coroutine `. + .. versionchanged:: 3.5.2 + ``address`` no longer needs to be resolved. ``sock_connect`` + will try to check if the *address* is already resolved by calling + :func:`socket.inet_pton`. If not, + :meth:`BaseEventLoop.getaddrinfo` will be used to resolve the + *address*. + .. seealso:: - The :meth:`BaseEventLoop.create_connection` method, the - :func:`open_connection` function and the :meth:`socket.socket.connect` - method. + :meth:`BaseEventLoop.create_connection` + and :func:`asyncio.open_connection() `. .. coroutinemethod:: BaseEventLoop.sock_accept(sock) - Accept a connection. The socket must be bound to an address and listening + Accept a connection. Modeled after blocking + :meth:`socket.socket.accept`. + + The socket must be bound to an address and listening for connections. The return value is a pair ``(conn, address)`` where *conn* is a *new* socket object usable to send and receive data on the connection, and *address* is the address bound to the socket on the other end of the @@ -557,8 +559,7 @@ .. seealso:: - The :meth:`BaseEventLoop.create_server` method, the :func:`start_server` - function and the :meth:`socket.socket.accept` method. + :meth:`BaseEventLoop.create_server` and :func:`start_server`. Resolve host name -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 12:56:08 2016 From: python-checkins at python.org (yury.selivanov) Date: Wed, 08 Jun 2016 16:56:08 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogYXN5bmNpbzogVXBk?= =?utf-8?q?ate_whatsnew/3=2E5=2E2?= Message-ID: <20160608165557.39285.95102.D322A56B@psf.io> https://hg.python.org/cpython/rev/d8df590a476d changeset: 101800:d8df590a476d branch: 3.5 parent: 101798:149fbdbe4729 user: Yury Selivanov date: Wed Jun 08 12:55:29 2016 -0400 summary: asyncio: Update whatsnew/3.5.2 files: Doc/whatsnew/3.5.rst | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/3.5.rst b/Doc/whatsnew/3.5.rst --- a/Doc/whatsnew/3.5.rst +++ b/Doc/whatsnew/3.5.rst @@ -844,11 +844,16 @@ sequence appears. (Contributed by Mark Korenberg.) -* The :meth:`loop.getaddrinfo() ` - method is optimized to avoid calling the system ``getaddrinfo`` +* The :meth:`loop.create_connection() ` + and :meth:`loop.create_server() ` + methods are optimized to avoid calling the system ``getaddrinfo`` function if the address is already resolved. (Contributed by A. Jesse Jiryu Davis.) +* The :meth:`loop.sock_connect(sock, address) ` + no longer requires the *address* to be resolved prior to the call. + (Contributed by A. Jesse Jiryu Davis.) + bz2 --- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 12:57:02 2016 From: python-checkins at python.org (yury.selivanov) Date: Wed, 08 Jun 2016 16:57:02 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy41ICh3aGF0c25ldyk=?= Message-ID: <20160608165557.17996.56197.CC1F9AA1@psf.io> https://hg.python.org/cpython/rev/718f0fbc1336 changeset: 101801:718f0fbc1336 parent: 101799:44767f603535 parent: 101800:d8df590a476d user: Yury Selivanov date: Wed Jun 08 12:55:54 2016 -0400 summary: Merge 3.5 (whatsnew) files: Doc/whatsnew/3.5.rst | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/3.5.rst b/Doc/whatsnew/3.5.rst --- a/Doc/whatsnew/3.5.rst +++ b/Doc/whatsnew/3.5.rst @@ -844,11 +844,16 @@ sequence appears. (Contributed by Mark Korenberg.) -* The :meth:`loop.getaddrinfo() ` - method is optimized to avoid calling the system ``getaddrinfo`` +* The :meth:`loop.create_connection() ` + and :meth:`loop.create_server() ` + methods are optimized to avoid calling the system ``getaddrinfo`` function if the address is already resolved. (Contributed by A. Jesse Jiryu Davis.) +* The :meth:`loop.sock_connect(sock, address) ` + no longer requires the *address* to be resolved prior to the call. + (Contributed by A. Jesse Jiryu Davis.) + bz2 --- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 13:57:27 2016 From: python-checkins at python.org (yury.selivanov) Date: Wed, 08 Jun 2016 17:57:27 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogYXN5bmNpbzogUmVt?= =?utf-8?q?ove_asyncio=2Etimeout=28=29_context_manager=2E?= Message-ID: <20160608175725.21037.17323.2E759902@psf.io> https://hg.python.org/cpython/rev/73a28ad66bd9 changeset: 101802:73a28ad66bd9 branch: 3.5 parent: 101800:d8df590a476d user: Yury Selivanov date: Wed Jun 08 13:57:03 2016 -0400 summary: asyncio: Remove asyncio.timeout() context manager. It will probably be added back in Python 3.6, once its compatibility issues are resolved; see [1] for more details. [1] https://mail.python.org/pipermail/async-sig/2016-June/000045.html files: Doc/library/asyncio-task.rst | 16 - Doc/whatsnew/3.5.rst | 4 - Lib/asyncio/tasks.py | 53 ---- Lib/test/test_asyncio/test_tasks.py | 187 ---------------- 4 files changed, 0 insertions(+), 260 deletions(-) diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -662,22 +662,6 @@ except CancelledError: res = None -.. function:: timeout(timeout, \*, loop=None) - - Return a context manager that cancels a block on *timeout* expiring:: - - with timeout(1.5): - yield from inner() - - 1. If ``inner()`` is executed faster than in ``1.5`` seconds - nothing happens. - 2. Otherwise ``inner()`` is cancelled internally but - :exc:`asyncio.TimeoutError` is raised outside of - context manager scope. - - Passing ``None`` as *timeout* argument disables the manager logic. - - .. versionadded:: 3.5.2 .. coroutinefunction:: wait(futures, \*, loop=None, timeout=None,\ return_when=ALL_COMPLETED) diff --git a/Doc/whatsnew/3.5.rst b/Doc/whatsnew/3.5.rst --- a/Doc/whatsnew/3.5.rst +++ b/Doc/whatsnew/3.5.rst @@ -835,10 +835,6 @@ method to get the current exception handler. (Contributed by Yury Selivanov.) -* New :func:`~asyncio.timeout` context manager to simplify timeouts - handling code. - (Contributed by Andrew Svetlov.) - * New :meth:`StreamReader.readuntil() ` method to read data from the stream until a separator bytes sequence appears. diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -4,7 +4,6 @@ 'FIRST_COMPLETED', 'FIRST_EXCEPTION', 'ALL_COMPLETED', 'wait', 'wait_for', 'as_completed', 'sleep', 'async', 'gather', 'shield', 'ensure_future', 'run_coroutine_threadsafe', - 'timeout', ] import concurrent.futures @@ -737,55 +736,3 @@ loop.call_soon_threadsafe(callback) return future - - -def timeout(timeout, *, loop=None): - """A factory which produce a context manager with timeout. - - Useful in cases when you want to apply timeout logic around block - of code or in cases when asyncio.wait_for is not suitable. - - For example: - - >>> with asyncio.timeout(0.001): - ... yield from coro() - - - timeout: timeout value in seconds or None to disable timeout logic - loop: asyncio compatible event loop - """ - if loop is None: - loop = events.get_event_loop() - return _Timeout(timeout, loop=loop) - - -class _Timeout: - def __init__(self, timeout, *, loop): - self._timeout = timeout - self._loop = loop - self._task = None - self._cancelled = False - self._cancel_handler = None - - def __enter__(self): - self._task = Task.current_task(loop=self._loop) - if self._task is None: - raise RuntimeError('Timeout context manager should be used ' - 'inside a task') - if self._timeout is not None: - self._cancel_handler = self._loop.call_later( - self._timeout, self._cancel_task) - return self - - def __exit__(self, exc_type, exc_val, exc_tb): - if exc_type is futures.CancelledError and self._cancelled: - self._cancel_handler = None - self._task = None - raise futures.TimeoutError - if self._timeout is not None: - self._cancel_handler.cancel() - self._cancel_handler = None - self._task = None - - def _cancel_task(self): - self._cancelled = self._task.cancel() diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -2260,192 +2260,5 @@ self.assertEqual(result, 11) -class TimeoutTests(test_utils.TestCase): - def setUp(self): - self.loop = asyncio.new_event_loop() - asyncio.set_event_loop(None) - - def tearDown(self): - self.loop.close() - self.loop = None - - def test_timeout(self): - canceled_raised = [False] - - @asyncio.coroutine - def long_running_task(): - try: - yield from asyncio.sleep(10, loop=self.loop) - except asyncio.CancelledError: - canceled_raised[0] = True - raise - - @asyncio.coroutine - def go(): - with self.assertRaises(asyncio.TimeoutError): - with asyncio.timeout(0.01, loop=self.loop) as t: - yield from long_running_task() - self.assertIs(t._loop, self.loop) - - self.loop.run_until_complete(go()) - self.assertTrue(canceled_raised[0], 'CancelledError was not raised') - - def test_timeout_finish_in_time(self): - @asyncio.coroutine - def long_running_task(): - yield from asyncio.sleep(0.01, loop=self.loop) - return 'done' - - @asyncio.coroutine - def go(): - with asyncio.timeout(0.1, loop=self.loop): - resp = yield from long_running_task() - self.assertEqual(resp, 'done') - - self.loop.run_until_complete(go()) - - def test_timeout_gloabal_loop(self): - asyncio.set_event_loop(self.loop) - - @asyncio.coroutine - def run(): - with asyncio.timeout(0.1) as t: - yield from asyncio.sleep(0.01) - self.assertIs(t._loop, self.loop) - - self.loop.run_until_complete(run()) - - def test_timeout_not_relevant_exception(self): - @asyncio.coroutine - def go(): - yield from asyncio.sleep(0, loop=self.loop) - with self.assertRaises(KeyError): - with asyncio.timeout(0.1, loop=self.loop): - raise KeyError - - self.loop.run_until_complete(go()) - - def test_timeout_canceled_error_is_converted_to_timeout(self): - @asyncio.coroutine - def go(): - yield from asyncio.sleep(0, loop=self.loop) - with self.assertRaises(asyncio.CancelledError): - with asyncio.timeout(0.001, loop=self.loop): - raise asyncio.CancelledError - - self.loop.run_until_complete(go()) - - def test_timeout_blocking_loop(self): - @asyncio.coroutine - def long_running_task(): - time.sleep(0.05) - return 'done' - - @asyncio.coroutine - def go(): - with asyncio.timeout(0.01, loop=self.loop): - result = yield from long_running_task() - self.assertEqual(result, 'done') - - self.loop.run_until_complete(go()) - - def test_for_race_conditions(self): - fut = asyncio.Future(loop=self.loop) - self.loop.call_later(0.1, fut.set_result('done')) - - @asyncio.coroutine - def go(): - with asyncio.timeout(0.2, loop=self.loop): - resp = yield from fut - self.assertEqual(resp, 'done') - - self.loop.run_until_complete(go()) - - def test_timeout_time(self): - @asyncio.coroutine - def go(): - foo_running = None - - start = self.loop.time() - with self.assertRaises(asyncio.TimeoutError): - with asyncio.timeout(0.1, loop=self.loop): - foo_running = True - try: - yield from asyncio.sleep(0.2, loop=self.loop) - finally: - foo_running = False - - dt = self.loop.time() - start - # tolerate a small delta for slow delta or unstable clocks - self.assertTrue(0.09 < dt < 0.12, dt) - self.assertFalse(foo_running) - - self.loop.run_until_complete(go()) - - def test_timeout_disable(self): - @asyncio.coroutine - def long_running_task(): - yield from asyncio.sleep(0.1, loop=self.loop) - return 'done' - - @asyncio.coroutine - def go(): - t0 = self.loop.time() - with asyncio.timeout(None, loop=self.loop): - resp = yield from long_running_task() - self.assertEqual(resp, 'done') - dt = self.loop.time() - t0 - # tolerate a time delta for clocks with bad resolution - # and slow buildbots - self.assertTrue(0.09 < dt < 0.15, dt) - self.loop.run_until_complete(go()) - - def test_raise_runtimeerror_if_no_task(self): - with self.assertRaises(RuntimeError): - with asyncio.timeout(0.1, loop=self.loop): - pass - - def test_outer_coro_is_not_cancelled(self): - - has_timeout = [False] - - @asyncio.coroutine - def outer(): - try: - with asyncio.timeout(0.001, loop=self.loop): - yield from asyncio.sleep(1, loop=self.loop) - except asyncio.TimeoutError: - has_timeout[0] = True - - @asyncio.coroutine - def go(): - task = asyncio.ensure_future(outer(), loop=self.loop) - yield from task - self.assertTrue(has_timeout[0]) - self.assertFalse(task.cancelled()) - self.assertTrue(task.done()) - - self.loop.run_until_complete(go()) - - def test_cancel_outer_coro(self): - fut = asyncio.Future(loop=self.loop) - - @asyncio.coroutine - def outer(): - fut.set_result(None) - yield from asyncio.sleep(1, loop=self.loop) - - @asyncio.coroutine - def go(): - task = asyncio.ensure_future(outer(), loop=self.loop) - yield from fut - task.cancel() - with self.assertRaises(asyncio.CancelledError): - yield from task - self.assertTrue(task.cancelled()) - self.assertTrue(task.done()) - - self.loop.run_until_complete(go()) - if __name__ == '__main__': unittest.main() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 13:57:28 2016 From: python-checkins at python.org (yury.selivanov) Date: Wed, 08 Jun 2016 17:57:28 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_3=2E5_=28asyncio=29?= Message-ID: <20160608175725.39458.9963.F45E7B20@psf.io> https://hg.python.org/cpython/rev/92048148bc49 changeset: 101803:92048148bc49 parent: 101801:718f0fbc1336 parent: 101802:73a28ad66bd9 user: Yury Selivanov date: Wed Jun 08 13:57:23 2016 -0400 summary: Merge 3.5 (asyncio) files: Doc/library/asyncio-task.rst | 16 - Doc/whatsnew/3.5.rst | 4 - Lib/asyncio/tasks.py | 53 ---- Lib/test/test_asyncio/test_tasks.py | 187 ---------------- 4 files changed, 0 insertions(+), 260 deletions(-) diff --git a/Doc/library/asyncio-task.rst b/Doc/library/asyncio-task.rst --- a/Doc/library/asyncio-task.rst +++ b/Doc/library/asyncio-task.rst @@ -662,22 +662,6 @@ except CancelledError: res = None -.. function:: timeout(timeout, \*, loop=None) - - Return a context manager that cancels a block on *timeout* expiring:: - - with timeout(1.5): - yield from inner() - - 1. If ``inner()`` is executed faster than in ``1.5`` seconds - nothing happens. - 2. Otherwise ``inner()`` is cancelled internally but - :exc:`asyncio.TimeoutError` is raised outside of - context manager scope. - - Passing ``None`` as *timeout* argument disables the manager logic. - - .. versionadded:: 3.5.2 .. coroutinefunction:: wait(futures, \*, loop=None, timeout=None,\ return_when=ALL_COMPLETED) diff --git a/Doc/whatsnew/3.5.rst b/Doc/whatsnew/3.5.rst --- a/Doc/whatsnew/3.5.rst +++ b/Doc/whatsnew/3.5.rst @@ -835,10 +835,6 @@ method to get the current exception handler. (Contributed by Yury Selivanov.) -* New :func:`~asyncio.timeout` context manager to simplify timeouts - handling code. - (Contributed by Andrew Svetlov.) - * New :meth:`StreamReader.readuntil() ` method to read data from the stream until a separator bytes sequence appears. diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -4,7 +4,6 @@ 'FIRST_COMPLETED', 'FIRST_EXCEPTION', 'ALL_COMPLETED', 'wait', 'wait_for', 'as_completed', 'sleep', 'async', 'gather', 'shield', 'ensure_future', 'run_coroutine_threadsafe', - 'timeout', ] import concurrent.futures @@ -737,55 +736,3 @@ loop.call_soon_threadsafe(callback) return future - - -def timeout(timeout, *, loop=None): - """A factory which produce a context manager with timeout. - - Useful in cases when you want to apply timeout logic around block - of code or in cases when asyncio.wait_for is not suitable. - - For example: - - >>> with asyncio.timeout(0.001): - ... yield from coro() - - - timeout: timeout value in seconds or None to disable timeout logic - loop: asyncio compatible event loop - """ - if loop is None: - loop = events.get_event_loop() - return _Timeout(timeout, loop=loop) - - -class _Timeout: - def __init__(self, timeout, *, loop): - self._timeout = timeout - self._loop = loop - self._task = None - self._cancelled = False - self._cancel_handler = None - - def __enter__(self): - self._task = Task.current_task(loop=self._loop) - if self._task is None: - raise RuntimeError('Timeout context manager should be used ' - 'inside a task') - if self._timeout is not None: - self._cancel_handler = self._loop.call_later( - self._timeout, self._cancel_task) - return self - - def __exit__(self, exc_type, exc_val, exc_tb): - if exc_type is futures.CancelledError and self._cancelled: - self._cancel_handler = None - self._task = None - raise futures.TimeoutError - if self._timeout is not None: - self._cancel_handler.cancel() - self._cancel_handler = None - self._task = None - - def _cancel_task(self): - self._cancelled = self._task.cancel() diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -2260,192 +2260,5 @@ self.assertEqual(result, 11) -class TimeoutTests(test_utils.TestCase): - def setUp(self): - self.loop = asyncio.new_event_loop() - asyncio.set_event_loop(None) - - def tearDown(self): - self.loop.close() - self.loop = None - - def test_timeout(self): - canceled_raised = [False] - - @asyncio.coroutine - def long_running_task(): - try: - yield from asyncio.sleep(10, loop=self.loop) - except asyncio.CancelledError: - canceled_raised[0] = True - raise - - @asyncio.coroutine - def go(): - with self.assertRaises(asyncio.TimeoutError): - with asyncio.timeout(0.01, loop=self.loop) as t: - yield from long_running_task() - self.assertIs(t._loop, self.loop) - - self.loop.run_until_complete(go()) - self.assertTrue(canceled_raised[0], 'CancelledError was not raised') - - def test_timeout_finish_in_time(self): - @asyncio.coroutine - def long_running_task(): - yield from asyncio.sleep(0.01, loop=self.loop) - return 'done' - - @asyncio.coroutine - def go(): - with asyncio.timeout(0.1, loop=self.loop): - resp = yield from long_running_task() - self.assertEqual(resp, 'done') - - self.loop.run_until_complete(go()) - - def test_timeout_gloabal_loop(self): - asyncio.set_event_loop(self.loop) - - @asyncio.coroutine - def run(): - with asyncio.timeout(0.1) as t: - yield from asyncio.sleep(0.01) - self.assertIs(t._loop, self.loop) - - self.loop.run_until_complete(run()) - - def test_timeout_not_relevant_exception(self): - @asyncio.coroutine - def go(): - yield from asyncio.sleep(0, loop=self.loop) - with self.assertRaises(KeyError): - with asyncio.timeout(0.1, loop=self.loop): - raise KeyError - - self.loop.run_until_complete(go()) - - def test_timeout_canceled_error_is_converted_to_timeout(self): - @asyncio.coroutine - def go(): - yield from asyncio.sleep(0, loop=self.loop) - with self.assertRaises(asyncio.CancelledError): - with asyncio.timeout(0.001, loop=self.loop): - raise asyncio.CancelledError - - self.loop.run_until_complete(go()) - - def test_timeout_blocking_loop(self): - @asyncio.coroutine - def long_running_task(): - time.sleep(0.05) - return 'done' - - @asyncio.coroutine - def go(): - with asyncio.timeout(0.01, loop=self.loop): - result = yield from long_running_task() - self.assertEqual(result, 'done') - - self.loop.run_until_complete(go()) - - def test_for_race_conditions(self): - fut = asyncio.Future(loop=self.loop) - self.loop.call_later(0.1, fut.set_result('done')) - - @asyncio.coroutine - def go(): - with asyncio.timeout(0.2, loop=self.loop): - resp = yield from fut - self.assertEqual(resp, 'done') - - self.loop.run_until_complete(go()) - - def test_timeout_time(self): - @asyncio.coroutine - def go(): - foo_running = None - - start = self.loop.time() - with self.assertRaises(asyncio.TimeoutError): - with asyncio.timeout(0.1, loop=self.loop): - foo_running = True - try: - yield from asyncio.sleep(0.2, loop=self.loop) - finally: - foo_running = False - - dt = self.loop.time() - start - # tolerate a small delta for slow delta or unstable clocks - self.assertTrue(0.09 < dt < 0.12, dt) - self.assertFalse(foo_running) - - self.loop.run_until_complete(go()) - - def test_timeout_disable(self): - @asyncio.coroutine - def long_running_task(): - yield from asyncio.sleep(0.1, loop=self.loop) - return 'done' - - @asyncio.coroutine - def go(): - t0 = self.loop.time() - with asyncio.timeout(None, loop=self.loop): - resp = yield from long_running_task() - self.assertEqual(resp, 'done') - dt = self.loop.time() - t0 - # tolerate a time delta for clocks with bad resolution - # and slow buildbots - self.assertTrue(0.09 < dt < 0.15, dt) - self.loop.run_until_complete(go()) - - def test_raise_runtimeerror_if_no_task(self): - with self.assertRaises(RuntimeError): - with asyncio.timeout(0.1, loop=self.loop): - pass - - def test_outer_coro_is_not_cancelled(self): - - has_timeout = [False] - - @asyncio.coroutine - def outer(): - try: - with asyncio.timeout(0.001, loop=self.loop): - yield from asyncio.sleep(1, loop=self.loop) - except asyncio.TimeoutError: - has_timeout[0] = True - - @asyncio.coroutine - def go(): - task = asyncio.ensure_future(outer(), loop=self.loop) - yield from task - self.assertTrue(has_timeout[0]) - self.assertFalse(task.cancelled()) - self.assertTrue(task.done()) - - self.loop.run_until_complete(go()) - - def test_cancel_outer_coro(self): - fut = asyncio.Future(loop=self.loop) - - @asyncio.coroutine - def outer(): - fut.set_result(None) - yield from asyncio.sleep(1, loop=self.loop) - - @asyncio.coroutine - def go(): - task = asyncio.ensure_future(outer(), loop=self.loop) - yield from fut - task.cancel() - with self.assertRaises(asyncio.CancelledError): - yield from task - self.assertTrue(task.cancelled()) - self.assertTrue(task.done()) - - self.loop.run_until_complete(go()) - if __name__ == '__main__': unittest.main() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 13:58:40 2016 From: python-checkins at python.org (yury.selivanov) Date: Wed, 08 Jun 2016 17:58:40 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy41IChORVdTKQ==?= Message-ID: <20160608175839.17761.88110.01209097@psf.io> https://hg.python.org/cpython/rev/b980d0ec49c0 changeset: 101805:b980d0ec49c0 parent: 101803:92048148bc49 parent: 101804:e0cd9effcb85 user: Yury Selivanov date: Wed Jun 08 13:58:35 2016 -0400 summary: Merge 3.5 (NEWS) files: Misc/NEWS | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1158,8 +1158,6 @@ - Skip getaddrinfo if host is already resolved. Patch by A. Jesse Jiryu Davis. -- Add asyncio.timeout() context manager. - - Issue #26050: Add asyncio.StreamReader.readuntil() method. Patch by ???? ?????????. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 13:58:41 2016 From: python-checkins at python.org (yury.selivanov) Date: Wed, 08 Jun 2016 17:58:41 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogYXN5bmNpbzogUmVt?= =?utf-8?q?ove_line_about_asyncio=2Etimeout=28=29_from_the_NEWS_file?= Message-ID: <20160608175839.38459.83602.06A5FCF2@psf.io> https://hg.python.org/cpython/rev/e0cd9effcb85 changeset: 101804:e0cd9effcb85 branch: 3.5 parent: 101802:73a28ad66bd9 user: Yury Selivanov date: Wed Jun 08 13:58:15 2016 -0400 summary: asyncio: Remove line about asyncio.timeout() from the NEWS file files: Misc/NEWS | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -485,8 +485,6 @@ - Skip getaddrinfo if host is already resolved. Patch by A. Jesse Jiryu Davis. -- Add asyncio.timeout() context manager. - - Issue #26050: Add asyncio.StreamReader.readuntil() method. Patch by ???? ?????????. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 14:13:54 2016 From: python-checkins at python.org (guido.van.rossum) Date: Wed, 08 Jun 2016 18:13:54 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Add_typing=2ETYPE=5FCHECKING_?= =?utf-8?q?to_PEP_484=2E?= Message-ID: <20160608181350.32971.3905.9B9CDC9C@psf.io> https://hg.python.org/peps/rev/9759b59479c2 changeset: 6358:9759b59479c2 user: Guido van Rossum date: Wed Jun 08 11:13:41 2016 -0700 summary: Add typing.TYPE_CHECKING to PEP 484. files: pep-0484.txt | 29 ++++++++++++++++++++++++++++- 1 files changed, 28 insertions(+), 1 deletions(-) diff --git a/pep-0484.txt b/pep-0484.txt --- a/pep-0484.txt +++ b/pep-0484.txt @@ -983,6 +983,31 @@ ``"".join(reversed(sys.platform)) == "xunil"``. +Runtime or type checking? +------------------------- + +Sometimes there's code that must be seen by a type checker (or other +static analysis tools) but should not be executed. For such +situations the ``typing`` module defines a constant, +``TYPE_CHECKING``, that is considered ``True`` during type checking +(or other static analysis) but ``False`` at runtime. Example:: + + import typing + + if typing.TYPE_CHECKING: + import expensive_mod + + def a_func(arg: 'expensive_mod.SomeClass') -> None: + a_var = arg # type: expensive_mod.SomeClass + ... + +(Note that the type annotation must be enclosed in quotes, making it a +"forward reference", to hide the ``expensive_mod`` reference from the +interpreter runtime. In the ``# type`` comment no quotes are needed.) + +This approach may also be useful to handle import cycles. + + Arbitrary argument lists and default argument values ---------------------------------------------------- @@ -1174,7 +1199,7 @@ NewType helper function ------------------------ +======================= There are also situations where a programmer might want to avoid logical errors by creating simple classes. For example:: @@ -1644,6 +1669,8 @@ forward references (which are given as string literals) as expressions in the context of the original function or method definition. +* TYPE_CHECKING, ``False`` at runtime but ``True`` to type checkers + Types available in the ``typing.io`` submodule: * IO (generic over ``AnyStr``) -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Wed Jun 8 14:21:43 2016 From: python-checkins at python.org (guido.van.rossum) Date: Wed, 08 Jun 2016 18:21:43 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Sync_typing=2Epy_with_upstream_=28merge_3=2E5-=3E3=2E6?= =?utf-8?b?KS4=?= Message-ID: <20160608182138.20728.41060.4C522C04@psf.io> https://hg.python.org/cpython/rev/251b2e642939 changeset: 101807:251b2e642939 parent: 101805:b980d0ec49c0 parent: 101806:d11082567e76 user: Guido van Rossum date: Wed Jun 08 11:20:02 2016 -0700 summary: Sync typing.py with upstream (merge 3.5->3.6). files: Lib/test/test_typing.py | 38 ++++++++++++++++++++++++- Lib/typing.py | 42 +++++++++++++++++++++++++++- 2 files changed, 76 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -3,7 +3,7 @@ import pickle import re import sys -from unittest import TestCase, main, skipUnless +from unittest import TestCase, main, skipUnless, SkipTest from typing import Any from typing import TypeVar, AnyStr @@ -16,6 +16,7 @@ from typing import get_type_hints from typing import no_type_check, no_type_check_decorator from typing import Type +from typing import NewType from typing import NamedTuple from typing import IO, TextIO, BinaryIO from typing import Pattern, Match @@ -339,6 +340,20 @@ A = Union[str, Pattern] A + def test_etree(self): + # See https://github.com/python/typing/issues/229 + # (Only relevant for Python 2.) + try: + from xml.etree.cElementTree import Element + except ImportError: + raise SkipTest("cElementTree not found") + Union[Element, str] # Shouldn't crash + + def Elem(*args): + return Element(*args) + + Union[Elem, str] # Nor should this + class TypeVarUnionTests(BaseTestCase): @@ -410,7 +425,7 @@ def test_repr(self): self.assertEqual(repr(Tuple), 'typing.Tuple') - self.assertEqual(repr(Tuple[()]), 'typing.Tuple[]') + self.assertEqual(repr(Tuple[()]), 'typing.Tuple[()]') self.assertEqual(repr(Tuple[int, float]), 'typing.Tuple[int, float]') self.assertEqual(repr(Tuple[int, ...]), 'typing.Tuple[int, ...]') @@ -1401,6 +1416,25 @@ joe = new_user(BasicUser) +class NewTypeTests(BaseTestCase): + + def test_basic(self): + UserId = NewType('UserId', int) + UserName = NewType('UserName', str) + self.assertIsInstance(UserId(5), int) + self.assertIsInstance(UserName('Joe'), str) + self.assertEqual(UserId(5) + 1, 6) + + def test_errors(self): + UserId = NewType('UserId', int) + UserName = NewType('UserName', str) + with self.assertRaises(TypeError): + issubclass(UserId, int) + with self.assertRaises(TypeError): + class D(UserName): + pass + + class NamedTupleTests(BaseTestCase): def test_basics(self): diff --git a/Lib/typing.py b/Lib/typing.py --- a/Lib/typing.py +++ b/Lib/typing.py @@ -64,10 +64,12 @@ 'AnyStr', 'cast', 'get_type_hints', + 'NewType', 'no_type_check', 'no_type_check_decorator', 'overload', 'Text', + 'TYPE_CHECKING', ] # The pseudo-submodules 're' and 'io' are part of the public @@ -306,7 +308,7 @@ return type(None) if isinstance(arg, str): arg = _ForwardRef(arg) - if not isinstance(arg, (type, _TypeAlias)): + if not isinstance(arg, (type, _TypeAlias)) and not callable(arg): raise TypeError(msg + " Got %.100r." % (arg,)) return arg @@ -503,7 +505,10 @@ if isinstance(t1, _TypeAlias): # _TypeAlias is not a real class. continue - if any(issubclass(t1, t2) + if not isinstance(t1, type): + assert callable(t1) # A callable might sneak through. + continue + if any(isinstance(t2, type) and issubclass(t1, t2) for t2 in all_params - {t1} if not isinstance(t2, TypeVar)): all_params.remove(t1) # It's not a union if there's only one type left. @@ -684,6 +689,8 @@ params = [_type_repr(p) for p in self.__tuple_params__] if self.__tuple_use_ellipsis__: params.append('...') + if not params: + params.append('()') r += '[%s]' % ( ', '.join(params)) return r @@ -1632,10 +1639,41 @@ return cls +def NewType(name, tp): + """NewType creates simple unique types with almost zero + runtime overhead. NewType(name, tp) is considered a subtype of tp + by static type checkers. At runtime, NewType(name, tp) returns + a dummy function that simply returns its argument. Usage:: + + UserId = NewType('UserId', int) + + def name_by_id(user_id: UserId) -> str: + ... + + UserId('user') # Fails type check + + name_by_id(42) # Fails type check + name_by_id(UserId(42)) # OK + + num = UserId(5) + 1 # type: int + """ + + def new_type(x): + return x + + new_type.__name__ = name + new_type.__supertype__ = tp + return new_type + + # Python-version-specific alias (Python 2: unicode; Python 3: str) Text = str +# Constant that's True when type checking, but False here. +TYPE_CHECKING = False + + class IO(Generic[AnyStr]): """Generic base class for TextIO and BinaryIO. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 14:22:07 2016 From: python-checkins at python.org (guido.van.rossum) Date: Wed, 08 Jun 2016 18:22:07 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogU3luYyB0eXBpbmcu?= =?utf-8?q?py_with_upstream=2E?= Message-ID: <20160608182138.11879.29851.B1DC13F3@psf.io> https://hg.python.org/cpython/rev/d11082567e76 changeset: 101806:d11082567e76 branch: 3.5 parent: 101804:e0cd9effcb85 user: Guido van Rossum date: Wed Jun 08 11:19:11 2016 -0700 summary: Sync typing.py with upstream. (Upstream is https://github.com/python/typing) - Add TYPE_CHECKING (false at runtime, true in type checkers) (upstream #230). - Avoid error on Union[xml.etree.cElementTree.Element, str] (upstream #229). - Repr of Tuple[()] should be 'Tuple[()]' (upstream #231). - Add NewType() (upstream #189). files: Lib/test/test_typing.py | 38 ++++++++++++++++++++++++- Lib/typing.py | 42 +++++++++++++++++++++++++++- 2 files changed, 76 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -3,7 +3,7 @@ import pickle import re import sys -from unittest import TestCase, main, skipUnless +from unittest import TestCase, main, skipUnless, SkipTest from typing import Any from typing import TypeVar, AnyStr @@ -16,6 +16,7 @@ from typing import get_type_hints from typing import no_type_check, no_type_check_decorator from typing import Type +from typing import NewType from typing import NamedTuple from typing import IO, TextIO, BinaryIO from typing import Pattern, Match @@ -339,6 +340,20 @@ A = Union[str, Pattern] A + def test_etree(self): + # See https://github.com/python/typing/issues/229 + # (Only relevant for Python 2.) + try: + from xml.etree.cElementTree import Element + except ImportError: + raise SkipTest("cElementTree not found") + Union[Element, str] # Shouldn't crash + + def Elem(*args): + return Element(*args) + + Union[Elem, str] # Nor should this + class TypeVarUnionTests(BaseTestCase): @@ -410,7 +425,7 @@ def test_repr(self): self.assertEqual(repr(Tuple), 'typing.Tuple') - self.assertEqual(repr(Tuple[()]), 'typing.Tuple[]') + self.assertEqual(repr(Tuple[()]), 'typing.Tuple[()]') self.assertEqual(repr(Tuple[int, float]), 'typing.Tuple[int, float]') self.assertEqual(repr(Tuple[int, ...]), 'typing.Tuple[int, ...]') @@ -1401,6 +1416,25 @@ joe = new_user(BasicUser) +class NewTypeTests(BaseTestCase): + + def test_basic(self): + UserId = NewType('UserId', int) + UserName = NewType('UserName', str) + self.assertIsInstance(UserId(5), int) + self.assertIsInstance(UserName('Joe'), str) + self.assertEqual(UserId(5) + 1, 6) + + def test_errors(self): + UserId = NewType('UserId', int) + UserName = NewType('UserName', str) + with self.assertRaises(TypeError): + issubclass(UserId, int) + with self.assertRaises(TypeError): + class D(UserName): + pass + + class NamedTupleTests(BaseTestCase): def test_basics(self): diff --git a/Lib/typing.py b/Lib/typing.py --- a/Lib/typing.py +++ b/Lib/typing.py @@ -64,10 +64,12 @@ 'AnyStr', 'cast', 'get_type_hints', + 'NewType', 'no_type_check', 'no_type_check_decorator', 'overload', 'Text', + 'TYPE_CHECKING', ] # The pseudo-submodules 're' and 'io' are part of the public @@ -306,7 +308,7 @@ return type(None) if isinstance(arg, str): arg = _ForwardRef(arg) - if not isinstance(arg, (type, _TypeAlias)): + if not isinstance(arg, (type, _TypeAlias)) and not callable(arg): raise TypeError(msg + " Got %.100r." % (arg,)) return arg @@ -503,7 +505,10 @@ if isinstance(t1, _TypeAlias): # _TypeAlias is not a real class. continue - if any(issubclass(t1, t2) + if not isinstance(t1, type): + assert callable(t1) # A callable might sneak through. + continue + if any(isinstance(t2, type) and issubclass(t1, t2) for t2 in all_params - {t1} if not isinstance(t2, TypeVar)): all_params.remove(t1) # It's not a union if there's only one type left. @@ -684,6 +689,8 @@ params = [_type_repr(p) for p in self.__tuple_params__] if self.__tuple_use_ellipsis__: params.append('...') + if not params: + params.append('()') r += '[%s]' % ( ', '.join(params)) return r @@ -1632,10 +1639,41 @@ return cls +def NewType(name, tp): + """NewType creates simple unique types with almost zero + runtime overhead. NewType(name, tp) is considered a subtype of tp + by static type checkers. At runtime, NewType(name, tp) returns + a dummy function that simply returns its argument. Usage:: + + UserId = NewType('UserId', int) + + def name_by_id(user_id: UserId) -> str: + ... + + UserId('user') # Fails type check + + name_by_id(42) # Fails type check + name_by_id(UserId(42)) # OK + + num = UserId(5) + 1 # type: int + """ + + def new_type(x): + return x + + new_type.__name__ = name + new_type.__supertype__ = tp + return new_type + + # Python-version-specific alias (Python 2: unicode; Python 3: str) Text = str +# Constant that's True when type checking, but False here. +TYPE_CHECKING = False + + class IO(Generic[AnyStr]): """Generic base class for TextIO and BinaryIO. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 14:33:54 2016 From: python-checkins at python.org (guido.van.rossum) Date: Wed, 08 Jun 2016 18:33:54 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Omnibus_news_e?= =?utf-8?q?ntry_for_updates_to_typing=2Epy=2E?= Message-ID: <20160608183346.1533.23436.86137CA0@psf.io> https://hg.python.org/cpython/rev/640c0b6a273d changeset: 101808:640c0b6a273d branch: 3.5 parent: 101806:d11082567e76 user: Guido van Rossum date: Wed Jun 08 11:30:48 2016 -0700 summary: Omnibus news entry for updates to typing.py. files: Misc/NEWS | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -131,6 +131,14 @@ Library ------- +- A new version of typing.py provides several new classes and + features: @overload outside stubs, Reversible, DefaultDict, Text, + ContextManager, Type[], NewType(), TYPE_CHECKING, and numerous bug + fixes (note that some of the new features are not yet implemented in + mypy or other static analyzers). Also classes for PEP 492 + (Awaitable, AsyncIterable, AsyncIterator) have been added (in fact + they made it into 3.5.1 but were never mentioned). + - Issue #25738: Stop http.server.BaseHTTPRequestHandler.send_error() from sending a message body for 205 Reset Content. Also, don't send Content header fields in responses that don't have a body. Patch by Susumu -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 14:33:53 2016 From: python-checkins at python.org (guido.van.rossum) Date: Wed, 08 Jun 2016 18:33:53 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Omnibus_news_entry_for_updates_to_typing=2Epy=2E_=28Merg?= =?utf-8?b?ZSAzLjUtPjMuNik=?= Message-ID: <20160608183346.1716.38088.A0C597FB@psf.io> https://hg.python.org/cpython/rev/c589568a70d2 changeset: 101809:c589568a70d2 parent: 101807:251b2e642939 parent: 101808:640c0b6a273d user: Guido van Rossum date: Wed Jun 08 11:33:28 2016 -0700 summary: Omnibus news entry for updates to typing.py. (Merge 3.5->3.6) files: Misc/NEWS | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,14 @@ Library ------- +- A new version of typing.py provides several new classes and + features: @overload outside stubs, Reversible, DefaultDict, Text, + ContextManager, Type[], NewType(), TYPE_CHECKING, and numerous bug + fixes (note that some of the new features are not yet implemented in + mypy or other static analyzers). Also classes for PEP 492 + (Awaitable, AsyncIterable, AsyncIterator) have been added (in fact + they made it into 3.5.1 but were never mentioned). + - Issue #25738: Stop http.server.BaseHTTPRequestHandler.send_error() from sending a message body for 205 Reset Content. Also, don't send Content header fields in responses that don't have a body. Patch by Susumu -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 14:37:36 2016 From: python-checkins at python.org (terry.reedy) Date: Wed, 08 Jun 2016 18:37:36 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327262=3A_move_Aqu?= =?utf-8?q?a_unbinding_code=2C_which_enable_context_menus=2C_to_maxosx=2E?= Message-ID: <20160608183724.17660.81014.29DF902A@psf.io> https://hg.python.org/cpython/rev/09ec7f7322b5 changeset: 101810:09ec7f7322b5 user: Terry Jan Reedy date: Wed Jun 08 14:37:05 2016 -0400 summary: Issue #27262: move Aqua unbinding code, which enable context menus, to maxosx. files: Lib/idlelib/macosx.py | 11 +++++++++++ Lib/idlelib/pyshell.py | 8 -------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py --- a/Lib/idlelib/macosx.py +++ b/Lib/idlelib/macosx.py @@ -206,6 +206,16 @@ # remove redundant "IDLE Help" from menu del mainmenu.menudefs[-1][1][0] +def fixb2context(root): + '''Removed bad AquaTk Button-2 (right) and Paste bindings. + + They prevent context menu access and seem to be gone in AquaTk8.6. + See issue #24801. + ''' + root.unbind_class('Text', '') + root.unbind_class('Text', '') + root.unbind_class('Text', '<>') + def setupApp(root, flist): """ Perform initial OS X customizations if needed. @@ -227,3 +237,4 @@ hideTkConsole(root) overrideRootMenu(root, flist) addOpenEventSupport(root, flist) + fixb2context() diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py --- a/Lib/idlelib/pyshell.py +++ b/Lib/idlelib/pyshell.py @@ -1548,14 +1548,6 @@ flist = PyShellFileList(root) macosx.setupApp(root, flist) - if macosx.isAquaTk(): - # There are some screwed up <2> class bindings for text - # widgets defined in Tk which we need to do away with. - # See issue #24801. - root.unbind_class('Text', '') - root.unbind_class('Text', '') - root.unbind_class('Text', '<>') - if enable_edit: if not (cmd or script): for filename in args[:]: -- Repository URL: https://hg.python.org/cpython From tjreedy at udel.edu Wed Jun 8 13:53:21 2016 From: tjreedy at udel.edu (Terry Reedy) Date: Wed, 08 Jun 2016 13:53:21 -0400 Subject: [Python-checkins] cpython: Fix RST conflicts with Idle news entries In-Reply-To: <20160608133614.3687.1250.E3511B2E@psf.io> References: <20160608133614.3687.1250.E3511B2E@psf.io> Message-ID: <68c65e35-df27-6de5-ba20-459c728f0cf4@udel.edu> On 6/8/2016 9:36 AM, martin.panter wrote: > https://hg.python.org/cpython/rev/2fcfa9badfcd > changeset: 101795:2fcfa9badfcd > parent: 101793:e04daecf4992 > user: Martin Panter > date: Wed Jun 08 13:32:49 2016 +0000 > summary: > Fix RST conflicts with Idle news entries I now know to think 'MISC.rst' and to use `` for x.py and code and not use ''. When news entries are constructed automatically from either checkin message or tracker entry, they might be checked before commit. From python-checkins at python.org Wed Jun 8 17:57:35 2016 From: python-checkins at python.org (barry.warsaw) Date: Wed, 08 Jun 2016 21:57:35 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Null_merge=2E?= Message-ID: <20160608215733.5957.52461.0B8EE217@psf.io> https://hg.python.org/cpython/rev/8afac724465c changeset: 101814:8afac724465c parent: 101812:84c91d7d4667 parent: 101813:eccfb9b597c1 user: Barry Warsaw date: Wed Jun 08 17:56:13 2016 -0400 summary: Null merge. files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 17:57:35 2016 From: python-checkins at python.org (barry.warsaw) Date: Wed, 08 Jun 2016 21:57:35 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MDY2?= =?utf-8?q?=3A_Fixed_SystemError_if_a_custom_opener_=28for_open=28=29=29_r?= =?utf-8?q?eturns?= Message-ID: <20160608215733.21409.10973.0748AB01@psf.io> https://hg.python.org/cpython/rev/4af64ab34eef changeset: 101811:4af64ab34eef branch: 3.5 parent: 101808:640c0b6a273d user: Barry Warsaw date: Wed Jun 08 17:47:26 2016 -0400 summary: Issue #27066: Fixed SystemError if a custom opener (for open()) returns a negative number without setting an exception. files: Lib/test/test_io.py | 16 ++++++++++++++++ Misc/NEWS | 3 +++ Modules/_io/fileio.c | 7 ++++++- 3 files changed, 25 insertions(+), 1 deletions(-) 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 @@ -805,6 +805,22 @@ with self.open("non-existent", "r", opener=opener) as f: self.assertEqual(f.read(), "egg\n") + def test_bad_opener_negative_1(self): + # Issue #27066. + def badopener(fname, flags): + return -1 + with self.assertRaises(ValueError) as cm: + open('non-existent', 'r', opener=badopener) + self.assertEqual(str(cm.exception), 'opener returned -1') + + def test_bad_opener_other_negative(self): + # Issue #27066. + def badopener(fname, flags): + return -2 + with self.assertRaises(ValueError) as cm: + open('non-existent', 'r', opener=badopener) + self.assertEqual(str(cm.exception), 'opener returned -2') + def test_fileio_closefd(self): # Issue #4841 with self.open(__file__, 'rb') as f1, \ diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #27066: Fixed SystemError if a custom opener (for open()) returns a + negative number without setting an exception. + - Issue #20041: Fixed TypeError when frame.f_trace is set to None. Patch by Xavier de Gaye. diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -421,7 +421,12 @@ self->fd = _PyLong_AsInt(fdobj); Py_DECREF(fdobj); - if (self->fd == -1) { + if (self->fd < 0) { + if (!PyErr_Occurred()) { + /* The opener returned -1. See issue #27066 */ + PyErr_Format(PyExc_ValueError, + "opener returned %d", self->fd); + } goto error; } } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 17:57:36 2016 From: python-checkins at python.org (barry.warsaw) Date: Wed, 08 Jun 2016 21:57:36 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Fix_a_comment?= =?utf-8?q?=2E?= Message-ID: <20160608215733.11089.98335.C2513A39@psf.io> https://hg.python.org/cpython/rev/eccfb9b597c1 changeset: 101813:eccfb9b597c1 branch: 3.5 parent: 101811:4af64ab34eef user: Barry Warsaw date: Wed Jun 08 17:55:49 2016 -0400 summary: Fix a comment. files: Modules/_io/fileio.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -423,7 +423,8 @@ Py_DECREF(fdobj); if (self->fd < 0) { if (!PyErr_Occurred()) { - /* The opener returned -1. See issue #27066 */ + /* The opener returned a negative but didn't set an + exception. See issue #27066 */ PyErr_Format(PyExc_ValueError, "opener returned %d", self->fd); } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 17:57:35 2016 From: python-checkins at python.org (barry.warsaw) Date: Wed, 08 Jun 2016 21:57:35 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327066=3A_Fixed_SystemError_if_a_custom_opener_?= =?utf-8?q?=28for_open=28=29=29_returns_a?= Message-ID: <20160608215733.18458.95865.1FEC8668@psf.io> https://hg.python.org/cpython/rev/84c91d7d4667 changeset: 101812:84c91d7d4667 parent: 101810:09ec7f7322b5 parent: 101811:4af64ab34eef user: Barry Warsaw date: Wed Jun 08 17:54:43 2016 -0400 summary: Issue #27066: Fixed SystemError if a custom opener (for open()) returns a negative number without setting an exception. files: Lib/test/test_io.py | 16 ++++++++++++++++ Misc/NEWS | 3 +++ Modules/_io/fileio.c | 8 +++++++- 3 files changed, 26 insertions(+), 1 deletions(-) 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 @@ -809,6 +809,22 @@ with self.open("non-existent", "r", opener=opener) as f: self.assertEqual(f.read(), "egg\n") + def test_bad_opener_negative_1(self): + # Issue #27066. + def badopener(fname, flags): + return -1 + with self.assertRaises(ValueError) as cm: + open('non-existent', 'r', opener=badopener) + self.assertEqual(str(cm.exception), 'opener returned -1') + + def test_bad_opener_other_negative(self): + # Issue #27066. + def badopener(fname, flags): + return -2 + with self.assertRaises(ValueError) as cm: + open('non-existent', 'r', opener=badopener) + self.assertEqual(str(cm.exception), 'opener returned -2') + def test_fileio_closefd(self): # Issue #4841 with self.open(__file__, 'rb') as f1, \ diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #27066: Fixed SystemError if a custom opener (for open()) returns a + negative number without setting an exception. + - Issue #26983: float() now always return an instance of exact float. The deprecation warning is emitted if __float__ returns an instance of a strict subclass of float. In a future versions of Python this can diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -420,7 +420,13 @@ self->fd = _PyLong_AsInt(fdobj); Py_DECREF(fdobj); - if (self->fd == -1) { + if (self->fd < 0) { + if (!PyErr_Occurred()) { + /* The opener returned a negative but didn't set an + exception. See issue #27066 */ + PyErr_Format(PyExc_ValueError, + "opener returned %d", self->fd); + } goto error; } } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 8 18:09:58 2016 From: python-checkins at python.org (terry.reedy) Date: Wed, 08 Jun 2016 22:09:58 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327239=3A_idlelib?= =?utf-8?q?=2Emacosx=2EisXyzTk_functions_initialize_as_needed=2E?= Message-ID: <20160608220941.20950.1794.BB818DB4@psf.io> https://hg.python.org/cpython/rev/cc7f63b6847e changeset: 101815:cc7f63b6847e user: Terry Jan Reedy date: Wed Jun 08 18:09:22 2016 -0400 summary: Issue #27239: idlelib.macosx.isXyzTk functions initialize as needed. files: Lib/idlelib/idle_test/htest.py | 4 +- Lib/idlelib/idle_test/test_configdialog.py | 2 - Lib/idlelib/idle_test/test_macosx.py | 69 ++++++++++ Lib/idlelib/macosx.py | 19 +- 4 files changed, 84 insertions(+), 10 deletions(-) diff --git a/Lib/idlelib/idle_test/htest.py b/Lib/idlelib/idle_test/htest.py --- a/Lib/idlelib/idle_test/htest.py +++ b/Lib/idlelib/idle_test/htest.py @@ -66,7 +66,7 @@ ''' from importlib import import_module -from idlelib.macosx import _initializeTkVariantTests +from idlelib.macosx import _init_tk_type import tkinter as tk AboutDialog_spec = { @@ -337,7 +337,7 @@ root = tk.Tk() root.title('IDLE htest') root.resizable(0, 0) - _initializeTkVariantTests(root) + _init_tk_type(root) # a scrollable Label like constant width text widget. frameLabel = tk.Frame(root, padx=10) diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py --- a/Lib/idlelib/idle_test/test_configdialog.py +++ b/Lib/idlelib/idle_test/test_configdialog.py @@ -8,14 +8,12 @@ requires('gui') from tkinter import Tk import unittest -from idlelib import macosx class ConfigDialogTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.root = Tk() - macosx._initializeTkVariantTests(cls.root) @classmethod def tearDownClass(cls): diff --git a/Lib/idlelib/idle_test/test_macosx.py b/Lib/idlelib/idle_test/test_macosx.py new file mode 100644 --- /dev/null +++ b/Lib/idlelib/idle_test/test_macosx.py @@ -0,0 +1,69 @@ +'''Test idlelib.macosx.py +''' +from idlelib import macosx +from test.support import requires +import sys +import tkinter as tk +import unittest +import unittest.mock as mock + +MAC = sys.platform == 'darwin' +mactypes = {'carbon', 'cocoa', 'xquartz'} +nontypes = {'other'} +alltypes = mactypes | nontypes + + +class InitTktypeTest(unittest.TestCase): + "Test _init_tk_type." + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = tk.Tk() + + @classmethod + def tearDownClass(cls): + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def test_init_sets_tktype(self): + "Test that _init_tk_type sets _tk_type according to platform." + for root in (None, self.root): + with self.subTest(root=root): + macosx._tk_type == None + macosx._init_tk_type(root) + self.assertIn(macosx._tk_type, + mactypes if MAC else nontypes) + + +class IsTypeTkTest(unittest.TestCase): + "Test each of the four isTypeTk predecates." + isfuncs = ((macosx.isAquaTk, ('carbon', 'cocoa')), + (macosx.isCarbonTk, ('carbon')), + (macosx.isCocoaTk, ('cocoa')), + (macosx.isXQuartz, ('xquartz')), + ) + + @mock.patch('idlelib.macosx._init_tk_type') + def test_is_calls_init(self, mockinit): + "Test that each isTypeTk calls _init_tk_type when _tk_type is None." + macosx._tk_type = None + for func, whentrue in self.isfuncs: + with self.subTest(func=func): + func() + self.assertTrue(mockinit.called) + mockinit.reset_mock() + + def test_isfuncs(self): + "Test that each isTypeTk return correct bool." + for func, whentrue in self.isfuncs: + for tktype in alltypes: + with self.subTest(func=func, whentrue=whentrue, tktype=tktype): + macosx._tk_type = tktype + (self.assertTrue if tktype in whentrue else self.assertFalse)\ + (func()) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py --- a/Lib/idlelib/macosx.py +++ b/Lib/idlelib/macosx.py @@ -7,13 +7,14 @@ _tk_type = None -def _initializeTkVariantTests(root): +def _init_tk_type(idleroot=None): """ Initializes OS X Tk variant values for isAquaTk(), isCarbonTk(), isCocoaTk(), and isXQuartz(). """ global _tk_type if sys.platform == 'darwin': + root = idleroot or tkinter.Tk() ws = root.tk.call('tk', 'windowingsystem') if 'x11' in ws: _tk_type = "xquartz" @@ -23,6 +24,8 @@ _tk_type = "cocoa" else: _tk_type = "carbon" + if not idleroot: + root.destroy else: _tk_type = "other" @@ -30,7 +33,8 @@ """ Returns True if IDLE is using a native OS X Tk (Cocoa or Carbon). """ - assert _tk_type is not None + if not _tk_type: + _init_tk_type() return _tk_type == "cocoa" or _tk_type == "carbon" def isCarbonTk(): @@ -38,21 +42,24 @@ Returns True if IDLE is using a Carbon Aqua Tk (instead of the newer Cocoa Aqua Tk). """ - assert _tk_type is not None + if not _tk_type: + _init_tk_type() return _tk_type == "carbon" def isCocoaTk(): """ Returns True if IDLE is using a Cocoa Aqua Tk. """ - assert _tk_type is not None + if not _tk_type: + _init_tk_type() return _tk_type == "cocoa" def isXQuartz(): """ Returns True if IDLE is using an OS X X11 Tk. """ - assert _tk_type is not None + if not _tk_type: + _init_tk_type() return _tk_type == "xquartz" def tkVersionWarning(root): @@ -232,7 +239,7 @@ isAquaTk(), isCarbonTk(), isCocoaTk(), isXQuartz() functions which are initialized here as well. """ - _initializeTkVariantTests(root) + _init_tk_type(root) if isAquaTk(): hideTkConsole(root) overrideRootMenu(root, flist) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 02:19:05 2016 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 09 Jun 2016 06:19:05 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_fix_leak_of_ke?= =?utf-8?q?yfile=5Fbytes?= Message-ID: <20160609061905.27788.83814.41D726FB@psf.io> https://hg.python.org/cpython/rev/0d09fc6a4081 changeset: 101817:0d09fc6a4081 branch: 2.7 user: Benjamin Peterson date: Wed Jun 08 23:18:51 2016 -0700 summary: fix leak of keyfile_bytes files: Modules/_ssl.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Modules/_ssl.c b/Modules/_ssl.c --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -2613,6 +2613,7 @@ } SSL_CTX_set_default_passwd_cb(self->ctx, orig_passwd_cb); SSL_CTX_set_default_passwd_cb_userdata(self->ctx, orig_passwd_userdata); + Py_XDECREF(keyfile_bytes); PyMem_Free(pw_info.password); PyMem_Free(certfile_bytes); Py_RETURN_NONE; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 02:19:05 2016 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 09 Jun 2016 06:19:05 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_stop_leaking_c?= =?utf-8?q?ertfile=5Fbytes_=28closes_=2327267=29?= Message-ID: <20160609061905.27788.85718.0134B0F9@psf.io> https://hg.python.org/cpython/rev/66cd109f3f21 changeset: 101816:66cd109f3f21 branch: 2.7 parent: 101702:4d916be61d46 user: Benjamin Peterson date: Wed Jun 08 23:16:36 2016 -0700 summary: stop leaking certfile_bytes (closes #27267) files: Modules/_ssl.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Modules/_ssl.c b/Modules/_ssl.c --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -2614,6 +2614,7 @@ SSL_CTX_set_default_passwd_cb(self->ctx, orig_passwd_cb); SSL_CTX_set_default_passwd_cb_userdata(self->ctx, orig_passwd_userdata); PyMem_Free(pw_info.password); + PyMem_Free(certfile_bytes); Py_RETURN_NONE; error: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 02:19:06 2016 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 09 Jun 2016 06:19:06 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf-8?q?_merge_heads?= Message-ID: <20160609061905.26279.18752.2E706526@psf.io> https://hg.python.org/cpython/rev/b72ff4d59f62 changeset: 101818:b72ff4d59f62 branch: 2.7 parent: 101817:0d09fc6a4081 parent: 101794:8700f4d09b28 user: Benjamin Peterson date: Wed Jun 08 23:18:56 2016 -0700 summary: merge heads files: Doc/distributing/index.rst | 2 +- Doc/distutils/index.rst | 11 +- Doc/install/index.rst | 11 +- Doc/library/basehttpserver.rst | 5 +- Doc/library/distutils.rst | 40 +- Doc/reference/simple_stmts.rst | 2 +- Doc/tools/templates/indexcontent.html | 8 +- Lib/BaseHTTPServer.py | 21 +- Lib/idlelib/NEWS.txt | 3 + Lib/idlelib/idle_test/__init__.py | 6 + Lib/platform.py | 15 +- Lib/test/test_httpservers.py | 38 + Lib/test/test_platform.py | 16 + Lib/test/test_turtle.py | 435 ++++++++++++++ Mac/BuildScript/build-installer.py | 6 +- Makefile.pre.in | 7 +- Misc/ACKS | 1 + Misc/NEWS | 28 +- Objects/typeobject.c | 6 +- 19 files changed, 616 insertions(+), 45 deletions(-) diff --git a/Doc/distributing/index.rst b/Doc/distributing/index.rst --- a/Doc/distributing/index.rst +++ b/Doc/distributing/index.rst @@ -61,7 +61,7 @@ extensions, to be installed on a system without needing to be built locally. -.. _setuptools: https://setuptools.pypa.io/en/latest/setuptools.html +.. _setuptools: https://setuptools.readthedocs.io/en/latest/ .. _wheel: https://wheel.readthedocs.org Open source licensing and collaboration diff --git a/Doc/distutils/index.rst b/Doc/distutils/index.rst --- a/Doc/distutils/index.rst +++ b/Doc/distutils/index.rst @@ -1,12 +1,17 @@ .. _distutils-index: -############################### - Distributing Python Modules -############################### +############################################## + Distributing Python Modules (Legacy version) +############################################## :Authors: Greg Ward, Anthony Baxter :Email: distutils-sig at python.org +.. seealso:: + + :ref:`distributing-index` + The up to date module distribution documentations + This document describes the Python Distribution Utilities ("Distutils") from the module developer's point of view, describing how to use the Distutils to make Python modules and extensions easily available to a wider audience with diff --git a/Doc/install/index.rst b/Doc/install/index.rst --- a/Doc/install/index.rst +++ b/Doc/install/index.rst @@ -2,14 +2,19 @@ .. _install-index: -***************************** - Installing Python Modules -***************************** +******************************************** + Installing Python Modules (Legacy version) +******************************************** :Author: Greg Ward .. TODO: Fill in XXX comments +.. seealso:: + + :ref:`installing-index` + The up to date module installation documentations + .. The audience for this document includes people who don't know anything about Python and aren't about to learn the language just in order to install and maintain it for their users, i.e. system administrators. diff --git a/Doc/library/basehttpserver.rst b/Doc/library/basehttpserver.rst --- a/Doc/library/basehttpserver.rst +++ b/Doc/library/basehttpserver.rst @@ -197,7 +197,10 @@ Sends and logs a complete error reply to the client. The numeric *code* specifies the HTTP error code, with *message* as optional, more specific text. A complete set of headers is sent, followed by text composed using the - :attr:`error_message_format` class variable. + :attr:`error_message_format` class variable. The body will be empty + if the method is HEAD or the response code is one of the following: + ``1xx``, ``204 No Content``, ``205 Reset Content``, + ``304 Not Modified``. .. method:: send_response(code[, message]) diff --git a/Doc/library/distutils.rst b/Doc/library/distutils.rst --- a/Doc/library/distutils.rst +++ b/Doc/library/distutils.rst @@ -1,10 +1,9 @@ - :mod:`distutils` --- Building and installing Python modules =========================================================== .. module:: distutils - :synopsis: Support for building and installing Python modules into an existing Python - installation. + :synopsis: Support for building and installing Python modules into an + existing Python installation. .. sectionauthor:: Fred L. Drake, Jr. @@ -13,18 +12,31 @@ 100%-pure Python, or may be extension modules written in C, or may be collections of Python packages which include modules coded in both Python and C. -This package is discussed in two separate chapters: +Most Python users will *not* want to use this module directly, but instead +use the cross-version tools maintained by the Python Packaging Authority. In +particular, +`setuptools `__ is an +enhanced alternative to :mod:`distutils` that provides: +* support for declaring project dependencies +* additional mechanisms for configuring which files to include in source + releases (including plugins for integration with version control systems) +* the ability to declare project "entry points", which can be used as the + basis for application plugin systems +* the ability to automatically generate Windows command line executables at + installation time rather than needing to prebuild them +* consistent behaviour across all supported Python versions -.. seealso:: +The recommended `pip `__ installer runs all +``setup.py`` scripts with ``setuptools``, even if the script itself only +imports ``distutils``. Refer to the +`Python Packaging User Guide `_ for more +information. - :ref:`distutils-index` - The manual for developers and packagers of Python modules. This describes how - to prepare :mod:`distutils`\ -based packages so that they may be easily - installed into an existing Python installation. +For the benefits of packaging tool authors and users seeking a deeper +understanding of the details of the current packaging and distribution +system, the legacy :mod:`distutils` based user documentation and API +reference remain available: - :ref:`install-index` - An "administrators" manual which includes information on installing modules into - an existing Python installation. You do not need to be a Python programmer to - read this manual. - +* :ref:`install-index` +* :ref:`distutils-index` 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 @@ -87,7 +87,7 @@ target_list: `target` ("," `target`)* [","] target: `identifier` : | "(" `target_list` ")" - : | "[" `target_list` "]" + : | "[" [`target_list`] "]" : | `attributeref` : | `subscription` : | `slicing` diff --git a/Doc/tools/templates/indexcontent.html b/Doc/tools/templates/indexcontent.html --- a/Doc/tools/templates/indexcontent.html +++ b/Doc/tools/templates/indexcontent.html @@ -16,14 +16,14 @@ + + - - diff --git a/Lib/BaseHTTPServer.py b/Lib/BaseHTTPServer.py --- a/Lib/BaseHTTPServer.py +++ b/Lib/BaseHTTPServer.py @@ -362,14 +362,25 @@ message = short explain = long self.log_error("code %d, message %s", code, message) - # using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201) - content = (self.error_message_format % - {'code': code, 'message': _quote_html(message), 'explain': explain}) self.send_response(code, message) - self.send_header("Content-Type", self.error_content_type) self.send_header('Connection', 'close') + + # Message body is omitted for cases described in: + # - RFC7230: 3.3. 1xx, 204(No Content), 304(Not Modified) + # - RFC7231: 6.3.6. 205(Reset Content) + content = None + if code >= 200 and code not in (204, 205, 304): + # HTML encode to prevent Cross Site Scripting attacks + # (see bug #1100201) + content = (self.error_message_format % { + 'code': code, + 'message': _quote_html(message), + 'explain': explain + }) + self.send_header("Content-Type", self.error_content_type) self.end_headers() - if self.command != 'HEAD' and code >= 200 and code not in (204, 304): + + if self.command != 'HEAD' and content: self.wfile.write(content) error_message_format = DEFAULT_ERROR_MESSAGE diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -2,6 +2,9 @@ ========================== *Release date: 2015-06-30?* +- Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory + is a private implementation of test.test_idle and tool for maintainers. + - Issue #26673: When tk reports font size as 0, change to size 10. Such fonts on Linux prevented the configuration dialog from opening. diff --git a/Lib/idlelib/idle_test/__init__.py b/Lib/idlelib/idle_test/__init__.py --- a/Lib/idlelib/idle_test/__init__.py +++ b/Lib/idlelib/idle_test/__init__.py @@ -1,3 +1,9 @@ +'''idlelib.idle_test is a private implementation of test.test_idle, +which tests the IDLE application as part of the stdlib test suite. +Run IDLE tests alone with "python -m test.test_idle". +This package and its contained modules are subject to change and +any direct use is at your own risk. +''' from os.path import dirname def load_tests(loader, standard_tests, pattern): diff --git a/Lib/platform.py b/Lib/platform.py --- a/Lib/platform.py +++ b/Lib/platform.py @@ -1314,9 +1314,11 @@ ### Various APIs for extracting information from sys.version _sys_version_parser = re.compile( - r'([\w.+]+)\s*' - '\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*' - '\[([^\]]+)\]?') + r'([\w.+]+)\s*' # "version" + r'\(#?([^,]+)' # "(#buildno" + r'(?:,\s*([\w ]*)' # ", builddate" + r'(?:,\s*([\w :]*))?)?\)\s*' # ", buildtime)" + r'\[([^\]]+)\]?') # "[compiler]" _ironpython_sys_version_parser = re.compile( r'IronPython\s*' @@ -1395,6 +1397,8 @@ 'failed to parse Jython sys.version: %s' % repr(sys_version)) version, buildno, builddate, buildtime, _ = match.groups() + if builddate is None: + builddate = '' compiler = sys.platform elif "PyPy" in sys_version: @@ -1417,7 +1421,10 @@ version, buildno, builddate, buildtime, compiler = \ match.groups() name = 'CPython' - builddate = builddate + ' ' + buildtime + if builddate is None: + builddate = '' + elif buildtime: + builddate = builddate + ' ' + buildtime if hasattr(sys, 'subversion'): # sys.subversion was added in Python 2.5 diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -178,6 +178,12 @@ self.send_header('Connection', 'close') self.end_headers() + def do_SEND_ERROR(self): + self.send_error(int(self.path[1:])) + + def do_HEAD(self): + self.send_error(int(self.path[1:])) + def setUp(self): BaseTestCase.setUp(self) self.con = httplib.HTTPConnection('localhost', self.PORT) @@ -276,6 +282,38 @@ res = self.con.getresponse() self.assertEqual(res.status, 999) + def test_send_error(self): + allow_transfer_encoding_codes = (205, 304) + for code in (101, 102, 204, 205, 304): + self.con.request('SEND_ERROR', '/{}'.format(code)) + res = self.con.getresponse() + self.assertEqual(code, res.status) + self.assertEqual(None, res.getheader('Content-Length')) + self.assertEqual(None, res.getheader('Content-Type')) + if code not in allow_transfer_encoding_codes: + self.assertEqual(None, res.getheader('Transfer-Encoding')) + + data = res.read() + self.assertEqual(b'', data) + + def test_head_via_send_error(self): + allow_transfer_encoding_codes = (205, 304) + for code in (101, 200, 204, 205, 304): + self.con.request('HEAD', '/{}'.format(code)) + res = self.con.getresponse() + self.assertEqual(code, res.status) + if code == 200: + self.assertEqual(None, res.getheader('Content-Length')) + self.assertIn('text/html', res.getheader('Content-Type')) + else: + self.assertEqual(None, res.getheader('Content-Length')) + self.assertEqual(None, res.getheader('Content-Type')) + if code not in allow_transfer_encoding_codes: + self.assertEqual(None, res.getheader('Transfer-Encoding')) + + data = res.read() + self.assertEqual(b'', data) + class SimpleHTTPServerTestCase(BaseTestCase): class request_handler(NoLogRequestHandler, SimpleHTTPRequestHandler): diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py --- a/Lib/test/test_platform.py +++ b/Lib/test/test_platform.py @@ -67,6 +67,22 @@ ('IronPython', '1.0.60816', '', '', '', '', '.NET 2.0.50727.42')), ('IronPython 1.0 (1.0.61005.1977) on .NET 2.0.50727.42', ('IronPython', '1.0.0', '', '', '', '', '.NET 2.0.50727.42')), + ('2.4.3 (truncation, date, t) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', 'date t', 'GCC')), + ('2.4.3 (truncation, date, ) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', 'date', 'GCC')), + ('2.4.3 (truncation, date,) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', 'date', 'GCC')), + ('2.4.3 (truncation, date) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', 'date', 'GCC')), + ('2.4.3 (truncation, d) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', 'd', 'GCC')), + ('2.4.3 (truncation, ) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', '', 'GCC')), + ('2.4.3 (truncation,) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', '', 'GCC')), + ('2.4.3 (truncation) \n[GCC]', + ('CPython', '2.4.3', '', '', 'truncation', '', 'GCC')), ): # branch and revision are not "parsed", but fetched # from sys.subversion. Ignore them diff --git a/Lib/test/test_turtle.py b/Lib/test/test_turtle.py new file mode 100644 --- /dev/null +++ b/Lib/test/test_turtle.py @@ -0,0 +1,435 @@ +import pickle +import unittest +from test import test_support as support + +turtle = support.import_module('turtle') +Vec2D = turtle.Vec2D + +test_config = """\ +width = 0.75 +height = 0.8 +canvwidth = 500 +canvheight = 200 +leftright = 100 +topbottom = 100 +mode = world +colormode = 255 +delay = 100 +undobuffersize = 10000 +shape = circle +pencolor = red +fillcolor = blue +resizemode = auto +visible = None +language = english +exampleturtle = turtle +examplescreen = screen +title = Python Turtle Graphics +using_IDLE = '' +""" + +test_config_two = """\ +# Comments! +# Testing comments! +pencolor = red +fillcolor = blue +visible = False +language = english +# Some more +# comments +using_IDLE = False +""" + +invalid_test_config = """ +pencolor = red +fillcolor: blue +visible = False +""" + + +class TurtleConfigTest(unittest.TestCase): + + def get_cfg_file(self, cfg_str): + self.addCleanup(support.unlink, support.TESTFN) + with open(support.TESTFN, 'w') as f: + f.write(cfg_str) + return support.TESTFN + + def test_config_dict(self): + + cfg_name = self.get_cfg_file(test_config) + parsed_cfg = turtle.config_dict(cfg_name) + + expected = { + 'width' : 0.75, + 'height' : 0.8, + 'canvwidth' : 500, + 'canvheight': 200, + 'leftright': 100, + 'topbottom': 100, + 'mode': 'world', + 'colormode': 255, + 'delay': 100, + 'undobuffersize': 10000, + 'shape': 'circle', + 'pencolor' : 'red', + 'fillcolor' : 'blue', + 'resizemode' : 'auto', + 'visible' : None, + 'language': 'english', + 'exampleturtle': 'turtle', + 'examplescreen': 'screen', + 'title': 'Python Turtle Graphics', + 'using_IDLE': '', + } + + self.assertEqual(parsed_cfg, expected) + + def test_partial_config_dict_with_commments(self): + + cfg_name = self.get_cfg_file(test_config_two) + parsed_cfg = turtle.config_dict(cfg_name) + + expected = { + 'pencolor': 'red', + 'fillcolor': 'blue', + 'visible': False, + 'language': 'english', + 'using_IDLE': False, + } + + self.assertEqual(parsed_cfg, expected) + + def test_config_dict_invalid(self): + + cfg_name = self.get_cfg_file(invalid_test_config) + + with support.captured_stdout() as stdout: + parsed_cfg = turtle.config_dict(cfg_name) + + err_msg = stdout.getvalue() + + self.assertIn('Bad line in config-file ', err_msg) + self.assertIn('fillcolor: blue', err_msg) + + self.assertEqual(parsed_cfg, { + 'pencolor': 'red', + 'visible': False, + }) + + +class VectorComparisonMixin: + + def assertVectorsAlmostEqual(self, vec1, vec2): + if len(vec1) != len(vec2): + self.fail("Tuples are not of equal size") + for idx, (i, j) in enumerate(zip(vec1, vec2)): + self.assertAlmostEqual( + i, j, msg='values at index {} do not match'.format(idx)) + + +class TestVec2D(VectorComparisonMixin, unittest.TestCase): + + def test_constructor(self): + vec = Vec2D(0.5, 2) + self.assertEqual(vec[0], 0.5) + self.assertEqual(vec[1], 2) + self.assertIsInstance(vec, Vec2D) + + self.assertRaises(TypeError, Vec2D) + self.assertRaises(TypeError, Vec2D, 0) + self.assertRaises(TypeError, Vec2D, (0, 1)) + self.assertRaises(TypeError, Vec2D, vec) + self.assertRaises(TypeError, Vec2D, 0, 1, 2) + + def test_repr(self): + vec = Vec2D(0.567, 1.234) + self.assertEqual(repr(vec), '(0.57,1.23)') + + def test_equality(self): + vec1 = Vec2D(0, 1) + vec2 = Vec2D(0.0, 1) + vec3 = Vec2D(42, 1) + self.assertEqual(vec1, vec2) + self.assertEqual(vec1, tuple(vec1)) + self.assertEqual(tuple(vec1), vec1) + self.assertNotEqual(vec1, vec3) + self.assertNotEqual(vec2, vec3) + + def test_pickling(self): + vec = Vec2D(0.5, 2) + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + pickled = pickle.dumps(vec, protocol=proto) + unpickled = pickle.loads(pickled) + self.assertEqual(unpickled, vec) + self.assertIsInstance(unpickled, Vec2D) + + def _assert_arithmetic_cases(self, test_cases, lambda_operator): + for test_case in test_cases: + ((first, second), expected) = test_case + + op1 = Vec2D(*first) + op2 = Vec2D(*second) + + result = lambda_operator(op1, op2) + + expected = Vec2D(*expected) + + self.assertVectorsAlmostEqual(result, expected) + + def test_vector_addition(self): + + test_cases = [ + (((0, 0), (1, 1)), (1.0, 1.0)), + (((-1, 0), (2, 2)), (1, 2)), + (((1.5, 0), (1, 1)), (2.5, 1)), + ] + + self._assert_arithmetic_cases(test_cases, lambda x, y: x + y) + + def test_vector_subtraction(self): + + test_cases = [ + (((0, 0), (1, 1)), (-1, -1)), + (((10.625, 0.125), (10, 0)), (0.625, 0.125)), + ] + + self._assert_arithmetic_cases(test_cases, lambda x, y: x - y) + + def test_vector_multiply(self): + + vec1 = Vec2D(10, 10) + vec2 = Vec2D(0.5, 3) + answer = vec1 * vec2 + expected = 35 + self.assertAlmostEqual(answer, expected) + + vec = Vec2D(0.5, 3) + answer = vec * 10 + expected = Vec2D(5, 30) + self.assertVectorsAlmostEqual(answer, expected) + + def test_vector_negative(self): + vec = Vec2D(10, -10) + expected = (-10, 10) + self.assertVectorsAlmostEqual(-vec, expected) + + def test_distance(self): + vec = Vec2D(6, 8) + expected = 10 + self.assertEqual(abs(vec), expected) + + vec = Vec2D(0, 0) + expected = 0 + self.assertEqual(abs(vec), expected) + + vec = Vec2D(2.5, 6) + expected = 6.5 + self.assertEqual(abs(vec), expected) + + def test_rotate(self): + + cases = [ + (((0, 0), 0), (0, 0)), + (((0, 1), 90), (-1, 0)), + (((0, 1), -90), (1, 0)), + (((1, 0), 180), (-1, 0)), + (((1, 0), 360), (1, 0)), + ] + + for case in cases: + (vec, rot), expected = case + vec = Vec2D(*vec) + got = vec.rotate(rot) + self.assertVectorsAlmostEqual(got, expected) + + +class TestTNavigator(VectorComparisonMixin, unittest.TestCase): + + def setUp(self): + self.nav = turtle.TNavigator() + + def test_goto(self): + self.nav.goto(100, -100) + self.assertAlmostEqual(self.nav.xcor(), 100) + self.assertAlmostEqual(self.nav.ycor(), -100) + + def test_pos(self): + self.assertEqual(self.nav.pos(), self.nav._position) + self.nav.goto(100, -100) + self.assertEqual(self.nav.pos(), self.nav._position) + + def test_left(self): + self.assertEqual(self.nav._orient, (1.0, 0)) + self.nav.left(90) + self.assertVectorsAlmostEqual(self.nav._orient, (0.0, 1.0)) + + def test_right(self): + self.assertEqual(self.nav._orient, (1.0, 0)) + self.nav.right(90) + self.assertVectorsAlmostEqual(self.nav._orient, (0, -1.0)) + + def test_reset(self): + self.nav.goto(100, -100) + self.assertAlmostEqual(self.nav.xcor(), 100) + self.assertAlmostEqual(self.nav.ycor(), -100) + self.nav.reset() + self.assertAlmostEqual(self.nav.xcor(), 0) + self.assertAlmostEqual(self.nav.ycor(), 0) + + def test_forward(self): + self.nav.forward(150) + expected = Vec2D(150, 0) + self.assertVectorsAlmostEqual(self.nav.position(), expected) + + self.nav.reset() + self.nav.left(90) + self.nav.forward(150) + expected = Vec2D(0, 150) + self.assertVectorsAlmostEqual(self.nav.position(), expected) + + self.assertRaises(TypeError, self.nav.forward, 'skldjfldsk') + + def test_backwards(self): + self.nav.back(200) + expected = Vec2D(-200, 0) + self.assertVectorsAlmostEqual(self.nav.position(), expected) + + self.nav.reset() + self.nav.right(90) + self.nav.back(200) + expected = Vec2D(0, 200) + self.assertVectorsAlmostEqual(self.nav.position(), expected) + + def test_distance(self): + self.nav.forward(100) + expected = 100 + self.assertAlmostEqual(self.nav.distance(Vec2D(0,0)), expected) + + def test_radians_and_degrees(self): + self.nav.left(90) + self.assertAlmostEqual(self.nav.heading(), 90) + self.nav.radians() + self.assertAlmostEqual(self.nav.heading(), 1.57079633) + self.nav.degrees() + self.assertAlmostEqual(self.nav.heading(), 90) + + def test_towards(self): + + coordinates = [ + # coordinates, expected + ((100, 0), 0.0), + ((100, 100), 45.0), + ((0, 100), 90.0), + ((-100, 100), 135.0), + ((-100, 0), 180.0), + ((-100, -100), 225.0), + ((0, -100), 270.0), + ((100, -100), 315.0), + ] + + for (x, y), expected in coordinates: + self.assertEqual(self.nav.towards(x, y), expected) + self.assertEqual(self.nav.towards((x, y)), expected) + self.assertEqual(self.nav.towards(Vec2D(x, y)), expected) + + def test_heading(self): + + self.nav.left(90) + self.assertAlmostEqual(self.nav.heading(), 90) + self.nav.left(45) + self.assertAlmostEqual(self.nav.heading(), 135) + self.nav.right(1.6) + self.assertAlmostEqual(self.nav.heading(), 133.4) + self.assertRaises(TypeError, self.nav.right, 'sdkfjdsf') + self.nav.reset() + + rotations = [10, 20, 170, 300] + result = sum(rotations) % 360 + for num in rotations: + self.nav.left(num) + self.assertEqual(self.nav.heading(), result) + self.nav.reset() + + result = (360-sum(rotations)) % 360 + for num in rotations: + self.nav.right(num) + self.assertEqual(self.nav.heading(), result) + self.nav.reset() + + rotations = [10, 20, -170, 300, -210, 34.3, -50.2, -10, -29.98, 500] + sum_so_far = 0 + for num in rotations: + if num < 0: + self.nav.right(abs(num)) + else: + self.nav.left(num) + sum_so_far += num + self.assertAlmostEqual(self.nav.heading(), sum_so_far % 360) + + def test_setheading(self): + self.nav.setheading(102.32) + self.assertAlmostEqual(self.nav.heading(), 102.32) + self.nav.setheading(-123.23) + self.assertAlmostEqual(self.nav.heading(), (-123.23) % 360) + self.nav.setheading(-1000.34) + self.assertAlmostEqual(self.nav.heading(), (-1000.34) % 360) + self.nav.setheading(300000) + self.assertAlmostEqual(self.nav.heading(), 300000%360) + + def test_positions(self): + self.nav.forward(100) + self.nav.left(90) + self.nav.forward(-200) + self.assertVectorsAlmostEqual(self.nav.pos(), (100.0, -200.0)) + + def test_setx_and_sety(self): + self.nav.setx(-1023.2334) + self.nav.sety(193323.234) + self.assertVectorsAlmostEqual(self.nav.pos(), (-1023.2334, 193323.234)) + + def test_home(self): + self.nav.left(30) + self.nav.forward(-100000) + self.nav.home() + self.assertVectorsAlmostEqual(self.nav.pos(), (0,0)) + self.assertAlmostEqual(self.nav.heading(), 0) + + def test_distance_method(self): + self.assertAlmostEqual(self.nav.distance(30, 40), 50) + vec = Vec2D(0.22, .001) + self.assertAlmostEqual(self.nav.distance(vec), 0.22000227271553355) + another_turtle = turtle.TNavigator() + another_turtle.left(90) + another_turtle.forward(10000) + self.assertAlmostEqual(self.nav.distance(another_turtle), 10000) + + +class TestTPen(unittest.TestCase): + + def test_pendown_and_penup(self): + + tpen = turtle.TPen() + + self.assertTrue(tpen.isdown()) + tpen.penup() + self.assertFalse(tpen.isdown()) + tpen.pendown() + self.assertTrue(tpen.isdown()) + + def test_showturtle_hideturtle_and_isvisible(self): + + tpen = turtle.TPen() + + self.assertTrue(tpen.isvisible()) + tpen.hideturtle() + self.assertFalse(tpen.isvisible()) + tpen.showturtle() + self.assertTrue(tpen.isvisible()) + + +def test_main(): + support.run_unittest(TurtleConfigTest, TestVec2D, TestTNavigator, TestTPen) + +if __name__ == '__main__': + test_main() diff --git a/Mac/BuildScript/build-installer.py b/Mac/BuildScript/build-installer.py --- a/Mac/BuildScript/build-installer.py +++ b/Mac/BuildScript/build-installer.py @@ -242,9 +242,9 @@ result.extend([ dict( - name="OpenSSL 1.0.2g", - url="https://www.openssl.org/source/openssl-1.0.2g.tar.gz", - checksum='f3c710c045cdee5fd114feb69feba7aa', + name="OpenSSL 1.0.2h", + url="https://www.openssl.org/source/openssl-1.0.2h.tar.gz", + checksum='9392e65072ce4b614c1392eefc1f23d0', patches=[ "openssl_sdk_makedepend.patch", ], diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -682,16 +682,19 @@ $(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGEN) @$(MKDIR_P) Include + # Avoid copying the file onto itself for an in-tree build if test "$(cross_compiling)" != "yes"; then \ $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C); \ else \ - cp $(srcdir)/Include/graminit.h $(GRAMMAR_H); \ + cp $(srcdir)/Include/graminit.h $(GRAMMAR_H).tmp; \ + mv $(GRAMMAR_H).tmp $(GRAMMAR_H); \ fi $(GRAMMAR_C): $(GRAMMAR_H) if test "$(cross_compiling)" != "yes"; then \ touch $(GRAMMAR_C); \ else \ - cp $(srcdir)/Python/graminit.c $(GRAMMAR_C); \ + cp $(srcdir)/Python/graminit.c $(GRAMMAR_C).tmp; \ + mv $(GRAMMAR_C).tmp $(GRAMMAR_C); \ fi $(PGEN): $(PGENOBJS) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -741,6 +741,7 @@ ???? ????????? Vlad Korolev Anna Koroliuk +Susumu Koshiba Joseph Koshy Daniel Kozan Jerzy Kozera diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -18,7 +18,7 @@ Some compilers and toolchains are known to not produce stable code when using LTO, be sure to test things thoroughly before relying on it. It can provide a few % speed up over profile-opt alone. - + - Issue #26168: Fixed possible refleaks in failing Py_BuildValue() with the "N" format unit. @@ -92,6 +92,14 @@ Library ------- +- Issue #25738: Stop BaseHTTPServer.BaseHTTPRequestHandler.send_error() from + sending a message body for 205 Reset Content. Also, don't send the + Content-Type header field in responses that don't have a body. Based on + patch by Susumu Koshiba. + +- Issue #21313: Fix the "platform" module to tolerate when sys.version + contains truncated build information. + - Issue #27211: Fix possible memory corruption in io.IOBase.readline(). - Issue #27114: Fix SSLContext._load_windows_store_certs fails with @@ -263,6 +271,8 @@ IDLE ---- +- Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory + is a private implementation of test.test_idle and tool for maintainers. - Issue #26673: When tk reports font size as 0, change to size 10. Such fonts on Linux prevented the configuration dialog from opening. @@ -293,9 +303,18 @@ functions together, and add more details such as what underlying Readline functions and variables are accessed. +- Issue #26014: Guide users to the newer packaging documentation as was done + for Python 3.x. In particular, the top-level 2.7 documentation page now + links to the newer installer and distributions pages rather than the + legacy install and Distutils pages; these are still linked to in the + library/distutils doc page. + Tests ----- +- Issue #21916: Added tests for the turtle module. Patch by ingrid, + Gregory Loyse and Jelle Zijlstra. + - Issue #25940: Changed test_ssl to use self-signed.pythontest.net. This avoids relying on svn.python.org, which recently changed root certificate. @@ -312,6 +331,9 @@ - Issue #19450: Update Windows builds to use SQLite 3.8.11.0. +- Issue #27229: Fix the cross-compiling pgen rule for in-tree builds. Patch + by Xavier de Gaye. + - Issue #17603: Avoid error about nonexistant fileblocks.o file by using a lower-level check for st_blocks in struct stat. @@ -333,8 +355,8 @@ - Issue #25696: Fix installation of Python on UNIX with make -j9. -- Issue #26465: Update OS X 10.5+ 32-bit-only installer to build - and link with OpenSSL 1.0.2g. +- Issue #26930: Update OS X 10.5+ 32-bit-only installer to build + and link with OpenSSL 1.0.2h. - Issue #26268: Update Windows builds to use OpenSSL 1.0.2f. diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2430,7 +2430,11 @@ Py_DECREF(type); return NULL; } - PyDict_SetItemString(dict, "__new__", tmp); + if (PyDict_SetItemString(dict, "__new__", tmp) < 0) { + Py_DECREF(tmp); + Py_DECREF(type); + return NULL; + } Py_DECREF(tmp); } -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Thu Jun 9 04:51:59 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 09 Jun 2016 08:51:59 +0000 Subject: [Python-checkins] Daily reference leaks (cc7f63b6847e): sum=5 Message-ID: <20160609085159.26579.52099.0D249EE6@psf.io> results for cc7f63b6847e on branch "default" -------------------------------------------- test_collections leaked [-2, 0, 0] references, sum=-2 test_collections leaked [-1, 4, 0] memory blocks, sum=3 test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflog7f0qA9', '--timeout', '7200'] From python-checkins at python.org Thu Jun 9 05:08:50 2016 From: python-checkins at python.org (berker.peksag) Date: Thu, 09 Jun 2016 09:08:50 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Add_PEP_512_by_Nathaniel_Smit?= =?utf-8?q?h?= Message-ID: <20160609090848.120773.4289.0B57B485@psf.io> https://hg.python.org/peps/rev/c244d09c7874 changeset: 6359:c244d09c7874 user: Berker Peksag date: Thu Jun 09 12:08:48 2016 +0300 summary: Add PEP 512 by Nathaniel Smith files: pep-0521.txt | 387 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 387 insertions(+), 0 deletions(-) diff --git a/pep-0521.txt b/pep-0521.txt new file mode 100644 --- /dev/null +++ b/pep-0521.txt @@ -0,0 +1,387 @@ +PEP: 521 +Title: Managing global context via 'with' blocks in generators and coroutines +Version: $Revision$ +Last-Modified: $Date$ +Author: Nathaniel J. Smith +Status: Deferred +Type: Standards Track +Content-Type: text/x-rst +Created: 27-Apr-2015 +Python-Version: 3.6 +Post-History: 29-Apr-2015 + + +Abstract +======== + +While we generally try to avoid global state when possible, there +nonetheless exist a number of situations where it is agreed to be the +best approach. In Python, the standard way of handling such cases is +to store the global state in global or thread-local storage, and then +use ``with`` blocks to limit modifications of this global state to a +single dynamic scope. Examples where this pattern is used include the +standard library's ``warnings.catch_warnings`` and +``decimal.localcontext``, NumPy's ``numpy.errstate`` (which exposes +the error-handling settings provided by the IEEE 754 floating point +standard), and the handling of logging context or HTTP request context +in many server application frameworks. + +However, there is currently no ergonomic way to manage such local +changes to global state when writing a generator or coroutine. For +example, this code:: + + def f(): + with warnings.catch_warnings(): + for x in g(): + yield x + +may or may not successfully catch warnings raised by ``g()``, and may +or may not inadverdantly swallow warnings triggered elsewhere in the +code. The context manager, which was intended to apply only to ``f`` +and its callees, ends up having a dynamic scope that encompasses +arbitrary and unpredictable parts of its call\ **ers**. This problem +becomes particularly acute when writing asynchronous code, where +essentially all functions become coroutines. + +Here, we propose to solve this problem by notifying context managers +whenever execution is suspended or resumed within their scope, +allowing them to restrict their effects appropriately. + + +Specification +============= + +Two new, optional, methods are added to the context manager protocol: +``__suspend__`` and ``__resume__``. If present, these methods will be +called whenever a frame's execution is suspended or resumed from +within the context of the ``with`` block. + +More formally, consider the following code:: + + with EXPR as VAR: + PARTIAL-BLOCK-1 + f((yield foo)) + PARTIAL-BLOCK-2 + +Currently this is equivalent to the following code copied from PEP 343:: + + mgr = (EXPR) + exit = type(mgr).__exit__ # Not calling it yet + value = type(mgr).__enter__(mgr) + exc = True + try: + try: + VAR = value # Only if "as VAR" is present + PARTIAL-BLOCK-1 + f((yield foo)) + PARTIAL-BLOCK-2 + except: + exc = False + if not exit(mgr, *sys.exc_info()): + raise + finally: + if exc: + exit(mgr, None, None, None) + +This PEP proposes to modify ``with`` block handling to instead become:: + + mgr = (EXPR) + exit = type(mgr).__exit__ # Not calling it yet + ### --- NEW STUFF --- + if the_block_contains_yield_points: # known statically at compile time + suspend = getattr(type(mgr), "__suspend__", lambda: None) + resume = getattr(type(mgr), "__resume__", lambda: None) + ### --- END OF NEW STUFF --- + value = type(mgr).__enter__(mgr) + exc = True + try: + try: + VAR = value # Only if "as VAR" is present + PARTIAL-BLOCK-1 + ### --- NEW STUFF --- + suspend() + tmp = yield foo + resume() + f(tmp) + ### --- END OF NEW STUFF --- + PARTIAL-BLOCK-2 + except: + exc = False + if not exit(mgr, *sys.exc_info()): + raise + finally: + if exc: + exit(mgr, None, None, None) + +Analogous suspend/resume calls are also wrapped around the ``yield`` +points embedded inside the ``yield from``, ``await``, ``async with``, +and ``async for`` constructs. + + +Nested blocks +------------- + +Given this code:: + + def f(): + with OUTER: + with INNER: + yield VALUE + +then we perform the following operations in the following sequence:: + + INNER.__suspend__() + OUTER.__suspend__() + yield VALUE + OUTER.__resume__() + INNER.__resume__() + +Note that this ensures that the following is a valid refactoring:: + + def f(): + with OUTER: + yield from g() + + def g(): + with INNER + yield VALUE + +Similarly, ``with`` statements with multiple context managers suspend +from right to left, and resume from left to right. + + +Other changes +------------- + +``__suspend__`` and ``__resume__`` methods are added to +``warnings.catch_warnings`` and ``decimal.localcontext``. + + +Rationale +========= + +In the abstract, we gave an example of plausible but incorrect code:: + + def f(): + with warnings.catch_warnings(): + for x in g(): + yield x + +To make this correct in current Python, we need to instead write +something like:: + + def f(): + with warnings.catch_warnings(): + it = iter(g()) + while True: + with warnings.catch_warnings(): + try: + x = next(it) + except StopIteration: + break + yield x + +OTOH, if this PEP is accepted then the original code will become +correct as-is. Or if this isn't convincing, then here's another +example of broken code; fixing it requires even greater gyrations, and +these are left as an exercise for the reader:: + + def f2(): + with warnings.catch_warnings(record=True) as w: + for x in g(): + yield x + assert len(w) == 1 + assert "xyzzy" in w[0].message + +And notice that this last example isn't artificial at all -- if you +squint, it turns out to be exactly how you write a test that an +asyncio-using coroutine ``g`` correctly raises a warning. Similar +issues arise for pretty much any use of ``warnings.catch_warnings``, +``decimal.localcontext``, or ``numpy.errstate`` in asyncio-using code. +So there's clearly a real problem to solve here, and the growing +prominence of async code makes it increasingly urgent. + + +Alternative approaches +---------------------- + +The main alternative that has been proposed is to create some kind of +"task-local storage", analogous to "thread-local storage" +[#yury-task-local-proposal]_. In essence, the idea would be that the +event loop would take care to allocate a new "task namespace" for each +task it schedules, and provide an API to at any given time fetch the +namespace corresponding to the currently executing task. While there +are many details to be worked out [#task-local-challenges]_, the basic +idea seems doable, and it is an especially natural way to handle the +kind of global context that arises at the top-level of async +application frameworks (e.g., setting up context objects in a web +framework). But it also has a number of flaws: + +* It only solves the problem of managing global state for coroutines + that ``yield`` back to an asynchronous event loop. But there + actually isn't anything about this problem that's specific to + asyncio -- as shown in the examples above, simple generators run + into exactly the same issue. + +* It creates an unnecessary coupling between event loops and code that + needs to manage global state. Obviously an async web framework needs + to interact with some event loop API anyway, so it's not a big deal + in that case. But it's weird that ``warnings`` or ``decimal`` or + NumPy should have to call into an async library's API to access + their internal state when they themselves involve no async code. + Worse, since there are multiple event loop APIs in common use, it + isn't clear how to choose which to integrate with. (This could be + somewhat mitigated by CPython providing a standard API for creating + and switching "task-local domains" that asyncio, Twisted, tornado, + etc. could then work with.) + +* It's not at all clear that this can be made acceptably fast. NumPy + has to check the floating point error settings on every single + arithmetic operation. Checking a piece of data in thread-local + storage is absurdly quick, because modern platforms have put massive + resources into optimizing this case (e.g. dedicating a CPU register + for this purpose); calling a method on an event loop to fetch a + handle to a namespace and then doing lookup in that namespace is + much slower. + + More importantly, this extra cost would be paid on *every* access to + the global data, even for programs which are not otherwise using an + event loop at all. This PEP's proposal, by contrast, only affects + code that actually mixes ``with`` blocks and ``yield`` statements, + meaning that the users who experience the costs are the same users + who also reap the benefits. + +On the other hand, such tight integration between task context and the +event loop does potentially allow other features that are beyond the +scope of the current proposal. For example, an event loop could note +which task namespace was in effect when a task called ``call_soon``, +and arrange that the callback when run would have access to the same +task namespace. Whether this is useful, or even well-defined in the +case of cross-thread calls (what does it mean to have task-local +storage accessed from two threads simultaneously?), is left as a +puzzle for event loop implementors to ponder -- nothing in this +proposal rules out such enhancements as well. It does seem though +that such features would be useful primarily for state that already +has a tight integration with the event loop -- while we might want a +request id to be preserved across ``call_soon``, most people would not +expect:: + + with warnings.catch_warnings(): + loop.call_soon(f) + +to result in ``f`` being run with warnings disabled, which would be +the result if ``call_soon`` preserved global context in general. + + +Backwards compatibility +======================= + +Because ``__suspend__`` and ``__resume__`` are optional and default to +no-ops, all existing context managers continue to work exactly as +before. + +Speed-wise, this proposal adds additional overhead when entering a +``with`` block (where we must now check for the additional methods; +failed attribute lookup in CPython is rather slow, since it involves +allocating an ``AttributeError``), and additional overhead at +suspension points. Since the position of ``with`` blocks and +suspension points is known statically, the compiler can +straightforwardly optimize away this overhead in all cases except +where one actually has a ``yield`` inside a ``with``. + + +Interaction with PEP 492 +======================== + +PEP 492 added new asynchronous context managers, which are like +regular context managers but instead of having regular methods +``__enter__`` and ``__exit__`` they have coroutine methods +``__aenter__`` and ``__aexit__``. + +There are a few options for how to handle these: + +1) Add ``__asuspend__`` and ``__aresume__`` coroutine methods. + + One potential difficulty here is that this would add a complication + to an already complicated part of the bytecode + interpreter. Consider code like:: + + async def f(): + async with MGR: + await g() + + @types.coroutine + def g(): + yield 1 + + In 3.5, ``f`` gets desugared to something like:: + + @types.coroutine + def f(): + yield from MGR.__aenter__() + try: + yield from g() + finally: + yield from MGR.__aexit__() + + With the addition of ``__asuspend__`` / ``__aresume__``, the + ``yield from`` would have to replaced by something like:: + + for SUBVALUE in g(): + yield from MGR.__asuspend__() + yield SUBVALUE + yield from MGR.__aresume__() + + Notice that we've had to introduce a new temporary ``SUBVALUE`` to + hold the value yielded from ``g()`` while we yield from + ``MGR.__asuspend__()``. Where does this temporary go? Currently + ``yield from`` is a single bytecode that doesn't modify the stack + while looping. Also, the above code isn't even complete, because it + skips over the issue of how to direct ``send``/``throw`` calls to + the right place at the right time... + +2) Add plain ``__suspend__`` and ``__resume__`` methods. + +3) Leave async context managers alone for now until we have more + experience with them. + +It isn't entirely clear what use cases even exist in which an async +context manager would need to set coroutine-local-state (= like +thread-local-state, but for a coroutine stack instead of an OS +thread), and couldn't do so via coordination with the coroutine +runner. So this draft tentatively goes with option (3) and punts on +this question until later. + + +References +========== + +.. [#yury-task-local-proposal] https://groups.google.com/forum/#!topic/python-tulip/zix5HQxtElg + https://github.com/python/asyncio/issues/165 + +.. [#task-local-challenges] For example, we would have to decide + whether there is a single task-local namespace shared by all users + (in which case we need a way for multiple third-party libraries to + adjudicate access to this namespace), or else if there are multiple + task-local namespaces, then we need some mechanism for each library + to arrange for their task-local namespaces to be created and + destroyed at appropriate moments. The preliminary patch linked + from the github issue above doesn't seem to provide any mechanism + for such lifecycle management. + + +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: https://hg.python.org/peps From lp_benchmark_robot at intel.com Thu Jun 9 06:49:46 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 9 Jun 2016 11:49:46 +0100 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python Default 2016-06-09 Message-ID: <48aa787a-cdb7-4c7c-a4b5-b8958d050e90@irsmsx153.ger.corp.intel.com> Results for project Python default, build date 2016-06-09 02:02:13 +0000 commit: cc7f63b6847e previous commit: 12d939477b4f revision date: 2016-06-08 22:09:22 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.19% 0.27% 12.67% 14.05% :-| pybench 0.13% -0.27% 1.26% 8.14% :-( regex_v8 2.62% -0.10% -3.79% 4.77% :-| nbody 0.13% -0.12% 1.48% 6.73% :-| json_dump_v2 0.33% -0.31% -0.73% 11.52% :-| normal_startup 0.81% 0.25% 0.12% 6.21% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-default-2016-06-09/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Thu Jun 9 06:50:09 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 9 Jun 2016 11:50:09 +0100 Subject: [Python-checkins] GOOD Benchmark Results for Python 2.7 2016-06-09 Message-ID: No new revisions. Here are the previous results: Results for project Python 2.7, build date 2016-06-09 02:46:13 +0000 commit: 8700f4d09b28 previous commit: b1041ddb1391 revision date: 2016-06-08 12:44:30 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.15% 1.69% 5.38% 3.79% :-) pybench 0.21% -0.11% 5.69% 4.97% :-( regex_v8 0.75% -0.17% -2.71% 10.99% :-) nbody 0.15% -0.33% 8.44% 2.08% :-) json_dump_v2 0.55% 0.02% 2.27% 10.99% :-( normal_startup 2.09% -0.38% -6.12% 2.14% :-) ssbench 0.22% 0.69% 2.35% 1.28% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-2-7-2016-06-09/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Thu Jun 9 09:16:57 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 09 Jun 2016 13:16:57 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Regenerate_Argument_Clinic?= =?utf-8?q?_code_for_issue_=2323026=2E?= Message-ID: <20160609131649.26564.97834.AAD52558@psf.io> https://hg.python.org/cpython/rev/5306f27c53aa changeset: 101819:5306f27c53aa parent: 101815:cc7f63b6847e user: Serhiy Storchaka date: Thu Jun 09 16:01:19 2016 +0300 summary: Regenerate Argument Clinic code for issue #23026. files: PC/clinic/winreg.c.h | 6 ++++-- PC/winreg.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/PC/clinic/winreg.c.h b/PC/clinic/winreg.c.h --- a/PC/clinic/winreg.c.h +++ b/PC/clinic/winreg.c.h @@ -907,7 +907,7 @@ " An integer that specifies the type of the data, one of:\n" " REG_BINARY -- Binary data in any form.\n" " REG_DWORD -- A 32-bit number.\n" -" REG_DWORD_LITTLE_ENDIAN -- A 32-bit number in little-endian format.\n" +" REG_DWORD_LITTLE_ENDIAN -- A 32-bit number in little-endian format. Equivalent to REG_DWORD\n" " REG_DWORD_BIG_ENDIAN -- A 32-bit number in big-endian format.\n" " REG_EXPAND_SZ -- A null-terminated string that contains unexpanded\n" " references to environment variables (for example,\n" @@ -917,6 +917,8 @@ " by two null characters. Note that Python handles\n" " this termination automatically.\n" " REG_NONE -- No defined value type.\n" +" REG_QWORD -- A 64-bit number.\n" +" REG_QWORD_LITTLE_ENDIAN -- A 64-bit number in little-endian format. Equivalent to REG_QWORD.\n" " REG_RESOURCE_LIST -- A device-driver resource list.\n" " REG_SZ -- A null-terminated string.\n" " value\n" @@ -1056,4 +1058,4 @@ exit: return return_value; } -/*[clinic end generated code: output=5e346dccc296f9f1 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=0b71782e9b37b12a input=a9049054013a1b77]*/ diff --git a/PC/winreg.c b/PC/winreg.c --- a/PC/winreg.c +++ b/PC/winreg.c @@ -1657,7 +1657,7 @@ static PyObject * winreg_SetValueEx_impl(PyModuleDef *module, HKEY key, Py_UNICODE *value_name, PyObject *reserved, DWORD type, PyObject *value) -/*[clinic end generated code: output=ea092a935c361582 input=f1b16cbcc3ed4101]*/ +/*[clinic end generated code: output=ea092a935c361582 input=900a9e3990bfb196]*/ { BYTE *data; DWORD len; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 09:16:57 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 09 Jun 2016 13:16:57 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI2MzA1?= =?utf-8?q?=3A_Argument_Clinic_now_escapes_braces=2E_No_need_to_double_the?= =?utf-8?q?m=2E?= Message-ID: <20160609131649.9990.51462.90FFFE83@psf.io> https://hg.python.org/cpython/rev/eeb742d8bf9c changeset: 101820:eeb742d8bf9c branch: 3.5 parent: 101813:eccfb9b597c1 user: Serhiy Storchaka date: Thu Jun 09 16:02:15 2016 +0300 summary: Issue #26305: Argument Clinic now escapes braces. No need to double them. files: Modules/cmathmodule.c | 14 +++++++------- Tools/clinic/clinic.py | 27 ++++++++++++++------------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/Modules/cmathmodule.c b/Modules/cmathmodule.c --- a/Modules/cmathmodule.c +++ b/Modules/cmathmodule.c @@ -27,20 +27,20 @@ self.declare(data) data.return_conversion.append(""" PyFPE_END_PROTECT(_return_value); -if (errno == EDOM) {{ +if (errno == EDOM) { PyErr_SetString(PyExc_ValueError, "math domain error"); goto exit; -}} -else if (errno == ERANGE) {{ +} +else if (errno == ERANGE) { PyErr_SetString(PyExc_OverflowError, "math range error"); goto exit; -}} -else {{ +} +else { return_value = PyComplex_FromCComplex(_return_value); -}} +} """.strip()) [python start generated code]*/ -/*[python end generated code: output=da39a3ee5e6b4b0d input=231019039a6fbb9a]*/ +/*[python end generated code: output=da39a3ee5e6b4b0d input=345daa075b1028e7]*/ #if (FLT_RADIX != 2 && FLT_RADIX != 16) #error "Modules/cmathmodule.c expects FLT_RADIX to be 2 or 16" diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -176,6 +176,13 @@ text.pop() return output() +def format_escape(s): + # double up curly-braces, this string will be used + # as part of a format_map() template later + s = s.replace('{', '{{') + s = s.replace('}', '}}') + return s + def linear_format(s, **kwargs): """ Perform str.format-like substitution, except: @@ -996,7 +1003,7 @@ count_min = sys.maxsize count_max = -1 - add("switch (PyTuple_GET_SIZE(args)) {{\n") + add("switch (PyTuple_GET_SIZE(args)) {\n") for subset in permute_optional_groups(left, required, right): count = len(subset) count_min = min(count_min, count) @@ -1012,7 +1019,6 @@ d = {} d['count'] = count d['name'] = f.name - d['groups'] = sorted(group_ids) d['format_units'] = "".join(p.converter.format_unit for p in subset) parse_arguments = [] @@ -1039,8 +1045,8 @@ s = ' PyErr_SetString(PyExc_TypeError, "{} requires {} to {} arguments");\n' add(s.format(f.full_name, count_min, count_max)) add(' goto exit;\n') - add("}}") - template_dict['option_group_parsing'] = output() + add("}") + template_dict['option_group_parsing'] = format_escape(output()) def render_function(self, clinic, f): if not f: @@ -1135,7 +1141,7 @@ f.return_converter.render(f, data) template_dict['impl_return_type'] = f.return_converter.type - template_dict['declarations'] = "\n".join(data.declarations) + template_dict['declarations'] = format_escape("\n".join(data.declarations)) template_dict['initializers'] = "\n\n".join(data.initializers) template_dict['modifications'] = '\n\n'.join(data.modifications) template_dict['keywords'] = '"' + '", "'.join(data.keywords) + '"' @@ -1143,8 +1149,8 @@ template_dict['parse_arguments'] = ', '.join(data.parse_arguments) template_dict['impl_parameters'] = ", ".join(data.impl_parameters) template_dict['impl_arguments'] = ", ".join(data.impl_arguments) - template_dict['return_conversion'] = "".join(data.return_conversion).rstrip() - template_dict['cleanup'] = "".join(data.cleanup) + template_dict['return_conversion'] = format_escape("".join(data.return_conversion).rstrip()) + template_dict['cleanup'] = format_escape("".join(data.cleanup)) template_dict['return_value'] = data.return_value # used by unpack tuple code generator @@ -2439,12 +2445,7 @@ declaration.append('\nPy_ssize_clean_t ') declaration.append(self.length_name()) declaration.append(';') - s = "".join(declaration) - # double up curly-braces, this string will be used - # as part of a format_map() template later - s = s.replace("{", "{{") - s = s.replace("}", "}}") - return s + return "".join(declaration) def initialize(self): """ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 09:16:57 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 09 Jun 2016 13:16:57 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2326305=3A_Argument_Clinic_now_escapes_braces=2E_?= =?utf-8?q?No_need_to_double_them=2E?= Message-ID: <20160609131650.9860.90419.9FB05CE6@psf.io> https://hg.python.org/cpython/rev/d983c313b8f1 changeset: 101821:d983c313b8f1 parent: 101819:5306f27c53aa parent: 101820:eeb742d8bf9c user: Serhiy Storchaka date: Thu Jun 09 16:03:23 2016 +0300 summary: Issue #26305: Argument Clinic now escapes braces. No need to double them. files: Modules/cmathmodule.c | 14 +++++++------- Tools/clinic/clinic.py | 27 ++++++++++++++------------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/Modules/cmathmodule.c b/Modules/cmathmodule.c --- a/Modules/cmathmodule.c +++ b/Modules/cmathmodule.c @@ -27,20 +27,20 @@ self.declare(data) data.return_conversion.append(""" PyFPE_END_PROTECT(_return_value); -if (errno == EDOM) {{ +if (errno == EDOM) { PyErr_SetString(PyExc_ValueError, "math domain error"); goto exit; -}} -else if (errno == ERANGE) {{ +} +else if (errno == ERANGE) { PyErr_SetString(PyExc_OverflowError, "math range error"); goto exit; -}} -else {{ +} +else { return_value = PyComplex_FromCComplex(_return_value); -}} +} """.strip()) [python start generated code]*/ -/*[python end generated code: output=da39a3ee5e6b4b0d input=231019039a6fbb9a]*/ +/*[python end generated code: output=da39a3ee5e6b4b0d input=345daa075b1028e7]*/ #if (FLT_RADIX != 2 && FLT_RADIX != 16) #error "Modules/cmathmodule.c expects FLT_RADIX to be 2 or 16" diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -176,6 +176,13 @@ text.pop() return output() +def format_escape(s): + # double up curly-braces, this string will be used + # as part of a format_map() template later + s = s.replace('{', '{{') + s = s.replace('}', '}}') + return s + def linear_format(s, **kwargs): """ Perform str.format-like substitution, except: @@ -996,7 +1003,7 @@ count_min = sys.maxsize count_max = -1 - add("switch (PyTuple_GET_SIZE(args)) {{\n") + add("switch (PyTuple_GET_SIZE(args)) {\n") for subset in permute_optional_groups(left, required, right): count = len(subset) count_min = min(count_min, count) @@ -1012,7 +1019,6 @@ d = {} d['count'] = count d['name'] = f.name - d['groups'] = sorted(group_ids) d['format_units'] = "".join(p.converter.format_unit for p in subset) parse_arguments = [] @@ -1039,8 +1045,8 @@ s = ' PyErr_SetString(PyExc_TypeError, "{} requires {} to {} arguments");\n' add(s.format(f.full_name, count_min, count_max)) add(' goto exit;\n') - add("}}") - template_dict['option_group_parsing'] = output() + add("}") + template_dict['option_group_parsing'] = format_escape(output()) def render_function(self, clinic, f): if not f: @@ -1135,7 +1141,7 @@ f.return_converter.render(f, data) template_dict['impl_return_type'] = f.return_converter.type - template_dict['declarations'] = "\n".join(data.declarations) + template_dict['declarations'] = format_escape("\n".join(data.declarations)) template_dict['initializers'] = "\n\n".join(data.initializers) template_dict['modifications'] = '\n\n'.join(data.modifications) template_dict['keywords'] = '"' + '", "'.join(data.keywords) + '"' @@ -1143,8 +1149,8 @@ template_dict['parse_arguments'] = ', '.join(data.parse_arguments) template_dict['impl_parameters'] = ", ".join(data.impl_parameters) template_dict['impl_arguments'] = ", ".join(data.impl_arguments) - template_dict['return_conversion'] = "".join(data.return_conversion).rstrip() - template_dict['cleanup'] = "".join(data.cleanup) + template_dict['return_conversion'] = format_escape("".join(data.return_conversion).rstrip()) + template_dict['cleanup'] = format_escape("".join(data.cleanup)) template_dict['return_value'] = data.return_value # used by unpack tuple code generator @@ -2439,12 +2445,7 @@ declaration.append('\nPy_ssize_clean_t ') declaration.append(self.length_name()) declaration.append(';') - s = "".join(declaration) - # double up curly-braces, this string will be used - # as part of a format_map() template later - s = s.replace("{", "{{") - s = s.replace("}", "}}") - return s + return "".join(declaration) def initialize(self): """ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 09:18:04 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 09 Jun 2016 13:18:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2326305=3A_Argument?= =?utf-8?q?_Clinic_now_uses_braces_in_C_code_as_required_by_PEP_7=2E?= Message-ID: <20160609131650.81140.78490.7A04C9C2@psf.io> https://hg.python.org/cpython/rev/2d7dcd8cf928 changeset: 101822:2d7dcd8cf928 user: Serhiy Storchaka date: Thu Jun 09 16:16:06 2016 +0300 summary: Issue #26305: Argument Clinic now uses braces in C code as required by PEP 7. files: Modules/_io/clinic/_iomodule.c.h | 5 +- Modules/_io/clinic/bufferedio.c.h | 65 +- Modules/_io/clinic/bytesio.c.h | 26 +- Modules/_io/clinic/fileio.c.h | 26 +- Modules/_io/clinic/iobase.c.h | 11 +- Modules/_io/clinic/stringio.c.h | 17 +- Modules/_io/clinic/textio.c.h | 26 +- Modules/_winapi.c | 4 +- Modules/cjkcodecs/clinic/multibytecodec.c.h | 29 +- Modules/clinic/_bz2module.c.h | 26 +- Modules/clinic/_codecsmodule.c.h | 191 ++- Modules/clinic/_cryptmodule.c.h | 5 +- Modules/clinic/_cursesmodule.c.h | 14 +- Modules/clinic/_datetimemodule.c.h | 5 +- Modules/clinic/_dbmmodule.c.h | 11 +- Modules/clinic/_elementtree.c.h | 53 +- Modules/clinic/_gdbmmodule.c.h | 14 +- Modules/clinic/_lzmamodule.c.h | 29 +- Modules/clinic/_opcode.c.h | 8 +- Modules/clinic/_pickle.c.h | 29 +- Modules/clinic/_sre.c.h | 71 +- Modules/clinic/_ssl.c.h | 101 +- Modules/clinic/_tkinter.c.h | 53 +- Modules/clinic/_weakref.c.h | 5 +- Modules/clinic/_winapi.c.h | 116 +- Modules/clinic/arraymodule.c.h | 29 +- Modules/clinic/audioop.c.h | 167 ++- Modules/clinic/binascii.c.h | 86 +- Modules/clinic/cmathmodule.c.h | 74 +- Modules/clinic/fcntlmodule.c.h | 14 +- Modules/clinic/grpmodule.c.h | 8 +- Modules/clinic/md5module.c.h | 5 +- Modules/clinic/posixmodule.c.h | 482 ++++++--- Modules/clinic/pwdmodule.c.h | 5 +- Modules/clinic/pyexpat.c.h | 23 +- Modules/clinic/sha1module.c.h | 5 +- Modules/clinic/sha256module.c.h | 8 +- Modules/clinic/sha512module.c.h | 8 +- Modules/clinic/signalmodule.c.h | 32 +- Modules/clinic/spwdmodule.c.h | 5 +- Modules/clinic/unicodedata.c.h | 44 +- Modules/clinic/zlibmodule.c.h | 53 +- Objects/clinic/bytearrayobject.c.h | 65 +- Objects/clinic/bytesobject.c.h | 62 +- Objects/clinic/dictobject.c.h | 5 +- Objects/clinic/unicodeobject.c.h | 5 +- PC/clinic/msvcrtmodule.c.h | 59 +- PC/clinic/winreg.c.h | 86 +- PC/clinic/winsound.c.h | 11 +- Python/clinic/bltinmodule.c.h | 44 +- Python/clinic/import.c.h | 29 +- Tools/clinic/clinic.py | 37 +- 52 files changed, 1575 insertions(+), 816 deletions(-) diff --git a/Modules/_io/clinic/_iomodule.c.h b/Modules/_io/clinic/_iomodule.c.h --- a/Modules/_io/clinic/_iomodule.c.h +++ b/Modules/_io/clinic/_iomodule.c.h @@ -149,11 +149,12 @@ PyObject *opener = Py_None; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|sizzziO:open", _keywords, - &file, &mode, &buffering, &encoding, &errors, &newline, &closefd, &opener)) + &file, &mode, &buffering, &encoding, &errors, &newline, &closefd, &opener)) { goto exit; + } return_value = _io_open_impl(module, file, mode, buffering, encoding, errors, newline, closefd, opener); exit: return return_value; } -/*[clinic end generated code: output=97cdc09bf68a8064 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=079f597e71e9f0c6 input=a9049054013a1b77]*/ diff --git a/Modules/_io/clinic/bufferedio.c.h b/Modules/_io/clinic/bufferedio.c.h --- a/Modules/_io/clinic/bufferedio.c.h +++ b/Modules/_io/clinic/bufferedio.c.h @@ -19,14 +19,16 @@ PyObject *return_value = NULL; Py_buffer buffer = {NULL, NULL}; - if (!PyArg_Parse(arg, "w*:readinto", &buffer)) + if (!PyArg_Parse(arg, "w*:readinto", &buffer)) { goto exit; + } return_value = _io__BufferedIOBase_readinto_impl(self, &buffer); exit: /* Cleanup for buffer */ - if (buffer.obj) + if (buffer.obj) { PyBuffer_Release(&buffer); + } return return_value; } @@ -48,14 +50,16 @@ PyObject *return_value = NULL; Py_buffer buffer = {NULL, NULL}; - if (!PyArg_Parse(arg, "w*:readinto1", &buffer)) + if (!PyArg_Parse(arg, "w*:readinto1", &buffer)) { goto exit; + } return_value = _io__BufferedIOBase_readinto1_impl(self, &buffer); exit: /* Cleanup for buffer */ - if (buffer.obj) + if (buffer.obj) { PyBuffer_Release(&buffer); + } return return_value; } @@ -99,8 +103,9 @@ Py_ssize_t size = 0; if (!PyArg_ParseTuple(args, "|n:peek", - &size)) + &size)) { goto exit; + } return_value = _io__Buffered_peek_impl(self, size); exit: @@ -125,8 +130,9 @@ Py_ssize_t n = -1; if (!PyArg_ParseTuple(args, "|O&:read", - _PyIO_ConvertSsize_t, &n)) + _PyIO_ConvertSsize_t, &n)) { goto exit; + } return_value = _io__Buffered_read_impl(self, n); exit: @@ -150,8 +156,9 @@ PyObject *return_value = NULL; Py_ssize_t n; - if (!PyArg_Parse(arg, "n:read1", &n)) + if (!PyArg_Parse(arg, "n:read1", &n)) { goto exit; + } return_value = _io__Buffered_read1_impl(self, n); exit: @@ -175,14 +182,16 @@ PyObject *return_value = NULL; Py_buffer buffer = {NULL, NULL}; - if (!PyArg_Parse(arg, "w*:readinto", &buffer)) + if (!PyArg_Parse(arg, "w*:readinto", &buffer)) { goto exit; + } return_value = _io__Buffered_readinto_impl(self, &buffer); exit: /* Cleanup for buffer */ - if (buffer.obj) + if (buffer.obj) { PyBuffer_Release(&buffer); + } return return_value; } @@ -204,14 +213,16 @@ PyObject *return_value = NULL; Py_buffer buffer = {NULL, NULL}; - if (!PyArg_Parse(arg, "w*:readinto1", &buffer)) + if (!PyArg_Parse(arg, "w*:readinto1", &buffer)) { goto exit; + } return_value = _io__Buffered_readinto1_impl(self, &buffer); exit: /* Cleanup for buffer */ - if (buffer.obj) + if (buffer.obj) { PyBuffer_Release(&buffer); + } return return_value; } @@ -234,8 +245,9 @@ Py_ssize_t size = -1; if (!PyArg_ParseTuple(args, "|O&:readline", - _PyIO_ConvertSsize_t, &size)) + _PyIO_ConvertSsize_t, &size)) { goto exit; + } return_value = _io__Buffered_readline_impl(self, size); exit: @@ -261,8 +273,9 @@ int whence = 0; if (!PyArg_ParseTuple(args, "O|i:seek", - &targetobj, &whence)) + &targetobj, &whence)) { goto exit; + } return_value = _io__Buffered_seek_impl(self, targetobj, whence); exit: @@ -288,8 +301,9 @@ if (!PyArg_UnpackTuple(args, "truncate", 0, 1, - &pos)) + &pos)) { goto exit; + } return_value = _io__Buffered_truncate_impl(self, pos); exit: @@ -315,8 +329,9 @@ Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|n:BufferedReader", _keywords, - &raw, &buffer_size)) + &raw, &buffer_size)) { goto exit; + } return_value = _io_BufferedReader___init___impl((buffered *)self, raw, buffer_size); exit: @@ -346,8 +361,9 @@ Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|n:BufferedWriter", _keywords, - &raw, &buffer_size)) + &raw, &buffer_size)) { goto exit; + } return_value = _io_BufferedWriter___init___impl((buffered *)self, raw, buffer_size); exit: @@ -371,14 +387,16 @@ PyObject *return_value = NULL; Py_buffer buffer = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:write", &buffer)) + if (!PyArg_Parse(arg, "y*:write", &buffer)) { goto exit; + } return_value = _io_BufferedWriter_write_impl(self, &buffer); exit: /* Cleanup for buffer */ - if (buffer.obj) + if (buffer.obj) { PyBuffer_Release(&buffer); + } return return_value; } @@ -410,11 +428,13 @@ Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; if ((Py_TYPE(self) == &PyBufferedRWPair_Type) && - !_PyArg_NoKeywords("BufferedRWPair", kwargs)) + !_PyArg_NoKeywords("BufferedRWPair", kwargs)) { goto exit; + } if (!PyArg_ParseTuple(args, "OO|n:BufferedRWPair", - &reader, &writer, &buffer_size)) + &reader, &writer, &buffer_size)) { goto exit; + } return_value = _io_BufferedRWPair___init___impl((rwpair *)self, reader, writer, buffer_size); exit: @@ -444,11 +464,12 @@ Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|n:BufferedRandom", _keywords, - &raw, &buffer_size)) + &raw, &buffer_size)) { goto exit; + } return_value = _io_BufferedRandom___init___impl((buffered *)self, raw, buffer_size); exit: return return_value; } -/*[clinic end generated code: output=2bbb5e239b4ffe6f input=a9049054013a1b77]*/ +/*[clinic end generated code: output=4f6196c756b880c8 input=a9049054013a1b77]*/ diff --git a/Modules/_io/clinic/bytesio.c.h b/Modules/_io/clinic/bytesio.c.h --- a/Modules/_io/clinic/bytesio.c.h +++ b/Modules/_io/clinic/bytesio.c.h @@ -171,8 +171,9 @@ if (!PyArg_UnpackTuple(args, "read", 0, 1, - &arg)) + &arg)) { goto exit; + } return_value = _io_BytesIO_read_impl(self, arg); exit: @@ -215,8 +216,9 @@ if (!PyArg_UnpackTuple(args, "readline", 0, 1, - &arg)) + &arg)) { goto exit; + } return_value = _io_BytesIO_readline_impl(self, arg); exit: @@ -247,8 +249,9 @@ if (!PyArg_UnpackTuple(args, "readlines", 0, 1, - &arg)) + &arg)) { goto exit; + } return_value = _io_BytesIO_readlines_impl(self, arg); exit: @@ -276,14 +279,16 @@ PyObject *return_value = NULL; Py_buffer buffer = {NULL, NULL}; - if (!PyArg_Parse(arg, "w*:readinto", &buffer)) + if (!PyArg_Parse(arg, "w*:readinto", &buffer)) { goto exit; + } return_value = _io_BytesIO_readinto_impl(self, &buffer); exit: /* Cleanup for buffer */ - if (buffer.obj) + if (buffer.obj) { PyBuffer_Release(&buffer); + } return return_value; } @@ -311,8 +316,9 @@ if (!PyArg_UnpackTuple(args, "truncate", 0, 1, - &arg)) + &arg)) { goto exit; + } return_value = _io_BytesIO_truncate_impl(self, arg); exit: @@ -345,8 +351,9 @@ int whence = 0; if (!PyArg_ParseTuple(args, "n|i:seek", - &pos, &whence)) + &pos, &whence)) { goto exit; + } return_value = _io_BytesIO_seek_impl(self, pos, whence); exit: @@ -412,11 +419,12 @@ PyObject *initvalue = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:BytesIO", _keywords, - &initvalue)) + &initvalue)) { goto exit; + } return_value = _io_BytesIO___init___impl((bytesio *)self, initvalue); exit: return return_value; } -/*[clinic end generated code: output=60ce2c6272718431 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=3fdb62f3e3b0544d input=a9049054013a1b77]*/ diff --git a/Modules/_io/clinic/fileio.c.h b/Modules/_io/clinic/fileio.c.h --- a/Modules/_io/clinic/fileio.c.h +++ b/Modules/_io/clinic/fileio.c.h @@ -56,8 +56,9 @@ PyObject *opener = Py_None; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|siO:FileIO", _keywords, - &nameobj, &mode, &closefd, &opener)) + &nameobj, &mode, &closefd, &opener)) { goto exit; + } return_value = _io_FileIO___init___impl((fileio *)self, nameobj, mode, closefd, opener); exit: @@ -154,14 +155,16 @@ PyObject *return_value = NULL; Py_buffer buffer = {NULL, NULL}; - if (!PyArg_Parse(arg, "w*:readinto", &buffer)) + if (!PyArg_Parse(arg, "w*:readinto", &buffer)) { goto exit; + } return_value = _io_FileIO_readinto_impl(self, &buffer); exit: /* Cleanup for buffer */ - if (buffer.obj) + if (buffer.obj) { PyBuffer_Release(&buffer); + } return return_value; } @@ -210,8 +213,9 @@ Py_ssize_t size = -1; if (!PyArg_ParseTuple(args, "|O&:read", - _PyIO_ConvertSsize_t, &size)) + _PyIO_ConvertSsize_t, &size)) { goto exit; + } return_value = _io_FileIO_read_impl(self, size); exit: @@ -240,14 +244,16 @@ PyObject *return_value = NULL; Py_buffer b = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:write", &b)) + if (!PyArg_Parse(arg, "y*:write", &b)) { goto exit; + } return_value = _io_FileIO_write_impl(self, &b); exit: /* Cleanup for b */ - if (b.obj) + if (b.obj) { PyBuffer_Release(&b); + } return return_value; } @@ -280,8 +286,9 @@ int whence = 0; if (!PyArg_ParseTuple(args, "O|i:seek", - &pos, &whence)) + &pos, &whence)) { goto exit; + } return_value = _io_FileIO_seek_impl(self, pos, whence); exit: @@ -333,8 +340,9 @@ if (!PyArg_UnpackTuple(args, "truncate", 0, 1, - &posobj)) + &posobj)) { goto exit; + } return_value = _io_FileIO_truncate_impl(self, posobj); exit: @@ -364,4 +372,4 @@ #ifndef _IO_FILEIO_TRUNCATE_METHODDEF #define _IO_FILEIO_TRUNCATE_METHODDEF #endif /* !defined(_IO_FILEIO_TRUNCATE_METHODDEF) */ -/*[clinic end generated code: output=dcbc39b466598492 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=bf4b4bd6b976346d input=a9049054013a1b77]*/ diff --git a/Modules/_io/clinic/iobase.c.h b/Modules/_io/clinic/iobase.c.h --- a/Modules/_io/clinic/iobase.c.h +++ b/Modules/_io/clinic/iobase.c.h @@ -186,8 +186,9 @@ Py_ssize_t limit = -1; if (!PyArg_ParseTuple(args, "|O&:readline", - _PyIO_ConvertSsize_t, &limit)) + _PyIO_ConvertSsize_t, &limit)) { goto exit; + } return_value = _io__IOBase_readline_impl(self, limit); exit: @@ -217,8 +218,9 @@ Py_ssize_t hint = -1; if (!PyArg_ParseTuple(args, "|O&:readlines", - _PyIO_ConvertSsize_t, &hint)) + _PyIO_ConvertSsize_t, &hint)) { goto exit; + } return_value = _io__IOBase_readlines_impl(self, hint); exit: @@ -251,8 +253,9 @@ Py_ssize_t n = -1; if (!PyArg_ParseTuple(args, "|n:read", - &n)) + &n)) { goto exit; + } return_value = _io__RawIOBase_read_impl(self, n); exit: @@ -276,4 +279,4 @@ { return _io__RawIOBase_readall_impl(self); } -/*[clinic end generated code: output=b874952f5cc248a4 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=0f53fed928d8e02f input=a9049054013a1b77]*/ diff --git a/Modules/_io/clinic/stringio.c.h b/Modules/_io/clinic/stringio.c.h --- a/Modules/_io/clinic/stringio.c.h +++ b/Modules/_io/clinic/stringio.c.h @@ -61,8 +61,9 @@ if (!PyArg_UnpackTuple(args, "read", 0, 1, - &arg)) + &arg)) { goto exit; + } return_value = _io_StringIO_read_impl(self, arg); exit: @@ -91,8 +92,9 @@ if (!PyArg_UnpackTuple(args, "readline", 0, 1, - &arg)) + &arg)) { goto exit; + } return_value = _io_StringIO_readline_impl(self, arg); exit: @@ -123,8 +125,9 @@ if (!PyArg_UnpackTuple(args, "truncate", 0, 1, - &arg)) + &arg)) { goto exit; + } return_value = _io_StringIO_truncate_impl(self, arg); exit: @@ -157,8 +160,9 @@ int whence = 0; if (!PyArg_ParseTuple(args, "n|i:seek", - &pos, &whence)) + &pos, &whence)) { goto exit; + } return_value = _io_StringIO_seek_impl(self, pos, whence); exit: @@ -222,8 +226,9 @@ PyObject *newline_obj = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OO:StringIO", _keywords, - &value, &newline_obj)) + &value, &newline_obj)) { goto exit; + } return_value = _io_StringIO___init___impl((stringio *)self, value, newline_obj); exit: @@ -283,4 +288,4 @@ { return _io_StringIO_seekable_impl(self); } -/*[clinic end generated code: output=f061cf3a20cd14ed input=a9049054013a1b77]*/ +/*[clinic end generated code: output=0513219581cbe952 input=a9049054013a1b77]*/ diff --git a/Modules/_io/clinic/textio.c.h b/Modules/_io/clinic/textio.c.h --- a/Modules/_io/clinic/textio.c.h +++ b/Modules/_io/clinic/textio.c.h @@ -30,8 +30,9 @@ PyObject *errors = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Oi|O:IncrementalNewlineDecoder", _keywords, - &decoder, &translate, &errors)) + &decoder, &translate, &errors)) { goto exit; + } return_value = _io_IncrementalNewlineDecoder___init___impl((nldecoder_object *)self, decoder, translate, errors); exit: @@ -59,8 +60,9 @@ int final = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i:decode", _keywords, - &input, &final)) + &input, &final)) { goto exit; + } return_value = _io_IncrementalNewlineDecoder_decode_impl(self, input, final); exit: @@ -162,8 +164,9 @@ int write_through = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|zzzii:TextIOWrapper", _keywords, - &buffer, &encoding, &errors, &newline, &line_buffering, &write_through)) + &buffer, &encoding, &errors, &newline, &line_buffering, &write_through)) { goto exit; + } return_value = _io_TextIOWrapper___init___impl((textio *)self, buffer, encoding, errors, newline, line_buffering, write_through); exit: @@ -204,8 +207,9 @@ PyObject *return_value = NULL; PyObject *text; - if (!PyArg_Parse(arg, "U:write", &text)) + if (!PyArg_Parse(arg, "U:write", &text)) { goto exit; + } return_value = _io_TextIOWrapper_write_impl(self, text); exit: @@ -230,8 +234,9 @@ Py_ssize_t n = -1; if (!PyArg_ParseTuple(args, "|O&:read", - _PyIO_ConvertSsize_t, &n)) + _PyIO_ConvertSsize_t, &n)) { goto exit; + } return_value = _io_TextIOWrapper_read_impl(self, n); exit: @@ -256,8 +261,9 @@ Py_ssize_t size = -1; if (!PyArg_ParseTuple(args, "|n:readline", - &size)) + &size)) { goto exit; + } return_value = _io_TextIOWrapper_readline_impl(self, size); exit: @@ -283,8 +289,9 @@ int whence = 0; if (!PyArg_ParseTuple(args, "O|i:seek", - &cookieObj, &whence)) + &cookieObj, &whence)) { goto exit; + } return_value = _io_TextIOWrapper_seek_impl(self, cookieObj, whence); exit: @@ -327,8 +334,9 @@ if (!PyArg_UnpackTuple(args, "truncate", 0, 1, - &pos)) + &pos)) { goto exit; + } return_value = _io_TextIOWrapper_truncate_impl(self, pos); exit: @@ -453,4 +461,4 @@ { return _io_TextIOWrapper_close_impl(self); } -/*[clinic end generated code: output=690608f85aab8ba5 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=31a39bbbe07ae4e7 input=a9049054013a1b77]*/ diff --git a/Modules/_winapi.c b/Modules/_winapi.c --- a/Modules/_winapi.c +++ b/Modules/_winapi.c @@ -175,7 +175,7 @@ self.declare(data) self.err_occurred_if("_return_value == INVALID_HANDLE_VALUE", data) data.return_conversion.append( - 'if (_return_value == NULL)\n Py_RETURN_NONE;\n') + 'if (_return_value == NULL) {\n Py_RETURN_NONE;\n}\n') data.return_conversion.append( 'return_value = HANDLE_TO_PYNUM(_return_value);\n') @@ -188,7 +188,7 @@ data.return_conversion.append( 'return_value = Py_BuildValue("k", _return_value);\n') [python start generated code]*/ -/*[python end generated code: output=da39a3ee5e6b4b0d input=374076979596ebba]*/ +/*[python end generated code: output=da39a3ee5e6b4b0d input=94819e72d2c6d558]*/ #include "clinic/_winapi.c.h" diff --git a/Modules/cjkcodecs/clinic/multibytecodec.c.h b/Modules/cjkcodecs/clinic/multibytecodec.c.h --- a/Modules/cjkcodecs/clinic/multibytecodec.c.h +++ b/Modules/cjkcodecs/clinic/multibytecodec.c.h @@ -30,8 +30,9 @@ const char *errors = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|z:encode", _keywords, - &input, &errors)) + &input, &errors)) { goto exit; + } return_value = _multibytecodec_MultibyteCodec_encode_impl(self, input, errors); exit: @@ -66,14 +67,16 @@ const char *errors = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|z:decode", _keywords, - &input, &errors)) + &input, &errors)) { goto exit; + } return_value = _multibytecodec_MultibyteCodec_decode_impl(self, &input, errors); exit: /* Cleanup for input */ - if (input.obj) + if (input.obj) { PyBuffer_Release(&input); + } return return_value; } @@ -100,8 +103,9 @@ int final = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i:encode", _keywords, - &input, &final)) + &input, &final)) { goto exit; + } return_value = _multibytecodec_MultibyteIncrementalEncoder_encode_impl(self, input, final); exit: @@ -147,14 +151,16 @@ int final = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|i:decode", _keywords, - &input, &final)) + &input, &final)) { goto exit; + } return_value = _multibytecodec_MultibyteIncrementalDecoder_decode_impl(self, &input, final); exit: /* Cleanup for input */ - if (input.obj) + if (input.obj) { PyBuffer_Release(&input); + } return return_value; } @@ -196,8 +202,9 @@ if (!PyArg_UnpackTuple(args, "read", 0, 1, - &sizeobj)) + &sizeobj)) { goto exit; + } return_value = _multibytecodec_MultibyteStreamReader_read_impl(self, sizeobj); exit: @@ -224,8 +231,9 @@ if (!PyArg_UnpackTuple(args, "readline", 0, 1, - &sizeobj)) + &sizeobj)) { goto exit; + } return_value = _multibytecodec_MultibyteStreamReader_readline_impl(self, sizeobj); exit: @@ -252,8 +260,9 @@ if (!PyArg_UnpackTuple(args, "readlines", 0, 1, - &sizehintobj)) + &sizehintobj)) { goto exit; + } return_value = _multibytecodec_MultibyteStreamReader_readlines_impl(self, sizehintobj); exit: @@ -317,4 +326,4 @@ #define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \ {"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__}, -/*[clinic end generated code: output=eebb21e18c3043d1 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=f837bc56b2fa2a4e input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_bz2module.c.h b/Modules/clinic/_bz2module.c.h --- a/Modules/clinic/_bz2module.c.h +++ b/Modules/clinic/_bz2module.c.h @@ -25,14 +25,16 @@ PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:compress", &data)) + if (!PyArg_Parse(arg, "y*:compress", &data)) { goto exit; + } return_value = _bz2_BZ2Compressor_compress_impl(self, &data); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -80,11 +82,13 @@ int compresslevel = 9; if ((Py_TYPE(self) == &BZ2Compressor_Type) && - !_PyArg_NoKeywords("BZ2Compressor", kwargs)) + !_PyArg_NoKeywords("BZ2Compressor", kwargs)) { goto exit; + } if (!PyArg_ParseTuple(args, "|i:BZ2Compressor", - &compresslevel)) + &compresslevel)) { goto exit; + } return_value = _bz2_BZ2Compressor___init___impl((BZ2Compressor *)self, compresslevel); exit: @@ -126,14 +130,16 @@ Py_ssize_t max_length = -1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|n:decompress", _keywords, - &data, &max_length)) + &data, &max_length)) { goto exit; + } return_value = _bz2_BZ2Decompressor_decompress_impl(self, &data, max_length); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -155,14 +161,16 @@ int return_value = -1; if ((Py_TYPE(self) == &BZ2Decompressor_Type) && - !_PyArg_NoPositional("BZ2Decompressor", args)) + !_PyArg_NoPositional("BZ2Decompressor", args)) { goto exit; + } if ((Py_TYPE(self) == &BZ2Decompressor_Type) && - !_PyArg_NoKeywords("BZ2Decompressor", kwargs)) + !_PyArg_NoKeywords("BZ2Decompressor", kwargs)) { goto exit; + } return_value = _bz2_BZ2Decompressor___init___impl((BZ2Decompressor *)self); exit: return return_value; } -/*[clinic end generated code: output=fef29b76b3314fc7 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=71be22f38224fe84 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_codecsmodule.c.h b/Modules/clinic/_codecsmodule.c.h --- a/Modules/clinic/_codecsmodule.c.h +++ b/Modules/clinic/_codecsmodule.c.h @@ -33,8 +33,9 @@ PyObject *return_value = NULL; const char *encoding; - if (!PyArg_Parse(arg, "s:lookup", &encoding)) + if (!PyArg_Parse(arg, "s:lookup", &encoding)) { goto exit; + } return_value = _codecs_lookup_impl(module, encoding); exit: @@ -70,8 +71,9 @@ const char *errors = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|ss:encode", _keywords, - &obj, &encoding, &errors)) + &obj, &encoding, &errors)) { goto exit; + } return_value = _codecs_encode_impl(module, obj, encoding, errors); exit: @@ -107,8 +109,9 @@ const char *errors = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|ss:decode", _keywords, - &obj, &encoding, &errors)) + &obj, &encoding, &errors)) { goto exit; + } return_value = _codecs_decode_impl(module, obj, encoding, errors); exit: @@ -133,8 +136,9 @@ PyObject *return_value = NULL; const char *encoding; - if (!PyArg_Parse(arg, "s:_forget_codec", &encoding)) + if (!PyArg_Parse(arg, "s:_forget_codec", &encoding)) { goto exit; + } return_value = _codecs__forget_codec_impl(module, encoding); exit: @@ -161,14 +165,16 @@ const char *errors = NULL; if (!PyArg_ParseTuple(args, "s*|z:escape_decode", - &data, &errors)) + &data, &errors)) { goto exit; + } return_value = _codecs_escape_decode_impl(module, &data, errors); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -193,8 +199,9 @@ const char *errors = NULL; if (!PyArg_ParseTuple(args, "O!|z:escape_encode", - &PyBytes_Type, &data, &errors)) + &PyBytes_Type, &data, &errors)) { goto exit; + } return_value = _codecs_escape_encode_impl(module, data, errors); exit: @@ -221,8 +228,9 @@ const char *errors = NULL; if (!PyArg_ParseTuple(args, "O|z:unicode_internal_decode", - &obj, &errors)) + &obj, &errors)) { goto exit; + } return_value = _codecs_unicode_internal_decode_impl(module, obj, errors); exit: @@ -250,14 +258,16 @@ int final = 0; if (!PyArg_ParseTuple(args, "y*|zi:utf_7_decode", - &data, &errors, &final)) + &data, &errors, &final)) { goto exit; + } return_value = _codecs_utf_7_decode_impl(module, &data, errors, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -283,14 +293,16 @@ int final = 0; if (!PyArg_ParseTuple(args, "y*|zi:utf_8_decode", - &data, &errors, &final)) + &data, &errors, &final)) { goto exit; + } return_value = _codecs_utf_8_decode_impl(module, &data, errors, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -316,14 +328,16 @@ int final = 0; if (!PyArg_ParseTuple(args, "y*|zi:utf_16_decode", - &data, &errors, &final)) + &data, &errors, &final)) { goto exit; + } return_value = _codecs_utf_16_decode_impl(module, &data, errors, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -349,14 +363,16 @@ int final = 0; if (!PyArg_ParseTuple(args, "y*|zi:utf_16_le_decode", - &data, &errors, &final)) + &data, &errors, &final)) { goto exit; + } return_value = _codecs_utf_16_le_decode_impl(module, &data, errors, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -382,14 +398,16 @@ int final = 0; if (!PyArg_ParseTuple(args, "y*|zi:utf_16_be_decode", - &data, &errors, &final)) + &data, &errors, &final)) { goto exit; + } return_value = _codecs_utf_16_be_decode_impl(module, &data, errors, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -417,14 +435,16 @@ int final = 0; if (!PyArg_ParseTuple(args, "y*|zii:utf_16_ex_decode", - &data, &errors, &byteorder, &final)) + &data, &errors, &byteorder, &final)) { goto exit; + } return_value = _codecs_utf_16_ex_decode_impl(module, &data, errors, byteorder, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -450,14 +470,16 @@ int final = 0; if (!PyArg_ParseTuple(args, "y*|zi:utf_32_decode", - &data, &errors, &final)) + &data, &errors, &final)) { goto exit; + } return_value = _codecs_utf_32_decode_impl(module, &data, errors, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -483,14 +505,16 @@ int final = 0; if (!PyArg_ParseTuple(args, "y*|zi:utf_32_le_decode", - &data, &errors, &final)) + &data, &errors, &final)) { goto exit; + } return_value = _codecs_utf_32_le_decode_impl(module, &data, errors, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -516,14 +540,16 @@ int final = 0; if (!PyArg_ParseTuple(args, "y*|zi:utf_32_be_decode", - &data, &errors, &final)) + &data, &errors, &final)) { goto exit; + } return_value = _codecs_utf_32_be_decode_impl(module, &data, errors, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -551,14 +577,16 @@ int final = 0; if (!PyArg_ParseTuple(args, "y*|zii:utf_32_ex_decode", - &data, &errors, &byteorder, &final)) + &data, &errors, &byteorder, &final)) { goto exit; + } return_value = _codecs_utf_32_ex_decode_impl(module, &data, errors, byteorder, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -583,14 +611,16 @@ const char *errors = NULL; if (!PyArg_ParseTuple(args, "s*|z:unicode_escape_decode", - &data, &errors)) + &data, &errors)) { goto exit; + } return_value = _codecs_unicode_escape_decode_impl(module, &data, errors); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -615,14 +645,16 @@ const char *errors = NULL; if (!PyArg_ParseTuple(args, "s*|z:raw_unicode_escape_decode", - &data, &errors)) + &data, &errors)) { goto exit; + } return_value = _codecs_raw_unicode_escape_decode_impl(module, &data, errors); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -647,14 +679,16 @@ const char *errors = NULL; if (!PyArg_ParseTuple(args, "y*|z:latin_1_decode", - &data, &errors)) + &data, &errors)) { goto exit; + } return_value = _codecs_latin_1_decode_impl(module, &data, errors); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -679,14 +713,16 @@ const char *errors = NULL; if (!PyArg_ParseTuple(args, "y*|z:ascii_decode", - &data, &errors)) + &data, &errors)) { goto exit; + } return_value = _codecs_ascii_decode_impl(module, &data, errors); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -712,14 +748,16 @@ PyObject *mapping = NULL; if (!PyArg_ParseTuple(args, "y*|zO:charmap_decode", - &data, &errors, &mapping)) + &data, &errors, &mapping)) { goto exit; + } return_value = _codecs_charmap_decode_impl(module, &data, errors, mapping); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -747,14 +785,16 @@ int final = 0; if (!PyArg_ParseTuple(args, "y*|zi:mbcs_decode", - &data, &errors, &final)) + &data, &errors, &final)) { goto exit; + } return_value = _codecs_mbcs_decode_impl(module, &data, errors, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -785,14 +825,16 @@ int final = 0; if (!PyArg_ParseTuple(args, "iy*|zi:code_page_decode", - &codepage, &data, &errors, &final)) + &codepage, &data, &errors, &final)) { goto exit; + } return_value = _codecs_code_page_decode_impl(module, codepage, &data, errors, final); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -819,14 +861,16 @@ const char *errors = NULL; if (!PyArg_ParseTuple(args, "s*|z:readbuffer_encode", - &data, &errors)) + &data, &errors)) { goto exit; + } return_value = _codecs_readbuffer_encode_impl(module, &data, errors); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -851,8 +895,9 @@ const char *errors = NULL; if (!PyArg_ParseTuple(args, "O|z:unicode_internal_encode", - &obj, &errors)) + &obj, &errors)) { goto exit; + } return_value = _codecs_unicode_internal_encode_impl(module, obj, errors); exit: @@ -879,8 +924,9 @@ const char *errors = NULL; if (!PyArg_ParseTuple(args, "U|z:utf_7_encode", - &str, &errors)) + &str, &errors)) { goto exit; + } return_value = _codecs_utf_7_encode_impl(module, str, errors); exit: @@ -907,8 +953,9 @@ const char *errors = NULL; if (!PyArg_ParseTuple(args, "U|z:utf_8_encode", - &str, &errors)) + &str, &errors)) { goto exit; + } return_value = _codecs_utf_8_encode_impl(module, str, errors); exit: @@ -936,8 +983,9 @@ int byteorder = 0; if (!PyArg_ParseTuple(args, "U|zi:utf_16_encode", - &str, &errors, &byteorder)) + &str, &errors, &byteorder)) { goto exit; + } return_value = _codecs_utf_16_encode_impl(module, str, errors, byteorder); exit: @@ -964,8 +1012,9 @@ const char *errors = NULL; if (!PyArg_ParseTuple(args, "U|z:utf_16_le_encode", - &str, &errors)) + &str, &errors)) { goto exit; + } return_value = _codecs_utf_16_le_encode_impl(module, str, errors); exit: @@ -992,8 +1041,9 @@ const char *errors = NULL; if (!PyArg_ParseTuple(args, "U|z:utf_16_be_encode", - &str, &errors)) + &str, &errors)) { goto exit; + } return_value = _codecs_utf_16_be_encode_impl(module, str, errors); exit: @@ -1021,8 +1071,9 @@ int byteorder = 0; if (!PyArg_ParseTuple(args, "U|zi:utf_32_encode", - &str, &errors, &byteorder)) + &str, &errors, &byteorder)) { goto exit; + } return_value = _codecs_utf_32_encode_impl(module, str, errors, byteorder); exit: @@ -1049,8 +1100,9 @@ const char *errors = NULL; if (!PyArg_ParseTuple(args, "U|z:utf_32_le_encode", - &str, &errors)) + &str, &errors)) { goto exit; + } return_value = _codecs_utf_32_le_encode_impl(module, str, errors); exit: @@ -1077,8 +1129,9 @@ const char *errors = NULL; if (!PyArg_ParseTuple(args, "U|z:utf_32_be_encode", - &str, &errors)) + &str, &errors)) { goto exit; + } return_value = _codecs_utf_32_be_encode_impl(module, str, errors); exit: @@ -1105,8 +1158,9 @@ const char *errors = NULL; if (!PyArg_ParseTuple(args, "U|z:unicode_escape_encode", - &str, &errors)) + &str, &errors)) { goto exit; + } return_value = _codecs_unicode_escape_encode_impl(module, str, errors); exit: @@ -1133,8 +1187,9 @@ const char *errors = NULL; if (!PyArg_ParseTuple(args, "U|z:raw_unicode_escape_encode", - &str, &errors)) + &str, &errors)) { goto exit; + } return_value = _codecs_raw_unicode_escape_encode_impl(module, str, errors); exit: @@ -1161,8 +1216,9 @@ const char *errors = NULL; if (!PyArg_ParseTuple(args, "U|z:latin_1_encode", - &str, &errors)) + &str, &errors)) { goto exit; + } return_value = _codecs_latin_1_encode_impl(module, str, errors); exit: @@ -1189,8 +1245,9 @@ const char *errors = NULL; if (!PyArg_ParseTuple(args, "U|z:ascii_encode", - &str, &errors)) + &str, &errors)) { goto exit; + } return_value = _codecs_ascii_encode_impl(module, str, errors); exit: @@ -1218,8 +1275,9 @@ PyObject *mapping = NULL; if (!PyArg_ParseTuple(args, "U|zO:charmap_encode", - &str, &errors, &mapping)) + &str, &errors, &mapping)) { goto exit; + } return_value = _codecs_charmap_encode_impl(module, str, errors, mapping); exit: @@ -1243,8 +1301,9 @@ PyObject *return_value = NULL; PyObject *map; - if (!PyArg_Parse(arg, "U:charmap_build", &map)) + if (!PyArg_Parse(arg, "U:charmap_build", &map)) { goto exit; + } return_value = _codecs_charmap_build_impl(module, map); exit: @@ -1273,8 +1332,9 @@ const char *errors = NULL; if (!PyArg_ParseTuple(args, "U|z:mbcs_encode", - &str, &errors)) + &str, &errors)) { goto exit; + } return_value = _codecs_mbcs_encode_impl(module, str, errors); exit: @@ -1306,8 +1366,9 @@ const char *errors = NULL; if (!PyArg_ParseTuple(args, "iU|z:code_page_encode", - &code_page, &str, &errors)) + &code_page, &str, &errors)) { goto exit; + } return_value = _codecs_code_page_encode_impl(module, code_page, str, errors); exit: @@ -1341,8 +1402,9 @@ PyObject *handler; if (!PyArg_ParseTuple(args, "sO:register_error", - &errors, &handler)) + &errors, &handler)) { goto exit; + } return_value = _codecs_register_error_impl(module, errors, handler); exit: @@ -1370,8 +1432,9 @@ PyObject *return_value = NULL; const char *name; - if (!PyArg_Parse(arg, "s:lookup_error", &name)) + if (!PyArg_Parse(arg, "s:lookup_error", &name)) { goto exit; + } return_value = _codecs_lookup_error_impl(module, name); exit: @@ -1393,4 +1456,4 @@ #ifndef _CODECS_CODE_PAGE_ENCODE_METHODDEF #define _CODECS_CODE_PAGE_ENCODE_METHODDEF #endif /* !defined(_CODECS_CODE_PAGE_ENCODE_METHODDEF) */ -/*[clinic end generated code: output=04007a13c8387689 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=120320fe2ac32085 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_cryptmodule.c.h b/Modules/clinic/_cryptmodule.c.h --- a/Modules/clinic/_cryptmodule.c.h +++ b/Modules/clinic/_cryptmodule.c.h @@ -27,11 +27,12 @@ const char *salt; if (!PyArg_ParseTuple(args, "ss:crypt", - &word, &salt)) + &word, &salt)) { goto exit; + } return_value = crypt_crypt_impl(module, word, salt); exit: return return_value; } -/*[clinic end generated code: output=22c295c9bce018c4 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=6977cf9917d9a684 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_cursesmodule.c.h b/Modules/clinic/_cursesmodule.c.h --- a/Modules/clinic/_cursesmodule.c.h +++ b/Modules/clinic/_cursesmodule.c.h @@ -40,22 +40,26 @@ switch (PyTuple_GET_SIZE(args)) { case 1: - if (!PyArg_ParseTuple(args, "O:addch", &ch)) + if (!PyArg_ParseTuple(args, "O:addch", &ch)) { goto exit; + } break; case 2: - if (!PyArg_ParseTuple(args, "Ol:addch", &ch, &attr)) + if (!PyArg_ParseTuple(args, "Ol:addch", &ch, &attr)) { goto exit; + } group_right_1 = 1; break; case 3: - if (!PyArg_ParseTuple(args, "iiO:addch", &y, &x, &ch)) + if (!PyArg_ParseTuple(args, "iiO:addch", &y, &x, &ch)) { goto exit; + } group_left_1 = 1; break; case 4: - if (!PyArg_ParseTuple(args, "iiOl:addch", &y, &x, &ch, &attr)) + if (!PyArg_ParseTuple(args, "iiOl:addch", &y, &x, &ch, &attr)) { goto exit; + } group_right_1 = 1; group_left_1 = 1; break; @@ -68,4 +72,4 @@ exit: return return_value; } -/*[clinic end generated code: output=982b1e709577f3ec input=a9049054013a1b77]*/ +/*[clinic end generated code: output=13ffc5f8d79cbfbf input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_datetimemodule.c.h b/Modules/clinic/_datetimemodule.c.h --- a/Modules/clinic/_datetimemodule.c.h +++ b/Modules/clinic/_datetimemodule.c.h @@ -27,11 +27,12 @@ PyObject *tz = Py_None; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:now", _keywords, - &tz)) + &tz)) { goto exit; + } return_value = datetime_datetime_now_impl(type, tz); exit: return return_value; } -/*[clinic end generated code: output=7f45c670d6e4953a input=a9049054013a1b77]*/ +/*[clinic end generated code: output=a82e6bd057a5dab9 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_dbmmodule.c.h b/Modules/clinic/_dbmmodule.c.h --- a/Modules/clinic/_dbmmodule.c.h +++ b/Modules/clinic/_dbmmodule.c.h @@ -60,8 +60,9 @@ PyObject *default_value = NULL; if (!PyArg_ParseTuple(args, "s#|O:get", - &key, &key_length, &default_value)) + &key, &key_length, &default_value)) { goto exit; + } return_value = _dbm_dbm_get_impl(self, key, key_length, default_value); exit: @@ -93,8 +94,9 @@ PyObject *default_value = NULL; if (!PyArg_ParseTuple(args, "s#|O:setdefault", - &key, &key_length, &default_value)) + &key, &key_length, &default_value)) { goto exit; + } return_value = _dbm_dbm_setdefault_impl(self, key, key_length, default_value); exit: @@ -131,11 +133,12 @@ int mode = 438; if (!PyArg_ParseTuple(args, "s|si:open", - &filename, &flags, &mode)) + &filename, &flags, &mode)) { goto exit; + } return_value = dbmopen_impl(module, filename, flags, mode); exit: return return_value; } -/*[clinic end generated code: output=1d92e81b28c558d0 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=97f8b6f542973b71 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_elementtree.c.h b/Modules/clinic/_elementtree.c.h --- a/Modules/clinic/_elementtree.c.h +++ b/Modules/clinic/_elementtree.c.h @@ -19,8 +19,9 @@ PyObject *return_value = NULL; PyObject *subelement; - if (!PyArg_Parse(arg, "O!:append", &Element_Type, &subelement)) + if (!PyArg_Parse(arg, "O!:append", &Element_Type, &subelement)) { goto exit; + } return_value = _elementtree_Element_append_impl(self, subelement); exit: @@ -87,8 +88,9 @@ Py_ssize_t _return_value; _return_value = _elementtree_Element___sizeof___impl(self); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromSsize_t(_return_value); exit: @@ -149,8 +151,9 @@ PyObject *namespaces = Py_None; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:find", _keywords, - &path, &namespaces)) + &path, &namespaces)) { goto exit; + } return_value = _elementtree_Element_find_impl(self, path, namespaces); exit: @@ -180,8 +183,9 @@ PyObject *namespaces = Py_None; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OO:findtext", _keywords, - &path, &default_value, &namespaces)) + &path, &default_value, &namespaces)) { goto exit; + } return_value = _elementtree_Element_findtext_impl(self, path, default_value, namespaces); exit: @@ -209,8 +213,9 @@ PyObject *namespaces = Py_None; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:findall", _keywords, - &path, &namespaces)) + &path, &namespaces)) { goto exit; + } return_value = _elementtree_Element_findall_impl(self, path, namespaces); exit: @@ -238,8 +243,9 @@ PyObject *namespaces = Py_None; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:iterfind", _keywords, - &path, &namespaces)) + &path, &namespaces)) { goto exit; + } return_value = _elementtree_Element_iterfind_impl(self, path, namespaces); exit: @@ -267,8 +273,9 @@ PyObject *default_value = Py_None; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O:get", _keywords, - &key, &default_value)) + &key, &default_value)) { goto exit; + } return_value = _elementtree_Element_get_impl(self, key, default_value); exit: @@ -311,8 +318,9 @@ PyObject *tag = Py_None; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:iter", _keywords, - &tag)) + &tag)) { goto exit; + } return_value = _elementtree_Element_iter_impl(self, tag); exit: @@ -356,8 +364,9 @@ PyObject *subelement; if (!PyArg_ParseTuple(args, "nO!:insert", - &index, &Element_Type, &subelement)) + &index, &Element_Type, &subelement)) { goto exit; + } return_value = _elementtree_Element_insert_impl(self, index, subelement); exit: @@ -419,8 +428,9 @@ if (!PyArg_UnpackTuple(args, "makeelement", 2, 2, - &tag, &attrib)) + &tag, &attrib)) { goto exit; + } return_value = _elementtree_Element_makeelement_impl(self, tag, attrib); exit: @@ -444,8 +454,9 @@ PyObject *return_value = NULL; PyObject *subelement; - if (!PyArg_Parse(arg, "O!:remove", &Element_Type, &subelement)) + if (!PyArg_Parse(arg, "O!:remove", &Element_Type, &subelement)) { goto exit; + } return_value = _elementtree_Element_remove_impl(self, subelement); exit: @@ -473,8 +484,9 @@ if (!PyArg_UnpackTuple(args, "set", 2, 2, - &key, &value)) + &key, &value)) { goto exit; + } return_value = _elementtree_Element_set_impl(self, key, value); exit: @@ -493,8 +505,9 @@ PyObject *element_factory = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:TreeBuilder", _keywords, - &element_factory)) + &element_factory)) { goto exit; + } return_value = _elementtree_TreeBuilder___init___impl((TreeBuilderObject *)self, element_factory); exit: @@ -555,8 +568,9 @@ if (!PyArg_UnpackTuple(args, "start", 1, 2, - &tag, &attrs)) + &tag, &attrs)) { goto exit; + } return_value = _elementtree_TreeBuilder_start_impl(self, tag, attrs); exit: @@ -577,8 +591,9 @@ const char *encoding = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOz:XMLParser", _keywords, - &html, &target, &encoding)) + &html, &target, &encoding)) { goto exit; + } return_value = _elementtree_XMLParser___init___impl((XMLParserObject *)self, html, target, encoding); exit: @@ -640,8 +655,9 @@ if (!PyArg_UnpackTuple(args, "doctype", 3, 3, - &name, &pubid, &system)) + &name, &pubid, &system)) { goto exit; + } return_value = _elementtree_XMLParser_doctype_impl(self, name, pubid, system); exit: @@ -670,11 +686,12 @@ if (!PyArg_UnpackTuple(args, "_setevents", 1, 2, - &events_queue, &events_to_report)) + &events_queue, &events_to_report)) { goto exit; + } return_value = _elementtree_XMLParser__setevents_impl(self, events_queue, events_to_report); exit: return return_value; } -/*[clinic end generated code: output=19d94e2d2726d3aa input=a9049054013a1b77]*/ +/*[clinic end generated code: output=491eb5718c1ae64b input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_gdbmmodule.c.h b/Modules/clinic/_gdbmmodule.c.h --- a/Modules/clinic/_gdbmmodule.c.h +++ b/Modules/clinic/_gdbmmodule.c.h @@ -23,8 +23,9 @@ if (!PyArg_UnpackTuple(args, "get", 1, 2, - &key, &default_value)) + &key, &default_value)) { goto exit; + } return_value = _gdbm_gdbm_get_impl(self, key, default_value); exit: @@ -53,8 +54,9 @@ if (!PyArg_UnpackTuple(args, "setdefault", 1, 2, - &key, &default_value)) + &key, &default_value)) { goto exit; + } return_value = _gdbm_gdbm_setdefault_impl(self, key, default_value); exit: @@ -147,8 +149,9 @@ const char *key; Py_ssize_clean_t key_length; - if (!PyArg_Parse(arg, "s#:nextkey", &key, &key_length)) + if (!PyArg_Parse(arg, "s#:nextkey", &key, &key_length)) { goto exit; + } return_value = _gdbm_gdbm_nextkey_impl(self, key, key_length); exit: @@ -243,11 +246,12 @@ int mode = 438; if (!PyArg_ParseTuple(args, "s|si:open", - &name, &flags, &mode)) + &name, &flags, &mode)) { goto exit; + } return_value = dbmopen_impl(module, name, flags, mode); exit: return return_value; } -/*[clinic end generated code: output=d3d8d871bcccb68a input=a9049054013a1b77]*/ +/*[clinic end generated code: output=418849fb5dbe69a5 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_lzmamodule.c.h b/Modules/clinic/_lzmamodule.c.h --- a/Modules/clinic/_lzmamodule.c.h +++ b/Modules/clinic/_lzmamodule.c.h @@ -25,14 +25,16 @@ PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:compress", &data)) + if (!PyArg_Parse(arg, "y*:compress", &data)) { goto exit; + } return_value = _lzma_LZMACompressor_compress_impl(self, &data); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -94,14 +96,16 @@ Py_ssize_t max_length = -1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|n:decompress", _keywords, - &data, &max_length)) + &data, &max_length)) { goto exit; + } return_value = _lzma_LZMADecompressor_decompress_impl(self, &data, max_length); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -143,8 +147,9 @@ PyObject *filters = Py_None; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iOO:LZMADecompressor", _keywords, - &format, &memlimit, &filters)) + &format, &memlimit, &filters)) { goto exit; + } return_value = _lzma_LZMADecompressor___init___impl((Decompressor *)self, format, memlimit, filters); exit: @@ -171,8 +176,9 @@ PyObject *return_value = NULL; int check_id; - if (!PyArg_Parse(arg, "i:is_check_supported", &check_id)) + if (!PyArg_Parse(arg, "i:is_check_supported", &check_id)) { goto exit; + } return_value = _lzma_is_check_supported_impl(module, check_id); exit: @@ -199,8 +205,9 @@ PyObject *return_value = NULL; lzma_filter filter = {LZMA_VLI_UNKNOWN, NULL}; - if (!PyArg_Parse(arg, "O&:_encode_filter_properties", lzma_filter_converter, &filter)) + if (!PyArg_Parse(arg, "O&:_encode_filter_properties", lzma_filter_converter, &filter)) { goto exit; + } return_value = _lzma__encode_filter_properties_impl(module, filter); exit: @@ -234,15 +241,17 @@ Py_buffer encoded_props = {NULL, NULL}; if (!PyArg_ParseTuple(args, "O&y*:_decode_filter_properties", - lzma_vli_converter, &filter_id, &encoded_props)) + lzma_vli_converter, &filter_id, &encoded_props)) { goto exit; + } return_value = _lzma__decode_filter_properties_impl(module, filter_id, &encoded_props); exit: /* Cleanup for encoded_props */ - if (encoded_props.obj) + if (encoded_props.obj) { PyBuffer_Release(&encoded_props); + } return return_value; } -/*[clinic end generated code: output=2d3e0842be3d3fe1 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=804aed7d196ba52e input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_opcode.c.h b/Modules/clinic/_opcode.c.h --- a/Modules/clinic/_opcode.c.h +++ b/Modules/clinic/_opcode.c.h @@ -23,14 +23,16 @@ int _return_value; if (!PyArg_ParseTuple(args, "i|O:stack_effect", - &opcode, &oparg)) + &opcode, &oparg)) { goto exit; + } _return_value = _opcode_stack_effect_impl(module, opcode, oparg); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: return return_value; } -/*[clinic end generated code: output=8ee7cb735705e8b3 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=5bd7c1c113e6526a input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_pickle.c.h b/Modules/clinic/_pickle.c.h --- a/Modules/clinic/_pickle.c.h +++ b/Modules/clinic/_pickle.c.h @@ -53,8 +53,9 @@ Py_ssize_t _return_value; _return_value = _pickle_Pickler___sizeof___impl(self); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromSsize_t(_return_value); exit: @@ -98,8 +99,9 @@ int fix_imports = 1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|Op:Pickler", _keywords, - &file, &protocol, &fix_imports)) + &file, &protocol, &fix_imports)) { goto exit; + } return_value = _pickle_Pickler___init___impl((PicklerObject *)self, file, protocol, fix_imports); exit: @@ -212,8 +214,9 @@ if (!PyArg_UnpackTuple(args, "find_class", 2, 2, - &module_name, &global_name)) + &module_name, &global_name)) { goto exit; + } return_value = _pickle_Unpickler_find_class_impl(self, module_name, global_name); exit: @@ -239,8 +242,9 @@ Py_ssize_t _return_value; _return_value = _pickle_Unpickler___sizeof___impl(self); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromSsize_t(_return_value); exit: @@ -288,8 +292,9 @@ const char *errors = "strict"; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|$pss:Unpickler", _keywords, - &file, &fix_imports, &encoding, &errors)) + &file, &fix_imports, &encoding, &errors)) { goto exit; + } return_value = _pickle_Unpickler___init___impl((UnpicklerObject *)self, file, fix_imports, encoding, errors); exit: @@ -394,8 +399,9 @@ int fix_imports = 1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|O$p:dump", _keywords, - &obj, &file, &protocol, &fix_imports)) + &obj, &file, &protocol, &fix_imports)) { goto exit; + } return_value = _pickle_dump_impl(module, obj, file, protocol, fix_imports); exit: @@ -437,8 +443,9 @@ int fix_imports = 1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|O$p:dumps", _keywords, - &obj, &protocol, &fix_imports)) + &obj, &protocol, &fix_imports)) { goto exit; + } return_value = _pickle_dumps_impl(module, obj, protocol, fix_imports); exit: @@ -492,8 +499,9 @@ const char *errors = "strict"; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|$pss:load", _keywords, - &file, &fix_imports, &encoding, &errors)) + &file, &fix_imports, &encoding, &errors)) { goto exit; + } return_value = _pickle_load_impl(module, file, fix_imports, encoding, errors); exit: @@ -538,11 +546,12 @@ const char *errors = "strict"; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|$pss:loads", _keywords, - &data, &fix_imports, &encoding, &errors)) + &data, &fix_imports, &encoding, &errors)) { goto exit; + } return_value = _pickle_loads_impl(module, data, fix_imports, encoding, errors); exit: return return_value; } -/*[clinic end generated code: output=a7169d4fbbeef827 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=5e972f339d197760 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_sre.c.h b/Modules/clinic/_sre.c.h --- a/Modules/clinic/_sre.c.h +++ b/Modules/clinic/_sre.c.h @@ -20,8 +20,9 @@ int _return_value; _return_value = _sre_getcodesize_impl(module); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -48,11 +49,13 @@ int _return_value; if (!PyArg_ParseTuple(args, "ii:getlower", - &character, &flags)) + &character, &flags)) { goto exit; + } _return_value = _sre_getlower_impl(module, character, flags); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -84,8 +87,9 @@ PyObject *pattern = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Onn$O:match", _keywords, - &string, &pos, &endpos, &pattern)) + &string, &pos, &endpos, &pattern)) { goto exit; + } return_value = _sre_SRE_Pattern_match_impl(self, string, pos, endpos, pattern); exit: @@ -118,8 +122,9 @@ PyObject *pattern = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Onn$O:fullmatch", _keywords, - &string, &pos, &endpos, &pattern)) + &string, &pos, &endpos, &pattern)) { goto exit; + } return_value = _sre_SRE_Pattern_fullmatch_impl(self, string, pos, endpos, pattern); exit: @@ -154,8 +159,9 @@ PyObject *pattern = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Onn$O:search", _keywords, - &string, &pos, &endpos, &pattern)) + &string, &pos, &endpos, &pattern)) { goto exit; + } return_value = _sre_SRE_Pattern_search_impl(self, string, pos, endpos, pattern); exit: @@ -188,8 +194,9 @@ PyObject *source = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|Onn$O:findall", _keywords, - &string, &pos, &endpos, &source)) + &string, &pos, &endpos, &source)) { goto exit; + } return_value = _sre_SRE_Pattern_findall_impl(self, string, pos, endpos, source); exit: @@ -221,8 +228,9 @@ Py_ssize_t endpos = PY_SSIZE_T_MAX; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|nn:finditer", _keywords, - &string, &pos, &endpos)) + &string, &pos, &endpos)) { goto exit; + } return_value = _sre_SRE_Pattern_finditer_impl(self, string, pos, endpos); exit: @@ -251,8 +259,9 @@ Py_ssize_t endpos = PY_SSIZE_T_MAX; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|nn:scanner", _keywords, - &string, &pos, &endpos)) + &string, &pos, &endpos)) { goto exit; + } return_value = _sre_SRE_Pattern_scanner_impl(self, string, pos, endpos); exit: @@ -282,8 +291,9 @@ PyObject *source = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|On$O:split", _keywords, - &string, &maxsplit, &source)) + &string, &maxsplit, &source)) { goto exit; + } return_value = _sre_SRE_Pattern_split_impl(self, string, maxsplit, source); exit: @@ -313,8 +323,9 @@ Py_ssize_t count = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|n:sub", _keywords, - &repl, &string, &count)) + &repl, &string, &count)) { goto exit; + } return_value = _sre_SRE_Pattern_sub_impl(self, repl, string, count); exit: @@ -344,8 +355,9 @@ Py_ssize_t count = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|n:subn", _keywords, - &repl, &string, &count)) + &repl, &string, &count)) { goto exit; + } return_value = _sre_SRE_Pattern_subn_impl(self, repl, string, count); exit: @@ -388,8 +400,9 @@ PyObject *memo; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:__deepcopy__", _keywords, - &memo)) + &memo)) { goto exit; + } return_value = _sre_SRE_Pattern___deepcopy___impl(self, memo); exit: @@ -423,8 +436,9 @@ PyObject *indexgroup; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OiO!nOO:compile", _keywords, - &pattern, &flags, &PyList_Type, &code, &groups, &groupindex, &indexgroup)) + &pattern, &flags, &PyList_Type, &code, &groups, &groupindex, &indexgroup)) { goto exit; + } return_value = _sre_compile_impl(module, pattern, flags, code, groups, groupindex, indexgroup); exit: @@ -451,8 +465,9 @@ PyObject *template; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:expand", _keywords, - &template)) + &template)) { goto exit; + } return_value = _sre_SRE_Match_expand_impl(self, template); exit: @@ -482,8 +497,9 @@ PyObject *default_value = Py_None; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:groups", _keywords, - &default_value)) + &default_value)) { goto exit; + } return_value = _sre_SRE_Match_groups_impl(self, default_value); exit: @@ -513,8 +529,9 @@ PyObject *default_value = Py_None; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:groupdict", _keywords, - &default_value)) + &default_value)) { goto exit; + } return_value = _sre_SRE_Match_groupdict_impl(self, default_value); exit: @@ -542,11 +559,13 @@ if (!PyArg_UnpackTuple(args, "start", 0, 1, - &group)) + &group)) { goto exit; + } _return_value = _sre_SRE_Match_start_impl(self, group); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromSsize_t(_return_value); exit: @@ -574,11 +593,13 @@ if (!PyArg_UnpackTuple(args, "end", 0, 1, - &group)) + &group)) { goto exit; + } _return_value = _sre_SRE_Match_end_impl(self, group); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromSsize_t(_return_value); exit: @@ -605,8 +626,9 @@ if (!PyArg_UnpackTuple(args, "span", 0, 1, - &group)) + &group)) { goto exit; + } return_value = _sre_SRE_Match_span_impl(self, group); exit: @@ -649,8 +671,9 @@ PyObject *memo; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:__deepcopy__", _keywords, - &memo)) + &memo)) { goto exit; + } return_value = _sre_SRE_Match___deepcopy___impl(self, memo); exit: @@ -690,4 +713,4 @@ { return _sre_SRE_Scanner_search_impl(self); } -/*[clinic end generated code: output=d1d73ab2c5008bd4 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=00f7bf869b3283bc input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_ssl.c.h b/Modules/clinic/_ssl.c.h --- a/Modules/clinic/_ssl.c.h +++ b/Modules/clinic/_ssl.c.h @@ -36,8 +36,9 @@ PyObject *return_value = NULL; PyObject *path; - if (!PyArg_Parse(arg, "O&:_test_decode_cert", PyUnicode_FSConverter, &path)) + if (!PyArg_Parse(arg, "O&:_test_decode_cert", PyUnicode_FSConverter, &path)) { goto exit; + } return_value = _ssl__test_decode_cert_impl(module, path); exit: @@ -71,8 +72,9 @@ int binary_mode = 0; if (!PyArg_ParseTuple(args, "|p:peer_certificate", - &binary_mode)) + &binary_mode)) { goto exit; + } return_value = _ssl__SSLSocket_peer_certificate_impl(self, binary_mode); exit: @@ -209,14 +211,16 @@ PyObject *return_value = NULL; Py_buffer b = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:write", &b)) + if (!PyArg_Parse(arg, "y*:write", &b)) { goto exit; + } return_value = _ssl__SSLSocket_write_impl(self, &b); exit: /* Cleanup for b */ - if (b.obj) + if (b.obj) { PyBuffer_Release(&b); + } return return_value; } @@ -260,12 +264,14 @@ switch (PyTuple_GET_SIZE(args)) { case 1: - if (!PyArg_ParseTuple(args, "i:read", &len)) + if (!PyArg_ParseTuple(args, "i:read", &len)) { goto exit; + } break; case 2: - if (!PyArg_ParseTuple(args, "iw*:read", &len, &buffer)) + if (!PyArg_ParseTuple(args, "iw*:read", &len, &buffer)) { goto exit; + } group_right_1 = 1; break; default: @@ -276,8 +282,9 @@ exit: /* Cleanup for buffer */ - if (buffer.obj) + if (buffer.obj) { PyBuffer_Release(&buffer); + } return return_value; } @@ -332,11 +339,13 @@ int proto_version; if ((type == &PySSLContext_Type) && - !_PyArg_NoKeywords("_SSLContext", kwargs)) + !_PyArg_NoKeywords("_SSLContext", kwargs)) { goto exit; + } if (!PyArg_ParseTuple(args, "i:_SSLContext", - &proto_version)) + &proto_version)) { goto exit; + } return_value = _ssl__SSLContext_impl(type, proto_version); exit: @@ -360,8 +369,9 @@ PyObject *return_value = NULL; const char *cipherlist; - if (!PyArg_Parse(arg, "s:set_ciphers", &cipherlist)) + if (!PyArg_Parse(arg, "s:set_ciphers", &cipherlist)) { goto exit; + } return_value = _ssl__SSLContext_set_ciphers_impl(self, cipherlist); exit: @@ -386,14 +396,16 @@ PyObject *return_value = NULL; Py_buffer protos = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:_set_npn_protocols", &protos)) + if (!PyArg_Parse(arg, "y*:_set_npn_protocols", &protos)) { goto exit; + } return_value = _ssl__SSLContext__set_npn_protocols_impl(self, &protos); exit: /* Cleanup for protos */ - if (protos.obj) + if (protos.obj) { PyBuffer_Release(&protos); + } return return_value; } @@ -416,14 +428,16 @@ PyObject *return_value = NULL; Py_buffer protos = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:_set_alpn_protocols", &protos)) + if (!PyArg_Parse(arg, "y*:_set_alpn_protocols", &protos)) { goto exit; + } return_value = _ssl__SSLContext__set_alpn_protocols_impl(self, &protos); exit: /* Cleanup for protos */ - if (protos.obj) + if (protos.obj) { PyBuffer_Release(&protos); + } return return_value; } @@ -450,8 +464,9 @@ PyObject *password = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|OO:load_cert_chain", _keywords, - &certfile, &keyfile, &password)) + &certfile, &keyfile, &password)) { goto exit; + } return_value = _ssl__SSLContext_load_cert_chain_impl(self, certfile, keyfile, password); exit: @@ -482,8 +497,9 @@ PyObject *cadata = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|OOO:load_verify_locations", _keywords, - &cafile, &capath, &cadata)) + &cafile, &capath, &cadata)) { goto exit; + } return_value = _ssl__SSLContext_load_verify_locations_impl(self, cafile, capath, cadata); exit: @@ -520,8 +536,9 @@ PyObject *hostname_obj = Py_None; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!i|O:_wrap_socket", _keywords, - PySocketModule.Sock_Type, &sock, &server_side, &hostname_obj)) + PySocketModule.Sock_Type, &sock, &server_side, &hostname_obj)) { goto exit; + } return_value = _ssl__SSLContext__wrap_socket_impl(self, sock, server_side, hostname_obj); exit: @@ -553,8 +570,9 @@ PyObject *hostname_obj = Py_None; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!O!i|O:_wrap_bio", _keywords, - &PySSLMemoryBIO_Type, &incoming, &PySSLMemoryBIO_Type, &outgoing, &server_side, &hostname_obj)) + &PySSLMemoryBIO_Type, &incoming, &PySSLMemoryBIO_Type, &outgoing, &server_side, &hostname_obj)) { goto exit; + } return_value = _ssl__SSLContext__wrap_bio_impl(self, incoming, outgoing, server_side, hostname_obj); exit: @@ -670,8 +688,9 @@ int binary_form = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|p:get_ca_certs", _keywords, - &binary_form)) + &binary_form)) { goto exit; + } return_value = _ssl__SSLContext_get_ca_certs_impl(self, binary_form); exit: @@ -687,11 +706,13 @@ PyObject *return_value = NULL; if ((type == &PySSLMemoryBIO_Type) && - !_PyArg_NoPositional("MemoryBIO", args)) + !_PyArg_NoPositional("MemoryBIO", args)) { goto exit; + } if ((type == &PySSLMemoryBIO_Type) && - !_PyArg_NoKeywords("MemoryBIO", kwargs)) + !_PyArg_NoKeywords("MemoryBIO", kwargs)) { goto exit; + } return_value = _ssl_MemoryBIO_impl(type); exit: @@ -722,8 +743,9 @@ int len = -1; if (!PyArg_ParseTuple(args, "|i:read", - &len)) + &len)) { goto exit; + } return_value = _ssl_MemoryBIO_read_impl(self, len); exit: @@ -750,14 +772,16 @@ PyObject *return_value = NULL; Py_buffer b = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:write", &b)) + if (!PyArg_Parse(arg, "y*:write", &b)) { goto exit; + } return_value = _ssl_MemoryBIO_write_impl(self, &b); exit: /* Cleanup for b */ - if (b.obj) + if (b.obj) { PyBuffer_Release(&b); + } return return_value; } @@ -805,14 +829,16 @@ double entropy; if (!PyArg_ParseTuple(args, "s*d:RAND_add", - &view, &entropy)) + &view, &entropy)) { goto exit; + } return_value = _ssl_RAND_add_impl(module, &view, entropy); exit: /* Cleanup for view */ - if (view.obj) + if (view.obj) { PyBuffer_Release(&view); + } return return_value; } @@ -835,8 +861,9 @@ PyObject *return_value = NULL; int n; - if (!PyArg_Parse(arg, "i:RAND_bytes", &n)) + if (!PyArg_Parse(arg, "i:RAND_bytes", &n)) { goto exit; + } return_value = _ssl_RAND_bytes_impl(module, n); exit: @@ -864,8 +891,9 @@ PyObject *return_value = NULL; int n; - if (!PyArg_Parse(arg, "i:RAND_pseudo_bytes", &n)) + if (!PyArg_Parse(arg, "i:RAND_pseudo_bytes", &n)) { goto exit; + } return_value = _ssl_RAND_pseudo_bytes_impl(module, n); exit: @@ -916,8 +944,9 @@ PyObject *return_value = NULL; PyObject *path; - if (!PyArg_Parse(arg, "O&:RAND_egd", PyUnicode_FSConverter, &path)) + if (!PyArg_Parse(arg, "O&:RAND_egd", PyUnicode_FSConverter, &path)) { goto exit; + } return_value = _ssl_RAND_egd_impl(module, path); exit: @@ -970,8 +999,9 @@ int name = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|p:txt2obj", _keywords, - &txt, &name)) + &txt, &name)) { goto exit; + } return_value = _ssl_txt2obj_impl(module, txt, name); exit: @@ -996,8 +1026,9 @@ PyObject *return_value = NULL; int nid; - if (!PyArg_Parse(arg, "i:nid2obj", &nid)) + if (!PyArg_Parse(arg, "i:nid2obj", &nid)) { goto exit; + } return_value = _ssl_nid2obj_impl(module, nid); exit: @@ -1032,8 +1063,9 @@ const char *store_name; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:enum_certificates", _keywords, - &store_name)) + &store_name)) { goto exit; + } return_value = _ssl_enum_certificates_impl(module, store_name); exit: @@ -1069,8 +1101,9 @@ const char *store_name; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s:enum_crls", _keywords, - &store_name)) + &store_name)) { goto exit; + } return_value = _ssl_enum_crls_impl(module, store_name); exit: @@ -1102,4 +1135,4 @@ #ifndef _SSL_ENUM_CRLS_METHODDEF #define _SSL_ENUM_CRLS_METHODDEF #endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */ -/*[clinic end generated code: output=a14999cb565a69a2 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=c6fe203099a5aa89 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_tkinter.c.h b/Modules/clinic/_tkinter.c.h --- a/Modules/clinic/_tkinter.c.h +++ b/Modules/clinic/_tkinter.c.h @@ -19,8 +19,9 @@ PyObject *return_value = NULL; const char *script; - if (!PyArg_Parse(arg, "s:eval", &script)) + if (!PyArg_Parse(arg, "s:eval", &script)) { goto exit; + } return_value = _tkinter_tkapp_eval_impl(self, script); exit: @@ -44,8 +45,9 @@ PyObject *return_value = NULL; const char *fileName; - if (!PyArg_Parse(arg, "s:evalfile", &fileName)) + if (!PyArg_Parse(arg, "s:evalfile", &fileName)) { goto exit; + } return_value = _tkinter_tkapp_evalfile_impl(self, fileName); exit: @@ -69,8 +71,9 @@ PyObject *return_value = NULL; const char *script; - if (!PyArg_Parse(arg, "s:record", &script)) + if (!PyArg_Parse(arg, "s:record", &script)) { goto exit; + } return_value = _tkinter_tkapp_record_impl(self, script); exit: @@ -94,8 +97,9 @@ PyObject *return_value = NULL; const char *msg; - if (!PyArg_Parse(arg, "s:adderrinfo", &msg)) + if (!PyArg_Parse(arg, "s:adderrinfo", &msg)) { goto exit; + } return_value = _tkinter_tkapp_adderrinfo_impl(self, msg); exit: @@ -143,8 +147,9 @@ PyObject *return_value = NULL; const char *s; - if (!PyArg_Parse(arg, "s:exprstring", &s)) + if (!PyArg_Parse(arg, "s:exprstring", &s)) { goto exit; + } return_value = _tkinter_tkapp_exprstring_impl(self, s); exit: @@ -168,8 +173,9 @@ PyObject *return_value = NULL; const char *s; - if (!PyArg_Parse(arg, "s:exprlong", &s)) + if (!PyArg_Parse(arg, "s:exprlong", &s)) { goto exit; + } return_value = _tkinter_tkapp_exprlong_impl(self, s); exit: @@ -193,8 +199,9 @@ PyObject *return_value = NULL; const char *s; - if (!PyArg_Parse(arg, "s:exprdouble", &s)) + if (!PyArg_Parse(arg, "s:exprdouble", &s)) { goto exit; + } return_value = _tkinter_tkapp_exprdouble_impl(self, s); exit: @@ -218,8 +225,9 @@ PyObject *return_value = NULL; const char *s; - if (!PyArg_Parse(arg, "s:exprboolean", &s)) + if (!PyArg_Parse(arg, "s:exprboolean", &s)) { goto exit; + } return_value = _tkinter_tkapp_exprboolean_impl(self, s); exit: @@ -262,8 +270,9 @@ PyObject *func; if (!PyArg_ParseTuple(args, "sO:createcommand", - &name, &func)) + &name, &func)) { goto exit; + } return_value = _tkinter_tkapp_createcommand_impl(self, name, func); exit: @@ -287,8 +296,9 @@ PyObject *return_value = NULL; const char *name; - if (!PyArg_Parse(arg, "s:deletecommand", &name)) + if (!PyArg_Parse(arg, "s:deletecommand", &name)) { goto exit; + } return_value = _tkinter_tkapp_deletecommand_impl(self, name); exit: @@ -318,8 +328,9 @@ PyObject *func; if (!PyArg_ParseTuple(args, "OiO:createfilehandler", - &file, &mask, &func)) + &file, &mask, &func)) { goto exit; + } return_value = _tkinter_tkapp_createfilehandler_impl(self, file, mask, func); exit: @@ -377,8 +388,9 @@ PyObject *func; if (!PyArg_ParseTuple(args, "iO:createtimerhandler", - &milliseconds, &func)) + &milliseconds, &func)) { goto exit; + } return_value = _tkinter_tkapp_createtimerhandler_impl(self, milliseconds, func); exit: @@ -403,8 +415,9 @@ int threshold = 0; if (!PyArg_ParseTuple(args, "|i:mainloop", - &threshold)) + &threshold)) { goto exit; + } return_value = _tkinter_tkapp_mainloop_impl(self, threshold); exit: @@ -429,8 +442,9 @@ int flags = 0; if (!PyArg_ParseTuple(args, "|i:dooneevent", - &flags)) + &flags)) { goto exit; + } return_value = _tkinter_tkapp_dooneevent_impl(self, flags); exit: @@ -551,8 +565,9 @@ const char *use = NULL; if (!PyArg_ParseTuple(args, "|zssiiiiz:create", - &screenName, &baseName, &className, &interactive, &wantobjects, &wantTk, &sync, &use)) + &screenName, &baseName, &className, &interactive, &wantobjects, &wantTk, &sync, &use)) { goto exit; + } return_value = _tkinter_create_impl(module, screenName, baseName, className, interactive, wantobjects, wantTk, sync, use); exit: @@ -579,8 +594,9 @@ PyObject *return_value = NULL; int new_val; - if (!PyArg_Parse(arg, "i:setbusywaitinterval", &new_val)) + if (!PyArg_Parse(arg, "i:setbusywaitinterval", &new_val)) { goto exit; + } return_value = _tkinter_setbusywaitinterval_impl(module, new_val); exit: @@ -606,8 +622,9 @@ int _return_value; _return_value = _tkinter_getbusywaitinterval_impl(module); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -621,4 +638,4 @@ #ifndef _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF #define _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF #endif /* !defined(_TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF) */ -/*[clinic end generated code: output=6dd667b91cf8addd input=a9049054013a1b77]*/ +/*[clinic end generated code: output=13be3f8313bba3c7 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_weakref.c.h b/Modules/clinic/_weakref.c.h --- a/Modules/clinic/_weakref.c.h +++ b/Modules/clinic/_weakref.c.h @@ -21,11 +21,12 @@ Py_ssize_t _return_value; _return_value = _weakref_getweakrefcount_impl(module, object); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromSsize_t(_return_value); exit: return return_value; } -/*[clinic end generated code: output=4da9aade63eed77f input=a9049054013a1b77]*/ +/*[clinic end generated code: output=00e317cda5359ea3 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_winapi.c.h b/Modules/clinic/_winapi.c.h --- a/Modules/clinic/_winapi.c.h +++ b/Modules/clinic/_winapi.c.h @@ -19,8 +19,9 @@ PyObject *return_value = NULL; int wait; - if (!PyArg_Parse(arg, "p:GetOverlappedResult", &wait)) + if (!PyArg_Parse(arg, "p:GetOverlappedResult", &wait)) { goto exit; + } return_value = _winapi_Overlapped_GetOverlappedResult_impl(self, wait); exit: @@ -79,8 +80,9 @@ PyObject *return_value = NULL; HANDLE handle; - if (!PyArg_Parse(arg, "" F_HANDLE ":CloseHandle", &handle)) + if (!PyArg_Parse(arg, "" F_HANDLE ":CloseHandle", &handle)) { goto exit; + } return_value = _winapi_CloseHandle_impl(module, handle); exit: @@ -108,8 +110,9 @@ int use_overlapped = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" F_HANDLE "|i:ConnectNamedPipe", _keywords, - &handle, &use_overlapped)) + &handle, &use_overlapped)) { goto exit; + } return_value = _winapi_ConnectNamedPipe_impl(module, handle, use_overlapped); exit: @@ -147,13 +150,16 @@ HANDLE _return_value; if (!PyArg_ParseTuple(args, "skk" F_POINTER "kk" F_HANDLE ":CreateFile", - &file_name, &desired_access, &share_mode, &security_attributes, &creation_disposition, &flags_and_attributes, &template_file)) + &file_name, &desired_access, &share_mode, &security_attributes, &creation_disposition, &flags_and_attributes, &template_file)) { goto exit; + } _return_value = _winapi_CreateFile_impl(module, file_name, desired_access, share_mode, security_attributes, creation_disposition, flags_and_attributes, template_file); - if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) + if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; - if (_return_value == NULL) + } + if (_return_value == NULL) { Py_RETURN_NONE; + } return_value = HANDLE_TO_PYNUM(_return_value); exit: @@ -180,8 +186,9 @@ LPWSTR dst_path; if (!PyArg_ParseTuple(args, "uu:CreateJunction", - &src_path, &dst_path)) + &src_path, &dst_path)) { goto exit; + } return_value = _winapi_CreateJunction_impl(module, src_path, dst_path); exit: @@ -220,13 +227,16 @@ HANDLE _return_value; if (!PyArg_ParseTuple(args, "skkkkkk" F_POINTER ":CreateNamedPipe", - &name, &open_mode, &pipe_mode, &max_instances, &out_buffer_size, &in_buffer_size, &default_timeout, &security_attributes)) + &name, &open_mode, &pipe_mode, &max_instances, &out_buffer_size, &in_buffer_size, &default_timeout, &security_attributes)) { goto exit; + } _return_value = _winapi_CreateNamedPipe_impl(module, name, open_mode, pipe_mode, max_instances, out_buffer_size, in_buffer_size, default_timeout, security_attributes); - if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) + if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; - if (_return_value == NULL) + } + if (_return_value == NULL) { Py_RETURN_NONE; + } return_value = HANDLE_TO_PYNUM(_return_value); exit: @@ -259,8 +269,9 @@ DWORD size; if (!PyArg_ParseTuple(args, "Ok:CreatePipe", - &pipe_attrs, &size)) + &pipe_attrs, &size)) { goto exit; + } return_value = _winapi_CreatePipe_impl(module, pipe_attrs, size); exit: @@ -309,8 +320,9 @@ PyObject *startup_info; if (!PyArg_ParseTuple(args, "ZZOOikOZO:CreateProcess", - &application_name, &command_line, &proc_attrs, &thread_attrs, &inherit_handles, &creation_flags, &env_mapping, ¤t_directory, &startup_info)) + &application_name, &command_line, &proc_attrs, &thread_attrs, &inherit_handles, &creation_flags, &env_mapping, ¤t_directory, &startup_info)) { goto exit; + } return_value = _winapi_CreateProcess_impl(module, application_name, command_line, proc_attrs, thread_attrs, inherit_handles, creation_flags, env_mapping, current_directory, startup_info); exit: @@ -353,13 +365,16 @@ HANDLE _return_value; if (!PyArg_ParseTuple(args, "" F_HANDLE "" F_HANDLE "" F_HANDLE "ki|k:DuplicateHandle", - &source_process_handle, &source_handle, &target_process_handle, &desired_access, &inherit_handle, &options)) + &source_process_handle, &source_handle, &target_process_handle, &desired_access, &inherit_handle, &options)) { goto exit; + } _return_value = _winapi_DuplicateHandle_impl(module, source_process_handle, source_handle, target_process_handle, desired_access, inherit_handle, options); - if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) + if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; - if (_return_value == NULL) + } + if (_return_value == NULL) { Py_RETURN_NONE; + } return_value = HANDLE_TO_PYNUM(_return_value); exit: @@ -383,8 +398,9 @@ PyObject *return_value = NULL; UINT ExitCode; - if (!PyArg_Parse(arg, "I:ExitProcess", &ExitCode)) + if (!PyArg_Parse(arg, "I:ExitProcess", &ExitCode)) { goto exit; + } return_value = _winapi_ExitProcess_impl(module, ExitCode); exit: @@ -410,10 +426,12 @@ HANDLE _return_value; _return_value = _winapi_GetCurrentProcess_impl(module); - if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) + if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; - if (_return_value == NULL) + } + if (_return_value == NULL) { Py_RETURN_NONE; + } return_value = HANDLE_TO_PYNUM(_return_value); exit: @@ -439,11 +457,13 @@ HANDLE process; DWORD _return_value; - if (!PyArg_Parse(arg, "" F_HANDLE ":GetExitCodeProcess", &process)) + if (!PyArg_Parse(arg, "" F_HANDLE ":GetExitCodeProcess", &process)) { goto exit; + } _return_value = _winapi_GetExitCodeProcess_impl(module, process); - if ((_return_value == DWORD_MAX) && PyErr_Occurred()) + if ((_return_value == DWORD_MAX) && PyErr_Occurred()) { goto exit; + } return_value = Py_BuildValue("k", _return_value); exit: @@ -468,8 +488,9 @@ DWORD _return_value; _return_value = _winapi_GetLastError_impl(module); - if ((_return_value == DWORD_MAX) && PyErr_Occurred()) + if ((_return_value == DWORD_MAX) && PyErr_Occurred()) { goto exit; + } return_value = Py_BuildValue("k", _return_value); exit: @@ -501,8 +522,9 @@ PyObject *return_value = NULL; HMODULE module_handle; - if (!PyArg_Parse(arg, "" F_HANDLE ":GetModuleFileName", &module_handle)) + if (!PyArg_Parse(arg, "" F_HANDLE ":GetModuleFileName", &module_handle)) { goto exit; + } return_value = _winapi_GetModuleFileName_impl(module, module_handle); exit: @@ -533,13 +555,16 @@ DWORD std_handle; HANDLE _return_value; - if (!PyArg_Parse(arg, "k:GetStdHandle", &std_handle)) + if (!PyArg_Parse(arg, "k:GetStdHandle", &std_handle)) { goto exit; + } _return_value = _winapi_GetStdHandle_impl(module, std_handle); - if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) + if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; - if (_return_value == NULL) + } + if (_return_value == NULL) { Py_RETURN_NONE; + } return_value = HANDLE_TO_PYNUM(_return_value); exit: @@ -565,8 +590,9 @@ long _return_value; _return_value = _winapi_GetVersion_impl(module); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -595,13 +621,16 @@ HANDLE _return_value; if (!PyArg_ParseTuple(args, "kik:OpenProcess", - &desired_access, &inherit_handle, &process_id)) + &desired_access, &inherit_handle, &process_id)) { goto exit; + } _return_value = _winapi_OpenProcess_impl(module, desired_access, inherit_handle, process_id); - if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) + if ((_return_value == INVALID_HANDLE_VALUE) && PyErr_Occurred()) { goto exit; - if (_return_value == NULL) + } + if (_return_value == NULL) { Py_RETURN_NONE; + } return_value = HANDLE_TO_PYNUM(_return_value); exit: @@ -627,8 +656,9 @@ int size = 0; if (!PyArg_ParseTuple(args, "" F_HANDLE "|i:PeekNamedPipe", - &handle, &size)) + &handle, &size)) { goto exit; + } return_value = _winapi_PeekNamedPipe_impl(module, handle, size); exit: @@ -657,8 +687,9 @@ int use_overlapped = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" F_HANDLE "i|i:ReadFile", _keywords, - &handle, &size, &use_overlapped)) + &handle, &size, &use_overlapped)) { goto exit; + } return_value = _winapi_ReadFile_impl(module, handle, size, use_overlapped); exit: @@ -690,8 +721,9 @@ PyObject *collect_data_timeout; if (!PyArg_ParseTuple(args, "" F_HANDLE "OOO:SetNamedPipeHandleState", - &named_pipe, &mode, &max_collection_count, &collect_data_timeout)) + &named_pipe, &mode, &max_collection_count, &collect_data_timeout)) { goto exit; + } return_value = _winapi_SetNamedPipeHandleState_impl(module, named_pipe, mode, max_collection_count, collect_data_timeout); exit: @@ -719,8 +751,9 @@ UINT exit_code; if (!PyArg_ParseTuple(args, "" F_HANDLE "I:TerminateProcess", - &handle, &exit_code)) + &handle, &exit_code)) { goto exit; + } return_value = _winapi_TerminateProcess_impl(module, handle, exit_code); exit: @@ -746,8 +779,9 @@ DWORD timeout; if (!PyArg_ParseTuple(args, "sk:WaitNamedPipe", - &name, &timeout)) + &name, &timeout)) { goto exit; + } return_value = _winapi_WaitNamedPipe_impl(module, name, timeout); exit: @@ -777,8 +811,9 @@ DWORD milliseconds = INFINITE; if (!PyArg_ParseTuple(args, "Oi|k:WaitForMultipleObjects", - &handle_seq, &wait_flag, &milliseconds)) + &handle_seq, &wait_flag, &milliseconds)) { goto exit; + } return_value = _winapi_WaitForMultipleObjects_impl(module, handle_seq, wait_flag, milliseconds); exit: @@ -811,11 +846,13 @@ long _return_value; if (!PyArg_ParseTuple(args, "" F_HANDLE "k:WaitForSingleObject", - &handle, &milliseconds)) + &handle, &milliseconds)) { goto exit; + } _return_value = _winapi_WaitForSingleObject_impl(module, handle, milliseconds); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -844,11 +881,12 @@ int use_overlapped = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" F_HANDLE "O|i:WriteFile", _keywords, - &handle, &buffer, &use_overlapped)) + &handle, &buffer, &use_overlapped)) { goto exit; + } return_value = _winapi_WriteFile_impl(module, handle, buffer, use_overlapped); exit: return return_value; } -/*[clinic end generated code: output=98771c6584056d19 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=d099ee4fbcdd5bc0 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/arraymodule.c.h b/Modules/clinic/arraymodule.c.h --- a/Modules/clinic/arraymodule.c.h +++ b/Modules/clinic/arraymodule.c.h @@ -77,8 +77,9 @@ Py_ssize_t i = -1; if (!PyArg_ParseTuple(args, "|n:pop", - &i)) + &i)) { goto exit; + } return_value = array_array_pop_impl(self, i); exit: @@ -114,8 +115,9 @@ PyObject *v; if (!PyArg_ParseTuple(args, "nO:insert", - &i, &v)) + &i, &v)) { goto exit; + } return_value = array_array_insert_impl(self, i, v); exit: @@ -211,8 +213,9 @@ Py_ssize_t n; if (!PyArg_ParseTuple(args, "On:fromfile", - &f, &n)) + &f, &n)) { goto exit; + } return_value = array_array_fromfile_impl(self, f, n); exit: @@ -275,14 +278,16 @@ PyObject *return_value = NULL; Py_buffer buffer = {NULL, NULL}; - if (!PyArg_Parse(arg, "s*:fromstring", &buffer)) + if (!PyArg_Parse(arg, "s*:fromstring", &buffer)) { goto exit; + } return_value = array_array_fromstring_impl(self, &buffer); exit: /* Cleanup for buffer */ - if (buffer.obj) + if (buffer.obj) { PyBuffer_Release(&buffer); + } return return_value; } @@ -305,14 +310,16 @@ PyObject *return_value = NULL; Py_buffer buffer = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:frombytes", &buffer)) + if (!PyArg_Parse(arg, "y*:frombytes", &buffer)) { goto exit; + } return_value = array_array_frombytes_impl(self, &buffer); exit: /* Cleanup for buffer */ - if (buffer.obj) + if (buffer.obj) { PyBuffer_Release(&buffer); + } return return_value; } @@ -379,8 +386,9 @@ Py_UNICODE *ustr; Py_ssize_clean_t ustr_length; - if (!PyArg_Parse(arg, "u#:fromunicode", &ustr, &ustr_length)) + if (!PyArg_Parse(arg, "u#:fromunicode", &ustr, &ustr_length)) { goto exit; + } return_value = array_array_fromunicode_impl(self, ustr, ustr_length); exit: @@ -453,8 +461,9 @@ PyObject *items; if (!PyArg_ParseTuple(args, "OCiO:_array_reconstructor", - &arraytype, &typecode, &mformat_code, &items)) + &arraytype, &typecode, &mformat_code, &items)) { goto exit; + } return_value = array__array_reconstructor_impl(module, arraytype, typecode, mformat_code, items); exit: @@ -496,4 +505,4 @@ #define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF \ {"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__}, -/*[clinic end generated code: output=d2e82c65ea841cfc input=a9049054013a1b77]*/ +/*[clinic end generated code: output=0b99c89275eda265 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/audioop.c.h b/Modules/clinic/audioop.c.h --- a/Modules/clinic/audioop.c.h +++ b/Modules/clinic/audioop.c.h @@ -24,14 +24,16 @@ Py_ssize_t index; if (!PyArg_ParseTuple(args, "y*in:getsample", - &fragment, &width, &index)) + &fragment, &width, &index)) { goto exit; + } return_value = audioop_getsample_impl(module, &fragment, width, index); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -56,14 +58,16 @@ int width; if (!PyArg_ParseTuple(args, "y*i:max", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_max_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -88,14 +92,16 @@ int width; if (!PyArg_ParseTuple(args, "y*i:minmax", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_minmax_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -120,14 +126,16 @@ int width; if (!PyArg_ParseTuple(args, "y*i:avg", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_avg_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -152,14 +160,16 @@ int width; if (!PyArg_ParseTuple(args, "y*i:rms", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_rms_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -185,17 +195,20 @@ Py_buffer reference = {NULL, NULL}; if (!PyArg_ParseTuple(args, "y*y*:findfit", - &fragment, &reference)) + &fragment, &reference)) { goto exit; + } return_value = audioop_findfit_impl(module, &fragment, &reference); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } /* Cleanup for reference */ - if (reference.obj) + if (reference.obj) { PyBuffer_Release(&reference); + } return return_value; } @@ -221,17 +234,20 @@ Py_buffer reference = {NULL, NULL}; if (!PyArg_ParseTuple(args, "y*y*:findfactor", - &fragment, &reference)) + &fragment, &reference)) { goto exit; + } return_value = audioop_findfactor_impl(module, &fragment, &reference); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } /* Cleanup for reference */ - if (reference.obj) + if (reference.obj) { PyBuffer_Release(&reference); + } return return_value; } @@ -257,14 +273,16 @@ Py_ssize_t length; if (!PyArg_ParseTuple(args, "y*n:findmax", - &fragment, &length)) + &fragment, &length)) { goto exit; + } return_value = audioop_findmax_impl(module, &fragment, length); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -289,14 +307,16 @@ int width; if (!PyArg_ParseTuple(args, "y*i:avgpp", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_avgpp_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -321,14 +341,16 @@ int width; if (!PyArg_ParseTuple(args, "y*i:maxpp", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_maxpp_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -353,14 +375,16 @@ int width; if (!PyArg_ParseTuple(args, "y*i:cross", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_cross_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -387,14 +411,16 @@ double factor; if (!PyArg_ParseTuple(args, "y*id:mul", - &fragment, &width, &factor)) + &fragment, &width, &factor)) { goto exit; + } return_value = audioop_mul_impl(module, &fragment, width, factor); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -422,14 +448,16 @@ double rfactor; if (!PyArg_ParseTuple(args, "y*idd:tomono", - &fragment, &width, &lfactor, &rfactor)) + &fragment, &width, &lfactor, &rfactor)) { goto exit; + } return_value = audioop_tomono_impl(module, &fragment, width, lfactor, rfactor); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -457,14 +485,16 @@ double rfactor; if (!PyArg_ParseTuple(args, "y*idd:tostereo", - &fragment, &width, &lfactor, &rfactor)) + &fragment, &width, &lfactor, &rfactor)) { goto exit; + } return_value = audioop_tostereo_impl(module, &fragment, width, lfactor, rfactor); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -491,17 +521,20 @@ int width; if (!PyArg_ParseTuple(args, "y*y*i:add", - &fragment1, &fragment2, &width)) + &fragment1, &fragment2, &width)) { goto exit; + } return_value = audioop_add_impl(module, &fragment1, &fragment2, width); exit: /* Cleanup for fragment1 */ - if (fragment1.obj) + if (fragment1.obj) { PyBuffer_Release(&fragment1); + } /* Cleanup for fragment2 */ - if (fragment2.obj) + if (fragment2.obj) { PyBuffer_Release(&fragment2); + } return return_value; } @@ -528,14 +561,16 @@ int bias; if (!PyArg_ParseTuple(args, "y*ii:bias", - &fragment, &width, &bias)) + &fragment, &width, &bias)) { goto exit; + } return_value = audioop_bias_impl(module, &fragment, width, bias); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -560,14 +595,16 @@ int width; if (!PyArg_ParseTuple(args, "y*i:reverse", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_reverse_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -592,14 +629,16 @@ int width; if (!PyArg_ParseTuple(args, "y*i:byteswap", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_byteswap_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -626,14 +665,16 @@ int newwidth; if (!PyArg_ParseTuple(args, "y*ii:lin2lin", - &fragment, &width, &newwidth)) + &fragment, &width, &newwidth)) { goto exit; + } return_value = audioop_lin2lin_impl(module, &fragment, width, newwidth); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -667,14 +708,16 @@ int weightB = 0; if (!PyArg_ParseTuple(args, "y*iiiiO|ii:ratecv", - &fragment, &width, &nchannels, &inrate, &outrate, &state, &weightA, &weightB)) + &fragment, &width, &nchannels, &inrate, &outrate, &state, &weightA, &weightB)) { goto exit; + } return_value = audioop_ratecv_impl(module, &fragment, width, nchannels, inrate, outrate, state, weightA, weightB); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -699,14 +742,16 @@ int width; if (!PyArg_ParseTuple(args, "y*i:lin2ulaw", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_lin2ulaw_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -731,14 +776,16 @@ int width; if (!PyArg_ParseTuple(args, "y*i:ulaw2lin", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_ulaw2lin_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -763,14 +810,16 @@ int width; if (!PyArg_ParseTuple(args, "y*i:lin2alaw", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_lin2alaw_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -795,14 +844,16 @@ int width; if (!PyArg_ParseTuple(args, "y*i:alaw2lin", - &fragment, &width)) + &fragment, &width)) { goto exit; + } return_value = audioop_alaw2lin_impl(module, &fragment, width); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -829,14 +880,16 @@ PyObject *state; if (!PyArg_ParseTuple(args, "y*iO:lin2adpcm", - &fragment, &width, &state)) + &fragment, &width, &state)) { goto exit; + } return_value = audioop_lin2adpcm_impl(module, &fragment, width, state); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } @@ -863,15 +916,17 @@ PyObject *state; if (!PyArg_ParseTuple(args, "y*iO:adpcm2lin", - &fragment, &width, &state)) + &fragment, &width, &state)) { goto exit; + } return_value = audioop_adpcm2lin_impl(module, &fragment, width, state); exit: /* Cleanup for fragment */ - if (fragment.obj) + if (fragment.obj) { PyBuffer_Release(&fragment); + } return return_value; } -/*[clinic end generated code: output=a076e1b213a8727b input=a9049054013a1b77]*/ +/*[clinic end generated code: output=af5b025f0241fee2 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/binascii.c.h b/Modules/clinic/binascii.c.h --- a/Modules/clinic/binascii.c.h +++ b/Modules/clinic/binascii.c.h @@ -20,8 +20,9 @@ PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "O&:a2b_uu", ascii_buffer_converter, &data)) + if (!PyArg_Parse(arg, "O&:a2b_uu", ascii_buffer_converter, &data)) { goto exit; + } return_value = binascii_a2b_uu_impl(module, &data); exit: @@ -50,14 +51,16 @@ PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:b2a_uu", &data)) + if (!PyArg_Parse(arg, "y*:b2a_uu", &data)) { goto exit; + } return_value = binascii_b2a_uu_impl(module, &data); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -80,8 +83,9 @@ PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "O&:a2b_base64", ascii_buffer_converter, &data)) + if (!PyArg_Parse(arg, "O&:a2b_base64", ascii_buffer_converter, &data)) { goto exit; + } return_value = binascii_a2b_base64_impl(module, &data); exit: @@ -113,14 +117,16 @@ int newline = 1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|$i:b2a_base64", _keywords, - &data, &newline)) + &data, &newline)) { goto exit; + } return_value = binascii_b2a_base64_impl(module, &data, newline); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -143,8 +149,9 @@ PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "O&:a2b_hqx", ascii_buffer_converter, &data)) + if (!PyArg_Parse(arg, "O&:a2b_hqx", ascii_buffer_converter, &data)) { goto exit; + } return_value = binascii_a2b_hqx_impl(module, &data); exit: @@ -173,14 +180,16 @@ PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:rlecode_hqx", &data)) + if (!PyArg_Parse(arg, "y*:rlecode_hqx", &data)) { goto exit; + } return_value = binascii_rlecode_hqx_impl(module, &data); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -203,14 +212,16 @@ PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:b2a_hqx", &data)) + if (!PyArg_Parse(arg, "y*:b2a_hqx", &data)) { goto exit; + } return_value = binascii_b2a_hqx_impl(module, &data); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -233,14 +244,16 @@ PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:rledecode_hqx", &data)) + if (!PyArg_Parse(arg, "y*:rledecode_hqx", &data)) { goto exit; + } return_value = binascii_rledecode_hqx_impl(module, &data); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -266,17 +279,20 @@ unsigned int _return_value; if (!PyArg_ParseTuple(args, "y*I:crc_hqx", - &data, &crc)) + &data, &crc)) { goto exit; + } _return_value = binascii_crc_hqx_impl(module, &data, crc); - if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) + if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromUnsignedLong((unsigned long)_return_value); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -302,17 +318,20 @@ unsigned int _return_value; if (!PyArg_ParseTuple(args, "y*|I:crc32", - &data, &crc)) + &data, &crc)) { goto exit; + } _return_value = binascii_crc32_impl(module, &data, crc); - if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) + if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromUnsignedLong((unsigned long)_return_value); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -338,14 +357,16 @@ PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:b2a_hex", &data)) + if (!PyArg_Parse(arg, "y*:b2a_hex", &data)) { goto exit; + } return_value = binascii_b2a_hex_impl(module, &data); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -370,14 +391,16 @@ PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:hexlify", &data)) + if (!PyArg_Parse(arg, "y*:hexlify", &data)) { goto exit; + } return_value = binascii_hexlify_impl(module, &data); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -403,8 +426,9 @@ PyObject *return_value = NULL; Py_buffer hexstr = {NULL, NULL}; - if (!PyArg_Parse(arg, "O&:a2b_hex", ascii_buffer_converter, &hexstr)) + if (!PyArg_Parse(arg, "O&:a2b_hex", ascii_buffer_converter, &hexstr)) { goto exit; + } return_value = binascii_a2b_hex_impl(module, &hexstr); exit: @@ -435,8 +459,9 @@ PyObject *return_value = NULL; Py_buffer hexstr = {NULL, NULL}; - if (!PyArg_Parse(arg, "O&:unhexlify", ascii_buffer_converter, &hexstr)) + if (!PyArg_Parse(arg, "O&:unhexlify", ascii_buffer_converter, &hexstr)) { goto exit; + } return_value = binascii_unhexlify_impl(module, &hexstr); exit: @@ -468,8 +493,9 @@ int header = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|i:a2b_qp", _keywords, - ascii_buffer_converter, &data, &header)) + ascii_buffer_converter, &data, &header)) { goto exit; + } return_value = binascii_a2b_qp_impl(module, &data, header); exit: @@ -508,15 +534,17 @@ int header = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|iii:b2a_qp", _keywords, - &data, "etabs, &istext, &header)) + &data, "etabs, &istext, &header)) { goto exit; + } return_value = binascii_b2a_qp_impl(module, &data, quotetabs, istext, header); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } -/*[clinic end generated code: output=b15a24350d105251 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=7fb420392d78ac4d input=a9049054013a1b77]*/ diff --git a/Modules/clinic/cmathmodule.c.h b/Modules/clinic/cmathmodule.c.h --- a/Modules/clinic/cmathmodule.c.h +++ b/Modules/clinic/cmathmodule.c.h @@ -21,8 +21,9 @@ Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:acos", &z)) + if (!PyArg_Parse(arg, "D:acos", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_acos_impl(module, z); @@ -62,8 +63,9 @@ Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:acosh", &z)) + if (!PyArg_Parse(arg, "D:acosh", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_acosh_impl(module, z); @@ -103,8 +105,9 @@ Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:asin", &z)) + if (!PyArg_Parse(arg, "D:asin", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_asin_impl(module, z); @@ -144,8 +147,9 @@ Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:asinh", &z)) + if (!PyArg_Parse(arg, "D:asinh", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_asinh_impl(module, z); @@ -185,8 +189,9 @@ Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:atan", &z)) + if (!PyArg_Parse(arg, "D:atan", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_atan_impl(module, z); @@ -226,8 +231,9 @@ Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:atanh", &z)) + if (!PyArg_Parse(arg, "D:atanh", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_atanh_impl(module, z); @@ -267,8 +273,9 @@ Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:cos", &z)) + if (!PyArg_Parse(arg, "D:cos", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_cos_impl(module, z); @@ -308,8 +315,9 @@ Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:cosh", &z)) + if (!PyArg_Parse(arg, "D:cosh", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_cosh_impl(module, z); @@ -349,8 +357,9 @@ Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:exp", &z)) + if (!PyArg_Parse(arg, "D:exp", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_exp_impl(module, z); @@ -390,8 +399,9 @@ Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:log10", &z)) + if (!PyArg_Parse(arg, "D:log10", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_log10_impl(module, z); @@ -431,8 +441,9 @@ Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:sin", &z)) + if (!PyArg_Parse(arg, "D:sin", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_sin_impl(module, z); @@ -472,8 +483,9 @@ Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:sinh", &z)) + if (!PyArg_Parse(arg, "D:sinh", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_sinh_impl(module, z); @@ -513,8 +525,9 @@ Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:sqrt", &z)) + if (!PyArg_Parse(arg, "D:sqrt", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_sqrt_impl(module, z); @@ -554,8 +567,9 @@ Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:tan", &z)) + if (!PyArg_Parse(arg, "D:tan", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_tan_impl(module, z); @@ -595,8 +609,9 @@ Py_complex z; Py_complex _return_value; - if (!PyArg_Parse(arg, "D:tanh", &z)) + if (!PyArg_Parse(arg, "D:tanh", &z)) { goto exit; + } /* modifications for z */ errno = 0; PyFPE_START_PROTECT("complex function", goto exit); _return_value = cmath_tanh_impl(module, z); @@ -639,8 +654,9 @@ PyObject *y_obj = NULL; if (!PyArg_ParseTuple(args, "D|O:log", - &x, &y_obj)) + &x, &y_obj)) { goto exit; + } return_value = cmath_log_impl(module, x, y_obj); exit: @@ -665,8 +681,9 @@ PyObject *return_value = NULL; Py_complex z; - if (!PyArg_Parse(arg, "D:phase", &z)) + if (!PyArg_Parse(arg, "D:phase", &z)) { goto exit; + } return_value = cmath_phase_impl(module, z); exit: @@ -693,8 +710,9 @@ PyObject *return_value = NULL; Py_complex z; - if (!PyArg_Parse(arg, "D:polar", &z)) + if (!PyArg_Parse(arg, "D:polar", &z)) { goto exit; + } return_value = cmath_polar_impl(module, z); exit: @@ -721,8 +739,9 @@ double phi; if (!PyArg_ParseTuple(args, "dd:rect", - &r, &phi)) + &r, &phi)) { goto exit; + } return_value = cmath_rect_impl(module, r, phi); exit: @@ -747,8 +766,9 @@ PyObject *return_value = NULL; Py_complex z; - if (!PyArg_Parse(arg, "D:isfinite", &z)) + if (!PyArg_Parse(arg, "D:isfinite", &z)) { goto exit; + } return_value = cmath_isfinite_impl(module, z); exit: @@ -773,8 +793,9 @@ PyObject *return_value = NULL; Py_complex z; - if (!PyArg_Parse(arg, "D:isnan", &z)) + if (!PyArg_Parse(arg, "D:isnan", &z)) { goto exit; + } return_value = cmath_isnan_impl(module, z); exit: @@ -799,8 +820,9 @@ PyObject *return_value = NULL; Py_complex z; - if (!PyArg_Parse(arg, "D:isinf", &z)) + if (!PyArg_Parse(arg, "D:isinf", &z)) { goto exit; + } return_value = cmath_isinf_impl(module, z); exit: @@ -847,14 +869,16 @@ int _return_value; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "DD|$dd:isclose", _keywords, - &a, &b, &rel_tol, &abs_tol)) + &a, &b, &rel_tol, &abs_tol)) { goto exit; + } _return_value = cmath_isclose_impl(module, a, b, rel_tol, abs_tol); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyBool_FromLong((long)_return_value); exit: return return_value; } -/*[clinic end generated code: output=229e9c48c9d27362 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=f166205b4beb1826 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/fcntlmodule.c.h b/Modules/clinic/fcntlmodule.c.h --- a/Modules/clinic/fcntlmodule.c.h +++ b/Modules/clinic/fcntlmodule.c.h @@ -33,8 +33,9 @@ PyObject *arg = NULL; if (!PyArg_ParseTuple(args, "O&i|O:fcntl", - conv_descriptor, &fd, &code, &arg)) + conv_descriptor, &fd, &code, &arg)) { goto exit; + } return_value = fcntl_fcntl_impl(module, fd, code, arg); exit: @@ -91,8 +92,9 @@ int mutate_arg = 1; if (!PyArg_ParseTuple(args, "O&I|Op:ioctl", - conv_descriptor, &fd, &code, &ob_arg, &mutate_arg)) + conv_descriptor, &fd, &code, &ob_arg, &mutate_arg)) { goto exit; + } return_value = fcntl_ioctl_impl(module, fd, code, ob_arg, mutate_arg); exit: @@ -122,8 +124,9 @@ int code; if (!PyArg_ParseTuple(args, "O&i:flock", - conv_descriptor, &fd, &code)) + conv_descriptor, &fd, &code)) { goto exit; + } return_value = fcntl_flock_impl(module, fd, code); exit: @@ -175,11 +178,12 @@ int whence = 0; if (!PyArg_ParseTuple(args, "O&i|OOi:lockf", - conv_descriptor, &fd, &code, &lenobj, &startobj, &whence)) + conv_descriptor, &fd, &code, &lenobj, &startobj, &whence)) { goto exit; + } return_value = fcntl_lockf_impl(module, fd, code, lenobj, startobj, whence); exit: return return_value; } -/*[clinic end generated code: output=b7d6e8fc2ad09c48 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=b08537e9adc04ca2 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/grpmodule.c.h b/Modules/clinic/grpmodule.c.h --- a/Modules/clinic/grpmodule.c.h +++ b/Modules/clinic/grpmodule.c.h @@ -24,8 +24,9 @@ PyObject *id; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:getgrgid", _keywords, - &id)) + &id)) { goto exit; + } return_value = grp_getgrgid_impl(module, id); exit: @@ -54,8 +55,9 @@ PyObject *name; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "U:getgrnam", _keywords, - &name)) + &name)) { goto exit; + } return_value = grp_getgrnam_impl(module, name); exit: @@ -82,4 +84,4 @@ { return grp_getgrall_impl(module); } -/*[clinic end generated code: output=5191c25600afb1bd input=a9049054013a1b77]*/ +/*[clinic end generated code: output=a8a097520206ccd6 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/md5module.c.h b/Modules/clinic/md5module.c.h --- a/Modules/clinic/md5module.c.h +++ b/Modules/clinic/md5module.c.h @@ -85,11 +85,12 @@ PyObject *string = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:md5", _keywords, - &string)) + &string)) { goto exit; + } return_value = _md5_md5_impl(module, string); exit: return return_value; } -/*[clinic end generated code: output=0f803ded701aca54 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=d701d041d387b081 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h --- a/Modules/clinic/posixmodule.c.h +++ b/Modules/clinic/posixmodule.c.h @@ -43,8 +43,9 @@ int follow_symlinks = 1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|$O&p:stat", _keywords, - path_converter, &path, FSTATAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) + path_converter, &path, FSTATAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) { goto exit; + } return_value = os_stat_impl(module, &path, dir_fd, follow_symlinks); exit: @@ -78,8 +79,9 @@ int dir_fd = DEFAULT_DIR_FD; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|$O&:lstat", _keywords, - path_converter, &path, FSTATAT_DIR_FD_CONVERTER, &dir_fd)) + path_converter, &path, FSTATAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; + } return_value = os_lstat_impl(module, &path, dir_fd); exit: @@ -141,11 +143,13 @@ int _return_value; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&i|$O&pp:access", _keywords, - path_converter, &path, &mode, FACCESSAT_DIR_FD_CONVERTER, &dir_fd, &effective_ids, &follow_symlinks)) + path_converter, &path, &mode, FACCESSAT_DIR_FD_CONVERTER, &dir_fd, &effective_ids, &follow_symlinks)) { goto exit; + } _return_value = os_access_impl(module, &path, mode, dir_fd, effective_ids, follow_symlinks); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyBool_FromLong((long)_return_value); exit: @@ -179,11 +183,13 @@ int fd; char *_return_value; - if (!PyArg_Parse(arg, "i:ttyname", &fd)) + if (!PyArg_Parse(arg, "i:ttyname", &fd)) { goto exit; + } _return_value = os_ttyname_impl(module, fd); - if (_return_value == NULL) + if (_return_value == NULL) { goto exit; + } return_value = PyUnicode_DecodeFSDefault(_return_value); exit: @@ -238,8 +244,9 @@ path_t path = PATH_T_INITIALIZE("chdir", "path", 0, PATH_HAVE_FCHDIR); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:chdir", _keywords, - path_converter, &path)) + path_converter, &path)) { goto exit; + } return_value = os_chdir_impl(module, &path); exit: @@ -274,8 +281,9 @@ int fd; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:fchdir", _keywords, - fildes_converter, &fd)) + fildes_converter, &fd)) { goto exit; + } return_value = os_fchdir_impl(module, fd); exit: @@ -328,8 +336,9 @@ int follow_symlinks = 1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&i|$O&p:chmod", _keywords, - path_converter, &path, &mode, FCHMODAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) + path_converter, &path, &mode, FCHMODAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) { goto exit; + } return_value = os_chmod_impl(module, &path, mode, dir_fd, follow_symlinks); exit: @@ -364,8 +373,9 @@ int mode; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:fchmod", _keywords, - &fd, &mode)) + &fd, &mode)) { goto exit; + } return_value = os_fchmod_impl(module, fd, mode); exit: @@ -400,8 +410,9 @@ int mode; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&i:lchmod", _keywords, - path_converter, &path, &mode)) + path_converter, &path, &mode)) { goto exit; + } return_value = os_lchmod_impl(module, &path, mode); exit: @@ -444,8 +455,9 @@ int follow_symlinks = 1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&k|p:chflags", _keywords, - path_converter, &path, &flags, &follow_symlinks)) + path_converter, &path, &flags, &follow_symlinks)) { goto exit; + } return_value = os_chflags_impl(module, &path, flags, follow_symlinks); exit: @@ -483,8 +495,9 @@ unsigned long flags; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&k:lchflags", _keywords, - path_converter, &path, &flags)) + path_converter, &path, &flags)) { goto exit; + } return_value = os_lchflags_impl(module, &path, flags); exit: @@ -518,8 +531,9 @@ path_t path = PATH_T_INITIALIZE("chroot", "path", 0, 0); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:chroot", _keywords, - path_converter, &path)) + path_converter, &path)) { goto exit; + } return_value = os_chroot_impl(module, &path); exit: @@ -553,8 +567,9 @@ int fd; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:fsync", _keywords, - fildes_converter, &fd)) + fildes_converter, &fd)) { goto exit; + } return_value = os_fsync_impl(module, fd); exit: @@ -607,8 +622,9 @@ int fd; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:fdatasync", _keywords, - fildes_converter, &fd)) + fildes_converter, &fd)) { goto exit; + } return_value = os_fdatasync_impl(module, fd); exit: @@ -668,8 +684,9 @@ int follow_symlinks = 1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&O&|$O&p:chown", _keywords, - path_converter, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid, FCHOWNAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) + path_converter, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid, FCHOWNAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) { goto exit; + } return_value = os_chown_impl(module, &path, uid, gid, dir_fd, follow_symlinks); exit: @@ -707,8 +724,9 @@ gid_t gid; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "iO&O&:fchown", _keywords, - &fd, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid)) + &fd, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid)) { goto exit; + } return_value = os_fchown_impl(module, fd, uid, gid); exit: @@ -744,8 +762,9 @@ gid_t gid; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&O&:lchown", _keywords, - path_converter, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid)) + path_converter, &path, _Py_Uid_Converter, &uid, _Py_Gid_Converter, &gid)) { goto exit; + } return_value = os_lchown_impl(module, &path, uid, gid); exit: @@ -831,8 +850,9 @@ int follow_symlinks = 1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|$O&O&p:link", _keywords, - path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd, &follow_symlinks)) + path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd, &follow_symlinks)) { goto exit; + } return_value = os_link_impl(module, &src, &dst, src_dir_fd, dst_dir_fd, follow_symlinks); exit: @@ -877,8 +897,9 @@ path_t path = PATH_T_INITIALIZE("listdir", "path", 1, PATH_HAVE_FDOPENDIR); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O&:listdir", _keywords, - path_converter, &path)) + path_converter, &path)) { goto exit; + } return_value = os_listdir_impl(module, &path); exit: @@ -907,8 +928,9 @@ PyObject *return_value = NULL; path_t path = PATH_T_INITIALIZE("_getfullpathname", "path", 0, 0); - if (!PyArg_Parse(arg, "O&:_getfullpathname", path_converter, &path)) + if (!PyArg_Parse(arg, "O&:_getfullpathname", path_converter, &path)) { goto exit; + } return_value = os__getfullpathname_impl(module, &path); exit: @@ -940,8 +962,9 @@ PyObject *return_value = NULL; PyObject *path; - if (!PyArg_Parse(arg, "U:_getfinalpathname", &path)) + if (!PyArg_Parse(arg, "U:_getfinalpathname", &path)) { goto exit; + } return_value = os__getfinalpathname_impl(module, path); exit: @@ -969,8 +992,9 @@ PyObject *return_value = NULL; path_t path = PATH_T_INITIALIZE("_isdir", "path", 0, 0); - if (!PyArg_Parse(arg, "O&:_isdir", path_converter, &path)) + if (!PyArg_Parse(arg, "O&:_isdir", path_converter, &path)) { goto exit; + } return_value = os__isdir_impl(module, &path); exit: @@ -1004,8 +1028,9 @@ PyObject *path; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "U:_getvolumepathname", _keywords, - &path)) + &path)) { goto exit; + } return_value = os__getvolumepathname_impl(module, path); exit: @@ -1043,8 +1068,9 @@ int dir_fd = DEFAULT_DIR_FD; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|i$O&:mkdir", _keywords, - path_converter, &path, &mode, MKDIRAT_DIR_FD_CONVERTER, &dir_fd)) + path_converter, &path, &mode, MKDIRAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; + } return_value = os_mkdir_impl(module, &path, mode, dir_fd); exit: @@ -1074,8 +1100,9 @@ PyObject *return_value = NULL; int increment; - if (!PyArg_Parse(arg, "i:nice", &increment)) + if (!PyArg_Parse(arg, "i:nice", &increment)) { goto exit; + } return_value = os_nice_impl(module, increment); exit: @@ -1107,8 +1134,9 @@ int who; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:getpriority", _keywords, - &which, &who)) + &which, &who)) { goto exit; + } return_value = os_getpriority_impl(module, which, who); exit: @@ -1141,8 +1169,9 @@ int priority; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "iii:setpriority", _keywords, - &which, &who, &priority)) + &which, &who, &priority)) { goto exit; + } return_value = os_setpriority_impl(module, which, who, priority); exit: @@ -1181,8 +1210,9 @@ int dst_dir_fd = DEFAULT_DIR_FD; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|$O&O&:rename", _keywords, - path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd)) + path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd)) { goto exit; + } return_value = os_rename_impl(module, &src, &dst, src_dir_fd, dst_dir_fd); exit: @@ -1224,8 +1254,9 @@ int dst_dir_fd = DEFAULT_DIR_FD; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|$O&O&:replace", _keywords, - path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd)) + path_converter, &src, path_converter, &dst, dir_fd_converter, &src_dir_fd, dir_fd_converter, &dst_dir_fd)) { goto exit; + } return_value = os_replace_impl(module, &src, &dst, src_dir_fd, dst_dir_fd); exit: @@ -1263,8 +1294,9 @@ int dir_fd = DEFAULT_DIR_FD; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|$O&:rmdir", _keywords, - path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) + path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; + } return_value = os_rmdir_impl(module, &path, dir_fd); exit: @@ -1297,11 +1329,13 @@ long _return_value; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "u:system", _keywords, - &command)) + &command)) { goto exit; + } _return_value = os_system_impl(module, command); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -1333,11 +1367,13 @@ long _return_value; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:system", _keywords, - PyUnicode_FSConverter, &command)) + PyUnicode_FSConverter, &command)) { goto exit; + } _return_value = os_system_impl(module, command); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -1367,8 +1403,9 @@ PyObject *return_value = NULL; int mask; - if (!PyArg_Parse(arg, "i:umask", &mask)) + if (!PyArg_Parse(arg, "i:umask", &mask)) { goto exit; + } return_value = os_umask_impl(module, mask); exit: @@ -1401,8 +1438,9 @@ int dir_fd = DEFAULT_DIR_FD; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|$O&:unlink", _keywords, - path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) + path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; + } return_value = os_unlink_impl(module, &path, dir_fd); exit: @@ -1438,8 +1476,9 @@ int dir_fd = DEFAULT_DIR_FD; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|$O&:remove", _keywords, - path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) + path_converter, &path, UNLINKAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; + } return_value = os_remove_impl(module, &path, dir_fd); exit: @@ -1522,8 +1561,9 @@ int follow_symlinks = 1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|O$OO&p:utime", _keywords, - path_converter, &path, ×, &ns, FUTIMENSAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) + path_converter, &path, ×, &ns, FUTIMENSAT_DIR_FD_CONVERTER, &dir_fd, &follow_symlinks)) { goto exit; + } return_value = os_utime_impl(module, &path, times, ns, dir_fd, follow_symlinks); exit: @@ -1553,8 +1593,9 @@ int status; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:_exit", _keywords, - &status)) + &status)) { goto exit; + } return_value = os__exit_impl(module, status); exit: @@ -1588,8 +1629,9 @@ PyObject *argv; if (!PyArg_ParseTuple(args, "O&O:execv", - PyUnicode_FSConverter, &path, &argv)) + PyUnicode_FSConverter, &path, &argv)) { goto exit; + } return_value = os_execv_impl(module, path, argv); exit: @@ -1633,8 +1675,9 @@ PyObject *env; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&OO:execve", _keywords, - path_converter, &path, &argv, &env)) + path_converter, &path, &argv, &env)) { goto exit; + } return_value = os_execve_impl(module, &path, argv, env); exit: @@ -1676,8 +1719,9 @@ PyObject *argv; if (!PyArg_ParseTuple(args, "iO&O:spawnv", - &mode, PyUnicode_FSConverter, &path, &argv)) + &mode, PyUnicode_FSConverter, &path, &argv)) { goto exit; + } return_value = os_spawnv_impl(module, mode, path, argv); exit: @@ -1723,8 +1767,9 @@ PyObject *env; if (!PyArg_ParseTuple(args, "iO&OO:spawnve", - &mode, PyUnicode_FSConverter, &path, &argv, &env)) + &mode, PyUnicode_FSConverter, &path, &argv, &env)) { goto exit; + } return_value = os_spawnve_impl(module, mode, path, argv, env); exit: @@ -1806,8 +1851,9 @@ int policy; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:sched_get_priority_max", _keywords, - &policy)) + &policy)) { goto exit; + } return_value = os_sched_get_priority_max_impl(module, policy); exit: @@ -1838,8 +1884,9 @@ int policy; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:sched_get_priority_min", _keywords, - &policy)) + &policy)) { goto exit; + } return_value = os_sched_get_priority_min_impl(module, policy); exit: @@ -1870,8 +1917,9 @@ PyObject *return_value = NULL; pid_t pid; - if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getscheduler", &pid)) + if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getscheduler", &pid)) { goto exit; + } return_value = os_sched_getscheduler_impl(module, pid); exit: @@ -1902,8 +1950,9 @@ PyObject *sched_priority; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:sched_param", _keywords, - &sched_priority)) + &sched_priority)) { goto exit; + } return_value = os_sched_param_impl(type, sched_priority); exit: @@ -1939,8 +1988,9 @@ struct sched_param param; if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "iO&:sched_setscheduler", - &pid, &policy, convert_sched_param, ¶m)) + &pid, &policy, convert_sched_param, ¶m)) { goto exit; + } return_value = os_sched_setscheduler_impl(module, pid, policy, ¶m); exit: @@ -1972,8 +2022,9 @@ PyObject *return_value = NULL; pid_t pid; - if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getparam", &pid)) + if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getparam", &pid)) { goto exit; + } return_value = os_sched_getparam_impl(module, pid); exit: @@ -2008,8 +2059,9 @@ struct sched_param param; if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "O&:sched_setparam", - &pid, convert_sched_param, ¶m)) + &pid, convert_sched_param, ¶m)) { goto exit; + } return_value = os_sched_setparam_impl(module, pid, ¶m); exit: @@ -2041,11 +2093,13 @@ pid_t pid; double _return_value; - if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_rr_get_interval", &pid)) + if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_rr_get_interval", &pid)) { goto exit; + } _return_value = os_sched_rr_get_interval_impl(module, pid); - if ((_return_value == -1.0) && PyErr_Occurred()) + if ((_return_value == -1.0) && PyErr_Occurred()) { goto exit; + } return_value = PyFloat_FromDouble(_return_value); exit: @@ -2100,8 +2154,9 @@ PyObject *mask; if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "O:sched_setaffinity", - &pid, &mask)) + &pid, &mask)) { goto exit; + } return_value = os_sched_setaffinity_impl(module, pid, mask); exit: @@ -2132,8 +2187,9 @@ PyObject *return_value = NULL; pid_t pid; - if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getaffinity", &pid)) + if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":sched_getaffinity", &pid)) { goto exit; + } return_value = os_sched_getaffinity_impl(module, pid); exit: @@ -2322,8 +2378,9 @@ pid_t pid; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" _Py_PARSE_PID ":getpgid", _keywords, - &pid)) + &pid)) { goto exit; + } return_value = os_getpgid_impl(module, pid); exit: @@ -2467,8 +2524,9 @@ Py_ssize_t signal; if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "n:kill", - &pid, &signal)) + &pid, &signal)) { goto exit; + } return_value = os_kill_impl(module, pid, signal); exit: @@ -2499,8 +2557,9 @@ int signal; if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "i:killpg", - &pgid, &signal)) + &pgid, &signal)) { goto exit; + } return_value = os_killpg_impl(module, pgid, signal); exit: @@ -2529,8 +2588,9 @@ PyObject *return_value = NULL; int op; - if (!PyArg_Parse(arg, "i:plock", &op)) + if (!PyArg_Parse(arg, "i:plock", &op)) { goto exit; + } return_value = os_plock_impl(module, op); exit: @@ -2559,8 +2619,9 @@ PyObject *return_value = NULL; uid_t uid; - if (!PyArg_Parse(arg, "O&:setuid", _Py_Uid_Converter, &uid)) + if (!PyArg_Parse(arg, "O&:setuid", _Py_Uid_Converter, &uid)) { goto exit; + } return_value = os_setuid_impl(module, uid); exit: @@ -2589,8 +2650,9 @@ PyObject *return_value = NULL; uid_t euid; - if (!PyArg_Parse(arg, "O&:seteuid", _Py_Uid_Converter, &euid)) + if (!PyArg_Parse(arg, "O&:seteuid", _Py_Uid_Converter, &euid)) { goto exit; + } return_value = os_seteuid_impl(module, euid); exit: @@ -2619,8 +2681,9 @@ PyObject *return_value = NULL; gid_t egid; - if (!PyArg_Parse(arg, "O&:setegid", _Py_Gid_Converter, &egid)) + if (!PyArg_Parse(arg, "O&:setegid", _Py_Gid_Converter, &egid)) { goto exit; + } return_value = os_setegid_impl(module, egid); exit: @@ -2651,8 +2714,9 @@ uid_t euid; if (!PyArg_ParseTuple(args, "O&O&:setreuid", - _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid)) + _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid)) { goto exit; + } return_value = os_setreuid_impl(module, ruid, euid); exit: @@ -2683,8 +2747,9 @@ gid_t egid; if (!PyArg_ParseTuple(args, "O&O&:setregid", - _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid)) + _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid)) { goto exit; + } return_value = os_setregid_impl(module, rgid, egid); exit: @@ -2713,8 +2778,9 @@ PyObject *return_value = NULL; gid_t gid; - if (!PyArg_Parse(arg, "O&:setgid", _Py_Gid_Converter, &gid)) + if (!PyArg_Parse(arg, "O&:setgid", _Py_Gid_Converter, &gid)) { goto exit; + } return_value = os_setgid_impl(module, gid); exit: @@ -2761,8 +2827,9 @@ int options; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:wait3", _keywords, - &options)) + &options)) { goto exit; + } return_value = os_wait3_impl(module, options); exit: @@ -2797,8 +2864,9 @@ int options; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "" _Py_PARSE_PID "i:wait4", _keywords, - &pid, &options)) + &pid, &options)) { goto exit; + } return_value = os_wait4_impl(module, pid, options); exit: @@ -2841,8 +2909,9 @@ int options; if (!PyArg_ParseTuple(args, "i" _Py_PARSE_PID "i:waitid", - &idtype, &id, &options)) + &idtype, &id, &options)) { goto exit; + } return_value = os_waitid_impl(module, idtype, id, options); exit: @@ -2878,8 +2947,9 @@ int options; if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "i:waitpid", - &pid, &options)) + &pid, &options)) { goto exit; + } return_value = os_waitpid_impl(module, pid, options); exit: @@ -2915,8 +2985,9 @@ int options; if (!PyArg_ParseTuple(args, "" _Py_PARSE_INTPTR "i:waitpid", - &pid, &options)) + &pid, &options)) { goto exit; + } return_value = os_waitpid_impl(module, pid, options); exit: @@ -2986,8 +3057,9 @@ int dir_fd = DEFAULT_DIR_FD; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|p$O&:symlink", _keywords, - path_converter, &src, path_converter, &dst, &target_is_directory, SYMLINKAT_DIR_FD_CONVERTER, &dir_fd)) + path_converter, &src, path_converter, &dst, &target_is_directory, SYMLINKAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; + } return_value = os_symlink_impl(module, &src, &dst, target_is_directory, dir_fd); exit: @@ -3047,8 +3119,9 @@ PyObject *return_value = NULL; pid_t pid; - if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":getsid", &pid)) + if (!PyArg_Parse(arg, "" _Py_PARSE_PID ":getsid", &pid)) { goto exit; + } return_value = os_getsid_impl(module, pid); exit: @@ -3101,8 +3174,9 @@ pid_t pgrp; if (!PyArg_ParseTuple(args, "" _Py_PARSE_PID "" _Py_PARSE_PID ":setpgid", - &pid, &pgrp)) + &pid, &pgrp)) { goto exit; + } return_value = os_setpgid_impl(module, pid, pgrp); exit: @@ -3131,8 +3205,9 @@ PyObject *return_value = NULL; int fd; - if (!PyArg_Parse(arg, "i:tcgetpgrp", &fd)) + if (!PyArg_Parse(arg, "i:tcgetpgrp", &fd)) { goto exit; + } return_value = os_tcgetpgrp_impl(module, fd); exit: @@ -3163,8 +3238,9 @@ pid_t pgid; if (!PyArg_ParseTuple(args, "i" _Py_PARSE_PID ":tcsetpgrp", - &fd, &pgid)) + &fd, &pgid)) { goto exit; + } return_value = os_tcsetpgrp_impl(module, fd, pgid); exit: @@ -3203,11 +3279,13 @@ int _return_value; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&i|i$O&:open", _keywords, - path_converter, &path, &flags, &mode, OPENAT_DIR_FD_CONVERTER, &dir_fd)) + path_converter, &path, &flags, &mode, OPENAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; + } _return_value = os_open_impl(module, &path, flags, mode, dir_fd); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -3237,8 +3315,9 @@ int fd; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:close", _keywords, - &fd)) + &fd)) { goto exit; + } return_value = os_close_impl(module, fd); exit: @@ -3265,8 +3344,9 @@ int fd_high; if (!PyArg_ParseTuple(args, "ii:closerange", - &fd_low, &fd_high)) + &fd_low, &fd_high)) { goto exit; + } return_value = os_closerange_impl(module, fd_low, fd_high); exit: @@ -3292,11 +3372,13 @@ int fd; int _return_value; - if (!PyArg_Parse(arg, "i:dup", &fd)) + if (!PyArg_Parse(arg, "i:dup", &fd)) { goto exit; + } _return_value = os_dup_impl(module, fd); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -3325,8 +3407,9 @@ int inheritable = 1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii|p:dup2", _keywords, - &fd, &fd2, &inheritable)) + &fd, &fd2, &inheritable)) { goto exit; + } return_value = os_dup2_impl(module, fd, fd2, inheritable); exit: @@ -3363,8 +3446,9 @@ Py_off_t length; if (!PyArg_ParseTuple(args, "iiO&:lockf", - &fd, &command, Py_off_t_converter, &length)) + &fd, &command, Py_off_t_converter, &length)) { goto exit; + } return_value = os_lockf_impl(module, fd, command, length); exit: @@ -3398,11 +3482,13 @@ Py_off_t _return_value; if (!PyArg_ParseTuple(args, "iO&i:lseek", - &fd, Py_off_t_converter, &position, &how)) + &fd, Py_off_t_converter, &position, &how)) { goto exit; + } _return_value = os_lseek_impl(module, fd, position, how); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromPy_off_t(_return_value); exit: @@ -3429,8 +3515,9 @@ Py_ssize_t length; if (!PyArg_ParseTuple(args, "in:read", - &fd, &length)) + &fd, &length)) { goto exit; + } return_value = os_read_impl(module, fd, length); exit: @@ -3468,11 +3555,13 @@ Py_ssize_t _return_value; if (!PyArg_ParseTuple(args, "iO:readv", - &fd, &buffers)) + &fd, &buffers)) { goto exit; + } _return_value = os_readv_impl(module, fd, buffers); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromSsize_t(_return_value); exit: @@ -3507,8 +3596,9 @@ Py_off_t offset; if (!PyArg_ParseTuple(args, "iiO&:pread", - &fd, &length, Py_off_t_converter, &offset)) + &fd, &length, Py_off_t_converter, &offset)) { goto exit; + } return_value = os_pread_impl(module, fd, length, offset); exit: @@ -3538,17 +3628,20 @@ Py_ssize_t _return_value; if (!PyArg_ParseTuple(args, "iy*:write", - &fd, &data)) + &fd, &data)) { goto exit; + } _return_value = os_write_impl(module, fd, &data); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromSsize_t(_return_value); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -3576,8 +3669,9 @@ int fd; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:fstat", _keywords, - &fd)) + &fd)) { goto exit; + } return_value = os_fstat_impl(module, fd); exit: @@ -3606,11 +3700,13 @@ int fd; int _return_value; - if (!PyArg_Parse(arg, "i:isatty", &fd)) + if (!PyArg_Parse(arg, "i:isatty", &fd)) { goto exit; + } _return_value = os_isatty_impl(module, fd); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyBool_FromLong((long)_return_value); exit: @@ -3668,8 +3764,9 @@ PyObject *return_value = NULL; int flags; - if (!PyArg_Parse(arg, "i:pipe2", &flags)) + if (!PyArg_Parse(arg, "i:pipe2", &flags)) { goto exit; + } return_value = os_pipe2_impl(module, flags); exit: @@ -3704,11 +3801,13 @@ Py_ssize_t _return_value; if (!PyArg_ParseTuple(args, "iO:writev", - &fd, &buffers)) + &fd, &buffers)) { goto exit; + } _return_value = os_writev_impl(module, fd, buffers); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromSsize_t(_return_value); exit: @@ -3746,17 +3845,20 @@ Py_ssize_t _return_value; if (!PyArg_ParseTuple(args, "iy*O&:pwrite", - &fd, &buffer, Py_off_t_converter, &offset)) + &fd, &buffer, Py_off_t_converter, &offset)) { goto exit; + } _return_value = os_pwrite_impl(module, fd, &buffer, offset); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromSsize_t(_return_value); exit: /* Cleanup for buffer */ - if (buffer.obj) + if (buffer.obj) { PyBuffer_Release(&buffer); + } return return_value; } @@ -3792,8 +3894,9 @@ int dir_fd = DEFAULT_DIR_FD; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|i$O&:mkfifo", _keywords, - path_converter, &path, &mode, MKFIFOAT_DIR_FD_CONVERTER, &dir_fd)) + path_converter, &path, &mode, MKFIFOAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; + } return_value = os_mkfifo_impl(module, &path, mode, dir_fd); exit: @@ -3843,8 +3946,9 @@ int dir_fd = DEFAULT_DIR_FD; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|iO&$O&:mknod", _keywords, - path_converter, &path, &mode, _Py_Dev_Converter, &device, MKNODAT_DIR_FD_CONVERTER, &dir_fd)) + path_converter, &path, &mode, _Py_Dev_Converter, &device, MKNODAT_DIR_FD_CONVERTER, &dir_fd)) { goto exit; + } return_value = os_mknod_impl(module, &path, mode, device, dir_fd); exit: @@ -3877,11 +3981,13 @@ dev_t device; unsigned int _return_value; - if (!PyArg_Parse(arg, "O&:major", _Py_Dev_Converter, &device)) + if (!PyArg_Parse(arg, "O&:major", _Py_Dev_Converter, &device)) { goto exit; + } _return_value = os_major_impl(module, device); - if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) + if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromUnsignedLong((unsigned long)_return_value); exit: @@ -3911,11 +4017,13 @@ dev_t device; unsigned int _return_value; - if (!PyArg_Parse(arg, "O&:minor", _Py_Dev_Converter, &device)) + if (!PyArg_Parse(arg, "O&:minor", _Py_Dev_Converter, &device)) { goto exit; + } _return_value = os_minor_impl(module, device); - if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) + if ((_return_value == (unsigned int)-1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromUnsignedLong((unsigned long)_return_value); exit: @@ -3947,11 +4055,13 @@ dev_t _return_value; if (!PyArg_ParseTuple(args, "ii:makedev", - &major, &minor)) + &major, &minor)) { goto exit; + } _return_value = os_makedev_impl(module, major, minor); - if ((_return_value == (dev_t)-1) && PyErr_Occurred()) + if ((_return_value == (dev_t)-1) && PyErr_Occurred()) { goto exit; + } return_value = _PyLong_FromDev(_return_value); exit: @@ -3982,8 +4092,9 @@ Py_off_t length; if (!PyArg_ParseTuple(args, "iO&:ftruncate", - &fd, Py_off_t_converter, &length)) + &fd, Py_off_t_converter, &length)) { goto exit; + } return_value = os_ftruncate_impl(module, fd, length); exit: @@ -4018,8 +4129,9 @@ Py_off_t length; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&:truncate", _keywords, - path_converter, &path, Py_off_t_converter, &length)) + path_converter, &path, Py_off_t_converter, &length)) { goto exit; + } return_value = os_truncate_impl(module, &path, length); exit: @@ -4058,8 +4170,9 @@ Py_off_t length; if (!PyArg_ParseTuple(args, "iO&O&:posix_fallocate", - &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length)) + &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length)) { goto exit; + } return_value = os_posix_fallocate_impl(module, fd, offset, length); exit: @@ -4101,8 +4214,9 @@ int advice; if (!PyArg_ParseTuple(args, "iO&O&i:posix_fadvise", - &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length, &advice)) + &fd, Py_off_t_converter, &offset, Py_off_t_converter, &length, &advice)) { goto exit; + } return_value = os_posix_fadvise_impl(module, fd, offset, length, advice); exit: @@ -4133,8 +4247,9 @@ PyObject *value; if (!PyArg_ParseTuple(args, "UU:putenv", - &name, &value)) + &name, &value)) { goto exit; + } return_value = os_putenv_impl(module, name, value); exit: @@ -4165,8 +4280,9 @@ PyObject *value = NULL; if (!PyArg_ParseTuple(args, "O&O&:putenv", - PyUnicode_FSConverter, &name, PyUnicode_FSConverter, &value)) + PyUnicode_FSConverter, &name, PyUnicode_FSConverter, &value)) { goto exit; + } return_value = os_putenv_impl(module, name, value); exit: @@ -4200,8 +4316,9 @@ PyObject *return_value = NULL; PyObject *name = NULL; - if (!PyArg_Parse(arg, "O&:unsetenv", PyUnicode_FSConverter, &name)) + if (!PyArg_Parse(arg, "O&:unsetenv", PyUnicode_FSConverter, &name)) { goto exit; + } return_value = os_unsetenv_impl(module, name); exit: @@ -4231,8 +4348,9 @@ PyObject *return_value = NULL; int code; - if (!PyArg_Parse(arg, "i:strerror", &code)) + if (!PyArg_Parse(arg, "i:strerror", &code)) { goto exit; + } return_value = os_strerror_impl(module, code); exit: @@ -4260,11 +4378,13 @@ int status; int _return_value; - if (!PyArg_Parse(arg, "i:WCOREDUMP", &status)) + if (!PyArg_Parse(arg, "i:WCOREDUMP", &status)) { goto exit; + } _return_value = os_WCOREDUMP_impl(module, status); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyBool_FromLong((long)_return_value); exit: @@ -4299,11 +4419,13 @@ int _return_value; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WIFCONTINUED", _keywords, - &status)) + &status)) { goto exit; + } _return_value = os_WIFCONTINUED_impl(module, status); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyBool_FromLong((long)_return_value); exit: @@ -4335,11 +4457,13 @@ int _return_value; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WIFSTOPPED", _keywords, - &status)) + &status)) { goto exit; + } _return_value = os_WIFSTOPPED_impl(module, status); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyBool_FromLong((long)_return_value); exit: @@ -4371,11 +4495,13 @@ int _return_value; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WIFSIGNALED", _keywords, - &status)) + &status)) { goto exit; + } _return_value = os_WIFSIGNALED_impl(module, status); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyBool_FromLong((long)_return_value); exit: @@ -4407,11 +4533,13 @@ int _return_value; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WIFEXITED", _keywords, - &status)) + &status)) { goto exit; + } _return_value = os_WIFEXITED_impl(module, status); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyBool_FromLong((long)_return_value); exit: @@ -4443,11 +4571,13 @@ int _return_value; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WEXITSTATUS", _keywords, - &status)) + &status)) { goto exit; + } _return_value = os_WEXITSTATUS_impl(module, status); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -4479,11 +4609,13 @@ int _return_value; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WTERMSIG", _keywords, - &status)) + &status)) { goto exit; + } _return_value = os_WTERMSIG_impl(module, status); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -4515,11 +4647,13 @@ int _return_value; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:WSTOPSIG", _keywords, - &status)) + &status)) { goto exit; + } _return_value = os_WSTOPSIG_impl(module, status); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -4550,8 +4684,9 @@ PyObject *return_value = NULL; int fd; - if (!PyArg_Parse(arg, "i:fstatvfs", &fd)) + if (!PyArg_Parse(arg, "i:fstatvfs", &fd)) { goto exit; + } return_value = os_fstatvfs_impl(module, fd); exit: @@ -4586,8 +4721,9 @@ path_t path = PATH_T_INITIALIZE("statvfs", "path", 0, PATH_HAVE_FSTATVFS); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&:statvfs", _keywords, - path_converter, &path)) + path_converter, &path)) { goto exit; + } return_value = os_statvfs_impl(module, &path); exit: @@ -4621,8 +4757,9 @@ Py_UNICODE *path; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "u:_getdiskusage", _keywords, - &path)) + &path)) { goto exit; + } return_value = os__getdiskusage_impl(module, path); exit: @@ -4656,11 +4793,13 @@ long _return_value; if (!PyArg_ParseTuple(args, "iO&:fpathconf", - &fd, conv_path_confname, &name)) + &fd, conv_path_confname, &name)) { goto exit; + } _return_value = os_fpathconf_impl(module, fd, name); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -4697,11 +4836,13 @@ long _return_value; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&:pathconf", _keywords, - path_converter, &path, conv_path_confname, &name)) + path_converter, &path, conv_path_confname, &name)) { goto exit; + } _return_value = os_pathconf_impl(module, &path, name); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -4733,8 +4874,9 @@ PyObject *return_value = NULL; int name; - if (!PyArg_Parse(arg, "O&:confstr", conv_confstr_confname, &name)) + if (!PyArg_Parse(arg, "O&:confstr", conv_confstr_confname, &name)) { goto exit; + } return_value = os_confstr_impl(module, name); exit: @@ -4764,11 +4906,13 @@ int name; long _return_value; - if (!PyArg_Parse(arg, "O&:sysconf", conv_sysconf_confname, &name)) + if (!PyArg_Parse(arg, "O&:sysconf", conv_sysconf_confname, &name)) { goto exit; + } _return_value = os_sysconf_impl(module, name); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -4847,8 +4991,9 @@ int fd; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:device_encoding", _keywords, - &fd)) + &fd)) { goto exit; + } return_value = os_device_encoding_impl(module, fd); exit: @@ -4878,8 +5023,9 @@ uid_t suid; if (!PyArg_ParseTuple(args, "O&O&O&:setresuid", - _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid, _Py_Uid_Converter, &suid)) + _Py_Uid_Converter, &ruid, _Py_Uid_Converter, &euid, _Py_Uid_Converter, &suid)) { goto exit; + } return_value = os_setresuid_impl(module, ruid, euid, suid); exit: @@ -4911,8 +5057,9 @@ gid_t sgid; if (!PyArg_ParseTuple(args, "O&O&O&:setresgid", - _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid, _Py_Gid_Converter, &sgid)) + _Py_Gid_Converter, &rgid, _Py_Gid_Converter, &egid, _Py_Gid_Converter, &sgid)) { goto exit; + } return_value = os_setresgid_impl(module, rgid, egid, sgid); exit: @@ -4995,8 +5142,9 @@ int follow_symlinks = 1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|$p:getxattr", _keywords, - path_converter, &path, path_converter, &attribute, &follow_symlinks)) + path_converter, &path, path_converter, &attribute, &follow_symlinks)) { goto exit; + } return_value = os_getxattr_impl(module, &path, &attribute, follow_symlinks); exit: @@ -5043,8 +5191,9 @@ int follow_symlinks = 1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&y*|i$p:setxattr", _keywords, - path_converter, &path, path_converter, &attribute, &value, &flags, &follow_symlinks)) + path_converter, &path, path_converter, &attribute, &value, &flags, &follow_symlinks)) { goto exit; + } return_value = os_setxattr_impl(module, &path, &attribute, &value, flags, follow_symlinks); exit: @@ -5053,8 +5202,9 @@ /* Cleanup for attribute */ path_cleanup(&attribute); /* Cleanup for value */ - if (value.obj) + if (value.obj) { PyBuffer_Release(&value); + } return return_value; } @@ -5091,8 +5241,9 @@ int follow_symlinks = 1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&O&|$p:removexattr", _keywords, - path_converter, &path, path_converter, &attribute, &follow_symlinks)) + path_converter, &path, path_converter, &attribute, &follow_symlinks)) { goto exit; + } return_value = os_removexattr_impl(module, &path, &attribute, follow_symlinks); exit: @@ -5135,8 +5286,9 @@ int follow_symlinks = 1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O&$p:listxattr", _keywords, - path_converter, &path, &follow_symlinks)) + path_converter, &path, &follow_symlinks)) { goto exit; + } return_value = os_listxattr_impl(module, &path, follow_symlinks); exit: @@ -5166,8 +5318,9 @@ PyObject *return_value = NULL; Py_ssize_t size; - if (!PyArg_Parse(arg, "n:urandom", &size)) + if (!PyArg_Parse(arg, "n:urandom", &size)) { goto exit; + } return_value = os_urandom_impl(module, size); exit: @@ -5215,11 +5368,13 @@ int fd; int _return_value; - if (!PyArg_Parse(arg, "i:get_inheritable", &fd)) + if (!PyArg_Parse(arg, "i:get_inheritable", &fd)) { goto exit; + } _return_value = os_get_inheritable_impl(module, fd); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyBool_FromLong((long)_return_value); exit: @@ -5246,8 +5401,9 @@ int inheritable; if (!PyArg_ParseTuple(args, "ii:set_inheritable", - &fd, &inheritable)) + &fd, &inheritable)) { goto exit; + } return_value = os_set_inheritable_impl(module, fd, inheritable); exit: @@ -5275,11 +5431,13 @@ Py_intptr_t handle; int _return_value; - if (!PyArg_Parse(arg, "" _Py_PARSE_INTPTR ":get_handle_inheritable", &handle)) + if (!PyArg_Parse(arg, "" _Py_PARSE_INTPTR ":get_handle_inheritable", &handle)) { goto exit; + } _return_value = os_get_handle_inheritable_impl(module, handle); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyBool_FromLong((long)_return_value); exit: @@ -5311,8 +5469,9 @@ int inheritable; if (!PyArg_ParseTuple(args, "" _Py_PARSE_INTPTR "p:set_handle_inheritable", - &handle, &inheritable)) + &handle, &inheritable)) { goto exit; + } return_value = os_set_handle_inheritable_impl(module, handle, inheritable); exit: @@ -5345,8 +5504,9 @@ PyObject *path; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:fspath", _keywords, - &path)) + &path)) { goto exit; + } return_value = os_fspath_impl(module, path); exit: @@ -5824,4 +5984,4 @@ #ifndef OS_SET_HANDLE_INHERITABLE_METHODDEF #define OS_SET_HANDLE_INHERITABLE_METHODDEF #endif /* !defined(OS_SET_HANDLE_INHERITABLE_METHODDEF) */ -/*[clinic end generated code: output=e64e246b8270abda input=a9049054013a1b77]*/ +/*[clinic end generated code: output=31dd4f672c8a6f8c input=a9049054013a1b77]*/ diff --git a/Modules/clinic/pwdmodule.c.h b/Modules/clinic/pwdmodule.c.h --- a/Modules/clinic/pwdmodule.c.h +++ b/Modules/clinic/pwdmodule.c.h @@ -33,8 +33,9 @@ PyObject *return_value = NULL; PyObject *arg; - if (!PyArg_Parse(arg_, "U:getpwnam", &arg)) + if (!PyArg_Parse(arg_, "U:getpwnam", &arg)) { goto exit; + } return_value = pwd_getpwnam_impl(module, arg); exit: @@ -68,4 +69,4 @@ #ifndef PWD_GETPWALL_METHODDEF #define PWD_GETPWALL_METHODDEF #endif /* !defined(PWD_GETPWALL_METHODDEF) */ -/*[clinic end generated code: output=2ed0ecf34fd3f98f input=a9049054013a1b77]*/ +/*[clinic end generated code: output=f807c89b44be0fde input=a9049054013a1b77]*/ diff --git a/Modules/clinic/pyexpat.c.h b/Modules/clinic/pyexpat.c.h --- a/Modules/clinic/pyexpat.c.h +++ b/Modules/clinic/pyexpat.c.h @@ -25,8 +25,9 @@ int isfinal = 0; if (!PyArg_ParseTuple(args, "O|i:Parse", - &data, &isfinal)) + &data, &isfinal)) { goto exit; + } return_value = pyexpat_xmlparser_Parse_impl(self, data, isfinal); exit: @@ -60,8 +61,9 @@ PyObject *return_value = NULL; const char *base; - if (!PyArg_Parse(arg, "s:SetBase", &base)) + if (!PyArg_Parse(arg, "s:SetBase", &base)) { goto exit; + } return_value = pyexpat_xmlparser_SetBase_impl(self, base); exit: @@ -129,8 +131,9 @@ const char *encoding = NULL; if (!PyArg_ParseTuple(args, "z|s:ExternalEntityParserCreate", - &context, &encoding)) + &context, &encoding)) { goto exit; + } return_value = pyexpat_xmlparser_ExternalEntityParserCreate_impl(self, context, encoding); exit: @@ -160,8 +163,9 @@ PyObject *return_value = NULL; int flag; - if (!PyArg_Parse(arg, "i:SetParamEntityParsing", &flag)) + if (!PyArg_Parse(arg, "i:SetParamEntityParsing", &flag)) { goto exit; + } return_value = pyexpat_xmlparser_SetParamEntityParsing_impl(self, flag); exit: @@ -193,8 +197,9 @@ int flag = 1; if (!PyArg_ParseTuple(args, "|p:UseForeignDTD", - &flag)) + &flag)) { goto exit; + } return_value = pyexpat_xmlparser_UseForeignDTD_impl(self, flag); exit: @@ -244,8 +249,9 @@ PyObject *intern = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|zzO:ParserCreate", _keywords, - &encoding, &namespace_separator, &intern)) + &encoding, &namespace_separator, &intern)) { goto exit; + } return_value = pyexpat_ParserCreate_impl(module, encoding, namespace_separator, intern); exit: @@ -270,8 +276,9 @@ PyObject *return_value = NULL; long code; - if (!PyArg_Parse(arg, "l:ErrorString", &code)) + if (!PyArg_Parse(arg, "l:ErrorString", &code)) { goto exit; + } return_value = pyexpat_ErrorString_impl(module, code); exit: @@ -281,4 +288,4 @@ #ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF #define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF #endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */ -/*[clinic end generated code: output=bf4d99c9702d8a6c input=a9049054013a1b77]*/ +/*[clinic end generated code: output=71a60d709647fbe3 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/sha1module.c.h b/Modules/clinic/sha1module.c.h --- a/Modules/clinic/sha1module.c.h +++ b/Modules/clinic/sha1module.c.h @@ -85,11 +85,12 @@ PyObject *string = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha1", _keywords, - &string)) + &string)) { goto exit; + } return_value = _sha1_sha1_impl(module, string); exit: return return_value; } -/*[clinic end generated code: output=be19102f3120490a input=a9049054013a1b77]*/ +/*[clinic end generated code: output=40df3f8955919e72 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/sha256module.c.h b/Modules/clinic/sha256module.c.h --- a/Modules/clinic/sha256module.c.h +++ b/Modules/clinic/sha256module.c.h @@ -85,8 +85,9 @@ PyObject *string = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha256", _keywords, - &string)) + &string)) { goto exit; + } return_value = _sha256_sha256_impl(module, string); exit: @@ -113,11 +114,12 @@ PyObject *string = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha224", _keywords, - &string)) + &string)) { goto exit; + } return_value = _sha256_sha224_impl(module, string); exit: return return_value; } -/*[clinic end generated code: output=354cedf3b632c7b2 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=e85cc4a223371d84 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/sha512module.c.h b/Modules/clinic/sha512module.c.h --- a/Modules/clinic/sha512module.c.h +++ b/Modules/clinic/sha512module.c.h @@ -103,8 +103,9 @@ PyObject *string = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha512", _keywords, - &string)) + &string)) { goto exit; + } return_value = _sha512_sha512_impl(module, string); exit: @@ -135,8 +136,9 @@ PyObject *string = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O:sha384", _keywords, - &string)) + &string)) { goto exit; + } return_value = _sha512_sha384_impl(module, string); exit: @@ -168,4 +170,4 @@ #ifndef _SHA512_SHA384_METHODDEF #define _SHA512_SHA384_METHODDEF #endif /* !defined(_SHA512_SHA384_METHODDEF) */ -/*[clinic end generated code: output=1c7d385731fee7c0 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=845af47cea22e2a1 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/signalmodule.c.h b/Modules/clinic/signalmodule.c.h --- a/Modules/clinic/signalmodule.c.h +++ b/Modules/clinic/signalmodule.c.h @@ -23,11 +23,13 @@ int seconds; long _return_value; - if (!PyArg_Parse(arg, "i:alarm", &seconds)) + if (!PyArg_Parse(arg, "i:alarm", &seconds)) { goto exit; + } _return_value = signal_alarm_impl(module, seconds); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -85,8 +87,9 @@ PyObject *handler; if (!PyArg_ParseTuple(args, "iO:signal", - &signalnum, &handler)) + &signalnum, &handler)) { goto exit; + } return_value = signal_signal_impl(module, signalnum, handler); exit: @@ -117,8 +120,9 @@ PyObject *return_value = NULL; int signalnum; - if (!PyArg_Parse(arg, "i:getsignal", &signalnum)) + if (!PyArg_Parse(arg, "i:getsignal", &signalnum)) { goto exit; + } return_value = signal_getsignal_impl(module, signalnum); exit: @@ -150,8 +154,9 @@ int flag; if (!PyArg_ParseTuple(args, "ii:siginterrupt", - &signalnum, &flag)) + &signalnum, &flag)) { goto exit; + } return_value = signal_siginterrupt_impl(module, signalnum, flag); exit: @@ -189,8 +194,9 @@ double interval = 0.0; if (!PyArg_ParseTuple(args, "id|d:setitimer", - &which, &seconds, &interval)) + &which, &seconds, &interval)) { goto exit; + } return_value = signal_setitimer_impl(module, which, seconds, interval); exit: @@ -219,8 +225,9 @@ PyObject *return_value = NULL; int which; - if (!PyArg_Parse(arg, "i:getitimer", &which)) + if (!PyArg_Parse(arg, "i:getitimer", &which)) { goto exit; + } return_value = signal_getitimer_impl(module, which); exit: @@ -251,8 +258,9 @@ PyObject *mask; if (!PyArg_ParseTuple(args, "iO:pthread_sigmask", - &how, &mask)) + &how, &mask)) { goto exit; + } return_value = signal_pthread_sigmask_impl(module, how, mask); exit: @@ -344,8 +352,9 @@ if (!PyArg_UnpackTuple(args, "sigtimedwait", 2, 2, - &sigset, &timeout_obj)) + &sigset, &timeout_obj)) { goto exit; + } return_value = signal_sigtimedwait_impl(module, sigset, timeout_obj); exit: @@ -376,8 +385,9 @@ int signalnum; if (!PyArg_ParseTuple(args, "li:pthread_kill", - &thread_id, &signalnum)) + &thread_id, &signalnum)) { goto exit; + } return_value = signal_pthread_kill_impl(module, thread_id, signalnum); exit: @@ -429,4 +439,4 @@ #ifndef SIGNAL_PTHREAD_KILL_METHODDEF #define SIGNAL_PTHREAD_KILL_METHODDEF #endif /* !defined(SIGNAL_PTHREAD_KILL_METHODDEF) */ -/*[clinic end generated code: output=b99278c16c40ea43 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=4b9519180a091536 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/spwdmodule.c.h b/Modules/clinic/spwdmodule.c.h --- a/Modules/clinic/spwdmodule.c.h +++ b/Modules/clinic/spwdmodule.c.h @@ -24,8 +24,9 @@ PyObject *return_value = NULL; PyObject *arg; - if (!PyArg_Parse(arg_, "U:getspnam", &arg)) + if (!PyArg_Parse(arg_, "U:getspnam", &arg)) { goto exit; + } return_value = spwd_getspnam_impl(module, arg); exit: @@ -65,4 +66,4 @@ #ifndef SPWD_GETSPALL_METHODDEF #define SPWD_GETSPALL_METHODDEF #endif /* !defined(SPWD_GETSPALL_METHODDEF) */ -/*[clinic end generated code: output=6c178830413f7763 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=2b7a384447e5f1e3 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/unicodedata.c.h b/Modules/clinic/unicodedata.c.h --- a/Modules/clinic/unicodedata.c.h +++ b/Modules/clinic/unicodedata.c.h @@ -27,8 +27,9 @@ PyObject *default_value = NULL; if (!PyArg_ParseTuple(args, "C|O:decimal", - &chr, &default_value)) + &chr, &default_value)) { goto exit; + } return_value = unicodedata_UCD_decimal_impl(self, chr, default_value); exit: @@ -59,8 +60,9 @@ PyObject *default_value = NULL; if (!PyArg_ParseTuple(args, "C|O:digit", - &chr, &default_value)) + &chr, &default_value)) { goto exit; + } return_value = unicodedata_UCD_digit_impl(self, chr, default_value); exit: @@ -92,8 +94,9 @@ PyObject *default_value = NULL; if (!PyArg_ParseTuple(args, "C|O:numeric", - &chr, &default_value)) + &chr, &default_value)) { goto exit; + } return_value = unicodedata_UCD_numeric_impl(self, chr, default_value); exit: @@ -118,8 +121,9 @@ PyObject *return_value = NULL; int chr; - if (!PyArg_Parse(arg, "C:category", &chr)) + if (!PyArg_Parse(arg, "C:category", &chr)) { goto exit; + } return_value = unicodedata_UCD_category_impl(self, chr); exit: @@ -146,8 +150,9 @@ PyObject *return_value = NULL; int chr; - if (!PyArg_Parse(arg, "C:bidirectional", &chr)) + if (!PyArg_Parse(arg, "C:bidirectional", &chr)) { goto exit; + } return_value = unicodedata_UCD_bidirectional_impl(self, chr); exit: @@ -175,11 +180,13 @@ int chr; int _return_value; - if (!PyArg_Parse(arg, "C:combining", &chr)) + if (!PyArg_Parse(arg, "C:combining", &chr)) { goto exit; + } _return_value = unicodedata_UCD_combining_impl(self, chr); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -208,11 +215,13 @@ int chr; int _return_value; - if (!PyArg_Parse(arg, "C:mirrored", &chr)) + if (!PyArg_Parse(arg, "C:mirrored", &chr)) { goto exit; + } _return_value = unicodedata_UCD_mirrored_impl(self, chr); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -237,8 +246,9 @@ PyObject *return_value = NULL; int chr; - if (!PyArg_Parse(arg, "C:east_asian_width", &chr)) + if (!PyArg_Parse(arg, "C:east_asian_width", &chr)) { goto exit; + } return_value = unicodedata_UCD_east_asian_width_impl(self, chr); exit: @@ -265,8 +275,9 @@ PyObject *return_value = NULL; int chr; - if (!PyArg_Parse(arg, "C:decomposition", &chr)) + if (!PyArg_Parse(arg, "C:decomposition", &chr)) { goto exit; + } return_value = unicodedata_UCD_decomposition_impl(self, chr); exit: @@ -296,8 +307,9 @@ PyObject *input; if (!PyArg_ParseTuple(args, "sO!:normalize", - &form, &PyUnicode_Type, &input)) + &form, &PyUnicode_Type, &input)) { goto exit; + } return_value = unicodedata_UCD_normalize_impl(self, form, input); exit: @@ -327,8 +339,9 @@ PyObject *default_value = NULL; if (!PyArg_ParseTuple(args, "C|O:name", - &chr, &default_value)) + &chr, &default_value)) { goto exit; + } return_value = unicodedata_UCD_name_impl(self, chr, default_value); exit: @@ -358,11 +371,12 @@ const char *name; Py_ssize_clean_t name_length; - if (!PyArg_Parse(arg, "s#:lookup", &name, &name_length)) + if (!PyArg_Parse(arg, "s#:lookup", &name, &name_length)) { goto exit; + } return_value = unicodedata_UCD_lookup_impl(self, name, name_length); exit: return return_value; } -/*[clinic end generated code: output=4f8da33c6bc6efc9 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=5313ce129da87b2f input=a9049054013a1b77]*/ diff --git a/Modules/clinic/zlibmodule.c.h b/Modules/clinic/zlibmodule.c.h --- a/Modules/clinic/zlibmodule.c.h +++ b/Modules/clinic/zlibmodule.c.h @@ -28,14 +28,16 @@ int level = Z_DEFAULT_COMPRESSION; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "y*|i:compress", _keywords, - &data, &level)) + &data, &level)) { goto exit; + } return_value = zlib_compress_impl(module, &data, level); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -69,14 +71,16 @@ unsigned int bufsize = DEF_BUF_SIZE; if (!PyArg_ParseTuple(args, "y*|iO&:decompress", - &data, &wbits, capped_uint_converter, &bufsize)) + &data, &wbits, capped_uint_converter, &bufsize)) { goto exit; + } return_value = zlib_decompress_impl(module, &data, wbits, bufsize); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -131,14 +135,16 @@ Py_buffer zdict = {NULL, NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iiiiiy*:compressobj", _keywords, - &level, &method, &wbits, &memLevel, &strategy, &zdict)) + &level, &method, &wbits, &memLevel, &strategy, &zdict)) { goto exit; + } return_value = zlib_compressobj_impl(module, level, method, wbits, memLevel, strategy, &zdict); exit: /* Cleanup for zdict */ - if (zdict.obj) + if (zdict.obj) { PyBuffer_Release(&zdict); + } return return_value; } @@ -170,8 +176,9 @@ PyObject *zdict = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iO:decompressobj", _keywords, - &wbits, &zdict)) + &wbits, &zdict)) { goto exit; + } return_value = zlib_decompressobj_impl(module, wbits, zdict); exit: @@ -203,14 +210,16 @@ PyObject *return_value = NULL; Py_buffer data = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:compress", &data)) + if (!PyArg_Parse(arg, "y*:compress", &data)) { goto exit; + } return_value = zlib_Compress_compress_impl(self, &data); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -247,14 +256,16 @@ unsigned int max_length = 0; if (!PyArg_ParseTuple(args, "y*|O&:decompress", - &data, capped_uint_converter, &max_length)) + &data, capped_uint_converter, &max_length)) { goto exit; + } return_value = zlib_Decompress_decompress_impl(self, &data, max_length); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -284,8 +295,9 @@ int mode = Z_FINISH; if (!PyArg_ParseTuple(args, "|i:flush", - &mode)) + &mode)) { goto exit; + } return_value = zlib_Compress_flush_impl(self, mode); exit: @@ -358,8 +370,9 @@ unsigned int length = DEF_BUF_SIZE; if (!PyArg_ParseTuple(args, "|O&:flush", - capped_uint_converter, &length)) + capped_uint_converter, &length)) { goto exit; + } return_value = zlib_Decompress_flush_impl(self, length); exit: @@ -391,14 +404,16 @@ unsigned int value = 1; if (!PyArg_ParseTuple(args, "y*|I:adler32", - &data, &value)) + &data, &value)) { goto exit; + } return_value = zlib_adler32_impl(module, &data, value); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -428,14 +443,16 @@ unsigned int value = 0; if (!PyArg_ParseTuple(args, "y*|I:crc32", - &data, &value)) + &data, &value)) { goto exit; + } return_value = zlib_crc32_impl(module, &data, value); exit: /* Cleanup for data */ - if (data.obj) + if (data.obj) { PyBuffer_Release(&data); + } return return_value; } @@ -443,4 +460,4 @@ #ifndef ZLIB_COMPRESS_COPY_METHODDEF #define ZLIB_COMPRESS_COPY_METHODDEF #endif /* !defined(ZLIB_COMPRESS_COPY_METHODDEF) */ -/*[clinic end generated code: output=8669ba9266c78433 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=9bd8a093baa653b2 input=a9049054013a1b77]*/ diff --git a/Objects/clinic/bytearrayobject.c.h b/Objects/clinic/bytearrayobject.c.h --- a/Objects/clinic/bytearrayobject.c.h +++ b/Objects/clinic/bytearrayobject.c.h @@ -65,12 +65,14 @@ switch (PyTuple_GET_SIZE(args)) { case 1: - if (!PyArg_ParseTuple(args, "O:translate", &table)) + if (!PyArg_ParseTuple(args, "O:translate", &table)) { goto exit; + } break; case 2: - if (!PyArg_ParseTuple(args, "OO:translate", &table, &deletechars)) + if (!PyArg_ParseTuple(args, "OO:translate", &table, &deletechars)) { goto exit; + } group_right_1 = 1; break; default: @@ -108,17 +110,20 @@ Py_buffer to = {NULL, NULL}; if (!PyArg_ParseTuple(args, "y*y*:maketrans", - &frm, &to)) + &frm, &to)) { goto exit; + } return_value = bytearray_maketrans_impl(&frm, &to); exit: /* Cleanup for frm */ - if (frm.obj) + if (frm.obj) { PyBuffer_Release(&frm); + } /* Cleanup for to */ - if (to.obj) + if (to.obj) { PyBuffer_Release(&to); + } return return_value; } @@ -152,17 +157,20 @@ Py_ssize_t count = -1; if (!PyArg_ParseTuple(args, "y*y*|n:replace", - &old, &new, &count)) + &old, &new, &count)) { goto exit; + } return_value = bytearray_replace_impl(self, &old, &new, count); exit: /* Cleanup for old */ - if (old.obj) + if (old.obj) { PyBuffer_Release(&old); + } /* Cleanup for new */ - if (new.obj) + if (new.obj) { PyBuffer_Release(&new); + } return return_value; } @@ -197,8 +205,9 @@ Py_ssize_t maxsplit = -1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|On:split", _keywords, - &sep, &maxsplit)) + &sep, &maxsplit)) { goto exit; + } return_value = bytearray_split_impl(self, sep, maxsplit); exit: @@ -269,8 +278,9 @@ Py_ssize_t maxsplit = -1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|On:rsplit", _keywords, - &sep, &maxsplit)) + &sep, &maxsplit)) { goto exit; + } return_value = bytearray_rsplit_impl(self, sep, maxsplit); exit: @@ -320,8 +330,9 @@ int item; if (!PyArg_ParseTuple(args, "nO&:insert", - &index, _getbytevalue, &item)) + &index, _getbytevalue, &item)) { goto exit; + } return_value = bytearray_insert_impl(self, index, item); exit: @@ -349,8 +360,9 @@ PyObject *return_value = NULL; int item; - if (!PyArg_Parse(arg, "O&:append", _getbytevalue, &item)) + if (!PyArg_Parse(arg, "O&:append", _getbytevalue, &item)) { goto exit; + } return_value = bytearray_append_impl(self, item); exit: @@ -394,8 +406,9 @@ Py_ssize_t index = -1; if (!PyArg_ParseTuple(args, "|n:pop", - &index)) + &index)) { goto exit; + } return_value = bytearray_pop_impl(self, index); exit: @@ -423,8 +436,9 @@ PyObject *return_value = NULL; int value; - if (!PyArg_Parse(arg, "O&:remove", _getbytevalue, &value)) + if (!PyArg_Parse(arg, "O&:remove", _getbytevalue, &value)) { goto exit; + } return_value = bytearray_remove_impl(self, value); exit: @@ -453,8 +467,9 @@ if (!PyArg_UnpackTuple(args, "strip", 0, 1, - &bytes)) + &bytes)) { goto exit; + } return_value = bytearray_strip_impl(self, bytes); exit: @@ -483,8 +498,9 @@ if (!PyArg_UnpackTuple(args, "lstrip", 0, 1, - &bytes)) + &bytes)) { goto exit; + } return_value = bytearray_lstrip_impl(self, bytes); exit: @@ -513,8 +529,9 @@ if (!PyArg_UnpackTuple(args, "rstrip", 0, 1, - &bytes)) + &bytes)) { goto exit; + } return_value = bytearray_rstrip_impl(self, bytes); exit: @@ -552,8 +569,9 @@ const char *errors = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ss:decode", _keywords, - &encoding, &errors)) + &encoding, &errors)) { goto exit; + } return_value = bytearray_decode_impl(self, encoding, errors); exit: @@ -596,8 +614,9 @@ int keepends = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i:splitlines", _keywords, - &keepends)) + &keepends)) { goto exit; + } return_value = bytearray_splitlines_impl(self, keepends); exit: @@ -625,8 +644,9 @@ PyObject *return_value = NULL; PyObject *string; - if (!PyArg_Parse(arg, "U:fromhex", &string)) + if (!PyArg_Parse(arg, "U:fromhex", &string)) { goto exit; + } return_value = bytearray_fromhex_impl((PyObject*)cls, string); exit: @@ -670,8 +690,9 @@ int proto = 0; if (!PyArg_ParseTuple(args, "|i:__reduce_ex__", - &proto)) + &proto)) { goto exit; + } return_value = bytearray_reduce_ex_impl(self, proto); exit: @@ -695,4 +716,4 @@ { return bytearray_sizeof_impl(self); } -/*[clinic end generated code: output=966c15ff22c5e243 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=044a6c26a836bcfe input=a9049054013a1b77]*/ diff --git a/Objects/clinic/bytesobject.c.h b/Objects/clinic/bytesobject.c.h --- a/Objects/clinic/bytesobject.c.h +++ b/Objects/clinic/bytesobject.c.h @@ -31,8 +31,9 @@ Py_ssize_t maxsplit = -1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|On:split", _keywords, - &sep, &maxsplit)) + &sep, &maxsplit)) { goto exit; + } return_value = bytes_split_impl(self, sep, maxsplit); exit: @@ -64,14 +65,16 @@ PyObject *return_value = NULL; Py_buffer sep = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:partition", &sep)) + if (!PyArg_Parse(arg, "y*:partition", &sep)) { goto exit; + } return_value = bytes_partition_impl(self, &sep); exit: /* Cleanup for sep */ - if (sep.obj) + if (sep.obj) { PyBuffer_Release(&sep); + } return return_value; } @@ -101,14 +104,16 @@ PyObject *return_value = NULL; Py_buffer sep = {NULL, NULL}; - if (!PyArg_Parse(arg, "y*:rpartition", &sep)) + if (!PyArg_Parse(arg, "y*:rpartition", &sep)) { goto exit; + } return_value = bytes_rpartition_impl(self, &sep); exit: /* Cleanup for sep */ - if (sep.obj) + if (sep.obj) { PyBuffer_Release(&sep); + } return return_value; } @@ -144,8 +149,9 @@ Py_ssize_t maxsplit = -1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|On:rsplit", _keywords, - &sep, &maxsplit)) + &sep, &maxsplit)) { goto exit; + } return_value = bytes_rsplit_impl(self, sep, maxsplit); exit: @@ -189,8 +195,9 @@ if (!PyArg_UnpackTuple(args, "strip", 0, 1, - &bytes)) + &bytes)) { goto exit; + } return_value = bytes_strip_impl(self, bytes); exit: @@ -219,8 +226,9 @@ if (!PyArg_UnpackTuple(args, "lstrip", 0, 1, - &bytes)) + &bytes)) { goto exit; + } return_value = bytes_lstrip_impl(self, bytes); exit: @@ -249,8 +257,9 @@ if (!PyArg_UnpackTuple(args, "rstrip", 0, 1, - &bytes)) + &bytes)) { goto exit; + } return_value = bytes_rstrip_impl(self, bytes); exit: @@ -284,12 +293,14 @@ switch (PyTuple_GET_SIZE(args)) { case 1: - if (!PyArg_ParseTuple(args, "O:translate", &table)) + if (!PyArg_ParseTuple(args, "O:translate", &table)) { goto exit; + } break; case 2: - if (!PyArg_ParseTuple(args, "OO:translate", &table, &deletechars)) + if (!PyArg_ParseTuple(args, "OO:translate", &table, &deletechars)) { goto exit; + } group_right_1 = 1; break; default: @@ -327,17 +338,20 @@ Py_buffer to = {NULL, NULL}; if (!PyArg_ParseTuple(args, "y*y*:maketrans", - &frm, &to)) + &frm, &to)) { goto exit; + } return_value = bytes_maketrans_impl(&frm, &to); exit: /* Cleanup for frm */ - if (frm.obj) + if (frm.obj) { PyBuffer_Release(&frm); + } /* Cleanup for to */ - if (to.obj) + if (to.obj) { PyBuffer_Release(&to); + } return return_value; } @@ -371,17 +385,20 @@ Py_ssize_t count = -1; if (!PyArg_ParseTuple(args, "y*y*|n:replace", - &old, &new, &count)) + &old, &new, &count)) { goto exit; + } return_value = bytes_replace_impl(self, &old, &new, count); exit: /* Cleanup for old */ - if (old.obj) + if (old.obj) { PyBuffer_Release(&old); + } /* Cleanup for new */ - if (new.obj) + if (new.obj) { PyBuffer_Release(&new); + } return return_value; } @@ -417,8 +434,9 @@ const char *errors = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ss:decode", _keywords, - &encoding, &errors)) + &encoding, &errors)) { goto exit; + } return_value = bytes_decode_impl(self, encoding, errors); exit: @@ -448,8 +466,9 @@ int keepends = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|i:splitlines", _keywords, - &keepends)) + &keepends)) { goto exit; + } return_value = bytes_splitlines_impl(self, keepends); exit: @@ -477,11 +496,12 @@ PyObject *return_value = NULL; PyObject *string; - if (!PyArg_Parse(arg, "U:fromhex", &string)) + if (!PyArg_Parse(arg, "U:fromhex", &string)) { goto exit; + } return_value = bytes_fromhex_impl(type, string); exit: return return_value; } -/*[clinic end generated code: output=d0e9f5a1c0682910 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=6fe884a74e7d49cf input=a9049054013a1b77]*/ diff --git a/Objects/clinic/dictobject.c.h b/Objects/clinic/dictobject.c.h --- a/Objects/clinic/dictobject.c.h +++ b/Objects/clinic/dictobject.c.h @@ -23,8 +23,9 @@ if (!PyArg_UnpackTuple(args, "fromkeys", 1, 2, - &iterable, &value)) + &iterable, &value)) { goto exit; + } return_value = dict_fromkeys_impl(type, iterable, value); exit: @@ -39,4 +40,4 @@ #define DICT___CONTAINS___METHODDEF \ {"__contains__", (PyCFunction)dict___contains__, METH_O|METH_COEXIST, dict___contains____doc__}, -/*[clinic end generated code: output=fe74d676332fdba6 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=926326109e3d9839 input=a9049054013a1b77]*/ diff --git a/Objects/clinic/unicodeobject.c.h b/Objects/clinic/unicodeobject.c.h --- a/Objects/clinic/unicodeobject.c.h +++ b/Objects/clinic/unicodeobject.c.h @@ -31,11 +31,12 @@ PyObject *z = NULL; if (!PyArg_ParseTuple(args, "O|UU:maketrans", - &x, &y, &z)) + &x, &y, &z)) { goto exit; + } return_value = unicode_maketrans_impl(x, y, z); exit: return return_value; } -/*[clinic end generated code: output=94affdff5b2daff5 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=4a86dd108d92d104 input=a9049054013a1b77]*/ diff --git a/PC/clinic/msvcrtmodule.c.h b/PC/clinic/msvcrtmodule.c.h --- a/PC/clinic/msvcrtmodule.c.h +++ b/PC/clinic/msvcrtmodule.c.h @@ -51,8 +51,9 @@ long nbytes; if (!PyArg_ParseTuple(args, "iil:locking", - &fd, &mode, &nbytes)) + &fd, &mode, &nbytes)) { goto exit; + } return_value = msvcrt_locking_impl(module, fd, mode, nbytes); exit: @@ -85,11 +86,13 @@ long _return_value; if (!PyArg_ParseTuple(args, "ii:setmode", - &fd, &flags)) + &fd, &flags)) { goto exit; + } _return_value = msvcrt_setmode_impl(module, fd, flags); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -122,11 +125,13 @@ long _return_value; if (!PyArg_ParseTuple(args, ""_Py_PARSE_INTPTR"i:open_osfhandle", - &handle, &flags)) + &handle, &flags)) { goto exit; + } _return_value = msvcrt_open_osfhandle_impl(module, handle, flags); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -154,11 +159,13 @@ int fd; Py_intptr_t _return_value; - if (!PyArg_Parse(arg, "i:get_osfhandle", &fd)) + if (!PyArg_Parse(arg, "i:get_osfhandle", &fd)) { goto exit; + } _return_value = msvcrt_get_osfhandle_impl(module, fd); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromVoidPtr((void *)_return_value); exit: @@ -184,8 +191,9 @@ long _return_value; _return_value = msvcrt_kbhit_impl(module); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -312,8 +320,9 @@ PyObject *return_value = NULL; char char_value; - if (!PyArg_Parse(arg, "c:putch", &char_value)) + if (!PyArg_Parse(arg, "c:putch", &char_value)) { goto exit; + } return_value = msvcrt_putch_impl(module, char_value); exit: @@ -338,8 +347,9 @@ PyObject *return_value = NULL; int unicode_char; - if (!PyArg_Parse(arg, "C:putwch", &unicode_char)) + if (!PyArg_Parse(arg, "C:putwch", &unicode_char)) { goto exit; + } return_value = msvcrt_putwch_impl(module, unicode_char); exit: @@ -368,8 +378,9 @@ PyObject *return_value = NULL; char char_value; - if (!PyArg_Parse(arg, "c:ungetch", &char_value)) + if (!PyArg_Parse(arg, "c:ungetch", &char_value)) { goto exit; + } return_value = msvcrt_ungetch_impl(module, char_value); exit: @@ -394,8 +405,9 @@ PyObject *return_value = NULL; int unicode_char; - if (!PyArg_Parse(arg, "C:ungetwch", &unicode_char)) + if (!PyArg_Parse(arg, "C:ungetwch", &unicode_char)) { goto exit; + } return_value = msvcrt_ungetwch_impl(module, unicode_char); exit: @@ -427,11 +439,13 @@ long _return_value; if (!PyArg_ParseTuple(args, "ii:CrtSetReportFile", - &type, &file)) + &type, &file)) { goto exit; + } _return_value = msvcrt_CrtSetReportFile_impl(module, type, file); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -465,11 +479,13 @@ long _return_value; if (!PyArg_ParseTuple(args, "ii:CrtSetReportMode", - &type, &mode)) + &type, &mode)) { goto exit; + } _return_value = msvcrt_CrtSetReportMode_impl(module, type, mode); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -501,11 +517,13 @@ int mode; long _return_value; - if (!PyArg_Parse(arg, "i:set_error_mode", &mode)) + if (!PyArg_Parse(arg, "i:set_error_mode", &mode)) { goto exit; + } _return_value = msvcrt_set_error_mode_impl(module, mode); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong(_return_value); exit: @@ -532,8 +550,9 @@ PyObject *return_value = NULL; unsigned int mode; - if (!PyArg_Parse(arg, "I:SetErrorMode", &mode)) + if (!PyArg_Parse(arg, "I:SetErrorMode", &mode)) { goto exit; + } return_value = msvcrt_SetErrorMode_impl(module, mode); exit: @@ -551,4 +570,4 @@ #ifndef MSVCRT_SET_ERROR_MODE_METHODDEF #define MSVCRT_SET_ERROR_MODE_METHODDEF #endif /* !defined(MSVCRT_SET_ERROR_MODE_METHODDEF) */ -/*[clinic end generated code: output=16613d3119a1fd44 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=636de3460aecbca7 input=a9049054013a1b77]*/ diff --git a/PC/clinic/winreg.c.h b/PC/clinic/winreg.c.h --- a/PC/clinic/winreg.c.h +++ b/PC/clinic/winreg.c.h @@ -93,8 +93,9 @@ PyObject *traceback; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOO:__exit__", _keywords, - &exc_type, &exc_value, &traceback)) + &exc_type, &exc_value, &traceback)) { goto exit; + } return_value = winreg_HKEYType___exit___impl(self, exc_type, exc_value, traceback); exit: @@ -147,11 +148,13 @@ HKEY _return_value; if (!PyArg_ParseTuple(args, "ZO&:ConnectRegistry", - &computer_name, clinic_HKEY_converter, &key)) + &computer_name, clinic_HKEY_converter, &key)) { goto exit; + } _return_value = winreg_ConnectRegistry_impl(module, computer_name, key); - if (_return_value == NULL) + if (_return_value == NULL) { goto exit; + } return_value = PyHKEY_FromHKEY(_return_value); exit: @@ -192,11 +195,13 @@ HKEY _return_value; if (!PyArg_ParseTuple(args, "O&Z:CreateKey", - clinic_HKEY_converter, &key, &sub_key)) + clinic_HKEY_converter, &key, &sub_key)) { goto exit; + } _return_value = winreg_CreateKey_impl(module, key, sub_key); - if (_return_value == NULL) + if (_return_value == NULL) { goto exit; + } return_value = PyHKEY_FromHKEY(_return_value); exit: @@ -247,11 +252,13 @@ HKEY _return_value; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&Z|ii:CreateKeyEx", _keywords, - clinic_HKEY_converter, &key, &sub_key, &reserved, &access)) + clinic_HKEY_converter, &key, &sub_key, &reserved, &access)) { goto exit; + } _return_value = winreg_CreateKeyEx_impl(module, key, sub_key, reserved, access); - if (_return_value == NULL) + if (_return_value == NULL) { goto exit; + } return_value = PyHKEY_FromHKEY(_return_value); exit: @@ -290,8 +297,9 @@ Py_UNICODE *sub_key; if (!PyArg_ParseTuple(args, "O&u:DeleteKey", - clinic_HKEY_converter, &key, &sub_key)) + clinic_HKEY_converter, &key, &sub_key)) { goto exit; + } return_value = winreg_DeleteKey_impl(module, key, sub_key); exit: @@ -341,8 +349,9 @@ int reserved = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&u|ii:DeleteKeyEx", _keywords, - clinic_HKEY_converter, &key, &sub_key, &access, &reserved)) + clinic_HKEY_converter, &key, &sub_key, &access, &reserved)) { goto exit; + } return_value = winreg_DeleteKeyEx_impl(module, key, sub_key, access, reserved); exit: @@ -374,8 +383,9 @@ Py_UNICODE *value; if (!PyArg_ParseTuple(args, "O&Z:DeleteValue", - clinic_HKEY_converter, &key, &value)) + clinic_HKEY_converter, &key, &value)) { goto exit; + } return_value = winreg_DeleteValue_impl(module, key, value); exit: @@ -411,8 +421,9 @@ int index; if (!PyArg_ParseTuple(args, "O&i:EnumKey", - clinic_HKEY_converter, &key, &index)) + clinic_HKEY_converter, &key, &index)) { goto exit; + } return_value = winreg_EnumKey_impl(module, key, index); exit: @@ -457,8 +468,9 @@ int index; if (!PyArg_ParseTuple(args, "O&i:EnumValue", - clinic_HKEY_converter, &key, &index)) + clinic_HKEY_converter, &key, &index)) { goto exit; + } return_value = winreg_EnumValue_impl(module, key, index); exit: @@ -483,8 +495,9 @@ PyObject *return_value = NULL; Py_UNICODE *string; - if (!PyArg_Parse(arg, "u:ExpandEnvironmentStrings", &string)) + if (!PyArg_Parse(arg, "u:ExpandEnvironmentStrings", &string)) { goto exit; + } return_value = winreg_ExpandEnvironmentStrings_impl(module, string); exit: @@ -522,8 +535,9 @@ PyObject *return_value = NULL; HKEY key; - if (!PyArg_Parse(arg, "O&:FlushKey", clinic_HKEY_converter, &key)) + if (!PyArg_Parse(arg, "O&:FlushKey", clinic_HKEY_converter, &key)) { goto exit; + } return_value = winreg_FlushKey_impl(module, key); exit: @@ -574,8 +588,9 @@ Py_UNICODE *file_name; if (!PyArg_ParseTuple(args, "O&uu:LoadKey", - clinic_HKEY_converter, &key, &sub_key, &file_name)) + clinic_HKEY_converter, &key, &sub_key, &file_name)) { goto exit; + } return_value = winreg_LoadKey_impl(module, key, sub_key, file_name); exit: @@ -620,11 +635,13 @@ HKEY _return_value; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&Z|ii:OpenKey", _keywords, - clinic_HKEY_converter, &key, &sub_key, &reserved, &access)) + clinic_HKEY_converter, &key, &sub_key, &reserved, &access)) { goto exit; + } _return_value = winreg_OpenKey_impl(module, key, sub_key, reserved, access); - if (_return_value == NULL) + if (_return_value == NULL) { goto exit; + } return_value = PyHKEY_FromHKEY(_return_value); exit: @@ -669,11 +686,13 @@ HKEY _return_value; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&Z|ii:OpenKeyEx", _keywords, - clinic_HKEY_converter, &key, &sub_key, &reserved, &access)) + clinic_HKEY_converter, &key, &sub_key, &reserved, &access)) { goto exit; + } _return_value = winreg_OpenKeyEx_impl(module, key, sub_key, reserved, access); - if (_return_value == NULL) + if (_return_value == NULL) { goto exit; + } return_value = PyHKEY_FromHKEY(_return_value); exit: @@ -707,8 +726,9 @@ PyObject *return_value = NULL; HKEY key; - if (!PyArg_Parse(arg, "O&:QueryInfoKey", clinic_HKEY_converter, &key)) + if (!PyArg_Parse(arg, "O&:QueryInfoKey", clinic_HKEY_converter, &key)) { goto exit; + } return_value = winreg_QueryInfoKey_impl(module, key); exit: @@ -749,8 +769,9 @@ Py_UNICODE *sub_key; if (!PyArg_ParseTuple(args, "O&Z:QueryValue", - clinic_HKEY_converter, &key, &sub_key)) + clinic_HKEY_converter, &key, &sub_key)) { goto exit; + } return_value = winreg_QueryValue_impl(module, key, sub_key); exit: @@ -787,8 +808,9 @@ Py_UNICODE *name; if (!PyArg_ParseTuple(args, "O&Z:QueryValueEx", - clinic_HKEY_converter, &key, &name)) + clinic_HKEY_converter, &key, &name)) { goto exit; + } return_value = winreg_QueryValueEx_impl(module, key, name); exit: @@ -830,8 +852,9 @@ Py_UNICODE *file_name; if (!PyArg_ParseTuple(args, "O&u:SaveKey", - clinic_HKEY_converter, &key, &file_name)) + clinic_HKEY_converter, &key, &file_name)) { goto exit; + } return_value = winreg_SaveKey_impl(module, key, file_name); exit: @@ -883,8 +906,9 @@ Py_ssize_clean_t value_length; if (!PyArg_ParseTuple(args, "O&Zku#:SetValue", - clinic_HKEY_converter, &key, &sub_key, &type, &value, &value_length)) + clinic_HKEY_converter, &key, &sub_key, &type, &value, &value_length)) { goto exit; + } return_value = winreg_SetValue_impl(module, key, sub_key, type, value, value_length); exit: @@ -952,8 +976,9 @@ PyObject *value; if (!PyArg_ParseTuple(args, "O&ZOkO:SetValueEx", - clinic_HKEY_converter, &key, &value_name, &reserved, &type, &value)) + clinic_HKEY_converter, &key, &value_name, &reserved, &type, &value)) { goto exit; + } return_value = winreg_SetValueEx_impl(module, key, value_name, reserved, type, value); exit: @@ -987,8 +1012,9 @@ PyObject *return_value = NULL; HKEY key; - if (!PyArg_Parse(arg, "O&:DisableReflectionKey", clinic_HKEY_converter, &key)) + if (!PyArg_Parse(arg, "O&:DisableReflectionKey", clinic_HKEY_converter, &key)) { goto exit; + } return_value = winreg_DisableReflectionKey_impl(module, key); exit: @@ -1020,8 +1046,9 @@ PyObject *return_value = NULL; HKEY key; - if (!PyArg_Parse(arg, "O&:EnableReflectionKey", clinic_HKEY_converter, &key)) + if (!PyArg_Parse(arg, "O&:EnableReflectionKey", clinic_HKEY_converter, &key)) { goto exit; + } return_value = winreg_EnableReflectionKey_impl(module, key); exit: @@ -1051,11 +1078,12 @@ PyObject *return_value = NULL; HKEY key; - if (!PyArg_Parse(arg, "O&:QueryReflectionKey", clinic_HKEY_converter, &key)) + if (!PyArg_Parse(arg, "O&:QueryReflectionKey", clinic_HKEY_converter, &key)) { goto exit; + } return_value = winreg_QueryReflectionKey_impl(module, key); exit: return return_value; } -/*[clinic end generated code: output=0b71782e9b37b12a input=a9049054013a1b77]*/ +/*[clinic end generated code: output=ca128bfa212d8d1f input=a9049054013a1b77]*/ diff --git a/PC/clinic/winsound.c.h b/PC/clinic/winsound.c.h --- a/PC/clinic/winsound.c.h +++ b/PC/clinic/winsound.c.h @@ -27,8 +27,9 @@ int flags; if (!PyArg_ParseTuple(args, "Zi:PlaySound", - &sound, &flags)) + &sound, &flags)) { goto exit; + } return_value = winsound_PlaySound_impl(module, sound, flags); exit: @@ -61,8 +62,9 @@ int duration; if (!PyArg_ParseTuple(args, "ii:Beep", - &frequency, &duration)) + &frequency, &duration)) { goto exit; + } return_value = winsound_Beep_impl(module, frequency, duration); exit: @@ -90,11 +92,12 @@ int x = MB_OK; if (!PyArg_ParseTuple(args, "|i:MessageBeep", - &x)) + &x)) { goto exit; + } return_value = winsound_MessageBeep_impl(module, x); exit: return return_value; } -/*[clinic end generated code: output=c5b018ac9dc1f500 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=a5f53e42d4396bb4 input=a9049054013a1b77]*/ diff --git a/Python/clinic/bltinmodule.c.h b/Python/clinic/bltinmodule.c.h --- a/Python/clinic/bltinmodule.c.h +++ b/Python/clinic/bltinmodule.c.h @@ -94,8 +94,9 @@ PyObject *format_spec = NULL; if (!PyArg_ParseTuple(args, "O|U:format", - &value, &format_spec)) + &value, &format_spec)) { goto exit; + } return_value = builtin_format_impl(module, value, format_spec); exit: @@ -120,8 +121,9 @@ PyObject *return_value = NULL; int i; - if (!PyArg_Parse(arg, "i:chr", &i)) + if (!PyArg_Parse(arg, "i:chr", &i)) { goto exit; + } return_value = builtin_chr_impl(module, i); exit: @@ -167,8 +169,9 @@ int optimize = -1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO&s|iii:compile", _keywords, - &source, PyUnicode_FSDecoder, &filename, &mode, &flags, &dont_inherit, &optimize)) + &source, PyUnicode_FSDecoder, &filename, &mode, &flags, &dont_inherit, &optimize)) { goto exit; + } return_value = builtin_compile_impl(module, source, filename, mode, flags, dont_inherit, optimize); exit: @@ -196,8 +199,9 @@ if (!PyArg_UnpackTuple(args, "divmod", 2, 2, - &x, &y)) + &x, &y)) { goto exit; + } return_value = builtin_divmod_impl(module, x, y); exit: @@ -233,8 +237,9 @@ if (!PyArg_UnpackTuple(args, "eval", 1, 3, - &source, &globals, &locals)) + &source, &globals, &locals)) { goto exit; + } return_value = builtin_eval_impl(module, source, globals, locals); exit: @@ -270,8 +275,9 @@ if (!PyArg_UnpackTuple(args, "exec", 1, 3, - &source, &globals, &locals)) + &source, &globals, &locals)) { goto exit; + } return_value = builtin_exec_impl(module, source, globals, locals); exit: @@ -322,8 +328,9 @@ if (!PyArg_UnpackTuple(args, "hasattr", 2, 2, - &obj, &name)) + &obj, &name)) { goto exit; + } return_value = builtin_hasattr_impl(module, obj, name); exit: @@ -367,8 +374,9 @@ if (!PyArg_UnpackTuple(args, "setattr", 3, 3, - &obj, &name, &value)) + &obj, &name, &value)) { goto exit; + } return_value = builtin_setattr_impl(module, obj, name, value); exit: @@ -398,8 +406,9 @@ if (!PyArg_UnpackTuple(args, "delattr", 2, 2, - &obj, &name)) + &obj, &name)) { goto exit; + } return_value = builtin_delattr_impl(module, obj, name); exit: @@ -507,8 +516,9 @@ if (!PyArg_UnpackTuple(args, "pow", 2, 3, - &x, &y, &z)) + &x, &y, &z)) { goto exit; + } return_value = builtin_pow_impl(module, x, y, z); exit: @@ -541,8 +551,9 @@ if (!PyArg_UnpackTuple(args, "input", 0, 1, - &prompt)) + &prompt)) { goto exit; + } return_value = builtin_input_impl(module, prompt); exit: @@ -585,8 +596,9 @@ if (!PyArg_UnpackTuple(args, "sum", 1, 2, - &iterable, &start)) + &iterable, &start)) { goto exit; + } return_value = builtin_sum_impl(module, iterable, start); exit: @@ -619,8 +631,9 @@ if (!PyArg_UnpackTuple(args, "isinstance", 2, 2, - &obj, &class_or_tuple)) + &obj, &class_or_tuple)) { goto exit; + } return_value = builtin_isinstance_impl(module, obj, class_or_tuple); exit: @@ -653,11 +666,12 @@ if (!PyArg_UnpackTuple(args, "issubclass", 2, 2, - &cls, &class_or_tuple)) + &cls, &class_or_tuple)) { goto exit; + } return_value = builtin_issubclass_impl(module, cls, class_or_tuple); exit: return return_value; } -/*[clinic end generated code: output=4bef16b6aa432879 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=940f25126caf8166 input=a9049054013a1b77]*/ diff --git a/Python/clinic/import.c.h b/Python/clinic/import.c.h --- a/Python/clinic/import.c.h +++ b/Python/clinic/import.c.h @@ -89,8 +89,9 @@ PyObject *path; if (!PyArg_ParseTuple(args, "O!U:_fix_co_filename", - &PyCode_Type, &code, &path)) + &PyCode_Type, &code, &path)) { goto exit; + } return_value = _imp__fix_co_filename_impl(module, code, path); exit: @@ -142,8 +143,9 @@ PyObject *return_value = NULL; PyObject *name; - if (!PyArg_Parse(arg, "U:init_frozen", &name)) + if (!PyArg_Parse(arg, "U:init_frozen", &name)) { goto exit; + } return_value = _imp_init_frozen_impl(module, name); exit: @@ -168,8 +170,9 @@ PyObject *return_value = NULL; PyObject *name; - if (!PyArg_Parse(arg, "U:get_frozen_object", &name)) + if (!PyArg_Parse(arg, "U:get_frozen_object", &name)) { goto exit; + } return_value = _imp_get_frozen_object_impl(module, name); exit: @@ -194,8 +197,9 @@ PyObject *return_value = NULL; PyObject *name; - if (!PyArg_Parse(arg, "U:is_frozen_package", &name)) + if (!PyArg_Parse(arg, "U:is_frozen_package", &name)) { goto exit; + } return_value = _imp_is_frozen_package_impl(module, name); exit: @@ -220,8 +224,9 @@ PyObject *return_value = NULL; PyObject *name; - if (!PyArg_Parse(arg, "U:is_builtin", &name)) + if (!PyArg_Parse(arg, "U:is_builtin", &name)) { goto exit; + } return_value = _imp_is_builtin_impl(module, name); exit: @@ -246,8 +251,9 @@ PyObject *return_value = NULL; PyObject *name; - if (!PyArg_Parse(arg, "U:is_frozen", &name)) + if (!PyArg_Parse(arg, "U:is_frozen", &name)) { goto exit; + } return_value = _imp_is_frozen_impl(module, name); exit: @@ -277,8 +283,9 @@ if (!PyArg_UnpackTuple(args, "create_dynamic", 1, 2, - &spec, &file)) + &spec, &file)) { goto exit; + } return_value = _imp_create_dynamic_impl(module, spec, file); exit: @@ -308,8 +315,9 @@ int _return_value; _return_value = _imp_exec_dynamic_impl(module, mod); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -337,8 +345,9 @@ int _return_value; _return_value = _imp_exec_builtin_impl(module, mod); - if ((_return_value == -1) && PyErr_Occurred()) + if ((_return_value == -1) && PyErr_Occurred()) { goto exit; + } return_value = PyLong_FromLong((long)_return_value); exit: @@ -352,4 +361,4 @@ #ifndef _IMP_EXEC_DYNAMIC_METHODDEF #define _IMP_EXEC_DYNAMIC_METHODDEF #endif /* !defined(_IMP_EXEC_DYNAMIC_METHODDEF) */ -/*[clinic end generated code: output=32324a5e46cdfc4b input=a9049054013a1b77]*/ +/*[clinic end generated code: output=22a7225925755674 input=a9049054013a1b77]*/ diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -797,8 +797,9 @@ """ % argname) parser_definition = parser_body(parser_prototype, normalize_snippet(""" - if (!PyArg_Parse(%s, "{format_units}:{name}", {parse_arguments})) + if (!PyArg_Parse(%s, "{format_units}:{name}", {parse_arguments})) {{ goto exit; + }} """ % argname, indent=4)) elif has_option_groups: @@ -822,8 +823,9 @@ parser_definition = parser_body(parser_prototype, normalize_snippet(""" if (!PyArg_UnpackTuple(args, "{name}", {unpack_min}, {unpack_max}, - {parse_arguments})) + {parse_arguments})) {{ goto exit; + }} """, indent=4)) elif positional: @@ -835,8 +837,9 @@ parser_definition = parser_body(parser_prototype, normalize_snippet(""" if (!PyArg_ParseTuple(args, "{format_units}:{name}", - {parse_arguments})) + {parse_arguments})) {{ goto exit; + }} """, indent=4)) else: @@ -847,13 +850,15 @@ body = normalize_snippet(""" if (!PyArg_ParseTupleAndKeywords(args, kwargs, "{format_units}:{name}", _keywords, - {parse_arguments})) + {parse_arguments})) {{ goto exit; - """, indent=4) + }} + """, indent=4) parser_definition = parser_body(parser_prototype, normalize_snippet(""" if (!PyArg_ParseTupleAndKeywords(args, kwargs, "{format_units}:{name}", _keywords, - {parse_arguments})) + {parse_arguments})) {{ goto exit; + }} """, indent=4)) parser_definition = insert_keywords(parser_definition) @@ -878,13 +883,15 @@ if not parses_keywords: fields.insert(0, normalize_snippet(""" - if ({self_type_check}!_PyArg_NoKeywords("{name}", kwargs)) + if ({self_type_check}!_PyArg_NoKeywords("{name}", kwargs)) {{ goto exit; + }} """, indent=4)) if not parses_positional: fields.insert(0, normalize_snippet(""" - if ({self_type_check}!_PyArg_NoPositional("{name}", args)) + if ({self_type_check}!_PyArg_NoPositional("{name}", args)) {{ goto exit; + }} """, indent=4)) parser_definition = parser_body(parser_prototype, *fields) @@ -1032,8 +1039,9 @@ s = """ case {count}: - if (!PyArg_ParseTuple(args, "{format_units}:{name}", {parse_arguments})) + if (!PyArg_ParseTuple(args, "{format_units}:{name}", {parse_arguments})) {{ goto exit; + }} {group_booleans} break; """[1:] @@ -2676,7 +2684,7 @@ def cleanup(self): if self.encoding: name = ensure_legal_c_identifier(self.name) - return "".join(["if (", name, ")\n PyMem_FREE(", name, ");\n"]) + return "".join(["if (", name, ") {\n PyMem_FREE(", name, ");\n}\n"]) # # This is the fourth or fifth rewrite of registering all the @@ -2786,7 +2794,7 @@ def cleanup(self): name = ensure_legal_c_identifier(self.name) - return "".join(["if (", name, ".obj)\n PyBuffer_Release(&", name, ");\n"]) + return "".join(["if (", name, ".obj) {\n PyBuffer_Release(&", name, ");\n}\n"]) def correct_name_for_self(f): @@ -2959,10 +2967,10 @@ data.return_value = name def err_occurred_if(self, expr, data): - data.return_conversion.append('if (({}) && PyErr_Occurred())\n goto exit;\n'.format(expr)) + data.return_conversion.append('if (({}) && PyErr_Occurred()) {{\n goto exit;\n}}\n'.format(expr)) def err_occurred_if_null_pointer(self, variable, data): - data.return_conversion.append('if ({} == NULL)\n goto exit;\n'.format(variable)) + data.return_conversion.append('if ({} == NULL) {{\n goto exit;\n}}\n'.format(variable)) def render(self, function, data): """ @@ -2977,8 +2985,9 @@ def render(self, function, data): self.declare(data) data.return_conversion.append(''' -if (_return_value != Py_None) +if (_return_value != Py_None) { goto exit; +} return_value = Py_None; Py_INCREF(Py_None); '''.strip()) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 14:45:40 2016 From: python-checkins at python.org (brett.cannon) Date: Thu, 09 Jun 2016 18:45:40 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Clarifications_from_the_PyCon?= =?utf-8?q?_US_2016_language_summit?= Message-ID: <20160609184537.26564.2955.8300E02F@psf.io> https://hg.python.org/peps/rev/b3b5c2ec657d changeset: 6360:b3b5c2ec657d user: Brett Cannon date: Thu Jun 09 11:45:31 2016 -0700 summary: Clarifications from the PyCon US 2016 language summit files: pep-0512.txt | 185 ++++++++++++++++++-------------------- 1 files changed, 87 insertions(+), 98 deletions(-) diff --git a/pep-0512.txt b/pep-0512.txt --- a/pep-0512.txt +++ b/pep-0512.txt @@ -162,8 +162,8 @@ Since moving to GitHub also entails moving to Git [#git]_, we must decide what tools and commands we will run to translate a Mercurial -repository to Git. The exact tools and steps to use are an -open issue; see `Tools and commands to move from Mercurial to Git`_. +repository to Git. The tools developed specifically for this migration +are hosted at https://github.com/orsenthil/cpython-hg-to-git . CLA enforcement @@ -287,42 +287,6 @@ `Git CLI commands for committing a pull request to cpython`_. -Handling Misc/NEWS -'''''''''''''''''' - -Traditionally the ``Misc/NEWS`` file [#news-file]_ has been problematic -for changes which spanned Python releases. Often times there will be -merge conflicts when committing a change between e.g., 3.5 and 3.6 -only in the ``Misc/NEWS`` file. It's so common, in fact, that the -example instructions in the devguide explicitly mention how to -resolve conflicts in the ``Misc/NEWS`` file -[#devguide-merge-across-branches]_. As part of our tool -modernization, working with the ``Misc/NEWS`` file will be -simplified. - -There are currently two competing approaches to solving the -``Misc/NEWS`` problem which are discussed in an open issue: -`How to handle the Misc/NEWS file`_. - - -Handling Misc/ACKS -'''''''''''''''''' - -Traditionally the ``Misc/ACKS`` file [#acks-file]_ has been managed -by hand. But thanks to Git supporting an ``author`` value as well as -a ``committer`` value per commit, authorship of a commit can be part -of the history of the code itself. - -As such, manual management of ``Misc/ACKS`` will become optional. A -script will be written that will collect all author and committer -names and merge them into ``Misc/ACKS`` with all of the names listed -prior to the move to Git. Running this script will become part of the -release process. - -The script should also generate a list of all people who contributed -since the last execution. This will allow having a list of those who -contributed to a specific release so they can be explicitly thanked. - Linking pull requests to issues ''''''''''''''''''''''''''''''' Historically, external contributions were attached to an issue on @@ -355,11 +319,11 @@ referencing another issue was done, but these are rare occasions. -Notify the issue if the pull request is committed -+++++++++++++++++++++++++++++++++++++++++++++++++ +Notify the issue if a commit is made +++++++++++++++++++++++++++++++++++++ -Once a pull request is closed (merged or not), the issue should be -updated to reflect this fact. +Once a commit is made, the corresponding issue should be updated to +reflect this fact. Update linking service for mapping commit IDs to URLs @@ -373,6 +337,81 @@ revision IDs created for the Git repository. +Deprecate sys._mercurial +'''''''''''''''''''''''' + +Once Python is no longer kept in Mercurial, the ``sys._mercurial`` +attribute will need to be changed to return ``('CPython', '', '')``. +An equivalent ``sys._git`` attribute will be added which fulfills the +same use-cases. + + +Update the devguide +''''''''''''''''''' + +The devguide will need to be updated with details of the new +workflow. Mostly likely work will take place in a separate branch +until the migration actually occurs. + + +Update PEP 101 +'''''''''''''' + +The release process will need to be updated as necessary. + + +Optional, Planned Features +-------------------------- + +Once the cpython repository [#cpython-repo]_ is migrated, all +repositories will have been moved to GitHub [#github]_ and the +development process should be on equal footing as before. But a key +reason for this migration is to improve the development process, +making it better than it has ever been. This section outlines some +plans on how to improve things. + +It should be mentioned that overall feature planning for +bugs.python.org [#b.p.o]_ -- which includes plans independent of this +migration -- are tracked on their own wiki page [#tracker-plans]_. + + +Handling Misc/NEWS +'''''''''''''''''' + +Traditionally the ``Misc/NEWS`` file [#news-file]_ has been problematic +for changes which spanned Python releases. Often times there will be +merge conflicts when committing a change between e.g., 3.5 and 3.6 +only in the ``Misc/NEWS`` file. It's so common, in fact, that the +example instructions in the devguide explicitly mention how to +resolve conflicts in the ``Misc/NEWS`` file +[#devguide-merge-across-branches]_. As part of our tool +modernization, working with the ``Misc/NEWS`` file will be +simplified. + +There are currently two competing approaches to solving the +``Misc/NEWS`` problem which are discussed in an open issue: +`How to handle the Misc/NEWS file`_. + + +Handling Misc/ACKS +'''''''''''''''''' + +Traditionally the ``Misc/ACKS`` file [#acks-file]_ has been managed +by hand. But thanks to Git supporting an ``author`` value as well as +a ``committer`` value per commit, authorship of a commit can be part +of the history of the code itself. + +As such, manual management of ``Misc/ACKS`` will become optional. A +script will be written that will collect all author and committer +names and merge them into ``Misc/ACKS`` with all of the names listed +prior to the move to Git. Running this script will become part of the +release process. + +The script should also generate a list of all people who contributed +since the last execution. This will allow having a list of those who +contributed to a specific release so they can be explicitly thanked. + + Create https://git.python.org ''''''''''''''''''''''''''''' @@ -398,44 +437,6 @@ disappear overnight. -Deprecate sys._mercurial -'''''''''''''''''''''''' - -Once Python is no longer kept in Mercurial, the ``sys._mercurial`` -attribute will need to be changed to return ``('CPython', '', '')``. -An equivalent ``sys._git`` attribute will be added which fulfills the -same use-cases. - - -Update the devguide -''''''''''''''''''' - -The devguide will need to be updated with details of the new -workflow. Mostly likely work will take place in a separate branch -until the migration actually occurs. - - -Update PEP 101 -'''''''''''''' - -The release process will need to be updated as necessary. - - -Optional, Planned Features --------------------------- - -Once the cpython repository [#cpython-repo]_ is migrated, all -repositories will have been moved to GitHub [#github]_ and the -development process should be on equal footing as before. But a key -reason for this migration is to improve the development process, -making it better than it has ever been. This section outlines some -plans on how to improve things. - -It should be mentioned that overall feature planning for -bugs.python.org [#b.p.o]_ -- which includes plans independent of this -migration -- are tracked on their own wiki page [#tracker-plans]_. - - Bot to handle pull request merging '''''''''''''''''''''''''''''''''' @@ -613,12 +614,11 @@ * Not started - - peps [#peps-repo]_ - devguide [#devguide-repo]_ * In progress - - None + - peps [#peps-repo]_ * Completed @@ -629,13 +629,9 @@ * Not started - `Document steps to commit a pull request`_ - - `Handling Misc/NEWS`_ - - `Handling Misc/ACKS`_ - `Linking a pull request to an issue`_ - - `Notify the issue if the pull request is committed`_ + - `Notify the issue if a commit is made`_ - `Update linking service for mapping commit IDs to URLs`_ - - `Create https://git.python.org`_ - - `Backup of pull request data`_ - `Deprecate sys._mercurial`_ - `Update the devguide`_ - `Update PEP 101`_ @@ -652,6 +648,10 @@ * Not started + - `Create https://git.python.org`_ + - `Backup of pull request data`_ + - `Handling Misc/NEWS`_ + - `Handling Misc/ACKS`_ - `Bot to handle pull request merging`_ - `Continuous integration per pull request`_ - `Test coverage report`_ @@ -699,17 +699,6 @@ hg.python.org. -Tools and commands to move from Mercurial to Git ------------------------------------------------- - -A decision needs to be made on exactly what tooling and what commands -involving those tools will be used to convert a Mercurial repository -to Git. Currently a suggestion has been made to use -https://github.com/frej/fast-export. Another suggestion is to use -https://github.com/felipec/git-remote-hg. Finally, -http://hg-git.github.io/ has been suggested. - - Git CLI commands for committing a pull request to cpython --------------------------------------------------------- -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Thu Jun 9 15:13:31 2016 From: python-checkins at python.org (yury.selivanov) Date: Thu, 09 Jun 2016 19:13:31 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MjQz?= =?utf-8?b?OiBGaXggX19haXRlcl9fIHByb3RvY29s?= Message-ID: <20160609191322.101555.41505.F8D73271@psf.io> https://hg.python.org/cpython/rev/93ad47d63b87 changeset: 101823:93ad47d63b87 branch: 3.5 parent: 101820:eeb742d8bf9c user: Yury Selivanov date: Thu Jun 09 15:08:31 2016 -0400 summary: Issue #27243: Fix __aiter__ protocol files: Doc/glossary.rst | 7 +- Doc/reference/compound_stmts.rst | 2 +- Doc/reference/datamodel.rst | 48 +++++++++- Doc/whatsnew/3.5.rst | 13 ++ Include/genobject.h | 3 + Lib/_collections_abc.py | 4 +- Lib/asyncio/compat.py | 1 + Lib/asyncio/streams.py | 6 + Lib/test/test_coroutines.py | 98 +++++++++++++++---- Lib/test/test_grammar.py | 2 +- Misc/NEWS | 5 + Objects/genobject.c | 94 +++++++++++++++++++ Python/ceval.c | 40 +++++++- 13 files changed, 291 insertions(+), 32 deletions(-) diff --git a/Doc/glossary.rst b/Doc/glossary.rst --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -76,13 +76,12 @@ asynchronous iterable An object, that can be used in an :keyword:`async for` statement. - Must return an :term:`awaitable` from its :meth:`__aiter__` method, - which should in turn be resolved in an :term:`asynchronous iterator` - object. Introduced by :pep:`492`. + Must return an :term:`asyncronous iterator` from its + :meth:`__aiter__` method. Introduced by :pep:`492`. asynchronous iterator An object that implements :meth:`__aiter__` and :meth:`__anext__` - methods, that must return :term:`awaitable` objects. + methods. ``__anext__`` must return an :term:`awaitable` object. :keyword:`async for` resolves awaitable returned from asynchronous iterator's :meth:`__anext__` method until it raises :exc:`StopAsyncIteration` exception. Introduced by :pep:`492`. 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 @@ -726,7 +726,7 @@ Is semantically equivalent to:: iter = (ITER) - iter = await type(iter).__aiter__(iter) + iter = type(iter).__aiter__(iter) running = True while running: try: diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -2359,6 +2359,7 @@ Coroutine objects are automatically closed using the above process when they are about to be destroyed. +.. _async-iterators: Asynchronous Iterators ---------------------- @@ -2371,7 +2372,7 @@ .. method:: object.__aiter__(self) - Must return an *awaitable* resulting in an *asynchronous iterator* object. + Must return an *asynchronous iterator* object. .. method:: object.__anext__(self) @@ -2384,7 +2385,7 @@ async def readline(self): ... - async def __aiter__(self): + def __aiter__(self): return self async def __anext__(self): @@ -2395,6 +2396,49 @@ .. versionadded:: 3.5 +.. note:: + + .. versionchanged:: 3.5.2 + Starting with CPython 3.5.2, ``__aiter__`` can directly return + :term:`asynchronous iterators `. Returning + an :term:`awaitable` object will result in a + :exc:`PendingDeprecationWarning`. + + The recommended way of writing backwards compatible code in + CPython 3.5.x is to continue returning awaitables from + ``__aiter__``. If you want to avoid the PendingDeprecationWarning + and keep the code backwards compatible, the following decorator + can be used:: + + import functools + import sys + + if sys.version_info < (3, 5, 2): + def aiter_compat(func): + @functools.wraps(func) + async def wrapper(self): + return func(self) + return wrapper + else: + def aiter_compat(func): + return func + + Example:: + + class AsyncIterator: + + @aiter_compat + def __aiter__(self): + return self + + async def __anext__(self): + ... + + Starting with CPython 3.6, the :exc:`PendingDeprecationWarning` + will be replaced with the :exc:`DeprecationWarning`. + In CPython 3.7, returning an awaitable from ``__aiter__`` will + result in a :exc:`RuntimeError`. + Asynchronous Context Managers ----------------------------- diff --git a/Doc/whatsnew/3.5.rst b/Doc/whatsnew/3.5.rst --- a/Doc/whatsnew/3.5.rst +++ b/Doc/whatsnew/3.5.rst @@ -247,6 +247,19 @@ Coroutine functions are intended to be run inside a compatible event loop, such as the :ref:`asyncio loop `. + +.. note:: + + .. versionchanged:: 3.5.2 + Starting with CPython 3.5.2, ``__aiter__`` can directly return + :term:`asynchronous iterators `. Returning + an :term:`awaitable` object will result in a + :exc:`PendingDeprecationWarning`. + + See more details in the :ref:`async-iterators` documentation + section. + + .. seealso:: :pep:`492` -- Coroutines with async and await syntax diff --git a/Include/genobject.h b/Include/genobject.h --- a/Include/genobject.h +++ b/Include/genobject.h @@ -54,6 +54,9 @@ PyAPI_DATA(PyTypeObject) PyCoro_Type; PyAPI_DATA(PyTypeObject) _PyCoroWrapper_Type; +PyAPI_DATA(PyTypeObject) _PyAIterWrapper_Type; +PyObject *_PyAIterWrapper_New(PyObject *aiter); + #define PyCoro_CheckExact(op) (Py_TYPE(op) == &PyCoro_Type) PyObject *_PyCoro_GetAwaitableIter(PyObject *o); PyAPI_FUNC(PyObject *) PyCoro_New(struct _frame *, diff --git a/Lib/_collections_abc.py b/Lib/_collections_abc.py --- a/Lib/_collections_abc.py +++ b/Lib/_collections_abc.py @@ -156,7 +156,7 @@ __slots__ = () @abstractmethod - async def __aiter__(self): + def __aiter__(self): return AsyncIterator() @classmethod @@ -176,7 +176,7 @@ """Return the next item or raise StopAsyncIteration when exhausted.""" raise StopAsyncIteration - async def __aiter__(self): + def __aiter__(self): return self @classmethod diff --git a/Lib/asyncio/compat.py b/Lib/asyncio/compat.py --- a/Lib/asyncio/compat.py +++ b/Lib/asyncio/compat.py @@ -4,6 +4,7 @@ PY34 = sys.version_info >= (3, 4) PY35 = sys.version_info >= (3, 5) +PY352 = sys.version_info >= (3, 5, 2) def flatten_list_bytes(list_of_data): diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py --- a/Lib/asyncio/streams.py +++ b/Lib/asyncio/streams.py @@ -689,3 +689,9 @@ if val == b'': raise StopAsyncIteration return val + + if compat.PY352: + # In Python 3.5.2 and greater, __aiter__ should return + # the asynchronous iterator directly. + def __aiter__(self): + return self diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py --- a/Lib/test/test_coroutines.py +++ b/Lib/test/test_coroutines.py @@ -1255,8 +1255,9 @@ buffer = [] async def test1(): - async for i1, i2 in AsyncIter(): - buffer.append(i1 + i2) + with self.assertWarnsRegex(PendingDeprecationWarning, "legacy"): + async for i1, i2 in AsyncIter(): + buffer.append(i1 + i2) yielded, _ = run_async(test1()) # Make sure that __aiter__ was called only once @@ -1268,12 +1269,13 @@ buffer = [] async def test2(): nonlocal buffer - async for i in AsyncIter(): - buffer.append(i[0]) - if i[0] == 20: - break - else: - buffer.append('what?') + with self.assertWarnsRegex(PendingDeprecationWarning, "legacy"): + async for i in AsyncIter(): + buffer.append(i[0]) + if i[0] == 20: + break + else: + buffer.append('what?') buffer.append('end') yielded, _ = run_async(test2()) @@ -1286,12 +1288,13 @@ buffer = [] async def test3(): nonlocal buffer - async for i in AsyncIter(): - if i[0] > 20: - continue - buffer.append(i[0]) - else: - buffer.append('what?') + with self.assertWarnsRegex(PendingDeprecationWarning, "legacy"): + async for i in AsyncIter(): + if i[0] > 20: + continue + buffer.append(i[0]) + else: + buffer.append('what?') buffer.append('end') yielded, _ = run_async(test3()) @@ -1338,7 +1341,7 @@ def test_for_4(self): class I: - async def __aiter__(self): + def __aiter__(self): return self def __anext__(self): @@ -1368,8 +1371,9 @@ return 123 async def foo(): - async for i in I(): - print('never going to happen') + with self.assertWarnsRegex(PendingDeprecationWarning, "legacy"): + async for i in I(): + print('never going to happen') with self.assertRaisesRegex( TypeError, @@ -1393,7 +1397,7 @@ def __init__(self): self.i = 0 - async def __aiter__(self): + def __aiter__(self): return self async def __anext__(self): @@ -1417,7 +1421,11 @@ I += 1 I += 1000 - run_async(main()) + with warnings.catch_warnings(): + warnings.simplefilter("error") + # Test that __aiter__ that returns an asyncronous iterator + # directly does not throw any warnings. + run_async(main()) self.assertEqual(I, 111011) self.assertEqual(sys.getrefcount(manager), mrefs_before) @@ -1472,13 +1480,63 @@ 1/0 async def foo(): nonlocal CNT + with self.assertWarnsRegex(PendingDeprecationWarning, "legacy"): + async for i in AI(): + CNT += 1 + CNT += 10 + with self.assertRaises(ZeroDivisionError): + run_async(foo()) + self.assertEqual(CNT, 0) + + def test_for_8(self): + CNT = 0 + class AI: + def __aiter__(self): + 1/0 + async def foo(): + nonlocal CNT async for i in AI(): CNT += 1 CNT += 10 with self.assertRaises(ZeroDivisionError): - run_async(foo()) + with warnings.catch_warnings(): + warnings.simplefilter("error") + # Test that if __aiter__ raises an exception it propagates + # without any kind of warning. + run_async(foo()) self.assertEqual(CNT, 0) + def test_for_9(self): + # Test that PendingDeprecationWarning can safely be converted into + # an exception (__aiter__ should not have a chance to raise + # a ZeroDivisionError.) + class AI: + async def __aiter__(self): + 1/0 + async def foo(): + async for i in AI(): + pass + + with self.assertRaises(PendingDeprecationWarning): + with warnings.catch_warnings(): + warnings.simplefilter("error") + run_async(foo()) + + def test_for_10(self): + # Test that PendingDeprecationWarning can safely be converted into + # an exception. + class AI: + async def __aiter__(self): + pass + async def foo(): + async for i in AI(): + pass + + with self.assertRaises(PendingDeprecationWarning): + with warnings.catch_warnings(): + warnings.simplefilter("error") + run_async(foo()) + def test_copy(self): async def func(): pass coro = func() 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 @@ -1076,7 +1076,7 @@ class Done(Exception): pass class AIter: - async def __aiter__(self): + def __aiter__(self): return self async def __anext__(self): raise StopAsyncIteration diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -130,6 +130,11 @@ - Issue #25887: Raise a RuntimeError when a coroutine object is awaited more than once. +- Issue #27243: Update the __aiter__ protocol: instead of returning + an awaitable that resolves to an asynchronous iterator, the asynchronous + iterator should be returned directly. Doing the former will trigger a + PendingDeprecationWarning. + Library ------- diff --git a/Objects/genobject.c b/Objects/genobject.c --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -992,3 +992,97 @@ { return gen_new_with_qualname(&PyCoro_Type, f, name, qualname); } + + +/* __aiter__ wrapper; see http://bugs.python.org/issue27243 for details. */ + +typedef struct { + PyObject_HEAD + PyObject *aw_aiter; +} PyAIterWrapper; + + +static PyObject * +aiter_wrapper_iternext(PyAIterWrapper *aw) +{ + PyErr_SetObject(PyExc_StopIteration, aw->aw_aiter); + return NULL; +} + +static int +aiter_wrapper_traverse(PyAIterWrapper *aw, visitproc visit, void *arg) +{ + Py_VISIT((PyObject *)aw->aw_aiter); + return 0; +} + +static void +aiter_wrapper_dealloc(PyAIterWrapper *aw) +{ + _PyObject_GC_UNTRACK((PyObject *)aw); + Py_CLEAR(aw->aw_aiter); + PyObject_GC_Del(aw); +} + +static PyAsyncMethods aiter_wrapper_as_async = { + PyObject_SelfIter, /* am_await */ + 0, /* am_aiter */ + 0 /* am_anext */ +}; + +PyTypeObject _PyAIterWrapper_Type = { + PyVarObject_HEAD_INIT(&PyType_Type, 0) + "aiter_wrapper", + sizeof(PyAIterWrapper), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)aiter_wrapper_dealloc, /* destructor tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + &aiter_wrapper_as_async, /* tp_as_async */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ + "A wrapper object for __aiter__ bakwards compatibility.", + (traverseproc)aiter_wrapper_traverse, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + PyObject_SelfIter, /* tp_iter */ + (iternextfunc)aiter_wrapper_iternext, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + PyObject_Del, /* tp_free */ +}; + + +PyObject * +_PyAIterWrapper_New(PyObject *aiter) +{ + PyAIterWrapper *aw = PyObject_GC_New(PyAIterWrapper, + &_PyAIterWrapper_Type); + if (aw == NULL) { + return NULL; + } + Py_INCREF(aiter); + aw->aw_aiter = aiter; + _PyObject_GC_TRACK(aw); + return (PyObject *)aw; +} diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1933,8 +1933,9 @@ PyObject *obj = TOP(); PyTypeObject *type = Py_TYPE(obj); - if (type->tp_as_async != NULL) + if (type->tp_as_async != NULL) { getter = type->tp_as_async->am_aiter; + } if (getter != NULL) { iter = (*getter)(obj); @@ -1955,6 +1956,27 @@ goto error; } + if (Py_TYPE(iter)->tp_as_async != NULL && + Py_TYPE(iter)->tp_as_async->am_anext != NULL) { + + /* Starting with CPython 3.5.2 __aiter__ should return + asynchronous iterators directly (not awaitables that + resolve to asynchronous iterators.) + + Therefore, we check if the object that was returned + from __aiter__ has an __anext__ method. If it does, + we wrap it in an awaitable that resolves to `iter`. + + See http://bugs.python.org/issue27243 for more + details. + */ + + PyObject *wrapper = _PyAIterWrapper_New(iter); + Py_DECREF(iter); + SET_TOP(wrapper); + DISPATCH(); + } + awaitable = _PyCoro_GetAwaitableIter(iter); if (awaitable == NULL) { SET_TOP(NULL); @@ -1966,9 +1988,23 @@ Py_DECREF(iter); goto error; - } else + } else { Py_DECREF(iter); + if (PyErr_WarnFormat( + PyExc_PendingDeprecationWarning, 1, + "'%.100s' implements legacy __aiter__ protocol; " + "__aiter__ should return an asynchronous " + "iterator, not awaitable", + type->tp_name)) + { + /* Warning was converted to an error. */ + Py_DECREF(awaitable); + SET_TOP(NULL); + goto error; + } + } + SET_TOP(awaitable); DISPATCH(); } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 15:13:31 2016 From: python-checkins at python.org (yury.selivanov) Date: Thu, 09 Jun 2016 19:13:31 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy41IChpc3N1ZSAjMjcyNDMp?= Message-ID: <20160609191322.120818.22590.6EE221AA@psf.io> https://hg.python.org/cpython/rev/9ff95c30a38e changeset: 101824:9ff95c30a38e parent: 101822:2d7dcd8cf928 parent: 101823:93ad47d63b87 user: Yury Selivanov date: Thu Jun 09 15:13:16 2016 -0400 summary: Merge 3.5 (issue #27243) files: Doc/glossary.rst | 7 +- Doc/reference/compound_stmts.rst | 2 +- Doc/reference/datamodel.rst | 48 +++++++++- Doc/whatsnew/3.5.rst | 13 ++ Include/genobject.h | 3 + Lib/_collections_abc.py | 4 +- Lib/asyncio/compat.py | 1 + Lib/asyncio/streams.py | 6 + Lib/test/test_coroutines.py | 98 +++++++++++++++---- Lib/test/test_grammar.py | 2 +- Misc/NEWS | 6 + Objects/genobject.c | 94 +++++++++++++++++++ Python/ceval.c | 40 +++++++- 13 files changed, 292 insertions(+), 32 deletions(-) diff --git a/Doc/glossary.rst b/Doc/glossary.rst --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -76,13 +76,12 @@ asynchronous iterable An object, that can be used in an :keyword:`async for` statement. - Must return an :term:`awaitable` from its :meth:`__aiter__` method, - which should in turn be resolved in an :term:`asynchronous iterator` - object. Introduced by :pep:`492`. + Must return an :term:`asyncronous iterator` from its + :meth:`__aiter__` method. Introduced by :pep:`492`. asynchronous iterator An object that implements :meth:`__aiter__` and :meth:`__anext__` - methods, that must return :term:`awaitable` objects. + methods. ``__anext__`` must return an :term:`awaitable` object. :keyword:`async for` resolves awaitable returned from asynchronous iterator's :meth:`__anext__` method until it raises :exc:`StopAsyncIteration` exception. Introduced by :pep:`492`. 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 @@ -726,7 +726,7 @@ Is semantically equivalent to:: iter = (ITER) - iter = await type(iter).__aiter__(iter) + iter = type(iter).__aiter__(iter) running = True while running: try: diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -2360,6 +2360,7 @@ Coroutine objects are automatically closed using the above process when they are about to be destroyed. +.. _async-iterators: Asynchronous Iterators ---------------------- @@ -2372,7 +2373,7 @@ .. method:: object.__aiter__(self) - Must return an *awaitable* resulting in an *asynchronous iterator* object. + Must return an *asynchronous iterator* object. .. method:: object.__anext__(self) @@ -2385,7 +2386,7 @@ async def readline(self): ... - async def __aiter__(self): + def __aiter__(self): return self async def __anext__(self): @@ -2396,6 +2397,49 @@ .. versionadded:: 3.5 +.. note:: + + .. versionchanged:: 3.5.2 + Starting with CPython 3.5.2, ``__aiter__`` can directly return + :term:`asynchronous iterators `. Returning + an :term:`awaitable` object will result in a + :exc:`PendingDeprecationWarning`. + + The recommended way of writing backwards compatible code in + CPython 3.5.x is to continue returning awaitables from + ``__aiter__``. If you want to avoid the PendingDeprecationWarning + and keep the code backwards compatible, the following decorator + can be used:: + + import functools + import sys + + if sys.version_info < (3, 5, 2): + def aiter_compat(func): + @functools.wraps(func) + async def wrapper(self): + return func(self) + return wrapper + else: + def aiter_compat(func): + return func + + Example:: + + class AsyncIterator: + + @aiter_compat + def __aiter__(self): + return self + + async def __anext__(self): + ... + + Starting with CPython 3.6, the :exc:`PendingDeprecationWarning` + will be replaced with the :exc:`DeprecationWarning`. + In CPython 3.7, returning an awaitable from ``__aiter__`` will + result in a :exc:`RuntimeError`. + Asynchronous Context Managers ----------------------------- diff --git a/Doc/whatsnew/3.5.rst b/Doc/whatsnew/3.5.rst --- a/Doc/whatsnew/3.5.rst +++ b/Doc/whatsnew/3.5.rst @@ -247,6 +247,19 @@ Coroutine functions are intended to be run inside a compatible event loop, such as the :ref:`asyncio loop `. + +.. note:: + + .. versionchanged:: 3.5.2 + Starting with CPython 3.5.2, ``__aiter__`` can directly return + :term:`asynchronous iterators `. Returning + an :term:`awaitable` object will result in a + :exc:`PendingDeprecationWarning`. + + See more details in the :ref:`async-iterators` documentation + section. + + .. seealso:: :pep:`492` -- Coroutines with async and await syntax diff --git a/Include/genobject.h b/Include/genobject.h --- a/Include/genobject.h +++ b/Include/genobject.h @@ -54,6 +54,9 @@ PyAPI_DATA(PyTypeObject) PyCoro_Type; PyAPI_DATA(PyTypeObject) _PyCoroWrapper_Type; +PyAPI_DATA(PyTypeObject) _PyAIterWrapper_Type; +PyObject *_PyAIterWrapper_New(PyObject *aiter); + #define PyCoro_CheckExact(op) (Py_TYPE(op) == &PyCoro_Type) PyObject *_PyCoro_GetAwaitableIter(PyObject *o); PyAPI_FUNC(PyObject *) PyCoro_New(struct _frame *, diff --git a/Lib/_collections_abc.py b/Lib/_collections_abc.py --- a/Lib/_collections_abc.py +++ b/Lib/_collections_abc.py @@ -156,7 +156,7 @@ __slots__ = () @abstractmethod - async def __aiter__(self): + def __aiter__(self): return AsyncIterator() @classmethod @@ -176,7 +176,7 @@ """Return the next item or raise StopAsyncIteration when exhausted.""" raise StopAsyncIteration - async def __aiter__(self): + def __aiter__(self): return self @classmethod diff --git a/Lib/asyncio/compat.py b/Lib/asyncio/compat.py --- a/Lib/asyncio/compat.py +++ b/Lib/asyncio/compat.py @@ -4,6 +4,7 @@ PY34 = sys.version_info >= (3, 4) PY35 = sys.version_info >= (3, 5) +PY352 = sys.version_info >= (3, 5, 2) def flatten_list_bytes(list_of_data): diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py --- a/Lib/asyncio/streams.py +++ b/Lib/asyncio/streams.py @@ -689,3 +689,9 @@ if val == b'': raise StopAsyncIteration return val + + if compat.PY352: + # In Python 3.5.2 and greater, __aiter__ should return + # the asynchronous iterator directly. + def __aiter__(self): + return self diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py --- a/Lib/test/test_coroutines.py +++ b/Lib/test/test_coroutines.py @@ -1255,8 +1255,9 @@ buffer = [] async def test1(): - async for i1, i2 in AsyncIter(): - buffer.append(i1 + i2) + with self.assertWarnsRegex(PendingDeprecationWarning, "legacy"): + async for i1, i2 in AsyncIter(): + buffer.append(i1 + i2) yielded, _ = run_async(test1()) # Make sure that __aiter__ was called only once @@ -1268,12 +1269,13 @@ buffer = [] async def test2(): nonlocal buffer - async for i in AsyncIter(): - buffer.append(i[0]) - if i[0] == 20: - break - else: - buffer.append('what?') + with self.assertWarnsRegex(PendingDeprecationWarning, "legacy"): + async for i in AsyncIter(): + buffer.append(i[0]) + if i[0] == 20: + break + else: + buffer.append('what?') buffer.append('end') yielded, _ = run_async(test2()) @@ -1286,12 +1288,13 @@ buffer = [] async def test3(): nonlocal buffer - async for i in AsyncIter(): - if i[0] > 20: - continue - buffer.append(i[0]) - else: - buffer.append('what?') + with self.assertWarnsRegex(PendingDeprecationWarning, "legacy"): + async for i in AsyncIter(): + if i[0] > 20: + continue + buffer.append(i[0]) + else: + buffer.append('what?') buffer.append('end') yielded, _ = run_async(test3()) @@ -1338,7 +1341,7 @@ def test_for_4(self): class I: - async def __aiter__(self): + def __aiter__(self): return self def __anext__(self): @@ -1368,8 +1371,9 @@ return 123 async def foo(): - async for i in I(): - print('never going to happen') + with self.assertWarnsRegex(PendingDeprecationWarning, "legacy"): + async for i in I(): + print('never going to happen') with self.assertRaisesRegex( TypeError, @@ -1393,7 +1397,7 @@ def __init__(self): self.i = 0 - async def __aiter__(self): + def __aiter__(self): return self async def __anext__(self): @@ -1417,7 +1421,11 @@ I += 1 I += 1000 - run_async(main()) + with warnings.catch_warnings(): + warnings.simplefilter("error") + # Test that __aiter__ that returns an asyncronous iterator + # directly does not throw any warnings. + run_async(main()) self.assertEqual(I, 111011) self.assertEqual(sys.getrefcount(manager), mrefs_before) @@ -1472,13 +1480,63 @@ 1/0 async def foo(): nonlocal CNT + with self.assertWarnsRegex(PendingDeprecationWarning, "legacy"): + async for i in AI(): + CNT += 1 + CNT += 10 + with self.assertRaises(ZeroDivisionError): + run_async(foo()) + self.assertEqual(CNT, 0) + + def test_for_8(self): + CNT = 0 + class AI: + def __aiter__(self): + 1/0 + async def foo(): + nonlocal CNT async for i in AI(): CNT += 1 CNT += 10 with self.assertRaises(ZeroDivisionError): - run_async(foo()) + with warnings.catch_warnings(): + warnings.simplefilter("error") + # Test that if __aiter__ raises an exception it propagates + # without any kind of warning. + run_async(foo()) self.assertEqual(CNT, 0) + def test_for_9(self): + # Test that PendingDeprecationWarning can safely be converted into + # an exception (__aiter__ should not have a chance to raise + # a ZeroDivisionError.) + class AI: + async def __aiter__(self): + 1/0 + async def foo(): + async for i in AI(): + pass + + with self.assertRaises(PendingDeprecationWarning): + with warnings.catch_warnings(): + warnings.simplefilter("error") + run_async(foo()) + + def test_for_10(self): + # Test that PendingDeprecationWarning can safely be converted into + # an exception. + class AI: + async def __aiter__(self): + pass + async def foo(): + async for i in AI(): + pass + + with self.assertRaises(PendingDeprecationWarning): + with warnings.catch_warnings(): + warnings.simplefilter("error") + run_async(foo()) + def test_copy(self): async def func(): pass coro = func() 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 @@ -1114,7 +1114,7 @@ class Done(Exception): pass class AIter: - async def __aiter__(self): + def __aiter__(self): return self async def __anext__(self): raise StopAsyncIteration diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -27,6 +27,12 @@ - Issue #23275: Allow assigning to an empty target list in round brackets: () = iterable. +- Issue #27243: Update the __aiter__ protocol: instead of returning + an awaitable that resolves to an asynchronous iterator, the asynchronous + iterator should be returned directly. Doing the former will trigger a + PendingDeprecationWarning. + + Library ------- diff --git a/Objects/genobject.c b/Objects/genobject.c --- a/Objects/genobject.c +++ b/Objects/genobject.c @@ -984,3 +984,97 @@ { return gen_new_with_qualname(&PyCoro_Type, f, name, qualname); } + + +/* __aiter__ wrapper; see http://bugs.python.org/issue27243 for details. */ + +typedef struct { + PyObject_HEAD + PyObject *aw_aiter; +} PyAIterWrapper; + + +static PyObject * +aiter_wrapper_iternext(PyAIterWrapper *aw) +{ + PyErr_SetObject(PyExc_StopIteration, aw->aw_aiter); + return NULL; +} + +static int +aiter_wrapper_traverse(PyAIterWrapper *aw, visitproc visit, void *arg) +{ + Py_VISIT((PyObject *)aw->aw_aiter); + return 0; +} + +static void +aiter_wrapper_dealloc(PyAIterWrapper *aw) +{ + _PyObject_GC_UNTRACK((PyObject *)aw); + Py_CLEAR(aw->aw_aiter); + PyObject_GC_Del(aw); +} + +static PyAsyncMethods aiter_wrapper_as_async = { + PyObject_SelfIter, /* am_await */ + 0, /* am_aiter */ + 0 /* am_anext */ +}; + +PyTypeObject _PyAIterWrapper_Type = { + PyVarObject_HEAD_INIT(&PyType_Type, 0) + "aiter_wrapper", + sizeof(PyAIterWrapper), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)aiter_wrapper_dealloc, /* destructor tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + &aiter_wrapper_as_async, /* tp_as_async */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ + "A wrapper object for __aiter__ bakwards compatibility.", + (traverseproc)aiter_wrapper_traverse, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + PyObject_SelfIter, /* tp_iter */ + (iternextfunc)aiter_wrapper_iternext, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ + PyObject_Del, /* tp_free */ +}; + + +PyObject * +_PyAIterWrapper_New(PyObject *aiter) +{ + PyAIterWrapper *aw = PyObject_GC_New(PyAIterWrapper, + &_PyAIterWrapper_Type); + if (aw == NULL) { + return NULL; + } + Py_INCREF(aiter); + aw->aw_aiter = aiter; + _PyObject_GC_TRACK(aw); + return (PyObject *)aw; +} diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1935,8 +1935,9 @@ PyObject *obj = TOP(); PyTypeObject *type = Py_TYPE(obj); - if (type->tp_as_async != NULL) + if (type->tp_as_async != NULL) { getter = type->tp_as_async->am_aiter; + } if (getter != NULL) { iter = (*getter)(obj); @@ -1957,6 +1958,27 @@ goto error; } + if (Py_TYPE(iter)->tp_as_async != NULL && + Py_TYPE(iter)->tp_as_async->am_anext != NULL) { + + /* Starting with CPython 3.5.2 __aiter__ should return + asynchronous iterators directly (not awaitables that + resolve to asynchronous iterators.) + + Therefore, we check if the object that was returned + from __aiter__ has an __anext__ method. If it does, + we wrap it in an awaitable that resolves to `iter`. + + See http://bugs.python.org/issue27243 for more + details. + */ + + PyObject *wrapper = _PyAIterWrapper_New(iter); + Py_DECREF(iter); + SET_TOP(wrapper); + DISPATCH(); + } + awaitable = _PyCoro_GetAwaitableIter(iter); if (awaitable == NULL) { SET_TOP(NULL); @@ -1968,9 +1990,23 @@ Py_DECREF(iter); goto error; - } else + } else { Py_DECREF(iter); + if (PyErr_WarnFormat( + PyExc_PendingDeprecationWarning, 1, + "'%.100s' implements legacy __aiter__ protocol; " + "__aiter__ should return an asynchronous " + "iterator, not awaitable", + type->tp_name)) + { + /* Warning was converted to an error. */ + Py_DECREF(awaitable); + SET_TOP(NULL); + goto error; + } + } + SET_TOP(awaitable); DISPATCH(); } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 17:17:10 2016 From: python-checkins at python.org (brett.cannon) Date: Thu, 09 Jun 2016 21:17:10 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Update_PEP_519_on_implementat?= =?utf-8?q?ion_progress_from_PyCon_US_2016_sprints?= Message-ID: <20160609211702.87507.69417.AF6E6CF2@psf.io> https://hg.python.org/peps/rev/9368e850ea61 changeset: 6361:9368e850ea61 user: Brett Cannon date: Thu Jun 09 14:16:57 2016 -0700 summary: Update PEP 519 on implementation progress from PyCon US 2016 sprints files: pep-0519.txt | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pep-0519.txt b/pep-0519.txt --- a/pep-0519.txt +++ b/pep-0519.txt @@ -321,28 +321,38 @@ Python 3.6: #. Remove the ``path`` attribute from pathlib - (`done `_) + (`done `__) #. Remove the provisional status of pathlib #. Add ``os.PathLike`` + (`code done `__; needs docs) #. Add ``PyOS_FSPath()`` + (`code done `__; needs docs) #. Add ``os.fspath()`` + (`done `__) #. Update ``os.fsencode()`` + (`done `__) #. Update ``os.fsdecode()`` + (`done `__) #. Update ``pathlib.PurePath`` and ``pathlib.Path`` + (`bug `__) #. Add ``__fspath__()`` #. Add ``os.PathLike`` support to the constructors #. Update ``os.DirEntry`` + (`bug `__) #. Add ``__fspath__()`` #. Add ``os.pathLike`` support to the constructor #. Alias ``DirEntry`` to ``os.DirEntry`` - (`bug `_) + (`bug `__) #. Update ``builtins.open()`` + (`done `__) #. Update ``os.path`` -#. Add a `glossary `_ entry for "path-like" + (http://bugs.python.org/issue27186) +#. Add a `glossary `__ entry for "path-like" + (`bug `__) #. Update `"What's New" `_ -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Thu Jun 9 17:29:35 2016 From: python-checkins at python.org (brett.cannon) Date: Thu, 09 Jun 2016 21:29:35 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fix_some_PEP_8_violations?= =?utf-8?q?=2E?= Message-ID: <20160609212930.81388.48438.5382F6E8@psf.io> https://hg.python.org/cpython/rev/f4a6267eace2 changeset: 101825:f4a6267eace2 user: Brett Cannon date: Thu Jun 09 14:29:25 2016 -0700 summary: Fix some PEP 8 violations. files: Lib/os.py | 16 ++++++---------- 1 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Lib/os.py b/Lib/os.py --- a/Lib/os.py +++ b/Lib/os.py @@ -876,8 +876,7 @@ errors = 'surrogateescape' def fsencode(filename): - """ - Encode filename (an os.PathLike, bytes, or str) to the filesystem + """Encode filename (an os.PathLike, bytes, or str) to the filesystem encoding with 'surrogateescape' error handler, return bytes unchanged. On Windows, use 'strict' error handler if the file system encoding is 'mbcs' (which is the default encoding). @@ -892,8 +891,7 @@ + type(filename).__name__) def fsdecode(filename): - """ - Decode filename (an os.PathLike, bytes, or str) from the filesystem + """Decode filename (an os.PathLike, bytes, or str) from the filesystem encoding with 'surrogateescape' error handler, return str unchanged. On Windows, use 'strict' error handler if the file system encoding is 'mbcs' (which is the default encoding). @@ -1127,14 +1125,12 @@ + path_type.__name__) class PathLike(abc.ABC): - """ - Abstract base class for implementing the file system path protocol. - """ + + """Abstract base class for implementing the file system path protocol.""" + @abc.abstractmethod def __fspath__(self): - """ - Return the file system path representation of the object. - """ + """Return the file system path representation of the object.""" raise NotImplementedError @classmethod -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 17:32:21 2016 From: python-checkins at python.org (brett.cannon) Date: Thu, 09 Jun 2016 21:32:21 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Clarify_documentation_for_?= =?utf-8?b?b3MuZnNwYXRoKCku?= Message-ID: <20160609213216.20145.11416.0A4A8CE1@psf.io> https://hg.python.org/cpython/rev/ec0c6a4e617c changeset: 101826:ec0c6a4e617c user: Brett Cannon date: Thu Jun 09 14:32:08 2016 -0700 summary: Clarify documentation for os.fspath(). files: Modules/clinic/posixmodule.c.h | 8 ++++---- Modules/posixmodule.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h --- a/Modules/clinic/posixmodule.c.h +++ b/Modules/clinic/posixmodule.c.h @@ -5486,9 +5486,9 @@ "\n" "Return the file system path representation of the object.\n" "\n" -"If the object is str or bytes, then allow it to pass through with\n" -"an incremented refcount. If the object defines __fspath__(), then\n" -"return the result of that method. All other types raise a TypeError."); +"If the object is str or bytes, then allow it to pass through as-is. If the\n" +"object defines __fspath__(), then return the result of that method. All other\n" +"types raise a TypeError."); #define OS_FSPATH_METHODDEF \ {"fspath", (PyCFunction)os_fspath, METH_VARARGS|METH_KEYWORDS, os_fspath__doc__}, @@ -5984,4 +5984,4 @@ #ifndef OS_SET_HANDLE_INHERITABLE_METHODDEF #define OS_SET_HANDLE_INHERITABLE_METHODDEF #endif /* !defined(OS_SET_HANDLE_INHERITABLE_METHODDEF) */ -/*[clinic end generated code: output=31dd4f672c8a6f8c input=a9049054013a1b77]*/ +/*[clinic end generated code: output=1b91c3a100e75a4d input=a9049054013a1b77]*/ diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -12323,14 +12323,14 @@ Return the file system path representation of the object. -If the object is str or bytes, then allow it to pass through with -an incremented refcount. If the object defines __fspath__(), then -return the result of that method. All other types raise a TypeError. +If the object is str or bytes, then allow it to pass through as-is. If the +object defines __fspath__(), then return the result of that method. All other +types raise a TypeError. [clinic start generated code]*/ static PyObject * os_fspath_impl(PyModuleDef *module, PyObject *path) -/*[clinic end generated code: output=51ef0c2772c1932a input=652c7c37e4be1c13]*/ +/*[clinic end generated code: output=51ef0c2772c1932a input=e357165f7b22490f]*/ { return PyOS_FSPath(path); } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 17:37:20 2016 From: python-checkins at python.org (brett.cannon) Date: Thu, 09 Jun 2016 21:37:20 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Clarify_the_os=2Efspath=28?= =?utf-8?q?=29_documentation=2E?= Message-ID: <20160609213710.101804.64697.A1EEE429@psf.io> https://hg.python.org/cpython/rev/dd5c0669cbd7 changeset: 101827:dd5c0669cbd7 user: Brett Cannon date: Thu Jun 09 14:37:06 2016 -0700 summary: Clarify the os.fspath() documentation. files: Doc/library/os.rst | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -188,11 +188,12 @@ .. function:: fspath(path) - Return the string representation of the path. + Return the file system representation of the path. If :class:`str` or :class:`bytes` is passed in, it is returned unchanged; - otherwise, the result of calling ``type(path).__fspath__`` is returned, or an - exception is raised. + otherwise, the result of calling ``type(path).__fspath__`` is returned + (which is represented by :class:`os.PathLike`). All other types raise a + :exc:`TypeError`. .. function:: getenv(key, default=None) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 17:42:37 2016 From: python-checkins at python.org (brett.cannon) Date: Thu, 09 Jun 2016 21:42:37 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Fix_up_link?= Message-ID: <20160609214235.120780.41678.9153724B@psf.io> https://hg.python.org/peps/rev/47928cdc329b changeset: 6362:47928cdc329b user: Brett Cannon date: Thu Jun 09 14:42:31 2016 -0700 summary: Fix up link files: pep-0519.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/pep-0519.txt b/pep-0519.txt --- a/pep-0519.txt +++ b/pep-0519.txt @@ -350,7 +350,7 @@ #. Update ``builtins.open()`` (`done `__) #. Update ``os.path`` - (http://bugs.python.org/issue27186) + (`bug `__) #. Add a `glossary `__ entry for "path-like" (`bug `__) #. Update `"What's New" `_ -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Thu Jun 9 17:57:56 2016 From: python-checkins at python.org (yury.selivanov) Date: Thu, 09 Jun 2016 21:57:56 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_PEP_492=3A_Update_=5F=5Faiter?= =?utf-8?q?=5F=5F_protocol?= Message-ID: <20160609215754.25983.68449.F34AF1B1@psf.io> https://hg.python.org/peps/rev/fef4b9969b9d changeset: 6363:fef4b9969b9d user: Yury Selivanov date: Thu Jun 09 17:57:41 2016 -0400 summary: PEP 492: Update __aiter__ protocol files: pep-0492.txt | 113 ++++++++++++++++---------------------- 1 files changed, 49 insertions(+), 64 deletions(-) diff --git a/pep-0492.txt b/pep-0492.txt --- a/pep-0492.txt +++ b/pep-0492.txt @@ -40,18 +40,36 @@ adopt, similar features: [2]_, [5]_, [6]_, [7]_, [8]_, [10]_. -API Design and Implementation Note -================================== +API Design and Implementation Revisions +======================================= -Feedback on the initial beta release of Python 3.5 resulted in a redesign -of the object model supporting this PEP to more clearly separate native -coroutines from generators - rather than being a new kind of generator, -native coroutines are now their own completely distinct type (implemented -in [17]_). +1. Feedback on the initial beta release of Python 3.5 resulted in a + redesign of the object model supporting this PEP to more clearly + separate native coroutines from generators - rather than being a + new kind of generator, native coroutines are now their own + completely distinct type (implemented in [17]_). -This change was implemented based primarily due to problems encountered -attempting to integrate support for native coroutines into the Tornado web -server (reported in [18]_). + This change was implemented based primarily due to problems + encountered attempting to integrate support for native coroutines + into the Tornado web server (reported in [18]_). + +2. In CPython 3.5.2, the ``__aiter__`` protocol was updated. + + Before 3.5.2, ``__aiter__`` was expected to return an *awaitable* + resolving to an *asynchronous iterator*. Starting with 3.5.2, + ``__aiter__`` should return asynchronous iterators directly. + + If the old protocol is used in 3.5.2, Python will raise a + ``PendingDeprecationWarning``. + + In CPython 3.6, the old ``__aiter__`` protocol will still be + supported with a ``DeprecationWarning`` being raised. + + In CPython 3.7, the old ``__aiter__`` protocol will no longer be + supported: a ``RuntimeError`` will be raised if ``__aiter__`` + returns anything but an asynchronous iterator. + + See [19]_ for more details. Rationale and Goals @@ -209,11 +227,6 @@ Objects with ``__await__`` method are called *Future-like* objects in the rest of this PEP. - Also, please note that ``__aiter__`` method (see its definition - below) cannot be used for this purpose. It is a different protocol, - and would be like using ``__iter__`` instead of ``__call__`` for - regular callables. - It is a ``TypeError`` if ``__await__`` returns anything but an iterator. @@ -428,7 +441,7 @@ 1. An object must implement an ``__aiter__`` method (or, if defined with CPython C API, ``tp_as_async.am_aiter`` slot) returning an - *awaitable* resulting in an *asynchronous iterator object*. + *asynchronous iterator object*. 2. An *asynchronous iterator object* must implement an ``__anext__`` method (or, if defined with CPython C API, ``tp_as_async.am_anext`` @@ -440,7 +453,7 @@ An example of asynchronous iterable:: class AsyncIterable: - async def __aiter__(self): + def __aiter__(self): return self async def __anext__(self): @@ -468,7 +481,7 @@ which is semantically equivalent to:: iter = (ITER) - iter = await type(iter).__aiter__(iter) + iter = type(iter).__aiter__(iter) running = True while running: try: @@ -510,7 +523,7 @@ async def _prefetch(self): ... - async def __aiter__(self): + def __aiter__(self): return self async def __anext__(self): @@ -527,7 +540,7 @@ which would be equivalent to the following code:: - i = await Cursor().__aiter__() + i = Cursor().__aiter__() while True: try: row = await i.__anext__() @@ -551,7 +564,7 @@ def __init__(self, obj): self._it = iter(obj) - async def __aiter__(self): + def __aiter__(self): return self async def __anext__(self): @@ -814,37 +827,6 @@ `Asynchronous Iterators and "async for"`_ for details. -List of functions and methods -============================= - -================= =================================== ================= -Method Can contain Can't contain -================= =================================== ================= -async def func await, return value yield, yield from -async def __a*__ await, return value yield, yield from -def __a*__ return awaitable await -def __await__ yield, yield from, return iterable await -generator yield, yield from, return value await -================= =================================== ================= - -Where: - -* "async def func": native coroutine; - -* "async def __a*__": ``__aiter__``, ``__anext__``, ``__aenter__``, - ``__aexit__`` defined with the ``async`` keyword; - -* "def __a*__": ``__aiter__``, ``__anext__``, ``__aenter__``, - ``__aexit__`` defined without the ``async`` keyword, must return an - *awaitable*; - -* "def __await__": ``__await__`` method to implement *Future-like* - objects; - -* generator: a "regular" generator, function defined with ``def`` and - which contains a least one ``yield`` or ``yield from`` expression. - - Transition Plan =============== @@ -1080,19 +1062,20 @@ project easier (Python with ECMAScript 7 for instance). -Why "__aiter__" returns awaitable ---------------------------------- +Why "__aiter__" does not return an awaitable +-------------------------------------------- -In principle, ``__aiter__`` could be a regular function. There are -several good reasons to make it a coroutine: +PEP 492 was accepted in CPython 3.5.0 with ``__aiter__`` defined as +a method, that was expected to return an awaitable resolving to an +asynchronous iterator. -* as most of the ``__anext__``, ``__aenter__``, and ``__aexit__`` - methods are coroutines, users would often make a mistake defining it - as ``async`` anyways; +In 3.5.2 (as PEP 492 was accepted on a provisional basis) the +``__aiter__`` protocol was updated to return asynchronous iterators +directly. -* there might be a need to run some asynchronous operations in - ``__aiter__``, for instance to prepare DB queries or do some file - operation. +The motivation behind this change is to make it possible to +implement asynchronous generators in Python. See [19]_ for +more details. Importance of "async" keyword @@ -1171,8 +1154,8 @@ New asynchronous magic methods ``__aiter__``, ``__anext__``, ``__aenter__``, and ``__aexit__`` all start with the same prefix "a". -An alternative proposal is to use "async" prefix, so that ``__aiter__`` -becomes ``__async_iter__``. However, to align new magic methods with +An alternative proposal is to use "async" prefix, so that ``__anext__`` +becomes ``__async_next__``. However, to align new magic methods with the existing ones, such as ``__radd__`` and ``__iadd__`` it was decided to use a shorter version. @@ -1454,6 +1437,8 @@ .. [18] http://bugs.python.org/issue24400 +.. [19] http://bugs.python.org/issue27243 + Acknowledgments =============== -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Thu Jun 9 18:05:19 2016 From: python-checkins at python.org (yury.selivanov) Date: Thu, 09 Jun 2016 22:05:19 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_PEP_492=3A_Add_a_link_to_Pyth?= =?utf-8?q?on_docs_about_=5F=5Faiter=5F=5F?= Message-ID: <20160609220515.9983.66847.B21AE8FB@psf.io> https://hg.python.org/peps/rev/e40c40fe09d5 changeset: 6364:e40c40fe09d5 user: Yury Selivanov date: Thu Jun 09 18:05:13 2016 -0400 summary: PEP 492: Add a link to Python docs about __aiter__ files: pep-0492.txt | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pep-0492.txt b/pep-0492.txt --- a/pep-0492.txt +++ b/pep-0492.txt @@ -69,7 +69,7 @@ supported: a ``RuntimeError`` will be raised if ``__aiter__`` returns anything but an asynchronous iterator. - See [19]_ for more details. + See [19]_ and [20]_ for more details. Rationale and Goals @@ -1074,7 +1074,7 @@ directly. The motivation behind this change is to make it possible to -implement asynchronous generators in Python. See [19]_ for +implement asynchronous generators in Python. See [19]_ and [20]_ for more details. @@ -1439,6 +1439,8 @@ .. [19] http://bugs.python.org/issue27243 +.. [20] https://docs.python.org/3/reference/datamodel.html#async-iterators + Acknowledgments =============== -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Thu Jun 9 18:55:58 2016 From: python-checkins at python.org (brett.cannon) Date: Thu, 09 Jun 2016 22:55:58 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Add_a_missing_=3Aterm=3A?= =?utf-8?q?=2E?= Message-ID: <20160609225557.101804.46553.D9A05985@psf.io> https://hg.python.org/cpython/rev/681da4ad2138 changeset: 101828:681da4ad2138 user: Brett Cannon date: Thu Jun 09 15:55:52 2016 -0700 summary: Add a missing :term:. files: Doc/library/contextlib.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/contextlib.rst b/Doc/library/contextlib.rst --- a/Doc/library/contextlib.rst +++ b/Doc/library/contextlib.rst @@ -20,7 +20,7 @@ .. class:: AbstractContextManager - An abstract base class for classes that implement + An :term:`abstract base class` for classes that implement :meth:`object.__enter__` and :meth:`object.__exit__`. A default implementation for :meth:`object.__enter__` is provided which returns ``self`` while :meth:`object.__exit__` is an abstract method which by default -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 18:58:12 2016 From: python-checkins at python.org (brett.cannon) Date: Thu, 09 Jun 2016 22:58:12 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327182=3A_Document?= =?utf-8?q?_os=2EPathLike=2E?= Message-ID: <20160609225811.101682.73549.46C9CA83@psf.io> https://hg.python.org/cpython/rev/6239673d5e1d changeset: 101829:6239673d5e1d user: Brett Cannon date: Thu Jun 09 15:58:06 2016 -0700 summary: Issue #27182: Document os.PathLike. Part of PEP 519. files: Doc/library/functions.rst | 3 +++ Doc/library/os.rst | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 0 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -1077,6 +1077,9 @@ .. versionchanged:: 3.5 The ``'namereplace'`` error handler was added. + .. versionchanged:: 3.6 + Support added to accept objects implementing :class:`os.PathLike`. + .. function:: ord(c) Given a string representing one Unicode character, return an integer diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -175,6 +175,9 @@ .. versionadded:: 3.2 + .. versionchanged:: 3.6 + Support added to accept objects implementing :class:`os.PathLike`. + .. function:: fsdecode(filename) @@ -185,6 +188,9 @@ .. versionadded:: 3.2 + .. versionchanged:: 3.6 + Support added to accept objects implementing :class:`os.PathLike`. + .. function:: fspath(path) @@ -195,6 +201,21 @@ (which is represented by :class:`os.PathLike`). All other types raise a :exc:`TypeError`. + .. versionadded:: 3.6 + + +.. class:: PathLike + + An :term:`abstract base class` for objects representing a file system path, + e.g. :class:`pathlib.PurePath`. + + .. abstractmethod:: __fspath__() + + Return the file system path representation of the object. + + The method should only return a :class:`str` or :class:`bytes` object, + with the preference being for :class:`str`. + .. function:: getenv(key, default=None) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 19:53:48 2016 From: python-checkins at python.org (martin.panter) Date: Thu, 09 Jun 2016 23:53:48 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogW0lzc3VlIDE1NDc2?= =?utf-8?q?=5D_Make_=22code_object=22_its_own_entry_in_the_index?= Message-ID: <20160609235348.81060.38755.A47B31C4@psf.io> https://hg.python.org/cpython/rev/f89e96235a42 changeset: 101832:f89e96235a42 branch: 2.7 parent: 101818:b72ff4d59f62 user: Tommy Beadle date: Thu Jun 02 19:26:51 2016 -0400 summary: [Issue 15476] Make "code object" its own entry in the index files: Doc/c-api/code.rst | 6 ++---- Doc/library/marshal.rst | 3 ++- Doc/library/stdtypes.rst | 4 ++-- Doc/reference/datamodel.rst | 6 ++---- 4 files changed, 8 insertions(+), 11 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 @@ -2,15 +2,13 @@ .. _codeobjects: +.. index:: object; code, code object + Code Objects ------------ .. sectionauthor:: Jeffrey Yasskin - -.. index:: - object: code - Code objects are a low-level detail of the CPython implementation. Each one represents a chunk of executable code that hasn't yet been bound into a function. diff --git a/Doc/library/marshal.rst b/Doc/library/marshal.rst --- a/Doc/library/marshal.rst +++ b/Doc/library/marshal.rst @@ -17,7 +17,6 @@ .. index:: module: pickle module: shelve - object: code This is not a general "persistence" module. For general persistence and transfer of Python objects through RPC calls, see the modules :mod:`pickle` and @@ -35,6 +34,8 @@ maliciously constructed data. Never unmarshal data received from an untrusted or unauthenticated source. +.. index:: object; code, code object + Not all Python object types are supported; in general, only objects whose value is independent from a particular invocation of Python can be written and read by this module. The following types are supported: booleans, integers, long diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2953,13 +2953,13 @@ See :ref:`types` for more information. +.. index:: object; code, code object + .. _bltin-code-objects: Code Objects ------------ -.. index:: object: code - .. index:: builtin: compile single: func_code (function object attribute) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -909,11 +909,9 @@ definitions may change with future versions of the interpreter, but they are mentioned here for completeness. + .. index:: bytecode, object; code, code object + Code objects - .. index:: - single: bytecode - object: code - Code objects represent *byte-compiled* executable Python code, or :term:`bytecode`. The difference between a code object and a function object is that the function object contains an explicit reference to the function's globals (the module in -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 19:53:48 2016 From: python-checkins at python.org (martin.panter) Date: Thu, 09 Jun 2016 23:53:48 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2315476=3A_Merge_index_entries_from_3=2E5?= Message-ID: <20160609235347.26129.1075.27E32D5D@psf.io> https://hg.python.org/cpython/rev/8455bbc6b4f2 changeset: 101831:8455bbc6b4f2 parent: 101829:6239673d5e1d parent: 101830:2e9aace7e10a user: Martin Panter date: Thu Jun 09 23:36:40 2016 +0000 summary: Issue #15476: Merge index entries from 3.5 files: Doc/c-api/code.rst | 6 ++---- Doc/library/marshal.rst | 3 ++- Doc/library/stdtypes.rst | 4 ++-- Doc/reference/datamodel.rst | 6 ++---- 4 files changed, 8 insertions(+), 11 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 @@ -2,15 +2,13 @@ .. _codeobjects: +.. index:: object; code, code object + Code Objects ------------ .. sectionauthor:: Jeffrey Yasskin - -.. index:: - object: code - Code objects are a low-level detail of the CPython implementation. Each one represents a chunk of executable code that hasn't yet been bound into a function. diff --git a/Doc/library/marshal.rst b/Doc/library/marshal.rst --- a/Doc/library/marshal.rst +++ b/Doc/library/marshal.rst @@ -16,7 +16,6 @@ .. index:: module: pickle module: shelve - object: code This is not a general "persistence" module. For general persistence and transfer of Python objects through RPC calls, see the modules :mod:`pickle` and @@ -34,6 +33,8 @@ maliciously constructed data. Never unmarshal data received from an untrusted or unauthenticated source. +.. index:: object; code, code object + Not all Python object types are supported; in general, only objects whose value is independent from a particular invocation of Python can be written and read by this module. The following types are supported: booleans, integers, floating diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -4437,13 +4437,13 @@ See :ref:`types` for more information. +.. index:: object; code, code object + .. _bltin-code-objects: Code Objects ------------ -.. index:: object: code - .. index:: builtin: compile single: __code__ (function object attribute) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -846,11 +846,9 @@ definitions may change with future versions of the interpreter, but they are mentioned here for completeness. + .. index:: bytecode, object; code, code object + Code objects - .. index:: - single: bytecode - object: code - Code objects represent *byte-compiled* executable Python code, or :term:`bytecode`. The difference between a code object and a function object is that the function object contains an explicit reference to the function's globals (the module in -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 19:53:48 2016 From: python-checkins at python.org (martin.panter) Date: Thu, 09 Jun 2016 23:53:48 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogW0lzc3VlIDE1NDc2?= =?utf-8?q?=5D_Make_=22code_object=22_its_own_entry_in_the_index?= Message-ID: <20160609235347.28057.66835.3FB70166@psf.io> https://hg.python.org/cpython/rev/2e9aace7e10a changeset: 101830:2e9aace7e10a branch: 3.5 parent: 101823:93ad47d63b87 user: Tommy Beadle date: Thu Jun 02 19:26:51 2016 -0400 summary: [Issue 15476] Make "code object" its own entry in the index files: Doc/c-api/code.rst | 6 ++---- Doc/library/marshal.rst | 3 ++- Doc/library/stdtypes.rst | 4 ++-- Doc/reference/datamodel.rst | 6 ++---- 4 files changed, 8 insertions(+), 11 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 @@ -2,15 +2,13 @@ .. _codeobjects: +.. index:: object; code, code object + Code Objects ------------ .. sectionauthor:: Jeffrey Yasskin - -.. index:: - object: code - Code objects are a low-level detail of the CPython implementation. Each one represents a chunk of executable code that hasn't yet been bound into a function. diff --git a/Doc/library/marshal.rst b/Doc/library/marshal.rst --- a/Doc/library/marshal.rst +++ b/Doc/library/marshal.rst @@ -16,7 +16,6 @@ .. index:: module: pickle module: shelve - object: code This is not a general "persistence" module. For general persistence and transfer of Python objects through RPC calls, see the modules :mod:`pickle` and @@ -34,6 +33,8 @@ maliciously constructed data. Never unmarshal data received from an untrusted or unauthenticated source. +.. index:: object; code, code object + Not all Python object types are supported; in general, only objects whose value is independent from a particular invocation of Python can be written and read by this module. The following types are supported: booleans, integers, floating diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -4436,13 +4436,13 @@ See :ref:`types` for more information. +.. index:: object; code, code object + .. _bltin-code-objects: Code Objects ------------ -.. index:: object: code - .. index:: builtin: compile single: __code__ (function object attribute) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -846,11 +846,9 @@ definitions may change with future versions of the interpreter, but they are mentioned here for completeness. + .. index:: bytecode, object; code, code object + Code objects - .. index:: - single: bytecode - object: code - Code objects represent *byte-compiled* executable Python code, or :term:`bytecode`. The difference between a code object and a function object is that the function object contains an explicit reference to the function's globals (the module in -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 19:59:19 2016 From: python-checkins at python.org (brett.cannon) Date: Thu, 09 Jun 2016 23:59:19 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327186=3A_Document?= =?utf-8?b?IFB5T1NfRlNQYXRoKCku?= Message-ID: <20160609235919.87700.4403.F4DB965D@psf.io> https://hg.python.org/cpython/rev/cec1f00c538d changeset: 101833:cec1f00c538d parent: 101829:6239673d5e1d user: Brett Cannon date: Thu Jun 09 16:58:38 2016 -0700 summary: Issue #27186: Document PyOS_FSPath(). files: Doc/c-api/sys.rst | 10 ++++++++++ Doc/data/refcounts.dat | 3 +++ 2 files changed, 13 insertions(+), 0 deletions(-) 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 @@ -5,6 +5,16 @@ Operating System Utilities ========================== +.. c:function:: PyObject* PyOS_FSPath(PyObject *path) + + Return the file system representation for *path*. If the object is a + :class:`str` or :class:`bytes` object, then its reference count is + incremented. If the object implements the :class:`os.PathLike` interface, + then ``type(path).__fspath__()`` is returned. Otherwise :exc:`TypeError` is + raised and ``NULL`` is returned. + + .. versionadded:: 3.6 + .. c:function:: int Py_FdIsInteractive(FILE *fp, const char *filename) diff --git a/Doc/data/refcounts.dat b/Doc/data/refcounts.dat --- a/Doc/data/refcounts.dat +++ b/Doc/data/refcounts.dat @@ -921,6 +921,9 @@ PyObject_AsFileDescriptor:int::: PyObject_AsFileDescriptor:PyObject*:o:0: +PyOS_FSPath:PyObject*::+1: +PyOS_FSPath:PyObject*:path:0: + PyObject_Call:PyObject*::+1: PyObject_Call:PyObject*:callable_object:0: PyObject_Call:PyObject*:args:0: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 19:59:20 2016 From: python-checkins at python.org (brett.cannon) Date: Thu, 09 Jun 2016 23:59:20 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?q?=29=3A_Merge?= Message-ID: <20160609235919.27813.22691.4D95068A@psf.io> https://hg.python.org/cpython/rev/808b2e681700 changeset: 101834:808b2e681700 parent: 101833:cec1f00c538d parent: 101831:8455bbc6b4f2 user: Brett Cannon date: Thu Jun 09 16:59:13 2016 -0700 summary: Merge files: Doc/c-api/code.rst | 6 ++---- Doc/library/marshal.rst | 3 ++- Doc/library/stdtypes.rst | 4 ++-- Doc/reference/datamodel.rst | 6 ++---- 4 files changed, 8 insertions(+), 11 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 @@ -2,15 +2,13 @@ .. _codeobjects: +.. index:: object; code, code object + Code Objects ------------ .. sectionauthor:: Jeffrey Yasskin - -.. index:: - object: code - Code objects are a low-level detail of the CPython implementation. Each one represents a chunk of executable code that hasn't yet been bound into a function. diff --git a/Doc/library/marshal.rst b/Doc/library/marshal.rst --- a/Doc/library/marshal.rst +++ b/Doc/library/marshal.rst @@ -16,7 +16,6 @@ .. index:: module: pickle module: shelve - object: code This is not a general "persistence" module. For general persistence and transfer of Python objects through RPC calls, see the modules :mod:`pickle` and @@ -34,6 +33,8 @@ maliciously constructed data. Never unmarshal data received from an untrusted or unauthenticated source. +.. index:: object; code, code object + Not all Python object types are supported; in general, only objects whose value is independent from a particular invocation of Python can be written and read by this module. The following types are supported: booleans, integers, floating diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -4437,13 +4437,13 @@ See :ref:`types` for more information. +.. index:: object; code, code object + .. _bltin-code-objects: Code Objects ------------ -.. index:: object: code - .. index:: builtin: compile single: __code__ (function object attribute) diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -846,11 +846,9 @@ definitions may change with future versions of the interpreter, but they are mentioned here for completeness. + .. index:: bytecode, object; code, code object + Code objects - .. index:: - single: bytecode - object: code - Code objects represent *byte-compiled* executable Python code, or :term:`bytecode`. The difference between a code object and a function object is that the function object contains an explicit reference to the function's globals (the module in -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 20:00:37 2016 From: python-checkins at python.org (brett.cannon) Date: Fri, 10 Jun 2016 00:00:37 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Update_PEP_519_on_current_pro?= =?utf-8?q?gress?= Message-ID: <20160610000033.114664.15894.BE4F2415@psf.io> https://hg.python.org/peps/rev/073fba82e848 changeset: 6365:073fba82e848 user: Brett Cannon date: Thu Jun 09 17:00:28 2016 -0700 summary: Update PEP 519 on current progress files: pep-0519.txt | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pep-0519.txt b/pep-0519.txt --- a/pep-0519.txt +++ b/pep-0519.txt @@ -324,9 +324,11 @@ (`done `__) #. Remove the provisional status of pathlib #. Add ``os.PathLike`` - (`code done `__; needs docs) + (`code `__ and + `docs `__ done) #. Add ``PyOS_FSPath()`` - (`code done `__; needs docs) + (`code `__ and + `docs `__ done) #. Add ``os.fspath()`` (`done `__) #. Update ``os.fsencode()`` -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Thu Jun 9 20:46:21 2016 From: python-checkins at python.org (martin.panter) Date: Fri, 10 Jun 2016 00:46:21 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzg0OTE6?= =?utf-8?q?_Add_link_to_Gnu_Readline_configuration_documentation?= Message-ID: <20160610004620.114579.74210.7B4B0BC7@psf.io> https://hg.python.org/cpython/rev/e981a4273cf6 changeset: 101835:e981a4273cf6 branch: 2.7 parent: 101832:f89e96235a42 user: Martin Panter date: Fri Jun 10 00:27:46 2016 +0000 summary: Issue #8491: Add link to Gnu Readline configuration documentation files: Doc/library/readline.rst | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/Doc/library/readline.rst b/Doc/library/readline.rst --- a/Doc/library/readline.rst +++ b/Doc/library/readline.rst @@ -27,6 +27,13 @@ you can check for the text "libedit" in :const:`readline.__doc__` to differentiate between GNU readline and libedit. +Readline keybindings may be configured via an initialization file, typically +``.inputrc`` in your home directory. See `Readline Init File +`_ +in the GNU Readline manual for information about the format and +allowable constructs of that file, and the capabilities of the +Readline library in general. + Init file --------- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 20:46:21 2016 From: python-checkins at python.org (martin.panter) Date: Fri, 10 Jun 2016 00:46:21 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzg0OTE6?= =?utf-8?q?_Add_link_to_Gnu_Readline_configuration_documentation?= Message-ID: <20160610004621.28042.9827.3F9B74EF@psf.io> https://hg.python.org/cpython/rev/5bbb021450d7 changeset: 101836:5bbb021450d7 branch: 3.5 parent: 101830:2e9aace7e10a user: Martin Panter date: Fri Jun 10 00:27:46 2016 +0000 summary: Issue #8491: Add link to Gnu Readline configuration documentation files: Doc/library/readline.rst | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/Doc/library/readline.rst b/Doc/library/readline.rst --- a/Doc/library/readline.rst +++ b/Doc/library/readline.rst @@ -27,6 +27,13 @@ you can check for the text "libedit" in :const:`readline.__doc__` to differentiate between GNU readline and libedit. +Readline keybindings may be configured via an initialization file, typically +``.inputrc`` in your home directory. See `Readline Init File +`_ +in the GNU Readline manual for information about the format and +allowable constructs of that file, and the capabilities of the +Readline library in general. + Init file --------- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 20:46:21 2016 From: python-checkins at python.org (martin.panter) Date: Fri, 10 Jun 2016 00:46:21 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=238491=3A_Merge_readline_doc_from_3=2E5?= Message-ID: <20160610004621.28193.76.165E34B5@psf.io> https://hg.python.org/cpython/rev/5b904920c2d1 changeset: 101837:5b904920c2d1 parent: 101834:808b2e681700 parent: 101836:5bbb021450d7 user: Martin Panter date: Fri Jun 10 00:39:28 2016 +0000 summary: Issue #8491: Merge readline doc from 3.5 files: Doc/library/readline.rst | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/Doc/library/readline.rst b/Doc/library/readline.rst --- a/Doc/library/readline.rst +++ b/Doc/library/readline.rst @@ -27,6 +27,13 @@ you can check for the text "libedit" in :const:`readline.__doc__` to differentiate between GNU readline and libedit. +Readline keybindings may be configured via an initialization file, typically +``.inputrc`` in your home directory. See `Readline Init File +`_ +in the GNU Readline manual for information about the format and +allowable constructs of that file, and the capabilities of the +Readline library in general. + Init file --------- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 21:04:21 2016 From: python-checkins at python.org (terry.reedy) Date: Fri, 10 Jun 2016 01:04:21 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2324759=3A_Add_test?= =?utf-8?q?_for_IDLE_syntax_colorizoer=2E?= Message-ID: <20160610010421.26206.30873.E04FE396@psf.io> https://hg.python.org/cpython/rev/81927f86fa3a changeset: 101838:81927f86fa3a user: Terry Jan Reedy date: Thu Jun 09 21:04:09 2016 -0400 summary: Issue #24759: Add test for IDLE syntax colorizoer. files: Lib/idlelib/idle_test/test_colorizer.py | 56 +++++++++++++ 1 files changed, 56 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/idle_test/test_colorizer.py b/Lib/idlelib/idle_test/test_colorizer.py new file mode 100644 --- /dev/null +++ b/Lib/idlelib/idle_test/test_colorizer.py @@ -0,0 +1,56 @@ +'''Test idlelib/colorizer.py + +Perform minimal sanity checks that module imports and some things run. + +Coverage 22%. +''' +from idlelib import colorizer # always test import +from test.support import requires +from tkinter import Tk, Text +import unittest + + +class FunctionTest(unittest.TestCase): + + def test_any(self): + self.assertTrue(colorizer.any('test', ('a', 'b'))) + + def test_make_pat(self): + self.assertTrue(colorizer.make_pat()) + + +class ColorConfigTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.text = Text(cls.root) + + @classmethod + def tearDownClass(cls): + del cls.text + cls.root.destroy() + del cls.root + + def test_colorizer(self): + colorizer.color_config(self.text) + +class ColorDelegatorTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + + @classmethod + def tearDownClass(cls): + cls.root.destroy() + del cls.root + + def test_colorizer(self): + colorizer.ColorDelegator() + + +if __name__ == '__main__': + unittest.main(verbosity=2) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 21:09:27 2016 From: python-checkins at python.org (terry.reedy) Date: Fri, 10 Jun 2016 01:09:27 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2324759=3A_IDLE_req?= =?utf-8?q?uires_tk_8=2E5_and_availability_ttk_widgets=2E?= Message-ID: <20160610010927.19990.10920.D67823FE@psf.io> https://hg.python.org/cpython/rev/76f831e4b806 changeset: 101839:76f831e4b806 user: Terry Jan Reedy date: Thu Jun 09 21:09:15 2016 -0400 summary: Issue #24759: IDLE requires tk 8.5 and availability ttk widgets. Delete now unneeded tk version tests and code for older versions. files: Lib/idlelib/__init__.py | 1 + Lib/idlelib/colorizer.py | 11 +++---- Lib/idlelib/config.py | 20 ++++++--------- Lib/idlelib/editor.py | 11 +++----- Lib/idlelib/idle_test/__init__.py | 2 + Lib/idlelib/macosx.py | 6 ---- Lib/idlelib/pyshell.py | 25 ++++++++++++------ Lib/test/test_idle.py | 2 + 8 files changed, 38 insertions(+), 40 deletions(-) diff --git a/Lib/idlelib/__init__.py b/Lib/idlelib/__init__.py --- a/Lib/idlelib/__init__.py +++ b/Lib/idlelib/__init__.py @@ -1,6 +1,7 @@ """The idlelib package implements the Idle application. Idle includes an interactive shell and editor. +Starting with Python 3.6, IDLE requires tcl/tk 8.5 or later. Use the files named idle.* to start Idle. The other files are private implementations. Their details are subject to diff --git a/Lib/idlelib/colorizer.py b/Lib/idlelib/colorizer.py --- a/Lib/idlelib/colorizer.py +++ b/Lib/idlelib/colorizer.py @@ -2,7 +2,6 @@ import re import keyword import builtins -from tkinter import TkVersion from idlelib.delegator import Delegator from idlelib.config import idleConf @@ -49,11 +48,8 @@ insertbackground=cursor_color, selectforeground=select_colors['foreground'], selectbackground=select_colors['background'], - ) - if TkVersion >= 8.5: - text.config( - inactiveselectbackground=select_colors['background']) - + inactiveselectbackground=select_colors['background'], # new in 8.5 + ) class ColorDelegator(Delegator): @@ -277,5 +273,8 @@ p.insertfilter(d) if __name__ == "__main__": + import unittest + unittest.main('idlelib.idle_test.test_colorizer', + verbosity=2, exit=False) from idlelib.idle_test.htest import run run(_color_delegator) diff --git a/Lib/idlelib/config.py b/Lib/idlelib/config.py --- a/Lib/idlelib/config.py +++ b/Lib/idlelib/config.py @@ -22,7 +22,6 @@ import sys from configparser import ConfigParser -from tkinter import TkVersion from tkinter.font import Font, nametofont class InvalidConfigType(Exception): pass @@ -713,16 +712,13 @@ bold = self.GetOption(configType, section, 'font-bold', default=0, type='bool') if (family == 'TkFixedFont'): - if TkVersion < 8.5: - family = 'Courier' - else: - f = Font(name='TkFixedFont', exists=True, root=root) - actualFont = Font.actual(f) - family = actualFont['family'] - size = actualFont['size'] - if size <= 0: - size = 10 # if font in pixels, ignore actual size - bold = actualFont['weight']=='bold' + f = Font(name='TkFixedFont', exists=True, root=root) + actualFont = Font.actual(f) + family = actualFont['family'] + size = actualFont['size'] + if size <= 0: + size = 10 # if font in pixels, ignore actual size + bold = actualFont['weight'] == 'bold' return (family, size, 'bold' if bold else 'normal') def LoadCfgFiles(self): @@ -740,7 +736,7 @@ idleConf = IdleConf() # TODO Revise test output, write expanded unittest -### module test +# if __name__ == '__main__': def dumpCfg(cfg): print('\n', cfg, '\n') diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py --- a/Lib/idlelib/editor.py +++ b/Lib/idlelib/editor.py @@ -110,13 +110,10 @@ 'wrap': 'none', 'highlightthickness': 0, 'width': self.width, - 'height': idleConf.GetOption('main', 'EditorWindow', - 'height', type='int')} - if TkVersion >= 8.5: - # Starting with tk 8.5 we have to set the new tabstyle option - # to 'wordprocessor' to achieve the same display of tabs as in - # older tk versions. - text_options['tabstyle'] = 'wordprocessor' + 'tabstyle': 'wordprocessor', # new in 8.5 + 'height': idleConf.GetOption( + 'main', 'EditorWindow', 'height', type='int'), + } self.text = text = MultiCallCreator(Text)(text_frame, **text_options) self.top.focused_widget = self.text diff --git a/Lib/idlelib/idle_test/__init__.py b/Lib/idlelib/idle_test/__init__.py --- a/Lib/idlelib/idle_test/__init__.py +++ b/Lib/idlelib/idle_test/__init__.py @@ -1,6 +1,8 @@ '''idlelib.idle_test is a private implementation of test.test_idle, which tests the IDLE application as part of the stdlib test suite. Run IDLE tests alone with "python -m test.test_idle". +Starting with Python 3.6, IDLE requires tcl/tk 8.5 or later. + This package and its contained modules are subject to change and any direct use is at your own risk. ''' diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py --- a/Lib/idlelib/macosx.py +++ b/Lib/idlelib/macosx.py @@ -199,12 +199,6 @@ ('About IDLE', '<>'), None, ])) - tkversion = root.tk.eval('info patchlevel') - if tuple(map(int, tkversion.split('.'))) < (8, 4, 14): - # for earlier AquaTk versions, supply a Preferences menu item - mainmenu.menudefs[0][1].append( - ('_Preferences....', '<>'), - ) if isCocoaTk(): # replace default About dialog with About IDLE one root.createcommand('tkAboutDialog', about_dialog) diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py --- a/Lib/idlelib/pyshell.py +++ b/Lib/idlelib/pyshell.py @@ -1,5 +1,20 @@ #! /usr/bin/env python3 +try: + from tkinter import * +except ImportError: + print("** IDLE can't import Tkinter.\n" + "Your Python may not be configured for Tk. **", file=sys.__stderr__) + sys.exit(1) +import tkinter.messagebox as tkMessageBox +if TkVersion < 8.5: + root = Tk() # otherwise create root in main + root.withdraw() + tkMessageBox.showerror("Idle Cannot Start", + "Idle requires tcl/tk 8.5+, not $s." % TkVersion, + parent=root) + sys.exit(1) + import getopt import os import os.path @@ -16,14 +31,6 @@ from code import InteractiveInterpreter from platform import python_version, system -try: - from tkinter import * -except ImportError: - print("** IDLE can't import Tkinter.\n" - "Your Python may not be configured for Tk. **", file=sys.__stderr__) - sys.exit(1) -import tkinter.messagebox as tkMessageBox - from idlelib.editor import EditorWindow, fixwordbreaks from idlelib.filelist import FileList from idlelib.colorizer import ColorDelegator @@ -1536,7 +1543,7 @@ if system() == 'Windows': iconfile = os.path.join(icondir, 'idle.ico') root.wm_iconbitmap(default=iconfile) - elif TkVersion >= 8.5: + else: ext = '.png' if TkVersion >= 8.6 else '.gif' iconfiles = [os.path.join(icondir, 'idle_%d%s' % (size, ext)) for size in (16, 32, 48)] diff --git a/Lib/test/test_idle.py b/Lib/test/test_idle.py --- a/Lib/test/test_idle.py +++ b/Lib/test/test_idle.py @@ -4,6 +4,8 @@ # Skip test if _thread or _tkinter wasn't built or idlelib was deleted. import_module('threading') # imported by PyShell, imports _thread tk = import_module('tkinter') # imports _tkinter +if tk.TkVersion < 8.5: + raise unittest.SkipTest("IDLE requires tk 8.5 or later.") idletest = import_module('idlelib.idle_test') # Without test_main present, regrtest.runtest_inner (line1219) calls -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 9 23:52:15 2016 From: python-checkins at python.org (martin.panter) Date: Fri, 10 Jun 2016 03:52:15 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzczNTY6?= =?utf-8?q?_ctypes=2Eutil=3A_Make_parsing_of_ldconfig_output_locale_indepe?= =?utf-8?q?ndent=2E?= Message-ID: <20160610035215.101651.75738.1E13F893@psf.io> https://hg.python.org/cpython/rev/b4839797f482 changeset: 101840:b4839797f482 branch: 2.7 parent: 101835:e981a4273cf6 user: Matthias Klose date: Mon Mar 15 13:46:04 2010 +0000 summary: Issue #7356: ctypes.util: Make parsing of ldconfig output locale independent. Previous fix was only made to dead and removed code. files: Lib/ctypes/util.py | 2 +- Misc/NEWS | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py --- a/Lib/ctypes/util.py +++ b/Lib/ctypes/util.py @@ -223,7 +223,7 @@ # XXX assuming GLIBC's ldconfig (with option -p) expr = r'\s+(lib%s\.[^\s]+)\s+\(%s' % (re.escape(name), abi_type) - f = os.popen('/sbin/ldconfig -p 2>/dev/null') + f = os.popen('LC_ALL=C LANG=C /sbin/ldconfig -p 2>/dev/null') try: data = f.read() finally: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -92,6 +92,9 @@ Library ------- +- Issue #7356: ctypes.util: Make parsing of ldconfig output independent of the + locale. + - Issue #25738: Stop BaseHTTPServer.BaseHTTPRequestHandler.send_error() from sending a message body for 205 Reset Content. Also, don't send the Content-Type header field in responses that don't have a body. Based on @@ -6232,9 +6235,6 @@ - Issue #8140: Extend compileall to compile single files. Add -i option. -- Issue #7356: ctypes.util: Make parsing of ldconfig output independent of the - locale. - - Issue #7774: Set sys.executable to an empty string if ``argv[0]`` has been set to an non existent program name and Python is unable to retrieve the real program name. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 10 01:43:52 2016 From: python-checkins at python.org (berker.peksag) Date: Fri, 10 Jun 2016 05:43:52 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Add_a_versionadded_directi?= =?utf-8?q?ve_to_os=2EPathLike?= Message-ID: <20160610054351.99348.42079.116CBE2E@psf.io> https://hg.python.org/cpython/rev/15738f76fe6f changeset: 101841:15738f76fe6f parent: 101839:76f831e4b806 user: Berker Peksag date: Fri Jun 10 08:43:54 2016 +0300 summary: Add a versionadded directive to os.PathLike files: Doc/library/os.rst | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -209,6 +209,8 @@ An :term:`abstract base class` for objects representing a file system path, e.g. :class:`pathlib.PurePath`. + .. versionadded:: 3.6 + .. abstractmethod:: __fspath__() Return the file system path representation of the object. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 10 04:49:20 2016 From: python-checkins at python.org (martin.panter) Date: Fri, 10 Jun 2016 08:49:20 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Fix_typo_and_m?= =?utf-8?q?ove_comment_to_appropriate_condition?= Message-ID: <20160610084919.99116.59889.3101013D@psf.io> https://hg.python.org/cpython/rev/0329218b0f83 changeset: 101845:0329218b0f83 branch: 3.5 parent: 101836:5bbb021450d7 user: Martin Panter date: Fri Jun 10 08:07:11 2016 +0000 summary: Fix typo and move comment to appropriate condition files: Python/random.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/random.c b/Python/random.c --- a/Python/random.c +++ b/Python/random.c @@ -75,6 +75,8 @@ return 0; } +/* Issue #25003: Don't use getentropy() on Solaris (available since + * Solaris 11.3), it is blocking whereas os.urandom() should not block. */ #elif defined(HAVE_GETENTROPY) && !defined(sun) #define PY_GETENTROPY 1 @@ -114,8 +116,6 @@ #else -/* Issue #25003: Don' use getentropy() on Solaris (available since - * Solaris 11.3), it is blocking whereas os.urandom() should not block. */ #if defined(HAVE_GETRANDOM) || defined(HAVE_GETRANDOM_SYSCALL) #define PY_GETRANDOM 1 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 10 04:49:20 2016 From: python-checkins at python.org (martin.panter) Date: Fri, 10 Jun 2016 08:49:20 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Fix_typo_in_co?= =?utf-8?q?mment?= Message-ID: <20160610084918.99323.63629.D5F57816@psf.io> https://hg.python.org/cpython/rev/e13a445718ec changeset: 101843:e13a445718ec branch: 2.7 user: Martin Panter date: Fri Jun 10 08:07:11 2016 +0000 summary: Fix typo in comment files: Python/random.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Python/random.c b/Python/random.c --- a/Python/random.c +++ b/Python/random.c @@ -93,7 +93,7 @@ return 0; } -/* Issue #25003: Don' use getentropy() on Solaris (available since +/* Issue #25003: Don't use getentropy() on Solaris (available since * Solaris 11.3), it is blocking whereas os.urandom() should not block. */ #elif defined(HAVE_GETENTROPY) && !defined(sun) #define PY_GETENTROPY 1 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 10 04:49:20 2016 From: python-checkins at python.org (martin.panter) Date: Fri, 10 Jun 2016 08:49:20 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2324617=3A_Merge_os=2Emkdir=28=29_doc_from_3=2E5?= Message-ID: <20160610084919.81080.62568.0541CF17@psf.io> https://hg.python.org/cpython/rev/bfd77c6fc04f changeset: 101848:bfd77c6fc04f parent: 101847:55b2d262a89d parent: 101846:e6093676e93b user: Martin Panter date: Fri Jun 10 08:40:02 2016 +0000 summary: Issue #24617: Merge os.mkdir() doc from 3.5 files: Doc/library/os.rst | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1656,9 +1656,15 @@ Create a directory named *path* with numeric mode *mode*. + If the directory already exists, :exc:`FileExistsError` is raised. + + .. _mkdir_modebits: + On some systems, *mode* is ignored. Where it is used, the current umask - value is first masked out. If the directory already exists, - :exc:`FileExistsError` is raised. + value is first masked out. If bits other than the last 9 (i.e. the last 3 + digits of the octal representation of the *mode*) are set, their meaning is + platform-dependent. On some platforms, they are ignored and you should call + :func:`chmod` explicitly to set them. This function can also support :ref:`paths relative to directory descriptors `. @@ -1679,8 +1685,8 @@ Recursive directory creation function. Like :func:`mkdir`, but makes all intermediate-level directories needed to contain the leaf directory. - The default *mode* is ``0o777`` (octal). On some systems, *mode* is - ignored. Where it is used, the current umask value is first masked out. + The *mode* parameter is passed to :func:`mkdir`; see :ref:`the mkdir() + description ` for how it is interpreted. If *exist_ok* is ``False`` (the default), an :exc:`OSError` is raised if the target directory already exists. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 10 04:50:15 2016 From: python-checkins at python.org (martin.panter) Date: Fri, 10 Jun 2016 08:50:15 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_comment_fix_from_3=2E5?= Message-ID: <20160610084919.20039.41545.A8807635@psf.io> https://hg.python.org/cpython/rev/55b2d262a89d changeset: 101847:55b2d262a89d parent: 101841:15738f76fe6f parent: 101845:0329218b0f83 user: Martin Panter date: Fri Jun 10 08:38:56 2016 +0000 summary: Merge comment fix from 3.5 files: Python/random.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/random.c b/Python/random.c --- a/Python/random.c +++ b/Python/random.c @@ -75,6 +75,8 @@ return 0; } +/* Issue #25003: Don't use getentropy() on Solaris (available since + * Solaris 11.3), it is blocking whereas os.urandom() should not block. */ #elif defined(HAVE_GETENTROPY) && !defined(sun) #define PY_GETENTROPY 1 @@ -114,8 +116,6 @@ #else -/* Issue #25003: Don' use getentropy() on Solaris (available since - * Solaris 11.3), it is blocking whereas os.urandom() should not block. */ #if defined(HAVE_GETRANDOM) || defined(HAVE_GETRANDOM_SYSCALL) #define PY_GETRANDOM 1 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 10 04:50:15 2016 From: python-checkins at python.org (martin.panter) Date: Fri, 10 Jun 2016 08:50:15 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI0NjE3?= =?utf-8?q?=3A_Add_comment_for_os=2Emkdir_about_mode_quirks?= Message-ID: <20160610084919.26206.8932.93989AF9@psf.io> https://hg.python.org/cpython/rev/e6093676e93b changeset: 101846:e6093676e93b branch: 3.5 user: Tommy Beadle date: Thu Jun 02 15:41:20 2016 -0400 summary: Issue #24617: Add comment for os.mkdir about mode quirks files: Doc/library/os.rst | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1623,9 +1623,15 @@ Create a directory named *path* with numeric mode *mode*. + If the directory already exists, :exc:`FileExistsError` is raised. + + .. _mkdir_modebits: + On some systems, *mode* is ignored. Where it is used, the current umask - value is first masked out. If the directory already exists, - :exc:`FileExistsError` is raised. + value is first masked out. If bits other than the last 9 (i.e. the last 3 + digits of the octal representation of the *mode*) are set, their meaning is + platform-dependent. On some platforms, they are ignored and you should call + :func:`chmod` explicitly to set them. This function can also support :ref:`paths relative to directory descriptors `. @@ -1646,8 +1652,8 @@ Recursive directory creation function. Like :func:`mkdir`, but makes all intermediate-level directories needed to contain the leaf directory. - The default *mode* is ``0o777`` (octal). On some systems, *mode* is - ignored. Where it is used, the current umask value is first masked out. + The *mode* parameter is passed to :func:`mkdir`; see :ref:`the mkdir() + description ` for how it is interpreted. If *exist_ok* is ``False`` (the default), an :exc:`OSError` is raised if the target directory already exists. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 10 04:50:15 2016 From: python-checkins at python.org (martin.panter) Date: Fri, 10 Jun 2016 08:50:15 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI0NjE3?= =?utf-8?q?=3A_Add_comment_for_os=2Emkdir_about_mode_quirks?= Message-ID: <20160610084918.19931.74533.C97E9AAF@psf.io> https://hg.python.org/cpython/rev/4fc7753efc89 changeset: 101844:4fc7753efc89 branch: 2.7 user: Tommy Beadle date: Thu Jun 02 15:41:20 2016 -0400 summary: Issue #24617: Add comment for os.mkdir about mode quirks files: Doc/library/os.rst | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1222,10 +1222,17 @@ .. function:: mkdir(path[, mode]) Create a directory named *path* with numeric mode *mode*. The default *mode* is - ``0777`` (octal). On some systems, *mode* is ignored. Where it is used, the - current umask value is first masked out. If the directory already exists, + ``0777`` (octal). If the directory already exists, :exc:`OSError` is raised. + .. _mkdir_modebits: + + On some systems, *mode* is ignored. Where it is used, the current umask + value is first masked out. If bits other than the last 9 (i.e. the last 3 + digits of the octal representation of the *mode*) are set, their meaning is + platform-dependent. On some platforms, they are ignored and you should call + :func:`chmod` explicitly to set them. + It is also possible to create temporary directories; see the :mod:`tempfile` module's :func:`tempfile.mkdtemp` function. @@ -1241,8 +1248,10 @@ Recursive directory creation function. Like :func:`mkdir`, but makes all intermediate-level directories needed to contain the leaf directory. Raises an :exc:`error` exception if the leaf directory already exists or cannot be - created. The default *mode* is ``0777`` (octal). On some systems, *mode* is - ignored. Where it is used, the current umask value is first masked out. + created. The default *mode* is ``0777`` (octal). + + The *mode* parameter is passed to :func:`mkdir`; see :ref:`the mkdir() + description ` for how it is interpreted. .. note:: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 10 04:50:16 2016 From: python-checkins at python.org (martin.panter) Date: Fri, 10 Jun 2016 08:50:16 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzIwNjk5?= =?utf-8?q?=3A_Document_that_=E2=80=9Cio=E2=80=9D_methods_should_accept_me?= =?utf-8?q?moryview?= Message-ID: <20160610084918.26279.45174.63449685@psf.io> https://hg.python.org/cpython/rev/ec69518aeebc changeset: 101842:ec69518aeebc branch: 2.7 parent: 101840:b4839797f482 user: Martin Panter date: Fri Jun 03 05:59:20 2016 +0000 summary: Issue #20699: Document that ?io? methods should accept memoryview This matches the usage by BufferedReader, BufferedWriter, etc. Also document and test that the write() methods should only access their argument before they return. files: Doc/library/io.rst | 50 ++++++++++++++++++-------- Lib/_pyio.py | 9 ++-- Lib/test/test_io.py | 39 ++++++++++++++++---- Lib/test/test_memoryio.py | 1 + Modules/_io/bufferedio.c | 3 +- Modules/_io/bytesio.c | 2 +- Modules/_io/fileio.c | 2 +- Modules/_io/iobase.c | 6 ++- 8 files changed, 78 insertions(+), 34 deletions(-) diff --git a/Doc/library/io.rst b/Doc/library/io.rst --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -225,10 +225,15 @@ support are called. The basic type used for binary data read from or written to a file is - :class:`bytes` (also known as :class:`str`). :class:`bytearray`\s are - accepted too, and in some cases (such as :class:`readinto`) required. + :class:`bytes` (also known as :class:`str`). Method arguments may + also be :class:`bytearray` or :class:`memoryview` of arrays of bytes. + In some cases, such as :meth:`~RawIOBase.readinto`, a writable object + such as :class:`bytearray` is required. Text I/O classes work with :class:`unicode` data. + .. versionchanged:: 2.7 + Implementations should support :class:`memoryview` arguments. + Note that calling any method (even inquiries) on a closed stream is undefined. Implementations may raise :exc:`IOError` in this case. @@ -383,18 +388,24 @@ .. method:: readinto(b) - Read up to len(b) bytes into bytearray *b* and return the number - of bytes read. If the object is in non-blocking mode and no + Read up to len(b) bytes into *b*, and return the number + of bytes read. The object *b* should be a pre-allocated, writable + array of bytes, either :class:`bytearray` or :class:`memoryview`. + If the object is in non-blocking mode and no bytes are available, ``None`` is returned. .. method:: write(b) - Write the given bytes or bytearray object, *b*, to the underlying raw - stream and return the number of bytes written. This can be less than + Write *b* to the underlying raw stream, and return the + number of bytes written. The object *b* should be an array + of bytes, either :class:`bytes`, :class:`bytearray`, or + :class:`memoryview`. The return value can be less than ``len(b)``, depending on specifics of the underlying raw stream, and especially if it is in non-blocking mode. ``None`` is returned if the raw stream is set not to block and no single byte could be readily - written to it. + written to it. The caller may release or mutate *b* after + this method returns, so the implementation should only access *b* + during the method call. .. class:: BufferedIOBase @@ -465,8 +476,9 @@ .. method:: readinto(b) - Read up to len(b) bytes into bytearray *b* and return the number of bytes - read. + Read up to len(b) bytes into *b*, and return the number of bytes read. + The object *b* should be a pre-allocated, writable array of bytes, + either :class:`bytearray` or :class:`memoryview`. Like :meth:`read`, multiple reads may be issued to the underlying raw stream, unless the latter is 'interactive'. @@ -476,9 +488,11 @@ .. method:: write(b) - Write the given bytes or bytearray object, *b* and return the number - of bytes written (never less than ``len(b)``, since if the write fails - an :exc:`IOError` will be raised). Depending on the actual + Write *b*, and return the number of bytes written + (always equal to ``len(b)``, since if the write fails + an :exc:`IOError` will be raised). The object *b* should be + an array of bytes, either :class:`bytes`, :class:`bytearray`, + or :class:`memoryview`. Depending on the actual implementation, these bytes may be readily written to the underlying stream, or held in a buffer for performance and latency reasons. @@ -486,6 +500,9 @@ data needed to be written to the raw stream but it couldn't accept all the data without blocking. + The caller may release or mutate *b* after this method returns, + so the implementation should only access *b* during the method call. + Raw File I/O ------------ @@ -535,7 +552,8 @@ A stream implementation using an in-memory bytes buffer. It inherits :class:`BufferedIOBase`. - The argument *initial_bytes* is an optional initial :class:`bytes`. + The optional argument *initial_bytes* is a :class:`bytes` object that + contains initial data. :class:`BytesIO` provides or overrides these methods in addition to those from :class:`BufferedIOBase` and :class:`IOBase`: @@ -611,8 +629,10 @@ .. method:: write(b) - Write the bytes or bytearray object, *b* and return the number of bytes - written. When in non-blocking mode, a :exc:`BlockingIOError` is raised + Write *b*, and return the number of bytes written. + The object *b* should be an array of bytes, either + :class:`bytes`, :class:`bytearray`, or :class:`memoryview`. + When in non-blocking mode, a :exc:`BlockingIOError` is raised if the buffer needs to be written out but the raw stream blocks. diff --git a/Lib/_pyio.py b/Lib/_pyio.py --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -277,8 +277,9 @@ may raise a IOError when operations they do not support are called. The basic type used for binary data read from or written to a file is - bytes. bytearrays are accepted too, and in some cases (such as - readinto) needed. Text I/O classes work with str data. + the bytes type. Method arguments may also be bytearray or memoryview of + arrays of bytes. In some cases, such as readinto, a writable object such + as bytearray is required. Text I/O classes work with unicode data. Note that calling any method (even inquiries) on a closed stream is undefined. Implementations may raise IOError in this case. @@ -649,7 +650,6 @@ Raises BlockingIOError if the underlying raw stream has no data at the moment. """ - # XXX This ought to work with anything that supports the buffer API data = self.read(len(b)) n = len(data) try: @@ -664,8 +664,7 @@ def write(self, b): """Write the given buffer to the IO stream. - Return the number of bytes written, which is never less than - len(b). + Return the number of bytes written, which is always len(b). Raises BlockingIOError if the buffer is full and the underlying raw stream cannot accept more data at the moment. 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 @@ -54,6 +54,9 @@ __metaclass__ = type bytes = support.py3k_bytes +def byteslike(*pos, **kw): + return memoryview(bytearray(*pos, **kw)) + def _default_chunk_size(): """Get the default TextIOWrapper chunk size""" with io.open(__file__, "r", encoding="latin1") as f: @@ -273,7 +276,9 @@ self.assertEqual(f.tell(), 6) self.assertEqual(f.seek(-1, 1), 5) self.assertEqual(f.tell(), 5) - self.assertEqual(f.write(bytearray(b" world\n\n\n")), 9) + buffer = bytearray(b" world\n\n\n") + self.assertEqual(f.write(buffer), 9) + buffer[:] = b"*" * 9 # Overwrite our copy of the data self.assertEqual(f.seek(0), 0) self.assertEqual(f.write(b"h"), 1) self.assertEqual(f.seek(-1, 2), 13) @@ -286,20 +291,21 @@ def read_ops(self, f, buffered=False): data = f.read(5) self.assertEqual(data, b"hello") - data = bytearray(data) + data = byteslike(data) self.assertEqual(f.readinto(data), 5) - self.assertEqual(data, b" worl") + self.assertEqual(data.tobytes(), b" worl") + data = bytearray(5) self.assertEqual(f.readinto(data), 2) self.assertEqual(len(data), 5) self.assertEqual(data[:2], b"d\n") self.assertEqual(f.seek(0), 0) self.assertEqual(f.read(20), b"hello world\n") self.assertEqual(f.read(1), b"") - self.assertEqual(f.readinto(bytearray(b"x")), 0) + self.assertEqual(f.readinto(byteslike(b"x")), 0) self.assertEqual(f.seek(-6, 2), 6) self.assertEqual(f.read(5), b"world") self.assertEqual(f.read(0), b"") - self.assertEqual(f.readinto(bytearray()), 0) + self.assertEqual(f.readinto(byteslike()), 0) self.assertEqual(f.seek(-6, 1), 5) self.assertEqual(f.read(5), b" worl") self.assertEqual(f.tell(), 10) @@ -649,6 +655,16 @@ support.gc_collect() self.assertEqual(recorded, []) + def test_buffered_readinto_mixin(self): + # Test the implementation provided by BufferedIOBase + class Stream(self.BufferedIOBase): + def read(self, size): + return b"12345" + stream = Stream() + buffer = byteslike(5) + self.assertEqual(stream.readinto(buffer), 5) + self.assertEqual(buffer.tobytes(), b"12345") + class CIOTest(IOTest): @@ -1111,6 +1127,11 @@ bufio = self.tp(writer, 8) bufio.write(b"abc") self.assertFalse(writer._write_stack) + buffer = bytearray(b"def") + bufio.write(buffer) + buffer[:] = b"***" # Overwrite our copy of the data + bufio.flush() + self.assertEqual(b"".join(writer._write_stack), b"abcdef") def test_write_overflow(self): writer = self.MockRawIO() @@ -1440,9 +1461,9 @@ def test_readinto(self): pair = self.tp(self.BytesIO(b"abcdef"), self.MockRawIO()) - data = bytearray(5) + data = byteslike(5) self.assertEqual(pair.readinto(data), 5) - self.assertEqual(data, b"abcde") + self.assertEqual(data.tobytes(), b"abcde") def test_write(self): w = self.MockRawIO() @@ -1450,7 +1471,9 @@ pair.write(b"abc") pair.flush() - pair.write(b"def") + buffer = bytearray(b"def") + pair.write(buffer) + buffer[:] = b"***" # Overwrite our copy of the data pair.flush() self.assertEqual(w._write_stack, [b"abc", b"def"]) diff --git a/Lib/test/test_memoryio.py b/Lib/test/test_memoryio.py --- a/Lib/test/test_memoryio.py +++ b/Lib/test/test_memoryio.py @@ -396,6 +396,7 @@ class PyBytesIOTest(MemoryTestMixin, MemorySeekTestMixin, unittest.TestCase): + # Test _pyio.BytesIO; class also inherited for testing C implementation UnsupportedOperation = pyio.UnsupportedOperation diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -125,8 +125,7 @@ PyDoc_STRVAR(bufferediobase_write_doc, "Write the given buffer to the IO stream.\n" "\n" - "Returns the number of bytes written, which is never less than\n" - "len(b).\n" + "Returns the number of bytes written, which is always len(b).\n" "\n" "Raises BlockingIOError if the buffer is full and the\n" "underlying raw stream cannot accept more data at the moment.\n"); diff --git a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c --- a/Modules/_io/bytesio.c +++ b/Modules/_io/bytesio.c @@ -392,7 +392,7 @@ } PyDoc_STRVAR(readinto_doc, -"readinto(bytearray) -> int. Read up to len(b) bytes into b.\n" +"readinto(b) -> int. Read up to len(b) bytes into b.\n" "\n" "Returns number of bytes read (0 for EOF), or None if the object\n" "is set not to block and has no data to read."); diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -969,7 +969,7 @@ "or None if no data is available. On end-of-file, returns ''."); PyDoc_STRVAR(write_doc, -"write(b: bytes) -> int. Write bytes b to file, return number written.\n" +"write(b) -> int. Write array of bytes b, return number written.\n" "\n" "Only makes one system call, so not all of the data may be written.\n" "The number of bytes actually written is returned. In non-blocking mode,\n" diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c --- a/Modules/_io/iobase.c +++ b/Modules/_io/iobase.c @@ -38,8 +38,10 @@ "may raise a IOError when operations they do not support are called.\n" "\n" "The basic type used for binary data read from or written to a file is\n" - "bytes. bytearrays are accepted too, and in some cases (such as\n" - "readinto) needed. Text I/O classes work with str data.\n" + "the bytes type. Method arguments may also be bytearray or memoryview\n" + "of arrays of bytes. In some cases, such as readinto, a writable\n" + "object such as bytearray is required. Text I/O classes work with\n" + "unicode data.\n" "\n" "Note that calling any method (except additional calls to close(),\n" "which are ignored) on a closed stream should raise a ValueError.\n" -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Fri Jun 10 04:53:05 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 10 Jun 2016 08:53:05 +0000 Subject: [Python-checkins] Daily reference leaks (15738f76fe6f): sum=4 Message-ID: <20160610085303.81161.35995.153DE468@psf.io> results for 15738f76fe6f on branch "default" -------------------------------------------- test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_fork leaked [-2, 2, 0] memory blocks, sum=0 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflog5ZdDzz', '--timeout', '7200'] From python-checkins at python.org Fri Jun 10 07:26:31 2016 From: python-checkins at python.org (berker.peksag) Date: Fri, 10 Jun 2016 11:26:31 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327280=3A_Merge_from_3=2E5?= Message-ID: <20160610112630.81041.86378.BF1BF7C8@psf.io> https://hg.python.org/cpython/rev/18f1012e0c56 changeset: 101850:18f1012e0c56 parent: 101848:bfd77c6fc04f parent: 101849:fcd9f6ffbeaf user: Berker Peksag date: Fri Jun 10 14:26:32 2016 +0300 summary: Issue #27280: Merge from 3.5 files: Doc/library/ipaddress.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/ipaddress.rst b/Doc/library/ipaddress.rst --- a/Doc/library/ipaddress.rst +++ b/Doc/library/ipaddress.rst @@ -580,7 +580,7 @@ 4. A two-tuple of an address description and a netmask, where the address description is either a string, a 128-bits integer, a 16-bytes packed - integer, or an existing IPv4Address object; and the netmask is an + integer, or an existing IPv6Address object; and the netmask is an integer representing the prefix length. An :exc:`AddressValueError` is raised if *address* is not a valid IPv6 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 10 07:26:31 2016 From: python-checkins at python.org (berker.peksag) Date: Fri, 10 Jun 2016 11:26:31 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3Mjgw?= =?utf-8?q?=3A_Fix_typo_in_IPv6Network_documentation?= Message-ID: <20160610112630.114300.9502.7E029907@psf.io> https://hg.python.org/cpython/rev/fcd9f6ffbeaf changeset: 101849:fcd9f6ffbeaf branch: 3.5 parent: 101846:e6093676e93b user: Berker Peksag date: Fri Jun 10 14:26:07 2016 +0300 summary: Issue #27280: Fix typo in IPv6Network documentation Patch by Arthur Carcano. files: Doc/library/ipaddress.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/ipaddress.rst b/Doc/library/ipaddress.rst --- a/Doc/library/ipaddress.rst +++ b/Doc/library/ipaddress.rst @@ -580,7 +580,7 @@ 4. A two-tuple of an address description and a netmask, where the address description is either a string, a 128-bits integer, a 16-bytes packed - integer, or an existing IPv4Address object; and the netmask is an + integer, or an existing IPv6Address object; and the netmask is an integer representing the prefix length. An :exc:`AddressValueError` is raised if *address* is not a valid IPv6 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 10 12:25:54 2016 From: python-checkins at python.org (matthias.klose) Date: Fri, 10 Jun 2016 16:25:54 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogLSBJc3N1ZSAjMTc1?= =?utf-8?q?00=2C_and_https=3A//github=2Ecom/python/pythondotorg/issues/945?= =?utf-8?q?=3A_Remove?= Message-ID: <20160610162552.28098.25522.A8146602@psf.io> https://hg.python.org/cpython/rev/c6c55d1eadc4 changeset: 101851:c6c55d1eadc4 branch: 2.7 parent: 101844:4fc7753efc89 user: doko at ubuntu.com date: Fri Jun 10 18:22:25 2016 +0200 summary: - Issue #17500, and https://github.com/python/pythondotorg/issues/945: Remove unused and outdated icons. files: Misc/NEWS | 6 + PC/icons/baselogo.svg | 609 ------------------------------ PC/icons/source.xar | Bin 3 files changed, 6 insertions(+), 609 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -379,6 +379,12 @@ - Issue #26476: Fixed compilation error when use PyErr_BadInternalCall() in C++. Patch by Jeroen Demeyer. +Misc +---- + +- Issue #17500, and https://github.com/python/pythondotorg/issues/945: Remove + unused and outdated icons. + What's New in Python 2.7.11? ============================ diff --git a/PC/icons/baselogo.svg b/PC/icons/baselogo.svg deleted file mode 100644 --- a/PC/icons/baselogo.svg +++ /dev/null @@ -1,609 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/PC/icons/source.xar b/PC/icons/source.xar deleted file mode 100644 index 84cbbc4d88eaa68bca3ecae6cdf0990cca4226c9..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 GIT binary patch [stripped] -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 10 12:26:03 2016 From: python-checkins at python.org (matthias.klose) Date: Fri, 10 Jun 2016 16:26:03 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_-_Issue_=2317500=2C_and_https=3A//github=2Ecom/python/py?= =?utf-8?q?thondotorg/issues/945=3A_Remove?= Message-ID: <20160610162553.120419.8415.28B452AF@psf.io> https://hg.python.org/cpython/rev/a3060775b8ad changeset: 101853:a3060775b8ad parent: 101850:18f1012e0c56 parent: 101852:0c4d525a2f10 user: doko at ubuntu.com date: Fri Jun 10 18:25:42 2016 +0200 summary: - Issue #17500, and https://github.com/python/pythondotorg/issues/945: Remove unused and outdated icons. files: Misc/NEWS | 7 + PC/icons/baselogo.svg | 609 ------------------------------ PC/icons/source.xar | Bin 3 files changed, 7 insertions(+), 609 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -195,6 +195,12 @@ - Issue #26930: Update OS X 10.5+ 32-bit-only installer to build and link with OpenSSL 1.0.2h. +Misc +---- + +- Issue #17500, and https://github.com/python/pythondotorg/issues/945: Remove + unused and outdated icons. + What's New in Python 3.6.0 alpha 1? =================================== @@ -1460,6 +1466,7 @@ - Issue #26316: Fix variable name typo in Argument Clinic. +<<<<<<< local - Issue #25440: Fix output of python-config --extension-suffix. - Issue #25154: The pyvenv script has been deprecated in favour of diff --git a/PC/icons/baselogo.svg b/PC/icons/baselogo.svg deleted file mode 100644 --- a/PC/icons/baselogo.svg +++ /dev/null @@ -1,609 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/PC/icons/source.xar b/PC/icons/source.xar deleted file mode 100644 index 84cbbc4d88eaa68bca3ecae6cdf0990cca4226c9..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 GIT binary patch [stripped] -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 10 12:26:04 2016 From: python-checkins at python.org (matthias.klose) Date: Fri, 10 Jun 2016 16:26:04 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogLSBJc3N1ZSAjMTc1?= =?utf-8?q?00=2C_and_https=3A//github=2Ecom/python/pythondotorg/issues/945?= =?utf-8?q?=3A_Remove?= Message-ID: <20160610162552.120521.8727.EFBEEC8B@psf.io> https://hg.python.org/cpython/rev/0c4d525a2f10 changeset: 101852:0c4d525a2f10 branch: 3.5 parent: 101849:fcd9f6ffbeaf user: doko at ubuntu.com date: Fri Jun 10 18:23:35 2016 +0200 summary: - Issue #17500, and https://github.com/python/pythondotorg/issues/945: Remove unused and outdated icons. files: Misc/NEWS | 6 + PC/icons/baselogo.svg | 609 ------------------------------ PC/icons/source.xar | Bin 3 files changed, 6 insertions(+), 609 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -699,6 +699,12 @@ - Issue #26316: Fix variable name typo in Argument Clinic. +Misc +---- + +- Issue #17500, and https://github.com/python/pythondotorg/issues/945: Remove + unused and outdated icons. + What's New in Python 3.5.1 final? ================================= diff --git a/PC/icons/baselogo.svg b/PC/icons/baselogo.svg deleted file mode 100644 --- a/PC/icons/baselogo.svg +++ /dev/null @@ -1,609 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/PC/icons/source.xar b/PC/icons/source.xar deleted file mode 100644 index 84cbbc4d88eaa68bca3ecae6cdf0990cca4226c9..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 GIT binary patch [stripped] -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 10 14:09:51 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 10 Jun 2016 18:09:51 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2326282=3A_PyArg=5F?= =?utf-8?q?ParseTupleAndKeywords=28=29_and_Argument_Clinic_now_support?= Message-ID: <20160610180951.20145.66460.6639B210@psf.io> https://hg.python.org/cpython/rev/69c0aa8a8185 changeset: 101854:69c0aa8a8185 user: Serhiy Storchaka date: Thu Jun 09 16:30:29 2016 +0300 summary: Issue #26282: PyArg_ParseTupleAndKeywords() and Argument Clinic now support positional-only and keyword parameters in the same function. files: Doc/c-api/arg.rst | 11 +- Doc/glossary.rst | 2 + Doc/whatsnew/3.6.rst | 5 + Lib/test/test_capi.py | 25 +++++ Lib/test/test_getargs2.py | 33 ++++++ Misc/NEWS | 12 ++ Modules/_testcapimodule.c | 18 +++ Python/getargs.c | 125 ++++++++++++++++--------- Tools/clinic/clinic.py | 51 +++++----- 9 files changed, 210 insertions(+), 72 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 @@ -406,8 +406,15 @@ .. 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. + parameters into local variables. The *keywords* argument is a + *NULL*-terminated array of keyword parameter names. Empty names denote + :ref:`positional-only parameters `. + Returns true on success; on failure, it returns false and raises the + appropriate exception. + + .. versionchanged:: 3.6 + Added support for :ref:`positional-only parameters + `. .. c:function:: int PyArg_VaParseTupleAndKeywords(PyObject *args, PyObject *kw, const char *format, char *keywords[], va_list vargs) diff --git a/Doc/glossary.rst b/Doc/glossary.rst --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -718,6 +718,8 @@ def func(foo, bar=None): ... + .. _positional-only_parameter: + * :dfn:`positional-only`: specifies an argument that can be supplied only by position. Python has no syntax for defining positional-only parameters. However, some built-in functions have positional-only diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -503,6 +503,11 @@ * New :c:func:`Py_FinalizeEx` API which indicates if flushing buffered data failed (:issue:`5319`). +* :c:func:`PyArg_ParseTupleAndKeywords` now supports :ref:`positional-only + parameters `. Positional-only parameters are + defined by empty names. + (Contributed by Serhit Storchaka in :issue:`26282`). + Deprecated ========== 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 @@ -527,6 +527,31 @@ self.assertRaises(ValueError, _testcapi.parse_tuple_and_keywords, (), {}, b'', [42]) + def test_positional_only(self): + parse = _testcapi.parse_tuple_and_keywords + + parse((1, 2, 3), {}, b'OOO', ['', '', 'a']) + parse((1, 2), {'a': 3}, b'OOO', ['', '', 'a']) + with self.assertRaisesRegex(TypeError, + 'Function takes at least 2 positional arguments \(1 given\)'): + parse((1,), {'a': 3}, b'OOO', ['', '', 'a']) + parse((1,), {}, b'O|OO', ['', '', 'a']) + with self.assertRaisesRegex(TypeError, + 'Function takes at least 1 positional arguments \(0 given\)'): + parse((), {}, b'O|OO', ['', '', 'a']) + parse((1, 2), {'a': 3}, b'OO$O', ['', '', 'a']) + with self.assertRaisesRegex(TypeError, + 'Function takes exactly 2 positional arguments \(1 given\)'): + parse((1,), {'a': 3}, b'OO$O', ['', '', 'a']) + parse((1,), {}, b'O|O$O', ['', '', 'a']) + with self.assertRaisesRegex(TypeError, + 'Function takes at least 1 positional arguments \(0 given\)'): + parse((), {}, b'O|O$O', ['', '', 'a']) + with self.assertRaisesRegex(SystemError, 'Empty parameter name after \$'): + parse((1,), {}, b'O|$OO', ['', '', 'a']) + with self.assertRaisesRegex(SystemError, 'Empty keyword'): + parse((1,), {}, b'O|OO', ['', 'a', '']) + @unittest.skipUnless(threading, 'Threading required for this test.') class TestThreadState(unittest.TestCase): diff --git a/Lib/test/test_getargs2.py b/Lib/test/test_getargs2.py --- a/Lib/test/test_getargs2.py +++ b/Lib/test/test_getargs2.py @@ -658,6 +658,39 @@ getargs_keyword_only(1, 2, **{'\uDC80': 10}) +class PositionalOnlyAndKeywords_TestCase(unittest.TestCase): + from _testcapi import getargs_positional_only_and_keywords as getargs + + def test_positional_args(self): + # using all possible positional args + self.assertEqual(self.getargs(1, 2, 3), (1, 2, 3)) + + def test_mixed_args(self): + # positional and keyword args + self.assertEqual(self.getargs(1, 2, keyword=3), (1, 2, 3)) + + def test_optional_args(self): + # missing optional args + self.assertEqual(self.getargs(1, 2), (1, 2, -1)) + self.assertEqual(self.getargs(1, keyword=3), (1, -1, 3)) + + def test_required_args(self): + self.assertEqual(self.getargs(1), (1, -1, -1)) + # required positional arg missing + with self.assertRaisesRegex(TypeError, + "Function takes at least 1 positional arguments \(0 given\)"): + self.getargs() + + with self.assertRaisesRegex(TypeError, + "Function takes at least 1 positional arguments \(0 given\)"): + self.getargs(keyword=3) + + def test_empty_keyword(self): + with self.assertRaisesRegex(TypeError, + "'' is an invalid keyword argument for this function"): + self.getargs(1, 2, **{'': 666}) + + class Bytes_TestCase(unittest.TestCase): def test_c(self): from _testcapi import getargs_c diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -201,6 +201,18 @@ - Issue #17500, and https://github.com/python/pythondotorg/issues/945: Remove unused and outdated icons. +C API +----- + +- Issue #26282: PyArg_ParseTupleAndKeywords() now supports positional-only + parameters. + +Tools/Demos +----------- + +- Issue #26282: Argument Clinic now supports positional-only and keyword + parameters in the same function. + What's New in Python 3.6.0 alpha 1? =================================== diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -1028,6 +1028,21 @@ return Py_BuildValue("iii", required, optional, keyword_only); } +/* test PyArg_ParseTupleAndKeywords positional-only arguments */ +static PyObject * +getargs_positional_only_and_keywords(PyObject *self, PyObject *args, PyObject *kwargs) +{ + static char *keywords[] = {"", "", "keyword", NULL}; + int required = -1; + int optional = -1; + int keyword = -1; + + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|ii", keywords, + &required, &optional, &keyword)) + return NULL; + return Py_BuildValue("iii", required, optional, keyword); +} + /* Functions to call PyArg_ParseTuple with integer format codes, and return the result. */ @@ -3963,6 +3978,9 @@ METH_VARARGS|METH_KEYWORDS}, {"getargs_keyword_only", (PyCFunction)getargs_keyword_only, METH_VARARGS|METH_KEYWORDS}, + {"getargs_positional_only_and_keywords", + (PyCFunction)getargs_positional_only_and_keywords, + METH_VARARGS|METH_KEYWORDS}, {"getargs_b", getargs_b, METH_VARARGS}, {"getargs_B", getargs_B, METH_VARARGS}, {"getargs_h", getargs_h, METH_VARARGS}, diff --git a/Python/getargs.c b/Python/getargs.c --- a/Python/getargs.c +++ b/Python/getargs.c @@ -1443,7 +1443,8 @@ const char *fname, *msg, *custom_msg, *keyword; int min = INT_MAX; int max = INT_MAX; - int i, len; + int i, pos, len; + int skip = 0; Py_ssize_t nargs, nkeywords; PyObject *current_arg; freelistentry_t static_entries[STATIC_FREELIST_ENTRIES]; @@ -1471,9 +1472,17 @@ custom_msg++; } + /* scan kwlist and count the number of positional-only parameters */ + for (pos = 0; kwlist[pos] && !*kwlist[pos]; pos++) { + } /* scan kwlist and get greatest possible nbr of args */ - for (len=0; kwlist[len]; len++) - continue; + for (len = pos; kwlist[len]; len++) { + if (!*kwlist[len]) { + PyErr_SetString(PyExc_SystemError, + "Empty keyword parameter name"); + return cleanreturn(0, &freelist); + } + } if (len > STATIC_FREELIST_ENTRIES) { freelist.entries = PyMem_NEW(freelistentry_t, len); @@ -1526,6 +1535,14 @@ max = i; format++; + if (max < pos) { + PyErr_SetString(PyExc_SystemError, + "Empty parameter name after $"); + return cleanreturn(0, &freelist); + } + if (skip) { + break; + } if (max < nargs) { PyErr_Format(PyExc_TypeError, "Function takes %s %d positional arguments" @@ -1541,48 +1558,59 @@ "format specifiers (%d)", len, i); return cleanreturn(0, &freelist); } - current_arg = NULL; - if (nkeywords) { - current_arg = PyDict_GetItemString(keywords, keyword); - } - if (current_arg) { - --nkeywords; - if (i < nargs) { - /* arg present in tuple and in dict */ - PyErr_Format(PyExc_TypeError, - "Argument given by name ('%s') " - "and position (%d)", - keyword, i+1); - return cleanreturn(0, &freelist); + if (!skip) { + current_arg = NULL; + if (nkeywords && i >= pos) { + current_arg = PyDict_GetItemString(keywords, keyword); + if (!current_arg && PyErr_Occurred()) { + return cleanreturn(0, &freelist); + } + } + if (current_arg) { + --nkeywords; + if (i < nargs) { + /* arg present in tuple and in dict */ + PyErr_Format(PyExc_TypeError, + "Argument given by name ('%s') " + "and position (%d)", + keyword, i+1); + return cleanreturn(0, &freelist); + } + } + else if (i < nargs) + current_arg = PyTuple_GET_ITEM(args, i); + + if (current_arg) { + msg = convertitem(current_arg, &format, p_va, flags, + levels, msgbuf, sizeof(msgbuf), &freelist); + if (msg) { + seterror(i+1, msg, levels, fname, custom_msg); + return cleanreturn(0, &freelist); + } + continue; + } + + if (i < min) { + if (i < pos) { + assert (min == INT_MAX); + assert (max == INT_MAX); + skip = 1; + } + else { + PyErr_Format(PyExc_TypeError, "Required argument " + "'%s' (pos %d) not found", + keyword, i+1); + return cleanreturn(0, &freelist); + } + } + /* current code reports success when all required args + * fulfilled and no keyword args left, with no further + * validation. XXX Maybe skip this in debug build ? + */ + if (!nkeywords && !skip) { + return cleanreturn(1, &freelist); } } - else if (nkeywords && PyErr_Occurred()) - return cleanreturn(0, &freelist); - else if (i < nargs) - current_arg = PyTuple_GET_ITEM(args, i); - - if (current_arg) { - msg = convertitem(current_arg, &format, p_va, flags, - levels, msgbuf, sizeof(msgbuf), &freelist); - if (msg) { - seterror(i+1, msg, levels, fname, custom_msg); - return cleanreturn(0, &freelist); - } - continue; - } - - if (i < min) { - PyErr_Format(PyExc_TypeError, "Required argument " - "'%s' (pos %d) not found", - keyword, i+1); - return cleanreturn(0, &freelist); - } - /* current code reports success when all required args - * fulfilled and no keyword args left, with no further - * validation. XXX Maybe skip this in debug build ? - */ - if (!nkeywords) - return cleanreturn(1, &freelist); /* We are into optional args, skip thru to any remaining * keyword args */ @@ -1594,6 +1622,15 @@ } } + if (skip) { + PyErr_Format(PyExc_TypeError, + "Function takes %s %d positional arguments" + " (%d given)", + (Py_MIN(pos, min) < i) ? "at least" : "exactly", + Py_MIN(pos, min), nargs); + return cleanreturn(0, &freelist); + } + if (!IS_END_OF_FORMAT(*format) && (*format != '|') && (*format != '$')) { PyErr_Format(PyExc_SystemError, "more argument specifiers than keyword list entries " @@ -1613,7 +1650,7 @@ return cleanreturn(0, &freelist); } for (i = 0; i < len; i++) { - if (!PyUnicode_CompareWithASCIIString(key, kwlist[i])) { + if (*kwlist[i] && !PyUnicode_CompareWithASCIIString(key, kwlist[i])) { match = 1; break; } diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -644,7 +644,7 @@ default_return_converter = (not f.return_converter or f.return_converter.type == 'PyObject *') - positional = parameters and (parameters[-1].kind == inspect.Parameter.POSITIONAL_ONLY) + positional = parameters and parameters[-1].is_positional_only() all_boring_objects = False # yes, this will be false if there are 0 parameters, it's fine first_optional = len(parameters) for i, p in enumerate(parameters): @@ -661,7 +661,7 @@ new_or_init = f.kind in (METHOD_NEW, METHOD_INIT) meth_o = (len(parameters) == 1 and - parameters[0].kind == inspect.Parameter.POSITIONAL_ONLY and + parameters[0].is_positional_only() and not converters[0].is_optional() and not new_or_init) @@ -1075,7 +1075,7 @@ last_group = 0 first_optional = len(selfless) - positional = selfless and selfless[-1].kind == inspect.Parameter.POSITIONAL_ONLY + positional = selfless and selfless[-1].is_positional_only() new_or_init = f.kind in (METHOD_NEW, METHOD_INIT) default_return_converter = (not f.return_converter or f.return_converter.type == 'PyObject *') @@ -2367,7 +2367,10 @@ data.modifications.append('/* modifications for ' + name + ' */\n' + modifications.rstrip()) # keywords - data.keywords.append(parameter.name) + if parameter.is_positional_only(): + data.keywords.append('') + else: + data.keywords.append(parameter.name) # format_units if self.is_optional() and '|' not in data.format_units: @@ -3192,6 +3195,7 @@ self.state = self.state_dsl_start self.parameter_indent = None self.keyword_only = False + self.positional_only = False self.group = 0 self.parameter_state = self.ps_start self.seen_positional_with_default = False @@ -3570,8 +3574,8 @@ # "parameter_state". (Previously the code was a miasma of ifs and # separate boolean state variables.) The states are: # - # [ [ a, b, ] c, ] d, e, f=3, [ g, h, [ i ] ] / <- line - # 01 2 3 4 5 6 7 <- state transitions + # [ [ a, b, ] c, ] d, e, f=3, [ g, h, [ i ] ] <- line + # 01 2 3 4 5 6 <- state transitions # # 0: ps_start. before we've seen anything. legal transitions are to 1 or 3. # 1: ps_left_square_before. left square brackets before required parameters. @@ -3582,9 +3586,8 @@ # now must have default values. # 5: ps_group_after. in a group, after required parameters. # 6: ps_right_square_after. right square brackets after required parameters. - # 7: ps_seen_slash. seen slash. ps_start, ps_left_square_before, ps_group_before, ps_required, \ - ps_optional, ps_group_after, ps_right_square_after, ps_seen_slash = range(8) + ps_optional, ps_group_after, ps_right_square_after = range(7) def state_parameters_start(self, line): if self.ignore_line(line): @@ -3863,9 +3866,6 @@ return name, False, kwargs def parse_special_symbol(self, symbol): - if self.parameter_state == self.ps_seen_slash: - fail("Function " + self.function.name + " specifies " + symbol + " after /, which is unsupported.") - if symbol == '*': if self.keyword_only: fail("Function " + self.function.name + " uses '*' more than once.") @@ -3892,13 +3892,15 @@ else: fail("Function " + self.function.name + " has an unsupported group configuration. (Unexpected state " + str(self.parameter_state) + ".c)") elif symbol == '/': + if self.positional_only: + fail("Function " + self.function.name + " uses '/' more than once.") + self.positional_only = True # ps_required and ps_optional are allowed here, that allows positional-only without option groups # to work (and have default values!) if (self.parameter_state not in (self.ps_required, self.ps_optional, self.ps_right_square_after, self.ps_group_before)) or self.group: fail("Function " + self.function.name + " has an unsupported group configuration. (Unexpected state " + str(self.parameter_state) + ".d)") if self.keyword_only: fail("Function " + self.function.name + " mixes keyword-only and positional-only parameters, which is unsupported.") - self.parameter_state = self.ps_seen_slash # fixup preceding parameters for p in self.function.parameters.values(): if (p.kind != inspect.Parameter.POSITIONAL_OR_KEYWORD and not isinstance(p.converter, self_converter)): @@ -3986,23 +3988,20 @@ # populate "right_bracket_count" field for every parameter assert parameters, "We should always have a self parameter. " + repr(f) assert isinstance(parameters[0].converter, self_converter) + # self is always positional-only. + assert parameters[0].is_positional_only() parameters[0].right_bracket_count = 0 - parameters_after_self = parameters[1:] - if parameters_after_self: - # for now, the only way Clinic supports positional-only parameters - # is if all of them are positional-only... - # - # ... except for self! self is always positional-only. - - positional_only_parameters = [p.kind == inspect.Parameter.POSITIONAL_ONLY for p in parameters_after_self] - if parameters_after_self[0].kind == inspect.Parameter.POSITIONAL_ONLY: - assert all(positional_only_parameters) - for p in parameters: - p.right_bracket_count = abs(p.group) + positional_only = True + for p in parameters[1:]: + if not p.is_positional_only(): + positional_only = False + else: + assert positional_only + if positional_only: + p.right_bracket_count = abs(p.group) else: # don't put any right brackets around non-positional-only parameters, ever. - for p in parameters_after_self: - p.right_bracket_count = 0 + p.right_bracket_count = 0 right_bracket_count = 0 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 10 15:34:06 2016 From: python-checkins at python.org (brett.cannon) Date: Fri, 10 Jun 2016 19:34:06 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327186=3A_Add_os?= =?utf-8?q?=2EPathLike_support_to_pathlib=2E?= Message-ID: <20160610193402.120669.78008.27307823@psf.io> https://hg.python.org/cpython/rev/a5a013ca5687 changeset: 101855:a5a013ca5687 user: Brett Cannon date: Fri Jun 10 12:20:49 2016 -0700 summary: Issue #27186: Add os.PathLike support to pathlib. This adds support both to pathlib.PurePath's constructor as well as implementing __fspath__(). This removes the provisional status for pathlib. Initial patch by Dusty Phillips. files: Doc/library/pathlib.rst | 23 ++++++++++++++++------- Lib/pathlib.py | 22 ++++++++++++++++------ Lib/test/test_pathlib.py | 11 +++++++++++ Misc/NEWS | 14 +++++++++++++- 4 files changed, 56 insertions(+), 14 deletions(-) diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -31,12 +31,6 @@ accessing the OS. In this case, instantiating one of the pure classes may be useful since those simply don't have any OS-accessing operations. -.. note:: - This module has been included in the standard library on a - :term:`provisional basis `. Backwards incompatible - changes (up to and including removal of the package) may occur if deemed - necessary by the core developers. - .. seealso:: :pep:`428`: The pathlib module -- object-oriented filesystem paths. @@ -107,7 +101,8 @@ PurePosixPath('setup.py') Each element of *pathsegments* can be either a string representing a - path segment, or another path object:: + path segment, an object implementing the :class:`os.PathLike` interface + which returns a string, or another path object:: >>> PurePath('foo', 'some/path', 'bar') PurePosixPath('foo/some/path/bar') @@ -148,6 +143,12 @@ to ``PurePosixPath('bar')``, which is wrong if ``foo`` is a symbolic link to another directory) + Pure path objects implement the :class:`os.PathLike` interface, allowing them + to be used anywhere the interface is accepted. + + .. versionchanged:: 3.6 + Added support for the :class:`os.PathLike` interface. + .. class:: PurePosixPath(*pathsegments) A subclass of :class:`PurePath`, this path flavour represents non-Windows @@ -212,6 +213,14 @@ >>> '/usr' / q PurePosixPath('/usr/bin') +A path object can be used anywhere an object implementing :class:`os.PathLike` +is accepted:: + + >>> import os + >>> p = PurePath('/etc') + >>> os.fspath(p) + '/etc' + The string representation of a path is the raw filesystem path itself (in native form, e.g. with backslashes under Windows), which you can pass to any function taking a file path as a string:: diff --git a/Lib/pathlib.py b/Lib/pathlib.py --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -634,13 +634,16 @@ for a in args: if isinstance(a, PurePath): parts += a._parts - elif isinstance(a, str): - # Force-cast str subclasses to str (issue #21127) - parts.append(str(a)) else: - raise TypeError( - "argument should be a path or str object, not %r" - % type(a)) + a = os.fspath(a) + if isinstance(a, str): + # Force-cast str subclasses to str (issue #21127) + parts.append(str(a)) + else: + raise TypeError( + "argument should be a str object or an os.PathLike " + "object returning str, not %r" + % type(a)) return cls._flavour.parse_parts(parts) @classmethod @@ -693,6 +696,9 @@ self._parts) or '.' return self._str + def __fspath__(self): + return str(self) + def as_posix(self): """Return the string representation of the path with forward (/) slashes.""" @@ -943,6 +949,10 @@ return False return True +# Can't subclass os.PathLike from PurePath and keep the constructor +# optimizations in PurePath._parse_args(). +os.PathLike.register(PurePath) + class PurePosixPath(PurePath): _flavour = _posix_flavour diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -190,13 +190,18 @@ P = self.cls p = P('a') self.assertIsInstance(p, P) + class PathLike: + def __fspath__(self): + return "a/b/c" P('a', 'b', 'c') P('/a', 'b', 'c') P('a/b/c') P('/a/b/c') + P(PathLike()) self.assertEqual(P(P('a')), P('a')) self.assertEqual(P(P('a'), 'b'), P('a/b')) self.assertEqual(P(P('a'), P('b')), P('a/b')) + self.assertEqual(P(P('a'), P('b'), P('c')), P(PathLike())) def _check_str_subclass(self, *args): # Issue #21127: it should be possible to construct a PurePath object @@ -384,6 +389,12 @@ parts = p.parts self.assertEqual(parts, (sep, 'a', 'b')) + def test_fspath_common(self): + P = self.cls + p = P('a/b') + self._check_str(p.__fspath__(), ('a/b',)) + self._check_str(os.fspath(p), ('a/b',)) + def test_equivalences(self): for k, tuples in self.equivalences.items(): canon = k.replace('/', self.sep) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #27186: Add support for os.PathLike objects to open() (part of PEP 519). + - Issue #27066: Fixed SystemError if a custom opener (for open()) returns a negative number without setting an exception. @@ -36,6 +38,14 @@ Library ------- +- Issue #27186: Add os.PathLike support to pathlib, removing its provisional + status (part of PEP 519). + +- Issue #27186: Add support for os.PathLike objects to os.fsencode() and + os.fsdecode() (part of PEP 519). + +- Issue #27186: Introduce os.PathLike and os.fspath() (part of PEP 519). + - A new version of typing.py provides several new classes and features: @overload outside stubs, Reversible, DefaultDict, Text, ContextManager, Type[], NewType(), TYPE_CHECKING, and numerous bug @@ -198,12 +208,14 @@ Misc ---- -- Issue #17500, and https://github.com/python/pythondotorg/issues/945: Remove +- Issue #17500, and https://github.com/python/pythondotorg/issues/945: Remove unused and outdated icons. C API ----- +- Issue #27186: Add the PyOS_FSPath() function (part of PEP 519). + - Issue #26282: PyArg_ParseTupleAndKeywords() now supports positional-only parameters. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 10 15:35:12 2016 From: python-checkins at python.org (brett.cannon) Date: Fri, 10 Jun 2016 19:35:12 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Update_PEP_519_on_current_pro?= =?utf-8?q?gress?= Message-ID: <20160610193503.114539.81856.139229C1@psf.io> https://hg.python.org/peps/rev/40de4ef39f5f changeset: 6366:40de4ef39f5f user: Brett Cannon date: Fri Jun 10 12:34:59 2016 -0700 summary: Update PEP 519 on current progress files: pep-0519.txt | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/pep-0519.txt b/pep-0519.txt --- a/pep-0519.txt +++ b/pep-0519.txt @@ -323,6 +323,7 @@ #. Remove the ``path`` attribute from pathlib (`done `__) #. Remove the provisional status of pathlib + (`done `__) #. Add ``os.PathLike`` (`code `__ and `docs `__ done) @@ -336,7 +337,7 @@ #. Update ``os.fsdecode()`` (`done `__) #. Update ``pathlib.PurePath`` and ``pathlib.Path`` - (`bug `__) + (`done `__) #. Add ``__fspath__()`` #. Add ``os.PathLike`` support to the constructors -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Fri Jun 10 16:02:00 2016 From: python-checkins at python.org (berker.peksag) Date: Fri, 10 Jun 2016 20:02:00 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIwOTAw?= =?utf-8?q?=3A_distutils_register_command_now_decodes_HTTP_responses_corre?= =?utf-8?q?ctly?= Message-ID: <20160610200159.28015.71589.962F352E@psf.io> https://hg.python.org/cpython/rev/02824cee7624 changeset: 101856:02824cee7624 branch: 3.5 parent: 101852:0c4d525a2f10 user: Berker Peksag date: Fri Jun 10 23:00:52 2016 +0300 summary: Issue #20900: distutils register command now decodes HTTP responses correctly Initial patch by ingrid. files: Lib/distutils/command/register.py | 6 +++--- Lib/distutils/tests/test_register.py | 14 ++++++++++++++ Lib/distutils/tests/test_upload.py | 2 +- Misc/NEWS | 3 +++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Lib/distutils/command/register.py b/Lib/distutils/command/register.py --- a/Lib/distutils/command/register.py +++ b/Lib/distutils/command/register.py @@ -296,9 +296,9 @@ result = 500, str(e) else: if self.show_response: - data = result.read() + data = self._read_pypi_response(result) result = 200, 'OK' if self.show_response: - dashes = '-' * 75 - self.announce('%s%r%s' % (dashes, data, dashes)) + msg = '\n'.join(('-' * 75, data, '-' * 75)) + self.announce(msg, log.INFO) return result diff --git a/Lib/distutils/tests/test_register.py b/Lib/distutils/tests/test_register.py --- a/Lib/distutils/tests/test_register.py +++ b/Lib/distutils/tests/test_register.py @@ -301,6 +301,20 @@ results = self.get_logs(INFO) self.assertEqual(results, ['running check', 'xxx']) + def test_show_response(self): + # test that the --show-response option return a well formatted response + cmd = self._get_cmd() + inputs = Inputs('1', 'tarek', 'y') + register_module.input = inputs.__call__ + cmd.show_response = 1 + try: + cmd.run() + finally: + del register_module.input + + results = self.get_logs(INFO) + self.assertEqual(results[3], 75 * '-' + '\nxxx\n' + 75 * '-') + def test_suite(): return unittest.makeSuite(RegisterTestCase) diff --git a/Lib/distutils/tests/test_upload.py b/Lib/distutils/tests/test_upload.py --- a/Lib/distutils/tests/test_upload.py +++ b/Lib/distutils/tests/test_upload.py @@ -140,7 +140,7 @@ # The PyPI response body was echoed results = self.get_logs(INFO) - self.assertIn('xyzzy\n', results[-1]) + self.assertEqual(results[-1], 75 * '-' + '\nxyzzy\n' + 75 * '-') def test_upload_fails(self): self.next_msg = "Not Found" diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -139,6 +139,9 @@ Library ------- +- Issue #20900: distutils register command now decodes HTTP responses + correctly. Initial patch by ingrid. + - A new version of typing.py provides several new classes and features: @overload outside stubs, Reversible, DefaultDict, Text, ContextManager, Type[], NewType(), TYPE_CHECKING, and numerous bug -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 10 16:02:03 2016 From: python-checkins at python.org (berker.peksag) Date: Fri, 10 Jun 2016 20:02:03 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2320900=3A_Merge_from_3=2E5?= Message-ID: <20160610200159.101725.8362.F2355EA6@psf.io> https://hg.python.org/cpython/rev/b0be24a2f16c changeset: 101857:b0be24a2f16c parent: 101855:a5a013ca5687 parent: 101856:02824cee7624 user: Berker Peksag date: Fri Jun 10 23:02:04 2016 +0300 summary: Issue #20900: Merge from 3.5 files: Lib/distutils/command/register.py | 6 +++--- Lib/distutils/tests/test_register.py | 14 ++++++++++++++ Lib/distutils/tests/test_upload.py | 2 +- Misc/NEWS | 3 +++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Lib/distutils/command/register.py b/Lib/distutils/command/register.py --- a/Lib/distutils/command/register.py +++ b/Lib/distutils/command/register.py @@ -296,9 +296,9 @@ result = 500, str(e) else: if self.show_response: - data = result.read() + data = self._read_pypi_response(result) result = 200, 'OK' if self.show_response: - dashes = '-' * 75 - self.announce('%s%r%s' % (dashes, data, dashes)) + msg = '\n'.join(('-' * 75, data, '-' * 75)) + self.announce(msg, log.INFO) return result diff --git a/Lib/distutils/tests/test_register.py b/Lib/distutils/tests/test_register.py --- a/Lib/distutils/tests/test_register.py +++ b/Lib/distutils/tests/test_register.py @@ -301,6 +301,20 @@ results = self.get_logs(INFO) self.assertEqual(results, ['running check', 'xxx']) + def test_show_response(self): + # test that the --show-response option return a well formatted response + cmd = self._get_cmd() + inputs = Inputs('1', 'tarek', 'y') + register_module.input = inputs.__call__ + cmd.show_response = 1 + try: + cmd.run() + finally: + del register_module.input + + results = self.get_logs(INFO) + self.assertEqual(results[3], 75 * '-' + '\nxxx\n' + 75 * '-') + def test_suite(): return unittest.makeSuite(RegisterTestCase) diff --git a/Lib/distutils/tests/test_upload.py b/Lib/distutils/tests/test_upload.py --- a/Lib/distutils/tests/test_upload.py +++ b/Lib/distutils/tests/test_upload.py @@ -140,7 +140,7 @@ # The PyPI response body was echoed results = self.get_logs(INFO) - self.assertIn('xyzzy\n', results[-1]) + self.assertEqual(results[-1], 75 * '-' + '\nxyzzy\n' + 75 * '-') def test_upload_fails(self): self.next_msg = "Not Found" diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -38,6 +38,9 @@ Library ------- +- Issue #20900: distutils register command now decodes HTTP responses + correctly. Initial patch by ingrid. + - Issue #27186: Add os.PathLike support to pathlib, removing its provisional status (part of PEP 519). -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 10 17:37:27 2016 From: python-checkins at python.org (brett.cannon) Date: Fri, 10 Jun 2016 21:37:27 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327186=3A_Add_os?= =?utf-8?q?=2EPathLike_support_to_DirEntry?= Message-ID: <20160610213726.114533.42814.999BA05B@psf.io> https://hg.python.org/cpython/rev/5a62d682636e changeset: 101858:5a62d682636e user: Brett Cannon date: Fri Jun 10 14:37:21 2016 -0700 summary: Issue #27186: Add os.PathLike support to DirEntry Initial patch thanks to Jelle Zijlstra. files: Doc/library/os.rst | 6 ++++++ Lib/test/test_os.py | 23 +++++++++++++++++++---- Misc/NEWS | 5 ++++- Modules/posixmodule.c | 10 ++++++++++ 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1994,6 +1994,9 @@ control over errors, you can catch :exc:`OSError` when calling one of the ``DirEntry`` methods and handle as appropriate. + To be directly usable as a path-like object, ``DirEntry`` implements the + :class:`os.PathLike` interface. + Attributes and methods on a ``DirEntry`` instance are as follows: .. attribute:: name @@ -2106,6 +2109,9 @@ .. versionadded:: 3.5 + .. versionchanged:: 3.6 + Added support for the :class:`os.PathLike` interface. + .. function:: stat(path, \*, dir_fd=None, follow_symlinks=True) 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 @@ -2824,11 +2824,13 @@ def setUp(self): self.path = os.path.realpath(support.TESTFN) + self.bytes_path = os.fsencode(self.path) self.addCleanup(support.rmtree, self.path) os.mkdir(self.path) def create_file(self, name="file.txt"): - filename = os.path.join(self.path, name) + path = self.bytes_path if isinstance(name, bytes) else self.path + filename = os.path.join(path, name) create_file(filename, b'python') return filename @@ -2917,15 +2919,16 @@ self.check_entry(entry, 'symlink_file.txt', False, True, True) def get_entry(self, name): - entries = list(os.scandir(self.path)) + path = self.bytes_path if isinstance(name, bytes) else self.path + entries = list(os.scandir(path)) self.assertEqual(len(entries), 1) entry = entries[0] self.assertEqual(entry.name, name) return entry - def create_file_entry(self): - filename = self.create_file() + def create_file_entry(self, name='file.txt'): + filename = self.create_file(name=name) return self.get_entry(os.path.basename(filename)) def test_current_directory(self): @@ -2946,6 +2949,18 @@ entry = self.create_file_entry() self.assertEqual(repr(entry), "") + def test_fspath_protocol(self): + entry = self.create_file_entry() + self.assertEqual(os.fspath(entry), os.path.join(self.path, 'file.txt')) + + def test_fspath_protocol_bytes(self): + bytes_filename = os.fsencode('bytesfile.txt') + bytes_entry = self.create_file_entry(name=bytes_filename) + fspath = os.fspath(bytes_entry) + self.assertIsInstance(fspath, bytes) + self.assertEqual(fspath, + os.path.join(os.fsencode(self.path),bytes_filename)) + def test_removed_dir(self): path = os.path.join(self.path, 'dir') diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -38,11 +38,14 @@ Library ------- +- Issue #27186: Add os.PathLike support to DirEntry (part of PEP 519). + Initial patch by Jelle Zijlstra. + - Issue #20900: distutils register command now decodes HTTP responses correctly. Initial patch by ingrid. - Issue #27186: Add os.PathLike support to pathlib, removing its provisional - status (part of PEP 519). + status (part of PEP 519). Initial patch by Dusty Phillips. - Issue #27186: Add support for os.PathLike objects to os.fsencode() and os.fsdecode() (part of PEP 519). diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -11718,6 +11718,13 @@ return PyUnicode_FromFormat("", self->name); } +static PyObject * +DirEntry_fspath(DirEntry *self) +{ + Py_INCREF(self->path); + return self->path; +} + static PyMemberDef DirEntry_members[] = { {"name", T_OBJECT_EX, offsetof(DirEntry, name), READONLY, "the entry's base filename, relative to scandir() \"path\" argument"}, @@ -11742,6 +11749,9 @@ {"inode", (PyCFunction)DirEntry_inode, METH_NOARGS, "return inode of the entry; cached per entry", }, + {"__fspath__", (PyCFunction)DirEntry_fspath, METH_NOARGS, + "returns the path for the entry", + }, {NULL} }; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 10 17:39:55 2016 From: python-checkins at python.org (brett.cannon) Date: Fri, 10 Jun 2016 21:39:55 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Update_PEP_519_for_DirEntry_w?= =?utf-8?q?ork?= Message-ID: <20160610213955.27788.98439.E68AAB61@psf.io> https://hg.python.org/peps/rev/ad949ebfc3fa changeset: 6367:ad949ebfc3fa user: Brett Cannon date: Fri Jun 10 14:39:51 2016 -0700 summary: Update PEP 519 for DirEntry work files: pep-0519.txt | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-) diff --git a/pep-0519.txt b/pep-0519.txt --- a/pep-0519.txt +++ b/pep-0519.txt @@ -342,13 +342,8 @@ #. Add ``__fspath__()`` #. Add ``os.PathLike`` support to the constructors -#. Update ``os.DirEntry`` - (`bug `__) - - #. Add ``__fspath__()`` - #. Add ``os.pathLike`` support to the constructor - #. Alias ``DirEntry`` to ``os.DirEntry`` - (`bug `__) +#. Add ``__fspath__()`` to ``DirEntry`` + (`done `__) #. Update ``builtins.open()`` (`done `__) -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Fri Jun 10 18:19:32 2016 From: python-checkins at python.org (terry.reedy) Date: Fri, 10 Jun 2016 22:19:32 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_*24750=3A_Switch_all?= =?utf-8?q?_scrollbars_in_IDLE_to_ttk_versions=2E?= Message-ID: <20160610221932.19970.30672.E3560E4F@psf.io> https://hg.python.org/cpython/rev/288e97680d84 changeset: 101859:288e97680d84 user: Terry Jan Reedy date: Fri Jun 10 18:19:21 2016 -0400 summary: Issue *24750: Switch all scrollbars in IDLE to ttk versions. Where needed, add minimal tests to cover changes. files: Lib/idlelib/autocomplete_w.py | 1 + Lib/idlelib/config_key.py | 21 +++-- Lib/idlelib/configdialog.py | 1 + Lib/idlelib/debugger.py | 1 + Lib/idlelib/editor.py | 1 + Lib/idlelib/help.py | 22 +++--- Lib/idlelib/idle_test/htest.py | 3 +- Lib/idlelib/idle_test/test_autocomplete.py | 8 +- Lib/idlelib/idle_test/test_config_key.py | 31 ++++++++ Lib/idlelib/idle_test/test_debugger.py | 29 ++++++++ Lib/idlelib/idle_test/test_help.py | 34 +++++++++ Lib/idlelib/idle_test/test_scrolledlist.py | 29 ++++++++ Lib/idlelib/idle_test/test_textview.py | 2 +- Lib/idlelib/idle_test/test_tree.py | 36 ++++++++++ Lib/idlelib/scrolledlist.py | 13 +- Lib/idlelib/textview.py | 3 +- Lib/idlelib/tree.py | 15 +-- 17 files changed, 211 insertions(+), 39 deletions(-) diff --git a/Lib/idlelib/autocomplete_w.py b/Lib/idlelib/autocomplete_w.py --- a/Lib/idlelib/autocomplete_w.py +++ b/Lib/idlelib/autocomplete_w.py @@ -2,6 +2,7 @@ An auto-completion window for IDLE, used by the autocomplete extension """ from tkinter import * +from tkinter.ttk import Scrollbar from idlelib.multicall import MC_SHIFT from idlelib.autocomplete import COMPLETE_FILES, COMPLETE_ATTRIBUTES diff --git a/Lib/idlelib/config_key.py b/Lib/idlelib/config_key.py --- a/Lib/idlelib/config_key.py +++ b/Lib/idlelib/config_key.py @@ -2,31 +2,35 @@ Dialog for building Tkinter accelerator key bindings """ from tkinter import * +from tkinter.ttk import Scrollbar import tkinter.messagebox as tkMessageBox import string import sys class GetKeysDialog(Toplevel): - def __init__(self,parent,title,action,currentKeySequences,_htest=False): + def __init__(self, parent, title, action, currentKeySequences, + _htest=False, _utest=False): """ action - string, the name of the virtual event these keys will be mapped to currentKeys - list, a list of all key sequence lists currently mapped to virtual events, for overlap checking + _utest - bool, do not wait when running unittest _htest - bool, change box location when running htest """ Toplevel.__init__(self, parent) + self.withdraw() #hide while setting geometry self.configure(borderwidth=5) - self.resizable(height=FALSE,width=FALSE) + self.resizable(height=FALSE, width=FALSE) self.title(title) self.transient(parent) self.grab_set() self.protocol("WM_DELETE_WINDOW", self.Cancel) self.parent = parent self.action=action - self.currentKeySequences=currentKeySequences - self.result='' - self.keyString=StringVar(self) + self.currentKeySequences = currentKeySequences + self.result = '' + self.keyString = StringVar(self) self.keyString.set('') self.SetModifiersForPlatform() # set self.modifiers, self.modifier_label self.modifier_vars = [] @@ -37,7 +41,6 @@ self.advanced = False self.CreateWidgets() self.LoadFinalKeyList() - self.withdraw() #hide while setting geometry self.update_idletasks() self.geometry( "+%d+%d" % ( @@ -47,8 +50,9 @@ ((parent.winfo_height()/2 - self.winfo_reqheight()/2) if not _htest else 150) ) ) #centre dialog over parent (or below htest box) - self.deiconify() #geometry set, unhide - self.wait_window() + if not _utest: + self.deiconify() #geometry set, unhide + self.wait_window() def CreateWidgets(self): frameMain = Frame(self,borderwidth=2,relief=SUNKEN) @@ -261,6 +265,7 @@ keysOK = True return keysOK + if __name__ == '__main__': from idlelib.idle_test.htest import run run(GetKeysDialog) diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -10,6 +10,7 @@ """ from tkinter import * +from tkinter.ttk import Scrollbar import tkinter.messagebox as tkMessageBox import tkinter.colorchooser as tkColorChooser import tkinter.font as tkFont diff --git a/Lib/idlelib/debugger.py b/Lib/idlelib/debugger.py --- a/Lib/idlelib/debugger.py +++ b/Lib/idlelib/debugger.py @@ -1,6 +1,7 @@ import os import bdb from tkinter import * +from tkinter.ttk import Scrollbar from idlelib.windows import ListedToplevel from idlelib.scrolledlist import ScrolledList from idlelib import macosx diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py --- a/Lib/idlelib/editor.py +++ b/Lib/idlelib/editor.py @@ -7,6 +7,7 @@ import string import sys from tkinter import * +from tkinter.ttk import Scrollbar import tkinter.simpledialog as tkSimpleDialog import tkinter.messagebox as tkMessageBox import traceback diff --git a/Lib/idlelib/help.py b/Lib/idlelib/help.py --- a/Lib/idlelib/help.py +++ b/Lib/idlelib/help.py @@ -26,14 +26,11 @@ """ from html.parser import HTMLParser from os.path import abspath, dirname, isfile, join -from tkinter import Toplevel, Frame, Text, Scrollbar, Menu, Menubutton +from tkinter import Toplevel, Frame, Text, Menu +from tkinter.ttk import Menubutton, Scrollbar from tkinter import font as tkfont from idlelib.config import idleConf -use_ttk = False # until available to import -if use_ttk: - from tkinter.ttk import Menubutton - ## About IDLE ## @@ -196,15 +193,18 @@ "Display html text, scrollbar, and toc." def __init__(self, parent, filename): Frame.__init__(self, parent) - text = HelpText(self, filename) + # keep references to widgets for test access. + self.text = text = HelpText(self, filename) self['background'] = text['background'] - scroll = Scrollbar(self, command=text.yview) + self.toc = toc = self.toc_menu(text) + self.scroll = scroll = Scrollbar(self, command=text.yview) text['yscrollcommand'] = scroll.set + self.rowconfigure(0, weight=1) self.columnconfigure(1, weight=1) # text - self.toc_menu(text).grid(column=0, row=0, sticky='nw') - text.grid(column=1, row=0, sticky='nsew') - scroll.grid(column=2, row=0, sticky='ns') + toc.grid(row=0, column=0, sticky='nw') + text.grid(row=0, column=1, sticky='nsew') + scroll.grid(row=0, column=2, sticky='ns') def toc_menu(self, text): "Create table of contents as drop-down menu." @@ -265,7 +265,7 @@ if not isfile(filename): # try copy_strip, present message return - HelpWindow(parent, filename, 'IDLE Help') + return HelpWindow(parent, filename, 'IDLE Help') if __name__ == '__main__': from idlelib.idle_test.htest import run diff --git a/Lib/idlelib/idle_test/htest.py b/Lib/idlelib/idle_test/htest.py --- a/Lib/idlelib/idle_test/htest.py +++ b/Lib/idlelib/idle_test/htest.py @@ -68,6 +68,7 @@ from importlib import import_module from idlelib.macosx import _init_tk_type import tkinter as tk +from tkinter.ttk import Scrollbar AboutDialog_spec = { 'file': 'help_about', @@ -344,7 +345,7 @@ frameLabel.pack() text = tk.Text(frameLabel, wrap='word') text.configure(bg=root.cget('bg'), relief='flat', height=4, width=70) - scrollbar = tk.Scrollbar(frameLabel, command=text.yview) + scrollbar = Scrollbar(frameLabel, command=text.yview) text.config(yscrollcommand=scrollbar.set) scrollbar.pack(side='right', fill='y', expand=False) text.pack(side='left', fill='both', expand=True) diff --git a/Lib/idlelib/idle_test/test_autocomplete.py b/Lib/idlelib/idle_test/test_autocomplete.py --- a/Lib/idlelib/idle_test/test_autocomplete.py +++ b/Lib/idlelib/idle_test/test_autocomplete.py @@ -1,10 +1,14 @@ +''' Test autocomplete and autocomple_w + +Coverage of autocomple: 56% +''' import unittest from test.support import requires from tkinter import Tk, Text import idlelib.autocomplete as ac import idlelib.autocomplete_w as acw -import idlelib.macosx as mac +from idlelib import macosx from idlelib.idle_test.mock_idle import Func from idlelib.idle_test.mock_tk import Event @@ -27,7 +31,7 @@ def setUpClass(cls): requires('gui') cls.root = Tk() - mac.setupApp(cls.root, None) + macosx.setupApp(cls.root, None) cls.text = Text(cls.root) cls.editor = DummyEditwin(cls.root, cls.text) diff --git a/Lib/idlelib/idle_test/test_config_key.py b/Lib/idlelib/idle_test/test_config_key.py new file mode 100644 --- /dev/null +++ b/Lib/idlelib/idle_test/test_config_key.py @@ -0,0 +1,31 @@ +''' Test idlelib.config_key. + +Coverage: 56% +''' +from idlelib import config_key +from test.support import requires +requires('gui') +import unittest +from tkinter import Tk, Text + + +class GetKeysTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.root = Tk() + + @classmethod + def tearDownClass(cls): + cls.root.destroy() + del cls.root + + + def test_init(self): + dia = config_key.GetKeysDialog( + self.root, 'test', '<>', [''], _utest=True) + dia.Cancel() + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/Lib/idlelib/idle_test/test_debugger.py b/Lib/idlelib/idle_test/test_debugger.py new file mode 100644 --- /dev/null +++ b/Lib/idlelib/idle_test/test_debugger.py @@ -0,0 +1,29 @@ +''' Test idlelib.debugger. + +Coverage: 19% +''' +from idlelib import debugger +from test.support import requires +requires('gui') +import unittest +from tkinter import Tk + + +class NameSpaceTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.root = Tk() + cls.root.withdraw() + + @classmethod + def tearDownClass(cls): + cls.root.destroy() + del cls.root + + def test_init(self): + debugger.NamespaceViewer(self.root, 'Test') + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/Lib/idlelib/idle_test/test_help.py b/Lib/idlelib/idle_test/test_help.py new file mode 100644 --- /dev/null +++ b/Lib/idlelib/idle_test/test_help.py @@ -0,0 +1,34 @@ +'''Test idlelib.help. + +Coverage: 87% +''' +from idlelib import help +from test.support import requires +requires('gui') +from os.path import abspath, dirname, join +from tkinter import Tk +import unittest + +class HelpFrameTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + "By itself, this tests that file parsed without exception." + cls.root = root = Tk() + root.withdraw() + helpfile = join(abspath(dirname(dirname(__file__))), 'help.html') + cls.frame = help.HelpFrame(root, helpfile) + + @classmethod + def tearDownClass(cls): + del cls.frame + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def test_line1(self): + text = self.frame.text + self.assertEqual(text.get('1.0', '1.end'), ' IDLE ') + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/Lib/idlelib/idle_test/test_scrolledlist.py b/Lib/idlelib/idle_test/test_scrolledlist.py new file mode 100644 --- /dev/null +++ b/Lib/idlelib/idle_test/test_scrolledlist.py @@ -0,0 +1,29 @@ +''' Test idlelib.scrolledlist. + +Coverage: 39% +''' +from idlelib import scrolledlist +from test.support import requires +requires('gui') +import unittest +from tkinter import Tk + + +class ScrolledListTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.root = Tk() + + @classmethod + def tearDownClass(cls): + cls.root.destroy() + del cls.root + + + def test_init(self): + scrolledlist.ScrolledList(self.root) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/Lib/idlelib/idle_test/test_textview.py b/Lib/idlelib/idle_test/test_textview.py --- a/Lib/idlelib/idle_test/test_textview.py +++ b/Lib/idlelib/idle_test/test_textview.py @@ -7,13 +7,13 @@ The coverage is essentially 100%. ''' +from idlelib import textview as tv from test.support import requires requires('gui') import unittest import os from tkinter import Tk -from idlelib import textview as tv from idlelib.idle_test.mock_idle import Func from idlelib.idle_test.mock_tk import Mbox diff --git a/Lib/idlelib/idle_test/test_tree.py b/Lib/idlelib/idle_test/test_tree.py new file mode 100644 --- /dev/null +++ b/Lib/idlelib/idle_test/test_tree.py @@ -0,0 +1,36 @@ +''' Test idlelib.tree. + +Coverage: 56% +''' +from idlelib import tree +from test.support import requires +requires('gui') +import os +import unittest +from tkinter import Tk + + +class TreeTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + cls.root = Tk() + cls.root.withdraw() + + @classmethod + def tearDownClass(cls): + cls.root.destroy() + del cls.root + + def test_init(self): + # Start with code slightly adapted from htest. + sc = tree.ScrolledCanvas( + self.root, bg="white", highlightthickness=0, takefocus=1) + sc.frame.pack(expand=1, fill="both", side='left') + item = tree.FileTreeItem(tree.ICONDIR) + node = tree.TreeNode(sc.canvas, None, item) + node.expand() + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/Lib/idlelib/scrolledlist.py b/Lib/idlelib/scrolledlist.py --- a/Lib/idlelib/scrolledlist.py +++ b/Lib/idlelib/scrolledlist.py @@ -1,5 +1,6 @@ from tkinter import * from idlelib import macosx +from tkinter.ttk import Scrollbar class ScrolledList: @@ -124,22 +125,20 @@ pass -def _scrolled_list(parent): - root = Tk() - root.title("Test ScrolledList") +def _scrolled_list(parent): # htest # + top = Toplevel(parent) width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - root.geometry("+%d+%d"%(x, y + 150)) + top.geometry("+%d+%d"%(x+200, y + 175)) class MyScrolledList(ScrolledList): def fill_menu(self): self.menu.add_command(label="right click") def on_select(self, index): print("select", self.get(index)) def on_double(self, index): print("double", self.get(index)) - scrolled_list = MyScrolledList(root) + scrolled_list = MyScrolledList(top) for i in range(30): scrolled_list.append("Item %02d" % i) - root.mainloop() - if __name__ == '__main__': + # At the moment, test_scrolledlist merely creates instance, like htest. from idlelib.idle_test.htest import run run(_scrolled_list) diff --git a/Lib/idlelib/textview.py b/Lib/idlelib/textview.py --- a/Lib/idlelib/textview.py +++ b/Lib/idlelib/textview.py @@ -3,6 +3,7 @@ """ from tkinter import * +from tkinter.ttk import Scrollbar import tkinter.messagebox as tkMessageBox class TextViewer(Toplevel): @@ -50,7 +51,7 @@ self.buttonOk = Button(frameButtons, text='Close', command=self.Ok, takefocus=FALSE) self.scrollbarView = Scrollbar(frameText, orient=VERTICAL, - takefocus=FALSE, highlightthickness=0) + takefocus=FALSE) self.textView = Text(frameText, wrap=WORD, highlightthickness=0, fg=self.fg, bg=self.bg) self.scrollbarView.config(command=self.textView.yview) diff --git a/Lib/idlelib/tree.py b/Lib/idlelib/tree.py --- a/Lib/idlelib/tree.py +++ b/Lib/idlelib/tree.py @@ -16,7 +16,7 @@ import os from tkinter import * - +from tkinter.ttk import Scrollbar from idlelib import zoomheight from idlelib.config import idleConf @@ -449,18 +449,17 @@ return "break" -def _tree_widget(parent): - root = Tk() - root.title("Test TreeWidget") +def _tree_widget(parent): # htest # + top = Toplevel(parent) width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - root.geometry("+%d+%d"%(x, y + 150)) - sc = ScrolledCanvas(root, bg="white", highlightthickness=0, takefocus=1) + top.geometry("+%d+%d"%(x+50, y+175)) + sc = ScrolledCanvas(top, bg="white", highlightthickness=0, takefocus=1) sc.frame.pack(expand=1, fill="both", side=LEFT) - item = FileTreeItem(os.getcwd()) + item = FileTreeItem(ICONDIR) node = TreeNode(sc.canvas, None, item) node.expand() - root.mainloop() if __name__ == '__main__': + # test_tree is currently a copy of this from idlelib.idle_test.htest import run run(_tree_widget) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 02:06:58 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 11 Jun 2016 06:06:58 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=235124=3A_Temporary?= =?utf-8?q?_pyshell_rename_to_avoid_case-folding_collision_in_merge=2E?= Message-ID: <20160611060658.28015.60081.B9035189@psf.io> https://hg.python.org/cpython/rev/99760b6a181e changeset: 101860:99760b6a181e user: Terry Jan Reedy date: Sat Jun 11 02:05:52 2016 -0400 summary: Issue #5124: Temporary pyshell rename to avoid case-folding collision in merge. files: Lib/idlelib/PyShell.py | 0 1 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/PyShell.py rename from Lib/idlelib/pyshell.py rename to Lib/idlelib/PyShell.py -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 02:06:58 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 11 Jun 2016 06:06:58 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzUxMjQ6?= =?utf-8?q?_Paste_with_selection_should_always_replace=2E?= Message-ID: <20160611060658.26129.52538.8FCC4EF5@psf.io> https://hg.python.org/cpython/rev/f8b40e0d5913 changeset: 101862:f8b40e0d5913 branch: 3.5 parent: 101856:02824cee7624 user: Terry Jan Reedy date: Sat Jun 11 02:06:26 2016 -0400 summary: Issue #5124: Paste with selection should always replace. This is how paste work on Windows, Mac, modern Linux apps, and ttk widgets. The exception was X11 tk widgets. Original patch by Serhiy Storchake. files: Lib/idlelib/PyShell.py | 15 ++- Lib/idlelib/idle_test/test_editmenu.py | 71 ++++++++++++++ 2 files changed, 85 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 @@ -1396,6 +1396,17 @@ self.shell.close() +def fix_x11_paste(root): + "Make paste replace selection on x11. See issue #5124." + if root._windowingsystem == 'x11': + for cls in 'Text', 'Entry', 'Spinbox': + root.bind_class( + cls, + '<>', + 'catch {%W delete sel.first sel.last}\n' + + root.bind_class(cls, '<>')) + + usage_msg = """\ USAGE: idle [-deins] [-t title] [file]* @@ -1528,8 +1539,10 @@ 'editor-on-startup', type='bool') enable_edit = enable_edit or edit_start enable_shell = enable_shell or not enable_edit + # start editor and/or shell windows: root = Tk(className="Idle") + root.withdraw() # set application icon icondir = os.path.join(os.path.dirname(__file__), 'Icons') @@ -1544,7 +1557,7 @@ root.wm_iconphoto(True, *icons) fixwordbreaks(root) - root.withdraw() + fix_x11_paste(root) flist = PyShellFileList(root) macosxSupport.setupApp(root, flist) diff --git a/Lib/idlelib/idle_test/test_editmenu.py b/Lib/idlelib/idle_test/test_editmenu.py new file mode 100644 --- /dev/null +++ b/Lib/idlelib/idle_test/test_editmenu.py @@ -0,0 +1,71 @@ +'''Test (selected) IDLE Edit menu items. + +Edit modules have their own test files files +''' +from test.support import requires +requires('gui') +import tkinter as tk +import unittest +from idlelib import PyShell + +class PasteTest(unittest.TestCase): + '''Test pasting into widgets that allow pasting. + + On X11, replacing selections requires tk fix. + ''' + @classmethod + def setUpClass(cls): + cls.root = root = tk.Tk() + PyShell.fix_x11_paste(root) + cls.text = tk.Text(root) + cls.entry = tk.Entry(root) + cls.spin = tk.Spinbox(root) + root.clipboard_clear() + root.clipboard_append('two') + + @classmethod + def tearDownClass(cls): + del cls.text, cls.entry, cls.spin + cls.root.clipboard_clear() + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def test_paste_text(self): + "Test pasting into text with and without a selection." + text = self.text + for tag, ans in ('', 'onetwo\n'), ('sel', 'two\n'): + with self.subTest(tag=tag, ans=ans): + text.delete('1.0', 'end') + text.insert('1.0', 'one', tag) + text.event_generate('<>') + self.assertEqual(text.get('1.0', 'end'), ans) + + def test_paste_entry(self): + "Test pasting into an entry with and without a selection." + # On 3.6, generated <> fails without empty select range + # for 'no selection'. Live widget works fine. + entry = self.entry + for end, ans in (0, 'onetwo'), ('end', 'two'): + with self.subTest(entry=entry, end=end, ans=ans): + entry.delete(0, 'end') + entry.insert(0, 'one') + entry.select_range(0, end) # see note + entry.event_generate('<>') + self.assertEqual(entry.get(), ans) + + def test_paste_spin(self): + "Test pasting into a spinbox with and without a selection." + # See note above for entry. + spin = self.spin + for end, ans in (0, 'onetwo'), ('end', 'two'): + with self.subTest(end=end, ans=ans): + spin.delete(0, 'end') + spin.insert(0, 'one') + spin.selection('range', 0, end) # see note + spin.event_generate('<>') + self.assertEqual(spin.get(), ans) + + +if __name__ == '__main__': + unittest.main(verbosity=2) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 02:06:58 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 11 Jun 2016 06:06:58 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzUxMjQ6?= =?utf-8?q?_Paste_with_selection_should_always_replace=2E?= Message-ID: <20160611060658.28193.43306.D1DC675C@psf.io> https://hg.python.org/cpython/rev/6c469b50e198 changeset: 101861:6c469b50e198 branch: 2.7 parent: 101851:c6c55d1eadc4 user: Terry Jan Reedy date: Sat Jun 11 02:06:18 2016 -0400 summary: Issue #5124: Paste with selection should always replace. This is how paste work on Windows, Mac, modern Linux apps, and ttk widgets. The exception was X11 tk widgets. Original patch by Serhiy Storchake. files: Lib/idlelib/PyShell.py | 15 ++- Lib/idlelib/idle_test/test_editmenu.py | 98 ++++++++++++++ 2 files changed, 112 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 @@ -1408,6 +1408,17 @@ self.shell.close() +def fix_x11_paste(root): + "Make paste replace selection on x11. See issue #5124." + if root._windowingsystem == 'x11': + for cls in 'Text', 'Entry', 'Spinbox': + root.bind_class( + cls, + '<>', + 'catch {%W delete sel.first sel.last}\n' + + root.bind_class(cls, '<>')) + + usage_msg = """\ USAGE: idle [-deins] [-t title] [file]* @@ -1537,8 +1548,10 @@ 'editor-on-startup', type='bool') enable_edit = enable_edit or edit_start enable_shell = enable_shell or not enable_edit + # start editor and/or shell windows: root = Tk(className="Idle") + root.withdraw() # set application icon icondir = os.path.join(os.path.dirname(__file__), 'Icons') @@ -1553,7 +1566,7 @@ root.tk.call('wm', 'iconphoto', str(root), "-default", *icons) fixwordbreaks(root) - root.withdraw() + fix_x11_paste(root) flist = PyShellFileList(root) macosxSupport.setupApp(root, flist) diff --git a/Lib/idlelib/idle_test/test_editmenu.py b/Lib/idlelib/idle_test/test_editmenu.py new file mode 100644 --- /dev/null +++ b/Lib/idlelib/idle_test/test_editmenu.py @@ -0,0 +1,98 @@ +'''Test (selected) IDLE Edit menu items. + +Edit modules have their own test files files +''' +from test.test_support import requires +requires('gui') +import Tkinter as tk +import unittest +from idlelib import PyShell + +class PasteTest(unittest.TestCase): + '''Test pasting into widgets that allow pasting. + + On X11, replacing selections requires tk fix. + ''' + @classmethod + def setUpClass(cls): + cls.root = root = tk.Tk() + PyShell.fix_x11_paste(root) + cls.text = tk.Text(root) + cls.entry = tk.Entry(root) + cls.spin = tk.Spinbox(root) + root.clipboard_clear() + root.clipboard_append('two') + + @classmethod + def tearDownClass(cls): + del cls.text, cls.entry, cls.spin + cls.root.clipboard_clear() + cls.root.update_idletasks() + cls.root.update() + cls.root.destroy() + del cls.root + + def test_paste_text_no_selection(self): + "Test pasting into text without a selection." + text = self.text + tag, ans = '', 'onetwo\n' + text.delete('1.0', 'end') + text.insert('1.0', 'one', tag) + text.event_generate('<>') + self.assertEqual(text.get('1.0', 'end'), ans) + + def test_paste_text_selection(self): + "Test pasting into text with a selection." + text = self.text + tag, ans = 'sel', 'two\n' + text.delete('1.0', 'end') + text.insert('1.0', 'one', tag) + text.event_generate('<>') + self.assertEqual(text.get('1.0', 'end'), ans) + + def test_paste_entry_no_selection(self): + "Test pasting into an entry without a selection." + # On 3.6, generated <> fails without empty select range + # for 'no selection'. Live widget works fine. + entry = self.entry + end, ans = 0, 'onetwo' + entry.delete(0, 'end') + entry.insert(0, 'one') + entry.select_range(0, end) # see note + entry.event_generate('<>') + self.assertEqual(entry.get(), ans) + + def test_paste_entry_selection(self): + "Test pasting into an entry with a selection." + entry = self.entry + end, ans = 'end', 'two' + entry.delete(0, 'end') + entry.insert(0, 'one') + entry.select_range(0, end) + entry.event_generate('<>') + self.assertEqual(entry.get(), ans) + + def test_paste_spin_no_selection(self): + "Test pasting into a spinbox without a selection." + # See note above for entry. + spin = self.spin + end, ans = 0, 'onetwo' + spin.delete(0, 'end') + spin.insert(0, 'one') + spin.selection('range', 0, end) # see note + spin.event_generate('<>') + self.assertEqual(spin.get(), ans) + + def test_paste_spin_selection(self): + "Test pasting into a spinbox with a selection." + spin = self.spin + end, ans = 'end', 'two' + spin.delete(0, 'end') + spin.insert(0, 'one') + spin.selection('range', 0, end) + spin.event_generate('<>') + self.assertEqual(spin.get(), ans) + + +if __name__ == '__main__': + unittest.main(verbosity=2) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 02:06:59 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 11 Jun 2016 06:06:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_with_3=2E5?= Message-ID: <20160611060658.101550.57078.3364417F@psf.io> https://hg.python.org/cpython/rev/471193fe9dfd changeset: 101863:471193fe9dfd parent: 101860:99760b6a181e parent: 101862:f8b40e0d5913 user: Terry Jan Reedy date: Sat Jun 11 02:06:40 2016 -0400 summary: Merge with 3.5 files: Lib/idlelib/PyShell.py | 15 ++- Lib/idlelib/idle_test/test_editmenu.py | 71 ++++++++++++++ 2 files changed, 85 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 @@ -1403,6 +1403,17 @@ self.shell.close() +def fix_x11_paste(root): + "Make paste replace selection on x11. See issue #5124." + if root._windowingsystem == 'x11': + for cls in 'Text', 'Entry', 'Spinbox': + root.bind_class( + cls, + '<>', + 'catch {%W delete sel.first sel.last}\n' + + root.bind_class(cls, '<>')) + + usage_msg = """\ USAGE: idle [-deins] [-t title] [file]* @@ -1535,8 +1546,10 @@ 'editor-on-startup', type='bool') enable_edit = enable_edit or edit_start enable_shell = enable_shell or not enable_edit + # start editor and/or shell windows: root = Tk(className="Idle") + root.withdraw() # set application icon icondir = os.path.join(os.path.dirname(__file__), 'Icons') @@ -1551,7 +1564,7 @@ root.wm_iconphoto(True, *icons) fixwordbreaks(root) - root.withdraw() + fix_x11_paste(root) flist = PyShellFileList(root) macosx.setupApp(root, flist) diff --git a/Lib/idlelib/idle_test/test_editmenu.py b/Lib/idlelib/idle_test/test_editmenu.py new file mode 100644 --- /dev/null +++ b/Lib/idlelib/idle_test/test_editmenu.py @@ -0,0 +1,71 @@ +'''Test (selected) IDLE Edit menu items. + +Edit modules have their own test files files +''' +from test.support import requires +requires('gui') +import tkinter as tk +import unittest +from idlelib import PyShell + +class PasteTest(unittest.TestCase): + '''Test pasting into widgets that allow pasting. + + On X11, replacing selections requires tk fix. + ''' + @classmethod + def setUpClass(cls): + cls.root = root = tk.Tk() + PyShell.fix_x11_paste(root) + cls.text = tk.Text(root) + cls.entry = tk.Entry(root) + cls.spin = tk.Spinbox(root) + root.clipboard_clear() + root.clipboard_append('two') + + @classmethod + def tearDownClass(cls): + del cls.text, cls.entry, cls.spin + cls.root.clipboard_clear() + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def test_paste_text(self): + "Test pasting into text with and without a selection." + text = self.text + for tag, ans in ('', 'onetwo\n'), ('sel', 'two\n'): + with self.subTest(tag=tag, ans=ans): + text.delete('1.0', 'end') + text.insert('1.0', 'one', tag) + text.event_generate('<>') + self.assertEqual(text.get('1.0', 'end'), ans) + + def test_paste_entry(self): + "Test pasting into an entry with and without a selection." + # On 3.6, generated <> fails without empty select range + # for 'no selection'. Live widget works fine. + entry = self.entry + for end, ans in (0, 'onetwo'), ('end', 'two'): + with self.subTest(entry=entry, end=end, ans=ans): + entry.delete(0, 'end') + entry.insert(0, 'one') + entry.select_range(0, end) # see note + entry.event_generate('<>') + self.assertEqual(entry.get(), ans) + + def test_paste_spin(self): + "Test pasting into a spinbox with and without a selection." + # See note above for entry. + spin = self.spin + for end, ans in (0, 'onetwo'), ('end', 'two'): + with self.subTest(end=end, ans=ans): + spin.delete(0, 'end') + spin.insert(0, 'one') + spin.selection('range', 0, end) # see note + spin.event_generate('<>') + self.assertEqual(spin.get(), ans) + + +if __name__ == '__main__': + unittest.main(verbosity=2) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 02:11:18 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 11 Jun 2016 06:11:18 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=235124=3A_rename_Py?= =?utf-8?q?Shell_back_to_pyshell_and_patch_test_for_3=2E6?= Message-ID: <20160611061118.26389.59120.31C7D9A2@psf.io> https://hg.python.org/cpython/rev/095e79636663 changeset: 101864:095e79636663 user: Terry Jan Reedy date: Sat Jun 11 02:10:59 2016 -0400 summary: Issue #5124: rename PyShell back to pyshell and patch test for 3.6 files: Lib/idlelib/idle_test/test_editmenu.py | 28 +++++++------ Lib/idlelib/pyshell.py | 0 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Lib/idlelib/idle_test/test_editmenu.py b/Lib/idlelib/idle_test/test_editmenu.py --- a/Lib/idlelib/idle_test/test_editmenu.py +++ b/Lib/idlelib/idle_test/test_editmenu.py @@ -5,8 +5,9 @@ from test.support import requires requires('gui') import tkinter as tk +from tkinter import ttk import unittest -from idlelib import PyShell +from idlelib import pyshell class PasteTest(unittest.TestCase): '''Test pasting into widgets that allow pasting. @@ -16,16 +17,17 @@ @classmethod def setUpClass(cls): cls.root = root = tk.Tk() - PyShell.fix_x11_paste(root) + pyshell.fix_x11_paste(root) cls.text = tk.Text(root) cls.entry = tk.Entry(root) + cls.tentry = ttk.Entry(root) cls.spin = tk.Spinbox(root) root.clipboard_clear() root.clipboard_append('two') @classmethod def tearDownClass(cls): - del cls.text, cls.entry, cls.spin + del cls.text, cls.entry, cls.tentry cls.root.clipboard_clear() cls.root.update_idletasks() cls.root.destroy() @@ -43,16 +45,16 @@ def test_paste_entry(self): "Test pasting into an entry with and without a selection." - # On 3.6, generated <> fails without empty select range - # for 'no selection'. Live widget works fine. - entry = self.entry - for end, ans in (0, 'onetwo'), ('end', 'two'): - with self.subTest(entry=entry, end=end, ans=ans): - entry.delete(0, 'end') - entry.insert(0, 'one') - entry.select_range(0, end) # see note - entry.event_generate('<>') - self.assertEqual(entry.get(), ans) + # Generated <> fails for tk entry without empty select + # range for 'no selection'. Live widget works fine. + for entry in self.entry, self.tentry: + for end, ans in (0, 'onetwo'), ('end', 'two'): + with self.subTest(entry=entry, end=end, ans=ans): + entry.delete(0, 'end') + entry.insert(0, 'one') + entry.select_range(0, end) + entry.event_generate('<>') + self.assertEqual(entry.get(), ans) def test_paste_spin(self): "Test pasting into a spinbox with and without a selection." diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/pyshell.py rename from Lib/idlelib/PyShell.py rename to Lib/idlelib/pyshell.py -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 02:58:23 2016 From: python-checkins at python.org (ned.deily) Date: Sat, 11 Jun 2016 06:58:23 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327262=3A_fix_miss?= =?utf-8?q?ing_parameter_typo?= Message-ID: <20160611065823.19990.2350.C7526DBD@psf.io> https://hg.python.org/cpython/rev/374dd14cf0e5 changeset: 101865:374dd14cf0e5 user: Ned Deily date: Sat Jun 11 02:57:56 2016 -0400 summary: Issue #27262: fix missing parameter typo files: Lib/idlelib/macosx.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py --- a/Lib/idlelib/macosx.py +++ b/Lib/idlelib/macosx.py @@ -238,4 +238,4 @@ hideTkConsole(root) overrideRootMenu(root, flist) addOpenEventSupport(root, flist) - fixb2context() + fixb2context(root) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 04:32:50 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 11 Jun 2016 08:32:50 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzUxMjQ6?= =?utf-8?q?_NEWS_entries=2E?= Message-ID: <20160611083247.101725.38537.A1FA01DD@psf.io> https://hg.python.org/cpython/rev/62b949a179cb changeset: 101867:62b949a179cb branch: 3.5 parent: 101862:f8b40e0d5913 user: Terry Jan Reedy date: Sat Jun 11 04:31:22 2016 -0400 summary: Issue #5124: NEWS entries. files: Lib/idlelib/NEWS.txt | 4 ++++ Misc/NEWS | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -2,6 +2,10 @@ ========================= *Release date: 2016-06-30?* +- Issue #5124: Paste with text selected now replaces the selection on X11. + This matches how paste works on Windows, Mac, most modern Linux apps, + and ttk widgets. Original patch by Serhiy Storchaka. + - Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory is a private implementation of test.test_idle and tool for maintainers. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -523,6 +523,10 @@ IDLE ---- +- Issue #5124: Paste with text selected now replaces the selection on X11. + This matches how paste works on Windows, Mac, most modern Linux apps, + and ttk widgets. Original patch by Serhiy Storchaka. + - Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory is a private implementation of test.test_idle and tool for maintainers. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 04:32:50 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 11 Jun 2016 08:32:50 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzUxMjQ6?= =?utf-8?q?_NEWS_entries=2E?= Message-ID: <20160611083247.87602.20672.7834255F@psf.io> https://hg.python.org/cpython/rev/3017e41b0c99 changeset: 101866:3017e41b0c99 branch: 2.7 parent: 101861:6c469b50e198 user: Terry Jan Reedy date: Sat Jun 11 04:31:18 2016 -0400 summary: Issue #5124: NEWS entries. files: Lib/idlelib/NEWS.txt | 4 ++++ Misc/NEWS | 5 +++++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -2,6 +2,10 @@ ========================== *Release date: 2015-06-30?* +- Issue #5124: Paste with text selected now replaces the selection on X11. + This matches how paste works on Windows, Mac, most modern Linux apps, + and ttk widgets. Original patch by Serhiy Storchaka. + - Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory is a private implementation of test.test_idle and tool for maintainers. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -274,6 +274,11 @@ IDLE ---- + +- Issue #5124: Paste with text selected now replaces the selection on X11. + This matches how paste works on Windows, Mac, most modern Linux apps, + and ttk widgets. Original patch by Serhiy Storchaka. + - Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory is a private implementation of test.test_idle and tool for maintainers. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 04:32:50 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 11 Jun 2016 08:32:50 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_Issue_=235124=3A_NEWS_entries=2E?= Message-ID: <20160611083248.81260.7715.4742346B@psf.io> https://hg.python.org/cpython/rev/2fc15579606b changeset: 101868:2fc15579606b parent: 101865:374dd14cf0e5 parent: 101867:62b949a179cb user: Terry Jan Reedy date: Sat Jun 11 04:32:30 2016 -0400 summary: Merge Issue #5124: NEWS entries. files: Lib/idlelib/NEWS.txt | 4 ++++ Misc/NEWS | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -2,6 +2,10 @@ =========================== *Release date: 2016-09-??* +- Issue #5124: Paste with text selected now replaces the selection on X11. + This matches how paste works on Windows, Mac, most modern Linux apps, + and ttk widgets. Original patch by Serhiy Storchaka. + - Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory is a private implementation of test.test_idle and tool for maintainers. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -135,6 +135,10 @@ IDLE ---- +- Issue #5124: Paste with text selected now replaces the selection on X11. + This matches how paste works on Windows, Mac, most modern Linux apps, + and ttk widgets. Original patch by Serhiy Storchaka. + - Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory is a private implementation of test.test_idle and tool for maintainers. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 04:36:52 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 11 Jun 2016 08:36:52 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_IDLE_NEWS_entries?= Message-ID: <20160611083652.26579.40812.6381B8FE@psf.io> https://hg.python.org/cpython/rev/77604a2f019b changeset: 101869:77604a2f019b user: Terry Jan Reedy date: Sat Jun 11 04:36:34 2016 -0400 summary: IDLE NEWS entries files: Lib/idlelib/NEWS.txt | 11 +++++++++++ Misc/NEWS | 11 +++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -6,6 +6,17 @@ This matches how paste works on Windows, Mac, most modern Linux apps, and ttk widgets. Original patch by Serhiy Storchaka. +- Issue #24750: Switch all scrollbars in IDLE to ttk versions. + Where needed, minimal tests are added to cover changes. + +- Issue #24759: IDLE requires tk 8.5 and availability ttk widgets. + Delete now unneeded tk version tests and code for older versions. + Add test for IDLE syntax colorizer. + +- Issue #27239: idlelib.macosx.isXyzTk functions initialize as needed. + +- Issue #27262: move Aqua unbinding code, which enable context menus, to maxosx. + - Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory is a private implementation of test.test_idle and tool for maintainers. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -139,6 +139,17 @@ This matches how paste works on Windows, Mac, most modern Linux apps, and ttk widgets. Original patch by Serhiy Storchaka. +- Issue #24750: Switch all scrollbars in IDLE to ttk versions. + Where needed, minimal tests are added to cover changes. + +- Issue #24759: IDLE requires tk 8.5 and availability ttk widgets. + Delete now unneeded tk version tests and code for older versions. + Add test for IDLE syntax colorizoer. + +- Issue #27239: idlelib.macosx.isXyzTk functions initialize as needed. + +- Issue #27262: move Aqua unbinding code, which enable context menus, to maxosx. + - Issue #24759: Make clear in idlelib.idle_test.__init__ that the directory is a private implementation of test.test_idle and tool for maintainers. -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Sat Jun 11 04:53:00 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 11 Jun 2016 08:53:00 +0000 Subject: [Python-checkins] Daily reference leaks (288e97680d84): sum=2 Message-ID: <20160611085300.20039.5189.C1D7DC48@psf.io> results for 288e97680d84 on branch "default" -------------------------------------------- test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_fork leaked [0, 0, -2] memory blocks, sum=-2 test_multiprocessing_forkserver leaked [0, -2, 2] memory blocks, sum=0 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogLRgwRU', '--timeout', '7200'] From python-checkins at python.org Sat Jun 11 11:20:57 2016 From: python-checkins at python.org (yury.selivanov) Date: Sat, 11 Jun 2016 15:20:57 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy41IChpc3N1ZSAjMjcyMjMp?= Message-ID: <20160611152056.27813.82912.9D7F22D3@psf.io> https://hg.python.org/cpython/rev/d56b3e5ebfe2 changeset: 101871:d56b3e5ebfe2 parent: 101869:77604a2f019b parent: 101870:9512cfd53903 user: Yury Selivanov date: Sat Jun 11 11:20:50 2016 -0400 summary: Merge 3.5 (issue #27223) files: Lib/asyncio/selector_events.py | 11 +++ Lib/test/test_asyncio/test_selector_events.py | 30 ++++----- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -569,6 +569,7 @@ self._loop.remove_reader(self._sock_fd) if not self._buffer: self._conn_lost += 1 + self._loop.remove_writer(self._sock_fd) self._loop.call_soon(self._call_connection_lost, None) # On Python 3.3 and older, objects with a destructor part of a reference @@ -663,6 +664,8 @@ logger.debug("%r resumes reading", self) def _read_ready(self): + if self._conn_lost: + return try: data = self._sock.recv(self.max_size) except (BlockingIOError, InterruptedError): @@ -722,6 +725,8 @@ def _write_ready(self): assert self._buffer, 'Data should not be empty' + if self._conn_lost: + return try: n = self._sock.send(self._buffer) except (BlockingIOError, InterruptedError): @@ -892,6 +897,8 @@ logger.debug("%r resumes reading", self) def _read_ready(self): + if self._conn_lost: + return if self._write_wants_read: self._write_wants_read = False self._write_ready() @@ -924,6 +931,8 @@ self.close() def _write_ready(self): + if self._conn_lost: + return if self._read_wants_write: self._read_wants_write = False self._read_ready() @@ -1001,6 +1010,8 @@ return sum(len(data) for data, _ in self._buffer) def _read_ready(self): + if self._conn_lost: + return try: data, addr = self._sock.recvfrom(self.max_size) except (BlockingIOError, InterruptedError): diff --git a/Lib/test/test_asyncio/test_selector_events.py b/Lib/test/test_asyncio/test_selector_events.py --- a/Lib/test/test_asyncio/test_selector_events.py +++ b/Lib/test/test_asyncio/test_selector_events.py @@ -1087,17 +1087,6 @@ err, 'Fatal write error on socket transport') - @mock.patch('asyncio.base_events.logger') - def test_write_ready_exception_and_close(self, m_log): - self.sock.send.side_effect = OSError() - remove_writer = self.loop.remove_writer = mock.Mock() - - transport = self.socket_transport() - transport.close() - transport._buffer.extend(b'data') - transport._write_ready() - remove_writer.assert_called_with(self.sock_fd) - def test_write_eof(self): tr = self.socket_transport() self.assertTrue(tr.can_write_eof()) @@ -1121,6 +1110,14 @@ self.sock.shutdown.assert_called_with(socket.SHUT_WR) tr.close() + @mock.patch('asyncio.base_events.logger') + def test_transport_close_remove_writer(self, m_log): + remove_writer = self.loop.remove_writer = mock.Mock() + + transport = self.socket_transport() + transport.close() + remove_writer.assert_called_with(self.sock_fd) + @unittest.skipIf(ssl is None, 'No ssl module') class SelectorSslTransportTests(test_utils.TestCase): @@ -1175,7 +1172,7 @@ self.sslsock.do_handshake.side_effect = exc with test_utils.disable_logger(): waiter = asyncio.Future(loop=self.loop) - transport = self.ssl_transport(waiter=waiter) + self.ssl_transport(waiter=waiter) self.assertTrue(waiter.done()) self.assertIs(exc, waiter.exception()) self.assertTrue(self.sslsock.close.called) @@ -1374,20 +1371,19 @@ def test_write_ready_send_closing(self): self.sslsock.send.return_value = 4 transport = self._make_one() + transport._buffer = list_to_buffer([b'data']) transport.close() - transport._buffer = list_to_buffer([b'data']) transport._write_ready() - self.assertFalse(self.loop.writers) self.protocol.connection_lost.assert_called_with(None) def test_write_ready_send_closing_empty_buffer(self): self.sslsock.send.return_value = 4 + call_soon = self.loop.call_soon = mock.Mock() transport = self._make_one() + transport._buffer = list_to_buffer() transport.close() - transport._buffer = list_to_buffer() transport._write_ready() - self.assertFalse(self.loop.writers) - self.protocol.connection_lost.assert_called_with(None) + call_soon.assert_called_with(transport._call_connection_lost, None) def test_write_ready_send_retry(self): transport = self._make_one() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 11:20:57 2016 From: python-checkins at python.org (yury.selivanov) Date: Sat, 11 Jun 2016 15:20:57 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MjIz?= =?utf-8?q?=3A_aio=3A_Fix_=5Fread=5Fready_and_=5Fwrite=5Fready_to_respect_?= =?utf-8?b?X2Nvbm5fbG9zdC4=?= Message-ID: <20160611152056.87602.29505.9A5BA759@psf.io> https://hg.python.org/cpython/rev/9512cfd53903 changeset: 101870:9512cfd53903 branch: 3.5 parent: 101867:62b949a179cb user: Yury Selivanov date: Sat Jun 11 11:19:47 2016 -0400 summary: Issue #27223: aio: Fix _read_ready and _write_ready to respect _conn_lost. Patch by ?ukasz Langa. files: Lib/asyncio/selector_events.py | 11 +++ Lib/test/test_asyncio/test_selector_events.py | 30 ++++----- Misc/NEWS | 6 +- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -569,6 +569,7 @@ self._loop.remove_reader(self._sock_fd) if not self._buffer: self._conn_lost += 1 + self._loop.remove_writer(self._sock_fd) self._loop.call_soon(self._call_connection_lost, None) # On Python 3.3 and older, objects with a destructor part of a reference @@ -662,6 +663,8 @@ logger.debug("%r resumes reading", self) def _read_ready(self): + if self._conn_lost: + return try: data = self._sock.recv(self.max_size) except (BlockingIOError, InterruptedError): @@ -721,6 +724,8 @@ def _write_ready(self): assert self._buffer, 'Data should not be empty' + if self._conn_lost: + return try: n = self._sock.send(self._buffer) except (BlockingIOError, InterruptedError): @@ -891,6 +896,8 @@ logger.debug("%r resumes reading", self) def _read_ready(self): + if self._conn_lost: + return if self._write_wants_read: self._write_wants_read = False self._write_ready() @@ -923,6 +930,8 @@ self.close() def _write_ready(self): + if self._conn_lost: + return if self._read_wants_write: self._read_wants_write = False self._read_ready() @@ -1000,6 +1009,8 @@ return sum(len(data) for data, _ in self._buffer) def _read_ready(self): + if self._conn_lost: + return try: data, addr = self._sock.recvfrom(self.max_size) except (BlockingIOError, InterruptedError): diff --git a/Lib/test/test_asyncio/test_selector_events.py b/Lib/test/test_asyncio/test_selector_events.py --- a/Lib/test/test_asyncio/test_selector_events.py +++ b/Lib/test/test_asyncio/test_selector_events.py @@ -1087,17 +1087,6 @@ err, 'Fatal write error on socket transport') - @mock.patch('asyncio.base_events.logger') - def test_write_ready_exception_and_close(self, m_log): - self.sock.send.side_effect = OSError() - remove_writer = self.loop.remove_writer = mock.Mock() - - transport = self.socket_transport() - transport.close() - transport._buffer.extend(b'data') - transport._write_ready() - remove_writer.assert_called_with(self.sock_fd) - def test_write_eof(self): tr = self.socket_transport() self.assertTrue(tr.can_write_eof()) @@ -1121,6 +1110,14 @@ self.sock.shutdown.assert_called_with(socket.SHUT_WR) tr.close() + @mock.patch('asyncio.base_events.logger') + def test_transport_close_remove_writer(self, m_log): + remove_writer = self.loop.remove_writer = mock.Mock() + + transport = self.socket_transport() + transport.close() + remove_writer.assert_called_with(self.sock_fd) + @unittest.skipIf(ssl is None, 'No ssl module') class SelectorSslTransportTests(test_utils.TestCase): @@ -1175,7 +1172,7 @@ self.sslsock.do_handshake.side_effect = exc with test_utils.disable_logger(): waiter = asyncio.Future(loop=self.loop) - transport = self.ssl_transport(waiter=waiter) + self.ssl_transport(waiter=waiter) self.assertTrue(waiter.done()) self.assertIs(exc, waiter.exception()) self.assertTrue(self.sslsock.close.called) @@ -1374,20 +1371,19 @@ def test_write_ready_send_closing(self): self.sslsock.send.return_value = 4 transport = self._make_one() + transport._buffer = list_to_buffer([b'data']) transport.close() - transport._buffer = list_to_buffer([b'data']) transport._write_ready() - self.assertFalse(self.loop.writers) self.protocol.connection_lost.assert_called_with(None) def test_write_ready_send_closing_empty_buffer(self): self.sslsock.send.return_value = 4 + call_soon = self.loop.call_soon = mock.Mock() transport = self._make_one() + transport._buffer = list_to_buffer() transport.close() - transport._buffer = list_to_buffer() transport._write_ready() - self.assertFalse(self.loop.writers) - self.protocol.connection_lost.assert_called_with(None) + call_soon.assert_called_with(transport._call_connection_lost, None) def test_write_ready_send_retry(self): transport = self._make_one() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -520,6 +520,10 @@ - Issue #27041: asyncio: Add loop.create_future method +- Issue #27223: asyncio: Fix _read_ready and _write_ready to respect + _conn_lost. + Patch by ?ukasz Langa. + IDLE ---- @@ -709,7 +713,7 @@ Misc ---- -- Issue #17500, and https://github.com/python/pythondotorg/issues/945: Remove +- Issue #17500, and https://github.com/python/pythondotorg/issues/945: Remove unused and outdated icons. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 12:01:28 2016 From: python-checkins at python.org (yury.selivanov) Date: Sat, 11 Jun 2016 16:01:28 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIyOTcw?= =?utf-8?q?=3A_asyncio=3A_Fix_inconsistency_cancelling_Condition=2Ewait=2E?= Message-ID: <20160611160126.120747.76310.F54743B5@psf.io> https://hg.python.org/cpython/rev/0bda9bc443ce changeset: 101872:0bda9bc443ce branch: 3.5 parent: 101870:9512cfd53903 user: Yury Selivanov date: Sat Jun 11 12:00:07 2016 -0400 summary: Issue #22970: asyncio: Fix inconsistency cancelling Condition.wait. Patch by David Coles. files: Lib/asyncio/locks.py | 8 ++++- Lib/test/test_asyncio/test_locks.py | 25 +++++++++++++++++ Misc/NEWS | 3 ++ 3 files changed, 35 insertions(+), 1 deletions(-) diff --git a/Lib/asyncio/locks.py b/Lib/asyncio/locks.py --- a/Lib/asyncio/locks.py +++ b/Lib/asyncio/locks.py @@ -329,7 +329,13 @@ self._waiters.remove(fut) finally: - yield from self.acquire() + # Must reacquire lock even if wait is cancelled + while True: + try: + yield from self.acquire() + break + except futures.CancelledError: + pass @coroutine def wait_for(self, predicate): diff --git a/Lib/test/test_asyncio/test_locks.py b/Lib/test/test_asyncio/test_locks.py --- a/Lib/test/test_asyncio/test_locks.py +++ b/Lib/test/test_asyncio/test_locks.py @@ -457,6 +457,31 @@ self.assertFalse(cond._waiters) self.assertTrue(cond.locked()) + def test_wait_cancel_contested(self): + cond = asyncio.Condition(loop=self.loop) + + self.loop.run_until_complete(cond.acquire()) + self.assertTrue(cond.locked()) + + wait_task = asyncio.Task(cond.wait(), loop=self.loop) + test_utils.run_briefly(self.loop) + self.assertFalse(cond.locked()) + + # Notify, but contest the lock before cancelling + self.loop.run_until_complete(cond.acquire()) + self.assertTrue(cond.locked()) + cond.notify() + self.loop.call_soon(wait_task.cancel) + self.loop.call_soon(cond.release) + + try: + self.loop.run_until_complete(wait_task) + except asyncio.CancelledError: + # Should not happen, since no cancellation points + pass + + self.assertTrue(cond.locked()) + def test_wait_unacquired(self): cond = asyncio.Condition(loop=self.loop) self.assertRaises( diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -524,6 +524,9 @@ _conn_lost. Patch by ?ukasz Langa. +- Issue #22970: asyncio: Fix inconsistency cancelling Condition.wait. + Patch by David Coles. + IDLE ---- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 12:01:28 2016 From: python-checkins at python.org (yury.selivanov) Date: Sat, 11 Jun 2016 16:01:28 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy41IChpc3N1ZSAjMjI5NzAp?= Message-ID: <20160611160126.99162.21296.23C92E5F@psf.io> https://hg.python.org/cpython/rev/00a9de0f3fdc changeset: 101873:00a9de0f3fdc parent: 101871:d56b3e5ebfe2 parent: 101872:0bda9bc443ce user: Yury Selivanov date: Sat Jun 11 12:01:19 2016 -0400 summary: Merge 3.5 (issue #22970) files: Lib/asyncio/locks.py | 8 ++++- Lib/test/test_asyncio/test_locks.py | 25 +++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletions(-) diff --git a/Lib/asyncio/locks.py b/Lib/asyncio/locks.py --- a/Lib/asyncio/locks.py +++ b/Lib/asyncio/locks.py @@ -329,7 +329,13 @@ self._waiters.remove(fut) finally: - yield from self.acquire() + # Must reacquire lock even if wait is cancelled + while True: + try: + yield from self.acquire() + break + except futures.CancelledError: + pass @coroutine def wait_for(self, predicate): diff --git a/Lib/test/test_asyncio/test_locks.py b/Lib/test/test_asyncio/test_locks.py --- a/Lib/test/test_asyncio/test_locks.py +++ b/Lib/test/test_asyncio/test_locks.py @@ -457,6 +457,31 @@ self.assertFalse(cond._waiters) self.assertTrue(cond.locked()) + def test_wait_cancel_contested(self): + cond = asyncio.Condition(loop=self.loop) + + self.loop.run_until_complete(cond.acquire()) + self.assertTrue(cond.locked()) + + wait_task = asyncio.Task(cond.wait(), loop=self.loop) + test_utils.run_briefly(self.loop) + self.assertFalse(cond.locked()) + + # Notify, but contest the lock before cancelling + self.loop.run_until_complete(cond.acquire()) + self.assertTrue(cond.locked()) + cond.notify() + self.loop.call_soon(wait_task.cancel) + self.loop.call_soon(cond.release) + + try: + self.loop.run_until_complete(wait_task) + except asyncio.CancelledError: + # Should not happen, since no cancellation points + pass + + self.assertTrue(cond.locked()) + def test_wait_unacquired(self): cond = asyncio.Condition(loop=self.loop) self.assertRaises( -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 12:15:27 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 11 Jun 2016 16:15:27 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327030=3A_Unknown_?= =?utf-8?q?escapes_consisting_of_=60=60=27=5C=27=60=60_and_ASCII_letter_in?= Message-ID: <20160611161527.28132.67992.F5246E00@psf.io> https://hg.python.org/cpython/rev/09d1af3fe332 changeset: 101874:09d1af3fe332 user: Serhiy Storchaka date: Sat Jun 11 19:15:00 2016 +0300 summary: Issue #27030: Unknown escapes consisting of ``'\'`` and ASCII letter in regular expressions now are errors. files: Doc/library/re.rst | 23 +++++++-------- Lib/sre_parse.py | 49 +++----------------------------- Lib/test/test_re.py | 41 ++++++++------------------ Misc/NEWS | 3 ++ 4 files changed, 32 insertions(+), 84 deletions(-) diff --git a/Doc/library/re.rst b/Doc/library/re.rst --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -317,8 +317,9 @@ The special sequences consist of ``'\'`` and a character from the list below. -If the ordinary character is not on the list, then the resulting RE will match -the second character. For example, ``\$`` matches the character ``'$'``. +If the ordinary character is not ASCII digit or ASCII letter, then the +resulting RE will match the second character. For example, ``\$`` matches the +character ``'$'``. ``\number`` Matches the contents of the group of the same number. Groups are numbered @@ -438,9 +439,8 @@ .. versionchanged:: 3.3 The ``'\u'`` and ``'\U'`` escape sequences have been added. -.. deprecated-removed:: 3.5 3.6 - Unknown escapes consist of ``'\'`` and ASCII letter now raise a - deprecation warning and will be forbidden in Python 3.6. +.. versionchanged:: 3.6 + Unknown escapes consisting of ``'\'`` and ASCII letter now are errors. .. seealso:: @@ -528,11 +528,11 @@ current locale. The use of this flag is discouraged as the locale mechanism is very unreliable, and it only handles one "culture" at a time anyway; you should use Unicode matching instead, which is the default in Python 3 - for Unicode (str) patterns. This flag makes sense only with bytes patterns. + for Unicode (str) patterns. This flag can be used only with bytes patterns. - .. deprecated-removed:: 3.5 3.6 - Deprecated the use of :const:`re.LOCALE` with string patterns or - :const:`re.ASCII`. + .. versionchanged:: 3.6 + :const:`re.LOCALE` can be used only with bytes patterns and is + not compatible with :const:`re.ASCII`. .. data:: M @@ -738,9 +738,8 @@ .. versionchanged:: 3.5 Unmatched groups are replaced with an empty string. - .. deprecated-removed:: 3.5 3.6 - Unknown escapes consist of ``'\'`` and ASCII letter now raise a - deprecation warning and will be forbidden in Python 3.6. + .. versionchanged:: 3.6 + Unknown escapes consisting of ``'\'`` and ASCII letter now are errors. .. function:: subn(pattern, repl, string, count=0, flags=0) diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -282,33 +282,6 @@ def error(self, msg, offset=0): return error(msg, self.string, self.tell() - offset) -# The following three functions are not used in this module anymore, but we keep -# them here (with DeprecationWarnings) for backwards compatibility. - -def isident(char): - import warnings - warnings.warn('sre_parse.isident() will be removed in 3.5', - DeprecationWarning, stacklevel=2) - return "a" <= char <= "z" or "A" <= char <= "Z" or char == "_" - -def isdigit(char): - import warnings - warnings.warn('sre_parse.isdigit() will be removed in 3.5', - DeprecationWarning, stacklevel=2) - return "0" <= char <= "9" - -def isname(name): - import warnings - warnings.warn('sre_parse.isname() will be removed in 3.5', - DeprecationWarning, stacklevel=2) - # check that group name is a valid string - if not isident(name[0]): - return False - for char in name[1:]: - if not isident(char) and not isdigit(char): - return False - return True - def _class_escape(source, escape): # handle escape code inside character class code = ESCAPES.get(escape) @@ -351,9 +324,7 @@ raise ValueError if len(escape) == 2: if c in ASCIILETTERS: - import warnings - warnings.warn('bad escape %s' % escape, - DeprecationWarning, stacklevel=8) + raise source.error('bad escape %s' % escape, len(escape)) return LITERAL, ord(escape[1]) except ValueError: pass @@ -418,9 +389,7 @@ raise source.error("invalid group reference", len(escape)) if len(escape) == 2: if c in ASCIILETTERS: - import warnings - warnings.warn('bad escape %s' % escape, - DeprecationWarning, stacklevel=8) + raise source.error("bad escape %s" % escape, len(escape)) return LITERAL, ord(escape[1]) except ValueError: pass @@ -798,10 +767,7 @@ # Check and fix flags according to the type of pattern (str or bytes) if isinstance(src, str): if flags & SRE_FLAG_LOCALE: - import warnings - warnings.warn("LOCALE flag with a str pattern is deprecated. " - "Will be an error in 3.6", - DeprecationWarning, stacklevel=6) + raise ValueError("cannot use LOCALE flag with a str pattern") if not flags & SRE_FLAG_ASCII: flags |= SRE_FLAG_UNICODE elif flags & SRE_FLAG_UNICODE: @@ -810,10 +776,7 @@ if flags & SRE_FLAG_UNICODE: raise ValueError("cannot use UNICODE flag with a bytes pattern") if flags & SRE_FLAG_LOCALE and flags & SRE_FLAG_ASCII: - import warnings - warnings.warn("ASCII and LOCALE flags are incompatible. " - "Will be an error in 3.6", - DeprecationWarning, stacklevel=6) + raise ValueError("ASCII and LOCALE flags are incompatible") return flags def parse(str, flags=0, pattern=None): @@ -914,9 +877,7 @@ this = chr(ESCAPES[this][1]) except KeyError: if c in ASCIILETTERS: - import warnings - warnings.warn('bad escape %s' % this, - DeprecationWarning, stacklevel=4) + raise s.error('bad escape %s' % this, len(this)) lappend(this) else: lappend(this) diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -124,7 +124,7 @@ (chr(9)+chr(10)+chr(11)+chr(13)+chr(12)+chr(7)+chr(8))) for c in 'cdehijklmopqsuwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ': with self.subTest(c): - with self.assertWarns(DeprecationWarning): + with self.assertRaises(re.error): self.assertEqual(re.sub('a', '\\' + c, 'a'), '\\' + c) self.assertEqual(re.sub('^\s*', 'X', 'test'), 'Xtest') @@ -633,14 +633,10 @@ re.purge() # for warnings for c in 'ceghijklmopqyzCEFGHIJKLMNOPQRTVXY': with self.subTest(c): - with self.assertWarns(DeprecationWarning): - self.assertEqual(re.fullmatch('\\%c' % c, c).group(), c) - self.assertIsNone(re.match('\\%c' % c, 'a')) + self.assertRaises(re.error, re.compile, '\\%c' % c) for c in 'ceghijklmopqyzABCEFGHIJKLMNOPQRTVXYZ': with self.subTest(c): - with self.assertWarns(DeprecationWarning): - self.assertEqual(re.fullmatch('[\\%c]' % c, c).group(), c) - self.assertIsNone(re.match('[\\%c]' % c, 'a')) + self.assertRaises(re.error, re.compile, '[\\%c]' % c) def test_string_boundaries(self): # See http://bugs.python.org/issue10713 @@ -993,10 +989,8 @@ self.assertTrue(re.match((r"\x%02x" % i).encode(), bytes([i]))) self.assertTrue(re.match((r"\x%02x0" % i).encode(), bytes([i])+b"0")) self.assertTrue(re.match((r"\x%02xz" % i).encode(), bytes([i])+b"z")) - with self.assertWarns(DeprecationWarning): - self.assertTrue(re.match(br"\u1234", b'u1234')) - with self.assertWarns(DeprecationWarning): - self.assertTrue(re.match(br"\U00012345", b'U00012345')) + self.assertRaises(re.error, re.compile, br"\u1234") + self.assertRaises(re.error, re.compile, br"\U00012345") self.assertTrue(re.match(br"\0", b"\000")) self.assertTrue(re.match(br"\08", b"\0008")) self.assertTrue(re.match(br"\01", b"\001")) @@ -1018,10 +1012,8 @@ self.assertTrue(re.match((r"[\x%02x]" % i).encode(), bytes([i]))) self.assertTrue(re.match((r"[\x%02x0]" % i).encode(), bytes([i]))) self.assertTrue(re.match((r"[\x%02xz]" % i).encode(), bytes([i]))) - with self.assertWarns(DeprecationWarning): - self.assertTrue(re.match(br"[\u1234]", b'u')) - with self.assertWarns(DeprecationWarning): - self.assertTrue(re.match(br"[\U00012345]", b'U')) + self.assertRaises(re.error, re.compile, br"[\u1234]") + self.assertRaises(re.error, re.compile, br"[\U00012345]") self.checkPatternError(br"[\567]", r'octal escape value \567 outside of ' r'range 0-0o377', 1) @@ -1363,12 +1355,12 @@ if bletter: self.assertIsNone(pat.match(bletter)) # Incompatibilities - self.assertWarns(DeprecationWarning, re.compile, '', re.LOCALE) - self.assertWarns(DeprecationWarning, re.compile, '(?L)') - self.assertWarns(DeprecationWarning, re.compile, b'', re.LOCALE | re.ASCII) - self.assertWarns(DeprecationWarning, re.compile, b'(?L)', re.ASCII) - self.assertWarns(DeprecationWarning, re.compile, b'(?a)', re.LOCALE) - self.assertWarns(DeprecationWarning, re.compile, b'(?aL)') + self.assertRaises(ValueError, re.compile, '', re.LOCALE) + self.assertRaises(ValueError, re.compile, '(?L)') + self.assertRaises(ValueError, re.compile, b'', re.LOCALE | re.ASCII) + self.assertRaises(ValueError, re.compile, b'(?L)', re.ASCII) + self.assertRaises(ValueError, re.compile, b'(?a)', re.LOCALE) + self.assertRaises(ValueError, re.compile, b'(?aL)') def test_bug_6509(self): # Replacement strings of both types must parse properly. @@ -1419,13 +1411,6 @@ # Test behaviour when not given a string or pattern as parameter self.assertRaises(TypeError, re.compile, 0) - def test_bug_13899(self): - # Issue #13899: re pattern r"[\A]" should work like "A" but matches - # nothing. Ditto B and Z. - with self.assertWarns(DeprecationWarning): - self.assertEqual(re.findall(r'[\A\B\b\C\Z]', 'AB\bCZ'), - ['A', 'B', '\b', 'C', 'Z']) - @bigmemtest(size=_2G, memuse=1) def test_large_search(self, size): # Issue #10182: indices were 32-bit-truncated. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -38,6 +38,9 @@ Library ------- +- Issue #27030: Unknown escapes consisting of ``'\'`` and ASCII letter in + regular expressions now are errors. + - Issue #27186: Add os.PathLike support to DirEntry (part of PEP 519). Initial patch by Jelle Zijlstra. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 12:24:45 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 11 Jun 2016 16:24:45 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327030=3A_The_re?= =?utf-8?q?=2ELOCALE_flag_now_can_be_used_only_with_bytes_patterns=2E?= Message-ID: <20160611162445.28277.16578.DB5476FB@psf.io> https://hg.python.org/cpython/rev/8ed3880e94e5 changeset: 101875:8ed3880e94e5 user: Serhiy Storchaka date: Sat Jun 11 19:24:24 2016 +0300 summary: Issue #27030: The re.LOCALE flag now can be used only with bytes patterns. (Just updated NEWS.) files: Misc/NEWS | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -39,7 +39,8 @@ ------- - Issue #27030: Unknown escapes consisting of ``'\'`` and ASCII letter in - regular expressions now are errors. + regular expressions now are errors. The re.LOCALE flag now can be used + only with bytes patterns. - Issue #27186: Add os.PathLike support to DirEntry (part of PEP 519). Initial patch by Jelle Zijlstra. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 12:33:12 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 11 Jun 2016 16:33:12 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327029=3A_Removed_?= =?utf-8?q?deprecated_support_of_universal_newlines_mode_from?= Message-ID: <20160611163311.101555.92146.86262E67@psf.io> https://hg.python.org/cpython/rev/bf8773b054cb changeset: 101876:bf8773b054cb user: Serhiy Storchaka date: Sat Jun 11 19:32:44 2016 +0300 summary: Issue #27029: Removed deprecated support of universal newlines mode from ZipFile.open(). files: Doc/library/zipfile.rst | 21 +-- Doc/whatsnew/3.6.rst | 5 + Lib/test/test_zipfile.py | 167 +-------------------------- Lib/zipfile.py | 50 +------- Misc/NEWS | 3 + 5 files changed, 24 insertions(+), 222 deletions(-) diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -204,18 +204,13 @@ Return a list of archive members by name. -.. index:: - single: universal newlines; zipfile.ZipFile.open method - .. method:: ZipFile.open(name, mode='r', pwd=None, *, force_zip64=False) - Access a member of the archive as a file-like object. *name* - is the name of the file in the archive, or a :class:`ZipInfo` object. The - *mode* parameter, if included, must be one of the following: ``'r'`` (the - default), ``'U'``, ``'rU'`` or ``'w'``. Choosing ``'U'`` or ``'rU'`` will - enable :term:`universal newlines` support in the read-only object. *pwd* is - the password used to decrypt encrypted ZIP files. Calling :meth:`.open` on - a closed ZipFile will raise a :exc:`RuntimeError`. + Access a member of the archive as a binary file-like object. *name* + can be either the name of a file within the archive or a :class:`ZipInfo` + object. The *mode* parameter, if included, must be ``'r'`` (the default) + or ``'w'``. *pwd* is the password used to decrypt encrypted ZIP files. + Calling :meth:`.open` on a closed ZipFile will raise a :exc:`RuntimeError`. :meth:`~ZipFile.open` is also a context manager and therefore supports the :keyword:`with` statement:: @@ -224,7 +219,7 @@ with myzip.open('eggs.txt') as myfile: print(myfile.read()) - With *mode* ``'r'``, ``'U'`` or ``'rU'``, the file-like object + With *mode* ``'r'`` the file-like object (``ZipExtFile``) is read-only and provides the following methods: :meth:`~io.BufferedIOBase.read`, :meth:`~io.IOBase.readline`, :meth:`~io.IOBase.readlines`, :meth:`__iter__`, @@ -248,8 +243,8 @@ or a :class:`ZipInfo` object. You will appreciate this when trying to read a ZIP file that contains members with duplicate names. - .. deprecated-removed:: 3.4 3.6 - The ``'U'`` or ``'rU'`` mode. Use :class:`io.TextIOWrapper` for reading + .. versionchanged:: 3.6 + Removed support of ``mode='U'``. Use :class:`io.TextIOWrapper` for reading compressed text files in :term:`universal newlines` mode. .. versionchanged:: 3.6 diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -580,6 +580,11 @@ :mod:`tkinter` widget classes were removed (corresponding Tk commands were obsolete since Tk 4.0). +* The :meth:`~zipfile.ZipFile.open` method of the :class:`zipfile.ZipFile` + class no longer supports the ``'U'`` mode (was deprecated since Python 3.4). + Use :class:`io.TextIOWrapper` for reading compressed text files in + :term:`universal newlines` mode. + Porting to Python 3.6 ===================== diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py --- a/Lib/test/test_zipfile.py +++ b/Lib/test/test_zipfile.py @@ -38,10 +38,6 @@ yield f test.assertFalse(f.closed) -def openU(zipfp, fn): - with check_warnings(('', DeprecationWarning)): - return zipfp.open(fn, 'rU') - class AbstractTestsWithSourceFile: @classmethod def setUpClass(cls): @@ -1035,32 +1031,6 @@ data += zipfp.read(info) self.assertIn(data, {b"foobar", b"barfoo"}) - def test_universal_deprecation(self): - f = io.BytesIO() - with zipfile.ZipFile(f, "w") as zipfp: - zipfp.writestr('spam.txt', b'ababagalamaga') - - with zipfile.ZipFile(f, "r") as zipfp: - for mode in 'U', 'rU': - with self.assertWarns(DeprecationWarning): - zipopen = zipfp.open('spam.txt', mode) - zipopen.close() - - def test_universal_readaheads(self): - f = io.BytesIO() - - data = b'a\r\n' * 16 * 1024 - with zipfile.ZipFile(f, 'w', zipfile.ZIP_STORED) as zipfp: - zipfp.writestr(TESTFN, data) - - data2 = b'' - with zipfile.ZipFile(f, 'r') as zipfp, \ - openU(zipfp, TESTFN) as zipopen: - for line in zipopen: - data2 += line - - self.assertEqual(data, data2.replace(b'\n', b'\r\n')) - def test_writestr_extended_local_header_issue1202(self): with zipfile.ZipFile(TESTFN2, 'w') as orig_zip: for data in 'abcdefghijklmnop': @@ -1268,9 +1238,12 @@ zipf.writestr("foo.txt", "O, for a Muse of Fire!") with zipfile.ZipFile(TESTFN, mode="r") as zipf: - # read the data to make sure the file is there + # read the data to make sure the file is there zipf.read("foo.txt") self.assertRaises(RuntimeError, zipf.open, "foo.txt", "q") + # universal newlines support is removed + self.assertRaises(RuntimeError, zipf.open, "foo.txt", "U") + self.assertRaises(RuntimeError, zipf.open, "foo.txt", "rU") def test_read0(self): """Check that calling read(0) on a ZipExtFile object returns an empty @@ -2011,138 +1984,6 @@ unlink(TESTFN) -class AbstractUniversalNewlineTests: - @classmethod - def setUpClass(cls): - cls.line_gen = [bytes("Test of zipfile line %d." % i, "ascii") - for i in range(FIXEDTEST_SIZE)] - cls.seps = (b'\r', b'\r\n', b'\n') - cls.arcdata = {} - for n, s in enumerate(cls.seps): - cls.arcdata[s] = s.join(cls.line_gen) + s - - def setUp(self): - self.arcfiles = {} - for n, s in enumerate(self.seps): - self.arcfiles[s] = '%s-%d' % (TESTFN, n) - with open(self.arcfiles[s], "wb") as f: - f.write(self.arcdata[s]) - - def make_test_archive(self, f, compression): - # Create the ZIP archive - with zipfile.ZipFile(f, "w", compression) as zipfp: - for fn in self.arcfiles.values(): - zipfp.write(fn, fn) - - def read_test(self, f, compression): - self.make_test_archive(f, compression) - - # Read the ZIP archive - with zipfile.ZipFile(f, "r") as zipfp: - for sep, fn in self.arcfiles.items(): - with openU(zipfp, fn) as fp: - zipdata = fp.read() - self.assertEqual(self.arcdata[sep], zipdata) - - def test_read(self): - for f in get_files(self): - self.read_test(f, self.compression) - - def readline_read_test(self, f, compression): - self.make_test_archive(f, compression) - - # Read the ZIP archive - with zipfile.ZipFile(f, "r") as zipfp: - for sep, fn in self.arcfiles.items(): - with openU(zipfp, fn) as zipopen: - data = b'' - while True: - read = zipopen.readline() - if not read: - break - data += read - - read = zipopen.read(5) - if not read: - break - data += read - - self.assertEqual(data, self.arcdata[b'\n']) - - def test_readline_read(self): - for f in get_files(self): - self.readline_read_test(f, self.compression) - - def readline_test(self, f, compression): - self.make_test_archive(f, compression) - - # Read the ZIP archive - with zipfile.ZipFile(f, "r") as zipfp: - for sep, fn in self.arcfiles.items(): - with openU(zipfp, fn) as zipopen: - for line in self.line_gen: - linedata = zipopen.readline() - self.assertEqual(linedata, line + b'\n') - - def test_readline(self): - for f in get_files(self): - self.readline_test(f, self.compression) - - def readlines_test(self, f, compression): - self.make_test_archive(f, compression) - - # Read the ZIP archive - with zipfile.ZipFile(f, "r") as zipfp: - for sep, fn in self.arcfiles.items(): - with openU(zipfp, fn) as fp: - ziplines = fp.readlines() - for line, zipline in zip(self.line_gen, ziplines): - self.assertEqual(zipline, line + b'\n') - - def test_readlines(self): - for f in get_files(self): - self.readlines_test(f, self.compression) - - def iterlines_test(self, f, compression): - self.make_test_archive(f, compression) - - # Read the ZIP archive - with zipfile.ZipFile(f, "r") as zipfp: - for sep, fn in self.arcfiles.items(): - with openU(zipfp, fn) as fp: - for line, zipline in zip(self.line_gen, fp): - self.assertEqual(zipline, line + b'\n') - - def test_iterlines(self): - for f in get_files(self): - self.iterlines_test(f, self.compression) - - def tearDown(self): - for sep, fn in self.arcfiles.items(): - unlink(fn) - unlink(TESTFN) - unlink(TESTFN2) - - -class StoredUniversalNewlineTests(AbstractUniversalNewlineTests, - unittest.TestCase): - compression = zipfile.ZIP_STORED - - at requires_zlib -class DeflateUniversalNewlineTests(AbstractUniversalNewlineTests, - unittest.TestCase): - compression = zipfile.ZIP_DEFLATED - - at requires_bz2 -class Bzip2UniversalNewlineTests(AbstractUniversalNewlineTests, - unittest.TestCase): - compression = zipfile.ZIP_BZIP2 - - at requires_lzma -class LzmaUniversalNewlineTests(AbstractUniversalNewlineTests, - unittest.TestCase): - compression = zipfile.ZIP_LZMA - class ZipInfoTests(unittest.TestCase): def test_from_file(self): zi = zipfile.ZipInfo.from_file(__file__) diff --git a/Lib/zipfile.py b/Lib/zipfile.py --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -743,9 +743,6 @@ # Read from compressed files in 4k blocks. MIN_READ_SIZE = 4096 - # Search for universal newlines or line chunks. - PATTERN = re.compile(br'^(?P[^\r\n]+)|(?P\n|\r\n?)') - def __init__(self, fileobj, mode, zipinfo, decrypter=None, close_fileobj=False): self._fileobj = fileobj @@ -762,7 +759,6 @@ self._readbuffer = b'' self._offset = 0 - self._universal = 'U' in mode self.newlines = None # Adjust read size for encrypted files since the first 12 bytes @@ -799,7 +795,7 @@ If limit is specified, at most limit bytes will be read. """ - if not self._universal and limit < 0: + if limit < 0: # Shortcut common case - newline found in buffer. i = self._readbuffer.find(b'\n', self._offset) + 1 if i > 0: @@ -807,41 +803,7 @@ self._offset = i return line - if not self._universal: - return io.BufferedIOBase.readline(self, limit) - - line = b'' - while limit < 0 or len(line) < limit: - readahead = self.peek(2) - if readahead == b'': - return line - - # - # Search for universal newlines or line chunks. - # - # The pattern returns either a line chunk or a newline, but not - # both. Combined with peek(2), we are assured that the sequence - # '\r\n' is always retrieved completely and never split into - # separate newlines - '\r', '\n' due to coincidental readaheads. - # - match = self.PATTERN.search(readahead) - newline = match.group('newline') - if newline is not None: - if self.newlines is None: - self.newlines = [] - if newline not in self.newlines: - self.newlines.append(newline) - self._offset += len(newline) - return line + b'\n' - - chunk = match.group('chunk') - if limit >= 0: - chunk = chunk[: limit - len(line)] - - self._offset += len(chunk) - line += chunk - - return line + return io.BufferedIOBase.readline(self, limit) def peek(self, n=1): """Returns buffered bytes without advancing the position.""" @@ -1360,12 +1322,8 @@ files. If the size is known in advance, it is best to pass a ZipInfo instance for name, with zinfo.file_size set. """ - if mode not in {"r", "w", "U", "rU"}: - raise RuntimeError('open() requires mode "r", "w", "U", or "rU"') - if 'U' in mode: - import warnings - warnings.warn("'U' mode is deprecated", - DeprecationWarning, 2) + if mode not in {"r", "w"}: + raise RuntimeError('open() requires mode "r" or "w"') if pwd and not isinstance(pwd, bytes): raise TypeError("pwd: expected bytes, got %s" % type(pwd)) if pwd and (mode == "w"): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -38,6 +38,9 @@ Library ------- +- Issue #27029: Removed deprecated support of universal newlines mode from + ZipFile.open(). + - Issue #27030: Unknown escapes consisting of ``'\'`` and ASCII letter in regular expressions now are errors. The re.LOCALE flag now can be used only with bytes patterns. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 15:06:30 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 11 Jun 2016 19:06:30 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_Issue_=2322558=2E?= Message-ID: <20160611190630.9888.927.03B9B4E8@psf.io> https://hg.python.org/cpython/rev/2a01d7a488e9 changeset: 101878:2a01d7a488e9 parent: 101876:bf8773b054cb parent: 101877:222c1d461aa8 user: Terry Jan Reedy date: Sat Jun 11 15:06:08 2016 -0400 summary: Merge Issue #22558. files: Doc/library/2to3.rst | 4 ++++ Doc/library/__main__.rst | 2 ++ Doc/library/_thread.rst | 3 ++- Doc/library/abc.rst | 1 + Doc/library/aifc.rst | 3 +-- Doc/library/argparse.rst | 1 + Doc/library/array.rst | 3 ++- Doc/library/asynchat.rst | 1 + Doc/library/asyncio.rst | 8 ++++---- Doc/library/asyncore.rst | 1 + Doc/library/atexit.rst | 2 ++ Doc/library/audioop.rst | 1 + Doc/library/base64.rst | 3 +++ Doc/library/binascii.rst | 3 ++- Doc/library/binhex.rst | 3 +++ Doc/library/builtins.rst | 1 + Doc/library/bz2.rst | 4 ++++ Doc/library/calendar.rst | 1 + Doc/library/cgi.rst | 3 +-- Doc/library/cgitb.rst | 4 ++++ Doc/library/chunk.rst | 4 ++++ Doc/library/cmath.rst | 1 + Doc/library/cmd.rst | 1 + Doc/library/code.rst | 2 ++ Doc/library/codecs.rst | 3 +++ Doc/library/codeop.rst | 5 +++++ Doc/library/collections.abc.rst | 5 +++-- Doc/library/collections.rst | 5 +++-- Doc/library/colorsys.rst | 1 + Doc/library/compileall.rst | 1 - Doc/library/configparser.rst | 2 ++ Doc/library/copy.rst | 4 ++++ Doc/library/copyreg.rst | 3 +++ Doc/library/crypt.rst | 4 ++++ Doc/library/csv.rst | 3 +++ Doc/library/ctypes.rst | 2 ++ Doc/library/curses.ascii.rst | 2 ++ Doc/library/curses.panel.rst | 2 ++ Doc/library/curses.rst | 3 +++ Doc/library/datetime.rst | 3 +++ Doc/library/dbm.rst | 4 ++++ Doc/library/decimal.rst | 2 ++ Doc/library/difflib.rst | 3 +++ Doc/library/distutils.rst | 2 ++ Doc/library/doctest.rst | 4 ++++ Doc/library/email.charset.rst | 3 +++ Doc/library/email.contentmanager.rst | 7 +++++-- Doc/library/email.encoders.rst | 3 +++ Doc/library/email.errors.rst | 3 +++ Doc/library/email.generator.rst | 3 +++ Doc/library/email.header.rst | 3 +++ Doc/library/email.headerregistry.rst | 7 +++++-- Doc/library/email.iterators.rst | 3 +++ Doc/library/email.message.rst | 3 +++ Doc/library/email.mime.rst | 3 +++ Doc/library/email.parser.rst | 3 +++ Doc/library/email.policy.rst | 3 +++ Doc/library/email.rst | 4 ++++ Doc/library/email.util.rst | 3 +++ Doc/library/ensurepip.rst | 2 ++ Doc/library/errno.rst | 1 + Doc/library/faulthandler.rst | 2 ++ Doc/library/fcntl.rst | 4 +++- Doc/library/filecmp.rst | 1 + Doc/library/fileinput.rst | 1 + Doc/library/fnmatch.rst | 3 +-- Doc/library/formatter.rst | 1 + Doc/library/fpectl.rst | 4 +++- Doc/library/fractions.rst | 1 + Doc/library/ftplib.rst | 3 +-- Doc/library/functools.rst | 1 + Doc/library/gc.rst | 2 ++ Doc/library/getopt.rst | 4 ++-- Doc/library/getpass.rst | 5 +++++ Doc/library/gettext.rst | 1 + Doc/library/glob.rst | 3 +-- Doc/library/grp.rst | 1 + Doc/library/hashlib.rst | 4 ++-- Doc/library/heapq.rst | 1 + Doc/library/hmac.rst | 1 + Doc/library/html.entities.rst | 1 + Doc/library/html.parser.rst | 3 +-- Doc/library/http.client.rst | 3 +-- Doc/library/http.cookiejar.rst | 1 + Doc/library/http.cookies.rst | 1 + Doc/library/http.rst | 4 +++- Doc/library/http.server.rst | 3 +-- Doc/library/idle.rst | 6 +++++- Doc/library/imaplib.rst | 4 ++-- Doc/library/imp.rst | 4 ++++ Doc/library/importlib.rst | 3 +++ Doc/library/inspect.rst | 1 + Doc/library/io.rst | 5 +++++ Doc/library/ipaddress.rst | 1 + Doc/library/itertools.rst | 3 ++- Doc/library/json.rst | 5 +++++ Doc/library/linecache.rst | 1 + Doc/library/locale.rst | 4 ++++ Doc/library/logging.config.rst | 5 ++--- Doc/library/logging.handlers.rst | 5 ++--- Doc/library/logging.rst | 5 +---- Doc/library/lzma.rst | 4 ++++ Doc/library/macpath.rst | 3 +++ Doc/library/mailbox.rst | 4 ++++ Doc/library/marshal.rst | 1 + Doc/library/math.rst | 2 ++ Doc/library/mimetypes.rst | 4 ++-- Doc/library/mmap.rst | 1 + Doc/library/modulefinder.rst | 5 ++--- Doc/library/msilib.rst | 4 ++++ Doc/library/msvcrt.rst | 2 ++ Doc/library/multiprocessing.rst | 3 +++ Doc/library/netrc.rst | 1 + Doc/library/nis.rst | 2 ++ Doc/library/nntplib.rst | 3 +-- Doc/library/numbers.rst | 3 +++ Doc/library/operator.rst | 4 ++-- Doc/library/optparse.rst | 5 +++-- Doc/library/os.path.rst | 6 ++++++ Doc/library/os.rst | 3 +++ Doc/library/ossaudiodev.rst | 1 + Doc/library/parser.rst | 4 +++- Doc/library/pathlib.rst | 6 +++++- Doc/library/pdb.rst | 4 ++-- Doc/library/pickle.rst | 14 +++++++++----- Doc/library/pipes.rst | 1 + Doc/library/platform.rst | 1 + Doc/library/plistlib.rst | 5 +++-- Doc/library/poplib.rst | 5 +++-- Doc/library/posix.rst | 1 + Doc/library/pprint.rst | 1 + Doc/library/pty.rst | 4 ++++ Doc/library/pwd.rst | 1 + Doc/library/py_compile.rst | 5 +++-- Doc/library/pyclbr.rst | 1 + Doc/library/pydoc.rst | 4 ++-- Doc/library/pyexpat.rst | 2 ++ Doc/library/quopri.rst | 3 +-- Doc/library/re.rst | 4 ++++ Doc/library/readline.rst | 2 ++ Doc/library/reprlib.rst | 1 + Doc/library/resource.rst | 2 ++ Doc/library/rlcompleter.rst | 1 + Doc/library/runpy.rst | 1 + Doc/library/sched.rst | 5 +++-- Doc/library/select.rst | 1 + Doc/library/selectors.rst | 3 +++ Doc/library/shelve.rst | 3 +-- Doc/library/shlex.rst | 1 + Doc/library/shutil.rst | 5 +++-- Doc/library/signal.rst | 1 + Doc/library/smtplib.rst | 4 ++-- Doc/library/sndhdr.rst | 5 +++-- Doc/library/socket.rst | 3 +++ Doc/library/spwd.rst | 1 + Doc/library/sqlite3.rst | 4 ++++ Doc/library/ssl.rst | 3 +-- Doc/library/stat.rst | 4 ++-- Doc/library/statistics.rst | 5 +++-- Doc/library/stringprep.rst | 4 ++++ Doc/library/struct.rst | 4 ++++ Doc/library/subprocess.rst | 4 ++++ Doc/library/sunau.rst | 1 + Doc/library/symbol.rst | 1 + Doc/library/sys.rst | 1 + Doc/library/sysconfig.rst | 7 ++++--- Doc/library/syslog.rst | 1 + Doc/library/tabnanny.rst | 1 + Doc/library/tarfile.rst | 1 - Doc/library/telnetlib.rst | 4 ++-- Doc/library/tempfile.rst | 8 +++----- Doc/library/termios.rst | 3 ++- Doc/library/test.rst | 2 ++ Doc/library/textwrap.rst | 1 + Doc/library/time.rst | 1 + Doc/library/timeit.rst | 3 +-- Doc/library/tkinter.rst | 4 ++++ Doc/library/tkinter.scrolledtext.rst | 4 ++++ Doc/library/tkinter.tix.rst | 4 ++++ Doc/library/tkinter.ttk.rst | 4 ++++ Doc/library/token.rst | 1 + Doc/library/tokenize.rst | 1 + Doc/library/traceback.rst | 3 +++ Doc/library/tracemalloc.rst | 4 ++++ Doc/library/tty.rst | 4 ++++ Doc/library/turtle.rst | 5 +++++ Doc/library/typing.rst | 4 ++-- Doc/library/unicodedata.rst | 4 +++- Doc/library/unittest.mock.rst | 7 +++++-- Doc/library/unittest.rst | 5 +++++ Doc/library/urllib.error.rst | 4 ++++ Doc/library/urllib.parse.rst | 3 +-- Doc/library/urllib.request.rst | 4 ++++ Doc/library/urllib.robotparser.rst | 4 ++++ Doc/library/urllib.rst | 4 ++++ Doc/library/uu.rst | 1 + Doc/library/uuid.rst | 3 +++ Doc/library/venv.rst | 8 ++++---- Doc/library/warnings.rst | 4 ++-- Doc/library/wave.rst | 1 + Doc/library/weakref.rst | 1 + Doc/library/webbrowser.rst | 1 + Doc/library/winreg.rst | 2 ++ Doc/library/winsound.rst | 2 ++ Doc/library/wsgiref.rst | 2 ++ Doc/library/xdrlib.rst | 3 +-- Doc/library/xml.dom.minidom.rst | 1 + Doc/library/xml.dom.pulldom.rst | 1 + Doc/library/xml.dom.rst | 4 ++++ Doc/library/xml.etree.elementtree.rst | 5 +++++ Doc/library/xml.rst | 4 ++++ Doc/library/xml.sax.handler.rst | 4 ++++ Doc/library/xml.sax.reader.rst | 4 ++++ Doc/library/xml.sax.rst | 4 ++++ Doc/library/xml.sax.utils.rst | 4 ++++ Doc/library/xmlrpc.client.rst | 4 ++-- Doc/library/xmlrpc.server.rst | 1 + Doc/library/zipapp.rst | 7 +++---- Doc/library/zipfile.rst | 1 + Doc/library/zipimport.rst | 2 ++ Doc/library/zlib.rst | 1 + Lib/idlelib/help.html | 6 ++++-- Misc/ACKS | 1 + Misc/NEWS | 6 ++++++ 224 files changed, 542 insertions(+), 136 deletions(-) diff --git a/Doc/library/2to3.rst b/Doc/library/2to3.rst --- a/Doc/library/2to3.rst +++ b/Doc/library/2to3.rst @@ -449,10 +449,14 @@ .. module:: lib2to3 :synopsis: the 2to3 library + .. moduleauthor:: Guido van Rossum .. moduleauthor:: Collin Winter .. moduleauthor:: Benjamin Peterson +**Source code:** :source:`Lib/lib2to3/` + +-------------- .. note:: diff --git a/Doc/library/__main__.rst b/Doc/library/__main__.rst --- a/Doc/library/__main__.rst +++ b/Doc/library/__main__.rst @@ -5,6 +5,8 @@ .. module:: __main__ :synopsis: The environment where the top-level script is run. +-------------- + ``'__main__'`` is the name of the scope in which top-level code executes. A module's __name__ is set equal to ``'__main__'`` when read from standard input, a script, or from an interactive prompt. diff --git a/Doc/library/_thread.rst b/Doc/library/_thread.rst --- a/Doc/library/_thread.rst +++ b/Doc/library/_thread.rst @@ -4,13 +4,14 @@ .. module:: _thread :synopsis: Low-level threading API. - .. index:: single: light-weight processes single: processes, light-weight single: binary semaphores single: semaphores, binary +-------------- + This module provides low-level primitives for working with multiple threads (also called :dfn:`light-weight processes` or :dfn:`tasks`) --- multiple threads of control sharing their global data space. For synchronization, simple locks diff --git a/Doc/library/abc.rst b/Doc/library/abc.rst --- a/Doc/library/abc.rst +++ b/Doc/library/abc.rst @@ -3,6 +3,7 @@ .. module:: abc :synopsis: Abstract base classes according to PEP 3119. + .. moduleauthor:: Guido van Rossum .. sectionauthor:: Georg Brandl .. much of the content adapted from docstrings diff --git a/Doc/library/aifc.rst b/Doc/library/aifc.rst --- a/Doc/library/aifc.rst +++ b/Doc/library/aifc.rst @@ -4,14 +4,13 @@ .. module:: aifc :synopsis: Read and write audio files in AIFF or AIFC format. +**Source code:** :source:`Lib/aifc.py` .. index:: single: Audio Interchange File Format single: AIFF single: AIFF-C -**Source code:** :source:`Lib/aifc.py` - -------------- This module provides support for reading and writing AIFF and AIFF-C files. diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -3,6 +3,7 @@ .. module:: argparse :synopsis: Command-line option and argument parsing library. + .. moduleauthor:: Steven Bethard .. sectionauthor:: Steven Bethard diff --git a/Doc/library/array.rst b/Doc/library/array.rst --- a/Doc/library/array.rst +++ b/Doc/library/array.rst @@ -4,8 +4,9 @@ .. module:: array :synopsis: Space efficient arrays of uniformly typed numeric values. +.. index:: single: arrays -.. index:: single: arrays +-------------- This module defines an object type which can compactly represent an array of basic values: characters, integers, floating point numbers. Arrays are sequence diff --git a/Doc/library/asynchat.rst b/Doc/library/asynchat.rst --- a/Doc/library/asynchat.rst +++ b/Doc/library/asynchat.rst @@ -3,6 +3,7 @@ .. module:: asynchat :synopsis: Support for asynchronous command/response protocols. + .. moduleauthor:: Sam Rushing .. sectionauthor:: Steve Holden diff --git a/Doc/library/asyncio.rst b/Doc/library/asyncio.rst --- a/Doc/library/asyncio.rst +++ b/Doc/library/asyncio.rst @@ -4,6 +4,10 @@ .. module:: asyncio :synopsis: Asynchronous I/O, event loop, coroutines and tasks. +.. versionadded:: 3.4 + +**Source code:** :source:`Lib/asyncio/` + .. note:: The asyncio package has been included in the standard library on a @@ -11,10 +15,6 @@ changes (up to and including removal of the module) may occur if deemed necessary by the core developers. -.. versionadded:: 3.4 - -**Source code:** :source:`Lib/asyncio/` - -------------- This module provides infrastructure for writing single-threaded concurrent diff --git a/Doc/library/asyncore.rst b/Doc/library/asyncore.rst --- a/Doc/library/asyncore.rst +++ b/Doc/library/asyncore.rst @@ -4,6 +4,7 @@ .. module:: asyncore :synopsis: A base class for developing asynchronous socket handling services. + .. moduleauthor:: Sam Rushing .. sectionauthor:: Christopher Petrilli .. sectionauthor:: Steve Holden diff --git a/Doc/library/atexit.rst b/Doc/library/atexit.rst --- a/Doc/library/atexit.rst +++ b/Doc/library/atexit.rst @@ -3,9 +3,11 @@ .. module:: atexit :synopsis: Register and execute cleanup functions. + .. moduleauthor:: Skip Montanaro .. sectionauthor:: Skip Montanaro +-------------- 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/audioop.rst b/Doc/library/audioop.rst --- a/Doc/library/audioop.rst +++ b/Doc/library/audioop.rst @@ -4,6 +4,7 @@ .. module:: audioop :synopsis: Manipulate raw audio data. +-------------- The :mod:`audioop` module contains some useful operations on sound fragments. It operates on sound fragments consisting of signed integer samples 8, 16, 24 diff --git a/Doc/library/base64.rst b/Doc/library/base64.rst --- a/Doc/library/base64.rst +++ b/Doc/library/base64.rst @@ -5,11 +5,14 @@ :synopsis: RFC 3548: Base16, Base32, Base64 Data Encodings; Base85 and Ascii85 +**Source code:** :source:`Lib/base64.py` .. index:: pair: base64; encoding single: MIME; base64 encoding +-------------- + This module provides functions for encoding binary data to printable ASCII characters and decoding such encodings back to binary data. It provides encoding and decoding functions for the encodings specified in diff --git a/Doc/library/binascii.rst b/Doc/library/binascii.rst --- a/Doc/library/binascii.rst +++ b/Doc/library/binascii.rst @@ -5,12 +5,13 @@ :synopsis: Tools for converting between binary and various ASCII-encoded binary representations. - .. index:: module: uu module: base64 module: binhex +-------------- + The :mod:`binascii` module contains a number of methods to convert between binary and various ASCII-encoded binary representations. Normally, you will not use these functions directly but use wrapper modules like :mod:`uu`, diff --git a/Doc/library/binhex.rst b/Doc/library/binhex.rst --- a/Doc/library/binhex.rst +++ b/Doc/library/binhex.rst @@ -4,6 +4,9 @@ .. module:: binhex :synopsis: Encode and decode files in binhex4 format. +**Source code:** :source:`Lib/binhex.py` + +-------------- This module encodes and decodes files in binhex4 format, a format allowing representation of Macintosh files in ASCII. Only the data fork is handled. diff --git a/Doc/library/builtins.rst b/Doc/library/builtins.rst --- a/Doc/library/builtins.rst +++ b/Doc/library/builtins.rst @@ -4,6 +4,7 @@ .. module:: builtins :synopsis: The module that provides the built-in namespace. +-------------- This module provides direct access to all 'built-in' identifiers of Python; for example, ``builtins.open`` is the full name for the built-in function diff --git a/Doc/library/bz2.rst b/Doc/library/bz2.rst --- a/Doc/library/bz2.rst +++ b/Doc/library/bz2.rst @@ -3,11 +3,15 @@ .. module:: bz2 :synopsis: Interfaces for bzip2 compression and decompression. + .. moduleauthor:: Gustavo Niemeyer .. moduleauthor:: Nadeem Vawda .. sectionauthor:: Gustavo Niemeyer .. sectionauthor:: Nadeem Vawda +**Source code:** :source:`Lib/bz2.py` + +-------------- This module provides a comprehensive interface for compressing and decompressing data using the bzip2 compression algorithm. diff --git a/Doc/library/calendar.rst b/Doc/library/calendar.rst --- a/Doc/library/calendar.rst +++ b/Doc/library/calendar.rst @@ -4,6 +4,7 @@ .. module:: calendar :synopsis: Functions for working with calendars, including some emulation of the Unix cal program. + .. sectionauthor:: Drew Csillag **Source code:** :source:`Lib/calendar.py` diff --git a/Doc/library/cgi.rst b/Doc/library/cgi.rst --- a/Doc/library/cgi.rst +++ b/Doc/library/cgi.rst @@ -4,6 +4,7 @@ .. module:: cgi :synopsis: Helpers for running Python scripts via the Common Gateway Interface. +**Source code:** :source:`Lib/cgi.py` .. index:: pair: WWW; server @@ -13,8 +14,6 @@ single: URL single: Common Gateway Interface -**Source code:** :source:`Lib/cgi.py` - -------------- Support module for Common Gateway Interface (CGI) scripts. diff --git a/Doc/library/cgitb.rst b/Doc/library/cgitb.rst --- a/Doc/library/cgitb.rst +++ b/Doc/library/cgitb.rst @@ -3,9 +3,11 @@ .. module:: cgitb :synopsis: Configurable traceback handler for CGI scripts. + .. moduleauthor:: Ka-Ping Yee .. sectionauthor:: Fred L. Drake, Jr. +**Source code:** :source:`Lib/cgitb.py` .. index:: single: CGI; exceptions @@ -13,6 +15,8 @@ single: exceptions; in CGI scripts single: tracebacks; in CGI scripts +-------------- + The :mod:`cgitb` module provides a special exception handler for Python scripts. (Its name is a bit misleading. It was originally designed to display extensive traceback information in HTML for CGI scripts. It was later generalized to also diff --git a/Doc/library/chunk.rst b/Doc/library/chunk.rst --- a/Doc/library/chunk.rst +++ b/Doc/library/chunk.rst @@ -3,9 +3,11 @@ .. module:: chunk :synopsis: Module to read IFF chunks. + .. moduleauthor:: Sjoerd Mullender .. sectionauthor:: Sjoerd Mullender +**Source code:** :source:`Lib/chunk.py` .. index:: single: Audio Interchange File Format @@ -14,6 +16,8 @@ single: Real Media File Format single: RMFF +-------------- + This module provides an interface for reading files that use EA IFF 85 chunks. [#]_ This format is used in at least the Audio Interchange File Format (AIFF/AIFF-C) and the Real Media File Format (RMFF). The WAVE audio file format diff --git a/Doc/library/cmath.rst b/Doc/library/cmath.rst --- a/Doc/library/cmath.rst +++ b/Doc/library/cmath.rst @@ -4,6 +4,7 @@ .. module:: cmath :synopsis: Mathematical functions for complex numbers. +-------------- This module is always available. It provides access to mathematical functions for complex numbers. The functions in this module accept integers, diff --git a/Doc/library/cmd.rst b/Doc/library/cmd.rst --- a/Doc/library/cmd.rst +++ b/Doc/library/cmd.rst @@ -3,6 +3,7 @@ .. module:: cmd :synopsis: Build line-oriented command interpreters. + .. sectionauthor:: Eric S. Raymond **Source code:** :source:`Lib/cmd.py` diff --git a/Doc/library/code.rst b/Doc/library/code.rst --- a/Doc/library/code.rst +++ b/Doc/library/code.rst @@ -6,6 +6,8 @@ **Source code:** :source:`Lib/code.py` +-------------- + The ``code`` module provides facilities to implement read-eval-print loops in Python. Two classes and convenience functions are included which can be used to build applications which provide an interactive interpreter prompt. diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst --- a/Doc/library/codecs.rst +++ b/Doc/library/codecs.rst @@ -3,6 +3,7 @@ .. module:: codecs :synopsis: Encode and decode data and streams. + .. moduleauthor:: Marc-Andr? Lemburg .. sectionauthor:: Marc-Andr? Lemburg .. sectionauthor:: Martin v. L?wis @@ -17,6 +18,8 @@ single: streams pair: stackable; streams +-------------- + This module defines base classes for standard Python codecs (encoders and decoders) and provides access to the internal Python codec registry, which manages the codec and error handling lookup process. Most standard codecs diff --git a/Doc/library/codeop.rst b/Doc/library/codeop.rst --- a/Doc/library/codeop.rst +++ b/Doc/library/codeop.rst @@ -3,9 +3,14 @@ .. module:: codeop :synopsis: Compile (possibly incomplete) Python code. + .. sectionauthor:: Moshe Zadka .. sectionauthor:: Michael Hudson +**Source code:** :source:`Lib/codeop.py` + +-------------- + The :mod:`codeop` module provides utilities upon which the Python read-eval-print loop can be emulated, as is done in the :mod:`code` module. As a result, you probably don't want to use the module directly; if you want to diff --git a/Doc/library/collections.abc.rst b/Doc/library/collections.abc.rst --- a/Doc/library/collections.abc.rst +++ b/Doc/library/collections.abc.rst @@ -3,20 +3,21 @@ .. module:: collections.abc :synopsis: Abstract base classes for containers + .. moduleauthor:: Raymond Hettinger .. sectionauthor:: Raymond Hettinger .. versionadded:: 3.3 Formerly, this module was part of the :mod:`collections` module. +**Source code:** :source:`Lib/_collections_abc.py` + .. testsetup:: * from collections import * import itertools __name__ = '' -**Source code:** :source:`Lib/_collections_abc.py` - -------------- This module provides :term:`abstract base classes ` that diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -3,17 +3,18 @@ .. module:: collections :synopsis: Container datatypes + .. moduleauthor:: Raymond Hettinger .. sectionauthor:: Raymond Hettinger +**Source code:** :source:`Lib/collections/__init__.py` + .. testsetup:: * from collections import * import itertools __name__ = '' -**Source code:** :source:`Lib/collections/__init__.py` - -------------- This module implements specialized container datatypes providing alternatives to diff --git a/Doc/library/colorsys.rst b/Doc/library/colorsys.rst --- a/Doc/library/colorsys.rst +++ b/Doc/library/colorsys.rst @@ -3,6 +3,7 @@ .. module:: colorsys :synopsis: Conversion functions between RGB and other color systems. + .. sectionauthor:: David Ascher **Source code:** :source:`Lib/colorsys.py` diff --git a/Doc/library/compileall.rst b/Doc/library/compileall.rst --- a/Doc/library/compileall.rst +++ b/Doc/library/compileall.rst @@ -8,7 +8,6 @@ -------------- - This module provides some utility functions to support installing Python libraries. These functions compile Python source files in a directory tree. This module can be used to create the cached byte-code files at library diff --git a/Doc/library/configparser.rst b/Doc/library/configparser.rst --- a/Doc/library/configparser.rst +++ b/Doc/library/configparser.rst @@ -19,6 +19,8 @@ single: ini file single: Windows ini file +-------------- + This module provides the :class:`ConfigParser` class which implements a basic configuration language which provides a structure similar to what's found in Microsoft Windows INI files. You can use this to write Python programs which diff --git a/Doc/library/copy.rst b/Doc/library/copy.rst --- a/Doc/library/copy.rst +++ b/Doc/library/copy.rst @@ -4,6 +4,10 @@ .. module:: copy :synopsis: Shallow and deep copy operations. +**Source code:** :source:`Lib/copy.py` + +-------------- + Assignment statements in Python do not copy objects, they create bindings between a target and an object. For collections that are mutable or contain mutable items, a copy is sometimes needed so one can change one copy without diff --git a/Doc/library/copyreg.rst b/Doc/library/copyreg.rst --- a/Doc/library/copyreg.rst +++ b/Doc/library/copyreg.rst @@ -4,11 +4,14 @@ .. module:: copyreg :synopsis: Register pickle support functions. +**Source code:** :source:`Lib/copyreg.py` .. index:: module: pickle module: copy +-------------- + The :mod:`copyreg` module offers a way to define functions used while pickling specific objects. The :mod:`pickle` and :mod:`copy` modules use those functions when pickling/copying those objects. The module provides configuration diff --git a/Doc/library/crypt.rst b/Doc/library/crypt.rst --- a/Doc/library/crypt.rst +++ b/Doc/library/crypt.rst @@ -4,15 +4,19 @@ .. module:: crypt :platform: Unix :synopsis: The crypt() function used to check Unix passwords. + .. moduleauthor:: Steven D. Majewski .. sectionauthor:: Steven D. Majewski .. sectionauthor:: Peter Funk +**Source code:** :source:`Lib/crypt.py` .. index:: single: crypt(3) pair: cipher; DES +-------------- + This module implements an interface to the :manpage:`crypt(3)` routine, which is a one-way hash function based upon a modified DES algorithm; see the Unix man page for further details. Possible uses include storing hashed passwords diff --git a/Doc/library/csv.rst b/Doc/library/csv.rst --- a/Doc/library/csv.rst +++ b/Doc/library/csv.rst @@ -3,6 +3,7 @@ .. module:: csv :synopsis: Write and read tabular data to and from delimited files. + .. sectionauthor:: Skip Montanaro **Source code:** :source:`Lib/csv.py` @@ -11,6 +12,8 @@ single: csv pair: data; tabular +-------------- + The so-called CSV (Comma Separated Values) format is the most common import and export format for spreadsheets and databases. CSV format was used for many years prior to attempts to describe the format in a standardized way in diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -3,8 +3,10 @@ .. module:: ctypes :synopsis: A foreign function library for Python. + .. moduleauthor:: Thomas Heller +-------------- :mod:`ctypes` is a foreign function library for Python. It provides C compatible data types, and allows calling functions in DLLs or shared libraries. It can be diff --git a/Doc/library/curses.ascii.rst b/Doc/library/curses.ascii.rst --- a/Doc/library/curses.ascii.rst +++ b/Doc/library/curses.ascii.rst @@ -3,9 +3,11 @@ .. module:: curses.ascii :synopsis: Constants and set-membership functions for ASCII characters. + .. moduleauthor:: Eric S. Raymond .. sectionauthor:: Eric S. Raymond +-------------- The :mod:`curses.ascii` module supplies name constants for ASCII characters and functions to test membership in various ASCII character classes. The constants diff --git a/Doc/library/curses.panel.rst b/Doc/library/curses.panel.rst --- a/Doc/library/curses.panel.rst +++ b/Doc/library/curses.panel.rst @@ -3,8 +3,10 @@ .. module:: curses.panel :synopsis: A panel stack extension that adds depth to curses windows. + .. sectionauthor:: A.M. Kuchling +-------------- Panels are windows with the added feature of depth, so they can be stacked on top of each other, and only the visible portions of each window will be diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst --- a/Doc/library/curses.rst +++ b/Doc/library/curses.rst @@ -5,9 +5,12 @@ :synopsis: An interface to the curses library, providing portable terminal handling. :platform: Unix + .. sectionauthor:: Moshe Zadka .. sectionauthor:: Eric Raymond +-------------- + The :mod:`curses` module provides an interface to the curses library, the de-facto standard for portable advanced terminal handling. diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -3,12 +3,15 @@ .. module:: datetime :synopsis: Basic date and time types. + .. moduleauthor:: Tim Peters .. sectionauthor:: Tim Peters .. sectionauthor:: A.M. Kuchling **Source code:** :source:`Lib/datetime.py` +-------------- + .. XXX what order should the types be discussed in? The :mod:`datetime` module supplies classes for manipulating dates and times in diff --git a/Doc/library/dbm.rst b/Doc/library/dbm.rst --- a/Doc/library/dbm.rst +++ b/Doc/library/dbm.rst @@ -4,6 +4,10 @@ .. module:: dbm :synopsis: Interfaces to various Unix "database" formats. +**Source code:** :source:`Lib/dbm/__init__.py` + +-------------- + :mod:`dbm` is a generic interface to variants of the DBM database --- :mod:`dbm.gnu` or :mod:`dbm.ndbm`. If none of these modules is installed, the slow-but-simple implementation in module :mod:`dbm.dumb` will be used. There diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -23,6 +23,8 @@ # make sure each group gets a fresh context setcontext(Context()) +-------------- + The :mod:`decimal` module provides support for fast correctly-rounded decimal floating point arithmetic. It offers several advantages over the :class:`float` datatype: diff --git a/Doc/library/difflib.rst b/Doc/library/difflib.rst --- a/Doc/library/difflib.rst +++ b/Doc/library/difflib.rst @@ -3,6 +3,7 @@ .. module:: difflib :synopsis: Helpers for computing differences between objects. + .. moduleauthor:: Tim Peters .. sectionauthor:: Tim Peters .. Markup by Fred L. Drake, Jr. @@ -14,6 +15,8 @@ import sys from difflib import * +-------------- + This module provides classes and functions for comparing sequences. It can be used for example, for comparing files, and can produce difference information in various formats, including HTML and context and unified diff --git a/Doc/library/distutils.rst b/Doc/library/distutils.rst --- a/Doc/library/distutils.rst +++ b/Doc/library/distutils.rst @@ -4,8 +4,10 @@ .. module:: distutils :synopsis: Support for building and installing Python modules into an existing Python installation. + .. sectionauthor:: Fred L. Drake, Jr. +-------------- The :mod:`distutils` package provides support for building and installing additional modules into a Python installation. The new modules may be either diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -5,11 +5,15 @@ .. module:: doctest :synopsis: Test pieces of code within docstrings. + .. moduleauthor:: Tim Peters .. sectionauthor:: Tim Peters .. sectionauthor:: Moshe Zadka .. sectionauthor:: Edward Loper +**Source code:** :source:`Lib/doctest.py` + +-------------- The :mod:`doctest` module searches for pieces of text that look like interactive Python sessions, and then executes those sessions to verify that they work diff --git a/Doc/library/email.charset.rst b/Doc/library/email.charset.rst --- a/Doc/library/email.charset.rst +++ b/Doc/library/email.charset.rst @@ -4,6 +4,9 @@ .. module:: email.charset :synopsis: Character Sets +**Source code:** :source:`Lib/email/charset.py` + +-------------- This module provides a class :class:`Charset` for representing character sets and character set conversions in email messages, as well as a character set diff --git a/Doc/library/email.contentmanager.rst b/Doc/library/email.contentmanager.rst --- a/Doc/library/email.contentmanager.rst +++ b/Doc/library/email.contentmanager.rst @@ -7,6 +7,10 @@ .. moduleauthor:: R. David Murray .. sectionauthor:: R. David Murray +.. versionadded:: 3.4 + as a :term:`provisional module `. + +**Source code:** :source:`Lib/email/contentmanager.py` .. note:: @@ -15,8 +19,7 @@ changes (up to and including removal of the module) may occur if deemed necessary by the core developers. -.. versionadded:: 3.4 - as a :term:`provisional module `. +-------------- The :mod:`~email.message` module provides a class that can represent an arbitrary email message. That basic message model has a useful and flexible diff --git a/Doc/library/email.encoders.rst b/Doc/library/email.encoders.rst --- a/Doc/library/email.encoders.rst +++ b/Doc/library/email.encoders.rst @@ -4,6 +4,9 @@ .. module:: email.encoders :synopsis: Encoders for email message payloads. +**Source code:** :source:`Lib/email/encoders.py` + +-------------- When creating :class:`~email.message.Message` objects from scratch, you often need to encode the payloads for transport through compliant mail servers. This diff --git a/Doc/library/email.errors.rst b/Doc/library/email.errors.rst --- a/Doc/library/email.errors.rst +++ b/Doc/library/email.errors.rst @@ -4,6 +4,9 @@ .. module:: email.errors :synopsis: The exception classes used by the email package. +**Source code:** :source:`Lib/email/errors.py` + +-------------- The following exception classes are defined in the :mod:`email.errors` module: diff --git a/Doc/library/email.generator.rst b/Doc/library/email.generator.rst --- a/Doc/library/email.generator.rst +++ b/Doc/library/email.generator.rst @@ -4,6 +4,9 @@ .. module:: email.generator :synopsis: Generate flat text email messages from a message structure. +**Source code:** :source:`Lib/email/generator.py` + +-------------- One of the most common tasks is to generate the flat text of the email message represented by a message object structure. You will need to do this if you want diff --git a/Doc/library/email.header.rst b/Doc/library/email.header.rst --- a/Doc/library/email.header.rst +++ b/Doc/library/email.header.rst @@ -4,6 +4,9 @@ .. module:: email.header :synopsis: Representing non-ASCII headers +**Source code:** :source:`Lib/email/header.py` + +-------------- :rfc:`2822` is the base standard that describes the format of email messages. It derives from the older :rfc:`822` standard which came into widespread use at diff --git a/Doc/library/email.headerregistry.rst b/Doc/library/email.headerregistry.rst --- a/Doc/library/email.headerregistry.rst +++ b/Doc/library/email.headerregistry.rst @@ -7,6 +7,10 @@ .. moduleauthor:: R. David Murray .. sectionauthor:: R. David Murray +.. versionadded:: 3.3 + as a :term:`provisional module `. + +**Source code:** :source:`Lib/email/headerregistry.py` .. note:: @@ -15,8 +19,7 @@ changes (up to and including removal of the module) may occur if deemed necessary by the core developers. -.. versionadded:: 3.3 - as a :term:`provisional module `. +-------------- Headers are represented by customized subclasses of :class:`str`. The particular class used to represent a given header is determined by the diff --git a/Doc/library/email.iterators.rst b/Doc/library/email.iterators.rst --- a/Doc/library/email.iterators.rst +++ b/Doc/library/email.iterators.rst @@ -4,6 +4,9 @@ .. module:: email.iterators :synopsis: Iterate over a message object tree. +**Source code:** :source:`Lib/email/iterators.py` + +-------------- Iterating over a message object tree is fairly easy with the :meth:`Message.walk ` method. The diff --git a/Doc/library/email.message.rst b/Doc/library/email.message.rst --- a/Doc/library/email.message.rst +++ b/Doc/library/email.message.rst @@ -4,6 +4,9 @@ .. module:: email.message :synopsis: The base class representing email messages. +**Source code:** :source:`Lib/email/message.py` + +-------------- The central class in the :mod:`email` package is the :class:`Message` class, imported from the :mod:`email.message` module. It is the base class for the diff --git a/Doc/library/email.mime.rst b/Doc/library/email.mime.rst --- a/Doc/library/email.mime.rst +++ b/Doc/library/email.mime.rst @@ -4,6 +4,9 @@ .. module:: email.mime :synopsis: Build MIME messages. +**Source code:** :source:`Lib/email/mime/` + +-------------- Ordinarily, you get a message object structure by passing a file or some text to a parser, which parses the text and returns the root message object. However 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 @@ -4,6 +4,9 @@ .. module:: email.parser :synopsis: Parse flat text email messages to produce a message object structure. +**Source code:** :source:`Lib/email/parser.py` + +-------------- Message object structures can be created in one of two ways: they can be created from whole cloth by instantiating :class:`~email.message.Message` objects and diff --git a/Doc/library/email.policy.rst b/Doc/library/email.policy.rst --- a/Doc/library/email.policy.rst +++ b/Doc/library/email.policy.rst @@ -9,6 +9,9 @@ .. versionadded:: 3.3 +**Source code:** :source:`Lib/email/policy.py` + +-------------- The :mod:`email` package's prime focus is the handling of email messages as described by the various email and MIME RFCs. However, the general format of diff --git a/Doc/library/email.rst b/Doc/library/email.rst --- a/Doc/library/email.rst +++ b/Doc/library/email.rst @@ -4,10 +4,14 @@ .. module:: email :synopsis: Package supporting the parsing, manipulating, and generating email messages, including MIME documents. + .. moduleauthor:: Barry A. Warsaw .. sectionauthor:: Barry A. Warsaw .. Copyright (C) 2001-2010 Python Software Foundation +**Source code:** :source:`Lib/email/__init__.py` + +-------------- The :mod:`email` package is a library for managing email messages, including MIME and other :rfc:`2822`\ -based message documents. It is specifically *not* diff --git a/Doc/library/email.util.rst b/Doc/library/email.util.rst --- a/Doc/library/email.util.rst +++ b/Doc/library/email.util.rst @@ -4,6 +4,9 @@ .. module:: email.utils :synopsis: Miscellaneous email package utilities. +**Source code:** :source:`Lib/email/utils.py` + +-------------- There are several useful utilities provided in the :mod:`email.utils` module: diff --git a/Doc/library/ensurepip.rst b/Doc/library/ensurepip.rst --- a/Doc/library/ensurepip.rst +++ b/Doc/library/ensurepip.rst @@ -7,6 +7,8 @@ .. versionadded:: 3.4 +-------------- + The :mod:`ensurepip` package provides support for bootstrapping the ``pip`` installer into an existing Python installation or virtual environment. This bootstrapping approach reflects the fact that ``pip`` is an independent diff --git a/Doc/library/errno.rst b/Doc/library/errno.rst --- a/Doc/library/errno.rst +++ b/Doc/library/errno.rst @@ -4,6 +4,7 @@ .. module:: errno :synopsis: Standard errno system symbols. +---------------- This module makes available standard ``errno`` system symbols. The value of each symbol is the corresponding integer value. The names and descriptions are diff --git a/Doc/library/faulthandler.rst b/Doc/library/faulthandler.rst --- a/Doc/library/faulthandler.rst +++ b/Doc/library/faulthandler.rst @@ -6,6 +6,8 @@ .. versionadded:: 3.3 +---------------- + This module contains functions to dump Python tracebacks explicitly, on a fault, after a timeout, or on a user signal. Call :func:`faulthandler.enable` to install fault handlers for the :const:`SIGSEGV`, :const:`SIGFPE`, diff --git a/Doc/library/fcntl.rst b/Doc/library/fcntl.rst --- a/Doc/library/fcntl.rst +++ b/Doc/library/fcntl.rst @@ -4,13 +4,15 @@ .. module:: fcntl :platform: Unix :synopsis: The fcntl() and ioctl() system calls. + .. sectionauthor:: Jaap Vermeulen - .. index:: pair: UNIX; file control pair: UNIX; I/O control +---------------- + This module performs file control and I/O control on file descriptors. It is an interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. For a complete description of these calls, see :manpage:`fcntl(2)` and diff --git a/Doc/library/filecmp.rst b/Doc/library/filecmp.rst --- a/Doc/library/filecmp.rst +++ b/Doc/library/filecmp.rst @@ -3,6 +3,7 @@ .. module:: filecmp :synopsis: Compare files efficiently. + .. sectionauthor:: Moshe Zadka **Source code:** :source:`Lib/filecmp.py` diff --git a/Doc/library/fileinput.rst b/Doc/library/fileinput.rst --- a/Doc/library/fileinput.rst +++ b/Doc/library/fileinput.rst @@ -3,6 +3,7 @@ .. module:: fileinput :synopsis: Loop over standard input or a list of files. + .. moduleauthor:: Guido van Rossum .. sectionauthor:: Fred L. Drake, Jr. diff --git a/Doc/library/fnmatch.rst b/Doc/library/fnmatch.rst --- a/Doc/library/fnmatch.rst +++ b/Doc/library/fnmatch.rst @@ -4,13 +4,12 @@ .. module:: fnmatch :synopsis: Unix shell style filename pattern matching. +**Source code:** :source:`Lib/fnmatch.py` .. index:: single: filenames; wildcard expansion .. index:: module: re -**Source code:** :source:`Lib/fnmatch.py` - -------------- This module provides support for Unix shell-style wildcards, which are *not* the diff --git a/Doc/library/formatter.rst b/Doc/library/formatter.rst --- a/Doc/library/formatter.rst +++ b/Doc/library/formatter.rst @@ -8,6 +8,7 @@ .. deprecated:: 3.4 Due to lack of usage, the formatter module has been deprecated. +-------------- This module supports two interface definitions, each with multiple implementations: The *formatter* interface, and the *writer* interface which is diff --git a/Doc/library/fpectl.rst b/Doc/library/fpectl.rst --- a/Doc/library/fpectl.rst +++ b/Doc/library/fpectl.rst @@ -4,10 +4,10 @@ .. module:: fpectl :platform: Unix :synopsis: Provide control for floating point exception handling. + .. moduleauthor:: Lee Busby .. sectionauthor:: Lee Busby - .. note:: The :mod:`fpectl` module is not built by default, and its usage is discouraged @@ -16,6 +16,8 @@ .. index:: single: IEEE-754 +-------------- + Most computers carry out floating point operations in conformance with the so-called IEEE-754 standard. On any real computer, some floating point operations produce results that cannot be expressed as a normal floating point diff --git a/Doc/library/fractions.rst b/Doc/library/fractions.rst --- a/Doc/library/fractions.rst +++ b/Doc/library/fractions.rst @@ -3,6 +3,7 @@ .. module:: fractions :synopsis: Rational numbers. + .. moduleauthor:: Jeffrey Yasskin .. sectionauthor:: Jeffrey Yasskin diff --git a/Doc/library/ftplib.rst b/Doc/library/ftplib.rst --- a/Doc/library/ftplib.rst +++ b/Doc/library/ftplib.rst @@ -4,13 +4,12 @@ .. module:: ftplib :synopsis: FTP protocol client (requires sockets). +**Source code:** :source:`Lib/ftplib.py` .. index:: pair: FTP; protocol single: FTP; ftplib (standard module) -**Source code:** :source:`Lib/ftplib.py` - -------------- This module defines the class :class:`FTP` and a few related items. The diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -3,6 +3,7 @@ .. module:: functools :synopsis: Higher-order functions and operations on callable objects. + .. moduleauthor:: Peter Harris .. moduleauthor:: Raymond Hettinger .. moduleauthor:: Nick Coghlan diff --git a/Doc/library/gc.rst b/Doc/library/gc.rst --- a/Doc/library/gc.rst +++ b/Doc/library/gc.rst @@ -3,9 +3,11 @@ .. module:: gc :synopsis: Interface to the cycle-detecting garbage collector. + .. moduleauthor:: Neil Schemenauer .. sectionauthor:: Neil Schemenauer +-------------- This module provides an interface to the optional garbage collector. It provides the ability to disable the collector, tune the collection frequency, diff --git a/Doc/library/getopt.rst b/Doc/library/getopt.rst --- a/Doc/library/getopt.rst +++ b/Doc/library/getopt.rst @@ -7,8 +7,6 @@ **Source code:** :source:`Lib/getopt.py` --------------- - .. note:: The :mod:`getopt` module is a parser for command line options whose API is @@ -17,6 +15,8 @@ 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 :c:func:`getopt` function (including the special meanings of arguments of the form '``-``' and '``--``'). Long diff --git a/Doc/library/getpass.rst b/Doc/library/getpass.rst --- a/Doc/library/getpass.rst +++ b/Doc/library/getpass.rst @@ -3,10 +3,15 @@ .. module:: getpass :synopsis: Portable reading of passwords and retrieval of the userid. + .. moduleauthor:: Piers Lauder .. sectionauthor:: Fred L. Drake, Jr. .. Windows (& Mac?) support by Guido van Rossum. +**Source code:** :source:`Lib/getpass.py` + +-------------- + The :mod:`getpass` module provides two functions: diff --git a/Doc/library/gettext.rst b/Doc/library/gettext.rst --- a/Doc/library/gettext.rst +++ b/Doc/library/gettext.rst @@ -3,6 +3,7 @@ .. module:: gettext :synopsis: Multilingual internationalization services. + .. moduleauthor:: Barry A. Warsaw .. sectionauthor:: Barry A. Warsaw diff --git a/Doc/library/glob.rst b/Doc/library/glob.rst --- a/Doc/library/glob.rst +++ b/Doc/library/glob.rst @@ -4,11 +4,10 @@ .. module:: glob :synopsis: Unix shell style pathname pattern expansion. +**Source code:** :source:`Lib/glob.py` .. index:: single: filenames; pathname expansion -**Source code:** :source:`Lib/glob.py` - -------------- The :mod:`glob` module finds all the pathnames matching a specified pattern diff --git a/Doc/library/grp.rst b/Doc/library/grp.rst --- a/Doc/library/grp.rst +++ b/Doc/library/grp.rst @@ -5,6 +5,7 @@ :platform: Unix :synopsis: The group database (getgrnam() and friends). +-------------- This module provides access to the Unix group database. It is available on all Unix versions. diff --git a/Doc/library/hashlib.rst b/Doc/library/hashlib.rst --- a/Doc/library/hashlib.rst +++ b/Doc/library/hashlib.rst @@ -3,16 +3,16 @@ .. module:: hashlib :synopsis: Secure hash and message digest algorithms. + .. moduleauthor:: Gregory P. Smith .. sectionauthor:: Gregory P. Smith +**Source code:** :source:`Lib/hashlib.py` .. index:: single: message digest, MD5 single: secure hash algorithm, SHA1, SHA224, SHA256, SHA384, SHA512 -**Source code:** :source:`Lib/hashlib.py` - -------------- This module implements a common interface to many different secure hash and diff --git a/Doc/library/heapq.rst b/Doc/library/heapq.rst --- a/Doc/library/heapq.rst +++ b/Doc/library/heapq.rst @@ -3,6 +3,7 @@ .. module:: heapq :synopsis: Heap queue algorithm (a.k.a. priority queue). + .. moduleauthor:: Kevin O'Connor .. sectionauthor:: Guido van Rossum .. sectionauthor:: Fran?ois Pinard diff --git a/Doc/library/hmac.rst b/Doc/library/hmac.rst --- a/Doc/library/hmac.rst +++ b/Doc/library/hmac.rst @@ -3,6 +3,7 @@ .. module:: hmac :synopsis: Keyed-Hashing for Message Authentication (HMAC) implementation + .. moduleauthor:: Gerhard H?ring .. sectionauthor:: Gerhard H?ring diff --git a/Doc/library/html.entities.rst b/Doc/library/html.entities.rst --- a/Doc/library/html.entities.rst +++ b/Doc/library/html.entities.rst @@ -3,6 +3,7 @@ .. module:: html.entities :synopsis: Definitions of HTML general entities. + .. sectionauthor:: Fred L. Drake, Jr. **Source code:** :source:`Lib/html/entities.py` diff --git a/Doc/library/html.parser.rst b/Doc/library/html.parser.rst --- a/Doc/library/html.parser.rst +++ b/Doc/library/html.parser.rst @@ -4,13 +4,12 @@ .. module:: html.parser :synopsis: A simple parser that can handle HTML and XHTML. +**Source code:** :source:`Lib/html/parser.py` .. index:: single: HTML single: XHTML -**Source code:** :source:`Lib/html/parser.py` - -------------- This module defines a class :class:`HTMLParser` which serves as the basis for diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -4,6 +4,7 @@ .. module:: http.client :synopsis: HTTP and HTTPS protocol client (requires sockets). +**Source code:** :source:`Lib/http/client.py` .. index:: pair: HTTP; protocol @@ -11,8 +12,6 @@ .. index:: module: urllib.request -**Source code:** :source:`Lib/http/client.py` - -------------- This module defines classes which implement the client side of the HTTP and diff --git a/Doc/library/http.cookiejar.rst b/Doc/library/http.cookiejar.rst --- a/Doc/library/http.cookiejar.rst +++ b/Doc/library/http.cookiejar.rst @@ -3,6 +3,7 @@ .. module:: http.cookiejar :synopsis: Classes for automatic handling of HTTP cookies. + .. moduleauthor:: John J. Lee .. sectionauthor:: John J. Lee diff --git a/Doc/library/http.cookies.rst b/Doc/library/http.cookies.rst --- a/Doc/library/http.cookies.rst +++ b/Doc/library/http.cookies.rst @@ -3,6 +3,7 @@ .. module:: http.cookies :synopsis: Support for HTTP state management (cookies). + .. moduleauthor:: Timothy O'Malley .. sectionauthor:: Moshe Zadka diff --git a/Doc/library/http.rst b/Doc/library/http.rst --- a/Doc/library/http.rst +++ b/Doc/library/http.rst @@ -4,11 +4,13 @@ .. module:: http :synopsis: HTTP status codes and messages +**Source code:** :source:`Lib/http/__init__.py` + .. index:: pair: HTTP; protocol single: HTTP; http (standard module) -**Source code:** :source:`Lib/http/__init__.py` +-------------- :mod:`http` is a package that collects several modules for working with the HyperText Transfer Protocol: diff --git a/Doc/library/http.server.rst b/Doc/library/http.server.rst --- a/Doc/library/http.server.rst +++ b/Doc/library/http.server.rst @@ -4,6 +4,7 @@ .. module:: http.server :synopsis: HTTP server and request handlers. +**Source code:** :source:`Lib/http/server.py` .. index:: pair: WWW; server @@ -11,8 +12,6 @@ single: URL single: httpd -**Source code:** :source:`Lib/http/server.py` - -------------- This module defines classes for implementing HTTP servers (Web servers). diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -3,12 +3,16 @@ IDLE ==== +.. moduleauthor:: Guido van Rossum + +**Source code:** :source:`Lib/idlelib/` + .. index:: single: IDLE single: Python Editor single: Integrated Development Environment -.. moduleauthor:: Guido van Rossum +-------------- IDLE is Python's Integrated Development and Learning Environment. diff --git a/Doc/library/imaplib.rst b/Doc/library/imaplib.rst --- a/Doc/library/imaplib.rst +++ b/Doc/library/imaplib.rst @@ -3,6 +3,7 @@ .. module:: imaplib :synopsis: IMAP4 protocol client (requires sockets). + .. moduleauthor:: Piers Lauder .. sectionauthor:: Piers Lauder .. revised by ESR, January 2000 @@ -10,14 +11,13 @@ .. changes for IMAP4_stream by Piers Lauder , November 2002 +**Source code:** :source:`Lib/imaplib.py` .. index:: pair: IMAP4; protocol pair: IMAP4_SSL; protocol pair: IMAP4_stream; protocol -**Source code:** :source:`Lib/imaplib.py` - -------------- This module defines three classes, :class:`IMAP4`, :class:`IMAP4_SSL` and diff --git a/Doc/library/imp.rst b/Doc/library/imp.rst --- a/Doc/library/imp.rst +++ b/Doc/library/imp.rst @@ -5,11 +5,15 @@ :synopsis: Access the implementation of the import statement. :deprecated: +**Source code:** :source:`Lib/imp.py` + .. deprecated:: 3.4 The :mod:`imp` package is pending deprecation in favor of :mod:`importlib`. .. index:: statement: import +-------------- + This module provides an interface to the mechanisms used to implement the :keyword:`import` statement. It defines the following constants and functions: diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -9,6 +9,9 @@ .. versionadded:: 3.1 +**Source code:** :source:`Lib/importlib/__init__.py` + +-------------- Introduction ------------ diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -3,6 +3,7 @@ .. module:: inspect :synopsis: Extract information and source code from live objects. + .. moduleauthor:: Ka-Ping Yee .. sectionauthor:: Ka-Ping Yee diff --git a/Doc/library/io.rst b/Doc/library/io.rst --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -3,6 +3,7 @@ .. module:: io :synopsis: Core tools for working with streams. + .. moduleauthor:: Guido van Rossum .. moduleauthor:: Mike Verdone .. moduleauthor:: Mark Russell @@ -11,6 +12,10 @@ .. moduleauthor:: Benjamin Peterson .. sectionauthor:: Benjamin Peterson +**Source code:** :source:`Lib/io.py` + +-------------- + .. _io-overview: Overview diff --git a/Doc/library/ipaddress.rst b/Doc/library/ipaddress.rst --- a/Doc/library/ipaddress.rst +++ b/Doc/library/ipaddress.rst @@ -3,6 +3,7 @@ .. module:: ipaddress :synopsis: IPv4/IPv6 manipulation library. + .. moduleauthor:: Peter Moody **Source code:** :source:`Lib/ipaddress.py` diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -3,14 +3,15 @@ .. module:: itertools :synopsis: Functions creating iterators for efficient looping. + .. moduleauthor:: Raymond Hettinger .. sectionauthor:: Raymond Hettinger - .. testsetup:: from itertools import * +-------------- This module implements a number of :term:`iterator` building blocks inspired by constructs from APL, Haskell, and SML. Each has been recast in a form diff --git a/Doc/library/json.rst b/Doc/library/json.rst --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -3,9 +3,14 @@ .. module:: json :synopsis: Encode and decode the JSON format. + .. moduleauthor:: Bob Ippolito .. sectionauthor:: Bob Ippolito +**Source code:** :source:`Lib/json/__init__.py` + +-------------- + `JSON (JavaScript Object Notation) `_, specified by :rfc:`7159` (which obsoletes :rfc:`4627`) and by `ECMA-404 `_, diff --git a/Doc/library/linecache.rst b/Doc/library/linecache.rst --- a/Doc/library/linecache.rst +++ b/Doc/library/linecache.rst @@ -3,6 +3,7 @@ .. module:: linecache :synopsis: This module provides random access to individual lines from text files. + .. sectionauthor:: Moshe Zadka **Source code:** :source:`Lib/linecache.py` diff --git a/Doc/library/locale.rst b/Doc/library/locale.rst --- a/Doc/library/locale.rst +++ b/Doc/library/locale.rst @@ -3,9 +3,13 @@ .. module:: locale :synopsis: Internationalization services. + .. moduleauthor:: Martin von L?wis .. sectionauthor:: Martin von L?wis +**Source code:** :source:`Lib/locale.py` + +-------------- The :mod:`locale` module opens access to the POSIX locale database and functionality. The POSIX locale mechanism allows programmers to deal with diff --git a/Doc/library/logging.config.rst b/Doc/library/logging.config.rst --- a/Doc/library/logging.config.rst +++ b/Doc/library/logging.config.rst @@ -4,10 +4,11 @@ .. module:: logging.config :synopsis: Configuration of the logging module. - .. moduleauthor:: Vinay Sajip .. sectionauthor:: Vinay Sajip +**Source code:** :source:`Lib/logging/config.py` + .. sidebar:: Important This page contains only reference information. For tutorials, @@ -17,8 +18,6 @@ * :ref:`Advanced Tutorial ` * :ref:`Logging Cookbook ` -**Source code:** :source:`Lib/logging/config.py` - -------------- This section describes the API for configuring the logging module. 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 @@ -4,10 +4,11 @@ .. module:: logging.handlers :synopsis: Handlers for the logging module. - .. moduleauthor:: Vinay Sajip .. sectionauthor:: Vinay Sajip +**Source code:** :source:`Lib/logging/handlers.py` + .. sidebar:: Important This page contains only reference information. For tutorials, @@ -17,8 +18,6 @@ * :ref:`Advanced Tutorial ` * :ref:`Logging Cookbook ` -**Source code:** :source:`Lib/logging/handlers.py` - -------------- .. currentmodule:: logging diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -4,10 +4,10 @@ .. module:: logging :synopsis: Flexible event logging system for applications. - .. moduleauthor:: Vinay Sajip .. sectionauthor:: Vinay Sajip +**Source code:** :source:`Lib/logging/__init__.py` .. index:: pair: Errors; logging @@ -20,9 +20,6 @@ * :ref:`Advanced Tutorial ` * :ref:`Logging Cookbook ` - -**Source code:** :source:`Lib/logging/__init__.py` - -------------- This module defines functions and classes which implement a flexible event diff --git a/Doc/library/lzma.rst b/Doc/library/lzma.rst --- a/Doc/library/lzma.rst +++ b/Doc/library/lzma.rst @@ -3,11 +3,15 @@ .. module:: lzma :synopsis: A Python wrapper for the liblzma compression library. + .. moduleauthor:: Nadeem Vawda .. sectionauthor:: Nadeem Vawda .. versionadded:: 3.3 +**Source code:** :source:`Lib/lzma.py` + +-------------- This module provides classes and convenience functions for compressing and decompressing data using the LZMA compression algorithm. Also included is a file diff --git a/Doc/library/macpath.rst b/Doc/library/macpath.rst --- a/Doc/library/macpath.rst +++ b/Doc/library/macpath.rst @@ -4,6 +4,9 @@ .. module:: macpath :synopsis: Mac OS 9 path manipulation functions. +**Source code:** :source:`Lib/macpath.py` + +-------------- This module is the Mac OS 9 (and earlier) implementation of the :mod:`os.path` module. It can be used to manipulate old-style Macintosh pathnames on Mac OS X diff --git a/Doc/library/mailbox.rst b/Doc/library/mailbox.rst --- a/Doc/library/mailbox.rst +++ b/Doc/library/mailbox.rst @@ -3,9 +3,13 @@ .. module:: mailbox :synopsis: Manipulate mailboxes in various formats + .. moduleauthor:: Gregory K. Johnson .. sectionauthor:: Gregory K. Johnson +**Source code:** :source:`Lib/mailbox.py` + +-------------- This module defines two classes, :class:`Mailbox` and :class:`Message`, for accessing and manipulating on-disk mailboxes and the messages they contain. diff --git a/Doc/library/marshal.rst b/Doc/library/marshal.rst --- a/Doc/library/marshal.rst +++ b/Doc/library/marshal.rst @@ -5,6 +5,7 @@ :synopsis: Convert Python objects to streams of bytes and back (with different constraints). +-------------- This module contains functions that can read and write Python values in a binary format. The format is specific to Python, but independent of machine diff --git a/Doc/library/math.rst b/Doc/library/math.rst --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -8,6 +8,8 @@ from math import fsum +-------------- + This module is always available. It provides access to the mathematical functions defined by the C standard. diff --git a/Doc/library/mimetypes.rst b/Doc/library/mimetypes.rst --- a/Doc/library/mimetypes.rst +++ b/Doc/library/mimetypes.rst @@ -3,13 +3,13 @@ .. module:: mimetypes :synopsis: Mapping of filename extensions to MIME types. + .. sectionauthor:: Fred L. Drake, Jr. +**Source code:** :source:`Lib/mimetypes.py` .. index:: pair: MIME; content type -**Source code:** :source:`Lib/mimetypes.py` - -------------- The :mod:`mimetypes` module converts between a filename or URL and the MIME type diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -4,6 +4,7 @@ .. module:: mmap :synopsis: Interface to memory-mapped files for Unix and Windows. +-------------- Memory-mapped file objects behave like both :class:`bytearray` and like :term:`file objects `. You can use mmap objects in most places diff --git a/Doc/library/modulefinder.rst b/Doc/library/modulefinder.rst --- a/Doc/library/modulefinder.rst +++ b/Doc/library/modulefinder.rst @@ -1,12 +1,11 @@ :mod:`modulefinder` --- Find modules used by a script ===================================================== -.. sectionauthor:: A.M. Kuchling - - .. module:: modulefinder :synopsis: Find modules used by a script. +.. sectionauthor:: A.M. Kuchling + **Source code:** :source:`Lib/modulefinder.py` -------------- diff --git a/Doc/library/msilib.rst b/Doc/library/msilib.rst --- a/Doc/library/msilib.rst +++ b/Doc/library/msilib.rst @@ -4,12 +4,16 @@ .. module:: msilib :platform: Windows :synopsis: Creation of Microsoft Installer files, and CAB files. + .. moduleauthor:: Martin v. L?wis .. sectionauthor:: Martin v. L?wis +**Source code:** :source:`Lib/msilib/__init__.py` .. index:: single: msi +-------------- + The :mod:`msilib` supports the creation of Microsoft Installer (``.msi``) files. Because these files often contain an embedded "cabinet" file (``.cab``), it also exposes an API to create CAB files. Support for reading ``.cab`` files is diff --git a/Doc/library/msvcrt.rst b/Doc/library/msvcrt.rst --- a/Doc/library/msvcrt.rst +++ b/Doc/library/msvcrt.rst @@ -4,8 +4,10 @@ .. module:: msvcrt :platform: Windows :synopsis: Miscellaneous useful routines from the MS VC++ runtime. + .. sectionauthor:: Fred L. Drake, Jr. +-------------- These functions provide access to some useful capabilities on Windows platforms. Some higher-level modules use these functions to build the Windows diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -4,6 +4,9 @@ .. module:: multiprocessing :synopsis: Process-based parallelism. +**Source code:** :source:`Lib/multiprocessing/` + +-------------- Introduction ------------ diff --git a/Doc/library/netrc.rst b/Doc/library/netrc.rst --- a/Doc/library/netrc.rst +++ b/Doc/library/netrc.rst @@ -4,6 +4,7 @@ .. module:: netrc :synopsis: Loading of .netrc files. + .. moduleauthor:: Eric S. Raymond .. sectionauthor:: Eric S. Raymond diff --git a/Doc/library/nis.rst b/Doc/library/nis.rst --- a/Doc/library/nis.rst +++ b/Doc/library/nis.rst @@ -5,9 +5,11 @@ .. module:: nis :platform: Unix :synopsis: Interface to Sun's NIS (Yellow Pages) library. + .. moduleauthor:: Fred Gansevles .. sectionauthor:: Moshe Zadka +-------------- The :mod:`nis` module gives a thin wrapper around the NIS library, useful for central administration of several hosts. diff --git a/Doc/library/nntplib.rst b/Doc/library/nntplib.rst --- a/Doc/library/nntplib.rst +++ b/Doc/library/nntplib.rst @@ -4,13 +4,12 @@ .. module:: nntplib :synopsis: NNTP protocol client (requires sockets). +**Source code:** :source:`Lib/nntplib.py` .. index:: pair: NNTP; protocol single: Network News Transfer Protocol -**Source code:** :source:`Lib/nntplib.py` - -------------- This module defines the class :class:`NNTP` which implements the client side of diff --git a/Doc/library/numbers.rst b/Doc/library/numbers.rst --- a/Doc/library/numbers.rst +++ b/Doc/library/numbers.rst @@ -4,6 +4,9 @@ .. module:: numbers :synopsis: Numeric abstract base classes (Complex, Real, Integral, etc.). +**Source code:** :source:`Lib/numbers.py` + +-------------- The :mod:`numbers` module (:pep:`3141`) defines a hierarchy of numeric :term:`abstract base classes ` which progressively define diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst --- a/Doc/library/operator.rst +++ b/Doc/library/operator.rst @@ -3,16 +3,16 @@ .. module:: operator :synopsis: Functions corresponding to the standard operators. + .. sectionauthor:: Skip Montanaro +**Source code:** :source:`Lib/operator.py` .. testsetup:: import operator from operator import itemgetter, iadd -**Source code:** :source:`Lib/operator.py` - -------------- The :mod:`operator` module exports a set of efficient functions corresponding to diff --git a/Doc/library/optparse.rst b/Doc/library/optparse.rst --- a/Doc/library/optparse.rst +++ b/Doc/library/optparse.rst @@ -4,15 +4,16 @@ .. module:: optparse :synopsis: Command-line option parsing library. :deprecated: + .. moduleauthor:: Greg Ward .. sectionauthor:: Greg Ward +**Source code:** :source:`Lib/optparse.py` + .. deprecated:: 3.2 The :mod:`optparse` module is deprecated and will not be developed further; development will continue with the :mod:`argparse` module. -**Source code:** :source:`Lib/optparse.py` - -------------- :mod:`optparse` is a more convenient, flexible, and powerful library for parsing diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst --- a/Doc/library/os.path.rst +++ b/Doc/library/os.path.rst @@ -4,8 +4,14 @@ .. module:: os.path :synopsis: Operations on pathnames. +**Source code:** :source:`Lib/posixpath.py` (for POSIX), +:source:`Lib/ntpath.py` (for Windows NT), +and :source:`Lib/macpath.py` (for Macintosh) + .. index:: single: path; operations +-------------- + This module implements some useful functions on pathnames. To read or write files see :func:`open`, and for accessing the filesystem see the :mod:`os` module. The path parameters can be passed as either strings, diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -4,6 +4,9 @@ .. module:: os :synopsis: Miscellaneous operating system interfaces. +**Source code:** :source:`Lib/os.py` + +-------------- This module provides a portable way of using operating system dependent functionality. If you just want to read or write a file see :func:`open`, if diff --git a/Doc/library/ossaudiodev.rst b/Doc/library/ossaudiodev.rst --- a/Doc/library/ossaudiodev.rst +++ b/Doc/library/ossaudiodev.rst @@ -5,6 +5,7 @@ :platform: Linux, FreeBSD :synopsis: Access to OSS-compatible audio devices. +-------------- This module allows you to access the OSS (Open Sound System) audio interface. OSS is available for a wide range of open-source and commercial Unices, and is diff --git a/Doc/library/parser.rst b/Doc/library/parser.rst --- a/Doc/library/parser.rst +++ b/Doc/library/parser.rst @@ -3,10 +3,10 @@ .. module:: parser :synopsis: Access parse trees for Python source code. + .. moduleauthor:: Fred L. Drake, Jr. .. sectionauthor:: Fred L. Drake, Jr. - .. Copyright 1995 Virginia Polytechnic Institute and State University and Fred L. Drake, Jr. This copyright notice must be distributed on all copies, but this document otherwise may be distributed as part of the Python @@ -16,6 +16,8 @@ .. index:: single: parsing; Python source code +-------------- + The :mod:`parser` module provides an interface to Python's internal parser and byte-code compiler. The primary purpose for this interface is to allow Python code to edit the parse tree of a Python expression and create executable code diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -5,9 +5,13 @@ .. module:: pathlib :synopsis: Object-oriented filesystem paths +.. versionadded:: 3.4 + +**Source code:** :source:`Lib/pathlib.py` + .. index:: single: path; operations -.. versionadded:: 3.4 +-------------- This module offers classes representing filesystem paths with semantics appropriate for different operating systems. Path classes are divided diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst --- a/Doc/library/pdb.rst +++ b/Doc/library/pdb.rst @@ -8,10 +8,10 @@ **Source code:** :source:`Lib/pdb.py` +.. index:: single: debugging + -------------- -.. index:: single: debugging - The module :mod:`pdb` defines an interactive source code debugger for Python programs. It supports setting (conditional) breakpoints and single stepping at the source line level, inspection of stack frames, source code listing, and diff --git a/Doc/library/pickle.rst b/Doc/library/pickle.rst --- a/Doc/library/pickle.rst +++ b/Doc/library/pickle.rst @@ -1,6 +1,14 @@ :mod:`pickle` --- Python object serialization ============================================= +.. module:: pickle + :synopsis: Convert Python objects to streams of bytes and back. + +.. sectionauthor:: Jim Kerr . +.. sectionauthor:: Barry Warsaw + +**Source code:** :source:`Lib/pickle.py` + .. index:: single: persistence pair: persistent; objects @@ -9,11 +17,7 @@ pair: flattening; objects pair: pickling; objects -.. module:: pickle - :synopsis: Convert Python objects to streams of bytes and back. -.. sectionauthor:: Jim Kerr . -.. sectionauthor:: Barry Warsaw - +-------------- The :mod:`pickle` module implements binary protocols for serializing and de-serializing a Python object structure. *"Pickling"* is the process diff --git a/Doc/library/pipes.rst b/Doc/library/pipes.rst --- a/Doc/library/pipes.rst +++ b/Doc/library/pipes.rst @@ -4,6 +4,7 @@ .. module:: pipes :platform: Unix :synopsis: A Python interface to Unix shell pipelines. + .. sectionauthor:: Moshe Zadka **Source code:** :source:`Lib/pipes.py` diff --git a/Doc/library/platform.rst b/Doc/library/platform.rst --- a/Doc/library/platform.rst +++ b/Doc/library/platform.rst @@ -3,6 +3,7 @@ .. module:: platform :synopsis: Retrieves as much platform identifying data as possible. + .. moduleauthor:: Marc-Andr? Lemburg .. sectionauthor:: Bjorn Pettersen diff --git a/Doc/library/plistlib.rst b/Doc/library/plistlib.rst --- a/Doc/library/plistlib.rst +++ b/Doc/library/plistlib.rst @@ -3,16 +3,17 @@ .. module:: plistlib :synopsis: Generate and parse Mac OS X plist files. + .. moduleauthor:: Jack Jansen .. sectionauthor:: Georg Brandl .. (harvested from docstrings in the original file) +**Source code:** :source:`Lib/plistlib.py` + .. index:: pair: plist; file single: property list -**Source code:** :source:`Lib/plistlib.py` - -------------- This module provides an interface for reading and writing the "property list" diff --git a/Doc/library/poplib.rst b/Doc/library/poplib.rst --- a/Doc/library/poplib.rst +++ b/Doc/library/poplib.rst @@ -3,13 +3,14 @@ .. module:: poplib :synopsis: POP3 protocol client (requires sockets). + .. sectionauthor:: Andrew T. Csillag .. revised by ESR, January 2000 +**Source code:** :source:`Lib/poplib.py` + .. index:: pair: POP3; protocol -**Source code:** :source:`Lib/poplib.py` - -------------- This module defines a class, :class:`POP3`, which encapsulates a connection to a diff --git a/Doc/library/posix.rst b/Doc/library/posix.rst --- a/Doc/library/posix.rst +++ b/Doc/library/posix.rst @@ -5,6 +5,7 @@ :platform: Unix :synopsis: The most common POSIX system calls (normally used via module os). +-------------- This module provides access to operating system functionality that is standardized by the C Standard and the POSIX standard (a thinly disguised Unix diff --git a/Doc/library/pprint.rst b/Doc/library/pprint.rst --- a/Doc/library/pprint.rst +++ b/Doc/library/pprint.rst @@ -3,6 +3,7 @@ .. module:: pprint :synopsis: Data pretty printer. + .. moduleauthor:: Fred L. Drake, Jr. .. sectionauthor:: Fred L. Drake, Jr. diff --git a/Doc/library/pty.rst b/Doc/library/pty.rst --- a/Doc/library/pty.rst +++ b/Doc/library/pty.rst @@ -4,9 +4,13 @@ .. module:: pty :platform: Linux :synopsis: Pseudo-Terminal Handling for Linux. + .. moduleauthor:: Steen Lumholt .. sectionauthor:: Moshe Zadka +**Source code:** :source:`Lib/pty.py` + +-------------- The :mod:`pty` module defines operations for handling the pseudo-terminal concept: starting another process and being able to write to and read from its diff --git a/Doc/library/pwd.rst b/Doc/library/pwd.rst --- a/Doc/library/pwd.rst +++ b/Doc/library/pwd.rst @@ -5,6 +5,7 @@ :platform: Unix :synopsis: The password database (getpwnam() and friends). +-------------- This module provides access to the Unix user account and password database. It is available on all Unix versions. diff --git a/Doc/library/py_compile.rst b/Doc/library/py_compile.rst --- a/Doc/library/py_compile.rst +++ b/Doc/library/py_compile.rst @@ -3,13 +3,14 @@ .. module:: py_compile :synopsis: Generate byte-code files from Python source files. + .. sectionauthor:: Fred L. Drake, Jr. .. documentation based on module docstrings +**Source code:** :source:`Lib/py_compile.py` + .. index:: pair: file; byte-code -**Source code:** :source:`Lib/py_compile.py` - -------------- The :mod:`py_compile` module provides a function to generate a byte-code file diff --git a/Doc/library/pyclbr.rst b/Doc/library/pyclbr.rst --- a/Doc/library/pyclbr.rst +++ b/Doc/library/pyclbr.rst @@ -3,6 +3,7 @@ .. module:: pyclbr :synopsis: Supports information extraction for a Python class browser. + .. sectionauthor:: Fred L. Drake, Jr. **Source code:** :source:`Lib/pyclbr.py` diff --git a/Doc/library/pydoc.rst b/Doc/library/pydoc.rst --- a/Doc/library/pydoc.rst +++ b/Doc/library/pydoc.rst @@ -3,17 +3,17 @@ .. module:: pydoc :synopsis: Documentation generator and online help system. + .. moduleauthor:: Ka-Ping Yee .. sectionauthor:: Ka-Ping Yee +**Source code:** :source:`Lib/pydoc.py` .. index:: single: documentation; generation single: documentation; online single: help; online -**Source code:** :source:`Lib/pydoc.py` - -------------- The :mod:`pydoc` module automatically generates documentation from Python diff --git a/Doc/library/pyexpat.rst b/Doc/library/pyexpat.rst --- a/Doc/library/pyexpat.rst +++ b/Doc/library/pyexpat.rst @@ -3,8 +3,10 @@ .. module:: xml.parsers.expat :synopsis: An interface to the Expat non-validating XML parser. + .. moduleauthor:: Paul Prescod +-------------- .. Markup notes: diff --git a/Doc/library/quopri.rst b/Doc/library/quopri.rst --- a/Doc/library/quopri.rst +++ b/Doc/library/quopri.rst @@ -4,13 +4,12 @@ .. module:: quopri :synopsis: Encode and decode files using the MIME quoted-printable encoding. +**Source code:** :source:`Lib/quopri.py` .. index:: pair: quoted-printable; encoding single: MIME; quoted-printable encoding -**Source code:** :source:`Lib/quopri.py` - -------------- This module performs quoted-printable transport encoding and decoding, as diff --git a/Doc/library/re.rst b/Doc/library/re.rst --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -3,9 +3,13 @@ .. module:: re :synopsis: Regular expression operations. + .. moduleauthor:: Fredrik Lundh .. sectionauthor:: Andrew M. Kuchling +**Source code:** :source:`Lib/re.py` + +-------------- This module provides regular expression matching operations similar to those found in Perl. diff --git a/Doc/library/readline.rst b/Doc/library/readline.rst --- a/Doc/library/readline.rst +++ b/Doc/library/readline.rst @@ -4,8 +4,10 @@ .. module:: readline :platform: Unix :synopsis: GNU readline support for Python. + .. sectionauthor:: Skip Montanaro +-------------- The :mod:`readline` module defines a number of functions to facilitate completion and reading/writing of history files from the Python interpreter. diff --git a/Doc/library/reprlib.rst b/Doc/library/reprlib.rst --- a/Doc/library/reprlib.rst +++ b/Doc/library/reprlib.rst @@ -3,6 +3,7 @@ .. module:: reprlib :synopsis: Alternate repr() implementation with size limits. + .. sectionauthor:: Fred L. Drake, Jr. **Source code:** :source:`Lib/reprlib.py` diff --git a/Doc/library/resource.rst b/Doc/library/resource.rst --- a/Doc/library/resource.rst +++ b/Doc/library/resource.rst @@ -4,9 +4,11 @@ .. module:: resource :platform: Unix :synopsis: An interface to provide resource usage information on the current process. + .. moduleauthor:: Jeremy Hylton .. sectionauthor:: Jeremy Hylton +-------------- This module provides basic mechanisms for measuring and controlling system resources utilized by a program. diff --git a/Doc/library/rlcompleter.rst b/Doc/library/rlcompleter.rst --- a/Doc/library/rlcompleter.rst +++ b/Doc/library/rlcompleter.rst @@ -3,6 +3,7 @@ .. module:: rlcompleter :synopsis: Python identifier completion, suitable for the GNU readline library. + .. sectionauthor:: Moshe Zadka **Source code:** :source:`Lib/rlcompleter.py` diff --git a/Doc/library/runpy.rst b/Doc/library/runpy.rst --- a/Doc/library/runpy.rst +++ b/Doc/library/runpy.rst @@ -3,6 +3,7 @@ .. module:: runpy :synopsis: Locate and run Python modules without importing them first. + .. moduleauthor:: Nick Coghlan **Source code:** :source:`Lib/runpy.py` diff --git a/Doc/library/sched.rst b/Doc/library/sched.rst --- a/Doc/library/sched.rst +++ b/Doc/library/sched.rst @@ -3,12 +3,13 @@ .. module:: sched :synopsis: General purpose event scheduler. + .. sectionauthor:: Moshe Zadka +**Source code:** :source:`Lib/sched.py` + .. index:: single: event scheduling -**Source code:** :source:`Lib/sched.py` - -------------- The :mod:`sched` module defines a class which implements a general purpose event diff --git a/Doc/library/select.rst b/Doc/library/select.rst --- a/Doc/library/select.rst +++ b/Doc/library/select.rst @@ -4,6 +4,7 @@ .. module:: select :synopsis: Wait for I/O completion on multiple streams. +-------------- This module provides access to the :c:func:`select` and :c:func:`poll` functions available in most operating systems, :c:func:`devpoll` available on diff --git a/Doc/library/selectors.rst b/Doc/library/selectors.rst --- a/Doc/library/selectors.rst +++ b/Doc/library/selectors.rst @@ -6,6 +6,9 @@ .. versionadded:: 3.4 +**Source code:** :source:`Lib/selectors.py` + +-------------- Introduction ------------ diff --git a/Doc/library/shelve.rst b/Doc/library/shelve.rst --- a/Doc/library/shelve.rst +++ b/Doc/library/shelve.rst @@ -4,11 +4,10 @@ .. module:: shelve :synopsis: Python object persistence. +**Source code:** :source:`Lib/shelve.py` .. index:: module: pickle -**Source code:** :source:`Lib/shelve.py` - -------------- A "shelf" is a persistent, dictionary-like object. The difference with "dbm" diff --git a/Doc/library/shlex.rst b/Doc/library/shlex.rst --- a/Doc/library/shlex.rst +++ b/Doc/library/shlex.rst @@ -3,6 +3,7 @@ .. module:: shlex :synopsis: Simple lexical analysis for Unix shell-like languages. + .. moduleauthor:: Eric S. Raymond .. moduleauthor:: Gustavo Niemeyer .. sectionauthor:: Eric S. Raymond diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -3,15 +3,16 @@ .. module:: shutil :synopsis: High-level file operations, including copying. + .. sectionauthor:: Fred L. Drake, Jr. .. partly based on the docstrings +**Source code:** :source:`Lib/shutil.py` + .. index:: single: file; copying single: copying files -**Source code:** :source:`Lib/shutil.py` - -------------- The :mod:`shutil` module offers a number of high-level operations on files and diff --git a/Doc/library/signal.rst b/Doc/library/signal.rst --- a/Doc/library/signal.rst +++ b/Doc/library/signal.rst @@ -4,6 +4,7 @@ .. module:: signal :synopsis: Set handlers for asynchronous events. +-------------- This module provides mechanisms to use signal handlers in Python. diff --git a/Doc/library/smtplib.rst b/Doc/library/smtplib.rst --- a/Doc/library/smtplib.rst +++ b/Doc/library/smtplib.rst @@ -3,15 +3,15 @@ .. module:: smtplib :synopsis: SMTP protocol client (requires sockets). + .. sectionauthor:: Eric S. Raymond +**Source code:** :source:`Lib/smtplib.py` .. index:: pair: SMTP; protocol single: Simple Mail Transfer Protocol -**Source code:** :source:`Lib/smtplib.py` - -------------- The :mod:`smtplib` module defines an SMTP client session object that can be used diff --git a/Doc/library/sndhdr.rst b/Doc/library/sndhdr.rst --- a/Doc/library/sndhdr.rst +++ b/Doc/library/sndhdr.rst @@ -3,15 +3,16 @@ .. module:: sndhdr :synopsis: Determine type of a sound file. + .. sectionauthor:: Fred L. Drake, Jr. .. Based on comments in the module source file. +**Source code:** :source:`Lib/sndhdr.py` + .. index:: single: A-LAW single: u-LAW -**Source code:** :source:`Lib/sndhdr.py` - -------------- The :mod:`sndhdr` provides utility functions which attempt to determine the type diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -4,6 +4,9 @@ .. module:: socket :synopsis: Low-level networking interface. +**Source code:** :source:`Lib/socket.py` + +-------------- This module provides access to the BSD *socket* interface. It is available on all modern Unix systems, Windows, MacOS, and probably additional platforms. diff --git a/Doc/library/spwd.rst b/Doc/library/spwd.rst --- a/Doc/library/spwd.rst +++ b/Doc/library/spwd.rst @@ -5,6 +5,7 @@ :platform: Unix :synopsis: The shadow password database (getspnam() and friends). +-------------- This module provides access to the Unix shadow password database. It is available on various Unix versions. diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -3,8 +3,12 @@ .. module:: sqlite3 :synopsis: A DB-API 2.0 implementation using SQLite 3.x. + .. sectionauthor:: Gerhard H?ring +**Source code:** :source:`Lib/sqlite3/` + +-------------- SQLite is a C library that provides a lightweight disk-based database that doesn't require a separate server process and allows accessing the database diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -7,13 +7,12 @@ .. moduleauthor:: Bill Janssen .. sectionauthor:: Bill Janssen +**Source code:** :source:`Lib/ssl.py` .. index:: single: OpenSSL; (use in module ssl) .. index:: TLS, SSL, Transport Layer Security, Secure Sockets Layer -**Source code:** :source:`Lib/ssl.py` - -------------- This module provides access to Transport Layer Security (often known as "Secure diff --git a/Doc/library/stat.rst b/Doc/library/stat.rst --- a/Doc/library/stat.rst +++ b/Doc/library/stat.rst @@ -4,10 +4,10 @@ .. module:: stat :synopsis: Utilities for interpreting the results of os.stat(), os.lstat() and os.fstat(). + .. sectionauthor:: Skip Montanaro -**Source code:** :source:`Modules/_stat.c` - :source:`Lib/stat.py` +**Source code:** :source:`Lib/stat.py` -------------- diff --git a/Doc/library/statistics.rst b/Doc/library/statistics.rst --- a/Doc/library/statistics.rst +++ b/Doc/library/statistics.rst @@ -3,18 +3,19 @@ .. module:: statistics :synopsis: mathematical statistics functions + .. moduleauthor:: Steven D'Aprano .. sectionauthor:: Steven D'Aprano .. versionadded:: 3.4 +**Source code:** :source:`Lib/statistics.py` + .. testsetup:: * from statistics import * __name__ = '' -**Source code:** :source:`Lib/statistics.py` - -------------- This module provides functions for calculating mathematical statistics of diff --git a/Doc/library/stringprep.rst b/Doc/library/stringprep.rst --- a/Doc/library/stringprep.rst +++ b/Doc/library/stringprep.rst @@ -3,9 +3,13 @@ .. module:: stringprep :synopsis: String preparation, as per RFC 3453 + .. moduleauthor:: Martin v. L?wis .. sectionauthor:: Martin v. L?wis +**Source code:** :source:`Lib/stringprep.py` + +-------------- When identifying things (such as host names) in the internet, it is often necessary to compare such identifications for "equality". Exactly how this diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -4,10 +4,14 @@ .. module:: struct :synopsis: Interpret bytes as packed binary data. +**Source code:** :source:`Lib/struct.py` + .. index:: pair: C; structures triple: packing; binary; data +-------------- + This module performs conversions between Python values and C structs represented as Python :class:`bytes` objects. This can be used in handling binary data stored in files or from network connections, among other sources. It uses diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -3,9 +3,13 @@ .. module:: subprocess :synopsis: Subprocess management. + .. moduleauthor:: Peter ?strand .. sectionauthor:: Peter ?strand +**Source code:** :source:`Lib/subprocess.py` + +-------------- The :mod:`subprocess` module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes. This module intends to diff --git a/Doc/library/sunau.rst b/Doc/library/sunau.rst --- a/Doc/library/sunau.rst +++ b/Doc/library/sunau.rst @@ -3,6 +3,7 @@ .. module:: sunau :synopsis: Provide an interface to the Sun AU sound format. + .. sectionauthor:: Moshe Zadka **Source code:** :source:`Lib/sunau.py` diff --git a/Doc/library/symbol.rst b/Doc/library/symbol.rst --- a/Doc/library/symbol.rst +++ b/Doc/library/symbol.rst @@ -3,6 +3,7 @@ .. module:: symbol :synopsis: Constants representing internal nodes of the parse tree. + .. sectionauthor:: Fred L. Drake, Jr. **Source code:** :source:`Lib/symbol.py` diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -4,6 +4,7 @@ .. module:: sys :synopsis: Access system-specific parameters and functions. +-------------- This module provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter. It is diff --git a/Doc/library/sysconfig.rst b/Doc/library/sysconfig.rst --- a/Doc/library/sysconfig.rst +++ b/Doc/library/sysconfig.rst @@ -3,16 +3,17 @@ .. module:: sysconfig :synopsis: Python's configuration information + .. moduleauthor:: Tarek Ziad? .. sectionauthor:: Tarek Ziad? -.. index:: - single: configuration information - .. versionadded:: 3.2 **Source code:** :source:`Lib/sysconfig.py` +.. index:: + single: configuration information + -------------- The :mod:`sysconfig` module provides access to Python's configuration diff --git a/Doc/library/syslog.rst b/Doc/library/syslog.rst --- a/Doc/library/syslog.rst +++ b/Doc/library/syslog.rst @@ -5,6 +5,7 @@ :platform: Unix :synopsis: An interface to the Unix syslog library routines. +-------------- This module provides an interface to the Unix ``syslog`` library routines. Refer to the Unix manual pages for a detailed description of the ``syslog`` diff --git a/Doc/library/tabnanny.rst b/Doc/library/tabnanny.rst --- a/Doc/library/tabnanny.rst +++ b/Doc/library/tabnanny.rst @@ -4,6 +4,7 @@ .. module:: tabnanny :synopsis: Tool for detecting white space related problems in Python source files in a directory tree. + .. moduleauthor:: Tim Peters .. sectionauthor:: Peter Funk diff --git a/Doc/library/tarfile.rst b/Doc/library/tarfile.rst --- a/Doc/library/tarfile.rst +++ b/Doc/library/tarfile.rst @@ -4,7 +4,6 @@ .. module:: tarfile :synopsis: Read and write tar-format archive files. - .. moduleauthor:: Lars Gust?bel .. sectionauthor:: Lars Gust?bel diff --git a/Doc/library/telnetlib.rst b/Doc/library/telnetlib.rst --- a/Doc/library/telnetlib.rst +++ b/Doc/library/telnetlib.rst @@ -3,13 +3,13 @@ .. module:: telnetlib :synopsis: Telnet client class. + .. sectionauthor:: Skip Montanaro +**Source code:** :source:`Lib/telnetlib.py` .. index:: single: protocol; Telnet -**Source code:** :source:`Lib/telnetlib.py` - -------------- The :mod:`telnetlib` module provides a :class:`Telnet` class that implements the diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst --- a/Doc/library/tempfile.rst +++ b/Doc/library/tempfile.rst @@ -1,19 +1,17 @@ :mod:`tempfile` --- Generate temporary files and directories ============================================================ -.. sectionauthor:: Zack Weinberg - - .. module:: tempfile :synopsis: Generate temporary files and directories. +.. sectionauthor:: Zack Weinberg + +**Source code:** :source:`Lib/tempfile.py` .. index:: pair: temporary; file name pair: temporary; file -**Source code:** :source:`Lib/tempfile.py` - -------------- This module creates temporary files and directories. It works on all diff --git a/Doc/library/termios.rst b/Doc/library/termios.rst --- a/Doc/library/termios.rst +++ b/Doc/library/termios.rst @@ -5,11 +5,12 @@ :platform: Unix :synopsis: POSIX style tty control. - .. index:: pair: POSIX; I/O control pair: tty; I/O control +-------------- + This module provides an interface to the POSIX calls for tty I/O control. For a complete description of these calls, see :manpage:`termios(2)` Unix manual page. It is only available for those Unix versions that support POSIX diff --git a/Doc/library/test.rst b/Doc/library/test.rst --- a/Doc/library/test.rst +++ b/Doc/library/test.rst @@ -3,6 +3,7 @@ .. module:: test :synopsis: Regression tests package containing the testing suite for Python. + .. sectionauthor:: Brett Cannon .. note:: @@ -12,6 +13,7 @@ mentioned here can change or be removed without notice between releases of Python. +-------------- The :mod:`test` package contains all regression tests for Python as well as the modules :mod:`test.support` and :mod:`test.regrtest`. diff --git a/Doc/library/textwrap.rst b/Doc/library/textwrap.rst --- a/Doc/library/textwrap.rst +++ b/Doc/library/textwrap.rst @@ -3,6 +3,7 @@ .. module:: textwrap :synopsis: Text wrapping and filling + .. moduleauthor:: Greg Ward .. sectionauthor:: Greg Ward diff --git a/Doc/library/time.rst b/Doc/library/time.rst --- a/Doc/library/time.rst +++ b/Doc/library/time.rst @@ -4,6 +4,7 @@ .. module:: time :synopsis: Time access and conversions. +-------------- This module provides various time-related functions. For related functionality, see also the :mod:`datetime` and :mod:`calendar` modules. diff --git a/Doc/library/timeit.rst b/Doc/library/timeit.rst --- a/Doc/library/timeit.rst +++ b/Doc/library/timeit.rst @@ -4,13 +4,12 @@ .. module:: timeit :synopsis: Measure the execution time of small code snippets. +**Source code:** :source:`Lib/timeit.py` .. index:: single: Benchmarking single: Performance -**Source code:** :source:`Lib/timeit.py` - -------------- This module provides a simple way to time small bits of Python code. It has both diff --git a/Doc/library/tkinter.rst b/Doc/library/tkinter.rst --- a/Doc/library/tkinter.rst +++ b/Doc/library/tkinter.rst @@ -3,8 +3,12 @@ .. module:: tkinter :synopsis: Interface to Tcl/Tk for graphical user interfaces + .. moduleauthor:: Guido van Rossum +**Source code:** :source:`Lib/tkinter/__init__.py` + +-------------- The :mod:`tkinter` package ("Tk interface") is the standard Python interface to the Tk GUI toolkit. Both Tk and :mod:`tkinter` are available on most Unix diff --git a/Doc/library/tkinter.scrolledtext.rst b/Doc/library/tkinter.scrolledtext.rst --- a/Doc/library/tkinter.scrolledtext.rst +++ b/Doc/library/tkinter.scrolledtext.rst @@ -4,8 +4,12 @@ .. module:: tkinter.scrolledtext :platform: Tk :synopsis: Text widget with a vertical scroll bar. + .. sectionauthor:: Fred L. Drake, Jr. +**Source code:** :source:`Lib/tkinter/scrolledtext.py` + +-------------- The :mod:`tkinter.scrolledtext` module provides a class of the same name which implements a basic text widget which has a vertical scroll bar configured to do diff --git a/Doc/library/tkinter.tix.rst b/Doc/library/tkinter.tix.rst --- a/Doc/library/tkinter.tix.rst +++ b/Doc/library/tkinter.tix.rst @@ -3,11 +3,15 @@ .. module:: tkinter.tix :synopsis: Tk Extension Widgets for Tkinter + .. sectionauthor:: Mike Clarkson +**Source code:** :source:`Lib/tkinter/tix.py` .. index:: single: Tix +-------------- + The :mod:`tkinter.tix` (Tk Interface Extension) module provides an additional rich set of widgets. Although the standard Tk library has many useful widgets, they are far from complete. The :mod:`tkinter.tix` library provides most of the diff --git a/Doc/library/tkinter.ttk.rst b/Doc/library/tkinter.ttk.rst --- a/Doc/library/tkinter.ttk.rst +++ b/Doc/library/tkinter.ttk.rst @@ -3,11 +3,15 @@ .. module:: tkinter.ttk :synopsis: Tk themed widget set + .. sectionauthor:: Guilherme Polo +**Source code:** :source:`Lib/tkinter/ttk.py` .. index:: single: ttk +-------------- + The :mod:`tkinter.ttk` module provides access to the Tk themed widget set, introduced in Tk 8.5. If Python has not been compiled against Tk 8.5, this module can still be accessed if *Tile* has been installed. The former diff --git a/Doc/library/token.rst b/Doc/library/token.rst --- a/Doc/library/token.rst +++ b/Doc/library/token.rst @@ -3,6 +3,7 @@ .. module:: token :synopsis: Constants representing terminal nodes of the parse tree. + .. sectionauthor:: Fred L. Drake, Jr. **Source code:** :source:`Lib/token.py` diff --git a/Doc/library/tokenize.rst b/Doc/library/tokenize.rst --- a/Doc/library/tokenize.rst +++ b/Doc/library/tokenize.rst @@ -3,6 +3,7 @@ .. module:: tokenize :synopsis: Lexical scanner for Python source code. + .. moduleauthor:: Ka Ping Yee .. sectionauthor:: Fred L. Drake, Jr. diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst --- a/Doc/library/traceback.rst +++ b/Doc/library/traceback.rst @@ -4,6 +4,9 @@ .. module:: traceback :synopsis: Print or retrieve a stack traceback. +**Source code:** :source:`Lib/traceback.py` + +-------------- This module provides a standard interface to extract, format and print stack traces of Python programs. It exactly mimics the behavior of the Python diff --git a/Doc/library/tracemalloc.rst b/Doc/library/tracemalloc.rst --- a/Doc/library/tracemalloc.rst +++ b/Doc/library/tracemalloc.rst @@ -6,6 +6,10 @@ .. versionadded:: 3.4 +**Source code:** :source:`Lib/tracemalloc.py` + +-------------- + The tracemalloc module is a debug tool to trace memory blocks allocated by Python. It provides the following information: diff --git a/Doc/library/tty.rst b/Doc/library/tty.rst --- a/Doc/library/tty.rst +++ b/Doc/library/tty.rst @@ -4,9 +4,13 @@ .. module:: tty :platform: Unix :synopsis: Utility functions that perform common terminal control operations. + .. moduleauthor:: Steen Lumholt .. sectionauthor:: Moshe Zadka +**Source code:** :source:`Lib/tty.py` + +-------------- The :mod:`tty` module defines functions for putting the tty into cbreak and raw modes. diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst --- a/Doc/library/turtle.rst +++ b/Doc/library/turtle.rst @@ -4,13 +4,18 @@ .. module:: turtle :synopsis: An educational framework for simple graphics applications + .. sectionauthor:: Gregor Lingl +**Source code:** :source:`Lib/turtle.py` + .. testsetup:: default from turtle import * turtle = Turtle() +-------------- + Introduction ============ diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -4,10 +4,10 @@ .. module:: typing :synopsis: Support for type hints (see PEP 484). +.. versionadded:: 3.5 + **Source code:** :source:`Lib/typing.py` -.. versionadded:: 3.5 - -------------- This module supports type hints as specified by :pep:`484`. The most diff --git a/Doc/library/unicodedata.rst b/Doc/library/unicodedata.rst --- a/Doc/library/unicodedata.rst +++ b/Doc/library/unicodedata.rst @@ -3,16 +3,18 @@ .. module:: unicodedata :synopsis: Access the Unicode Database. + .. moduleauthor:: Marc-Andr? Lemburg .. sectionauthor:: Marc-Andr? Lemburg .. sectionauthor:: Martin v. L?wis - .. index:: single: Unicode single: character pair: Unicode; database +-------------- + This module provides access to the Unicode Character Database (UCD) which defines character properties for all Unicode characters. The data contained in this database is compiled from the `UCD version 8.0.0 diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst --- a/Doc/library/unittest.mock.rst +++ b/Doc/library/unittest.mock.rst @@ -4,11 +4,16 @@ .. module:: unittest.mock :synopsis: Mock object library. + .. moduleauthor:: Michael Foord .. currentmodule:: unittest.mock .. versionadded:: 3.3 +**Source code:** :source:`Lib/unittest/mock.py` + +-------------- + :mod:`unittest.mock` is a library for testing in Python. It allows you to replace parts of your system under test with mock objects and make assertions about how they have been used. @@ -32,8 +37,6 @@ There is a backport of :mod:`unittest.mock` for earlier versions of Python, available as `mock on PyPI `_. -**Source code:** :source:`Lib/unittest/mock.py` - Quick Guide ----------- diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -3,11 +3,16 @@ .. module:: unittest :synopsis: Unit testing framework for Python. + .. moduleauthor:: Steve Purcell .. sectionauthor:: Steve Purcell .. sectionauthor:: Fred L. Drake, Jr. .. sectionauthor:: Raymond Hettinger +**Source code:** :source:`Lib/unittest/__init__.py` + +-------------- + (If you are already familiar with the basic concepts of testing, you might want to skip to :ref:`the list of assert methods `.) diff --git a/Doc/library/urllib.error.rst b/Doc/library/urllib.error.rst --- a/Doc/library/urllib.error.rst +++ b/Doc/library/urllib.error.rst @@ -3,9 +3,13 @@ .. module:: urllib.error :synopsis: Exception classes raised by urllib.request. + .. moduleauthor:: Jeremy Hylton .. sectionauthor:: Senthil Kumaran +**Source code:** :source:`Lib/urllib/error.py` + +-------------- The :mod:`urllib.error` module defines the exception classes for exceptions raised by :mod:`urllib.request`. The base exception class is :exc:`URLError`. diff --git a/Doc/library/urllib.parse.rst b/Doc/library/urllib.parse.rst --- a/Doc/library/urllib.parse.rst +++ b/Doc/library/urllib.parse.rst @@ -4,6 +4,7 @@ .. module:: urllib.parse :synopsis: Parse URLs into or assemble them from components. +**Source code:** :source:`Lib/urllib/parse.py` .. index:: single: WWW @@ -12,8 +13,6 @@ pair: URL; parsing pair: relative; URL -**Source code:** :source:`Lib/urllib/parse.py` - -------------- This module defines a standard interface to break Uniform Resource Locator (URL) 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 @@ -3,10 +3,14 @@ .. module:: urllib.request :synopsis: Extensible library for opening URLs. + .. moduleauthor:: Jeremy Hylton .. sectionauthor:: Moshe Zadka .. sectionauthor:: Senthil Kumaran +**Source code:** :source:`Lib/urllib/request.py` + +-------------- The :mod:`urllib.request` module defines functions and classes which help in opening URLs (mostly HTTP) in a complex world --- basic and digest diff --git a/Doc/library/urllib.robotparser.rst b/Doc/library/urllib.robotparser.rst --- a/Doc/library/urllib.robotparser.rst +++ b/Doc/library/urllib.robotparser.rst @@ -4,8 +4,10 @@ .. module:: urllib.robotparser :synopsis: Load a robots.txt file and answer questions about fetchability of other URLs. + .. sectionauthor:: Skip Montanaro +**Source code:** :source:`Lib/urllib/robotparser.py` .. index:: single: WWW @@ -13,6 +15,8 @@ single: URL single: robots.txt +-------------- + This module provides a single class, :class:`RobotFileParser`, which answers questions about whether or not a particular user agent can fetch a URL on the Web site that published the :file:`robots.txt` file. For more details on the diff --git a/Doc/library/urllib.rst b/Doc/library/urllib.rst --- a/Doc/library/urllib.rst +++ b/Doc/library/urllib.rst @@ -3,6 +3,10 @@ .. module:: urllib +**Source code:** :source:`Lib/urllib/` + +-------------- + ``urllib`` is a package that collects several modules for working with URLs: * :mod:`urllib.request` for opening and reading URLs diff --git a/Doc/library/uu.rst b/Doc/library/uu.rst --- a/Doc/library/uu.rst +++ b/Doc/library/uu.rst @@ -3,6 +3,7 @@ .. module:: uu :synopsis: Encode and decode files in uuencode format. + .. moduleauthor:: Lance Ellinghouse **Source code:** :source:`Lib/uu.py` diff --git a/Doc/library/uuid.rst b/Doc/library/uuid.rst --- a/Doc/library/uuid.rst +++ b/Doc/library/uuid.rst @@ -6,6 +6,9 @@ .. moduleauthor:: Ka-Ping Yee .. sectionauthor:: George Yoshida +**Source code:** :source:`Lib/uuid.py` + +-------------- This module provides immutable :class:`UUID` objects (the :class:`UUID` class) and the functions :func:`uuid1`, :func:`uuid3`, :func:`uuid4`, :func:`uuid5` for diff --git a/Doc/library/venv.rst b/Doc/library/venv.rst --- a/Doc/library/venv.rst +++ b/Doc/library/venv.rst @@ -3,16 +3,16 @@ .. module:: venv :synopsis: Creation of virtual environments. + .. moduleauthor:: Vinay Sajip .. sectionauthor:: Vinay Sajip +.. versionadded:: 3.3 + +**Source code:** :source:`Lib/venv/` .. index:: pair: Environments; virtual -.. versionadded:: 3.3 - -**Source code:** :source:`Lib/venv` - -------------- The :mod:`venv` module provides support for creating lightweight "virtual diff --git a/Doc/library/warnings.rst b/Doc/library/warnings.rst --- a/Doc/library/warnings.rst +++ b/Doc/library/warnings.rst @@ -1,13 +1,13 @@ :mod:`warnings` --- Warning control =================================== -.. index:: single: warnings - .. module:: warnings :synopsis: Issue warning messages and control their disposition. **Source code:** :source:`Lib/warnings.py` +.. index:: single: warnings + -------------- Warning messages are typically issued in situations where it is useful to alert diff --git a/Doc/library/wave.rst b/Doc/library/wave.rst --- a/Doc/library/wave.rst +++ b/Doc/library/wave.rst @@ -3,6 +3,7 @@ .. module:: wave :synopsis: Provide an interface to the WAV sound format. + .. sectionauthor:: Moshe Zadka .. Documentations stolen from comments in file. diff --git a/Doc/library/weakref.rst b/Doc/library/weakref.rst --- a/Doc/library/weakref.rst +++ b/Doc/library/weakref.rst @@ -3,6 +3,7 @@ .. module:: weakref :synopsis: Support for weak references and weak dictionaries. + .. moduleauthor:: Fred L. Drake, Jr. .. moduleauthor:: Neil Schemenauer .. moduleauthor:: Martin von L?wis diff --git a/Doc/library/webbrowser.rst b/Doc/library/webbrowser.rst --- a/Doc/library/webbrowser.rst +++ b/Doc/library/webbrowser.rst @@ -3,6 +3,7 @@ .. module:: webbrowser :synopsis: Easy-to-use controller for Web browsers. + .. moduleauthor:: Fred L. Drake, Jr. .. sectionauthor:: Fred L. Drake, Jr. diff --git a/Doc/library/winreg.rst b/Doc/library/winreg.rst --- a/Doc/library/winreg.rst +++ b/Doc/library/winreg.rst @@ -4,8 +4,10 @@ .. module:: winreg :platform: Windows :synopsis: Routines and objects for manipulating the Windows registry. + .. sectionauthor:: Mark Hammond +-------------- These functions expose the Windows registry API to Python. Instead of using an integer as the registry handle, a :ref:`handle object ` is used diff --git a/Doc/library/winsound.rst b/Doc/library/winsound.rst --- a/Doc/library/winsound.rst +++ b/Doc/library/winsound.rst @@ -4,9 +4,11 @@ .. module:: winsound :platform: Windows :synopsis: Access to the sound-playing machinery for Windows. + .. moduleauthor:: Toby Dickenson .. sectionauthor:: Fred L. Drake, Jr. +-------------- The :mod:`winsound` module provides access to the basic sound-playing machinery provided by Windows platforms. It includes functions and several constants. diff --git a/Doc/library/wsgiref.rst b/Doc/library/wsgiref.rst --- a/Doc/library/wsgiref.rst +++ b/Doc/library/wsgiref.rst @@ -3,9 +3,11 @@ .. module:: wsgiref :synopsis: WSGI Utilities and Reference Implementation. + .. moduleauthor:: Phillip J. Eby .. sectionauthor:: Phillip J. Eby +-------------- The Web Server Gateway Interface (WSGI) is a standard interface between web server software and web applications written in Python. Having a standard diff --git a/Doc/library/xdrlib.rst b/Doc/library/xdrlib.rst --- a/Doc/library/xdrlib.rst +++ b/Doc/library/xdrlib.rst @@ -4,13 +4,12 @@ .. module:: xdrlib :synopsis: Encoders and decoders for the External Data Representation (XDR). +**Source code:** :source:`Lib/xdrlib.py` .. index:: single: XDR single: External Data Representation -**Source code:** :source:`Lib/xdrlib.py` - -------------- The :mod:`xdrlib` module supports the External Data Representation Standard as diff --git a/Doc/library/xml.dom.minidom.rst b/Doc/library/xml.dom.minidom.rst --- a/Doc/library/xml.dom.minidom.rst +++ b/Doc/library/xml.dom.minidom.rst @@ -3,6 +3,7 @@ .. module:: xml.dom.minidom :synopsis: Minimal Document Object Model (DOM) implementation. + .. moduleauthor:: Paul Prescod .. sectionauthor:: Paul Prescod .. sectionauthor:: Martin v. L?wis diff --git a/Doc/library/xml.dom.pulldom.rst b/Doc/library/xml.dom.pulldom.rst --- a/Doc/library/xml.dom.pulldom.rst +++ b/Doc/library/xml.dom.pulldom.rst @@ -3,6 +3,7 @@ .. module:: xml.dom.pulldom :synopsis: Support for building partial DOM trees from SAX events. + .. moduleauthor:: Paul Prescod **Source code:** :source:`Lib/xml/dom/pulldom.py` diff --git a/Doc/library/xml.dom.rst b/Doc/library/xml.dom.rst --- a/Doc/library/xml.dom.rst +++ b/Doc/library/xml.dom.rst @@ -3,9 +3,13 @@ .. module:: xml.dom :synopsis: Document Object Model API for Python. + .. sectionauthor:: Paul Prescod .. sectionauthor:: Martin v. L?wis +**Source code:** :source:`Lib/xml/dom/__init__.py` + +-------------- The Document Object Model, or "DOM," is a cross-language API from the World Wide Web Consortium (W3C) for accessing and modifying XML documents. A DOM diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -3,8 +3,13 @@ .. module:: xml.etree.ElementTree :synopsis: Implementation of the ElementTree API. + .. moduleauthor:: Fredrik Lundh +**Source code:** :source:`Lib/xml/etree/ElementTree.py` + +-------------- + The :mod:`xml.etree.ElementTree` module implements a simple and efficient API for parsing and creating XML data. diff --git a/Doc/library/xml.rst b/Doc/library/xml.rst --- a/Doc/library/xml.rst +++ b/Doc/library/xml.rst @@ -5,9 +5,13 @@ .. module:: xml :synopsis: Package containing XML processing modules + .. sectionauthor:: Christian Heimes .. sectionauthor:: Georg Brandl +**Source code:** :source:`Lib/xml/` + +-------------- Python's interfaces for processing XML are grouped in the ``xml`` package. diff --git a/Doc/library/xml.sax.handler.rst b/Doc/library/xml.sax.handler.rst --- a/Doc/library/xml.sax.handler.rst +++ b/Doc/library/xml.sax.handler.rst @@ -3,9 +3,13 @@ .. module:: xml.sax.handler :synopsis: Base classes for SAX event handlers. + .. moduleauthor:: Lars Marius Garshol .. sectionauthor:: Martin v. L?wis +**Source code:** :source:`Lib/xml/sax/handler.py` + +-------------- The SAX API defines four kinds of handlers: content handlers, DTD handlers, error handlers, and entity resolvers. Applications normally only need to diff --git a/Doc/library/xml.sax.reader.rst b/Doc/library/xml.sax.reader.rst --- a/Doc/library/xml.sax.reader.rst +++ b/Doc/library/xml.sax.reader.rst @@ -3,9 +3,13 @@ .. module:: xml.sax.xmlreader :synopsis: Interface which SAX-compliant XML parsers must implement. + .. moduleauthor:: Lars Marius Garshol .. sectionauthor:: Martin v. L?wis +**Source code:** :source:`Lib/xml/sax/xmlreader.py` + +-------------- SAX parsers implement the :class:`XMLReader` interface. They are implemented in a Python module, which must provide a function :func:`create_parser`. This diff --git a/Doc/library/xml.sax.rst b/Doc/library/xml.sax.rst --- a/Doc/library/xml.sax.rst +++ b/Doc/library/xml.sax.rst @@ -3,10 +3,14 @@ .. module:: xml.sax :synopsis: Package containing SAX2 base classes and convenience functions. + .. moduleauthor:: Lars Marius Garshol .. sectionauthor:: Fred L. Drake, Jr. .. sectionauthor:: Martin v. L?wis +**Source code:** :source:`Lib/xml/sax/__init__.py` + +-------------- The :mod:`xml.sax` package provides a number of modules which implement the Simple API for XML (SAX) interface for Python. The package itself provides the diff --git a/Doc/library/xml.sax.utils.rst b/Doc/library/xml.sax.utils.rst --- a/Doc/library/xml.sax.utils.rst +++ b/Doc/library/xml.sax.utils.rst @@ -3,9 +3,13 @@ .. module:: xml.sax.saxutils :synopsis: Convenience functions and classes for use with SAX. + .. moduleauthor:: Lars Marius Garshol .. sectionauthor:: Martin v. L?wis +**Source code:** :source:`Lib/xml/sax/saxutils.py` + +-------------- The module :mod:`xml.sax.saxutils` contains a number of classes and functions that are commonly useful when creating SAX applications, either in direct use, diff --git a/Doc/library/xmlrpc.client.rst b/Doc/library/xmlrpc.client.rst --- a/Doc/library/xmlrpc.client.rst +++ b/Doc/library/xmlrpc.client.rst @@ -3,15 +3,15 @@ .. module:: xmlrpc.client :synopsis: XML-RPC client access. + .. moduleauthor:: Fredrik Lundh .. sectionauthor:: Eric S. Raymond +**Source code:** :source:`Lib/xmlrpc/client.py` .. XXX Not everything is documented yet. It might be good to describe Marshaller, Unmarshaller, getparser and Transport. -**Source code:** :source:`Lib/xmlrpc/client.py` - -------------- XML-RPC is a Remote Procedure Call method that uses XML passed via HTTP(S) as a diff --git a/Doc/library/xmlrpc.server.rst b/Doc/library/xmlrpc.server.rst --- a/Doc/library/xmlrpc.server.rst +++ b/Doc/library/xmlrpc.server.rst @@ -3,6 +3,7 @@ .. module:: xmlrpc.server :synopsis: Basic XML-RPC server implementations. + .. moduleauthor:: Brian Quinlan .. sectionauthor:: Fred L. Drake, Jr. diff --git a/Doc/library/zipapp.rst b/Doc/library/zipapp.rst --- a/Doc/library/zipapp.rst +++ b/Doc/library/zipapp.rst @@ -4,14 +4,13 @@ .. module:: zipapp :synopsis: Manage executable python zip archives +.. versionadded:: 3.5 + +**Source code:** :source:`Lib/zipapp.py` .. index:: single: Executable Zip Files -.. versionadded:: 3.5 - -**Source code:** :source:`Lib/zipapp.py` - -------------- This module provides tools to manage the creation of zip files containing diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -3,6 +3,7 @@ .. module:: zipfile :synopsis: Read and write ZIP-format archive files. + .. moduleauthor:: James C. Ahlstrom .. sectionauthor:: James C. Ahlstrom diff --git a/Doc/library/zipimport.rst b/Doc/library/zipimport.rst --- a/Doc/library/zipimport.rst +++ b/Doc/library/zipimport.rst @@ -3,8 +3,10 @@ .. module:: zipimport :synopsis: support for importing Python modules from ZIP archives. + .. moduleauthor:: Just van Rossum +-------------- This module adds the ability to import Python modules (:file:`\*.py`, :file:`\*.py[co]`) and packages from ZIP-format archives. It is usually not diff --git a/Doc/library/zlib.rst b/Doc/library/zlib.rst --- a/Doc/library/zlib.rst +++ b/Doc/library/zlib.rst @@ -5,6 +5,7 @@ :synopsis: Low-level interface to compression and decompression routines compatible with gzip. +-------------- For applications that require data compression, the functions in this module allow compression and decompression, using the zlib library. The zlib library diff --git a/Lib/idlelib/help.html b/Lib/idlelib/help.html --- a/Lib/idlelib/help.html +++ b/Lib/idlelib/help.html @@ -75,7 +75,9 @@

25.5. IDLE?

-

IDLE is Python’s Integrated Development and Learning Environment.

+

Source code: Lib/idlelib/

+
+

IDLE is Python’s Integrated Development and Learning Environment.

IDLE has the following features:

  • coded in 100% pure Python, using the tkinter GUI toolkit
  • @@ -701,7 +703,7 @@ The Python Software Foundation is a non-profit corporation. Please donate.
    - Last updated on May 02, 2016. + Last updated on Jun 11, 2016. Found a bug?
    Created using Sphinx 1.3.3. diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -831,6 +831,7 @@ Amos Latteier Piers Lauder Ben Laurie +Yoni Lavi Simon Law Julia Lawall Chris Lawrence diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -207,6 +207,12 @@ - Issue #23977: Add more asserts to test_delegator. +Documentation +------------- + +- Issue #22558: Add remaining doc links to source code for Python-coded modules. + Patch by Yoni Lavi. + Tests ----- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 15:06:34 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 11 Jun 2016 19:06:34 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIyNTU4?= =?utf-8?q?=3A_Add_remaining_doc_links_to_source_code_for_Python-coded_mod?= =?utf-8?q?ules=2E?= Message-ID: <20160611190629.120685.70385.18EE7082@psf.io> https://hg.python.org/cpython/rev/222c1d461aa8 changeset: 101877:222c1d461aa8 branch: 3.5 parent: 101872:0bda9bc443ce user: Terry Jan Reedy date: Sat Jun 11 15:02:54 2016 -0400 summary: Issue #22558: Add remaining doc links to source code for Python-coded modules. Reformat header above separator line (added if missing) to a common format. Patch by Yoni Lavi. files: Doc/library/2to3.rst | 4 ++++ Doc/library/__main__.rst | 2 ++ Doc/library/_thread.rst | 3 ++- Doc/library/abc.rst | 1 + Doc/library/aifc.rst | 3 +-- Doc/library/argparse.rst | 1 + Doc/library/array.rst | 3 ++- Doc/library/asynchat.rst | 1 + Doc/library/asyncio.rst | 8 ++++---- Doc/library/asyncore.rst | 1 + Doc/library/atexit.rst | 2 ++ Doc/library/audioop.rst | 1 + Doc/library/base64.rst | 3 +++ Doc/library/binascii.rst | 3 ++- Doc/library/binhex.rst | 3 +++ Doc/library/builtins.rst | 1 + Doc/library/bz2.rst | 4 ++++ Doc/library/calendar.rst | 1 + Doc/library/cgi.rst | 3 +-- Doc/library/cgitb.rst | 4 ++++ Doc/library/chunk.rst | 4 ++++ Doc/library/cmath.rst | 1 + Doc/library/cmd.rst | 1 + Doc/library/code.rst | 2 ++ Doc/library/codecs.rst | 3 +++ Doc/library/codeop.rst | 5 +++++ Doc/library/collections.abc.rst | 5 +++-- Doc/library/collections.rst | 5 +++-- Doc/library/colorsys.rst | 1 + Doc/library/compileall.rst | 1 - Doc/library/configparser.rst | 2 ++ Doc/library/copy.rst | 4 ++++ Doc/library/copyreg.rst | 3 +++ Doc/library/crypt.rst | 4 ++++ Doc/library/csv.rst | 3 +++ Doc/library/ctypes.rst | 2 ++ Doc/library/curses.ascii.rst | 2 ++ Doc/library/curses.panel.rst | 2 ++ Doc/library/curses.rst | 3 +++ Doc/library/datetime.rst | 3 +++ Doc/library/dbm.rst | 4 ++++ Doc/library/decimal.rst | 2 ++ Doc/library/difflib.rst | 3 +++ Doc/library/distutils.rst | 2 ++ Doc/library/doctest.rst | 4 ++++ Doc/library/email.charset.rst | 3 +++ Doc/library/email.contentmanager.rst | 7 +++++-- Doc/library/email.encoders.rst | 3 +++ Doc/library/email.errors.rst | 3 +++ Doc/library/email.generator.rst | 3 +++ Doc/library/email.header.rst | 3 +++ Doc/library/email.headerregistry.rst | 7 +++++-- Doc/library/email.iterators.rst | 3 +++ Doc/library/email.message.rst | 3 +++ Doc/library/email.mime.rst | 3 +++ Doc/library/email.parser.rst | 3 +++ Doc/library/email.policy.rst | 3 +++ Doc/library/email.rst | 4 ++++ Doc/library/email.util.rst | 3 +++ Doc/library/ensurepip.rst | 2 ++ Doc/library/errno.rst | 1 + Doc/library/faulthandler.rst | 2 ++ Doc/library/fcntl.rst | 4 +++- Doc/library/filecmp.rst | 1 + Doc/library/fileinput.rst | 1 + Doc/library/fnmatch.rst | 3 +-- Doc/library/formatter.rst | 1 + Doc/library/fpectl.rst | 4 +++- Doc/library/fractions.rst | 1 + Doc/library/ftplib.rst | 3 +-- Doc/library/functools.rst | 1 + Doc/library/gc.rst | 2 ++ Doc/library/getopt.rst | 4 ++-- Doc/library/getpass.rst | 5 +++++ Doc/library/gettext.rst | 1 + Doc/library/glob.rst | 3 +-- Doc/library/grp.rst | 1 + Doc/library/hashlib.rst | 4 ++-- Doc/library/heapq.rst | 1 + Doc/library/hmac.rst | 1 + Doc/library/html.entities.rst | 1 + Doc/library/html.parser.rst | 3 +-- Doc/library/http.client.rst | 3 +-- Doc/library/http.cookiejar.rst | 1 + Doc/library/http.cookies.rst | 1 + Doc/library/http.rst | 4 +++- Doc/library/http.server.rst | 3 +-- Doc/library/idle.rst | 6 +++++- Doc/library/imaplib.rst | 4 ++-- Doc/library/imp.rst | 4 ++++ Doc/library/importlib.rst | 3 +++ Doc/library/inspect.rst | 1 + Doc/library/io.rst | 5 +++++ Doc/library/ipaddress.rst | 1 + Doc/library/itertools.rst | 3 ++- Doc/library/json.rst | 5 +++++ Doc/library/linecache.rst | 1 + Doc/library/locale.rst | 4 ++++ Doc/library/logging.config.rst | 5 ++--- Doc/library/logging.handlers.rst | 5 ++--- Doc/library/logging.rst | 5 +---- Doc/library/lzma.rst | 4 ++++ Doc/library/macpath.rst | 3 +++ Doc/library/mailbox.rst | 4 ++++ Doc/library/marshal.rst | 1 + Doc/library/math.rst | 2 ++ Doc/library/mimetypes.rst | 4 ++-- Doc/library/mmap.rst | 1 + Doc/library/modulefinder.rst | 5 ++--- Doc/library/msilib.rst | 4 ++++ Doc/library/msvcrt.rst | 2 ++ Doc/library/multiprocessing.rst | 3 +++ Doc/library/netrc.rst | 1 + Doc/library/nis.rst | 2 ++ Doc/library/nntplib.rst | 3 +-- Doc/library/numbers.rst | 3 +++ Doc/library/operator.rst | 4 ++-- Doc/library/optparse.rst | 5 +++-- Doc/library/os.path.rst | 6 ++++++ Doc/library/os.rst | 3 +++ Doc/library/ossaudiodev.rst | 1 + Doc/library/parser.rst | 4 +++- Doc/library/pathlib.rst | 6 +++++- Doc/library/pdb.rst | 4 ++-- Doc/library/pickle.rst | 14 +++++++++----- Doc/library/pipes.rst | 1 + Doc/library/platform.rst | 1 + Doc/library/plistlib.rst | 5 +++-- Doc/library/poplib.rst | 5 +++-- Doc/library/posix.rst | 1 + Doc/library/pprint.rst | 1 + Doc/library/pty.rst | 4 ++++ Doc/library/pwd.rst | 1 + Doc/library/py_compile.rst | 5 +++-- Doc/library/pyclbr.rst | 1 + Doc/library/pydoc.rst | 4 ++-- Doc/library/pyexpat.rst | 2 ++ Doc/library/quopri.rst | 3 +-- Doc/library/re.rst | 4 ++++ Doc/library/readline.rst | 2 ++ Doc/library/reprlib.rst | 1 + Doc/library/resource.rst | 2 ++ Doc/library/rlcompleter.rst | 1 + Doc/library/runpy.rst | 1 + Doc/library/sched.rst | 5 +++-- Doc/library/select.rst | 1 + Doc/library/selectors.rst | 3 +++ Doc/library/shelve.rst | 3 +-- Doc/library/shlex.rst | 1 + Doc/library/shutil.rst | 5 +++-- Doc/library/signal.rst | 1 + Doc/library/smtplib.rst | 4 ++-- Doc/library/sndhdr.rst | 5 +++-- Doc/library/socket.rst | 3 +++ Doc/library/spwd.rst | 1 + Doc/library/sqlite3.rst | 4 ++++ Doc/library/ssl.rst | 3 +-- Doc/library/stat.rst | 4 ++-- Doc/library/statistics.rst | 5 +++-- Doc/library/stringprep.rst | 4 ++++ Doc/library/struct.rst | 4 ++++ Doc/library/subprocess.rst | 4 ++++ Doc/library/sunau.rst | 1 + Doc/library/symbol.rst | 1 + Doc/library/sys.rst | 1 + Doc/library/sysconfig.rst | 7 ++++--- Doc/library/syslog.rst | 1 + Doc/library/tabnanny.rst | 1 + Doc/library/tarfile.rst | 1 - Doc/library/telnetlib.rst | 4 ++-- Doc/library/tempfile.rst | 8 +++----- Doc/library/termios.rst | 3 ++- Doc/library/test.rst | 2 ++ Doc/library/textwrap.rst | 1 + Doc/library/time.rst | 1 + Doc/library/timeit.rst | 3 +-- Doc/library/tkinter.rst | 4 ++++ Doc/library/tkinter.scrolledtext.rst | 4 ++++ Doc/library/tkinter.tix.rst | 4 ++++ Doc/library/tkinter.ttk.rst | 4 ++++ Doc/library/token.rst | 1 + Doc/library/tokenize.rst | 1 + Doc/library/traceback.rst | 3 +++ Doc/library/tracemalloc.rst | 4 ++++ Doc/library/tty.rst | 4 ++++ Doc/library/turtle.rst | 5 +++++ Doc/library/typing.rst | 4 ++-- Doc/library/unicodedata.rst | 4 +++- Doc/library/unittest.mock.rst | 7 +++++-- Doc/library/unittest.rst | 5 +++++ Doc/library/urllib.error.rst | 4 ++++ Doc/library/urllib.parse.rst | 3 +-- Doc/library/urllib.request.rst | 4 ++++ Doc/library/urllib.robotparser.rst | 4 ++++ Doc/library/urllib.rst | 4 ++++ Doc/library/uu.rst | 1 + Doc/library/uuid.rst | 3 +++ Doc/library/venv.rst | 8 ++++---- Doc/library/warnings.rst | 4 ++-- Doc/library/wave.rst | 1 + Doc/library/weakref.rst | 1 + Doc/library/webbrowser.rst | 1 + Doc/library/winreg.rst | 2 ++ Doc/library/winsound.rst | 2 ++ Doc/library/wsgiref.rst | 2 ++ Doc/library/xdrlib.rst | 3 +-- Doc/library/xml.dom.minidom.rst | 1 + Doc/library/xml.dom.pulldom.rst | 1 + Doc/library/xml.dom.rst | 4 ++++ Doc/library/xml.etree.elementtree.rst | 5 +++++ Doc/library/xml.rst | 4 ++++ Doc/library/xml.sax.handler.rst | 4 ++++ Doc/library/xml.sax.reader.rst | 4 ++++ Doc/library/xml.sax.rst | 4 ++++ Doc/library/xml.sax.utils.rst | 4 ++++ Doc/library/xmlrpc.client.rst | 4 ++-- Doc/library/xmlrpc.server.rst | 1 + Doc/library/zipapp.rst | 7 +++---- Doc/library/zipfile.rst | 1 + Doc/library/zipimport.rst | 2 ++ Doc/library/zlib.rst | 1 + Lib/idlelib/help.html | 6 ++++-- Misc/ACKS | 1 + Misc/NEWS | 3 +++ 224 files changed, 539 insertions(+), 136 deletions(-) diff --git a/Doc/library/2to3.rst b/Doc/library/2to3.rst --- a/Doc/library/2to3.rst +++ b/Doc/library/2to3.rst @@ -449,10 +449,14 @@ .. module:: lib2to3 :synopsis: the 2to3 library + .. moduleauthor:: Guido van Rossum .. moduleauthor:: Collin Winter .. moduleauthor:: Benjamin Peterson +**Source code:** :source:`Lib/lib2to3/` + +-------------- .. note:: diff --git a/Doc/library/__main__.rst b/Doc/library/__main__.rst --- a/Doc/library/__main__.rst +++ b/Doc/library/__main__.rst @@ -5,6 +5,8 @@ .. module:: __main__ :synopsis: The environment where the top-level script is run. +-------------- + ``'__main__'`` is the name of the scope in which top-level code executes. A module's __name__ is set equal to ``'__main__'`` when read from standard input, a script, or from an interactive prompt. diff --git a/Doc/library/_thread.rst b/Doc/library/_thread.rst --- a/Doc/library/_thread.rst +++ b/Doc/library/_thread.rst @@ -4,13 +4,14 @@ .. module:: _thread :synopsis: Low-level threading API. - .. index:: single: light-weight processes single: processes, light-weight single: binary semaphores single: semaphores, binary +-------------- + This module provides low-level primitives for working with multiple threads (also called :dfn:`light-weight processes` or :dfn:`tasks`) --- multiple threads of control sharing their global data space. For synchronization, simple locks diff --git a/Doc/library/abc.rst b/Doc/library/abc.rst --- a/Doc/library/abc.rst +++ b/Doc/library/abc.rst @@ -3,6 +3,7 @@ .. module:: abc :synopsis: Abstract base classes according to PEP 3119. + .. moduleauthor:: Guido van Rossum .. sectionauthor:: Georg Brandl .. much of the content adapted from docstrings diff --git a/Doc/library/aifc.rst b/Doc/library/aifc.rst --- a/Doc/library/aifc.rst +++ b/Doc/library/aifc.rst @@ -4,14 +4,13 @@ .. module:: aifc :synopsis: Read and write audio files in AIFF or AIFC format. +**Source code:** :source:`Lib/aifc.py` .. index:: single: Audio Interchange File Format single: AIFF single: AIFF-C -**Source code:** :source:`Lib/aifc.py` - -------------- This module provides support for reading and writing AIFF and AIFF-C files. diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst --- a/Doc/library/argparse.rst +++ b/Doc/library/argparse.rst @@ -3,6 +3,7 @@ .. module:: argparse :synopsis: Command-line option and argument parsing library. + .. moduleauthor:: Steven Bethard .. sectionauthor:: Steven Bethard diff --git a/Doc/library/array.rst b/Doc/library/array.rst --- a/Doc/library/array.rst +++ b/Doc/library/array.rst @@ -4,8 +4,9 @@ .. module:: array :synopsis: Space efficient arrays of uniformly typed numeric values. +.. index:: single: arrays -.. index:: single: arrays +-------------- This module defines an object type which can compactly represent an array of basic values: characters, integers, floating point numbers. Arrays are sequence diff --git a/Doc/library/asynchat.rst b/Doc/library/asynchat.rst --- a/Doc/library/asynchat.rst +++ b/Doc/library/asynchat.rst @@ -3,6 +3,7 @@ .. module:: asynchat :synopsis: Support for asynchronous command/response protocols. + .. moduleauthor:: Sam Rushing .. sectionauthor:: Steve Holden diff --git a/Doc/library/asyncio.rst b/Doc/library/asyncio.rst --- a/Doc/library/asyncio.rst +++ b/Doc/library/asyncio.rst @@ -4,6 +4,10 @@ .. module:: asyncio :synopsis: Asynchronous I/O, event loop, coroutines and tasks. +.. versionadded:: 3.4 + +**Source code:** :source:`Lib/asyncio/` + .. note:: The asyncio package has been included in the standard library on a @@ -11,10 +15,6 @@ changes (up to and including removal of the module) may occur if deemed necessary by the core developers. -.. versionadded:: 3.4 - -**Source code:** :source:`Lib/asyncio/` - -------------- This module provides infrastructure for writing single-threaded concurrent diff --git a/Doc/library/asyncore.rst b/Doc/library/asyncore.rst --- a/Doc/library/asyncore.rst +++ b/Doc/library/asyncore.rst @@ -4,6 +4,7 @@ .. module:: asyncore :synopsis: A base class for developing asynchronous socket handling services. + .. moduleauthor:: Sam Rushing .. sectionauthor:: Christopher Petrilli .. sectionauthor:: Steve Holden diff --git a/Doc/library/atexit.rst b/Doc/library/atexit.rst --- a/Doc/library/atexit.rst +++ b/Doc/library/atexit.rst @@ -3,9 +3,11 @@ .. module:: atexit :synopsis: Register and execute cleanup functions. + .. moduleauthor:: Skip Montanaro .. sectionauthor:: Skip Montanaro +-------------- 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/audioop.rst b/Doc/library/audioop.rst --- a/Doc/library/audioop.rst +++ b/Doc/library/audioop.rst @@ -4,6 +4,7 @@ .. module:: audioop :synopsis: Manipulate raw audio data. +-------------- The :mod:`audioop` module contains some useful operations on sound fragments. It operates on sound fragments consisting of signed integer samples 8, 16, 24 diff --git a/Doc/library/base64.rst b/Doc/library/base64.rst --- a/Doc/library/base64.rst +++ b/Doc/library/base64.rst @@ -5,11 +5,14 @@ :synopsis: RFC 3548: Base16, Base32, Base64 Data Encodings; Base85 and Ascii85 +**Source code:** :source:`Lib/base64.py` .. index:: pair: base64; encoding single: MIME; base64 encoding +-------------- + This module provides functions for encoding binary data to printable ASCII characters and decoding such encodings back to binary data. It provides encoding and decoding functions for the encodings specified in diff --git a/Doc/library/binascii.rst b/Doc/library/binascii.rst --- a/Doc/library/binascii.rst +++ b/Doc/library/binascii.rst @@ -5,12 +5,13 @@ :synopsis: Tools for converting between binary and various ASCII-encoded binary representations. - .. index:: module: uu module: base64 module: binhex +-------------- + The :mod:`binascii` module contains a number of methods to convert between binary and various ASCII-encoded binary representations. Normally, you will not use these functions directly but use wrapper modules like :mod:`uu`, diff --git a/Doc/library/binhex.rst b/Doc/library/binhex.rst --- a/Doc/library/binhex.rst +++ b/Doc/library/binhex.rst @@ -4,6 +4,9 @@ .. module:: binhex :synopsis: Encode and decode files in binhex4 format. +**Source code:** :source:`Lib/binhex.py` + +-------------- This module encodes and decodes files in binhex4 format, a format allowing representation of Macintosh files in ASCII. Only the data fork is handled. diff --git a/Doc/library/builtins.rst b/Doc/library/builtins.rst --- a/Doc/library/builtins.rst +++ b/Doc/library/builtins.rst @@ -4,6 +4,7 @@ .. module:: builtins :synopsis: The module that provides the built-in namespace. +-------------- This module provides direct access to all 'built-in' identifiers of Python; for example, ``builtins.open`` is the full name for the built-in function diff --git a/Doc/library/bz2.rst b/Doc/library/bz2.rst --- a/Doc/library/bz2.rst +++ b/Doc/library/bz2.rst @@ -3,11 +3,15 @@ .. module:: bz2 :synopsis: Interfaces for bzip2 compression and decompression. + .. moduleauthor:: Gustavo Niemeyer .. moduleauthor:: Nadeem Vawda .. sectionauthor:: Gustavo Niemeyer .. sectionauthor:: Nadeem Vawda +**Source code:** :source:`Lib/bz2.py` + +-------------- This module provides a comprehensive interface for compressing and decompressing data using the bzip2 compression algorithm. diff --git a/Doc/library/calendar.rst b/Doc/library/calendar.rst --- a/Doc/library/calendar.rst +++ b/Doc/library/calendar.rst @@ -4,6 +4,7 @@ .. module:: calendar :synopsis: Functions for working with calendars, including some emulation of the Unix cal program. + .. sectionauthor:: Drew Csillag **Source code:** :source:`Lib/calendar.py` diff --git a/Doc/library/cgi.rst b/Doc/library/cgi.rst --- a/Doc/library/cgi.rst +++ b/Doc/library/cgi.rst @@ -4,6 +4,7 @@ .. module:: cgi :synopsis: Helpers for running Python scripts via the Common Gateway Interface. +**Source code:** :source:`Lib/cgi.py` .. index:: pair: WWW; server @@ -13,8 +14,6 @@ single: URL single: Common Gateway Interface -**Source code:** :source:`Lib/cgi.py` - -------------- Support module for Common Gateway Interface (CGI) scripts. diff --git a/Doc/library/cgitb.rst b/Doc/library/cgitb.rst --- a/Doc/library/cgitb.rst +++ b/Doc/library/cgitb.rst @@ -3,9 +3,11 @@ .. module:: cgitb :synopsis: Configurable traceback handler for CGI scripts. + .. moduleauthor:: Ka-Ping Yee .. sectionauthor:: Fred L. Drake, Jr. +**Source code:** :source:`Lib/cgitb.py` .. index:: single: CGI; exceptions @@ -13,6 +15,8 @@ single: exceptions; in CGI scripts single: tracebacks; in CGI scripts +-------------- + The :mod:`cgitb` module provides a special exception handler for Python scripts. (Its name is a bit misleading. It was originally designed to display extensive traceback information in HTML for CGI scripts. It was later generalized to also diff --git a/Doc/library/chunk.rst b/Doc/library/chunk.rst --- a/Doc/library/chunk.rst +++ b/Doc/library/chunk.rst @@ -3,9 +3,11 @@ .. module:: chunk :synopsis: Module to read IFF chunks. + .. moduleauthor:: Sjoerd Mullender .. sectionauthor:: Sjoerd Mullender +**Source code:** :source:`Lib/chunk.py` .. index:: single: Audio Interchange File Format @@ -14,6 +16,8 @@ single: Real Media File Format single: RMFF +-------------- + This module provides an interface for reading files that use EA IFF 85 chunks. [#]_ This format is used in at least the Audio Interchange File Format (AIFF/AIFF-C) and the Real Media File Format (RMFF). The WAVE audio file format diff --git a/Doc/library/cmath.rst b/Doc/library/cmath.rst --- a/Doc/library/cmath.rst +++ b/Doc/library/cmath.rst @@ -4,6 +4,7 @@ .. module:: cmath :synopsis: Mathematical functions for complex numbers. +-------------- This module is always available. It provides access to mathematical functions for complex numbers. The functions in this module accept integers, diff --git a/Doc/library/cmd.rst b/Doc/library/cmd.rst --- a/Doc/library/cmd.rst +++ b/Doc/library/cmd.rst @@ -3,6 +3,7 @@ .. module:: cmd :synopsis: Build line-oriented command interpreters. + .. sectionauthor:: Eric S. Raymond **Source code:** :source:`Lib/cmd.py` diff --git a/Doc/library/code.rst b/Doc/library/code.rst --- a/Doc/library/code.rst +++ b/Doc/library/code.rst @@ -6,6 +6,8 @@ **Source code:** :source:`Lib/code.py` +-------------- + The ``code`` module provides facilities to implement read-eval-print loops in Python. Two classes and convenience functions are included which can be used to build applications which provide an interactive interpreter prompt. diff --git a/Doc/library/codecs.rst b/Doc/library/codecs.rst --- a/Doc/library/codecs.rst +++ b/Doc/library/codecs.rst @@ -3,6 +3,7 @@ .. module:: codecs :synopsis: Encode and decode data and streams. + .. moduleauthor:: Marc-Andr? Lemburg .. sectionauthor:: Marc-Andr? Lemburg .. sectionauthor:: Martin v. L?wis @@ -17,6 +18,8 @@ single: streams pair: stackable; streams +-------------- + This module defines base classes for standard Python codecs (encoders and decoders) and provides access to the internal Python codec registry, which manages the codec and error handling lookup process. Most standard codecs diff --git a/Doc/library/codeop.rst b/Doc/library/codeop.rst --- a/Doc/library/codeop.rst +++ b/Doc/library/codeop.rst @@ -3,9 +3,14 @@ .. module:: codeop :synopsis: Compile (possibly incomplete) Python code. + .. sectionauthor:: Moshe Zadka .. sectionauthor:: Michael Hudson +**Source code:** :source:`Lib/codeop.py` + +-------------- + The :mod:`codeop` module provides utilities upon which the Python read-eval-print loop can be emulated, as is done in the :mod:`code` module. As a result, you probably don't want to use the module directly; if you want to diff --git a/Doc/library/collections.abc.rst b/Doc/library/collections.abc.rst --- a/Doc/library/collections.abc.rst +++ b/Doc/library/collections.abc.rst @@ -3,20 +3,21 @@ .. module:: collections.abc :synopsis: Abstract base classes for containers + .. moduleauthor:: Raymond Hettinger .. sectionauthor:: Raymond Hettinger .. versionadded:: 3.3 Formerly, this module was part of the :mod:`collections` module. +**Source code:** :source:`Lib/_collections_abc.py` + .. testsetup:: * from collections import * import itertools __name__ = '' -**Source code:** :source:`Lib/_collections_abc.py` - -------------- This module provides :term:`abstract base classes ` that diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@ -3,17 +3,18 @@ .. module:: collections :synopsis: Container datatypes + .. moduleauthor:: Raymond Hettinger .. sectionauthor:: Raymond Hettinger +**Source code:** :source:`Lib/collections/__init__.py` + .. testsetup:: * from collections import * import itertools __name__ = '' -**Source code:** :source:`Lib/collections/__init__.py` - -------------- This module implements specialized container datatypes providing alternatives to diff --git a/Doc/library/colorsys.rst b/Doc/library/colorsys.rst --- a/Doc/library/colorsys.rst +++ b/Doc/library/colorsys.rst @@ -3,6 +3,7 @@ .. module:: colorsys :synopsis: Conversion functions between RGB and other color systems. + .. sectionauthor:: David Ascher **Source code:** :source:`Lib/colorsys.py` diff --git a/Doc/library/compileall.rst b/Doc/library/compileall.rst --- a/Doc/library/compileall.rst +++ b/Doc/library/compileall.rst @@ -8,7 +8,6 @@ -------------- - This module provides some utility functions to support installing Python libraries. These functions compile Python source files in a directory tree. This module can be used to create the cached byte-code files at library diff --git a/Doc/library/configparser.rst b/Doc/library/configparser.rst --- a/Doc/library/configparser.rst +++ b/Doc/library/configparser.rst @@ -19,6 +19,8 @@ single: ini file single: Windows ini file +-------------- + This module provides the :class:`ConfigParser` class which implements a basic configuration language which provides a structure similar to what's found in Microsoft Windows INI files. You can use this to write Python programs which diff --git a/Doc/library/copy.rst b/Doc/library/copy.rst --- a/Doc/library/copy.rst +++ b/Doc/library/copy.rst @@ -4,6 +4,10 @@ .. module:: copy :synopsis: Shallow and deep copy operations. +**Source code:** :source:`Lib/copy.py` + +-------------- + Assignment statements in Python do not copy objects, they create bindings between a target and an object. For collections that are mutable or contain mutable items, a copy is sometimes needed so one can change one copy without diff --git a/Doc/library/copyreg.rst b/Doc/library/copyreg.rst --- a/Doc/library/copyreg.rst +++ b/Doc/library/copyreg.rst @@ -4,11 +4,14 @@ .. module:: copyreg :synopsis: Register pickle support functions. +**Source code:** :source:`Lib/copyreg.py` .. index:: module: pickle module: copy +-------------- + The :mod:`copyreg` module offers a way to define functions used while pickling specific objects. The :mod:`pickle` and :mod:`copy` modules use those functions when pickling/copying those objects. The module provides configuration diff --git a/Doc/library/crypt.rst b/Doc/library/crypt.rst --- a/Doc/library/crypt.rst +++ b/Doc/library/crypt.rst @@ -4,15 +4,19 @@ .. module:: crypt :platform: Unix :synopsis: The crypt() function used to check Unix passwords. + .. moduleauthor:: Steven D. Majewski .. sectionauthor:: Steven D. Majewski .. sectionauthor:: Peter Funk +**Source code:** :source:`Lib/crypt.py` .. index:: single: crypt(3) pair: cipher; DES +-------------- + This module implements an interface to the :manpage:`crypt(3)` routine, which is a one-way hash function based upon a modified DES algorithm; see the Unix man page for further details. Possible uses include storing hashed passwords diff --git a/Doc/library/csv.rst b/Doc/library/csv.rst --- a/Doc/library/csv.rst +++ b/Doc/library/csv.rst @@ -3,6 +3,7 @@ .. module:: csv :synopsis: Write and read tabular data to and from delimited files. + .. sectionauthor:: Skip Montanaro **Source code:** :source:`Lib/csv.py` @@ -11,6 +12,8 @@ single: csv pair: data; tabular +-------------- + The so-called CSV (Comma Separated Values) format is the most common import and export format for spreadsheets and databases. CSV format was used for many years prior to attempts to describe the format in a standardized way in diff --git a/Doc/library/ctypes.rst b/Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst +++ b/Doc/library/ctypes.rst @@ -3,8 +3,10 @@ .. module:: ctypes :synopsis: A foreign function library for Python. + .. moduleauthor:: Thomas Heller +-------------- :mod:`ctypes` is a foreign function library for Python. It provides C compatible data types, and allows calling functions in DLLs or shared libraries. It can be diff --git a/Doc/library/curses.ascii.rst b/Doc/library/curses.ascii.rst --- a/Doc/library/curses.ascii.rst +++ b/Doc/library/curses.ascii.rst @@ -3,9 +3,11 @@ .. module:: curses.ascii :synopsis: Constants and set-membership functions for ASCII characters. + .. moduleauthor:: Eric S. Raymond .. sectionauthor:: Eric S. Raymond +-------------- The :mod:`curses.ascii` module supplies name constants for ASCII characters and functions to test membership in various ASCII character classes. The constants diff --git a/Doc/library/curses.panel.rst b/Doc/library/curses.panel.rst --- a/Doc/library/curses.panel.rst +++ b/Doc/library/curses.panel.rst @@ -3,8 +3,10 @@ .. module:: curses.panel :synopsis: A panel stack extension that adds depth to curses windows. + .. sectionauthor:: A.M. Kuchling +-------------- Panels are windows with the added feature of depth, so they can be stacked on top of each other, and only the visible portions of each window will be diff --git a/Doc/library/curses.rst b/Doc/library/curses.rst --- a/Doc/library/curses.rst +++ b/Doc/library/curses.rst @@ -5,9 +5,12 @@ :synopsis: An interface to the curses library, providing portable terminal handling. :platform: Unix + .. sectionauthor:: Moshe Zadka .. sectionauthor:: Eric Raymond +-------------- + The :mod:`curses` module provides an interface to the curses library, the de-facto standard for portable advanced terminal handling. diff --git a/Doc/library/datetime.rst b/Doc/library/datetime.rst --- a/Doc/library/datetime.rst +++ b/Doc/library/datetime.rst @@ -3,12 +3,15 @@ .. module:: datetime :synopsis: Basic date and time types. + .. moduleauthor:: Tim Peters .. sectionauthor:: Tim Peters .. sectionauthor:: A.M. Kuchling **Source code:** :source:`Lib/datetime.py` +-------------- + .. XXX what order should the types be discussed in? The :mod:`datetime` module supplies classes for manipulating dates and times in diff --git a/Doc/library/dbm.rst b/Doc/library/dbm.rst --- a/Doc/library/dbm.rst +++ b/Doc/library/dbm.rst @@ -4,6 +4,10 @@ .. module:: dbm :synopsis: Interfaces to various Unix "database" formats. +**Source code:** :source:`Lib/dbm/__init__.py` + +-------------- + :mod:`dbm` is a generic interface to variants of the DBM database --- :mod:`dbm.gnu` or :mod:`dbm.ndbm`. If none of these modules is installed, the slow-but-simple implementation in module :mod:`dbm.dumb` will be used. There diff --git a/Doc/library/decimal.rst b/Doc/library/decimal.rst --- a/Doc/library/decimal.rst +++ b/Doc/library/decimal.rst @@ -23,6 +23,8 @@ # make sure each group gets a fresh context setcontext(Context()) +-------------- + The :mod:`decimal` module provides support for fast correctly-rounded decimal floating point arithmetic. It offers several advantages over the :class:`float` datatype: diff --git a/Doc/library/difflib.rst b/Doc/library/difflib.rst --- a/Doc/library/difflib.rst +++ b/Doc/library/difflib.rst @@ -3,6 +3,7 @@ .. module:: difflib :synopsis: Helpers for computing differences between objects. + .. moduleauthor:: Tim Peters .. sectionauthor:: Tim Peters .. Markup by Fred L. Drake, Jr. @@ -14,6 +15,8 @@ import sys from difflib import * +-------------- + This module provides classes and functions for comparing sequences. It can be used for example, for comparing files, and can produce difference information in various formats, including HTML and context and unified diff --git a/Doc/library/distutils.rst b/Doc/library/distutils.rst --- a/Doc/library/distutils.rst +++ b/Doc/library/distutils.rst @@ -4,8 +4,10 @@ .. module:: distutils :synopsis: Support for building and installing Python modules into an existing Python installation. + .. sectionauthor:: Fred L. Drake, Jr. +-------------- The :mod:`distutils` package provides support for building and installing additional modules into a Python installation. The new modules may be either diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -5,11 +5,15 @@ .. module:: doctest :synopsis: Test pieces of code within docstrings. + .. moduleauthor:: Tim Peters .. sectionauthor:: Tim Peters .. sectionauthor:: Moshe Zadka .. sectionauthor:: Edward Loper +**Source code:** :source:`Lib/doctest.py` + +-------------- The :mod:`doctest` module searches for pieces of text that look like interactive Python sessions, and then executes those sessions to verify that they work diff --git a/Doc/library/email.charset.rst b/Doc/library/email.charset.rst --- a/Doc/library/email.charset.rst +++ b/Doc/library/email.charset.rst @@ -4,6 +4,9 @@ .. module:: email.charset :synopsis: Character Sets +**Source code:** :source:`Lib/email/charset.py` + +-------------- This module provides a class :class:`Charset` for representing character sets and character set conversions in email messages, as well as a character set diff --git a/Doc/library/email.contentmanager.rst b/Doc/library/email.contentmanager.rst --- a/Doc/library/email.contentmanager.rst +++ b/Doc/library/email.contentmanager.rst @@ -7,6 +7,10 @@ .. moduleauthor:: R. David Murray .. sectionauthor:: R. David Murray +.. versionadded:: 3.4 + as a :term:`provisional module `. + +**Source code:** :source:`Lib/email/contentmanager.py` .. note:: @@ -15,8 +19,7 @@ changes (up to and including removal of the module) may occur if deemed necessary by the core developers. -.. versionadded:: 3.4 - as a :term:`provisional module `. +-------------- The :mod:`~email.message` module provides a class that can represent an arbitrary email message. That basic message model has a useful and flexible diff --git a/Doc/library/email.encoders.rst b/Doc/library/email.encoders.rst --- a/Doc/library/email.encoders.rst +++ b/Doc/library/email.encoders.rst @@ -4,6 +4,9 @@ .. module:: email.encoders :synopsis: Encoders for email message payloads. +**Source code:** :source:`Lib/email/encoders.py` + +-------------- When creating :class:`~email.message.Message` objects from scratch, you often need to encode the payloads for transport through compliant mail servers. This diff --git a/Doc/library/email.errors.rst b/Doc/library/email.errors.rst --- a/Doc/library/email.errors.rst +++ b/Doc/library/email.errors.rst @@ -4,6 +4,9 @@ .. module:: email.errors :synopsis: The exception classes used by the email package. +**Source code:** :source:`Lib/email/errors.py` + +-------------- The following exception classes are defined in the :mod:`email.errors` module: diff --git a/Doc/library/email.generator.rst b/Doc/library/email.generator.rst --- a/Doc/library/email.generator.rst +++ b/Doc/library/email.generator.rst @@ -4,6 +4,9 @@ .. module:: email.generator :synopsis: Generate flat text email messages from a message structure. +**Source code:** :source:`Lib/email/generator.py` + +-------------- One of the most common tasks is to generate the flat text of the email message represented by a message object structure. You will need to do this if you want diff --git a/Doc/library/email.header.rst b/Doc/library/email.header.rst --- a/Doc/library/email.header.rst +++ b/Doc/library/email.header.rst @@ -4,6 +4,9 @@ .. module:: email.header :synopsis: Representing non-ASCII headers +**Source code:** :source:`Lib/email/header.py` + +-------------- :rfc:`2822` is the base standard that describes the format of email messages. It derives from the older :rfc:`822` standard which came into widespread use at diff --git a/Doc/library/email.headerregistry.rst b/Doc/library/email.headerregistry.rst --- a/Doc/library/email.headerregistry.rst +++ b/Doc/library/email.headerregistry.rst @@ -7,6 +7,10 @@ .. moduleauthor:: R. David Murray .. sectionauthor:: R. David Murray +.. versionadded:: 3.3 + as a :term:`provisional module `. + +**Source code:** :source:`Lib/email/headerregistry.py` .. note:: @@ -15,8 +19,7 @@ changes (up to and including removal of the module) may occur if deemed necessary by the core developers. -.. versionadded:: 3.3 - as a :term:`provisional module `. +-------------- Headers are represented by customized subclasses of :class:`str`. The particular class used to represent a given header is determined by the diff --git a/Doc/library/email.iterators.rst b/Doc/library/email.iterators.rst --- a/Doc/library/email.iterators.rst +++ b/Doc/library/email.iterators.rst @@ -4,6 +4,9 @@ .. module:: email.iterators :synopsis: Iterate over a message object tree. +**Source code:** :source:`Lib/email/iterators.py` + +-------------- Iterating over a message object tree is fairly easy with the :meth:`Message.walk ` method. The diff --git a/Doc/library/email.message.rst b/Doc/library/email.message.rst --- a/Doc/library/email.message.rst +++ b/Doc/library/email.message.rst @@ -4,6 +4,9 @@ .. module:: email.message :synopsis: The base class representing email messages. +**Source code:** :source:`Lib/email/message.py` + +-------------- The central class in the :mod:`email` package is the :class:`Message` class, imported from the :mod:`email.message` module. It is the base class for the diff --git a/Doc/library/email.mime.rst b/Doc/library/email.mime.rst --- a/Doc/library/email.mime.rst +++ b/Doc/library/email.mime.rst @@ -4,6 +4,9 @@ .. module:: email.mime :synopsis: Build MIME messages. +**Source code:** :source:`Lib/email/mime/` + +-------------- Ordinarily, you get a message object structure by passing a file or some text to a parser, which parses the text and returns the root message object. However 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 @@ -4,6 +4,9 @@ .. module:: email.parser :synopsis: Parse flat text email messages to produce a message object structure. +**Source code:** :source:`Lib/email/parser.py` + +-------------- Message object structures can be created in one of two ways: they can be created from whole cloth by instantiating :class:`~email.message.Message` objects and diff --git a/Doc/library/email.policy.rst b/Doc/library/email.policy.rst --- a/Doc/library/email.policy.rst +++ b/Doc/library/email.policy.rst @@ -9,6 +9,9 @@ .. versionadded:: 3.3 +**Source code:** :source:`Lib/email/policy.py` + +-------------- The :mod:`email` package's prime focus is the handling of email messages as described by the various email and MIME RFCs. However, the general format of diff --git a/Doc/library/email.rst b/Doc/library/email.rst --- a/Doc/library/email.rst +++ b/Doc/library/email.rst @@ -4,10 +4,14 @@ .. module:: email :synopsis: Package supporting the parsing, manipulating, and generating email messages, including MIME documents. + .. moduleauthor:: Barry A. Warsaw .. sectionauthor:: Barry A. Warsaw .. Copyright (C) 2001-2010 Python Software Foundation +**Source code:** :source:`Lib/email/__init__.py` + +-------------- The :mod:`email` package is a library for managing email messages, including MIME and other :rfc:`2822`\ -based message documents. It is specifically *not* diff --git a/Doc/library/email.util.rst b/Doc/library/email.util.rst --- a/Doc/library/email.util.rst +++ b/Doc/library/email.util.rst @@ -4,6 +4,9 @@ .. module:: email.utils :synopsis: Miscellaneous email package utilities. +**Source code:** :source:`Lib/email/utils.py` + +-------------- There are several useful utilities provided in the :mod:`email.utils` module: diff --git a/Doc/library/ensurepip.rst b/Doc/library/ensurepip.rst --- a/Doc/library/ensurepip.rst +++ b/Doc/library/ensurepip.rst @@ -7,6 +7,8 @@ .. versionadded:: 3.4 +-------------- + The :mod:`ensurepip` package provides support for bootstrapping the ``pip`` installer into an existing Python installation or virtual environment. This bootstrapping approach reflects the fact that ``pip`` is an independent diff --git a/Doc/library/errno.rst b/Doc/library/errno.rst --- a/Doc/library/errno.rst +++ b/Doc/library/errno.rst @@ -4,6 +4,7 @@ .. module:: errno :synopsis: Standard errno system symbols. +---------------- This module makes available standard ``errno`` system symbols. The value of each symbol is the corresponding integer value. The names and descriptions are diff --git a/Doc/library/faulthandler.rst b/Doc/library/faulthandler.rst --- a/Doc/library/faulthandler.rst +++ b/Doc/library/faulthandler.rst @@ -6,6 +6,8 @@ .. versionadded:: 3.3 +---------------- + This module contains functions to dump Python tracebacks explicitly, on a fault, after a timeout, or on a user signal. Call :func:`faulthandler.enable` to install fault handlers for the :const:`SIGSEGV`, :const:`SIGFPE`, diff --git a/Doc/library/fcntl.rst b/Doc/library/fcntl.rst --- a/Doc/library/fcntl.rst +++ b/Doc/library/fcntl.rst @@ -4,13 +4,15 @@ .. module:: fcntl :platform: Unix :synopsis: The fcntl() and ioctl() system calls. + .. sectionauthor:: Jaap Vermeulen - .. index:: pair: UNIX; file control pair: UNIX; I/O control +---------------- + This module performs file control and I/O control on file descriptors. It is an interface to the :c:func:`fcntl` and :c:func:`ioctl` Unix routines. For a complete description of these calls, see :manpage:`fcntl(2)` and diff --git a/Doc/library/filecmp.rst b/Doc/library/filecmp.rst --- a/Doc/library/filecmp.rst +++ b/Doc/library/filecmp.rst @@ -3,6 +3,7 @@ .. module:: filecmp :synopsis: Compare files efficiently. + .. sectionauthor:: Moshe Zadka **Source code:** :source:`Lib/filecmp.py` diff --git a/Doc/library/fileinput.rst b/Doc/library/fileinput.rst --- a/Doc/library/fileinput.rst +++ b/Doc/library/fileinput.rst @@ -3,6 +3,7 @@ .. module:: fileinput :synopsis: Loop over standard input or a list of files. + .. moduleauthor:: Guido van Rossum .. sectionauthor:: Fred L. Drake, Jr. diff --git a/Doc/library/fnmatch.rst b/Doc/library/fnmatch.rst --- a/Doc/library/fnmatch.rst +++ b/Doc/library/fnmatch.rst @@ -4,13 +4,12 @@ .. module:: fnmatch :synopsis: Unix shell style filename pattern matching. +**Source code:** :source:`Lib/fnmatch.py` .. index:: single: filenames; wildcard expansion .. index:: module: re -**Source code:** :source:`Lib/fnmatch.py` - -------------- This module provides support for Unix shell-style wildcards, which are *not* the diff --git a/Doc/library/formatter.rst b/Doc/library/formatter.rst --- a/Doc/library/formatter.rst +++ b/Doc/library/formatter.rst @@ -8,6 +8,7 @@ .. deprecated:: 3.4 Due to lack of usage, the formatter module has been deprecated. +-------------- This module supports two interface definitions, each with multiple implementations: The *formatter* interface, and the *writer* interface which is diff --git a/Doc/library/fpectl.rst b/Doc/library/fpectl.rst --- a/Doc/library/fpectl.rst +++ b/Doc/library/fpectl.rst @@ -4,10 +4,10 @@ .. module:: fpectl :platform: Unix :synopsis: Provide control for floating point exception handling. + .. moduleauthor:: Lee Busby .. sectionauthor:: Lee Busby - .. note:: The :mod:`fpectl` module is not built by default, and its usage is discouraged @@ -16,6 +16,8 @@ .. index:: single: IEEE-754 +-------------- + Most computers carry out floating point operations in conformance with the so-called IEEE-754 standard. On any real computer, some floating point operations produce results that cannot be expressed as a normal floating point diff --git a/Doc/library/fractions.rst b/Doc/library/fractions.rst --- a/Doc/library/fractions.rst +++ b/Doc/library/fractions.rst @@ -3,6 +3,7 @@ .. module:: fractions :synopsis: Rational numbers. + .. moduleauthor:: Jeffrey Yasskin .. sectionauthor:: Jeffrey Yasskin diff --git a/Doc/library/ftplib.rst b/Doc/library/ftplib.rst --- a/Doc/library/ftplib.rst +++ b/Doc/library/ftplib.rst @@ -4,13 +4,12 @@ .. module:: ftplib :synopsis: FTP protocol client (requires sockets). +**Source code:** :source:`Lib/ftplib.py` .. index:: pair: FTP; protocol single: FTP; ftplib (standard module) -**Source code:** :source:`Lib/ftplib.py` - -------------- This module defines the class :class:`FTP` and a few related items. The diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -3,6 +3,7 @@ .. module:: functools :synopsis: Higher-order functions and operations on callable objects. + .. moduleauthor:: Peter Harris .. moduleauthor:: Raymond Hettinger .. moduleauthor:: Nick Coghlan diff --git a/Doc/library/gc.rst b/Doc/library/gc.rst --- a/Doc/library/gc.rst +++ b/Doc/library/gc.rst @@ -3,9 +3,11 @@ .. module:: gc :synopsis: Interface to the cycle-detecting garbage collector. + .. moduleauthor:: Neil Schemenauer .. sectionauthor:: Neil Schemenauer +-------------- This module provides an interface to the optional garbage collector. It provides the ability to disable the collector, tune the collection frequency, diff --git a/Doc/library/getopt.rst b/Doc/library/getopt.rst --- a/Doc/library/getopt.rst +++ b/Doc/library/getopt.rst @@ -7,8 +7,6 @@ **Source code:** :source:`Lib/getopt.py` --------------- - .. note:: The :mod:`getopt` module is a parser for command line options whose API is @@ -17,6 +15,8 @@ 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 :c:func:`getopt` function (including the special meanings of arguments of the form '``-``' and '``--``'). Long diff --git a/Doc/library/getpass.rst b/Doc/library/getpass.rst --- a/Doc/library/getpass.rst +++ b/Doc/library/getpass.rst @@ -3,10 +3,15 @@ .. module:: getpass :synopsis: Portable reading of passwords and retrieval of the userid. + .. moduleauthor:: Piers Lauder .. sectionauthor:: Fred L. Drake, Jr. .. Windows (& Mac?) support by Guido van Rossum. +**Source code:** :source:`Lib/getpass.py` + +-------------- + The :mod:`getpass` module provides two functions: diff --git a/Doc/library/gettext.rst b/Doc/library/gettext.rst --- a/Doc/library/gettext.rst +++ b/Doc/library/gettext.rst @@ -3,6 +3,7 @@ .. module:: gettext :synopsis: Multilingual internationalization services. + .. moduleauthor:: Barry A. Warsaw .. sectionauthor:: Barry A. Warsaw diff --git a/Doc/library/glob.rst b/Doc/library/glob.rst --- a/Doc/library/glob.rst +++ b/Doc/library/glob.rst @@ -4,11 +4,10 @@ .. module:: glob :synopsis: Unix shell style pathname pattern expansion. +**Source code:** :source:`Lib/glob.py` .. index:: single: filenames; pathname expansion -**Source code:** :source:`Lib/glob.py` - -------------- The :mod:`glob` module finds all the pathnames matching a specified pattern diff --git a/Doc/library/grp.rst b/Doc/library/grp.rst --- a/Doc/library/grp.rst +++ b/Doc/library/grp.rst @@ -5,6 +5,7 @@ :platform: Unix :synopsis: The group database (getgrnam() and friends). +-------------- This module provides access to the Unix group database. It is available on all Unix versions. diff --git a/Doc/library/hashlib.rst b/Doc/library/hashlib.rst --- a/Doc/library/hashlib.rst +++ b/Doc/library/hashlib.rst @@ -3,16 +3,16 @@ .. module:: hashlib :synopsis: Secure hash and message digest algorithms. + .. moduleauthor:: Gregory P. Smith .. sectionauthor:: Gregory P. Smith +**Source code:** :source:`Lib/hashlib.py` .. index:: single: message digest, MD5 single: secure hash algorithm, SHA1, SHA224, SHA256, SHA384, SHA512 -**Source code:** :source:`Lib/hashlib.py` - -------------- This module implements a common interface to many different secure hash and diff --git a/Doc/library/heapq.rst b/Doc/library/heapq.rst --- a/Doc/library/heapq.rst +++ b/Doc/library/heapq.rst @@ -3,6 +3,7 @@ .. module:: heapq :synopsis: Heap queue algorithm (a.k.a. priority queue). + .. moduleauthor:: Kevin O'Connor .. sectionauthor:: Guido van Rossum .. sectionauthor:: Fran?ois Pinard diff --git a/Doc/library/hmac.rst b/Doc/library/hmac.rst --- a/Doc/library/hmac.rst +++ b/Doc/library/hmac.rst @@ -3,6 +3,7 @@ .. module:: hmac :synopsis: Keyed-Hashing for Message Authentication (HMAC) implementation + .. moduleauthor:: Gerhard H?ring .. sectionauthor:: Gerhard H?ring diff --git a/Doc/library/html.entities.rst b/Doc/library/html.entities.rst --- a/Doc/library/html.entities.rst +++ b/Doc/library/html.entities.rst @@ -3,6 +3,7 @@ .. module:: html.entities :synopsis: Definitions of HTML general entities. + .. sectionauthor:: Fred L. Drake, Jr. **Source code:** :source:`Lib/html/entities.py` diff --git a/Doc/library/html.parser.rst b/Doc/library/html.parser.rst --- a/Doc/library/html.parser.rst +++ b/Doc/library/html.parser.rst @@ -4,13 +4,12 @@ .. module:: html.parser :synopsis: A simple parser that can handle HTML and XHTML. +**Source code:** :source:`Lib/html/parser.py` .. index:: single: HTML single: XHTML -**Source code:** :source:`Lib/html/parser.py` - -------------- This module defines a class :class:`HTMLParser` which serves as the basis for diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -4,6 +4,7 @@ .. module:: http.client :synopsis: HTTP and HTTPS protocol client (requires sockets). +**Source code:** :source:`Lib/http/client.py` .. index:: pair: HTTP; protocol @@ -11,8 +12,6 @@ .. index:: module: urllib.request -**Source code:** :source:`Lib/http/client.py` - -------------- This module defines classes which implement the client side of the HTTP and diff --git a/Doc/library/http.cookiejar.rst b/Doc/library/http.cookiejar.rst --- a/Doc/library/http.cookiejar.rst +++ b/Doc/library/http.cookiejar.rst @@ -3,6 +3,7 @@ .. module:: http.cookiejar :synopsis: Classes for automatic handling of HTTP cookies. + .. moduleauthor:: John J. Lee .. sectionauthor:: John J. Lee diff --git a/Doc/library/http.cookies.rst b/Doc/library/http.cookies.rst --- a/Doc/library/http.cookies.rst +++ b/Doc/library/http.cookies.rst @@ -3,6 +3,7 @@ .. module:: http.cookies :synopsis: Support for HTTP state management (cookies). + .. moduleauthor:: Timothy O'Malley .. sectionauthor:: Moshe Zadka diff --git a/Doc/library/http.rst b/Doc/library/http.rst --- a/Doc/library/http.rst +++ b/Doc/library/http.rst @@ -4,11 +4,13 @@ .. module:: http :synopsis: HTTP status codes and messages +**Source code:** :source:`Lib/http/__init__.py` + .. index:: pair: HTTP; protocol single: HTTP; http (standard module) -**Source code:** :source:`Lib/http/__init__.py` +-------------- :mod:`http` is a package that collects several modules for working with the HyperText Transfer Protocol: diff --git a/Doc/library/http.server.rst b/Doc/library/http.server.rst --- a/Doc/library/http.server.rst +++ b/Doc/library/http.server.rst @@ -4,6 +4,7 @@ .. module:: http.server :synopsis: HTTP server and request handlers. +**Source code:** :source:`Lib/http/server.py` .. index:: pair: WWW; server @@ -11,8 +12,6 @@ single: URL single: httpd -**Source code:** :source:`Lib/http/server.py` - -------------- This module defines classes for implementing HTTP servers (Web servers). diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -3,12 +3,16 @@ IDLE ==== +.. moduleauthor:: Guido van Rossum + +**Source code:** :source:`Lib/idlelib/` + .. index:: single: IDLE single: Python Editor single: Integrated Development Environment -.. moduleauthor:: Guido van Rossum +-------------- IDLE is Python's Integrated Development and Learning Environment. diff --git a/Doc/library/imaplib.rst b/Doc/library/imaplib.rst --- a/Doc/library/imaplib.rst +++ b/Doc/library/imaplib.rst @@ -3,6 +3,7 @@ .. module:: imaplib :synopsis: IMAP4 protocol client (requires sockets). + .. moduleauthor:: Piers Lauder .. sectionauthor:: Piers Lauder .. revised by ESR, January 2000 @@ -10,14 +11,13 @@ .. changes for IMAP4_stream by Piers Lauder , November 2002 +**Source code:** :source:`Lib/imaplib.py` .. index:: pair: IMAP4; protocol pair: IMAP4_SSL; protocol pair: IMAP4_stream; protocol -**Source code:** :source:`Lib/imaplib.py` - -------------- This module defines three classes, :class:`IMAP4`, :class:`IMAP4_SSL` and diff --git a/Doc/library/imp.rst b/Doc/library/imp.rst --- a/Doc/library/imp.rst +++ b/Doc/library/imp.rst @@ -5,11 +5,15 @@ :synopsis: Access the implementation of the import statement. :deprecated: +**Source code:** :source:`Lib/imp.py` + .. deprecated:: 3.4 The :mod:`imp` package is pending deprecation in favor of :mod:`importlib`. .. index:: statement: import +-------------- + This module provides an interface to the mechanisms used to implement the :keyword:`import` statement. It defines the following constants and functions: diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -9,6 +9,9 @@ .. versionadded:: 3.1 +**Source code:** :source:`Lib/importlib/__init__.py` + +-------------- Introduction ------------ diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -3,6 +3,7 @@ .. module:: inspect :synopsis: Extract information and source code from live objects. + .. moduleauthor:: Ka-Ping Yee .. sectionauthor:: Ka-Ping Yee diff --git a/Doc/library/io.rst b/Doc/library/io.rst --- a/Doc/library/io.rst +++ b/Doc/library/io.rst @@ -3,6 +3,7 @@ .. module:: io :synopsis: Core tools for working with streams. + .. moduleauthor:: Guido van Rossum .. moduleauthor:: Mike Verdone .. moduleauthor:: Mark Russell @@ -11,6 +12,10 @@ .. moduleauthor:: Benjamin Peterson .. sectionauthor:: Benjamin Peterson +**Source code:** :source:`Lib/io.py` + +-------------- + .. _io-overview: Overview diff --git a/Doc/library/ipaddress.rst b/Doc/library/ipaddress.rst --- a/Doc/library/ipaddress.rst +++ b/Doc/library/ipaddress.rst @@ -3,6 +3,7 @@ .. module:: ipaddress :synopsis: IPv4/IPv6 manipulation library. + .. moduleauthor:: Peter Moody **Source code:** :source:`Lib/ipaddress.py` diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -3,14 +3,15 @@ .. module:: itertools :synopsis: Functions creating iterators for efficient looping. + .. moduleauthor:: Raymond Hettinger .. sectionauthor:: Raymond Hettinger - .. testsetup:: from itertools import * +-------------- This module implements a number of :term:`iterator` building blocks inspired by constructs from APL, Haskell, and SML. Each has been recast in a form diff --git a/Doc/library/json.rst b/Doc/library/json.rst --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -3,9 +3,14 @@ .. module:: json :synopsis: Encode and decode the JSON format. + .. moduleauthor:: Bob Ippolito .. sectionauthor:: Bob Ippolito +**Source code:** :source:`Lib/json/__init__.py` + +-------------- + `JSON (JavaScript Object Notation) `_, specified by :rfc:`7159` (which obsoletes :rfc:`4627`) and by `ECMA-404 `_, diff --git a/Doc/library/linecache.rst b/Doc/library/linecache.rst --- a/Doc/library/linecache.rst +++ b/Doc/library/linecache.rst @@ -3,6 +3,7 @@ .. module:: linecache :synopsis: This module provides random access to individual lines from text files. + .. sectionauthor:: Moshe Zadka **Source code:** :source:`Lib/linecache.py` diff --git a/Doc/library/locale.rst b/Doc/library/locale.rst --- a/Doc/library/locale.rst +++ b/Doc/library/locale.rst @@ -3,9 +3,13 @@ .. module:: locale :synopsis: Internationalization services. + .. moduleauthor:: Martin von L?wis .. sectionauthor:: Martin von L?wis +**Source code:** :source:`Lib/locale.py` + +-------------- The :mod:`locale` module opens access to the POSIX locale database and functionality. The POSIX locale mechanism allows programmers to deal with diff --git a/Doc/library/logging.config.rst b/Doc/library/logging.config.rst --- a/Doc/library/logging.config.rst +++ b/Doc/library/logging.config.rst @@ -4,10 +4,11 @@ .. module:: logging.config :synopsis: Configuration of the logging module. - .. moduleauthor:: Vinay Sajip .. sectionauthor:: Vinay Sajip +**Source code:** :source:`Lib/logging/config.py` + .. sidebar:: Important This page contains only reference information. For tutorials, @@ -17,8 +18,6 @@ * :ref:`Advanced Tutorial ` * :ref:`Logging Cookbook ` -**Source code:** :source:`Lib/logging/config.py` - -------------- This section describes the API for configuring the logging module. 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 @@ -4,10 +4,11 @@ .. module:: logging.handlers :synopsis: Handlers for the logging module. - .. moduleauthor:: Vinay Sajip .. sectionauthor:: Vinay Sajip +**Source code:** :source:`Lib/logging/handlers.py` + .. sidebar:: Important This page contains only reference information. For tutorials, @@ -17,8 +18,6 @@ * :ref:`Advanced Tutorial ` * :ref:`Logging Cookbook ` -**Source code:** :source:`Lib/logging/handlers.py` - -------------- .. currentmodule:: logging diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -4,10 +4,10 @@ .. module:: logging :synopsis: Flexible event logging system for applications. - .. moduleauthor:: Vinay Sajip .. sectionauthor:: Vinay Sajip +**Source code:** :source:`Lib/logging/__init__.py` .. index:: pair: Errors; logging @@ -20,9 +20,6 @@ * :ref:`Advanced Tutorial ` * :ref:`Logging Cookbook ` - -**Source code:** :source:`Lib/logging/__init__.py` - -------------- This module defines functions and classes which implement a flexible event diff --git a/Doc/library/lzma.rst b/Doc/library/lzma.rst --- a/Doc/library/lzma.rst +++ b/Doc/library/lzma.rst @@ -3,11 +3,15 @@ .. module:: lzma :synopsis: A Python wrapper for the liblzma compression library. + .. moduleauthor:: Nadeem Vawda .. sectionauthor:: Nadeem Vawda .. versionadded:: 3.3 +**Source code:** :source:`Lib/lzma.py` + +-------------- This module provides classes and convenience functions for compressing and decompressing data using the LZMA compression algorithm. Also included is a file diff --git a/Doc/library/macpath.rst b/Doc/library/macpath.rst --- a/Doc/library/macpath.rst +++ b/Doc/library/macpath.rst @@ -4,6 +4,9 @@ .. module:: macpath :synopsis: Mac OS 9 path manipulation functions. +**Source code:** :source:`Lib/macpath.py` + +-------------- This module is the Mac OS 9 (and earlier) implementation of the :mod:`os.path` module. It can be used to manipulate old-style Macintosh pathnames on Mac OS X diff --git a/Doc/library/mailbox.rst b/Doc/library/mailbox.rst --- a/Doc/library/mailbox.rst +++ b/Doc/library/mailbox.rst @@ -3,9 +3,13 @@ .. module:: mailbox :synopsis: Manipulate mailboxes in various formats + .. moduleauthor:: Gregory K. Johnson .. sectionauthor:: Gregory K. Johnson +**Source code:** :source:`Lib/mailbox.py` + +-------------- This module defines two classes, :class:`Mailbox` and :class:`Message`, for accessing and manipulating on-disk mailboxes and the messages they contain. diff --git a/Doc/library/marshal.rst b/Doc/library/marshal.rst --- a/Doc/library/marshal.rst +++ b/Doc/library/marshal.rst @@ -5,6 +5,7 @@ :synopsis: Convert Python objects to streams of bytes and back (with different constraints). +-------------- This module contains functions that can read and write Python values in a binary format. The format is specific to Python, but independent of machine diff --git a/Doc/library/math.rst b/Doc/library/math.rst --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -8,6 +8,8 @@ from math import fsum +-------------- + This module is always available. It provides access to the mathematical functions defined by the C standard. diff --git a/Doc/library/mimetypes.rst b/Doc/library/mimetypes.rst --- a/Doc/library/mimetypes.rst +++ b/Doc/library/mimetypes.rst @@ -3,13 +3,13 @@ .. module:: mimetypes :synopsis: Mapping of filename extensions to MIME types. + .. sectionauthor:: Fred L. Drake, Jr. +**Source code:** :source:`Lib/mimetypes.py` .. index:: pair: MIME; content type -**Source code:** :source:`Lib/mimetypes.py` - -------------- The :mod:`mimetypes` module converts between a filename or URL and the MIME type diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -4,6 +4,7 @@ .. module:: mmap :synopsis: Interface to memory-mapped files for Unix and Windows. +-------------- Memory-mapped file objects behave like both :class:`bytearray` and like :term:`file objects `. You can use mmap objects in most places diff --git a/Doc/library/modulefinder.rst b/Doc/library/modulefinder.rst --- a/Doc/library/modulefinder.rst +++ b/Doc/library/modulefinder.rst @@ -1,12 +1,11 @@ :mod:`modulefinder` --- Find modules used by a script ===================================================== -.. sectionauthor:: A.M. Kuchling - - .. module:: modulefinder :synopsis: Find modules used by a script. +.. sectionauthor:: A.M. Kuchling + **Source code:** :source:`Lib/modulefinder.py` -------------- diff --git a/Doc/library/msilib.rst b/Doc/library/msilib.rst --- a/Doc/library/msilib.rst +++ b/Doc/library/msilib.rst @@ -4,12 +4,16 @@ .. module:: msilib :platform: Windows :synopsis: Creation of Microsoft Installer files, and CAB files. + .. moduleauthor:: Martin v. L?wis .. sectionauthor:: Martin v. L?wis +**Source code:** :source:`Lib/msilib/__init__.py` .. index:: single: msi +-------------- + The :mod:`msilib` supports the creation of Microsoft Installer (``.msi``) files. Because these files often contain an embedded "cabinet" file (``.cab``), it also exposes an API to create CAB files. Support for reading ``.cab`` files is diff --git a/Doc/library/msvcrt.rst b/Doc/library/msvcrt.rst --- a/Doc/library/msvcrt.rst +++ b/Doc/library/msvcrt.rst @@ -4,8 +4,10 @@ .. module:: msvcrt :platform: Windows :synopsis: Miscellaneous useful routines from the MS VC++ runtime. + .. sectionauthor:: Fred L. Drake, Jr. +-------------- These functions provide access to some useful capabilities on Windows platforms. Some higher-level modules use these functions to build the Windows diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -4,6 +4,9 @@ .. module:: multiprocessing :synopsis: Process-based parallelism. +**Source code:** :source:`Lib/multiprocessing/` + +-------------- Introduction ------------ diff --git a/Doc/library/netrc.rst b/Doc/library/netrc.rst --- a/Doc/library/netrc.rst +++ b/Doc/library/netrc.rst @@ -4,6 +4,7 @@ .. module:: netrc :synopsis: Loading of .netrc files. + .. moduleauthor:: Eric S. Raymond .. sectionauthor:: Eric S. Raymond diff --git a/Doc/library/nis.rst b/Doc/library/nis.rst --- a/Doc/library/nis.rst +++ b/Doc/library/nis.rst @@ -5,9 +5,11 @@ .. module:: nis :platform: Unix :synopsis: Interface to Sun's NIS (Yellow Pages) library. + .. moduleauthor:: Fred Gansevles .. sectionauthor:: Moshe Zadka +-------------- The :mod:`nis` module gives a thin wrapper around the NIS library, useful for central administration of several hosts. diff --git a/Doc/library/nntplib.rst b/Doc/library/nntplib.rst --- a/Doc/library/nntplib.rst +++ b/Doc/library/nntplib.rst @@ -4,13 +4,12 @@ .. module:: nntplib :synopsis: NNTP protocol client (requires sockets). +**Source code:** :source:`Lib/nntplib.py` .. index:: pair: NNTP; protocol single: Network News Transfer Protocol -**Source code:** :source:`Lib/nntplib.py` - -------------- This module defines the class :class:`NNTP` which implements the client side of diff --git a/Doc/library/numbers.rst b/Doc/library/numbers.rst --- a/Doc/library/numbers.rst +++ b/Doc/library/numbers.rst @@ -4,6 +4,9 @@ .. module:: numbers :synopsis: Numeric abstract base classes (Complex, Real, Integral, etc.). +**Source code:** :source:`Lib/numbers.py` + +-------------- The :mod:`numbers` module (:pep:`3141`) defines a hierarchy of numeric :term:`abstract base classes ` which progressively define diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst --- a/Doc/library/operator.rst +++ b/Doc/library/operator.rst @@ -3,16 +3,16 @@ .. module:: operator :synopsis: Functions corresponding to the standard operators. + .. sectionauthor:: Skip Montanaro +**Source code:** :source:`Lib/operator.py` .. testsetup:: import operator from operator import itemgetter, iadd -**Source code:** :source:`Lib/operator.py` - -------------- The :mod:`operator` module exports a set of efficient functions corresponding to diff --git a/Doc/library/optparse.rst b/Doc/library/optparse.rst --- a/Doc/library/optparse.rst +++ b/Doc/library/optparse.rst @@ -4,15 +4,16 @@ .. module:: optparse :synopsis: Command-line option parsing library. :deprecated: + .. moduleauthor:: Greg Ward .. sectionauthor:: Greg Ward +**Source code:** :source:`Lib/optparse.py` + .. deprecated:: 3.2 The :mod:`optparse` module is deprecated and will not be developed further; development will continue with the :mod:`argparse` module. -**Source code:** :source:`Lib/optparse.py` - -------------- :mod:`optparse` is a more convenient, flexible, and powerful library for parsing diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst --- a/Doc/library/os.path.rst +++ b/Doc/library/os.path.rst @@ -4,8 +4,14 @@ .. module:: os.path :synopsis: Operations on pathnames. +**Source code:** :source:`Lib/posixpath.py` (for POSIX), +:source:`Lib/ntpath.py` (for Windows NT), +and :source:`Lib/macpath.py` (for Macintosh) + .. index:: single: path; operations +-------------- + This module implements some useful functions on pathnames. To read or write files see :func:`open`, and for accessing the filesystem see the :mod:`os` module. The path parameters can be passed as either strings, diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -4,6 +4,9 @@ .. module:: os :synopsis: Miscellaneous operating system interfaces. +**Source code:** :source:`Lib/os.py` + +-------------- This module provides a portable way of using operating system dependent functionality. If you just want to read or write a file see :func:`open`, if diff --git a/Doc/library/ossaudiodev.rst b/Doc/library/ossaudiodev.rst --- a/Doc/library/ossaudiodev.rst +++ b/Doc/library/ossaudiodev.rst @@ -5,6 +5,7 @@ :platform: Linux, FreeBSD :synopsis: Access to OSS-compatible audio devices. +-------------- This module allows you to access the OSS (Open Sound System) audio interface. OSS is available for a wide range of open-source and commercial Unices, and is diff --git a/Doc/library/parser.rst b/Doc/library/parser.rst --- a/Doc/library/parser.rst +++ b/Doc/library/parser.rst @@ -3,10 +3,10 @@ .. module:: parser :synopsis: Access parse trees for Python source code. + .. moduleauthor:: Fred L. Drake, Jr. .. sectionauthor:: Fred L. Drake, Jr. - .. Copyright 1995 Virginia Polytechnic Institute and State University and Fred L. Drake, Jr. This copyright notice must be distributed on all copies, but this document otherwise may be distributed as part of the Python @@ -16,6 +16,8 @@ .. index:: single: parsing; Python source code +-------------- + The :mod:`parser` module provides an interface to Python's internal parser and byte-code compiler. The primary purpose for this interface is to allow Python code to edit the parse tree of a Python expression and create executable code diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -5,9 +5,13 @@ .. module:: pathlib :synopsis: Object-oriented filesystem paths +.. versionadded:: 3.4 + +**Source code:** :source:`Lib/pathlib.py` + .. index:: single: path; operations -.. versionadded:: 3.4 +-------------- This module offers classes representing filesystem paths with semantics appropriate for different operating systems. Path classes are divided diff --git a/Doc/library/pdb.rst b/Doc/library/pdb.rst --- a/Doc/library/pdb.rst +++ b/Doc/library/pdb.rst @@ -8,10 +8,10 @@ **Source code:** :source:`Lib/pdb.py` +.. index:: single: debugging + -------------- -.. index:: single: debugging - The module :mod:`pdb` defines an interactive source code debugger for Python programs. It supports setting (conditional) breakpoints and single stepping at the source line level, inspection of stack frames, source code listing, and diff --git a/Doc/library/pickle.rst b/Doc/library/pickle.rst --- a/Doc/library/pickle.rst +++ b/Doc/library/pickle.rst @@ -1,6 +1,14 @@ :mod:`pickle` --- Python object serialization ============================================= +.. module:: pickle + :synopsis: Convert Python objects to streams of bytes and back. + +.. sectionauthor:: Jim Kerr . +.. sectionauthor:: Barry Warsaw + +**Source code:** :source:`Lib/pickle.py` + .. index:: single: persistence pair: persistent; objects @@ -9,11 +17,7 @@ pair: flattening; objects pair: pickling; objects -.. module:: pickle - :synopsis: Convert Python objects to streams of bytes and back. -.. sectionauthor:: Jim Kerr . -.. sectionauthor:: Barry Warsaw - +-------------- The :mod:`pickle` module implements binary protocols for serializing and de-serializing a Python object structure. *"Pickling"* is the process diff --git a/Doc/library/pipes.rst b/Doc/library/pipes.rst --- a/Doc/library/pipes.rst +++ b/Doc/library/pipes.rst @@ -4,6 +4,7 @@ .. module:: pipes :platform: Unix :synopsis: A Python interface to Unix shell pipelines. + .. sectionauthor:: Moshe Zadka **Source code:** :source:`Lib/pipes.py` diff --git a/Doc/library/platform.rst b/Doc/library/platform.rst --- a/Doc/library/platform.rst +++ b/Doc/library/platform.rst @@ -3,6 +3,7 @@ .. module:: platform :synopsis: Retrieves as much platform identifying data as possible. + .. moduleauthor:: Marc-Andr? Lemburg .. sectionauthor:: Bjorn Pettersen diff --git a/Doc/library/plistlib.rst b/Doc/library/plistlib.rst --- a/Doc/library/plistlib.rst +++ b/Doc/library/plistlib.rst @@ -3,16 +3,17 @@ .. module:: plistlib :synopsis: Generate and parse Mac OS X plist files. + .. moduleauthor:: Jack Jansen .. sectionauthor:: Georg Brandl .. (harvested from docstrings in the original file) +**Source code:** :source:`Lib/plistlib.py` + .. index:: pair: plist; file single: property list -**Source code:** :source:`Lib/plistlib.py` - -------------- This module provides an interface for reading and writing the "property list" diff --git a/Doc/library/poplib.rst b/Doc/library/poplib.rst --- a/Doc/library/poplib.rst +++ b/Doc/library/poplib.rst @@ -3,13 +3,14 @@ .. module:: poplib :synopsis: POP3 protocol client (requires sockets). + .. sectionauthor:: Andrew T. Csillag .. revised by ESR, January 2000 +**Source code:** :source:`Lib/poplib.py` + .. index:: pair: POP3; protocol -**Source code:** :source:`Lib/poplib.py` - -------------- This module defines a class, :class:`POP3`, which encapsulates a connection to a diff --git a/Doc/library/posix.rst b/Doc/library/posix.rst --- a/Doc/library/posix.rst +++ b/Doc/library/posix.rst @@ -5,6 +5,7 @@ :platform: Unix :synopsis: The most common POSIX system calls (normally used via module os). +-------------- This module provides access to operating system functionality that is standardized by the C Standard and the POSIX standard (a thinly disguised Unix diff --git a/Doc/library/pprint.rst b/Doc/library/pprint.rst --- a/Doc/library/pprint.rst +++ b/Doc/library/pprint.rst @@ -3,6 +3,7 @@ .. module:: pprint :synopsis: Data pretty printer. + .. moduleauthor:: Fred L. Drake, Jr. .. sectionauthor:: Fred L. Drake, Jr. diff --git a/Doc/library/pty.rst b/Doc/library/pty.rst --- a/Doc/library/pty.rst +++ b/Doc/library/pty.rst @@ -4,9 +4,13 @@ .. module:: pty :platform: Linux :synopsis: Pseudo-Terminal Handling for Linux. + .. moduleauthor:: Steen Lumholt .. sectionauthor:: Moshe Zadka +**Source code:** :source:`Lib/pty.py` + +-------------- The :mod:`pty` module defines operations for handling the pseudo-terminal concept: starting another process and being able to write to and read from its diff --git a/Doc/library/pwd.rst b/Doc/library/pwd.rst --- a/Doc/library/pwd.rst +++ b/Doc/library/pwd.rst @@ -5,6 +5,7 @@ :platform: Unix :synopsis: The password database (getpwnam() and friends). +-------------- This module provides access to the Unix user account and password database. It is available on all Unix versions. diff --git a/Doc/library/py_compile.rst b/Doc/library/py_compile.rst --- a/Doc/library/py_compile.rst +++ b/Doc/library/py_compile.rst @@ -3,13 +3,14 @@ .. module:: py_compile :synopsis: Generate byte-code files from Python source files. + .. sectionauthor:: Fred L. Drake, Jr. .. documentation based on module docstrings +**Source code:** :source:`Lib/py_compile.py` + .. index:: pair: file; byte-code -**Source code:** :source:`Lib/py_compile.py` - -------------- The :mod:`py_compile` module provides a function to generate a byte-code file diff --git a/Doc/library/pyclbr.rst b/Doc/library/pyclbr.rst --- a/Doc/library/pyclbr.rst +++ b/Doc/library/pyclbr.rst @@ -3,6 +3,7 @@ .. module:: pyclbr :synopsis: Supports information extraction for a Python class browser. + .. sectionauthor:: Fred L. Drake, Jr. **Source code:** :source:`Lib/pyclbr.py` diff --git a/Doc/library/pydoc.rst b/Doc/library/pydoc.rst --- a/Doc/library/pydoc.rst +++ b/Doc/library/pydoc.rst @@ -3,17 +3,17 @@ .. module:: pydoc :synopsis: Documentation generator and online help system. + .. moduleauthor:: Ka-Ping Yee .. sectionauthor:: Ka-Ping Yee +**Source code:** :source:`Lib/pydoc.py` .. index:: single: documentation; generation single: documentation; online single: help; online -**Source code:** :source:`Lib/pydoc.py` - -------------- The :mod:`pydoc` module automatically generates documentation from Python diff --git a/Doc/library/pyexpat.rst b/Doc/library/pyexpat.rst --- a/Doc/library/pyexpat.rst +++ b/Doc/library/pyexpat.rst @@ -3,8 +3,10 @@ .. module:: xml.parsers.expat :synopsis: An interface to the Expat non-validating XML parser. + .. moduleauthor:: Paul Prescod +-------------- .. Markup notes: diff --git a/Doc/library/quopri.rst b/Doc/library/quopri.rst --- a/Doc/library/quopri.rst +++ b/Doc/library/quopri.rst @@ -4,13 +4,12 @@ .. module:: quopri :synopsis: Encode and decode files using the MIME quoted-printable encoding. +**Source code:** :source:`Lib/quopri.py` .. index:: pair: quoted-printable; encoding single: MIME; quoted-printable encoding -**Source code:** :source:`Lib/quopri.py` - -------------- This module performs quoted-printable transport encoding and decoding, as diff --git a/Doc/library/re.rst b/Doc/library/re.rst --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -3,9 +3,13 @@ .. module:: re :synopsis: Regular expression operations. + .. moduleauthor:: Fredrik Lundh .. sectionauthor:: Andrew M. Kuchling +**Source code:** :source:`Lib/re.py` + +-------------- This module provides regular expression matching operations similar to those found in Perl. diff --git a/Doc/library/readline.rst b/Doc/library/readline.rst --- a/Doc/library/readline.rst +++ b/Doc/library/readline.rst @@ -4,8 +4,10 @@ .. module:: readline :platform: Unix :synopsis: GNU readline support for Python. + .. sectionauthor:: Skip Montanaro +-------------- The :mod:`readline` module defines a number of functions to facilitate completion and reading/writing of history files from the Python interpreter. diff --git a/Doc/library/reprlib.rst b/Doc/library/reprlib.rst --- a/Doc/library/reprlib.rst +++ b/Doc/library/reprlib.rst @@ -3,6 +3,7 @@ .. module:: reprlib :synopsis: Alternate repr() implementation with size limits. + .. sectionauthor:: Fred L. Drake, Jr. **Source code:** :source:`Lib/reprlib.py` diff --git a/Doc/library/resource.rst b/Doc/library/resource.rst --- a/Doc/library/resource.rst +++ b/Doc/library/resource.rst @@ -4,9 +4,11 @@ .. module:: resource :platform: Unix :synopsis: An interface to provide resource usage information on the current process. + .. moduleauthor:: Jeremy Hylton .. sectionauthor:: Jeremy Hylton +-------------- This module provides basic mechanisms for measuring and controlling system resources utilized by a program. diff --git a/Doc/library/rlcompleter.rst b/Doc/library/rlcompleter.rst --- a/Doc/library/rlcompleter.rst +++ b/Doc/library/rlcompleter.rst @@ -3,6 +3,7 @@ .. module:: rlcompleter :synopsis: Python identifier completion, suitable for the GNU readline library. + .. sectionauthor:: Moshe Zadka **Source code:** :source:`Lib/rlcompleter.py` diff --git a/Doc/library/runpy.rst b/Doc/library/runpy.rst --- a/Doc/library/runpy.rst +++ b/Doc/library/runpy.rst @@ -3,6 +3,7 @@ .. module:: runpy :synopsis: Locate and run Python modules without importing them first. + .. moduleauthor:: Nick Coghlan **Source code:** :source:`Lib/runpy.py` diff --git a/Doc/library/sched.rst b/Doc/library/sched.rst --- a/Doc/library/sched.rst +++ b/Doc/library/sched.rst @@ -3,12 +3,13 @@ .. module:: sched :synopsis: General purpose event scheduler. + .. sectionauthor:: Moshe Zadka +**Source code:** :source:`Lib/sched.py` + .. index:: single: event scheduling -**Source code:** :source:`Lib/sched.py` - -------------- The :mod:`sched` module defines a class which implements a general purpose event diff --git a/Doc/library/select.rst b/Doc/library/select.rst --- a/Doc/library/select.rst +++ b/Doc/library/select.rst @@ -4,6 +4,7 @@ .. module:: select :synopsis: Wait for I/O completion on multiple streams. +-------------- This module provides access to the :c:func:`select` and :c:func:`poll` functions available in most operating systems, :c:func:`devpoll` available on diff --git a/Doc/library/selectors.rst b/Doc/library/selectors.rst --- a/Doc/library/selectors.rst +++ b/Doc/library/selectors.rst @@ -6,6 +6,9 @@ .. versionadded:: 3.4 +**Source code:** :source:`Lib/selectors.py` + +-------------- Introduction ------------ diff --git a/Doc/library/shelve.rst b/Doc/library/shelve.rst --- a/Doc/library/shelve.rst +++ b/Doc/library/shelve.rst @@ -4,11 +4,10 @@ .. module:: shelve :synopsis: Python object persistence. +**Source code:** :source:`Lib/shelve.py` .. index:: module: pickle -**Source code:** :source:`Lib/shelve.py` - -------------- A "shelf" is a persistent, dictionary-like object. The difference with "dbm" diff --git a/Doc/library/shlex.rst b/Doc/library/shlex.rst --- a/Doc/library/shlex.rst +++ b/Doc/library/shlex.rst @@ -3,6 +3,7 @@ .. module:: shlex :synopsis: Simple lexical analysis for Unix shell-like languages. + .. moduleauthor:: Eric S. Raymond .. moduleauthor:: Gustavo Niemeyer .. sectionauthor:: Eric S. Raymond diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst --- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -3,15 +3,16 @@ .. module:: shutil :synopsis: High-level file operations, including copying. + .. sectionauthor:: Fred L. Drake, Jr. .. partly based on the docstrings +**Source code:** :source:`Lib/shutil.py` + .. index:: single: file; copying single: copying files -**Source code:** :source:`Lib/shutil.py` - -------------- The :mod:`shutil` module offers a number of high-level operations on files and diff --git a/Doc/library/signal.rst b/Doc/library/signal.rst --- a/Doc/library/signal.rst +++ b/Doc/library/signal.rst @@ -4,6 +4,7 @@ .. module:: signal :synopsis: Set handlers for asynchronous events. +-------------- This module provides mechanisms to use signal handlers in Python. diff --git a/Doc/library/smtplib.rst b/Doc/library/smtplib.rst --- a/Doc/library/smtplib.rst +++ b/Doc/library/smtplib.rst @@ -3,15 +3,15 @@ .. module:: smtplib :synopsis: SMTP protocol client (requires sockets). + .. sectionauthor:: Eric S. Raymond +**Source code:** :source:`Lib/smtplib.py` .. index:: pair: SMTP; protocol single: Simple Mail Transfer Protocol -**Source code:** :source:`Lib/smtplib.py` - -------------- The :mod:`smtplib` module defines an SMTP client session object that can be used diff --git a/Doc/library/sndhdr.rst b/Doc/library/sndhdr.rst --- a/Doc/library/sndhdr.rst +++ b/Doc/library/sndhdr.rst @@ -3,15 +3,16 @@ .. module:: sndhdr :synopsis: Determine type of a sound file. + .. sectionauthor:: Fred L. Drake, Jr. .. Based on comments in the module source file. +**Source code:** :source:`Lib/sndhdr.py` + .. index:: single: A-LAW single: u-LAW -**Source code:** :source:`Lib/sndhdr.py` - -------------- The :mod:`sndhdr` provides utility functions which attempt to determine the type diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -4,6 +4,9 @@ .. module:: socket :synopsis: Low-level networking interface. +**Source code:** :source:`Lib/socket.py` + +-------------- This module provides access to the BSD *socket* interface. It is available on all modern Unix systems, Windows, MacOS, and probably additional platforms. diff --git a/Doc/library/spwd.rst b/Doc/library/spwd.rst --- a/Doc/library/spwd.rst +++ b/Doc/library/spwd.rst @@ -5,6 +5,7 @@ :platform: Unix :synopsis: The shadow password database (getspnam() and friends). +-------------- This module provides access to the Unix shadow password database. It is available on various Unix versions. diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -3,8 +3,12 @@ .. module:: sqlite3 :synopsis: A DB-API 2.0 implementation using SQLite 3.x. + .. sectionauthor:: Gerhard H?ring +**Source code:** :source:`Lib/sqlite3/` + +-------------- SQLite is a C library that provides a lightweight disk-based database that doesn't require a separate server process and allows accessing the database diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -7,13 +7,12 @@ .. moduleauthor:: Bill Janssen .. sectionauthor:: Bill Janssen +**Source code:** :source:`Lib/ssl.py` .. index:: single: OpenSSL; (use in module ssl) .. index:: TLS, SSL, Transport Layer Security, Secure Sockets Layer -**Source code:** :source:`Lib/ssl.py` - -------------- This module provides access to Transport Layer Security (often known as "Secure diff --git a/Doc/library/stat.rst b/Doc/library/stat.rst --- a/Doc/library/stat.rst +++ b/Doc/library/stat.rst @@ -4,10 +4,10 @@ .. module:: stat :synopsis: Utilities for interpreting the results of os.stat(), os.lstat() and os.fstat(). + .. sectionauthor:: Skip Montanaro -**Source code:** :source:`Modules/_stat.c` - :source:`Lib/stat.py` +**Source code:** :source:`Lib/stat.py` -------------- diff --git a/Doc/library/statistics.rst b/Doc/library/statistics.rst --- a/Doc/library/statistics.rst +++ b/Doc/library/statistics.rst @@ -3,18 +3,19 @@ .. module:: statistics :synopsis: mathematical statistics functions + .. moduleauthor:: Steven D'Aprano .. sectionauthor:: Steven D'Aprano .. versionadded:: 3.4 +**Source code:** :source:`Lib/statistics.py` + .. testsetup:: * from statistics import * __name__ = '' -**Source code:** :source:`Lib/statistics.py` - -------------- This module provides functions for calculating mathematical statistics of diff --git a/Doc/library/stringprep.rst b/Doc/library/stringprep.rst --- a/Doc/library/stringprep.rst +++ b/Doc/library/stringprep.rst @@ -3,9 +3,13 @@ .. module:: stringprep :synopsis: String preparation, as per RFC 3453 + .. moduleauthor:: Martin v. L?wis .. sectionauthor:: Martin v. L?wis +**Source code:** :source:`Lib/stringprep.py` + +-------------- When identifying things (such as host names) in the internet, it is often necessary to compare such identifications for "equality". Exactly how this diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -4,10 +4,14 @@ .. module:: struct :synopsis: Interpret bytes as packed binary data. +**Source code:** :source:`Lib/struct.py` + .. index:: pair: C; structures triple: packing; binary; data +-------------- + This module performs conversions between Python values and C structs represented as Python :class:`bytes` objects. This can be used in handling binary data stored in files or from network connections, among other sources. It uses diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -3,9 +3,13 @@ .. module:: subprocess :synopsis: Subprocess management. + .. moduleauthor:: Peter ?strand .. sectionauthor:: Peter ?strand +**Source code:** :source:`Lib/subprocess.py` + +-------------- The :mod:`subprocess` module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes. This module intends to diff --git a/Doc/library/sunau.rst b/Doc/library/sunau.rst --- a/Doc/library/sunau.rst +++ b/Doc/library/sunau.rst @@ -3,6 +3,7 @@ .. module:: sunau :synopsis: Provide an interface to the Sun AU sound format. + .. sectionauthor:: Moshe Zadka **Source code:** :source:`Lib/sunau.py` diff --git a/Doc/library/symbol.rst b/Doc/library/symbol.rst --- a/Doc/library/symbol.rst +++ b/Doc/library/symbol.rst @@ -3,6 +3,7 @@ .. module:: symbol :synopsis: Constants representing internal nodes of the parse tree. + .. sectionauthor:: Fred L. Drake, Jr. **Source code:** :source:`Lib/symbol.py` diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -4,6 +4,7 @@ .. module:: sys :synopsis: Access system-specific parameters and functions. +-------------- This module provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter. It is diff --git a/Doc/library/sysconfig.rst b/Doc/library/sysconfig.rst --- a/Doc/library/sysconfig.rst +++ b/Doc/library/sysconfig.rst @@ -3,16 +3,17 @@ .. module:: sysconfig :synopsis: Python's configuration information + .. moduleauthor:: Tarek Ziad? .. sectionauthor:: Tarek Ziad? -.. index:: - single: configuration information - .. versionadded:: 3.2 **Source code:** :source:`Lib/sysconfig.py` +.. index:: + single: configuration information + -------------- The :mod:`sysconfig` module provides access to Python's configuration diff --git a/Doc/library/syslog.rst b/Doc/library/syslog.rst --- a/Doc/library/syslog.rst +++ b/Doc/library/syslog.rst @@ -5,6 +5,7 @@ :platform: Unix :synopsis: An interface to the Unix syslog library routines. +-------------- This module provides an interface to the Unix ``syslog`` library routines. Refer to the Unix manual pages for a detailed description of the ``syslog`` diff --git a/Doc/library/tabnanny.rst b/Doc/library/tabnanny.rst --- a/Doc/library/tabnanny.rst +++ b/Doc/library/tabnanny.rst @@ -4,6 +4,7 @@ .. module:: tabnanny :synopsis: Tool for detecting white space related problems in Python source files in a directory tree. + .. moduleauthor:: Tim Peters .. sectionauthor:: Peter Funk diff --git a/Doc/library/tarfile.rst b/Doc/library/tarfile.rst --- a/Doc/library/tarfile.rst +++ b/Doc/library/tarfile.rst @@ -4,7 +4,6 @@ .. module:: tarfile :synopsis: Read and write tar-format archive files. - .. moduleauthor:: Lars Gust?bel .. sectionauthor:: Lars Gust?bel diff --git a/Doc/library/telnetlib.rst b/Doc/library/telnetlib.rst --- a/Doc/library/telnetlib.rst +++ b/Doc/library/telnetlib.rst @@ -3,13 +3,13 @@ .. module:: telnetlib :synopsis: Telnet client class. + .. sectionauthor:: Skip Montanaro +**Source code:** :source:`Lib/telnetlib.py` .. index:: single: protocol; Telnet -**Source code:** :source:`Lib/telnetlib.py` - -------------- The :mod:`telnetlib` module provides a :class:`Telnet` class that implements the diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst --- a/Doc/library/tempfile.rst +++ b/Doc/library/tempfile.rst @@ -1,19 +1,17 @@ :mod:`tempfile` --- Generate temporary files and directories ============================================================ -.. sectionauthor:: Zack Weinberg - - .. module:: tempfile :synopsis: Generate temporary files and directories. +.. sectionauthor:: Zack Weinberg + +**Source code:** :source:`Lib/tempfile.py` .. index:: pair: temporary; file name pair: temporary; file -**Source code:** :source:`Lib/tempfile.py` - -------------- This module creates temporary files and directories. It works on all diff --git a/Doc/library/termios.rst b/Doc/library/termios.rst --- a/Doc/library/termios.rst +++ b/Doc/library/termios.rst @@ -5,11 +5,12 @@ :platform: Unix :synopsis: POSIX style tty control. - .. index:: pair: POSIX; I/O control pair: tty; I/O control +-------------- + This module provides an interface to the POSIX calls for tty I/O control. For a complete description of these calls, see :manpage:`termios(2)` Unix manual page. It is only available for those Unix versions that support POSIX diff --git a/Doc/library/test.rst b/Doc/library/test.rst --- a/Doc/library/test.rst +++ b/Doc/library/test.rst @@ -3,6 +3,7 @@ .. module:: test :synopsis: Regression tests package containing the testing suite for Python. + .. sectionauthor:: Brett Cannon .. note:: @@ -12,6 +13,7 @@ mentioned here can change or be removed without notice between releases of Python. +-------------- The :mod:`test` package contains all regression tests for Python as well as the modules :mod:`test.support` and :mod:`test.regrtest`. diff --git a/Doc/library/textwrap.rst b/Doc/library/textwrap.rst --- a/Doc/library/textwrap.rst +++ b/Doc/library/textwrap.rst @@ -3,6 +3,7 @@ .. module:: textwrap :synopsis: Text wrapping and filling + .. moduleauthor:: Greg Ward .. sectionauthor:: Greg Ward diff --git a/Doc/library/time.rst b/Doc/library/time.rst --- a/Doc/library/time.rst +++ b/Doc/library/time.rst @@ -4,6 +4,7 @@ .. module:: time :synopsis: Time access and conversions. +-------------- This module provides various time-related functions. For related functionality, see also the :mod:`datetime` and :mod:`calendar` modules. diff --git a/Doc/library/timeit.rst b/Doc/library/timeit.rst --- a/Doc/library/timeit.rst +++ b/Doc/library/timeit.rst @@ -4,13 +4,12 @@ .. module:: timeit :synopsis: Measure the execution time of small code snippets. +**Source code:** :source:`Lib/timeit.py` .. index:: single: Benchmarking single: Performance -**Source code:** :source:`Lib/timeit.py` - -------------- This module provides a simple way to time small bits of Python code. It has both diff --git a/Doc/library/tkinter.rst b/Doc/library/tkinter.rst --- a/Doc/library/tkinter.rst +++ b/Doc/library/tkinter.rst @@ -3,8 +3,12 @@ .. module:: tkinter :synopsis: Interface to Tcl/Tk for graphical user interfaces + .. moduleauthor:: Guido van Rossum +**Source code:** :source:`Lib/tkinter/__init__.py` + +-------------- The :mod:`tkinter` package ("Tk interface") is the standard Python interface to the Tk GUI toolkit. Both Tk and :mod:`tkinter` are available on most Unix diff --git a/Doc/library/tkinter.scrolledtext.rst b/Doc/library/tkinter.scrolledtext.rst --- a/Doc/library/tkinter.scrolledtext.rst +++ b/Doc/library/tkinter.scrolledtext.rst @@ -4,8 +4,12 @@ .. module:: tkinter.scrolledtext :platform: Tk :synopsis: Text widget with a vertical scroll bar. + .. sectionauthor:: Fred L. Drake, Jr. +**Source code:** :source:`Lib/tkinter/scrolledtext.py` + +-------------- The :mod:`tkinter.scrolledtext` module provides a class of the same name which implements a basic text widget which has a vertical scroll bar configured to do diff --git a/Doc/library/tkinter.tix.rst b/Doc/library/tkinter.tix.rst --- a/Doc/library/tkinter.tix.rst +++ b/Doc/library/tkinter.tix.rst @@ -3,11 +3,15 @@ .. module:: tkinter.tix :synopsis: Tk Extension Widgets for Tkinter + .. sectionauthor:: Mike Clarkson +**Source code:** :source:`Lib/tkinter/tix.py` .. index:: single: Tix +-------------- + The :mod:`tkinter.tix` (Tk Interface Extension) module provides an additional rich set of widgets. Although the standard Tk library has many useful widgets, they are far from complete. The :mod:`tkinter.tix` library provides most of the diff --git a/Doc/library/tkinter.ttk.rst b/Doc/library/tkinter.ttk.rst --- a/Doc/library/tkinter.ttk.rst +++ b/Doc/library/tkinter.ttk.rst @@ -3,11 +3,15 @@ .. module:: tkinter.ttk :synopsis: Tk themed widget set + .. sectionauthor:: Guilherme Polo +**Source code:** :source:`Lib/tkinter/ttk.py` .. index:: single: ttk +-------------- + The :mod:`tkinter.ttk` module provides access to the Tk themed widget set, introduced in Tk 8.5. If Python has not been compiled against Tk 8.5, this module can still be accessed if *Tile* has been installed. The former diff --git a/Doc/library/token.rst b/Doc/library/token.rst --- a/Doc/library/token.rst +++ b/Doc/library/token.rst @@ -3,6 +3,7 @@ .. module:: token :synopsis: Constants representing terminal nodes of the parse tree. + .. sectionauthor:: Fred L. Drake, Jr. **Source code:** :source:`Lib/token.py` diff --git a/Doc/library/tokenize.rst b/Doc/library/tokenize.rst --- a/Doc/library/tokenize.rst +++ b/Doc/library/tokenize.rst @@ -3,6 +3,7 @@ .. module:: tokenize :synopsis: Lexical scanner for Python source code. + .. moduleauthor:: Ka Ping Yee .. sectionauthor:: Fred L. Drake, Jr. diff --git a/Doc/library/traceback.rst b/Doc/library/traceback.rst --- a/Doc/library/traceback.rst +++ b/Doc/library/traceback.rst @@ -4,6 +4,9 @@ .. module:: traceback :synopsis: Print or retrieve a stack traceback. +**Source code:** :source:`Lib/traceback.py` + +-------------- This module provides a standard interface to extract, format and print stack traces of Python programs. It exactly mimics the behavior of the Python diff --git a/Doc/library/tracemalloc.rst b/Doc/library/tracemalloc.rst --- a/Doc/library/tracemalloc.rst +++ b/Doc/library/tracemalloc.rst @@ -6,6 +6,10 @@ .. versionadded:: 3.4 +**Source code:** :source:`Lib/tracemalloc.py` + +-------------- + The tracemalloc module is a debug tool to trace memory blocks allocated by Python. It provides the following information: diff --git a/Doc/library/tty.rst b/Doc/library/tty.rst --- a/Doc/library/tty.rst +++ b/Doc/library/tty.rst @@ -4,9 +4,13 @@ .. module:: tty :platform: Unix :synopsis: Utility functions that perform common terminal control operations. + .. moduleauthor:: Steen Lumholt .. sectionauthor:: Moshe Zadka +**Source code:** :source:`Lib/tty.py` + +-------------- The :mod:`tty` module defines functions for putting the tty into cbreak and raw modes. diff --git a/Doc/library/turtle.rst b/Doc/library/turtle.rst --- a/Doc/library/turtle.rst +++ b/Doc/library/turtle.rst @@ -4,13 +4,18 @@ .. module:: turtle :synopsis: An educational framework for simple graphics applications + .. sectionauthor:: Gregor Lingl +**Source code:** :source:`Lib/turtle.py` + .. testsetup:: default from turtle import * turtle = Turtle() +-------------- + Introduction ============ diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -4,10 +4,10 @@ .. module:: typing :synopsis: Support for type hints (see PEP 484). +.. versionadded:: 3.5 + **Source code:** :source:`Lib/typing.py` -.. versionadded:: 3.5 - -------------- This module supports type hints as specified by :pep:`484`. The most diff --git a/Doc/library/unicodedata.rst b/Doc/library/unicodedata.rst --- a/Doc/library/unicodedata.rst +++ b/Doc/library/unicodedata.rst @@ -3,16 +3,18 @@ .. module:: unicodedata :synopsis: Access the Unicode Database. + .. moduleauthor:: Marc-Andr? Lemburg .. sectionauthor:: Marc-Andr? Lemburg .. sectionauthor:: Martin v. L?wis - .. index:: single: Unicode single: character pair: Unicode; database +-------------- + This module provides access to the Unicode Character Database (UCD) which defines character properties for all Unicode characters. The data contained in this database is compiled from the `UCD version 8.0.0 diff --git a/Doc/library/unittest.mock.rst b/Doc/library/unittest.mock.rst --- a/Doc/library/unittest.mock.rst +++ b/Doc/library/unittest.mock.rst @@ -4,11 +4,16 @@ .. module:: unittest.mock :synopsis: Mock object library. + .. moduleauthor:: Michael Foord .. currentmodule:: unittest.mock .. versionadded:: 3.3 +**Source code:** :source:`Lib/unittest/mock.py` + +-------------- + :mod:`unittest.mock` is a library for testing in Python. It allows you to replace parts of your system under test with mock objects and make assertions about how they have been used. @@ -32,8 +37,6 @@ There is a backport of :mod:`unittest.mock` for earlier versions of Python, available as `mock on PyPI `_. -**Source code:** :source:`Lib/unittest/mock.py` - Quick Guide ----------- diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst --- a/Doc/library/unittest.rst +++ b/Doc/library/unittest.rst @@ -3,11 +3,16 @@ .. module:: unittest :synopsis: Unit testing framework for Python. + .. moduleauthor:: Steve Purcell .. sectionauthor:: Steve Purcell .. sectionauthor:: Fred L. Drake, Jr. .. sectionauthor:: Raymond Hettinger +**Source code:** :source:`Lib/unittest/__init__.py` + +-------------- + (If you are already familiar with the basic concepts of testing, you might want to skip to :ref:`the list of assert methods `.) diff --git a/Doc/library/urllib.error.rst b/Doc/library/urllib.error.rst --- a/Doc/library/urllib.error.rst +++ b/Doc/library/urllib.error.rst @@ -3,9 +3,13 @@ .. module:: urllib.error :synopsis: Exception classes raised by urllib.request. + .. moduleauthor:: Jeremy Hylton .. sectionauthor:: Senthil Kumaran +**Source code:** :source:`Lib/urllib/error.py` + +-------------- The :mod:`urllib.error` module defines the exception classes for exceptions raised by :mod:`urllib.request`. The base exception class is :exc:`URLError`. diff --git a/Doc/library/urllib.parse.rst b/Doc/library/urllib.parse.rst --- a/Doc/library/urllib.parse.rst +++ b/Doc/library/urllib.parse.rst @@ -4,6 +4,7 @@ .. module:: urllib.parse :synopsis: Parse URLs into or assemble them from components. +**Source code:** :source:`Lib/urllib/parse.py` .. index:: single: WWW @@ -12,8 +13,6 @@ pair: URL; parsing pair: relative; URL -**Source code:** :source:`Lib/urllib/parse.py` - -------------- This module defines a standard interface to break Uniform Resource Locator (URL) 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 @@ -3,10 +3,14 @@ .. module:: urllib.request :synopsis: Extensible library for opening URLs. + .. moduleauthor:: Jeremy Hylton .. sectionauthor:: Moshe Zadka .. sectionauthor:: Senthil Kumaran +**Source code:** :source:`Lib/urllib/request.py` + +-------------- The :mod:`urllib.request` module defines functions and classes which help in opening URLs (mostly HTTP) in a complex world --- basic and digest diff --git a/Doc/library/urllib.robotparser.rst b/Doc/library/urllib.robotparser.rst --- a/Doc/library/urllib.robotparser.rst +++ b/Doc/library/urllib.robotparser.rst @@ -4,8 +4,10 @@ .. module:: urllib.robotparser :synopsis: Load a robots.txt file and answer questions about fetchability of other URLs. + .. sectionauthor:: Skip Montanaro +**Source code:** :source:`Lib/urllib/robotparser.py` .. index:: single: WWW @@ -13,6 +15,8 @@ single: URL single: robots.txt +-------------- + This module provides a single class, :class:`RobotFileParser`, which answers questions about whether or not a particular user agent can fetch a URL on the Web site that published the :file:`robots.txt` file. For more details on the diff --git a/Doc/library/urllib.rst b/Doc/library/urllib.rst --- a/Doc/library/urllib.rst +++ b/Doc/library/urllib.rst @@ -3,6 +3,10 @@ .. module:: urllib +**Source code:** :source:`Lib/urllib/` + +-------------- + ``urllib`` is a package that collects several modules for working with URLs: * :mod:`urllib.request` for opening and reading URLs diff --git a/Doc/library/uu.rst b/Doc/library/uu.rst --- a/Doc/library/uu.rst +++ b/Doc/library/uu.rst @@ -3,6 +3,7 @@ .. module:: uu :synopsis: Encode and decode files in uuencode format. + .. moduleauthor:: Lance Ellinghouse **Source code:** :source:`Lib/uu.py` diff --git a/Doc/library/uuid.rst b/Doc/library/uuid.rst --- a/Doc/library/uuid.rst +++ b/Doc/library/uuid.rst @@ -6,6 +6,9 @@ .. moduleauthor:: Ka-Ping Yee .. sectionauthor:: George Yoshida +**Source code:** :source:`Lib/uuid.py` + +-------------- This module provides immutable :class:`UUID` objects (the :class:`UUID` class) and the functions :func:`uuid1`, :func:`uuid3`, :func:`uuid4`, :func:`uuid5` for diff --git a/Doc/library/venv.rst b/Doc/library/venv.rst --- a/Doc/library/venv.rst +++ b/Doc/library/venv.rst @@ -3,16 +3,16 @@ .. module:: venv :synopsis: Creation of virtual environments. + .. moduleauthor:: Vinay Sajip .. sectionauthor:: Vinay Sajip +.. versionadded:: 3.3 + +**Source code:** :source:`Lib/venv/` .. index:: pair: Environments; virtual -.. versionadded:: 3.3 - -**Source code:** :source:`Lib/venv` - -------------- The :mod:`venv` module provides support for creating lightweight "virtual diff --git a/Doc/library/warnings.rst b/Doc/library/warnings.rst --- a/Doc/library/warnings.rst +++ b/Doc/library/warnings.rst @@ -1,13 +1,13 @@ :mod:`warnings` --- Warning control =================================== -.. index:: single: warnings - .. module:: warnings :synopsis: Issue warning messages and control their disposition. **Source code:** :source:`Lib/warnings.py` +.. index:: single: warnings + -------------- Warning messages are typically issued in situations where it is useful to alert diff --git a/Doc/library/wave.rst b/Doc/library/wave.rst --- a/Doc/library/wave.rst +++ b/Doc/library/wave.rst @@ -3,6 +3,7 @@ .. module:: wave :synopsis: Provide an interface to the WAV sound format. + .. sectionauthor:: Moshe Zadka .. Documentations stolen from comments in file. diff --git a/Doc/library/weakref.rst b/Doc/library/weakref.rst --- a/Doc/library/weakref.rst +++ b/Doc/library/weakref.rst @@ -3,6 +3,7 @@ .. module:: weakref :synopsis: Support for weak references and weak dictionaries. + .. moduleauthor:: Fred L. Drake, Jr. .. moduleauthor:: Neil Schemenauer .. moduleauthor:: Martin von L?wis diff --git a/Doc/library/webbrowser.rst b/Doc/library/webbrowser.rst --- a/Doc/library/webbrowser.rst +++ b/Doc/library/webbrowser.rst @@ -3,6 +3,7 @@ .. module:: webbrowser :synopsis: Easy-to-use controller for Web browsers. + .. moduleauthor:: Fred L. Drake, Jr. .. sectionauthor:: Fred L. Drake, Jr. diff --git a/Doc/library/winreg.rst b/Doc/library/winreg.rst --- a/Doc/library/winreg.rst +++ b/Doc/library/winreg.rst @@ -4,8 +4,10 @@ .. module:: winreg :platform: Windows :synopsis: Routines and objects for manipulating the Windows registry. + .. sectionauthor:: Mark Hammond +-------------- These functions expose the Windows registry API to Python. Instead of using an integer as the registry handle, a :ref:`handle object ` is used diff --git a/Doc/library/winsound.rst b/Doc/library/winsound.rst --- a/Doc/library/winsound.rst +++ b/Doc/library/winsound.rst @@ -4,9 +4,11 @@ .. module:: winsound :platform: Windows :synopsis: Access to the sound-playing machinery for Windows. + .. moduleauthor:: Toby Dickenson .. sectionauthor:: Fred L. Drake, Jr. +-------------- The :mod:`winsound` module provides access to the basic sound-playing machinery provided by Windows platforms. It includes functions and several constants. diff --git a/Doc/library/wsgiref.rst b/Doc/library/wsgiref.rst --- a/Doc/library/wsgiref.rst +++ b/Doc/library/wsgiref.rst @@ -3,9 +3,11 @@ .. module:: wsgiref :synopsis: WSGI Utilities and Reference Implementation. + .. moduleauthor:: Phillip J. Eby .. sectionauthor:: Phillip J. Eby +-------------- The Web Server Gateway Interface (WSGI) is a standard interface between web server software and web applications written in Python. Having a standard diff --git a/Doc/library/xdrlib.rst b/Doc/library/xdrlib.rst --- a/Doc/library/xdrlib.rst +++ b/Doc/library/xdrlib.rst @@ -4,13 +4,12 @@ .. module:: xdrlib :synopsis: Encoders and decoders for the External Data Representation (XDR). +**Source code:** :source:`Lib/xdrlib.py` .. index:: single: XDR single: External Data Representation -**Source code:** :source:`Lib/xdrlib.py` - -------------- The :mod:`xdrlib` module supports the External Data Representation Standard as diff --git a/Doc/library/xml.dom.minidom.rst b/Doc/library/xml.dom.minidom.rst --- a/Doc/library/xml.dom.minidom.rst +++ b/Doc/library/xml.dom.minidom.rst @@ -3,6 +3,7 @@ .. module:: xml.dom.minidom :synopsis: Minimal Document Object Model (DOM) implementation. + .. moduleauthor:: Paul Prescod .. sectionauthor:: Paul Prescod .. sectionauthor:: Martin v. L?wis diff --git a/Doc/library/xml.dom.pulldom.rst b/Doc/library/xml.dom.pulldom.rst --- a/Doc/library/xml.dom.pulldom.rst +++ b/Doc/library/xml.dom.pulldom.rst @@ -3,6 +3,7 @@ .. module:: xml.dom.pulldom :synopsis: Support for building partial DOM trees from SAX events. + .. moduleauthor:: Paul Prescod **Source code:** :source:`Lib/xml/dom/pulldom.py` diff --git a/Doc/library/xml.dom.rst b/Doc/library/xml.dom.rst --- a/Doc/library/xml.dom.rst +++ b/Doc/library/xml.dom.rst @@ -3,9 +3,13 @@ .. module:: xml.dom :synopsis: Document Object Model API for Python. + .. sectionauthor:: Paul Prescod .. sectionauthor:: Martin v. L?wis +**Source code:** :source:`Lib/xml/dom/__init__.py` + +-------------- The Document Object Model, or "DOM," is a cross-language API from the World Wide Web Consortium (W3C) for accessing and modifying XML documents. A DOM diff --git a/Doc/library/xml.etree.elementtree.rst b/Doc/library/xml.etree.elementtree.rst --- a/Doc/library/xml.etree.elementtree.rst +++ b/Doc/library/xml.etree.elementtree.rst @@ -3,8 +3,13 @@ .. module:: xml.etree.ElementTree :synopsis: Implementation of the ElementTree API. + .. moduleauthor:: Fredrik Lundh +**Source code:** :source:`Lib/xml/etree/ElementTree.py` + +-------------- + The :mod:`xml.etree.ElementTree` module implements a simple and efficient API for parsing and creating XML data. diff --git a/Doc/library/xml.rst b/Doc/library/xml.rst --- a/Doc/library/xml.rst +++ b/Doc/library/xml.rst @@ -5,9 +5,13 @@ .. module:: xml :synopsis: Package containing XML processing modules + .. sectionauthor:: Christian Heimes .. sectionauthor:: Georg Brandl +**Source code:** :source:`Lib/xml/` + +-------------- Python's interfaces for processing XML are grouped in the ``xml`` package. diff --git a/Doc/library/xml.sax.handler.rst b/Doc/library/xml.sax.handler.rst --- a/Doc/library/xml.sax.handler.rst +++ b/Doc/library/xml.sax.handler.rst @@ -3,9 +3,13 @@ .. module:: xml.sax.handler :synopsis: Base classes for SAX event handlers. + .. moduleauthor:: Lars Marius Garshol .. sectionauthor:: Martin v. L?wis +**Source code:** :source:`Lib/xml/sax/handler.py` + +-------------- The SAX API defines four kinds of handlers: content handlers, DTD handlers, error handlers, and entity resolvers. Applications normally only need to diff --git a/Doc/library/xml.sax.reader.rst b/Doc/library/xml.sax.reader.rst --- a/Doc/library/xml.sax.reader.rst +++ b/Doc/library/xml.sax.reader.rst @@ -3,9 +3,13 @@ .. module:: xml.sax.xmlreader :synopsis: Interface which SAX-compliant XML parsers must implement. + .. moduleauthor:: Lars Marius Garshol .. sectionauthor:: Martin v. L?wis +**Source code:** :source:`Lib/xml/sax/xmlreader.py` + +-------------- SAX parsers implement the :class:`XMLReader` interface. They are implemented in a Python module, which must provide a function :func:`create_parser`. This diff --git a/Doc/library/xml.sax.rst b/Doc/library/xml.sax.rst --- a/Doc/library/xml.sax.rst +++ b/Doc/library/xml.sax.rst @@ -3,10 +3,14 @@ .. module:: xml.sax :synopsis: Package containing SAX2 base classes and convenience functions. + .. moduleauthor:: Lars Marius Garshol .. sectionauthor:: Fred L. Drake, Jr. .. sectionauthor:: Martin v. L?wis +**Source code:** :source:`Lib/xml/sax/__init__.py` + +-------------- The :mod:`xml.sax` package provides a number of modules which implement the Simple API for XML (SAX) interface for Python. The package itself provides the diff --git a/Doc/library/xml.sax.utils.rst b/Doc/library/xml.sax.utils.rst --- a/Doc/library/xml.sax.utils.rst +++ b/Doc/library/xml.sax.utils.rst @@ -3,9 +3,13 @@ .. module:: xml.sax.saxutils :synopsis: Convenience functions and classes for use with SAX. + .. moduleauthor:: Lars Marius Garshol .. sectionauthor:: Martin v. L?wis +**Source code:** :source:`Lib/xml/sax/saxutils.py` + +-------------- The module :mod:`xml.sax.saxutils` contains a number of classes and functions that are commonly useful when creating SAX applications, either in direct use, diff --git a/Doc/library/xmlrpc.client.rst b/Doc/library/xmlrpc.client.rst --- a/Doc/library/xmlrpc.client.rst +++ b/Doc/library/xmlrpc.client.rst @@ -3,15 +3,15 @@ .. module:: xmlrpc.client :synopsis: XML-RPC client access. + .. moduleauthor:: Fredrik Lundh .. sectionauthor:: Eric S. Raymond +**Source code:** :source:`Lib/xmlrpc/client.py` .. XXX Not everything is documented yet. It might be good to describe Marshaller, Unmarshaller, getparser and Transport. -**Source code:** :source:`Lib/xmlrpc/client.py` - -------------- XML-RPC is a Remote Procedure Call method that uses XML passed via HTTP(S) as a diff --git a/Doc/library/xmlrpc.server.rst b/Doc/library/xmlrpc.server.rst --- a/Doc/library/xmlrpc.server.rst +++ b/Doc/library/xmlrpc.server.rst @@ -3,6 +3,7 @@ .. module:: xmlrpc.server :synopsis: Basic XML-RPC server implementations. + .. moduleauthor:: Brian Quinlan .. sectionauthor:: Fred L. Drake, Jr. diff --git a/Doc/library/zipapp.rst b/Doc/library/zipapp.rst --- a/Doc/library/zipapp.rst +++ b/Doc/library/zipapp.rst @@ -4,14 +4,13 @@ .. module:: zipapp :synopsis: Manage executable python zip archives +.. versionadded:: 3.5 + +**Source code:** :source:`Lib/zipapp.py` .. index:: single: Executable Zip Files -.. versionadded:: 3.5 - -**Source code:** :source:`Lib/zipapp.py` - -------------- This module provides tools to manage the creation of zip files containing diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -3,6 +3,7 @@ .. module:: zipfile :synopsis: Read and write ZIP-format archive files. + .. moduleauthor:: James C. Ahlstrom .. sectionauthor:: James C. Ahlstrom diff --git a/Doc/library/zipimport.rst b/Doc/library/zipimport.rst --- a/Doc/library/zipimport.rst +++ b/Doc/library/zipimport.rst @@ -3,8 +3,10 @@ .. module:: zipimport :synopsis: support for importing Python modules from ZIP archives. + .. moduleauthor:: Just van Rossum +-------------- This module adds the ability to import Python modules (:file:`\*.py`, :file:`\*.py[co]`) and packages from ZIP-format archives. It is usually not diff --git a/Doc/library/zlib.rst b/Doc/library/zlib.rst --- a/Doc/library/zlib.rst +++ b/Doc/library/zlib.rst @@ -5,6 +5,7 @@ :synopsis: Low-level interface to compression and decompression routines compatible with gzip. +-------------- For applications that require data compression, the functions in this module allow compression and decompression, using the zlib library. The zlib library diff --git a/Lib/idlelib/help.html b/Lib/idlelib/help.html --- a/Lib/idlelib/help.html +++ b/Lib/idlelib/help.html @@ -75,7 +75,9 @@

    25.5. IDLE?

    -

    IDLE is Python’s Integrated Development and Learning Environment.

    +

    Source code: Lib/idlelib/

    +
    +

    IDLE is Python’s Integrated Development and Learning Environment.

    IDLE has the following features:

    • coded in 100% pure Python, using the tkinter GUI toolkit
    • @@ -701,7 +703,7 @@ The Python Software Foundation is a non-profit corporation. Please donate.
      - Last updated on May 02, 2016. + Last updated on Jun 11, 2016. Found a bug?
      Created using Sphinx 1.3.3. diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -824,6 +824,7 @@ Amos Latteier Piers Lauder Ben Laurie +Yoni Lavi Simon Law Julia Lawall Chris Lawrence diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1139,6 +1139,9 @@ Documentation ------------- +- Issue #22558: Add remaining doc links to source code for Python-coded modules. + Patch by Yoni Lavi. + - Issue #12067: Rewrite Comparisons section in the Expressions chapter of the language reference. Some of the details of comparing mixed types were incorrect or ambiguous. NotImplemented is only relevant at a lower level -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 15:12:33 2016 From: python-checkins at python.org (berker.peksag) Date: Sat, 11 Jun 2016 19:12:33 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIxMzg2?= =?utf-8?q?=3A_Implement_missing_IPv4Address=2Eis=5Fglobal_property?= Message-ID: <20160611191228.99059.82976.95182F80@psf.io> https://hg.python.org/cpython/rev/d65191861599 changeset: 101879:d65191861599 branch: 3.5 parent: 101877:222c1d461aa8 user: Berker Peksag date: Sat Jun 11 22:11:47 2016 +0300 summary: Issue #21386: Implement missing IPv4Address.is_global property It was documented since 07a5610bae9d. Initial patch by Roger Luethi. files: Lib/ipaddress.py | 7 +++++++ Lib/test/test_ipaddress.py | 3 +++ Misc/NEWS | 3 +++ 3 files changed, 13 insertions(+), 0 deletions(-) diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py --- a/Lib/ipaddress.py +++ b/Lib/ipaddress.py @@ -1312,6 +1312,11 @@ return any(self in net for net in self._constants._private_networks) @property + @functools.lru_cache() + def is_global(self): + return self not in self._constants._public_network and not self.is_private + + @property def is_multicast(self): """Test if the address is reserved for multicast use. @@ -1557,6 +1562,8 @@ _multicast_network = IPv4Network('224.0.0.0/4') + _public_network = IPv4Network('100.64.0.0/10') + _private_networks = [ IPv4Network('0.0.0.0/8'), IPv4Network('10.0.0.0/8'), diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py --- a/Lib/test/test_ipaddress.py +++ b/Lib/test/test_ipaddress.py @@ -1626,6 +1626,9 @@ self.assertEqual(False, ipaddress.ip_address('169.255.100.200').is_link_local) + self.assertTrue(ipaddress.ip_address('192.0.7.1').is_global) + self.assertFalse(ipaddress.ip_address('203.0.113.1').is_global) + self.assertEqual(True, ipaddress.ip_address('127.100.200.254').is_loopback) self.assertEqual(True, ipaddress.ip_address('127.42.0.0').is_loopback) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -139,6 +139,9 @@ Library ------- +- Issue #21386: Implement missing IPv4Address.is_global property. It was + documented since 07a5610bae9d. Initial patch by Roger Luethi. + - Issue #20900: distutils register command now decodes HTTP responses correctly. Initial patch by ingrid. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 15:12:33 2016 From: python-checkins at python.org (berker.peksag) Date: Sat, 11 Jun 2016 19:12:33 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2321386=3A_Merge_from_3=2E5?= Message-ID: <20160611191229.99348.13379.020C1410@psf.io> https://hg.python.org/cpython/rev/1519ca772e54 changeset: 101880:1519ca772e54 parent: 101878:2a01d7a488e9 parent: 101879:d65191861599 user: Berker Peksag date: Sat Jun 11 22:12:36 2016 +0300 summary: Issue #21386: Merge from 3.5 files: Lib/ipaddress.py | 7 +++++++ Lib/test/test_ipaddress.py | 3 +++ Misc/NEWS | 3 +++ 3 files changed, 13 insertions(+), 0 deletions(-) diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py --- a/Lib/ipaddress.py +++ b/Lib/ipaddress.py @@ -1312,6 +1312,11 @@ return any(self in net for net in self._constants._private_networks) @property + @functools.lru_cache() + def is_global(self): + return self not in self._constants._public_network and not self.is_private + + @property def is_multicast(self): """Test if the address is reserved for multicast use. @@ -1557,6 +1562,8 @@ _multicast_network = IPv4Network('224.0.0.0/4') + _public_network = IPv4Network('100.64.0.0/10') + _private_networks = [ IPv4Network('0.0.0.0/8'), IPv4Network('10.0.0.0/8'), diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py --- a/Lib/test/test_ipaddress.py +++ b/Lib/test/test_ipaddress.py @@ -1626,6 +1626,9 @@ self.assertEqual(False, ipaddress.ip_address('169.255.100.200').is_link_local) + self.assertTrue(ipaddress.ip_address('192.0.7.1').is_global) + self.assertFalse(ipaddress.ip_address('203.0.113.1').is_global) + self.assertEqual(True, ipaddress.ip_address('127.100.200.254').is_loopback) self.assertEqual(True, ipaddress.ip_address('127.42.0.0').is_loopback) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -38,6 +38,9 @@ Library ------- +- Issue #21386: Implement missing IPv4Address.is_global property. It was + documented since 07a5610bae9d. Initial patch by Roger Luethi. + - Issue #27029: Removed deprecated support of universal newlines mode from ZipFile.open(). -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 15:29:56 2016 From: python-checkins at python.org (berker.peksag) Date: Sat, 11 Jun 2016 19:29:56 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2320508=3A_Improve_?= =?utf-8?q?exception_message_of_IPv=7B4=2C6=7DNetwork=2E=5F=5Fgetitem=5F?= =?utf-8?q?=5F?= Message-ID: <20160611192955.99396.27948.89AF88A0@psf.io> https://hg.python.org/cpython/rev/bc758c62bc4f changeset: 101881:bc758c62bc4f user: Berker Peksag date: Sat Jun 11 22:30:05 2016 +0300 summary: Issue #20508: Improve exception message of IPv{4,6}Network.__getitem__ Patch by Gareth Rees. files: Lib/ipaddress.py | 4 ++-- Lib/test/test_ipaddress.py | 1 + Misc/NEWS | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/ipaddress.py b/Lib/ipaddress.py --- a/Lib/ipaddress.py +++ b/Lib/ipaddress.py @@ -636,12 +636,12 @@ broadcast = int(self.broadcast_address) if n >= 0: if network + n > broadcast: - raise IndexError + raise IndexError('address out of range') return self._address_class(network + n) else: n += 1 if broadcast + n < network: - raise IndexError + raise IndexError('address out of range') return self._address_class(broadcast + n) def __lt__(self, other): diff --git a/Lib/test/test_ipaddress.py b/Lib/test/test_ipaddress.py --- a/Lib/test/test_ipaddress.py +++ b/Lib/test/test_ipaddress.py @@ -1176,6 +1176,7 @@ self.assertEqual(str(self.ipv6_network[5]), '2001:658:22a:cafe::5') + self.assertRaises(IndexError, self.ipv6_network.__getitem__, 1 << 64) def testGetitem(self): # http://code.google.com/p/ipaddr-py/issues/detail?id=15 diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -38,6 +38,9 @@ Library ------- +- Issue #20508: Improve exception message of IPv{4,6}Network.__getitem__. + Patch by Gareth Rees. + - Issue #21386: Implement missing IPv4Address.is_global property. It was documented since 07a5610bae9d. Initial patch by Roger Luethi. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 15:38:48 2016 From: python-checkins at python.org (berker.peksag) Date: Sat, 11 Jun 2016 19:38:48 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogU2lsZW5jZSAnbWFr?= =?utf-8?q?e_suspicious=27_warnings?= Message-ID: <20160611193848.81161.14735.E7EBFB33@psf.io> https://hg.python.org/cpython/rev/c48a411e7aa1 changeset: 101882:c48a411e7aa1 branch: 3.5 parent: 101879:d65191861599 user: Berker Peksag date: Sat Jun 11 22:38:33 2016 +0300 summary: Silence 'make suspicious' warnings files: Doc/tools/susp-ignored.csv | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/tools/susp-ignored.csv b/Doc/tools/susp-ignored.csv --- a/Doc/tools/susp-ignored.csv +++ b/Doc/tools/susp-ignored.csv @@ -282,9 +282,9 @@ library/xml.etree.elementtree,301,:character,Sir Robin library/xml.etree.elementtree,301,:character,Gunther library/xml.etree.elementtree,301,:character,Commander Clement -library/xml.etree.elementtree,332,:actor,"for actor in root.findall('real_person:actor', ns):" -library/xml.etree.elementtree,332,:name,"name = actor.find('real_person:name', ns)" -library/xml.etree.elementtree,332,:character,"for char in actor.findall('role:character', ns):" +library/xml.etree.elementtree,,:actor,"for actor in root.findall('real_person:actor', ns):" +library/xml.etree.elementtree,,:name,"name = actor.find('real_person:name', ns)" +library/xml.etree.elementtree,,:character,"for char in actor.findall('role:character', ns):" library/zipapp,31,:main,"$ python -m zipapp myapp -m ""myapp:main""" library/zipapp,82,:fn,"argument should have the form ""pkg.mod:fn"", where ""pkg.mod"" is a" library/zipapp,155,:callable,"""pkg.module:callable"" and the archive will be run by importing" -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 15:38:48 2016 From: python-checkins at python.org (berker.peksag) Date: Sat, 11 Jun 2016 19:38:48 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5?= Message-ID: <20160611193848.28015.42539.B9C945B4@psf.io> https://hg.python.org/cpython/rev/05110cde7417 changeset: 101883:05110cde7417 parent: 101881:bc758c62bc4f parent: 101882:c48a411e7aa1 user: Berker Peksag date: Sat Jun 11 22:38:57 2016 +0300 summary: Merge from 3.5 files: Doc/tools/susp-ignored.csv | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/tools/susp-ignored.csv b/Doc/tools/susp-ignored.csv --- a/Doc/tools/susp-ignored.csv +++ b/Doc/tools/susp-ignored.csv @@ -283,9 +283,9 @@ library/xml.etree.elementtree,301,:character,Sir Robin library/xml.etree.elementtree,301,:character,Gunther library/xml.etree.elementtree,301,:character,Commander Clement -library/xml.etree.elementtree,332,:actor,"for actor in root.findall('real_person:actor', ns):" -library/xml.etree.elementtree,332,:name,"name = actor.find('real_person:name', ns)" -library/xml.etree.elementtree,332,:character,"for char in actor.findall('role:character', ns):" +library/xml.etree.elementtree,,:actor,"for actor in root.findall('real_person:actor', ns):" +library/xml.etree.elementtree,,:name,"name = actor.find('real_person:name', ns)" +library/xml.etree.elementtree,,:character,"for char in actor.findall('role:character', ns):" library/zipapp,31,:main,"$ python -m zipapp myapp -m ""myapp:main""" library/zipapp,82,:fn,"argument should have the form ""pkg.mod:fn"", where ""pkg.mod"" is a" library/zipapp,155,:callable,"""pkg.module:callable"" and the archive will be run by importing" -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 15:40:55 2016 From: python-checkins at python.org (berker.peksag) Date: Sat, 11 Jun 2016 19:40:55 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Fix_typo_and_s?= =?utf-8?q?ilence_a_Sphinx_warning_in_Doc/glossary=2Erst?= Message-ID: <20160611194053.120669.26202.0D0965BF@psf.io> https://hg.python.org/cpython/rev/0e6cd59b038c changeset: 101884:0e6cd59b038c branch: 3.5 parent: 101882:c48a411e7aa1 user: Berker Peksag date: Sat Jun 11 22:40:41 2016 +0300 summary: Fix typo and silence a Sphinx warning in Doc/glossary.rst files: Doc/glossary.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/glossary.rst b/Doc/glossary.rst --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -76,7 +76,7 @@ asynchronous iterable An object, that can be used in an :keyword:`async for` statement. - Must return an :term:`asyncronous iterator` from its + Must return an :term:`asynchronous iterator` from its :meth:`__aiter__` method. Introduced by :pep:`492`. asynchronous iterator -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 15:40:55 2016 From: python-checkins at python.org (berker.peksag) Date: Sat, 11 Jun 2016 19:40:55 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5?= Message-ID: <20160611194054.114533.22962.B9475373@psf.io> https://hg.python.org/cpython/rev/83e956f309c8 changeset: 101885:83e956f309c8 parent: 101883:05110cde7417 parent: 101884:0e6cd59b038c user: Berker Peksag date: Sat Jun 11 22:41:03 2016 +0300 summary: Merge from 3.5 files: Doc/glossary.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/glossary.rst b/Doc/glossary.rst --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -76,7 +76,7 @@ asynchronous iterable An object, that can be used in an :keyword:`async for` statement. - Must return an :term:`asyncronous iterator` from its + Must return an :term:`asynchronous iterator` from its :meth:`__aiter__` method. Introduced by :pep:`492`. asynchronous iterator -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 16:21:05 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 11 Jun 2016 20:21:05 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogbWVyZ2UgMy41?= Message-ID: <20160611202105.27883.9885.E69BDB34@psf.io> https://hg.python.org/cpython/rev/9e99a96d6ac3 changeset: 101889:9e99a96d6ac3 parent: 101885:83e956f309c8 parent: 101888:c71c6a3a8097 user: Benjamin Peterson date: Sat Jun 11 13:19:34 2016 -0700 summary: merge 3.5 files: Lib/smtplib.py | 5 +++++ Misc/NEWS | 3 +++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/Lib/smtplib.py b/Lib/smtplib.py --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -773,6 +773,11 @@ self.ehlo_resp = None self.esmtp_features = {} self.does_esmtp = 0 + else: + # RFC 3207: + # 501 Syntax error (no parameters allowed) + # 454 TLS not available due to temporary reason + raise SMTPResponseException(resp, reply) return (resp, reply) def sendmail(self, from_addr, to_addrs, msg, mail_options=[], diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -41,6 +41,9 @@ - Issue #20508: Improve exception message of IPv{4,6}Network.__getitem__. Patch by Gareth Rees. +- Fix TLS stripping vulnerability in smptlib, CVE-2016-0772. Reported by Team + Oststrom + - Issue #21386: Implement missing IPv4Address.is_global property. It was documented since 07a5610bae9d. Initial patch by Roger Luethi. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 16:21:05 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 11 Jun 2016 20:21:05 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E4=29=3A_raise_an_error?= =?utf-8?q?_when_STARTTLS_fails?= Message-ID: <20160611202105.27835.75333.76473E47@psf.io> https://hg.python.org/cpython/rev/d590114c2394 changeset: 101887:d590114c2394 branch: 3.4 parent: 101439:90e58a77d386 user: Benjamin Peterson date: Sat Jun 11 13:16:42 2016 -0700 summary: raise an error when STARTTLS fails files: Lib/smtplib.py | 5 +++++ Misc/NEWS | 3 +++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/Lib/smtplib.py b/Lib/smtplib.py --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -695,6 +695,11 @@ self.ehlo_resp = None self.esmtp_features = {} self.does_esmtp = 0 + else: + # RFC 3207: + # 501 Syntax error (no parameters allowed) + # 454 TLS not available due to temporary reason + raise SMTPResponseException(resp, reply) return (resp, reply) def sendmail(self, from_addr, to_addrs, msg, mail_options=[], diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -19,6 +19,9 @@ Library ------- +- Fix TLS stripping vulnerability in smptlib, CVE-2016-0772. Reported by Team + Oststrom + - Issue #25939: On Windows open the cert store readonly in ssl.enum_certificates. - Issue #26012: Don't traverse into symlinks for ** pattern in -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 16:21:05 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 11 Jun 2016 20:21:05 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy40IC0+IDMuNSk6?= =?utf-8?q?_merge_3=2E4?= Message-ID: <20160611202105.11521.92609.FD4C30F1@psf.io> https://hg.python.org/cpython/rev/c71c6a3a8097 changeset: 101888:c71c6a3a8097 branch: 3.5 parent: 101884:0e6cd59b038c parent: 101887:d590114c2394 user: Benjamin Peterson date: Sat Jun 11 13:18:56 2016 -0700 summary: merge 3.4 files: Lib/smtplib.py | 5 +++++ Misc/NEWS | 3 +++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/Lib/smtplib.py b/Lib/smtplib.py --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -773,6 +773,11 @@ self.ehlo_resp = None self.esmtp_features = {} self.does_esmtp = 0 + else: + # RFC 3207: + # 501 Syntax error (no parameters allowed) + # 454 TLS not available due to temporary reason + raise SMTPResponseException(resp, reply) return (resp, reply) def sendmail(self, from_addr, to_addrs, msg, mail_options=[], diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -139,6 +139,9 @@ Library ------- +- Fix TLS stripping vulnerability in smptlib, CVE-2016-0772. Reported by Team + Oststrom + - Issue #21386: Implement missing IPv4Address.is_global property. It was documented since 07a5610bae9d. Initial patch by Roger Luethi. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 16:21:06 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 11 Jun 2016 20:21:06 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_raise_an_error?= =?utf-8?q?_when_STARTTLS_fails?= Message-ID: <20160611202105.81080.75609.A4C4AF16@psf.io> https://hg.python.org/cpython/rev/b3ce713fb9be changeset: 101886:b3ce713fb9be branch: 2.7 parent: 101866:3017e41b0c99 user: Benjamin Peterson date: Sat Jun 11 13:16:42 2016 -0700 summary: raise an error when STARTTLS fails files: Lib/smtplib.py | 5 +++++ Misc/NEWS | 3 +++ 2 files changed, 8 insertions(+), 0 deletions(-) diff --git a/Lib/smtplib.py b/Lib/smtplib.py --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -656,6 +656,11 @@ self.ehlo_resp = None self.esmtp_features = {} self.does_esmtp = 0 + else: + # RFC 3207: + # 501 Syntax error (no parameters allowed) + # 454 TLS not available due to temporary reason + raise SMTPResponseException(resp, reply) return (resp, reply) def sendmail(self, from_addr, to_addrs, msg, mail_options=[], diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -92,6 +92,9 @@ Library ------- +- Fix TLS stripping vulnerability in smptlib, CVE-2016-0772. Reported by Team + Oststrom + - Issue #7356: ctypes.util: Make parsing of ldconfig output independent of the locale. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 16:26:29 2016 From: python-checkins at python.org (terry.reedy) Date: Sat, 11 Jun 2016 20:26:29 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzUxMjQ6?= =?utf-8?q?_For_2=2E7=2C_move_requires=28=27gui=27=29_from_module_level_to?= =?utf-8?q?_setUpClass=2E?= Message-ID: <20160611202629.101526.3716.5BEEBE8E@psf.io> https://hg.python.org/cpython/rev/274308a3b8b6 changeset: 101890:274308a3b8b6 branch: 2.7 parent: 101886:b3ce713fb9be user: Terry Jan Reedy date: Sat Jun 11 16:26:10 2016 -0400 summary: Issue #5124: For 2.7, move requires('gui') from module level to setUpClass. files: Lib/idlelib/idle_test/test_editmenu.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/idle_test/test_editmenu.py b/Lib/idlelib/idle_test/test_editmenu.py --- a/Lib/idlelib/idle_test/test_editmenu.py +++ b/Lib/idlelib/idle_test/test_editmenu.py @@ -3,7 +3,6 @@ Edit modules have their own test files files ''' from test.test_support import requires -requires('gui') import Tkinter as tk import unittest from idlelib import PyShell @@ -15,6 +14,7 @@ ''' @classmethod def setUpClass(cls): + requires('gui') cls.root = root = tk.Tk() PyShell.fix_x11_paste(root) cls.text = tk.Text(root) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 16:35:31 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 11 Jun 2016 20:35:31 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy40IC0+IDMuNSk6?= =?utf-8?q?_merge_3=2E4_=28=2326556=29?= Message-ID: <20160611203531.11544.77458.0890544F@psf.io> https://hg.python.org/cpython/rev/f3c36afdedae changeset: 101893:f3c36afdedae branch: 3.5 parent: 101888:c71c6a3a8097 parent: 101892:bb3ce78572f5 user: Benjamin Peterson date: Sat Jun 11 13:33:17 2016 -0700 summary: merge 3.4 (#26556) files: Misc/NEWS | 2 ++ Modules/expat/expat.h | 2 +- Modules/expat/xmlparse.c | 26 ++++++++++++++++++++++---- Modules/expat/xmltok.c | 2 +- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -139,6 +139,8 @@ Library ------- +- Issue #26556: Update expat to 2.1.1, fixes CVE-2015-1283. + - Fix TLS stripping vulnerability in smptlib, CVE-2016-0772. Reported by Team Oststrom diff --git a/Modules/expat/expat.h b/Modules/expat/expat.h --- a/Modules/expat/expat.h +++ b/Modules/expat/expat.h @@ -1040,7 +1040,7 @@ */ #define XML_MAJOR_VERSION 2 #define XML_MINOR_VERSION 1 -#define XML_MICRO_VERSION 0 +#define XML_MICRO_VERSION 1 #ifdef __cplusplus } diff --git a/Modules/expat/xmlparse.c b/Modules/expat/xmlparse.c --- a/Modules/expat/xmlparse.c +++ b/Modules/expat/xmlparse.c @@ -1550,7 +1550,7 @@ else if (bufferPtr == bufferEnd) { const char *end; int nLeftOver; - enum XML_Error result; + enum XML_Status result; parseEndByteIndex += len; positionPtr = s; ps_finalBuffer = (XML_Bool)isFinal; @@ -1678,6 +1678,10 @@ void * XMLCALL XML_GetBuffer(XML_Parser parser, int len) { + if (len < 0) { + errorCode = XML_ERROR_NO_MEMORY; + return NULL; + } switch (ps_parsing) { case XML_SUSPENDED: errorCode = XML_ERROR_SUSPENDED; @@ -1689,10 +1693,16 @@ } if (len > bufferLim - bufferEnd) { - /* FIXME avoid integer overflow */ +#ifdef XML_CONTEXT_BYTES + int keep; +#endif int neededSize = len + (int)(bufferEnd - bufferPtr); + if (neededSize < 0) { + errorCode = XML_ERROR_NO_MEMORY; + return NULL; + } #ifdef XML_CONTEXT_BYTES - int keep = (int)(bufferPtr - buffer); + keep = (int)(bufferPtr - buffer); if (keep > XML_CONTEXT_BYTES) keep = XML_CONTEXT_BYTES; @@ -1719,7 +1729,11 @@ bufferSize = INIT_BUFFER_SIZE; do { bufferSize *= 2; - } while (bufferSize < neededSize); + } while (bufferSize < neededSize && bufferSize > 0); + if (bufferSize <= 0) { + errorCode = XML_ERROR_NO_MEMORY; + return NULL; + } newBuf = (char *)MALLOC(bufferSize); if (newBuf == 0) { errorCode = XML_ERROR_NO_MEMORY; @@ -2911,6 +2925,8 @@ unsigned long uriHash = hash_secret_salt; ((XML_Char *)s)[-1] = 0; /* clear flag */ id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, s, 0); + if (!id || !id->prefix) + return XML_ERROR_NO_MEMORY; b = id->prefix->binding; if (!b) return XML_ERROR_UNBOUND_PREFIX; @@ -5475,6 +5491,8 @@ return NULL; id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&dtd->pool), sizeof(PREFIX)); + if (!id->prefix) + return NULL; if (id->prefix->name == poolStart(&dtd->pool)) poolFinish(&dtd->pool); else diff --git a/Modules/expat/xmltok.c b/Modules/expat/xmltok.c --- a/Modules/expat/xmltok.c +++ b/Modules/expat/xmltok.c @@ -1584,7 +1584,7 @@ if (ptr[0] == '\0') { /* 0 isn't a legal data character. Furthermore a document entity can only start with ASCII characters. So the only - way this can fail to be big-endian UTF-16 is if it is an + way this can fail to be big-endian UTF-16 if it it's an external parsed general entity that's labelled as UTF-16LE. */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 16:35:31 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 11 Jun 2016 20:35:31 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E4=29=3A_upgrade_expt_t?= =?utf-8?b?byAyLjEuMSAoY2xvc2VzICMyNjU1Nik=?= Message-ID: <20160611203530.20506.34118.DC2239D6@psf.io> https://hg.python.org/cpython/rev/bb3ce78572f5 changeset: 101892:bb3ce78572f5 branch: 3.4 parent: 101887:d590114c2394 user: Benjamin Peterson date: Sat Jun 11 13:28:56 2016 -0700 summary: upgrade expt to 2.1.1 (closes #26556) files: Misc/NEWS | 2 ++ Modules/expat/expat.h | 2 +- Modules/expat/xmlparse.c | 26 ++++++++++++++++++++++---- Modules/expat/xmltok.c | 2 +- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -19,6 +19,8 @@ Library ------- +- Issue #26556: Update expat to 2.1.1, fixes CVE-2015-1283. + - Fix TLS stripping vulnerability in smptlib, CVE-2016-0772. Reported by Team Oststrom diff --git a/Modules/expat/expat.h b/Modules/expat/expat.h --- a/Modules/expat/expat.h +++ b/Modules/expat/expat.h @@ -1040,7 +1040,7 @@ */ #define XML_MAJOR_VERSION 2 #define XML_MINOR_VERSION 1 -#define XML_MICRO_VERSION 0 +#define XML_MICRO_VERSION 1 #ifdef __cplusplus } diff --git a/Modules/expat/xmlparse.c b/Modules/expat/xmlparse.c --- a/Modules/expat/xmlparse.c +++ b/Modules/expat/xmlparse.c @@ -1550,7 +1550,7 @@ else if (bufferPtr == bufferEnd) { const char *end; int nLeftOver; - enum XML_Error result; + enum XML_Status result; parseEndByteIndex += len; positionPtr = s; ps_finalBuffer = (XML_Bool)isFinal; @@ -1678,6 +1678,10 @@ void * XMLCALL XML_GetBuffer(XML_Parser parser, int len) { + if (len < 0) { + errorCode = XML_ERROR_NO_MEMORY; + return NULL; + } switch (ps_parsing) { case XML_SUSPENDED: errorCode = XML_ERROR_SUSPENDED; @@ -1689,10 +1693,16 @@ } if (len > bufferLim - bufferEnd) { - /* FIXME avoid integer overflow */ +#ifdef XML_CONTEXT_BYTES + int keep; +#endif int neededSize = len + (int)(bufferEnd - bufferPtr); + if (neededSize < 0) { + errorCode = XML_ERROR_NO_MEMORY; + return NULL; + } #ifdef XML_CONTEXT_BYTES - int keep = (int)(bufferPtr - buffer); + keep = (int)(bufferPtr - buffer); if (keep > XML_CONTEXT_BYTES) keep = XML_CONTEXT_BYTES; @@ -1719,7 +1729,11 @@ bufferSize = INIT_BUFFER_SIZE; do { bufferSize *= 2; - } while (bufferSize < neededSize); + } while (bufferSize < neededSize && bufferSize > 0); + if (bufferSize <= 0) { + errorCode = XML_ERROR_NO_MEMORY; + return NULL; + } newBuf = (char *)MALLOC(bufferSize); if (newBuf == 0) { errorCode = XML_ERROR_NO_MEMORY; @@ -2911,6 +2925,8 @@ unsigned long uriHash = hash_secret_salt; ((XML_Char *)s)[-1] = 0; /* clear flag */ id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, s, 0); + if (!id || !id->prefix) + return XML_ERROR_NO_MEMORY; b = id->prefix->binding; if (!b) return XML_ERROR_UNBOUND_PREFIX; @@ -5475,6 +5491,8 @@ return NULL; id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&dtd->pool), sizeof(PREFIX)); + if (!id->prefix) + return NULL; if (id->prefix->name == poolStart(&dtd->pool)) poolFinish(&dtd->pool); else diff --git a/Modules/expat/xmltok.c b/Modules/expat/xmltok.c --- a/Modules/expat/xmltok.c +++ b/Modules/expat/xmltok.c @@ -1584,7 +1584,7 @@ if (ptr[0] == '\0') { /* 0 isn't a legal data character. Furthermore a document entity can only start with ASCII characters. So the only - way this can fail to be big-endian UTF-16 is if it is an + way this can fail to be big-endian UTF-16 if it it's an external parsed general entity that's labelled as UTF-16LE. */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 16:35:38 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 11 Jun 2016 20:35:38 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogbWVyZ2UgMy41ICgjMjY1NTYp?= Message-ID: <20160611203531.87542.48129.43B4D6FD@psf.io> https://hg.python.org/cpython/rev/77353f0106cc changeset: 101894:77353f0106cc parent: 101889:9e99a96d6ac3 parent: 101893:f3c36afdedae user: Benjamin Peterson date: Sat Jun 11 13:33:58 2016 -0700 summary: merge 3.5 (#26556) files: Misc/NEWS | 2 ++ Modules/expat/expat.h | 2 +- Modules/expat/xmlparse.c | 26 ++++++++++++++++++++++---- Modules/expat/xmltok.c | 2 +- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -41,6 +41,8 @@ - Issue #20508: Improve exception message of IPv{4,6}Network.__getitem__. Patch by Gareth Rees. +- Issue #26556: Update expat to 2.1.1, fixes CVE-2015-1283. + - Fix TLS stripping vulnerability in smptlib, CVE-2016-0772. Reported by Team Oststrom diff --git a/Modules/expat/expat.h b/Modules/expat/expat.h --- a/Modules/expat/expat.h +++ b/Modules/expat/expat.h @@ -1040,7 +1040,7 @@ */ #define XML_MAJOR_VERSION 2 #define XML_MINOR_VERSION 1 -#define XML_MICRO_VERSION 0 +#define XML_MICRO_VERSION 1 #ifdef __cplusplus } diff --git a/Modules/expat/xmlparse.c b/Modules/expat/xmlparse.c --- a/Modules/expat/xmlparse.c +++ b/Modules/expat/xmlparse.c @@ -1550,7 +1550,7 @@ else if (bufferPtr == bufferEnd) { const char *end; int nLeftOver; - enum XML_Error result; + enum XML_Status result; parseEndByteIndex += len; positionPtr = s; ps_finalBuffer = (XML_Bool)isFinal; @@ -1678,6 +1678,10 @@ void * XMLCALL XML_GetBuffer(XML_Parser parser, int len) { + if (len < 0) { + errorCode = XML_ERROR_NO_MEMORY; + return NULL; + } switch (ps_parsing) { case XML_SUSPENDED: errorCode = XML_ERROR_SUSPENDED; @@ -1689,10 +1693,16 @@ } if (len > bufferLim - bufferEnd) { - /* FIXME avoid integer overflow */ +#ifdef XML_CONTEXT_BYTES + int keep; +#endif int neededSize = len + (int)(bufferEnd - bufferPtr); + if (neededSize < 0) { + errorCode = XML_ERROR_NO_MEMORY; + return NULL; + } #ifdef XML_CONTEXT_BYTES - int keep = (int)(bufferPtr - buffer); + keep = (int)(bufferPtr - buffer); if (keep > XML_CONTEXT_BYTES) keep = XML_CONTEXT_BYTES; @@ -1719,7 +1729,11 @@ bufferSize = INIT_BUFFER_SIZE; do { bufferSize *= 2; - } while (bufferSize < neededSize); + } while (bufferSize < neededSize && bufferSize > 0); + if (bufferSize <= 0) { + errorCode = XML_ERROR_NO_MEMORY; + return NULL; + } newBuf = (char *)MALLOC(bufferSize); if (newBuf == 0) { errorCode = XML_ERROR_NO_MEMORY; @@ -2911,6 +2925,8 @@ unsigned long uriHash = hash_secret_salt; ((XML_Char *)s)[-1] = 0; /* clear flag */ id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, s, 0); + if (!id || !id->prefix) + return XML_ERROR_NO_MEMORY; b = id->prefix->binding; if (!b) return XML_ERROR_UNBOUND_PREFIX; @@ -5475,6 +5491,8 @@ return NULL; id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&dtd->pool), sizeof(PREFIX)); + if (!id->prefix) + return NULL; if (id->prefix->name == poolStart(&dtd->pool)) poolFinish(&dtd->pool); else diff --git a/Modules/expat/xmltok.c b/Modules/expat/xmltok.c --- a/Modules/expat/xmltok.c +++ b/Modules/expat/xmltok.c @@ -1584,7 +1584,7 @@ if (ptr[0] == '\0') { /* 0 isn't a legal data character. Furthermore a document entity can only start with ASCII characters. So the only - way this can fail to be big-endian UTF-16 is if it is an + way this can fail to be big-endian UTF-16 if it it's an external parsed general entity that's labelled as UTF-16LE. */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 16:35:39 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 11 Jun 2016 20:35:39 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_upgrade_expt_t?= =?utf-8?b?byAyLjEuMSAoY2xvc2VzICMyNjU1Nik=?= Message-ID: <20160611203530.81080.31029.B8223EC0@psf.io> https://hg.python.org/cpython/rev/d8a0a016d8d4 changeset: 101891:d8a0a016d8d4 branch: 2.7 user: Benjamin Peterson date: Sat Jun 11 13:28:56 2016 -0700 summary: upgrade expt to 2.1.1 (closes #26556) files: Misc/NEWS | 2 ++ Modules/expat/expat.h | 2 +- Modules/expat/xmlparse.c | 26 ++++++++++++++++++++++---- Modules/expat/xmltok.c | 2 +- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -92,6 +92,8 @@ Library ------- +- Issue #26556: Update expat to 2.1.1, fixes CVE-2015-1283. + - Fix TLS stripping vulnerability in smptlib, CVE-2016-0772. Reported by Team Oststrom diff --git a/Modules/expat/expat.h b/Modules/expat/expat.h --- a/Modules/expat/expat.h +++ b/Modules/expat/expat.h @@ -1040,7 +1040,7 @@ */ #define XML_MAJOR_VERSION 2 #define XML_MINOR_VERSION 1 -#define XML_MICRO_VERSION 0 +#define XML_MICRO_VERSION 1 #ifdef __cplusplus } diff --git a/Modules/expat/xmlparse.c b/Modules/expat/xmlparse.c --- a/Modules/expat/xmlparse.c +++ b/Modules/expat/xmlparse.c @@ -1550,7 +1550,7 @@ else if (bufferPtr == bufferEnd) { const char *end; int nLeftOver; - enum XML_Error result; + enum XML_Status result; parseEndByteIndex += len; positionPtr = s; ps_finalBuffer = (XML_Bool)isFinal; @@ -1678,6 +1678,10 @@ void * XMLCALL XML_GetBuffer(XML_Parser parser, int len) { + if (len < 0) { + errorCode = XML_ERROR_NO_MEMORY; + return NULL; + } switch (ps_parsing) { case XML_SUSPENDED: errorCode = XML_ERROR_SUSPENDED; @@ -1689,10 +1693,16 @@ } if (len > bufferLim - bufferEnd) { - /* FIXME avoid integer overflow */ +#ifdef XML_CONTEXT_BYTES + int keep; +#endif int neededSize = len + (int)(bufferEnd - bufferPtr); + if (neededSize < 0) { + errorCode = XML_ERROR_NO_MEMORY; + return NULL; + } #ifdef XML_CONTEXT_BYTES - int keep = (int)(bufferPtr - buffer); + keep = (int)(bufferPtr - buffer); if (keep > XML_CONTEXT_BYTES) keep = XML_CONTEXT_BYTES; @@ -1719,7 +1729,11 @@ bufferSize = INIT_BUFFER_SIZE; do { bufferSize *= 2; - } while (bufferSize < neededSize); + } while (bufferSize < neededSize && bufferSize > 0); + if (bufferSize <= 0) { + errorCode = XML_ERROR_NO_MEMORY; + return NULL; + } newBuf = (char *)MALLOC(bufferSize); if (newBuf == 0) { errorCode = XML_ERROR_NO_MEMORY; @@ -2911,6 +2925,8 @@ unsigned long uriHash = hash_secret_salt; ((XML_Char *)s)[-1] = 0; /* clear flag */ id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, s, 0); + if (!id || !id->prefix) + return XML_ERROR_NO_MEMORY; b = id->prefix->binding; if (!b) return XML_ERROR_UNBOUND_PREFIX; @@ -5475,6 +5491,8 @@ return NULL; id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&dtd->pool), sizeof(PREFIX)); + if (!id->prefix) + return NULL; if (id->prefix->name == poolStart(&dtd->pool)) poolFinish(&dtd->pool); else diff --git a/Modules/expat/xmltok.c b/Modules/expat/xmltok.c --- a/Modules/expat/xmltok.c +++ b/Modules/expat/xmltok.c @@ -1584,7 +1584,7 @@ if (ptr[0] == '\0') { /* 0 isn't a legal data character. Furthermore a document entity can only start with ASCII characters. So the only - way this can fail to be big-endian UTF-16 is if it is an + way this can fail to be big-endian UTF-16 if it it's an external parsed general entity that's labelled as UTF-16LE. */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 17:20:31 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 11 Jun 2016 21:20:31 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327294=3A_Improved?= =?utf-8?q?_repr_for_Tkinter_event_objects=2E?= Message-ID: <20160611212030.120747.55451.886565A8@psf.io> https://hg.python.org/cpython/rev/61a92a102b2d changeset: 101895:61a92a102b2d user: Serhiy Storchaka date: Sun Jun 12 00:19:44 2016 +0300 summary: Issue #27294: Improved repr for Tkinter event objects. files: Lib/tkinter/__init__.py | 75 ++++++++++++++++++++++++++++- Misc/NEWS | 2 + 2 files changed, 75 insertions(+), 2 deletions(-) diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -30,6 +30,7 @@ tk.mainloop() """ +import enum import sys import _tkinter # If this fails your Python may not be configured for Tk @@ -132,6 +133,50 @@ dict[key] = value return dict + +class EventType(str, enum.Enum): + KeyPress = '2' + Key = KeyPress, + KeyRelease = '3' + ButtonPress = '4' + Button = ButtonPress, + ButtonRelease = '5' + Motion = '6' + Enter = '7' + Leave = '8' + FocusIn = '9' + FocusOut = '10' + Keymap = '11' # undocumented + Expose = '12' + GraphicsExpose = '13' # undocumented + NoExpose = '14' # undocumented + Visibility = '15' + Create = '16' + Destroy = '17' + Unmap = '18' + Map = '19' + MapRequest = '20' + Reparent = '21' + Configure = '22' + ConfigureRequest = '23' + Gravity = '24' + ResizeRequest = '25' + Circulate = '26' + CirculateRequest = '27' + Property = '28' + SelectionClear = '29' # undocumented + SelectionRequest = '30' # undocumented + Selection = '31' # undocumented + Colormap = '32' + ClientMessage = '33' # undocumented + Mapping = '34' # undocumented + VirtualEvent = '35', # undocumented + Activate = '36', + Deactivate = '37', + MouseWheel = '38', + def __str__(self): + return self.name + class Event: """Container for the properties of an event. @@ -174,7 +219,30 @@ widget - widget in which the event occurred delta - delta of wheel movement (MouseWheel) """ - pass + def __repr__(self): + state = {k: v for k, v in self.__dict__.items() if v != '??'} + if not self.char: + del state['char'] + elif self.char != '??': + state['char'] = repr(self.char) + if not getattr(self, 'send_event', True): + del state['send_event'] + if self.state == 0: + del state['state'] + if self.delta == 0: + del state['delta'] + # widget usually is known + # serial and time are not very interesing + # keysym_num duplicates keysym + # x_root and y_root mostly duplicate x and y + keys = ('send_event', + 'state', 'keycode', 'char', 'keysym', + 'num', 'delta', 'focus', + 'x', 'y', 'width', 'height') + return '<%s event%s>' % ( + self.type, + ''.join(' %s=%s' % (k, state[k]) for k in keys if k in state) + ) _support_default_root = 1 _default_root = None @@ -1271,7 +1339,10 @@ except TclError: pass e.keysym = K e.keysym_num = getint_event(N) - e.type = T + try: + e.type = EventType(T) + except ValueError: + e.type = T try: e.widget = self._nametowidget(W) except KeyError: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -38,6 +38,8 @@ Library ------- +- Issue #27294: Improved repr for Tkinter event objects. + - Issue #20508: Improve exception message of IPv{4,6}Network.__getitem__. Patch by Gareth Rees. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 17:40:34 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 11 Jun 2016 21:40:34 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327140=3A_Added_BU?= =?utf-8?q?ILD=5FCONST=5FKEY=5FMAP_opcode=2E?= Message-ID: <20160611214033.26107.47033.EEC60D8A@psf.io> https://hg.python.org/cpython/rev/27b0dbaf0ea8 changeset: 101896:27b0dbaf0ea8 user: Serhiy Storchaka date: Sun Jun 12 00:39:41 2016 +0300 summary: Issue #27140: Added BUILD_CONST_KEY_MAP opcode. files: Doc/library/dis.rst | 9 + Include/opcode.h | 1 + Lib/importlib/_bootstrap_external.py | 3 +- Lib/opcode.py | 1 + Misc/NEWS | 2 + PC/launcher.c | 2 +- Python/ceval.c | 33 + Python/compile.c | 185 +- Python/importlib_external.h | 2322 +++++++------- Python/opcode_targets.h | 2 +- 10 files changed, 1367 insertions(+), 1193 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -768,6 +768,15 @@ to hold *count* entries. +.. opcode:: BUILD_CONST_KEY_MAP (count) + + The version of :opcode:`BUILD_MAP` specialized for constant keys. *count* + values are consumed from the stack. The top element on the stack contains + a tuple of keys. + + .. versionadded:: 3.6 + + .. opcode:: LOAD_ATTR (namei) Replaces TOS with ``getattr(TOS, co_names[namei])``. diff --git a/Include/opcode.h b/Include/opcode.h --- a/Include/opcode.h +++ b/Include/opcode.h @@ -123,6 +123,7 @@ #define BUILD_SET_UNPACK 153 #define SETUP_ASYNC_WITH 154 #define FORMAT_VALUE 155 +#define BUILD_CONST_KEY_MAP 156 /* EXCEPT_HANDLER is a special, implicit block type which is created when entering an except handler. It is not an opcode but we define it here diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -226,6 +226,7 @@ # Python 3.6a0 3360 (add FORMAT_VALUE opcode #25483 # Python 3.6a0 3361 (lineno delta of code.co_lnotab becomes signed) # Python 3.6a0 3370 (16 bit wordcode) +# Python 3.6a0 3371 (add BUILD_CONST_KEY_MAP opcode #27140) # # MAGIC must change whenever the bytecode emitted by the compiler may no # longer be understood by older implementations of the eval loop (usually @@ -234,7 +235,7 @@ # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3370).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3371).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/opcode.py b/Lib/opcode.py --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -213,5 +213,6 @@ def_op('BUILD_SET_UNPACK', 153) def_op('FORMAT_VALUE', 155) +def_op('BUILD_CONST_KEY_MAP', 156) del def_op, name_op, jrel_op, jabs_op diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #27140: Added BUILD_CONST_KEY_MAP opcode. + - Issue #27186: Add support for os.PathLike objects to open() (part of PEP 519). - Issue #27066: Fixed SystemError if a custom opener (for open()) returns a diff --git a/PC/launcher.c b/PC/launcher.c --- a/PC/launcher.c +++ b/PC/launcher.c @@ -1089,7 +1089,7 @@ { 3190, 3230, L"3.3" }, { 3250, 3310, L"3.4" }, { 3320, 3350, L"3.5" }, - { 3360, 3370, L"3.6" }, + { 3360, 3371, L"3.6" }, { 0 } }; diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2647,6 +2647,39 @@ DISPATCH(); } + TARGET(BUILD_CONST_KEY_MAP) { + int i; + PyObject *map; + PyObject *keys = TOP(); + if (!PyTuple_CheckExact(keys) || + PyTuple_GET_SIZE(keys) != (Py_ssize_t)oparg) { + PyErr_SetString(PyExc_SystemError, + "bad BUILD_CONST_KEY_MAP keys argument"); + goto error; + } + map = _PyDict_NewPresized((Py_ssize_t)oparg); + if (map == NULL) { + goto error; + } + for (i = oparg; i > 0; i--) { + int err; + PyObject *key = PyTuple_GET_ITEM(keys, oparg - i); + PyObject *value = PEEK(i + 1); + err = PyDict_SetItem(map, key, value); + if (err != 0) { + Py_DECREF(map); + goto error; + } + } + + Py_DECREF(POP()); + while (oparg--) { + Py_DECREF(POP()); + } + PUSH(map); + DISPATCH(); + } + TARGET(BUILD_MAP_UNPACK_WITH_CALL) TARGET(BUILD_MAP_UNPACK) { int with_call = opcode == BUILD_MAP_UNPACK_WITH_CALL; diff --git a/Python/compile.c b/Python/compile.c --- a/Python/compile.c +++ b/Python/compile.c @@ -980,6 +980,8 @@ return 1 - (oparg & 0xFF); case BUILD_MAP: return 1 - 2*oparg; + case BUILD_CONST_KEY_MAP: + return -oparg; case LOAD_ATTR: return 0; case COMPARE_OP: @@ -1234,6 +1236,15 @@ return 0; \ } +/* Same as ADDOP_O, but steals a reference. */ +#define ADDOP_N(C, OP, O, TYPE) { \ + if (!compiler_addop_o((C), (OP), (C)->u->u_ ## TYPE, (O))) { \ + Py_DECREF((O)); \ + return 0; \ + } \ + Py_DECREF((O)); \ +} + #define ADDOP_NAME(C, OP, O, TYPE) { \ if (!compiler_addop_name((C), (OP), (C)->u->u_ ## TYPE, (O))) \ return 0; \ @@ -1309,6 +1320,44 @@ return 0; } +static int +is_const(expr_ty e) +{ + switch (e->kind) { + case Constant_kind: + case Num_kind: + case Str_kind: + case Bytes_kind: + case Ellipsis_kind: + case NameConstant_kind: + return 1; + default: + return 0; + } +} + +static PyObject * +get_const_value(expr_ty e) +{ + switch (e->kind) { + case Constant_kind: + return e->v.Constant.value; + case Num_kind: + return e->v.Num.n; + case Str_kind: + return e->v.Str.s; + case Bytes_kind: + return e->v.Bytes.s; + case Ellipsis_kind: + return Py_Ellipsis; + case NameConstant_kind: + return e->v.NameConstant.value; + default: + assert(!is_const(e)); + return NULL; + } +} + /* Compile a sequence of statements, checking for a docstring. */ static int @@ -2604,19 +2653,9 @@ return 1; } - switch (value->kind) - { - case Str_kind: - case Num_kind: - case Ellipsis_kind: - case Bytes_kind: - case NameConstant_kind: - case Constant_kind: + if (is_const(value)) { /* ignore constant statement */ return 1; - - default: - break; } VISIT(c, expr, value); @@ -3096,6 +3135,49 @@ } static int +are_all_items_const(asdl_seq *seq, Py_ssize_t begin, Py_ssize_t end) +{ + Py_ssize_t i; + for (i = begin; i < end; i++) { + expr_ty key = (expr_ty)asdl_seq_GET(seq, i); + if (key == NULL || !is_const(key)) + return 0; + } + return 1; +} + +static int +compiler_subdict(struct compiler *c, expr_ty e, Py_ssize_t begin, Py_ssize_t end) +{ + Py_ssize_t i, n = end - begin; + PyObject *keys, *key; + if (n > 1 && are_all_items_const(e->v.Dict.keys, begin, end)) { + for (i = begin; i < end; i++) { + VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Dict.values, i)); + } + keys = PyTuple_New(n); + if (keys == NULL) { + return 0; + } + for (i = begin; i < end; i++) { + key = get_const_value((expr_ty)asdl_seq_GET(e->v.Dict.keys, i)); + Py_INCREF(key); + PyTuple_SET_ITEM(keys, i - begin, key); + } + ADDOP_N(c, LOAD_CONST, keys, consts); + ADDOP_I(c, BUILD_CONST_KEY_MAP, n); + } + else { + for (i = begin; i < end; i++) { + VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Dict.keys, i)); + VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Dict.values, i)); + } + ADDOP_I(c, BUILD_MAP, n); + } + return 1; +} + +static int compiler_dict(struct compiler *c, expr_ty e) { Py_ssize_t i, n, elements; @@ -3107,7 +3189,8 @@ for (i = 0; i < n; i++) { is_unpacking = (expr_ty)asdl_seq_GET(e->v.Dict.keys, i) == NULL; if (elements == 0xFFFF || (elements && is_unpacking)) { - ADDOP_I(c, BUILD_MAP, elements); + if (!compiler_subdict(c, e, i - elements, i)) + return 0; containers++; elements = 0; } @@ -3116,13 +3199,12 @@ containers++; } else { - VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Dict.keys, i)); - VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Dict.values, i)); elements++; } } if (elements || containers == 0) { - ADDOP_I(c, BUILD_MAP, elements); + if (!compiler_subdict(c, e, n - elements, n)) + return 0; containers++; } /* If there is more than one dict, they need to be merged into a new @@ -3266,6 +3348,42 @@ return 1; } +static int +compiler_subkwargs(struct compiler *c, asdl_seq *keywords, Py_ssize_t begin, Py_ssize_t end) +{ + Py_ssize_t i, n = end - begin; + keyword_ty kw; + PyObject *keys, *key; + assert(n > 0); + if (n > 1) { + for (i = begin; i < end; i++) { + kw = asdl_seq_GET(keywords, i); + VISIT(c, expr, kw->value); + } + keys = PyTuple_New(n); + if (keys == NULL) { + return 0; + } + for (i = begin; i < end; i++) { + key = ((keyword_ty) asdl_seq_GET(keywords, i))->arg; + Py_INCREF(key); + PyTuple_SET_ITEM(keys, i - begin, key); + } + ADDOP_N(c, LOAD_CONST, keys, consts); + ADDOP_I(c, BUILD_CONST_KEY_MAP, n); + } + else { + /* a for loop only executes once */ + for (i = begin; i < end; i++) { + kw = asdl_seq_GET(keywords, i); + ADDOP_O(c, LOAD_CONST, kw->arg, consts); + VISIT(c, expr, kw->value); + } + ADDOP_I(c, BUILD_MAP, n); + } + return 1; +} + /* shared code between compiler_call and compiler_class */ static int compiler_call_helper(struct compiler *c, @@ -3332,29 +3450,38 @@ if (kw->arg == NULL) { /* A keyword argument unpacking. */ if (nseen) { - ADDOP_I(c, BUILD_MAP, nseen); + if (nsubkwargs) { + if (!compiler_subkwargs(c, keywords, i - nseen, i)) + return 0; + nsubkwargs++; + } + else { + Py_ssize_t j; + for (j = 0; j < nseen; j++) { + VISIT(c, keyword, asdl_seq_GET(keywords, j)); + } + nkw = nseen; + } nseen = 0; - nsubkwargs++; } VISIT(c, expr, kw->value); nsubkwargs++; } - else if (nsubkwargs) { - /* A keyword argument and we already have a dict. */ - ADDOP_O(c, LOAD_CONST, kw->arg, consts); - VISIT(c, expr, kw->value); + else { nseen++; } - else { - /* keyword argument */ - VISIT(c, keyword, kw) - nkw++; - } } if (nseen) { - /* Pack up any trailing keyword arguments. */ - ADDOP_I(c, BUILD_MAP, nseen); - nsubkwargs++; + if (nsubkwargs) { + /* Pack up any trailing keyword arguments. */ + if (!compiler_subkwargs(c, keywords, nelts - nseen, nelts)) + return 0; + nsubkwargs++; + } + else { + VISIT_SEQ(c, keyword, keywords); + nkw = nseen; + } } if (nsubkwargs) { code |= 2; diff --git a/Python/importlib_external.h b/Python/importlib_external.h --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -236,7 +236,7 @@ 0,0,218,13,95,119,114,105,116,101,95,97,116,111,109,105, 99,99,0,0,0,115,26,0,0,0,0,5,16,1,6,1, 26,1,2,3,14,1,20,1,16,1,14,1,2,1,14,1, - 14,1,6,1,114,55,0,0,0,105,42,13,0,0,233,2, + 14,1,6,1,114,55,0,0,0,105,43,13,0,0,233,2, 0,0,0,114,13,0,0,0,115,2,0,0,0,13,10,90, 11,95,95,112,121,99,97,99,104,101,95,95,122,4,111,112, 116,45,122,3,46,112,121,122,4,46,112,121,99,78,218,12, @@ -339,7 +339,7 @@ 103,90,15,97,108,109,111,115,116,95,102,105,108,101,110,97, 109,101,114,4,0,0,0,114,4,0,0,0,114,5,0,0, 0,218,17,99,97,99,104,101,95,102,114,111,109,95,115,111, - 117,114,99,101,249,0,0,0,115,46,0,0,0,0,18,8, + 117,114,99,101,250,0,0,0,115,46,0,0,0,0,18,8, 1,6,1,6,1,8,1,4,1,8,1,12,1,12,1,16, 1,8,1,8,1,8,1,24,1,8,1,12,1,6,2,8, 1,8,1,8,1,8,1,14,1,14,1,114,79,0,0,0, @@ -412,7 +412,7 @@ 101,108,90,13,98,97,115,101,95,102,105,108,101,110,97,109, 101,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, 218,17,115,111,117,114,99,101,95,102,114,111,109,95,99,97, - 99,104,101,37,1,0,0,115,44,0,0,0,0,9,12,1, + 99,104,101,38,1,0,0,115,44,0,0,0,0,9,12,1, 8,1,12,1,12,1,8,1,6,1,10,1,10,1,8,1, 6,1,10,1,8,1,16,1,10,1,6,1,8,1,16,1, 8,1,6,1,8,1,14,1,114,85,0,0,0,99,1,0, @@ -447,7 +447,7 @@ 0,90,9,101,120,116,101,110,115,105,111,110,218,11,115,111, 117,114,99,101,95,112,97,116,104,114,4,0,0,0,114,4, 0,0,0,114,5,0,0,0,218,15,95,103,101,116,95,115, - 111,117,114,99,101,102,105,108,101,70,1,0,0,115,20,0, + 111,117,114,99,101,102,105,108,101,71,1,0,0,115,20,0, 0,0,0,7,12,1,4,1,16,1,26,1,4,1,2,1, 12,1,18,1,18,1,114,91,0,0,0,99,1,0,0,0, 0,0,0,0,1,0,0,0,11,0,0,0,67,0,0,0, @@ -461,7 +461,7 @@ 66,0,0,0,114,74,0,0,0,41,1,218,8,102,105,108, 101,110,97,109,101,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,11,95,103,101,116,95,99,97,99,104,101, - 100,89,1,0,0,115,16,0,0,0,0,1,14,1,2,1, + 100,90,1,0,0,115,16,0,0,0,0,1,14,1,2,1, 8,1,14,1,8,1,14,1,6,2,114,95,0,0,0,99, 1,0,0,0,0,0,0,0,2,0,0,0,11,0,0,0, 67,0,0,0,115,52,0,0,0,121,14,116,0,124,0,131, @@ -475,7 +475,7 @@ 114,39,0,0,0,114,41,0,0,0,114,40,0,0,0,41, 2,114,35,0,0,0,114,42,0,0,0,114,4,0,0,0, 114,4,0,0,0,114,5,0,0,0,218,10,95,99,97,108, - 99,95,109,111,100,101,101,1,0,0,115,12,0,0,0,0, + 99,95,109,111,100,101,102,1,0,0,115,12,0,0,0,0, 2,2,1,14,1,14,1,10,3,8,1,114,97,0,0,0, 99,1,0,0,0,0,0,0,0,3,0,0,0,11,0,0, 0,3,0,0,0,115,68,0,0,0,100,1,135,0,102,1, @@ -512,7 +512,7 @@ 0,0,0,218,4,97,114,103,115,90,6,107,119,97,114,103, 115,41,1,218,6,109,101,116,104,111,100,114,4,0,0,0, 114,5,0,0,0,218,19,95,99,104,101,99,107,95,110,97, - 109,101,95,119,114,97,112,112,101,114,121,1,0,0,115,12, + 109,101,95,119,114,97,112,112,101,114,122,1,0,0,115,12, 0,0,0,0,1,8,1,8,1,10,1,4,1,20,1,122, 40,95,99,104,101,99,107,95,110,97,109,101,46,60,108,111, 99,97,108,115,62,46,95,99,104,101,99,107,95,110,97,109, @@ -533,14 +533,14 @@ 105,99,116,95,95,218,6,117,112,100,97,116,101,41,3,90, 3,110,101,119,90,3,111,108,100,114,52,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,218,5,95, - 119,114,97,112,132,1,0,0,115,8,0,0,0,0,1,10, + 119,114,97,112,133,1,0,0,115,8,0,0,0,0,1,10, 1,10,1,22,1,122,26,95,99,104,101,99,107,95,110,97, 109,101,46,60,108,111,99,97,108,115,62,46,95,119,114,97, 112,41,3,218,10,95,98,111,111,116,115,116,114,97,112,114, 113,0,0,0,218,9,78,97,109,101,69,114,114,111,114,41, 3,114,102,0,0,0,114,103,0,0,0,114,113,0,0,0, 114,4,0,0,0,41,1,114,102,0,0,0,114,5,0,0, - 0,218,11,95,99,104,101,99,107,95,110,97,109,101,113,1, + 0,218,11,95,99,104,101,99,107,95,110,97,109,101,114,1, 0,0,115,14,0,0,0,0,8,14,7,2,1,10,1,14, 2,14,5,10,1,114,116,0,0,0,99,2,0,0,0,0, 0,0,0,5,0,0,0,4,0,0,0,67,0,0,0,115, @@ -568,7 +568,7 @@ 108,108,110,97,109,101,218,6,108,111,97,100,101,114,218,8, 112,111,114,116,105,111,110,115,218,3,109,115,103,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,218,17,95,102, - 105,110,100,95,109,111,100,117,108,101,95,115,104,105,109,141, + 105,110,100,95,109,111,100,117,108,101,95,115,104,105,109,142, 1,0,0,115,10,0,0,0,0,10,14,1,16,1,4,1, 22,1,114,123,0,0,0,99,4,0,0,0,0,0,0,0, 11,0,0,0,19,0,0,0,67,0,0,0,115,128,1,0, @@ -648,7 +648,7 @@ 109,101,218,11,115,111,117,114,99,101,95,115,105,122,101,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,25, 95,118,97,108,105,100,97,116,101,95,98,121,116,101,99,111, - 100,101,95,104,101,97,100,101,114,158,1,0,0,115,76,0, + 100,101,95,104,101,97,100,101,114,159,1,0,0,115,76,0, 0,0,0,11,4,1,8,1,10,3,4,1,8,1,8,1, 12,1,12,1,12,1,8,1,12,1,12,1,12,1,12,1, 10,1,12,1,10,1,12,1,10,1,12,1,8,1,10,1, @@ -678,7 +678,7 @@ 114,89,0,0,0,114,90,0,0,0,218,4,99,111,100,101, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218, 17,95,99,111,109,112,105,108,101,95,98,121,116,101,99,111, - 100,101,213,1,0,0,115,16,0,0,0,0,2,10,1,10, + 100,101,214,1,0,0,115,16,0,0,0,0,2,10,1,10, 1,12,1,8,1,12,1,6,2,12,1,114,141,0,0,0, 114,59,0,0,0,99,3,0,0,0,0,0,0,0,4,0, 0,0,3,0,0,0,67,0,0,0,115,56,0,0,0,116, @@ -696,7 +696,7 @@ 5,100,117,109,112,115,41,4,114,140,0,0,0,114,126,0, 0,0,114,134,0,0,0,114,53,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,218,17,95,99,111, - 100,101,95,116,111,95,98,121,116,101,99,111,100,101,225,1, + 100,101,95,116,111,95,98,121,116,101,99,111,100,101,226,1, 0,0,115,10,0,0,0,0,3,8,1,14,1,14,1,16, 1,114,144,0,0,0,99,1,0,0,0,0,0,0,0,5, 0,0,0,4,0,0,0,67,0,0,0,115,62,0,0,0, @@ -723,7 +723,7 @@ 97,100,108,105,110,101,218,8,101,110,99,111,100,105,110,103, 90,15,110,101,119,108,105,110,101,95,100,101,99,111,100,101, 114,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 218,13,100,101,99,111,100,101,95,115,111,117,114,99,101,235, + 218,13,100,101,99,111,100,101,95,115,111,117,114,99,101,236, 1,0,0,115,10,0,0,0,0,5,8,1,12,1,10,1, 12,1,114,149,0,0,0,114,120,0,0,0,218,26,115,117, 98,109,111,100,117,108,101,95,115,101,97,114,99,104,95,108, @@ -784,7 +784,7 @@ 7,100,105,114,110,97,109,101,114,4,0,0,0,114,4,0, 0,0,114,5,0,0,0,218,23,115,112,101,99,95,102,114, 111,109,95,102,105,108,101,95,108,111,99,97,116,105,111,110, - 252,1,0,0,115,60,0,0,0,0,12,8,4,4,1,10, + 253,1,0,0,115,60,0,0,0,0,12,8,4,4,1,10, 2,2,1,14,1,14,1,6,8,18,1,6,3,8,1,16, 1,14,1,10,1,6,1,6,2,4,3,8,2,10,1,2, 1,14,1,14,1,6,2,4,1,8,2,6,1,12,1,6, @@ -820,7 +820,7 @@ 89,95,76,79,67,65,76,95,77,65,67,72,73,78,69,41, 2,218,3,99,108,115,218,3,107,101,121,114,4,0,0,0, 114,4,0,0,0,114,5,0,0,0,218,14,95,111,112,101, - 110,95,114,101,103,105,115,116,114,121,74,2,0,0,115,8, + 110,95,114,101,103,105,115,116,114,121,75,2,0,0,115,8, 0,0,0,0,2,2,1,14,1,14,1,122,36,87,105,110, 100,111,119,115,82,101,103,105,115,116,114,121,70,105,110,100, 101,114,46,95,111,112,101,110,95,114,101,103,105,115,116,114, @@ -846,7 +846,7 @@ 107,101,121,114,165,0,0,0,90,4,104,107,101,121,218,8, 102,105,108,101,112,97,116,104,114,4,0,0,0,114,4,0, 0,0,114,5,0,0,0,218,16,95,115,101,97,114,99,104, - 95,114,101,103,105,115,116,114,121,81,2,0,0,115,22,0, + 95,114,101,103,105,115,116,114,121,82,2,0,0,115,22,0, 0,0,0,2,6,1,8,2,6,1,10,1,22,1,2,1, 12,1,26,1,14,1,6,1,122,38,87,105,110,100,111,119, 115,82,101,103,105,115,116,114,121,70,105,110,100,101,114,46, @@ -868,7 +868,7 @@ 114,35,0,0,0,218,6,116,97,114,103,101,116,114,171,0, 0,0,114,120,0,0,0,114,160,0,0,0,114,158,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 218,9,102,105,110,100,95,115,112,101,99,96,2,0,0,115, + 218,9,102,105,110,100,95,115,112,101,99,97,2,0,0,115, 26,0,0,0,0,2,10,1,8,1,4,1,2,1,12,1, 14,1,6,1,16,1,14,1,6,1,10,1,8,1,122,31, 87,105,110,100,111,119,115,82,101,103,105,115,116,114,121,70, @@ -887,7 +887,7 @@ 114,175,0,0,0,114,120,0,0,0,41,4,114,164,0,0, 0,114,119,0,0,0,114,35,0,0,0,114,158,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218, - 11,102,105,110,100,95,109,111,100,117,108,101,112,2,0,0, + 11,102,105,110,100,95,109,111,100,117,108,101,113,2,0,0, 115,8,0,0,0,0,7,12,1,8,1,8,2,122,33,87, 105,110,100,111,119,115,82,101,103,105,115,116,114,121,70,105, 110,100,101,114,46,102,105,110,100,95,109,111,100,117,108,101, @@ -896,7 +896,7 @@ 114,167,0,0,0,218,11,99,108,97,115,115,109,101,116,104, 111,100,114,166,0,0,0,114,172,0,0,0,114,175,0,0, 0,114,176,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,162,0,0,0,62, + 114,4,0,0,0,114,5,0,0,0,114,162,0,0,0,63, 2,0,0,115,20,0,0,0,8,2,4,3,4,3,4,2, 4,2,12,7,12,15,2,1,14,15,2,1,114,162,0,0, 0,99,0,0,0,0,0,0,0,0,0,0,0,0,2,0, @@ -931,7 +931,7 @@ 41,5,114,100,0,0,0,114,119,0,0,0,114,94,0,0, 0,90,13,102,105,108,101,110,97,109,101,95,98,97,115,101, 90,9,116,97,105,108,95,110,97,109,101,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,153,0,0,0,131, + 114,4,0,0,0,114,5,0,0,0,114,153,0,0,0,132, 2,0,0,115,8,0,0,0,0,3,18,1,16,1,14,1, 122,24,95,76,111,97,100,101,114,66,97,115,105,99,115,46, 105,115,95,112,97,99,107,97,103,101,99,2,0,0,0,0, @@ -942,7 +942,7 @@ 97,116,105,111,110,46,78,114,4,0,0,0,41,2,114,100, 0,0,0,114,158,0,0,0,114,4,0,0,0,114,4,0, 0,0,114,5,0,0,0,218,13,99,114,101,97,116,101,95, - 109,111,100,117,108,101,139,2,0,0,115,0,0,0,0,122, + 109,111,100,117,108,101,140,2,0,0,115,0,0,0,0,122, 27,95,76,111,97,100,101,114,66,97,115,105,99,115,46,99, 114,101,97,116,101,95,109,111,100,117,108,101,99,2,0,0, 0,0,0,0,0,3,0,0,0,4,0,0,0,67,0,0, @@ -962,7 +962,7 @@ 0,0,41,3,114,100,0,0,0,218,6,109,111,100,117,108, 101,114,140,0,0,0,114,4,0,0,0,114,4,0,0,0, 114,5,0,0,0,218,11,101,120,101,99,95,109,111,100,117, - 108,101,142,2,0,0,115,10,0,0,0,0,2,12,1,8, + 108,101,143,2,0,0,115,10,0,0,0,0,2,12,1,8, 1,6,1,10,1,122,25,95,76,111,97,100,101,114,66,97, 115,105,99,115,46,101,120,101,99,95,109,111,100,117,108,101, 99,2,0,0,0,0,0,0,0,2,0,0,0,3,0,0, @@ -973,14 +973,14 @@ 97,100,95,109,111,100,117,108,101,95,115,104,105,109,41,2, 114,100,0,0,0,114,119,0,0,0,114,4,0,0,0,114, 4,0,0,0,114,5,0,0,0,218,11,108,111,97,100,95, - 109,111,100,117,108,101,150,2,0,0,115,2,0,0,0,0, + 109,111,100,117,108,101,151,2,0,0,115,2,0,0,0,0, 2,122,25,95,76,111,97,100,101,114,66,97,115,105,99,115, 46,108,111,97,100,95,109,111,100,117,108,101,78,41,8,114, 105,0,0,0,114,104,0,0,0,114,106,0,0,0,114,107, 0,0,0,114,153,0,0,0,114,180,0,0,0,114,185,0, 0,0,114,187,0,0,0,114,4,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,114,178,0,0,0, - 126,2,0,0,115,10,0,0,0,8,3,4,2,8,8,8, + 127,2,0,0,115,10,0,0,0,8,3,4,2,8,8,8, 3,8,8,114,178,0,0,0,99,0,0,0,0,0,0,0, 0,0,0,0,0,4,0,0,0,64,0,0,0,115,74,0, 0,0,101,0,90,1,100,0,90,2,100,1,100,2,132,0, @@ -1005,7 +1005,7 @@ 32,32,32,32,78,41,1,218,7,73,79,69,114,114,111,114, 41,2,114,100,0,0,0,114,35,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,218,10,112,97,116, - 104,95,109,116,105,109,101,157,2,0,0,115,2,0,0,0, + 104,95,109,116,105,109,101,158,2,0,0,115,2,0,0,0, 0,6,122,23,83,111,117,114,99,101,76,111,97,100,101,114, 46,112,97,116,104,95,109,116,105,109,101,99,2,0,0,0, 0,0,0,0,2,0,0,0,3,0,0,0,67,0,0,0, @@ -1040,7 +1040,7 @@ 32,32,32,32,114,126,0,0,0,41,1,114,190,0,0,0, 41,2,114,100,0,0,0,114,35,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,218,10,112,97,116, - 104,95,115,116,97,116,115,165,2,0,0,115,2,0,0,0, + 104,95,115,116,97,116,115,166,2,0,0,115,2,0,0,0, 0,11,122,23,83,111,117,114,99,101,76,111,97,100,101,114, 46,112,97,116,104,95,115,116,97,116,115,99,4,0,0,0, 0,0,0,0,4,0,0,0,3,0,0,0,67,0,0,0, @@ -1064,7 +1064,7 @@ 0,90,10,99,97,99,104,101,95,112,97,116,104,114,53,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, 0,218,15,95,99,97,99,104,101,95,98,121,116,101,99,111, - 100,101,178,2,0,0,115,2,0,0,0,0,8,122,28,83, + 100,101,179,2,0,0,115,2,0,0,0,0,8,122,28,83, 111,117,114,99,101,76,111,97,100,101,114,46,95,99,97,99, 104,101,95,98,121,116,101,99,111,100,101,99,3,0,0,0, 0,0,0,0,3,0,0,0,1,0,0,0,67,0,0,0, @@ -1080,7 +1080,7 @@ 111,100,101,32,102,105,108,101,115,46,10,32,32,32,32,32, 32,32,32,78,114,4,0,0,0,41,3,114,100,0,0,0, 114,35,0,0,0,114,53,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,192,0,0,0,188,2, + 4,0,0,0,114,5,0,0,0,114,192,0,0,0,189,2, 0,0,115,0,0,0,0,122,21,83,111,117,114,99,101,76, 111,97,100,101,114,46,115,101,116,95,100,97,116,97,99,2, 0,0,0,0,0,0,0,5,0,0,0,16,0,0,0,67, @@ -1101,7 +1101,7 @@ 0,0,0,41,5,114,100,0,0,0,114,119,0,0,0,114, 35,0,0,0,114,147,0,0,0,218,3,101,120,99,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,218,10,103, - 101,116,95,115,111,117,114,99,101,195,2,0,0,115,14,0, + 101,116,95,115,111,117,114,99,101,196,2,0,0,115,14,0, 0,0,0,2,10,1,2,1,14,1,16,1,6,1,28,1, 122,23,83,111,117,114,99,101,76,111,97,100,101,114,46,103, 101,116,95,115,111,117,114,99,101,218,9,95,111,112,116,105, @@ -1123,7 +1123,7 @@ 101,41,4,114,100,0,0,0,114,53,0,0,0,114,35,0, 0,0,114,197,0,0,0,114,4,0,0,0,114,4,0,0, 0,114,5,0,0,0,218,14,115,111,117,114,99,101,95,116, - 111,95,99,111,100,101,205,2,0,0,115,4,0,0,0,0, + 111,95,99,111,100,101,206,2,0,0,115,4,0,0,0,0, 5,14,1,122,27,83,111,117,114,99,101,76,111,97,100,101, 114,46,115,111,117,114,99,101,95,116,111,95,99,111,100,101, 99,2,0,0,0,0,0,0,0,10,0,0,0,43,0,0, @@ -1180,7 +1180,7 @@ 10,98,121,116,101,115,95,100,97,116,97,114,147,0,0,0, 90,11,99,111,100,101,95,111,98,106,101,99,116,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,114,181,0,0, - 0,213,2,0,0,115,78,0,0,0,0,7,10,1,4,1, + 0,214,2,0,0,115,78,0,0,0,0,7,10,1,4,1, 2,1,12,1,14,1,10,2,2,1,14,1,14,1,6,2, 12,1,2,1,14,1,14,1,6,2,2,1,6,1,8,1, 12,1,18,1,6,2,8,1,6,1,10,1,4,1,8,1, @@ -1192,7 +1192,7 @@ 114,193,0,0,0,114,192,0,0,0,114,196,0,0,0,114, 200,0,0,0,114,181,0,0,0,114,4,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,188,0, - 0,0,155,2,0,0,115,14,0,0,0,8,2,8,8,8, + 0,0,156,2,0,0,115,14,0,0,0,8,2,8,8,8, 13,8,10,8,7,8,10,14,8,114,188,0,0,0,99,0, 0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0, 0,0,0,115,76,0,0,0,101,0,90,1,100,0,90,2, @@ -1218,7 +1218,7 @@ 100,101,114,46,78,41,2,114,98,0,0,0,114,35,0,0, 0,41,3,114,100,0,0,0,114,119,0,0,0,114,35,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,179,0,0,0,14,3,0,0,115,4,0,0,0,0, + 0,114,179,0,0,0,15,3,0,0,115,4,0,0,0,0, 3,6,1,122,19,70,105,108,101,76,111,97,100,101,114,46, 95,95,105,110,105,116,95,95,99,2,0,0,0,0,0,0, 0,2,0,0,0,2,0,0,0,67,0,0,0,115,24,0, @@ -1227,7 +1227,7 @@ 9,95,95,99,108,97,115,115,95,95,114,111,0,0,0,41, 2,114,100,0,0,0,218,5,111,116,104,101,114,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,218,6,95,95, - 101,113,95,95,20,3,0,0,115,4,0,0,0,0,1,12, + 101,113,95,95,21,3,0,0,115,4,0,0,0,0,1,12, 1,122,17,70,105,108,101,76,111,97,100,101,114,46,95,95, 101,113,95,95,99,1,0,0,0,0,0,0,0,1,0,0, 0,3,0,0,0,67,0,0,0,115,20,0,0,0,116,0, @@ -1235,7 +1235,7 @@ 83,0,41,1,78,41,3,218,4,104,97,115,104,114,98,0, 0,0,114,35,0,0,0,41,1,114,100,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,218,8,95, - 95,104,97,115,104,95,95,24,3,0,0,115,2,0,0,0, + 95,104,97,115,104,95,95,25,3,0,0,115,2,0,0,0, 0,1,122,19,70,105,108,101,76,111,97,100,101,114,46,95, 95,104,97,115,104,95,95,99,2,0,0,0,0,0,0,0, 2,0,0,0,3,0,0,0,3,0,0,0,115,16,0,0, @@ -1249,7 +1249,7 @@ 10,32,32,32,32,32,32,32,32,41,3,218,5,115,117,112, 101,114,114,204,0,0,0,114,187,0,0,0,41,2,114,100, 0,0,0,114,119,0,0,0,41,1,114,205,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,187,0,0,0,27,3, + 4,0,0,0,114,5,0,0,0,114,187,0,0,0,28,3, 0,0,115,2,0,0,0,0,10,122,22,70,105,108,101,76, 111,97,100,101,114,46,108,111,97,100,95,109,111,100,117,108, 101,99,2,0,0,0,0,0,0,0,2,0,0,0,1,0, @@ -1260,7 +1260,7 @@ 32,98,121,32,116,104,101,32,102,105,110,100,101,114,46,41, 1,114,35,0,0,0,41,2,114,100,0,0,0,114,119,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,151,0,0,0,39,3,0,0,115,2,0,0,0,0, + 0,114,151,0,0,0,40,3,0,0,115,2,0,0,0,0, 3,122,23,70,105,108,101,76,111,97,100,101,114,46,103,101, 116,95,102,105,108,101,110,97,109,101,99,2,0,0,0,0, 0,0,0,3,0,0,0,9,0,0,0,67,0,0,0,115, @@ -1272,7 +1272,7 @@ 1,114,78,41,3,114,49,0,0,0,114,50,0,0,0,90, 4,114,101,97,100,41,3,114,100,0,0,0,114,35,0,0, 0,114,54,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,5,0,0,0,114,194,0,0,0,44,3,0,0,115,4, + 114,5,0,0,0,114,194,0,0,0,45,3,0,0,115,4, 0,0,0,0,2,14,1,122,19,70,105,108,101,76,111,97, 100,101,114,46,103,101,116,95,100,97,116,97,41,11,114,105, 0,0,0,114,104,0,0,0,114,106,0,0,0,114,107,0, @@ -1280,7 +1280,7 @@ 0,114,116,0,0,0,114,187,0,0,0,114,151,0,0,0, 114,194,0,0,0,114,4,0,0,0,114,4,0,0,0,41, 1,114,205,0,0,0,114,5,0,0,0,114,204,0,0,0, - 9,3,0,0,115,14,0,0,0,8,3,4,2,8,6,8, + 10,3,0,0,115,14,0,0,0,8,3,4,2,8,6,8, 4,8,3,16,12,12,5,114,204,0,0,0,99,0,0,0, 0,0,0,0,0,0,0,0,0,4,0,0,0,64,0,0, 0,115,46,0,0,0,101,0,90,1,100,0,90,2,100,1, @@ -1292,1132 +1292,1132 @@ 110,32,111,102,32,83,111,117,114,99,101,76,111,97,100,101, 114,32,117,115,105,110,103,32,116,104,101,32,102,105,108,101, 32,115,121,115,116,101,109,46,99,2,0,0,0,0,0,0, - 0,3,0,0,0,4,0,0,0,67,0,0,0,115,24,0, - 0,0,116,0,124,1,131,1,125,2,100,1,124,2,106,1, - 100,2,124,2,106,2,105,2,83,0,41,3,122,33,82,101, - 116,117,114,110,32,116,104,101,32,109,101,116,97,100,97,116, - 97,32,102,111,114,32,116,104,101,32,112,97,116,104,46,114, - 126,0,0,0,114,127,0,0,0,41,3,114,39,0,0,0, - 218,8,115,116,95,109,116,105,109,101,90,7,115,116,95,115, - 105,122,101,41,3,114,100,0,0,0,114,35,0,0,0,114, - 202,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,191,0,0,0,54,3,0,0,115,4,0,0, - 0,0,2,8,1,122,27,83,111,117,114,99,101,70,105,108, - 101,76,111,97,100,101,114,46,112,97,116,104,95,115,116,97, - 116,115,99,4,0,0,0,0,0,0,0,5,0,0,0,5, - 0,0,0,67,0,0,0,115,26,0,0,0,116,0,124,1, - 131,1,125,4,124,0,106,1,124,2,124,3,100,1,124,4, - 144,1,131,2,83,0,41,2,78,218,5,95,109,111,100,101, - 41,2,114,97,0,0,0,114,192,0,0,0,41,5,114,100, - 0,0,0,114,90,0,0,0,114,89,0,0,0,114,53,0, - 0,0,114,42,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,5,0,0,0,114,193,0,0,0,59,3,0,0,115, - 4,0,0,0,0,2,8,1,122,32,83,111,117,114,99,101, - 70,105,108,101,76,111,97,100,101,114,46,95,99,97,99,104, - 101,95,98,121,116,101,99,111,100,101,114,214,0,0,0,105, - 182,1,0,0,99,3,0,0,0,1,0,0,0,9,0,0, - 0,17,0,0,0,67,0,0,0,115,250,0,0,0,116,0, - 124,1,131,1,92,2,125,4,125,5,103,0,125,6,120,40, - 124,4,114,56,116,1,124,4,131,1,12,0,114,56,116,0, - 124,4,131,1,92,2,125,4,125,7,124,6,106,2,124,7, - 131,1,1,0,113,18,87,0,120,108,116,3,124,6,131,1, - 68,0,93,96,125,7,116,4,124,4,124,7,131,2,125,4, - 121,14,116,5,106,6,124,4,131,1,1,0,87,0,113,68, - 4,0,116,7,107,10,114,118,1,0,1,0,1,0,119,68, - 89,0,113,68,4,0,116,8,107,10,114,162,1,0,125,8, - 1,0,122,18,116,9,106,10,100,1,124,4,124,8,131,3, - 1,0,100,2,83,0,100,2,125,8,126,8,88,0,113,68, - 88,0,113,68,87,0,121,28,116,11,124,1,124,2,124,3, - 131,3,1,0,116,9,106,10,100,3,124,1,131,2,1,0, - 87,0,110,48,4,0,116,8,107,10,114,244,1,0,125,8, - 1,0,122,20,116,9,106,10,100,1,124,1,124,8,131,3, - 1,0,87,0,89,0,100,2,100,2,125,8,126,8,88,0, - 110,2,88,0,100,2,83,0,41,4,122,27,87,114,105,116, - 101,32,98,121,116,101,115,32,100,97,116,97,32,116,111,32, - 97,32,102,105,108,101,46,122,27,99,111,117,108,100,32,110, - 111,116,32,99,114,101,97,116,101,32,123,33,114,125,58,32, - 123,33,114,125,78,122,12,99,114,101,97,116,101,100,32,123, - 33,114,125,41,12,114,38,0,0,0,114,46,0,0,0,114, - 157,0,0,0,114,33,0,0,0,114,28,0,0,0,114,3, - 0,0,0,90,5,109,107,100,105,114,218,15,70,105,108,101, - 69,120,105,115,116,115,69,114,114,111,114,114,40,0,0,0, - 114,114,0,0,0,114,129,0,0,0,114,55,0,0,0,41, - 9,114,100,0,0,0,114,35,0,0,0,114,53,0,0,0, - 114,214,0,0,0,218,6,112,97,114,101,110,116,114,94,0, - 0,0,114,27,0,0,0,114,23,0,0,0,114,195,0,0, + 0,3,0,0,0,3,0,0,0,67,0,0,0,115,22,0, + 0,0,116,0,124,1,131,1,125,2,124,2,106,1,124,2, + 106,2,100,1,156,2,83,0,41,2,122,33,82,101,116,117, + 114,110,32,116,104,101,32,109,101,116,97,100,97,116,97,32, + 102,111,114,32,116,104,101,32,112,97,116,104,46,41,2,122, + 5,109,116,105,109,101,122,4,115,105,122,101,41,3,114,39, + 0,0,0,218,8,115,116,95,109,116,105,109,101,90,7,115, + 116,95,115,105,122,101,41,3,114,100,0,0,0,114,35,0, + 0,0,114,202,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,5,0,0,0,114,191,0,0,0,55,3,0,0,115, + 4,0,0,0,0,2,8,1,122,27,83,111,117,114,99,101, + 70,105,108,101,76,111,97,100,101,114,46,112,97,116,104,95, + 115,116,97,116,115,99,4,0,0,0,0,0,0,0,5,0, + 0,0,5,0,0,0,67,0,0,0,115,26,0,0,0,116, + 0,124,1,131,1,125,4,124,0,106,1,124,2,124,3,100, + 1,124,4,144,1,131,2,83,0,41,2,78,218,5,95,109, + 111,100,101,41,2,114,97,0,0,0,114,192,0,0,0,41, + 5,114,100,0,0,0,114,90,0,0,0,114,89,0,0,0, + 114,53,0,0,0,114,42,0,0,0,114,4,0,0,0,114, + 4,0,0,0,114,5,0,0,0,114,193,0,0,0,60,3, + 0,0,115,4,0,0,0,0,2,8,1,122,32,83,111,117, + 114,99,101,70,105,108,101,76,111,97,100,101,114,46,95,99, + 97,99,104,101,95,98,121,116,101,99,111,100,101,114,214,0, + 0,0,105,182,1,0,0,99,3,0,0,0,1,0,0,0, + 9,0,0,0,17,0,0,0,67,0,0,0,115,250,0,0, + 0,116,0,124,1,131,1,92,2,125,4,125,5,103,0,125, + 6,120,40,124,4,114,56,116,1,124,4,131,1,12,0,114, + 56,116,0,124,4,131,1,92,2,125,4,125,7,124,6,106, + 2,124,7,131,1,1,0,113,18,87,0,120,108,116,3,124, + 6,131,1,68,0,93,96,125,7,116,4,124,4,124,7,131, + 2,125,4,121,14,116,5,106,6,124,4,131,1,1,0,87, + 0,113,68,4,0,116,7,107,10,114,118,1,0,1,0,1, + 0,119,68,89,0,113,68,4,0,116,8,107,10,114,162,1, + 0,125,8,1,0,122,18,116,9,106,10,100,1,124,4,124, + 8,131,3,1,0,100,2,83,0,100,2,125,8,126,8,88, + 0,113,68,88,0,113,68,87,0,121,28,116,11,124,1,124, + 2,124,3,131,3,1,0,116,9,106,10,100,3,124,1,131, + 2,1,0,87,0,110,48,4,0,116,8,107,10,114,244,1, + 0,125,8,1,0,122,20,116,9,106,10,100,1,124,1,124, + 8,131,3,1,0,87,0,89,0,100,2,100,2,125,8,126, + 8,88,0,110,2,88,0,100,2,83,0,41,4,122,27,87, + 114,105,116,101,32,98,121,116,101,115,32,100,97,116,97,32, + 116,111,32,97,32,102,105,108,101,46,122,27,99,111,117,108, + 100,32,110,111,116,32,99,114,101,97,116,101,32,123,33,114, + 125,58,32,123,33,114,125,78,122,12,99,114,101,97,116,101, + 100,32,123,33,114,125,41,12,114,38,0,0,0,114,46,0, + 0,0,114,157,0,0,0,114,33,0,0,0,114,28,0,0, + 0,114,3,0,0,0,90,5,109,107,100,105,114,218,15,70, + 105,108,101,69,120,105,115,116,115,69,114,114,111,114,114,40, + 0,0,0,114,114,0,0,0,114,129,0,0,0,114,55,0, + 0,0,41,9,114,100,0,0,0,114,35,0,0,0,114,53, + 0,0,0,114,214,0,0,0,218,6,112,97,114,101,110,116, + 114,94,0,0,0,114,27,0,0,0,114,23,0,0,0,114, + 195,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, + 0,0,0,114,192,0,0,0,65,3,0,0,115,42,0,0, + 0,0,2,12,1,4,2,16,1,12,1,14,2,14,1,10, + 1,2,1,14,1,14,2,6,1,16,3,6,1,8,1,20, + 1,2,1,12,1,16,1,16,2,8,1,122,25,83,111,117, + 114,99,101,70,105,108,101,76,111,97,100,101,114,46,115,101, + 116,95,100,97,116,97,78,41,7,114,105,0,0,0,114,104, + 0,0,0,114,106,0,0,0,114,107,0,0,0,114,191,0, + 0,0,114,193,0,0,0,114,192,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,192,0,0,0,64,3,0,0,115,42,0,0,0,0,2, - 12,1,4,2,16,1,12,1,14,2,14,1,10,1,2,1, - 14,1,14,2,6,1,16,3,6,1,8,1,20,1,2,1, - 12,1,16,1,16,2,8,1,122,25,83,111,117,114,99,101, - 70,105,108,101,76,111,97,100,101,114,46,115,101,116,95,100, - 97,116,97,78,41,7,114,105,0,0,0,114,104,0,0,0, - 114,106,0,0,0,114,107,0,0,0,114,191,0,0,0,114, - 193,0,0,0,114,192,0,0,0,114,4,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,5,0,0,0,114,212,0, - 0,0,50,3,0,0,115,8,0,0,0,8,2,4,2,8, - 5,8,5,114,212,0,0,0,99,0,0,0,0,0,0,0, - 0,0,0,0,0,2,0,0,0,64,0,0,0,115,32,0, - 0,0,101,0,90,1,100,0,90,2,100,1,90,3,100,2, - 100,3,132,0,90,4,100,4,100,5,132,0,90,5,100,6, - 83,0,41,7,218,20,83,111,117,114,99,101,108,101,115,115, - 70,105,108,101,76,111,97,100,101,114,122,45,76,111,97,100, - 101,114,32,119,104,105,99,104,32,104,97,110,100,108,101,115, - 32,115,111,117,114,99,101,108,101,115,115,32,102,105,108,101, - 32,105,109,112,111,114,116,115,46,99,2,0,0,0,0,0, - 0,0,5,0,0,0,6,0,0,0,67,0,0,0,115,56, - 0,0,0,124,0,106,0,124,1,131,1,125,2,124,0,106, - 1,124,2,131,1,125,3,116,2,124,3,100,1,124,1,100, - 2,124,2,144,2,131,1,125,4,116,3,124,4,100,1,124, - 1,100,3,124,2,144,2,131,1,83,0,41,4,78,114,98, - 0,0,0,114,35,0,0,0,114,89,0,0,0,41,4,114, - 151,0,0,0,114,194,0,0,0,114,135,0,0,0,114,141, - 0,0,0,41,5,114,100,0,0,0,114,119,0,0,0,114, - 35,0,0,0,114,53,0,0,0,114,203,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,5,0,0,0,114,181,0, - 0,0,99,3,0,0,115,8,0,0,0,0,1,10,1,10, - 1,18,1,122,29,83,111,117,114,99,101,108,101,115,115,70, - 105,108,101,76,111,97,100,101,114,46,103,101,116,95,99,111, + 114,212,0,0,0,51,3,0,0,115,8,0,0,0,8,2, + 4,2,8,5,8,5,114,212,0,0,0,99,0,0,0,0, + 0,0,0,0,0,0,0,0,2,0,0,0,64,0,0,0, + 115,32,0,0,0,101,0,90,1,100,0,90,2,100,1,90, + 3,100,2,100,3,132,0,90,4,100,4,100,5,132,0,90, + 5,100,6,83,0,41,7,218,20,83,111,117,114,99,101,108, + 101,115,115,70,105,108,101,76,111,97,100,101,114,122,45,76, + 111,97,100,101,114,32,119,104,105,99,104,32,104,97,110,100, + 108,101,115,32,115,111,117,114,99,101,108,101,115,115,32,102, + 105,108,101,32,105,109,112,111,114,116,115,46,99,2,0,0, + 0,0,0,0,0,5,0,0,0,6,0,0,0,67,0,0, + 0,115,56,0,0,0,124,0,106,0,124,1,131,1,125,2, + 124,0,106,1,124,2,131,1,125,3,116,2,124,3,100,1, + 124,1,100,2,124,2,144,2,131,1,125,4,116,3,124,4, + 100,1,124,1,100,3,124,2,144,2,131,1,83,0,41,4, + 78,114,98,0,0,0,114,35,0,0,0,114,89,0,0,0, + 41,4,114,151,0,0,0,114,194,0,0,0,114,135,0,0, + 0,114,141,0,0,0,41,5,114,100,0,0,0,114,119,0, + 0,0,114,35,0,0,0,114,53,0,0,0,114,203,0,0, + 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, + 114,181,0,0,0,100,3,0,0,115,8,0,0,0,0,1, + 10,1,10,1,18,1,122,29,83,111,117,114,99,101,108,101, + 115,115,70,105,108,101,76,111,97,100,101,114,46,103,101,116, + 95,99,111,100,101,99,2,0,0,0,0,0,0,0,2,0, + 0,0,1,0,0,0,67,0,0,0,115,4,0,0,0,100, + 1,83,0,41,2,122,39,82,101,116,117,114,110,32,78,111, + 110,101,32,97,115,32,116,104,101,114,101,32,105,115,32,110, + 111,32,115,111,117,114,99,101,32,99,111,100,101,46,78,114, + 4,0,0,0,41,2,114,100,0,0,0,114,119,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, + 196,0,0,0,106,3,0,0,115,2,0,0,0,0,2,122, + 31,83,111,117,114,99,101,108,101,115,115,70,105,108,101,76, + 111,97,100,101,114,46,103,101,116,95,115,111,117,114,99,101, + 78,41,6,114,105,0,0,0,114,104,0,0,0,114,106,0, + 0,0,114,107,0,0,0,114,181,0,0,0,114,196,0,0, + 0,114,4,0,0,0,114,4,0,0,0,114,4,0,0,0, + 114,5,0,0,0,114,217,0,0,0,96,3,0,0,115,6, + 0,0,0,8,2,4,2,8,6,114,217,0,0,0,99,0, + 0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,64, + 0,0,0,115,92,0,0,0,101,0,90,1,100,0,90,2, + 100,1,90,3,100,2,100,3,132,0,90,4,100,4,100,5, + 132,0,90,5,100,6,100,7,132,0,90,6,100,8,100,9, + 132,0,90,7,100,10,100,11,132,0,90,8,100,12,100,13, + 132,0,90,9,100,14,100,15,132,0,90,10,100,16,100,17, + 132,0,90,11,101,12,100,18,100,19,132,0,131,1,90,13, + 100,20,83,0,41,21,218,19,69,120,116,101,110,115,105,111, + 110,70,105,108,101,76,111,97,100,101,114,122,93,76,111,97, + 100,101,114,32,102,111,114,32,101,120,116,101,110,115,105,111, + 110,32,109,111,100,117,108,101,115,46,10,10,32,32,32,32, + 84,104,101,32,99,111,110,115,116,114,117,99,116,111,114,32, + 105,115,32,100,101,115,105,103,110,101,100,32,116,111,32,119, + 111,114,107,32,119,105,116,104,32,70,105,108,101,70,105,110, + 100,101,114,46,10,10,32,32,32,32,99,3,0,0,0,0, + 0,0,0,3,0,0,0,2,0,0,0,67,0,0,0,115, + 16,0,0,0,124,1,124,0,95,0,124,2,124,0,95,1, + 100,0,83,0,41,1,78,41,2,114,98,0,0,0,114,35, + 0,0,0,41,3,114,100,0,0,0,114,98,0,0,0,114, + 35,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, + 0,0,0,114,179,0,0,0,123,3,0,0,115,4,0,0, + 0,0,1,6,1,122,28,69,120,116,101,110,115,105,111,110, + 70,105,108,101,76,111,97,100,101,114,46,95,95,105,110,105, + 116,95,95,99,2,0,0,0,0,0,0,0,2,0,0,0, + 2,0,0,0,67,0,0,0,115,24,0,0,0,124,0,106, + 0,124,1,106,0,107,2,111,22,124,0,106,1,124,1,106, + 1,107,2,83,0,41,1,78,41,2,114,205,0,0,0,114, + 111,0,0,0,41,2,114,100,0,0,0,114,206,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, + 207,0,0,0,127,3,0,0,115,4,0,0,0,0,1,12, + 1,122,26,69,120,116,101,110,115,105,111,110,70,105,108,101, + 76,111,97,100,101,114,46,95,95,101,113,95,95,99,1,0, + 0,0,0,0,0,0,1,0,0,0,3,0,0,0,67,0, + 0,0,115,20,0,0,0,116,0,124,0,106,1,131,1,116, + 0,124,0,106,2,131,1,65,0,83,0,41,1,78,41,3, + 114,208,0,0,0,114,98,0,0,0,114,35,0,0,0,41, + 1,114,100,0,0,0,114,4,0,0,0,114,4,0,0,0, + 114,5,0,0,0,114,209,0,0,0,131,3,0,0,115,2, + 0,0,0,0,1,122,28,69,120,116,101,110,115,105,111,110, + 70,105,108,101,76,111,97,100,101,114,46,95,95,104,97,115, + 104,95,95,99,2,0,0,0,0,0,0,0,3,0,0,0, + 4,0,0,0,67,0,0,0,115,36,0,0,0,116,0,106, + 1,116,2,106,3,124,1,131,2,125,2,116,0,106,4,100, + 1,124,1,106,5,124,0,106,6,131,3,1,0,124,2,83, + 0,41,2,122,38,67,114,101,97,116,101,32,97,110,32,117, + 110,105,116,105,97,108,105,122,101,100,32,101,120,116,101,110, + 115,105,111,110,32,109,111,100,117,108,101,122,38,101,120,116, + 101,110,115,105,111,110,32,109,111,100,117,108,101,32,123,33, + 114,125,32,108,111,97,100,101,100,32,102,114,111,109,32,123, + 33,114,125,41,7,114,114,0,0,0,114,182,0,0,0,114, + 139,0,0,0,90,14,99,114,101,97,116,101,95,100,121,110, + 97,109,105,99,114,129,0,0,0,114,98,0,0,0,114,35, + 0,0,0,41,3,114,100,0,0,0,114,158,0,0,0,114, + 184,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, + 0,0,0,114,180,0,0,0,134,3,0,0,115,10,0,0, + 0,0,2,4,1,10,1,6,1,12,1,122,33,69,120,116, + 101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,114, + 46,99,114,101,97,116,101,95,109,111,100,117,108,101,99,2, + 0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,67, + 0,0,0,115,36,0,0,0,116,0,106,1,116,2,106,3, + 124,1,131,2,1,0,116,0,106,4,100,1,124,0,106,5, + 124,0,106,6,131,3,1,0,100,2,83,0,41,3,122,30, + 73,110,105,116,105,97,108,105,122,101,32,97,110,32,101,120, + 116,101,110,115,105,111,110,32,109,111,100,117,108,101,122,40, + 101,120,116,101,110,115,105,111,110,32,109,111,100,117,108,101, + 32,123,33,114,125,32,101,120,101,99,117,116,101,100,32,102, + 114,111,109,32,123,33,114,125,78,41,7,114,114,0,0,0, + 114,182,0,0,0,114,139,0,0,0,90,12,101,120,101,99, + 95,100,121,110,97,109,105,99,114,129,0,0,0,114,98,0, + 0,0,114,35,0,0,0,41,2,114,100,0,0,0,114,184, + 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, + 0,0,114,185,0,0,0,142,3,0,0,115,6,0,0,0, + 0,2,14,1,6,1,122,31,69,120,116,101,110,115,105,111, + 110,70,105,108,101,76,111,97,100,101,114,46,101,120,101,99, + 95,109,111,100,117,108,101,99,2,0,0,0,0,0,0,0, + 2,0,0,0,4,0,0,0,3,0,0,0,115,36,0,0, + 0,116,0,124,0,106,1,131,1,100,1,25,0,137,0,116, + 2,135,0,102,1,100,2,100,3,134,0,116,3,68,0,131, + 1,131,1,83,0,41,4,122,49,82,101,116,117,114,110,32, + 84,114,117,101,32,105,102,32,116,104,101,32,101,120,116,101, + 110,115,105,111,110,32,109,111,100,117,108,101,32,105,115,32, + 97,32,112,97,99,107,97,103,101,46,114,29,0,0,0,99, + 1,0,0,0,0,0,0,0,2,0,0,0,4,0,0,0, + 51,0,0,0,115,26,0,0,0,124,0,93,18,125,1,136, + 0,100,0,124,1,23,0,107,2,86,0,1,0,113,2,100, + 1,83,0,41,2,114,179,0,0,0,78,114,4,0,0,0, + 41,2,114,22,0,0,0,218,6,115,117,102,102,105,120,41, + 1,218,9,102,105,108,101,95,110,97,109,101,114,4,0,0, + 0,114,5,0,0,0,250,9,60,103,101,110,101,120,112,114, + 62,151,3,0,0,115,2,0,0,0,4,1,122,49,69,120, + 116,101,110,115,105,111,110,70,105,108,101,76,111,97,100,101, + 114,46,105,115,95,112,97,99,107,97,103,101,46,60,108,111, + 99,97,108,115,62,46,60,103,101,110,101,120,112,114,62,41, + 4,114,38,0,0,0,114,35,0,0,0,218,3,97,110,121, + 218,18,69,88,84,69,78,83,73,79,78,95,83,85,70,70, + 73,88,69,83,41,2,114,100,0,0,0,114,119,0,0,0, + 114,4,0,0,0,41,1,114,220,0,0,0,114,5,0,0, + 0,114,153,0,0,0,148,3,0,0,115,6,0,0,0,0, + 2,14,1,12,1,122,30,69,120,116,101,110,115,105,111,110, + 70,105,108,101,76,111,97,100,101,114,46,105,115,95,112,97, + 99,107,97,103,101,99,2,0,0,0,0,0,0,0,2,0, + 0,0,1,0,0,0,67,0,0,0,115,4,0,0,0,100, + 1,83,0,41,2,122,63,82,101,116,117,114,110,32,78,111, + 110,101,32,97,115,32,97,110,32,101,120,116,101,110,115,105, + 111,110,32,109,111,100,117,108,101,32,99,97,110,110,111,116, + 32,99,114,101,97,116,101,32,97,32,99,111,100,101,32,111, + 98,106,101,99,116,46,78,114,4,0,0,0,41,2,114,100, + 0,0,0,114,119,0,0,0,114,4,0,0,0,114,4,0, + 0,0,114,5,0,0,0,114,181,0,0,0,154,3,0,0, + 115,2,0,0,0,0,2,122,28,69,120,116,101,110,115,105, + 111,110,70,105,108,101,76,111,97,100,101,114,46,103,101,116, + 95,99,111,100,101,99,2,0,0,0,0,0,0,0,2,0, + 0,0,1,0,0,0,67,0,0,0,115,4,0,0,0,100, + 1,83,0,41,2,122,53,82,101,116,117,114,110,32,78,111, + 110,101,32,97,115,32,101,120,116,101,110,115,105,111,110,32, + 109,111,100,117,108,101,115,32,104,97,118,101,32,110,111,32, + 115,111,117,114,99,101,32,99,111,100,101,46,78,114,4,0, + 0,0,41,2,114,100,0,0,0,114,119,0,0,0,114,4, + 0,0,0,114,4,0,0,0,114,5,0,0,0,114,196,0, + 0,0,158,3,0,0,115,2,0,0,0,0,2,122,30,69, + 120,116,101,110,115,105,111,110,70,105,108,101,76,111,97,100, + 101,114,46,103,101,116,95,115,111,117,114,99,101,99,2,0, + 0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,0, + 0,0,115,6,0,0,0,124,0,106,0,83,0,41,1,122, + 58,82,101,116,117,114,110,32,116,104,101,32,112,97,116,104, + 32,116,111,32,116,104,101,32,115,111,117,114,99,101,32,102, + 105,108,101,32,97,115,32,102,111,117,110,100,32,98,121,32, + 116,104,101,32,102,105,110,100,101,114,46,41,1,114,35,0, + 0,0,41,2,114,100,0,0,0,114,119,0,0,0,114,4, + 0,0,0,114,4,0,0,0,114,5,0,0,0,114,151,0, + 0,0,162,3,0,0,115,2,0,0,0,0,3,122,32,69, + 120,116,101,110,115,105,111,110,70,105,108,101,76,111,97,100, + 101,114,46,103,101,116,95,102,105,108,101,110,97,109,101,78, + 41,14,114,105,0,0,0,114,104,0,0,0,114,106,0,0, + 0,114,107,0,0,0,114,179,0,0,0,114,207,0,0,0, + 114,209,0,0,0,114,180,0,0,0,114,185,0,0,0,114, + 153,0,0,0,114,181,0,0,0,114,196,0,0,0,114,116, + 0,0,0,114,151,0,0,0,114,4,0,0,0,114,4,0, + 0,0,114,4,0,0,0,114,5,0,0,0,114,218,0,0, + 0,115,3,0,0,115,20,0,0,0,8,6,4,2,8,4, + 8,4,8,3,8,8,8,6,8,6,8,4,8,4,114,218, + 0,0,0,99,0,0,0,0,0,0,0,0,0,0,0,0, + 2,0,0,0,64,0,0,0,115,96,0,0,0,101,0,90, + 1,100,0,90,2,100,1,90,3,100,2,100,3,132,0,90, + 4,100,4,100,5,132,0,90,5,100,6,100,7,132,0,90, + 6,100,8,100,9,132,0,90,7,100,10,100,11,132,0,90, + 8,100,12,100,13,132,0,90,9,100,14,100,15,132,0,90, + 10,100,16,100,17,132,0,90,11,100,18,100,19,132,0,90, + 12,100,20,100,21,132,0,90,13,100,22,83,0,41,23,218, + 14,95,78,97,109,101,115,112,97,99,101,80,97,116,104,97, + 38,1,0,0,82,101,112,114,101,115,101,110,116,115,32,97, + 32,110,97,109,101,115,112,97,99,101,32,112,97,99,107,97, + 103,101,39,115,32,112,97,116,104,46,32,32,73,116,32,117, + 115,101,115,32,116,104,101,32,109,111,100,117,108,101,32,110, + 97,109,101,10,32,32,32,32,116,111,32,102,105,110,100,32, + 105,116,115,32,112,97,114,101,110,116,32,109,111,100,117,108, + 101,44,32,97,110,100,32,102,114,111,109,32,116,104,101,114, + 101,32,105,116,32,108,111,111,107,115,32,117,112,32,116,104, + 101,32,112,97,114,101,110,116,39,115,10,32,32,32,32,95, + 95,112,97,116,104,95,95,46,32,32,87,104,101,110,32,116, + 104,105,115,32,99,104,97,110,103,101,115,44,32,116,104,101, + 32,109,111,100,117,108,101,39,115,32,111,119,110,32,112,97, + 116,104,32,105,115,32,114,101,99,111,109,112,117,116,101,100, + 44,10,32,32,32,32,117,115,105,110,103,32,112,97,116,104, + 95,102,105,110,100,101,114,46,32,32,70,111,114,32,116,111, + 112,45,108,101,118,101,108,32,109,111,100,117,108,101,115,44, + 32,116,104,101,32,112,97,114,101,110,116,32,109,111,100,117, + 108,101,39,115,32,112,97,116,104,10,32,32,32,32,105,115, + 32,115,121,115,46,112,97,116,104,46,99,4,0,0,0,0, + 0,0,0,4,0,0,0,2,0,0,0,67,0,0,0,115, + 36,0,0,0,124,1,124,0,95,0,124,2,124,0,95,1, + 116,2,124,0,106,3,131,0,131,1,124,0,95,4,124,3, + 124,0,95,5,100,0,83,0,41,1,78,41,6,218,5,95, + 110,97,109,101,218,5,95,112,97,116,104,114,93,0,0,0, + 218,16,95,103,101,116,95,112,97,114,101,110,116,95,112,97, + 116,104,218,17,95,108,97,115,116,95,112,97,114,101,110,116, + 95,112,97,116,104,218,12,95,112,97,116,104,95,102,105,110, + 100,101,114,41,4,114,100,0,0,0,114,98,0,0,0,114, + 35,0,0,0,218,11,112,97,116,104,95,102,105,110,100,101, + 114,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, + 114,179,0,0,0,175,3,0,0,115,8,0,0,0,0,1, + 6,1,6,1,14,1,122,23,95,78,97,109,101,115,112,97, + 99,101,80,97,116,104,46,95,95,105,110,105,116,95,95,99, + 1,0,0,0,0,0,0,0,4,0,0,0,3,0,0,0, + 67,0,0,0,115,38,0,0,0,124,0,106,0,106,1,100, + 1,131,1,92,3,125,1,125,2,125,3,124,2,100,2,107, + 2,114,30,100,6,83,0,124,1,100,5,102,2,83,0,41, + 7,122,62,82,101,116,117,114,110,115,32,97,32,116,117,112, + 108,101,32,111,102,32,40,112,97,114,101,110,116,45,109,111, + 100,117,108,101,45,110,97,109,101,44,32,112,97,114,101,110, + 116,45,112,97,116,104,45,97,116,116,114,45,110,97,109,101, + 41,114,58,0,0,0,114,30,0,0,0,114,7,0,0,0, + 114,35,0,0,0,90,8,95,95,112,97,116,104,95,95,41, + 2,122,3,115,121,115,122,4,112,97,116,104,41,2,114,225, + 0,0,0,114,32,0,0,0,41,4,114,100,0,0,0,114, + 216,0,0,0,218,3,100,111,116,90,2,109,101,114,4,0, + 0,0,114,4,0,0,0,114,5,0,0,0,218,23,95,102, + 105,110,100,95,112,97,114,101,110,116,95,112,97,116,104,95, + 110,97,109,101,115,181,3,0,0,115,8,0,0,0,0,2, + 18,1,8,2,4,3,122,38,95,78,97,109,101,115,112,97, + 99,101,80,97,116,104,46,95,102,105,110,100,95,112,97,114, + 101,110,116,95,112,97,116,104,95,110,97,109,101,115,99,1, + 0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,67, + 0,0,0,115,28,0,0,0,124,0,106,0,131,0,92,2, + 125,1,125,2,116,1,116,2,106,3,124,1,25,0,124,2, + 131,2,83,0,41,1,78,41,4,114,232,0,0,0,114,110, + 0,0,0,114,7,0,0,0,218,7,109,111,100,117,108,101, + 115,41,3,114,100,0,0,0,90,18,112,97,114,101,110,116, + 95,109,111,100,117,108,101,95,110,97,109,101,90,14,112,97, + 116,104,95,97,116,116,114,95,110,97,109,101,114,4,0,0, + 0,114,4,0,0,0,114,5,0,0,0,114,227,0,0,0, + 191,3,0,0,115,4,0,0,0,0,1,12,1,122,31,95, + 78,97,109,101,115,112,97,99,101,80,97,116,104,46,95,103, + 101,116,95,112,97,114,101,110,116,95,112,97,116,104,99,1, + 0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,67, + 0,0,0,115,80,0,0,0,116,0,124,0,106,1,131,0, + 131,1,125,1,124,1,124,0,106,2,107,3,114,74,124,0, + 106,3,124,0,106,4,124,1,131,2,125,2,124,2,100,0, + 107,9,114,68,124,2,106,5,100,0,107,8,114,68,124,2, + 106,6,114,68,124,2,106,6,124,0,95,7,124,1,124,0, + 95,2,124,0,106,7,83,0,41,1,78,41,8,114,93,0, + 0,0,114,227,0,0,0,114,228,0,0,0,114,229,0,0, + 0,114,225,0,0,0,114,120,0,0,0,114,150,0,0,0, + 114,226,0,0,0,41,3,114,100,0,0,0,90,11,112,97, + 114,101,110,116,95,112,97,116,104,114,158,0,0,0,114,4, + 0,0,0,114,4,0,0,0,114,5,0,0,0,218,12,95, + 114,101,99,97,108,99,117,108,97,116,101,195,3,0,0,115, + 16,0,0,0,0,2,12,1,10,1,14,3,18,1,6,1, + 8,1,6,1,122,27,95,78,97,109,101,115,112,97,99,101, + 80,97,116,104,46,95,114,101,99,97,108,99,117,108,97,116, + 101,99,1,0,0,0,0,0,0,0,1,0,0,0,2,0, + 0,0,67,0,0,0,115,12,0,0,0,116,0,124,0,106, + 1,131,0,131,1,83,0,41,1,78,41,2,218,4,105,116, + 101,114,114,234,0,0,0,41,1,114,100,0,0,0,114,4, + 0,0,0,114,4,0,0,0,114,5,0,0,0,218,8,95, + 95,105,116,101,114,95,95,208,3,0,0,115,2,0,0,0, + 0,1,122,23,95,78,97,109,101,115,112,97,99,101,80,97, + 116,104,46,95,95,105,116,101,114,95,95,99,3,0,0,0, + 0,0,0,0,3,0,0,0,3,0,0,0,67,0,0,0, + 115,14,0,0,0,124,2,124,0,106,0,124,1,60,0,100, + 0,83,0,41,1,78,41,1,114,226,0,0,0,41,3,114, + 100,0,0,0,218,5,105,110,100,101,120,114,35,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218, + 11,95,95,115,101,116,105,116,101,109,95,95,211,3,0,0, + 115,2,0,0,0,0,1,122,26,95,78,97,109,101,115,112, + 97,99,101,80,97,116,104,46,95,95,115,101,116,105,116,101, + 109,95,95,99,1,0,0,0,0,0,0,0,1,0,0,0, + 2,0,0,0,67,0,0,0,115,12,0,0,0,116,0,124, + 0,106,1,131,0,131,1,83,0,41,1,78,41,2,114,31, + 0,0,0,114,234,0,0,0,41,1,114,100,0,0,0,114, + 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,7, + 95,95,108,101,110,95,95,214,3,0,0,115,2,0,0,0, + 0,1,122,22,95,78,97,109,101,115,112,97,99,101,80,97, + 116,104,46,95,95,108,101,110,95,95,99,1,0,0,0,0, + 0,0,0,1,0,0,0,2,0,0,0,67,0,0,0,115, + 12,0,0,0,100,1,106,0,124,0,106,1,131,1,83,0, + 41,2,78,122,20,95,78,97,109,101,115,112,97,99,101,80, + 97,116,104,40,123,33,114,125,41,41,2,114,47,0,0,0, + 114,226,0,0,0,41,1,114,100,0,0,0,114,4,0,0, + 0,114,4,0,0,0,114,5,0,0,0,218,8,95,95,114, + 101,112,114,95,95,217,3,0,0,115,2,0,0,0,0,1, + 122,23,95,78,97,109,101,115,112,97,99,101,80,97,116,104, + 46,95,95,114,101,112,114,95,95,99,2,0,0,0,0,0, + 0,0,2,0,0,0,2,0,0,0,67,0,0,0,115,12, + 0,0,0,124,1,124,0,106,0,131,0,107,6,83,0,41, + 1,78,41,1,114,234,0,0,0,41,2,114,100,0,0,0, + 218,4,105,116,101,109,114,4,0,0,0,114,4,0,0,0, + 114,5,0,0,0,218,12,95,95,99,111,110,116,97,105,110, + 115,95,95,220,3,0,0,115,2,0,0,0,0,1,122,27, + 95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95, + 95,99,111,110,116,97,105,110,115,95,95,99,2,0,0,0, + 0,0,0,0,2,0,0,0,2,0,0,0,67,0,0,0, + 115,16,0,0,0,124,0,106,0,106,1,124,1,131,1,1, + 0,100,0,83,0,41,1,78,41,2,114,226,0,0,0,114, + 157,0,0,0,41,2,114,100,0,0,0,114,241,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, + 157,0,0,0,223,3,0,0,115,2,0,0,0,0,1,122, + 21,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46, + 97,112,112,101,110,100,78,41,14,114,105,0,0,0,114,104, + 0,0,0,114,106,0,0,0,114,107,0,0,0,114,179,0, + 0,0,114,232,0,0,0,114,227,0,0,0,114,234,0,0, + 0,114,236,0,0,0,114,238,0,0,0,114,239,0,0,0, + 114,240,0,0,0,114,242,0,0,0,114,157,0,0,0,114, + 4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, + 0,0,0,114,224,0,0,0,168,3,0,0,115,22,0,0, + 0,8,5,4,2,8,6,8,10,8,4,8,13,8,3,8, + 3,8,3,8,3,8,3,114,224,0,0,0,99,0,0,0, + 0,0,0,0,0,0,0,0,0,3,0,0,0,64,0,0, + 0,115,80,0,0,0,101,0,90,1,100,0,90,2,100,1, + 100,2,132,0,90,3,101,4,100,3,100,4,132,0,131,1, + 90,5,100,5,100,6,132,0,90,6,100,7,100,8,132,0, + 90,7,100,9,100,10,132,0,90,8,100,11,100,12,132,0, + 90,9,100,13,100,14,132,0,90,10,100,15,100,16,132,0, + 90,11,100,17,83,0,41,18,218,16,95,78,97,109,101,115, + 112,97,99,101,76,111,97,100,101,114,99,4,0,0,0,0, + 0,0,0,4,0,0,0,4,0,0,0,67,0,0,0,115, + 18,0,0,0,116,0,124,1,124,2,124,3,131,3,124,0, + 95,1,100,0,83,0,41,1,78,41,2,114,224,0,0,0, + 114,226,0,0,0,41,4,114,100,0,0,0,114,98,0,0, + 0,114,35,0,0,0,114,230,0,0,0,114,4,0,0,0, + 114,4,0,0,0,114,5,0,0,0,114,179,0,0,0,229, + 3,0,0,115,2,0,0,0,0,1,122,25,95,78,97,109, + 101,115,112,97,99,101,76,111,97,100,101,114,46,95,95,105, + 110,105,116,95,95,99,2,0,0,0,0,0,0,0,2,0, + 0,0,2,0,0,0,67,0,0,0,115,12,0,0,0,100, + 1,106,0,124,1,106,1,131,1,83,0,41,2,122,115,82, + 101,116,117,114,110,32,114,101,112,114,32,102,111,114,32,116, + 104,101,32,109,111,100,117,108,101,46,10,10,32,32,32,32, + 32,32,32,32,84,104,101,32,109,101,116,104,111,100,32,105, + 115,32,100,101,112,114,101,99,97,116,101,100,46,32,32,84, + 104,101,32,105,109,112,111,114,116,32,109,97,99,104,105,110, + 101,114,121,32,100,111,101,115,32,116,104,101,32,106,111,98, + 32,105,116,115,101,108,102,46,10,10,32,32,32,32,32,32, + 32,32,122,25,60,109,111,100,117,108,101,32,123,33,114,125, + 32,40,110,97,109,101,115,112,97,99,101,41,62,41,2,114, + 47,0,0,0,114,105,0,0,0,41,2,114,164,0,0,0, + 114,184,0,0,0,114,4,0,0,0,114,4,0,0,0,114, + 5,0,0,0,218,11,109,111,100,117,108,101,95,114,101,112, + 114,232,3,0,0,115,2,0,0,0,0,7,122,28,95,78, + 97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,109, + 111,100,117,108,101,95,114,101,112,114,99,2,0,0,0,0, + 0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,115, + 4,0,0,0,100,1,83,0,41,2,78,84,114,4,0,0, + 0,41,2,114,100,0,0,0,114,119,0,0,0,114,4,0, + 0,0,114,4,0,0,0,114,5,0,0,0,114,153,0,0, + 0,241,3,0,0,115,2,0,0,0,0,1,122,27,95,78, + 97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,105, + 115,95,112,97,99,107,97,103,101,99,2,0,0,0,0,0, + 0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,4, + 0,0,0,100,1,83,0,41,2,78,114,30,0,0,0,114, + 4,0,0,0,41,2,114,100,0,0,0,114,119,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, + 196,0,0,0,244,3,0,0,115,2,0,0,0,0,1,122, + 27,95,78,97,109,101,115,112,97,99,101,76,111,97,100,101, + 114,46,103,101,116,95,115,111,117,114,99,101,99,2,0,0, + 0,0,0,0,0,2,0,0,0,6,0,0,0,67,0,0, + 0,115,18,0,0,0,116,0,100,1,100,2,100,3,100,4, + 100,5,144,1,131,3,83,0,41,6,78,114,30,0,0,0, + 122,8,60,115,116,114,105,110,103,62,114,183,0,0,0,114, + 198,0,0,0,84,41,1,114,199,0,0,0,41,2,114,100, + 0,0,0,114,119,0,0,0,114,4,0,0,0,114,4,0, + 0,0,114,5,0,0,0,114,181,0,0,0,247,3,0,0, + 115,2,0,0,0,0,1,122,25,95,78,97,109,101,115,112, + 97,99,101,76,111,97,100,101,114,46,103,101,116,95,99,111, 100,101,99,2,0,0,0,0,0,0,0,2,0,0,0,1, 0,0,0,67,0,0,0,115,4,0,0,0,100,1,83,0, - 41,2,122,39,82,101,116,117,114,110,32,78,111,110,101,32, - 97,115,32,116,104,101,114,101,32,105,115,32,110,111,32,115, - 111,117,114,99,101,32,99,111,100,101,46,78,114,4,0,0, - 0,41,2,114,100,0,0,0,114,119,0,0,0,114,4,0, - 0,0,114,4,0,0,0,114,5,0,0,0,114,196,0,0, - 0,105,3,0,0,115,2,0,0,0,0,2,122,31,83,111, - 117,114,99,101,108,101,115,115,70,105,108,101,76,111,97,100, - 101,114,46,103,101,116,95,115,111,117,114,99,101,78,41,6, - 114,105,0,0,0,114,104,0,0,0,114,106,0,0,0,114, - 107,0,0,0,114,181,0,0,0,114,196,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,114,217,0,0,0,95,3,0,0,115,6,0,0,0, - 8,2,4,2,8,6,114,217,0,0,0,99,0,0,0,0, - 0,0,0,0,0,0,0,0,3,0,0,0,64,0,0,0, - 115,92,0,0,0,101,0,90,1,100,0,90,2,100,1,90, - 3,100,2,100,3,132,0,90,4,100,4,100,5,132,0,90, - 5,100,6,100,7,132,0,90,6,100,8,100,9,132,0,90, - 7,100,10,100,11,132,0,90,8,100,12,100,13,132,0,90, - 9,100,14,100,15,132,0,90,10,100,16,100,17,132,0,90, - 11,101,12,100,18,100,19,132,0,131,1,90,13,100,20,83, - 0,41,21,218,19,69,120,116,101,110,115,105,111,110,70,105, - 108,101,76,111,97,100,101,114,122,93,76,111,97,100,101,114, - 32,102,111,114,32,101,120,116,101,110,115,105,111,110,32,109, - 111,100,117,108,101,115,46,10,10,32,32,32,32,84,104,101, - 32,99,111,110,115,116,114,117,99,116,111,114,32,105,115,32, - 100,101,115,105,103,110,101,100,32,116,111,32,119,111,114,107, - 32,119,105,116,104,32,70,105,108,101,70,105,110,100,101,114, - 46,10,10,32,32,32,32,99,3,0,0,0,0,0,0,0, - 3,0,0,0,2,0,0,0,67,0,0,0,115,16,0,0, - 0,124,1,124,0,95,0,124,2,124,0,95,1,100,0,83, - 0,41,1,78,41,2,114,98,0,0,0,114,35,0,0,0, - 41,3,114,100,0,0,0,114,98,0,0,0,114,35,0,0, - 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,179,0,0,0,122,3,0,0,115,4,0,0,0,0,1, - 6,1,122,28,69,120,116,101,110,115,105,111,110,70,105,108, - 101,76,111,97,100,101,114,46,95,95,105,110,105,116,95,95, - 99,2,0,0,0,0,0,0,0,2,0,0,0,2,0,0, - 0,67,0,0,0,115,24,0,0,0,124,0,106,0,124,1, - 106,0,107,2,111,22,124,0,106,1,124,1,106,1,107,2, - 83,0,41,1,78,41,2,114,205,0,0,0,114,111,0,0, - 0,41,2,114,100,0,0,0,114,206,0,0,0,114,4,0, - 0,0,114,4,0,0,0,114,5,0,0,0,114,207,0,0, - 0,126,3,0,0,115,4,0,0,0,0,1,12,1,122,26, - 69,120,116,101,110,115,105,111,110,70,105,108,101,76,111,97, - 100,101,114,46,95,95,101,113,95,95,99,1,0,0,0,0, - 0,0,0,1,0,0,0,3,0,0,0,67,0,0,0,115, - 20,0,0,0,116,0,124,0,106,1,131,1,116,0,124,0, - 106,2,131,1,65,0,83,0,41,1,78,41,3,114,208,0, - 0,0,114,98,0,0,0,114,35,0,0,0,41,1,114,100, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,114,209,0,0,0,130,3,0,0,115,2,0,0,0, - 0,1,122,28,69,120,116,101,110,115,105,111,110,70,105,108, - 101,76,111,97,100,101,114,46,95,95,104,97,115,104,95,95, - 99,2,0,0,0,0,0,0,0,3,0,0,0,4,0,0, - 0,67,0,0,0,115,36,0,0,0,116,0,106,1,116,2, - 106,3,124,1,131,2,125,2,116,0,106,4,100,1,124,1, - 106,5,124,0,106,6,131,3,1,0,124,2,83,0,41,2, - 122,38,67,114,101,97,116,101,32,97,110,32,117,110,105,116, - 105,97,108,105,122,101,100,32,101,120,116,101,110,115,105,111, - 110,32,109,111,100,117,108,101,122,38,101,120,116,101,110,115, - 105,111,110,32,109,111,100,117,108,101,32,123,33,114,125,32, - 108,111,97,100,101,100,32,102,114,111,109,32,123,33,114,125, - 41,7,114,114,0,0,0,114,182,0,0,0,114,139,0,0, - 0,90,14,99,114,101,97,116,101,95,100,121,110,97,109,105, - 99,114,129,0,0,0,114,98,0,0,0,114,35,0,0,0, - 41,3,114,100,0,0,0,114,158,0,0,0,114,184,0,0, - 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,180,0,0,0,133,3,0,0,115,10,0,0,0,0,2, - 4,1,10,1,6,1,12,1,122,33,69,120,116,101,110,115, - 105,111,110,70,105,108,101,76,111,97,100,101,114,46,99,114, - 101,97,116,101,95,109,111,100,117,108,101,99,2,0,0,0, + 41,2,122,42,85,115,101,32,100,101,102,97,117,108,116,32, + 115,101,109,97,110,116,105,99,115,32,102,111,114,32,109,111, + 100,117,108,101,32,99,114,101,97,116,105,111,110,46,78,114, + 4,0,0,0,41,2,114,100,0,0,0,114,158,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, + 180,0,0,0,250,3,0,0,115,0,0,0,0,122,30,95, + 78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,46, + 99,114,101,97,116,101,95,109,111,100,117,108,101,99,2,0, + 0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,0, + 0,0,115,4,0,0,0,100,0,83,0,41,1,78,114,4, + 0,0,0,41,2,114,100,0,0,0,114,184,0,0,0,114, + 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,185, + 0,0,0,253,3,0,0,115,2,0,0,0,0,1,122,28, + 95,78,97,109,101,115,112,97,99,101,76,111,97,100,101,114, + 46,101,120,101,99,95,109,111,100,117,108,101,99,2,0,0, + 0,0,0,0,0,2,0,0,0,3,0,0,0,67,0,0, + 0,115,26,0,0,0,116,0,106,1,100,1,124,0,106,2, + 131,2,1,0,116,0,106,3,124,0,124,1,131,2,83,0, + 41,2,122,98,76,111,97,100,32,97,32,110,97,109,101,115, + 112,97,99,101,32,109,111,100,117,108,101,46,10,10,32,32, + 32,32,32,32,32,32,84,104,105,115,32,109,101,116,104,111, + 100,32,105,115,32,100,101,112,114,101,99,97,116,101,100,46, + 32,32,85,115,101,32,101,120,101,99,95,109,111,100,117,108, + 101,40,41,32,105,110,115,116,101,97,100,46,10,10,32,32, + 32,32,32,32,32,32,122,38,110,97,109,101,115,112,97,99, + 101,32,109,111,100,117,108,101,32,108,111,97,100,101,100,32, + 119,105,116,104,32,112,97,116,104,32,123,33,114,125,41,4, + 114,114,0,0,0,114,129,0,0,0,114,226,0,0,0,114, + 186,0,0,0,41,2,114,100,0,0,0,114,119,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, + 187,0,0,0,0,4,0,0,115,6,0,0,0,0,7,6, + 1,8,1,122,28,95,78,97,109,101,115,112,97,99,101,76, + 111,97,100,101,114,46,108,111,97,100,95,109,111,100,117,108, + 101,78,41,12,114,105,0,0,0,114,104,0,0,0,114,106, + 0,0,0,114,179,0,0,0,114,177,0,0,0,114,244,0, + 0,0,114,153,0,0,0,114,196,0,0,0,114,181,0,0, + 0,114,180,0,0,0,114,185,0,0,0,114,187,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,4,0,0,0,114, + 5,0,0,0,114,243,0,0,0,228,3,0,0,115,16,0, + 0,0,8,1,8,3,12,9,8,3,8,3,8,3,8,3, + 8,3,114,243,0,0,0,99,0,0,0,0,0,0,0,0, + 0,0,0,0,5,0,0,0,64,0,0,0,115,108,0,0, + 0,101,0,90,1,100,0,90,2,100,1,90,3,101,4,100, + 2,100,3,132,0,131,1,90,5,101,4,100,4,100,5,132, + 0,131,1,90,6,101,4,100,6,100,7,132,0,131,1,90, + 7,101,4,100,8,100,9,132,0,131,1,90,8,101,4,100, + 10,100,11,100,12,132,1,131,1,90,9,101,4,100,10,100, + 10,100,13,100,14,132,2,131,1,90,10,101,4,100,10,100, + 15,100,16,132,1,131,1,90,11,100,10,83,0,41,17,218, + 10,80,97,116,104,70,105,110,100,101,114,122,62,77,101,116, + 97,32,112,97,116,104,32,102,105,110,100,101,114,32,102,111, + 114,32,115,121,115,46,112,97,116,104,32,97,110,100,32,112, + 97,99,107,97,103,101,32,95,95,112,97,116,104,95,95,32, + 97,116,116,114,105,98,117,116,101,115,46,99,1,0,0,0, 0,0,0,0,2,0,0,0,4,0,0,0,67,0,0,0, - 115,36,0,0,0,116,0,106,1,116,2,106,3,124,1,131, - 2,1,0,116,0,106,4,100,1,124,0,106,5,124,0,106, - 6,131,3,1,0,100,2,83,0,41,3,122,30,73,110,105, - 116,105,97,108,105,122,101,32,97,110,32,101,120,116,101,110, - 115,105,111,110,32,109,111,100,117,108,101,122,40,101,120,116, - 101,110,115,105,111,110,32,109,111,100,117,108,101,32,123,33, - 114,125,32,101,120,101,99,117,116,101,100,32,102,114,111,109, - 32,123,33,114,125,78,41,7,114,114,0,0,0,114,182,0, - 0,0,114,139,0,0,0,90,12,101,120,101,99,95,100,121, - 110,97,109,105,99,114,129,0,0,0,114,98,0,0,0,114, - 35,0,0,0,41,2,114,100,0,0,0,114,184,0,0,0, - 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 185,0,0,0,141,3,0,0,115,6,0,0,0,0,2,14, - 1,6,1,122,31,69,120,116,101,110,115,105,111,110,70,105, - 108,101,76,111,97,100,101,114,46,101,120,101,99,95,109,111, - 100,117,108,101,99,2,0,0,0,0,0,0,0,2,0,0, - 0,4,0,0,0,3,0,0,0,115,36,0,0,0,116,0, - 124,0,106,1,131,1,100,1,25,0,137,0,116,2,135,0, - 102,1,100,2,100,3,134,0,116,3,68,0,131,1,131,1, - 83,0,41,4,122,49,82,101,116,117,114,110,32,84,114,117, - 101,32,105,102,32,116,104,101,32,101,120,116,101,110,115,105, - 111,110,32,109,111,100,117,108,101,32,105,115,32,97,32,112, - 97,99,107,97,103,101,46,114,29,0,0,0,99,1,0,0, - 0,0,0,0,0,2,0,0,0,4,0,0,0,51,0,0, - 0,115,26,0,0,0,124,0,93,18,125,1,136,0,100,0, - 124,1,23,0,107,2,86,0,1,0,113,2,100,1,83,0, - 41,2,114,179,0,0,0,78,114,4,0,0,0,41,2,114, - 22,0,0,0,218,6,115,117,102,102,105,120,41,1,218,9, - 102,105,108,101,95,110,97,109,101,114,4,0,0,0,114,5, - 0,0,0,250,9,60,103,101,110,101,120,112,114,62,150,3, - 0,0,115,2,0,0,0,4,1,122,49,69,120,116,101,110, - 115,105,111,110,70,105,108,101,76,111,97,100,101,114,46,105, - 115,95,112,97,99,107,97,103,101,46,60,108,111,99,97,108, - 115,62,46,60,103,101,110,101,120,112,114,62,41,4,114,38, - 0,0,0,114,35,0,0,0,218,3,97,110,121,218,18,69, - 88,84,69,78,83,73,79,78,95,83,85,70,70,73,88,69, - 83,41,2,114,100,0,0,0,114,119,0,0,0,114,4,0, - 0,0,41,1,114,220,0,0,0,114,5,0,0,0,114,153, - 0,0,0,147,3,0,0,115,6,0,0,0,0,2,14,1, - 12,1,122,30,69,120,116,101,110,115,105,111,110,70,105,108, - 101,76,111,97,100,101,114,46,105,115,95,112,97,99,107,97, - 103,101,99,2,0,0,0,0,0,0,0,2,0,0,0,1, - 0,0,0,67,0,0,0,115,4,0,0,0,100,1,83,0, - 41,2,122,63,82,101,116,117,114,110,32,78,111,110,101,32, - 97,115,32,97,110,32,101,120,116,101,110,115,105,111,110,32, - 109,111,100,117,108,101,32,99,97,110,110,111,116,32,99,114, - 101,97,116,101,32,97,32,99,111,100,101,32,111,98,106,101, - 99,116,46,78,114,4,0,0,0,41,2,114,100,0,0,0, - 114,119,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,181,0,0,0,153,3,0,0,115,2,0, - 0,0,0,2,122,28,69,120,116,101,110,115,105,111,110,70, - 105,108,101,76,111,97,100,101,114,46,103,101,116,95,99,111, - 100,101,99,2,0,0,0,0,0,0,0,2,0,0,0,1, - 0,0,0,67,0,0,0,115,4,0,0,0,100,1,83,0, - 41,2,122,53,82,101,116,117,114,110,32,78,111,110,101,32, - 97,115,32,101,120,116,101,110,115,105,111,110,32,109,111,100, - 117,108,101,115,32,104,97,118,101,32,110,111,32,115,111,117, - 114,99,101,32,99,111,100,101,46,78,114,4,0,0,0,41, - 2,114,100,0,0,0,114,119,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,196,0,0,0,157, - 3,0,0,115,2,0,0,0,0,2,122,30,69,120,116,101, - 110,115,105,111,110,70,105,108,101,76,111,97,100,101,114,46, - 103,101,116,95,115,111,117,114,99,101,99,2,0,0,0,0, - 0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,115, - 6,0,0,0,124,0,106,0,83,0,41,1,122,58,82,101, - 116,117,114,110,32,116,104,101,32,112,97,116,104,32,116,111, - 32,116,104,101,32,115,111,117,114,99,101,32,102,105,108,101, - 32,97,115,32,102,111,117,110,100,32,98,121,32,116,104,101, - 32,102,105,110,100,101,114,46,41,1,114,35,0,0,0,41, - 2,114,100,0,0,0,114,119,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,151,0,0,0,161, - 3,0,0,115,2,0,0,0,0,3,122,32,69,120,116,101, - 110,115,105,111,110,70,105,108,101,76,111,97,100,101,114,46, - 103,101,116,95,102,105,108,101,110,97,109,101,78,41,14,114, - 105,0,0,0,114,104,0,0,0,114,106,0,0,0,114,107, - 0,0,0,114,179,0,0,0,114,207,0,0,0,114,209,0, - 0,0,114,180,0,0,0,114,185,0,0,0,114,153,0,0, - 0,114,181,0,0,0,114,196,0,0,0,114,116,0,0,0, - 114,151,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,218,0,0,0,114,3, - 0,0,115,20,0,0,0,8,6,4,2,8,4,8,4,8, - 3,8,8,8,6,8,6,8,4,8,4,114,218,0,0,0, - 99,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0, - 0,64,0,0,0,115,96,0,0,0,101,0,90,1,100,0, - 90,2,100,1,90,3,100,2,100,3,132,0,90,4,100,4, - 100,5,132,0,90,5,100,6,100,7,132,0,90,6,100,8, - 100,9,132,0,90,7,100,10,100,11,132,0,90,8,100,12, - 100,13,132,0,90,9,100,14,100,15,132,0,90,10,100,16, - 100,17,132,0,90,11,100,18,100,19,132,0,90,12,100,20, - 100,21,132,0,90,13,100,22,83,0,41,23,218,14,95,78, - 97,109,101,115,112,97,99,101,80,97,116,104,97,38,1,0, - 0,82,101,112,114,101,115,101,110,116,115,32,97,32,110,97, - 109,101,115,112,97,99,101,32,112,97,99,107,97,103,101,39, - 115,32,112,97,116,104,46,32,32,73,116,32,117,115,101,115, - 32,116,104,101,32,109,111,100,117,108,101,32,110,97,109,101, - 10,32,32,32,32,116,111,32,102,105,110,100,32,105,116,115, - 32,112,97,114,101,110,116,32,109,111,100,117,108,101,44,32, - 97,110,100,32,102,114,111,109,32,116,104,101,114,101,32,105, - 116,32,108,111,111,107,115,32,117,112,32,116,104,101,32,112, - 97,114,101,110,116,39,115,10,32,32,32,32,95,95,112,97, - 116,104,95,95,46,32,32,87,104,101,110,32,116,104,105,115, - 32,99,104,97,110,103,101,115,44,32,116,104,101,32,109,111, - 100,117,108,101,39,115,32,111,119,110,32,112,97,116,104,32, - 105,115,32,114,101,99,111,109,112,117,116,101,100,44,10,32, - 32,32,32,117,115,105,110,103,32,112,97,116,104,95,102,105, - 110,100,101,114,46,32,32,70,111,114,32,116,111,112,45,108, - 101,118,101,108,32,109,111,100,117,108,101,115,44,32,116,104, - 101,32,112,97,114,101,110,116,32,109,111,100,117,108,101,39, - 115,32,112,97,116,104,10,32,32,32,32,105,115,32,115,121, - 115,46,112,97,116,104,46,99,4,0,0,0,0,0,0,0, - 4,0,0,0,2,0,0,0,67,0,0,0,115,36,0,0, - 0,124,1,124,0,95,0,124,2,124,0,95,1,116,2,124, - 0,106,3,131,0,131,1,124,0,95,4,124,3,124,0,95, - 5,100,0,83,0,41,1,78,41,6,218,5,95,110,97,109, - 101,218,5,95,112,97,116,104,114,93,0,0,0,218,16,95, - 103,101,116,95,112,97,114,101,110,116,95,112,97,116,104,218, - 17,95,108,97,115,116,95,112,97,114,101,110,116,95,112,97, - 116,104,218,12,95,112,97,116,104,95,102,105,110,100,101,114, - 41,4,114,100,0,0,0,114,98,0,0,0,114,35,0,0, - 0,218,11,112,97,116,104,95,102,105,110,100,101,114,114,4, - 0,0,0,114,4,0,0,0,114,5,0,0,0,114,179,0, - 0,0,174,3,0,0,115,8,0,0,0,0,1,6,1,6, - 1,14,1,122,23,95,78,97,109,101,115,112,97,99,101,80, - 97,116,104,46,95,95,105,110,105,116,95,95,99,1,0,0, - 0,0,0,0,0,4,0,0,0,3,0,0,0,67,0,0, - 0,115,38,0,0,0,124,0,106,0,106,1,100,1,131,1, - 92,3,125,1,125,2,125,3,124,2,100,2,107,2,114,30, - 100,6,83,0,124,1,100,5,102,2,83,0,41,7,122,62, - 82,101,116,117,114,110,115,32,97,32,116,117,112,108,101,32, - 111,102,32,40,112,97,114,101,110,116,45,109,111,100,117,108, - 101,45,110,97,109,101,44,32,112,97,114,101,110,116,45,112, - 97,116,104,45,97,116,116,114,45,110,97,109,101,41,114,58, - 0,0,0,114,30,0,0,0,114,7,0,0,0,114,35,0, - 0,0,90,8,95,95,112,97,116,104,95,95,41,2,122,3, - 115,121,115,122,4,112,97,116,104,41,2,114,225,0,0,0, - 114,32,0,0,0,41,4,114,100,0,0,0,114,216,0,0, - 0,218,3,100,111,116,90,2,109,101,114,4,0,0,0,114, - 4,0,0,0,114,5,0,0,0,218,23,95,102,105,110,100, - 95,112,97,114,101,110,116,95,112,97,116,104,95,110,97,109, - 101,115,180,3,0,0,115,8,0,0,0,0,2,18,1,8, - 2,4,3,122,38,95,78,97,109,101,115,112,97,99,101,80, - 97,116,104,46,95,102,105,110,100,95,112,97,114,101,110,116, - 95,112,97,116,104,95,110,97,109,101,115,99,1,0,0,0, - 0,0,0,0,3,0,0,0,3,0,0,0,67,0,0,0, - 115,28,0,0,0,124,0,106,0,131,0,92,2,125,1,125, - 2,116,1,116,2,106,3,124,1,25,0,124,2,131,2,83, - 0,41,1,78,41,4,114,232,0,0,0,114,110,0,0,0, - 114,7,0,0,0,218,7,109,111,100,117,108,101,115,41,3, - 114,100,0,0,0,90,18,112,97,114,101,110,116,95,109,111, - 100,117,108,101,95,110,97,109,101,90,14,112,97,116,104,95, - 97,116,116,114,95,110,97,109,101,114,4,0,0,0,114,4, - 0,0,0,114,5,0,0,0,114,227,0,0,0,190,3,0, - 0,115,4,0,0,0,0,1,12,1,122,31,95,78,97,109, - 101,115,112,97,99,101,80,97,116,104,46,95,103,101,116,95, - 112,97,114,101,110,116,95,112,97,116,104,99,1,0,0,0, - 0,0,0,0,3,0,0,0,3,0,0,0,67,0,0,0, - 115,80,0,0,0,116,0,124,0,106,1,131,0,131,1,125, - 1,124,1,124,0,106,2,107,3,114,74,124,0,106,3,124, - 0,106,4,124,1,131,2,125,2,124,2,100,0,107,9,114, - 68,124,2,106,5,100,0,107,8,114,68,124,2,106,6,114, - 68,124,2,106,6,124,0,95,7,124,1,124,0,95,2,124, - 0,106,7,83,0,41,1,78,41,8,114,93,0,0,0,114, - 227,0,0,0,114,228,0,0,0,114,229,0,0,0,114,225, - 0,0,0,114,120,0,0,0,114,150,0,0,0,114,226,0, - 0,0,41,3,114,100,0,0,0,90,11,112,97,114,101,110, - 116,95,112,97,116,104,114,158,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,218,12,95,114,101,99, - 97,108,99,117,108,97,116,101,194,3,0,0,115,16,0,0, - 0,0,2,12,1,10,1,14,3,18,1,6,1,8,1,6, - 1,122,27,95,78,97,109,101,115,112,97,99,101,80,97,116, - 104,46,95,114,101,99,97,108,99,117,108,97,116,101,99,1, - 0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,67, - 0,0,0,115,12,0,0,0,116,0,124,0,106,1,131,0, - 131,1,83,0,41,1,78,41,2,218,4,105,116,101,114,114, - 234,0,0,0,41,1,114,100,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,218,8,95,95,105,116, - 101,114,95,95,207,3,0,0,115,2,0,0,0,0,1,122, - 23,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46, - 95,95,105,116,101,114,95,95,99,3,0,0,0,0,0,0, - 0,3,0,0,0,3,0,0,0,67,0,0,0,115,14,0, - 0,0,124,2,124,0,106,0,124,1,60,0,100,0,83,0, - 41,1,78,41,1,114,226,0,0,0,41,3,114,100,0,0, - 0,218,5,105,110,100,101,120,114,35,0,0,0,114,4,0, - 0,0,114,4,0,0,0,114,5,0,0,0,218,11,95,95, - 115,101,116,105,116,101,109,95,95,210,3,0,0,115,2,0, - 0,0,0,1,122,26,95,78,97,109,101,115,112,97,99,101, - 80,97,116,104,46,95,95,115,101,116,105,116,101,109,95,95, - 99,1,0,0,0,0,0,0,0,1,0,0,0,2,0,0, - 0,67,0,0,0,115,12,0,0,0,116,0,124,0,106,1, - 131,0,131,1,83,0,41,1,78,41,2,114,31,0,0,0, - 114,234,0,0,0,41,1,114,100,0,0,0,114,4,0,0, - 0,114,4,0,0,0,114,5,0,0,0,218,7,95,95,108, - 101,110,95,95,213,3,0,0,115,2,0,0,0,0,1,122, - 22,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46, - 95,95,108,101,110,95,95,99,1,0,0,0,0,0,0,0, + 115,42,0,0,0,120,36,116,0,106,1,106,2,131,0,68, + 0,93,22,125,1,116,3,124,1,100,1,131,2,114,12,124, + 1,106,4,131,0,1,0,113,12,87,0,100,2,83,0,41, + 3,122,125,67,97,108,108,32,116,104,101,32,105,110,118,97, + 108,105,100,97,116,101,95,99,97,99,104,101,115,40,41,32, + 109,101,116,104,111,100,32,111,110,32,97,108,108,32,112,97, + 116,104,32,101,110,116,114,121,32,102,105,110,100,101,114,115, + 10,32,32,32,32,32,32,32,32,115,116,111,114,101,100,32, + 105,110,32,115,121,115,46,112,97,116,104,95,105,109,112,111, + 114,116,101,114,95,99,97,99,104,101,115,32,40,119,104,101, + 114,101,32,105,109,112,108,101,109,101,110,116,101,100,41,46, + 218,17,105,110,118,97,108,105,100,97,116,101,95,99,97,99, + 104,101,115,78,41,5,114,7,0,0,0,218,19,112,97,116, + 104,95,105,109,112,111,114,116,101,114,95,99,97,99,104,101, + 218,6,118,97,108,117,101,115,114,108,0,0,0,114,246,0, + 0,0,41,2,114,164,0,0,0,218,6,102,105,110,100,101, + 114,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, + 114,246,0,0,0,18,4,0,0,115,6,0,0,0,0,4, + 16,1,10,1,122,28,80,97,116,104,70,105,110,100,101,114, + 46,105,110,118,97,108,105,100,97,116,101,95,99,97,99,104, + 101,115,99,2,0,0,0,0,0,0,0,3,0,0,0,12, + 0,0,0,67,0,0,0,115,86,0,0,0,116,0,106,1, + 100,1,107,9,114,30,116,0,106,1,12,0,114,30,116,2, + 106,3,100,2,116,4,131,2,1,0,120,50,116,0,106,1, + 68,0,93,36,125,2,121,8,124,2,124,1,131,1,83,0, + 4,0,116,5,107,10,114,72,1,0,1,0,1,0,119,38, + 89,0,113,38,88,0,113,38,87,0,100,1,83,0,100,1, + 83,0,41,3,122,113,83,101,97,114,99,104,32,115,101,113, + 117,101,110,99,101,32,111,102,32,104,111,111,107,115,32,102, + 111,114,32,97,32,102,105,110,100,101,114,32,102,111,114,32, + 39,112,97,116,104,39,46,10,10,32,32,32,32,32,32,32, + 32,73,102,32,39,104,111,111,107,115,39,32,105,115,32,102, + 97,108,115,101,32,116,104,101,110,32,117,115,101,32,115,121, + 115,46,112,97,116,104,95,104,111,111,107,115,46,10,10,32, + 32,32,32,32,32,32,32,78,122,23,115,121,115,46,112,97, + 116,104,95,104,111,111,107,115,32,105,115,32,101,109,112,116, + 121,41,6,114,7,0,0,0,218,10,112,97,116,104,95,104, + 111,111,107,115,114,60,0,0,0,114,61,0,0,0,114,118, + 0,0,0,114,99,0,0,0,41,3,114,164,0,0,0,114, + 35,0,0,0,90,4,104,111,111,107,114,4,0,0,0,114, + 4,0,0,0,114,5,0,0,0,218,11,95,112,97,116,104, + 95,104,111,111,107,115,26,4,0,0,115,16,0,0,0,0, + 7,18,1,12,1,12,1,2,1,8,1,14,1,12,2,122, + 22,80,97,116,104,70,105,110,100,101,114,46,95,112,97,116, + 104,95,104,111,111,107,115,99,2,0,0,0,0,0,0,0, + 3,0,0,0,19,0,0,0,67,0,0,0,115,102,0,0, + 0,124,1,100,1,107,2,114,42,121,12,116,0,106,1,131, + 0,125,1,87,0,110,20,4,0,116,2,107,10,114,40,1, + 0,1,0,1,0,100,2,83,0,88,0,121,14,116,3,106, + 4,124,1,25,0,125,2,87,0,110,40,4,0,116,5,107, + 10,114,96,1,0,1,0,1,0,124,0,106,6,124,1,131, + 1,125,2,124,2,116,3,106,4,124,1,60,0,89,0,110, + 2,88,0,124,2,83,0,41,3,122,210,71,101,116,32,116, + 104,101,32,102,105,110,100,101,114,32,102,111,114,32,116,104, + 101,32,112,97,116,104,32,101,110,116,114,121,32,102,114,111, + 109,32,115,121,115,46,112,97,116,104,95,105,109,112,111,114, + 116,101,114,95,99,97,99,104,101,46,10,10,32,32,32,32, + 32,32,32,32,73,102,32,116,104,101,32,112,97,116,104,32, + 101,110,116,114,121,32,105,115,32,110,111,116,32,105,110,32, + 116,104,101,32,99,97,99,104,101,44,32,102,105,110,100,32, + 116,104,101,32,97,112,112,114,111,112,114,105,97,116,101,32, + 102,105,110,100,101,114,10,32,32,32,32,32,32,32,32,97, + 110,100,32,99,97,99,104,101,32,105,116,46,32,73,102,32, + 110,111,32,102,105,110,100,101,114,32,105,115,32,97,118,97, + 105,108,97,98,108,101,44,32,115,116,111,114,101,32,78,111, + 110,101,46,10,10,32,32,32,32,32,32,32,32,114,30,0, + 0,0,78,41,7,114,3,0,0,0,114,45,0,0,0,218, + 17,70,105,108,101,78,111,116,70,111,117,110,100,69,114,114, + 111,114,114,7,0,0,0,114,247,0,0,0,114,131,0,0, + 0,114,251,0,0,0,41,3,114,164,0,0,0,114,35,0, + 0,0,114,249,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,5,0,0,0,218,20,95,112,97,116,104,95,105,109, + 112,111,114,116,101,114,95,99,97,99,104,101,43,4,0,0, + 115,22,0,0,0,0,8,8,1,2,1,12,1,14,3,6, + 1,2,1,14,1,14,1,10,1,16,1,122,31,80,97,116, + 104,70,105,110,100,101,114,46,95,112,97,116,104,95,105,109, + 112,111,114,116,101,114,95,99,97,99,104,101,99,3,0,0, + 0,0,0,0,0,6,0,0,0,3,0,0,0,67,0,0, + 0,115,82,0,0,0,116,0,124,2,100,1,131,2,114,26, + 124,2,106,1,124,1,131,1,92,2,125,3,125,4,110,14, + 124,2,106,2,124,1,131,1,125,3,103,0,125,4,124,3, + 100,0,107,9,114,60,116,3,106,4,124,1,124,3,131,2, + 83,0,116,3,106,5,124,1,100,0,131,2,125,5,124,4, + 124,5,95,6,124,5,83,0,41,2,78,114,117,0,0,0, + 41,7,114,108,0,0,0,114,117,0,0,0,114,176,0,0, + 0,114,114,0,0,0,114,173,0,0,0,114,154,0,0,0, + 114,150,0,0,0,41,6,114,164,0,0,0,114,119,0,0, + 0,114,249,0,0,0,114,120,0,0,0,114,121,0,0,0, + 114,158,0,0,0,114,4,0,0,0,114,4,0,0,0,114, + 5,0,0,0,218,16,95,108,101,103,97,99,121,95,103,101, + 116,95,115,112,101,99,65,4,0,0,115,18,0,0,0,0, + 4,10,1,16,2,10,1,4,1,8,1,12,1,12,1,6, + 1,122,27,80,97,116,104,70,105,110,100,101,114,46,95,108, + 101,103,97,99,121,95,103,101,116,95,115,112,101,99,78,99, + 4,0,0,0,0,0,0,0,9,0,0,0,5,0,0,0, + 67,0,0,0,115,170,0,0,0,103,0,125,4,120,160,124, + 2,68,0,93,130,125,5,116,0,124,5,116,1,116,2,102, + 2,131,2,115,30,113,10,124,0,106,3,124,5,131,1,125, + 6,124,6,100,1,107,9,114,10,116,4,124,6,100,2,131, + 2,114,72,124,6,106,5,124,1,124,3,131,2,125,7,110, + 12,124,0,106,6,124,1,124,6,131,2,125,7,124,7,100, + 1,107,8,114,94,113,10,124,7,106,7,100,1,107,9,114, + 108,124,7,83,0,124,7,106,8,125,8,124,8,100,1,107, + 8,114,130,116,9,100,3,131,1,130,1,124,4,106,10,124, + 8,131,1,1,0,113,10,87,0,116,11,106,12,124,1,100, + 1,131,2,125,7,124,4,124,7,95,8,124,7,83,0,100, + 1,83,0,41,4,122,63,70,105,110,100,32,116,104,101,32, + 108,111,97,100,101,114,32,111,114,32,110,97,109,101,115,112, + 97,99,101,95,112,97,116,104,32,102,111,114,32,116,104,105, + 115,32,109,111,100,117,108,101,47,112,97,99,107,97,103,101, + 32,110,97,109,101,46,78,114,175,0,0,0,122,19,115,112, + 101,99,32,109,105,115,115,105,110,103,32,108,111,97,100,101, + 114,41,13,114,137,0,0,0,114,69,0,0,0,218,5,98, + 121,116,101,115,114,253,0,0,0,114,108,0,0,0,114,175, + 0,0,0,114,254,0,0,0,114,120,0,0,0,114,150,0, + 0,0,114,99,0,0,0,114,143,0,0,0,114,114,0,0, + 0,114,154,0,0,0,41,9,114,164,0,0,0,114,119,0, + 0,0,114,35,0,0,0,114,174,0,0,0,218,14,110,97, + 109,101,115,112,97,99,101,95,112,97,116,104,90,5,101,110, + 116,114,121,114,249,0,0,0,114,158,0,0,0,114,121,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, + 0,218,9,95,103,101,116,95,115,112,101,99,80,4,0,0, + 115,40,0,0,0,0,5,4,1,10,1,14,1,2,1,10, + 1,8,1,10,1,14,2,12,1,8,1,2,1,10,1,4, + 1,6,1,8,1,8,5,14,2,12,1,6,1,122,20,80, + 97,116,104,70,105,110,100,101,114,46,95,103,101,116,95,115, + 112,101,99,99,4,0,0,0,0,0,0,0,6,0,0,0, + 4,0,0,0,67,0,0,0,115,104,0,0,0,124,2,100, + 1,107,8,114,14,116,0,106,1,125,2,124,0,106,2,124, + 1,124,2,124,3,131,3,125,4,124,4,100,1,107,8,114, + 42,100,1,83,0,110,58,124,4,106,3,100,1,107,8,114, + 96,124,4,106,4,125,5,124,5,114,90,100,2,124,4,95, + 5,116,6,124,1,124,5,124,0,106,2,131,3,124,4,95, + 4,124,4,83,0,113,100,100,1,83,0,110,4,124,4,83, + 0,100,1,83,0,41,3,122,98,102,105,110,100,32,116,104, + 101,32,109,111,100,117,108,101,32,111,110,32,115,121,115,46, + 112,97,116,104,32,111,114,32,39,112,97,116,104,39,32,98, + 97,115,101,100,32,111,110,32,115,121,115,46,112,97,116,104, + 95,104,111,111,107,115,32,97,110,100,10,32,32,32,32,32, + 32,32,32,115,121,115,46,112,97,116,104,95,105,109,112,111, + 114,116,101,114,95,99,97,99,104,101,46,78,90,9,110,97, + 109,101,115,112,97,99,101,41,7,114,7,0,0,0,114,35, + 0,0,0,114,1,1,0,0,114,120,0,0,0,114,150,0, + 0,0,114,152,0,0,0,114,224,0,0,0,41,6,114,164, + 0,0,0,114,119,0,0,0,114,35,0,0,0,114,174,0, + 0,0,114,158,0,0,0,114,0,1,0,0,114,4,0,0, + 0,114,4,0,0,0,114,5,0,0,0,114,175,0,0,0, + 112,4,0,0,115,26,0,0,0,0,4,8,1,6,1,14, + 1,8,1,6,1,10,1,6,1,4,3,6,1,16,1,6, + 2,6,2,122,20,80,97,116,104,70,105,110,100,101,114,46, + 102,105,110,100,95,115,112,101,99,99,3,0,0,0,0,0, + 0,0,4,0,0,0,3,0,0,0,67,0,0,0,115,30, + 0,0,0,124,0,106,0,124,1,124,2,131,2,125,3,124, + 3,100,1,107,8,114,24,100,1,83,0,124,3,106,1,83, + 0,41,2,122,170,102,105,110,100,32,116,104,101,32,109,111, + 100,117,108,101,32,111,110,32,115,121,115,46,112,97,116,104, + 32,111,114,32,39,112,97,116,104,39,32,98,97,115,101,100, + 32,111,110,32,115,121,115,46,112,97,116,104,95,104,111,111, + 107,115,32,97,110,100,10,32,32,32,32,32,32,32,32,115, + 121,115,46,112,97,116,104,95,105,109,112,111,114,116,101,114, + 95,99,97,99,104,101,46,10,10,32,32,32,32,32,32,32, + 32,84,104,105,115,32,109,101,116,104,111,100,32,105,115,32, + 100,101,112,114,101,99,97,116,101,100,46,32,32,85,115,101, + 32,102,105,110,100,95,115,112,101,99,40,41,32,105,110,115, + 116,101,97,100,46,10,10,32,32,32,32,32,32,32,32,78, + 41,2,114,175,0,0,0,114,120,0,0,0,41,4,114,164, + 0,0,0,114,119,0,0,0,114,35,0,0,0,114,158,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, + 0,114,176,0,0,0,134,4,0,0,115,8,0,0,0,0, + 8,12,1,8,1,4,1,122,22,80,97,116,104,70,105,110, + 100,101,114,46,102,105,110,100,95,109,111,100,117,108,101,41, + 12,114,105,0,0,0,114,104,0,0,0,114,106,0,0,0, + 114,107,0,0,0,114,177,0,0,0,114,246,0,0,0,114, + 251,0,0,0,114,253,0,0,0,114,254,0,0,0,114,1, + 1,0,0,114,175,0,0,0,114,176,0,0,0,114,4,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, + 0,114,245,0,0,0,14,4,0,0,115,22,0,0,0,8, + 2,4,2,12,8,12,17,12,22,12,15,2,1,12,31,2, + 1,14,21,2,1,114,245,0,0,0,99,0,0,0,0,0, + 0,0,0,0,0,0,0,3,0,0,0,64,0,0,0,115, + 90,0,0,0,101,0,90,1,100,0,90,2,100,1,90,3, + 100,2,100,3,132,0,90,4,100,4,100,5,132,0,90,5, + 101,6,90,7,100,6,100,7,132,0,90,8,100,8,100,9, + 132,0,90,9,100,10,100,11,100,12,132,1,90,10,100,13, + 100,14,132,0,90,11,101,12,100,15,100,16,132,0,131,1, + 90,13,100,17,100,18,132,0,90,14,100,10,83,0,41,19, + 218,10,70,105,108,101,70,105,110,100,101,114,122,172,70,105, + 108,101,45,98,97,115,101,100,32,102,105,110,100,101,114,46, + 10,10,32,32,32,32,73,110,116,101,114,97,99,116,105,111, + 110,115,32,119,105,116,104,32,116,104,101,32,102,105,108,101, + 32,115,121,115,116,101,109,32,97,114,101,32,99,97,99,104, + 101,100,32,102,111,114,32,112,101,114,102,111,114,109,97,110, + 99,101,44,32,98,101,105,110,103,10,32,32,32,32,114,101, + 102,114,101,115,104,101,100,32,119,104,101,110,32,116,104,101, + 32,100,105,114,101,99,116,111,114,121,32,116,104,101,32,102, + 105,110,100,101,114,32,105,115,32,104,97,110,100,108,105,110, + 103,32,104,97,115,32,98,101,101,110,32,109,111,100,105,102, + 105,101,100,46,10,10,32,32,32,32,99,2,0,0,0,0, + 0,0,0,5,0,0,0,5,0,0,0,7,0,0,0,115, + 88,0,0,0,103,0,125,3,120,40,124,2,68,0,93,32, + 92,2,137,0,125,4,124,3,106,0,135,0,102,1,100,1, + 100,2,134,0,124,4,68,0,131,1,131,1,1,0,113,10, + 87,0,124,3,124,0,95,1,124,1,112,58,100,3,124,0, + 95,2,100,6,124,0,95,3,116,4,131,0,124,0,95,5, + 116,4,131,0,124,0,95,6,100,5,83,0,41,7,122,154, + 73,110,105,116,105,97,108,105,122,101,32,119,105,116,104,32, + 116,104,101,32,112,97,116,104,32,116,111,32,115,101,97,114, + 99,104,32,111,110,32,97,110,100,32,97,32,118,97,114,105, + 97,98,108,101,32,110,117,109,98,101,114,32,111,102,10,32, + 32,32,32,32,32,32,32,50,45,116,117,112,108,101,115,32, + 99,111,110,116,97,105,110,105,110,103,32,116,104,101,32,108, + 111,97,100,101,114,32,97,110,100,32,116,104,101,32,102,105, + 108,101,32,115,117,102,102,105,120,101,115,32,116,104,101,32, + 108,111,97,100,101,114,10,32,32,32,32,32,32,32,32,114, + 101,99,111,103,110,105,122,101,115,46,99,1,0,0,0,0, + 0,0,0,2,0,0,0,3,0,0,0,51,0,0,0,115, + 22,0,0,0,124,0,93,14,125,1,124,1,136,0,102,2, + 86,0,1,0,113,2,100,0,83,0,41,1,78,114,4,0, + 0,0,41,2,114,22,0,0,0,114,219,0,0,0,41,1, + 114,120,0,0,0,114,4,0,0,0,114,5,0,0,0,114, + 221,0,0,0,163,4,0,0,115,2,0,0,0,4,0,122, + 38,70,105,108,101,70,105,110,100,101,114,46,95,95,105,110, + 105,116,95,95,46,60,108,111,99,97,108,115,62,46,60,103, + 101,110,101,120,112,114,62,114,58,0,0,0,114,29,0,0, + 0,78,114,87,0,0,0,41,7,114,143,0,0,0,218,8, + 95,108,111,97,100,101,114,115,114,35,0,0,0,218,11,95, + 112,97,116,104,95,109,116,105,109,101,218,3,115,101,116,218, + 11,95,112,97,116,104,95,99,97,99,104,101,218,19,95,114, + 101,108,97,120,101,100,95,112,97,116,104,95,99,97,99,104, + 101,41,5,114,100,0,0,0,114,35,0,0,0,218,14,108, + 111,97,100,101,114,95,100,101,116,97,105,108,115,90,7,108, + 111,97,100,101,114,115,114,160,0,0,0,114,4,0,0,0, + 41,1,114,120,0,0,0,114,5,0,0,0,114,179,0,0, + 0,157,4,0,0,115,16,0,0,0,0,4,4,1,14,1, + 28,1,6,2,10,1,6,1,8,1,122,19,70,105,108,101, + 70,105,110,100,101,114,46,95,95,105,110,105,116,95,95,99, + 1,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0, + 67,0,0,0,115,10,0,0,0,100,3,124,0,95,0,100, + 2,83,0,41,4,122,31,73,110,118,97,108,105,100,97,116, + 101,32,116,104,101,32,100,105,114,101,99,116,111,114,121,32, + 109,116,105,109,101,46,114,29,0,0,0,78,114,87,0,0, + 0,41,1,114,4,1,0,0,41,1,114,100,0,0,0,114, + 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,246, + 0,0,0,171,4,0,0,115,2,0,0,0,0,2,122,28, + 70,105,108,101,70,105,110,100,101,114,46,105,110,118,97,108, + 105,100,97,116,101,95,99,97,99,104,101,115,99,2,0,0, + 0,0,0,0,0,3,0,0,0,2,0,0,0,67,0,0, + 0,115,42,0,0,0,124,0,106,0,124,1,131,1,125,2, + 124,2,100,1,107,8,114,26,100,1,103,0,102,2,83,0, + 124,2,106,1,124,2,106,2,112,38,103,0,102,2,83,0, + 41,2,122,197,84,114,121,32,116,111,32,102,105,110,100,32, + 97,32,108,111,97,100,101,114,32,102,111,114,32,116,104,101, + 32,115,112,101,99,105,102,105,101,100,32,109,111,100,117,108, + 101,44,32,111,114,32,116,104,101,32,110,97,109,101,115,112, + 97,99,101,10,32,32,32,32,32,32,32,32,112,97,99,107, + 97,103,101,32,112,111,114,116,105,111,110,115,46,32,82,101, + 116,117,114,110,115,32,40,108,111,97,100,101,114,44,32,108, + 105,115,116,45,111,102,45,112,111,114,116,105,111,110,115,41, + 46,10,10,32,32,32,32,32,32,32,32,84,104,105,115,32, + 109,101,116,104,111,100,32,105,115,32,100,101,112,114,101,99, + 97,116,101,100,46,32,32,85,115,101,32,102,105,110,100,95, + 115,112,101,99,40,41,32,105,110,115,116,101,97,100,46,10, + 10,32,32,32,32,32,32,32,32,78,41,3,114,175,0,0, + 0,114,120,0,0,0,114,150,0,0,0,41,3,114,100,0, + 0,0,114,119,0,0,0,114,158,0,0,0,114,4,0,0, + 0,114,4,0,0,0,114,5,0,0,0,114,117,0,0,0, + 177,4,0,0,115,8,0,0,0,0,7,10,1,8,1,8, + 1,122,22,70,105,108,101,70,105,110,100,101,114,46,102,105, + 110,100,95,108,111,97,100,101,114,99,6,0,0,0,0,0, + 0,0,7,0,0,0,7,0,0,0,67,0,0,0,115,30, + 0,0,0,124,1,124,2,124,3,131,2,125,6,116,0,124, + 2,124,3,100,1,124,6,100,2,124,4,144,2,131,2,83, + 0,41,3,78,114,120,0,0,0,114,150,0,0,0,41,1, + 114,161,0,0,0,41,7,114,100,0,0,0,114,159,0,0, + 0,114,119,0,0,0,114,35,0,0,0,90,4,115,109,115, + 108,114,174,0,0,0,114,120,0,0,0,114,4,0,0,0, + 114,4,0,0,0,114,5,0,0,0,114,1,1,0,0,189, + 4,0,0,115,6,0,0,0,0,1,10,1,12,1,122,20, + 70,105,108,101,70,105,110,100,101,114,46,95,103,101,116,95, + 115,112,101,99,78,99,3,0,0,0,0,0,0,0,14,0, + 0,0,15,0,0,0,67,0,0,0,115,100,1,0,0,100, + 1,125,3,124,1,106,0,100,2,131,1,100,3,25,0,125, + 4,121,24,116,1,124,0,106,2,112,34,116,3,106,4,131, + 0,131,1,106,5,125,5,87,0,110,24,4,0,116,6,107, + 10,114,66,1,0,1,0,1,0,100,10,125,5,89,0,110, + 2,88,0,124,5,124,0,106,7,107,3,114,92,124,0,106, + 8,131,0,1,0,124,5,124,0,95,7,116,9,131,0,114, + 114,124,0,106,10,125,6,124,4,106,11,131,0,125,7,110, + 10,124,0,106,12,125,6,124,4,125,7,124,7,124,6,107, + 6,114,218,116,13,124,0,106,2,124,4,131,2,125,8,120, + 72,124,0,106,14,68,0,93,54,92,2,125,9,125,10,100, + 5,124,9,23,0,125,11,116,13,124,8,124,11,131,2,125, + 12,116,15,124,12,131,1,114,152,124,0,106,16,124,10,124, + 1,124,12,124,8,103,1,124,2,131,5,83,0,113,152,87, + 0,116,17,124,8,131,1,125,3,120,90,124,0,106,14,68, + 0,93,80,92,2,125,9,125,10,116,13,124,0,106,2,124, + 4,124,9,23,0,131,2,125,12,116,18,106,19,100,6,124, + 12,100,7,100,3,144,1,131,2,1,0,124,7,124,9,23, + 0,124,6,107,6,114,226,116,15,124,12,131,1,114,226,124, + 0,106,16,124,10,124,1,124,12,100,8,124,2,131,5,83, + 0,113,226,87,0,124,3,144,1,114,96,116,18,106,19,100, + 9,124,8,131,2,1,0,116,18,106,20,124,1,100,8,131, + 2,125,13,124,8,103,1,124,13,95,21,124,13,83,0,100, + 8,83,0,41,11,122,102,84,114,121,32,116,111,32,102,105, + 110,100,32,97,32,115,112,101,99,32,102,111,114,32,116,104, + 101,32,115,112,101,99,105,102,105,101,100,32,109,111,100,117, + 108,101,46,32,32,82,101,116,117,114,110,115,32,116,104,101, + 10,32,32,32,32,32,32,32,32,109,97,116,99,104,105,110, + 103,32,115,112,101,99,44,32,111,114,32,78,111,110,101,32, + 105,102,32,110,111,116,32,102,111,117,110,100,46,70,114,58, + 0,0,0,114,56,0,0,0,114,29,0,0,0,114,179,0, + 0,0,122,9,116,114,121,105,110,103,32,123,125,90,9,118, + 101,114,98,111,115,105,116,121,78,122,25,112,111,115,115,105, + 98,108,101,32,110,97,109,101,115,112,97,99,101,32,102,111, + 114,32,123,125,114,87,0,0,0,41,22,114,32,0,0,0, + 114,39,0,0,0,114,35,0,0,0,114,3,0,0,0,114, + 45,0,0,0,114,213,0,0,0,114,40,0,0,0,114,4, + 1,0,0,218,11,95,102,105,108,108,95,99,97,99,104,101, + 114,6,0,0,0,114,7,1,0,0,114,88,0,0,0,114, + 6,1,0,0,114,28,0,0,0,114,3,1,0,0,114,44, + 0,0,0,114,1,1,0,0,114,46,0,0,0,114,114,0, + 0,0,114,129,0,0,0,114,154,0,0,0,114,150,0,0, + 0,41,14,114,100,0,0,0,114,119,0,0,0,114,174,0, + 0,0,90,12,105,115,95,110,97,109,101,115,112,97,99,101, + 90,11,116,97,105,108,95,109,111,100,117,108,101,114,126,0, + 0,0,90,5,99,97,99,104,101,90,12,99,97,99,104,101, + 95,109,111,100,117,108,101,90,9,98,97,115,101,95,112,97, + 116,104,114,219,0,0,0,114,159,0,0,0,90,13,105,110, + 105,116,95,102,105,108,101,110,97,109,101,90,9,102,117,108, + 108,95,112,97,116,104,114,158,0,0,0,114,4,0,0,0, + 114,4,0,0,0,114,5,0,0,0,114,175,0,0,0,194, + 4,0,0,115,70,0,0,0,0,3,4,1,14,1,2,1, + 24,1,14,1,10,1,10,1,8,1,6,2,6,1,6,1, + 10,2,6,1,4,2,8,1,12,1,16,1,8,1,10,1, + 8,1,24,4,8,2,16,1,16,1,18,1,12,1,8,1, + 10,1,12,1,6,1,12,1,12,1,8,1,4,1,122,20, + 70,105,108,101,70,105,110,100,101,114,46,102,105,110,100,95, + 115,112,101,99,99,1,0,0,0,0,0,0,0,9,0,0, + 0,13,0,0,0,67,0,0,0,115,194,0,0,0,124,0, + 106,0,125,1,121,22,116,1,106,2,124,1,112,22,116,1, + 106,3,131,0,131,1,125,2,87,0,110,30,4,0,116,4, + 116,5,116,6,102,3,107,10,114,58,1,0,1,0,1,0, + 103,0,125,2,89,0,110,2,88,0,116,7,106,8,106,9, + 100,1,131,1,115,84,116,10,124,2,131,1,124,0,95,11, + 110,78,116,10,131,0,125,3,120,64,124,2,68,0,93,56, + 125,4,124,4,106,12,100,2,131,1,92,3,125,5,125,6, + 125,7,124,6,114,138,100,3,106,13,124,5,124,7,106,14, + 131,0,131,2,125,8,110,4,124,5,125,8,124,3,106,15, + 124,8,131,1,1,0,113,96,87,0,124,3,124,0,95,11, + 116,7,106,8,106,9,116,16,131,1,114,190,100,4,100,5, + 132,0,124,2,68,0,131,1,124,0,95,17,100,6,83,0, + 41,7,122,68,70,105,108,108,32,116,104,101,32,99,97,99, + 104,101,32,111,102,32,112,111,116,101,110,116,105,97,108,32, + 109,111,100,117,108,101,115,32,97,110,100,32,112,97,99,107, + 97,103,101,115,32,102,111,114,32,116,104,105,115,32,100,105, + 114,101,99,116,111,114,121,46,114,0,0,0,0,114,58,0, + 0,0,122,5,123,125,46,123,125,99,1,0,0,0,0,0, + 0,0,2,0,0,0,3,0,0,0,83,0,0,0,115,20, + 0,0,0,104,0,124,0,93,12,125,1,124,1,106,0,131, + 0,146,2,113,4,83,0,114,4,0,0,0,41,1,114,88, + 0,0,0,41,2,114,22,0,0,0,90,2,102,110,114,4, + 0,0,0,114,4,0,0,0,114,5,0,0,0,250,9,60, + 115,101,116,99,111,109,112,62,13,5,0,0,115,2,0,0, + 0,6,0,122,41,70,105,108,101,70,105,110,100,101,114,46, + 95,102,105,108,108,95,99,97,99,104,101,46,60,108,111,99, + 97,108,115,62,46,60,115,101,116,99,111,109,112,62,78,41, + 18,114,35,0,0,0,114,3,0,0,0,90,7,108,105,115, + 116,100,105,114,114,45,0,0,0,114,252,0,0,0,218,15, + 80,101,114,109,105,115,115,105,111,110,69,114,114,111,114,218, + 18,78,111,116,65,68,105,114,101,99,116,111,114,121,69,114, + 114,111,114,114,7,0,0,0,114,8,0,0,0,114,9,0, + 0,0,114,5,1,0,0,114,6,1,0,0,114,83,0,0, + 0,114,47,0,0,0,114,88,0,0,0,218,3,97,100,100, + 114,10,0,0,0,114,7,1,0,0,41,9,114,100,0,0, + 0,114,35,0,0,0,90,8,99,111,110,116,101,110,116,115, + 90,21,108,111,119,101,114,95,115,117,102,102,105,120,95,99, + 111,110,116,101,110,116,115,114,241,0,0,0,114,98,0,0, + 0,114,231,0,0,0,114,219,0,0,0,90,8,110,101,119, + 95,110,97,109,101,114,4,0,0,0,114,4,0,0,0,114, + 5,0,0,0,114,9,1,0,0,240,4,0,0,115,34,0, + 0,0,0,2,6,1,2,1,22,1,20,3,10,3,12,1, + 12,7,6,1,10,1,16,1,4,1,18,2,4,1,14,1, + 6,1,12,1,122,22,70,105,108,101,70,105,110,100,101,114, + 46,95,102,105,108,108,95,99,97,99,104,101,99,1,0,0, + 0,0,0,0,0,3,0,0,0,3,0,0,0,7,0,0, + 0,115,18,0,0,0,135,0,135,1,102,2,100,1,100,2, + 134,0,125,2,124,2,83,0,41,3,97,20,1,0,0,65, + 32,99,108,97,115,115,32,109,101,116,104,111,100,32,119,104, + 105,99,104,32,114,101,116,117,114,110,115,32,97,32,99,108, + 111,115,117,114,101,32,116,111,32,117,115,101,32,111,110,32, + 115,121,115,46,112,97,116,104,95,104,111,111,107,10,32,32, + 32,32,32,32,32,32,119,104,105,99,104,32,119,105,108,108, + 32,114,101,116,117,114,110,32,97,110,32,105,110,115,116,97, + 110,99,101,32,117,115,105,110,103,32,116,104,101,32,115,112, + 101,99,105,102,105,101,100,32,108,111,97,100,101,114,115,32, + 97,110,100,32,116,104,101,32,112,97,116,104,10,32,32,32, + 32,32,32,32,32,99,97,108,108,101,100,32,111,110,32,116, + 104,101,32,99,108,111,115,117,114,101,46,10,10,32,32,32, + 32,32,32,32,32,73,102,32,116,104,101,32,112,97,116,104, + 32,99,97,108,108,101,100,32,111,110,32,116,104,101,32,99, + 108,111,115,117,114,101,32,105,115,32,110,111,116,32,97,32, + 100,105,114,101,99,116,111,114,121,44,32,73,109,112,111,114, + 116,69,114,114,111,114,32,105,115,10,32,32,32,32,32,32, + 32,32,114,97,105,115,101,100,46,10,10,32,32,32,32,32, + 32,32,32,99,1,0,0,0,0,0,0,0,1,0,0,0, + 4,0,0,0,19,0,0,0,115,32,0,0,0,116,0,124, + 0,131,1,115,22,116,1,100,1,100,2,124,0,144,1,131, + 1,130,1,136,0,124,0,136,1,140,1,83,0,41,3,122, + 45,80,97,116,104,32,104,111,111,107,32,102,111,114,32,105, + 109,112,111,114,116,108,105,98,46,109,97,99,104,105,110,101, + 114,121,46,70,105,108,101,70,105,110,100,101,114,46,122,30, + 111,110,108,121,32,100,105,114,101,99,116,111,114,105,101,115, + 32,97,114,101,32,115,117,112,112,111,114,116,101,100,114,35, + 0,0,0,41,2,114,46,0,0,0,114,99,0,0,0,41, + 1,114,35,0,0,0,41,2,114,164,0,0,0,114,8,1, + 0,0,114,4,0,0,0,114,5,0,0,0,218,24,112,97, + 116,104,95,104,111,111,107,95,102,111,114,95,70,105,108,101, + 70,105,110,100,101,114,25,5,0,0,115,6,0,0,0,0, + 2,8,1,14,1,122,54,70,105,108,101,70,105,110,100,101, + 114,46,112,97,116,104,95,104,111,111,107,46,60,108,111,99, + 97,108,115,62,46,112,97,116,104,95,104,111,111,107,95,102, + 111,114,95,70,105,108,101,70,105,110,100,101,114,114,4,0, + 0,0,41,3,114,164,0,0,0,114,8,1,0,0,114,14, + 1,0,0,114,4,0,0,0,41,2,114,164,0,0,0,114, + 8,1,0,0,114,5,0,0,0,218,9,112,97,116,104,95, + 104,111,111,107,15,5,0,0,115,4,0,0,0,0,10,14, + 6,122,20,70,105,108,101,70,105,110,100,101,114,46,112,97, + 116,104,95,104,111,111,107,99,1,0,0,0,0,0,0,0, 1,0,0,0,2,0,0,0,67,0,0,0,115,12,0,0, 0,100,1,106,0,124,0,106,1,131,1,83,0,41,2,78, - 122,20,95,78,97,109,101,115,112,97,99,101,80,97,116,104, - 40,123,33,114,125,41,41,2,114,47,0,0,0,114,226,0, - 0,0,41,1,114,100,0,0,0,114,4,0,0,0,114,4, - 0,0,0,114,5,0,0,0,218,8,95,95,114,101,112,114, - 95,95,216,3,0,0,115,2,0,0,0,0,1,122,23,95, - 78,97,109,101,115,112,97,99,101,80,97,116,104,46,95,95, - 114,101,112,114,95,95,99,2,0,0,0,0,0,0,0,2, - 0,0,0,2,0,0,0,67,0,0,0,115,12,0,0,0, - 124,1,124,0,106,0,131,0,107,6,83,0,41,1,78,41, - 1,114,234,0,0,0,41,2,114,100,0,0,0,218,4,105, - 116,101,109,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,218,12,95,95,99,111,110,116,97,105,110,115,95,95, - 219,3,0,0,115,2,0,0,0,0,1,122,27,95,78,97, - 109,101,115,112,97,99,101,80,97,116,104,46,95,95,99,111, - 110,116,97,105,110,115,95,95,99,2,0,0,0,0,0,0, - 0,2,0,0,0,2,0,0,0,67,0,0,0,115,16,0, - 0,0,124,0,106,0,106,1,124,1,131,1,1,0,100,0, - 83,0,41,1,78,41,2,114,226,0,0,0,114,157,0,0, - 0,41,2,114,100,0,0,0,114,241,0,0,0,114,4,0, - 0,0,114,4,0,0,0,114,5,0,0,0,114,157,0,0, - 0,222,3,0,0,115,2,0,0,0,0,1,122,21,95,78, - 97,109,101,115,112,97,99,101,80,97,116,104,46,97,112,112, - 101,110,100,78,41,14,114,105,0,0,0,114,104,0,0,0, - 114,106,0,0,0,114,107,0,0,0,114,179,0,0,0,114, - 232,0,0,0,114,227,0,0,0,114,234,0,0,0,114,236, - 0,0,0,114,238,0,0,0,114,239,0,0,0,114,240,0, - 0,0,114,242,0,0,0,114,157,0,0,0,114,4,0,0, - 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,224,0,0,0,167,3,0,0,115,22,0,0,0,8,5, - 4,2,8,6,8,10,8,4,8,13,8,3,8,3,8,3, - 8,3,8,3,114,224,0,0,0,99,0,0,0,0,0,0, - 0,0,0,0,0,0,3,0,0,0,64,0,0,0,115,80, - 0,0,0,101,0,90,1,100,0,90,2,100,1,100,2,132, - 0,90,3,101,4,100,3,100,4,132,0,131,1,90,5,100, - 5,100,6,132,0,90,6,100,7,100,8,132,0,90,7,100, - 9,100,10,132,0,90,8,100,11,100,12,132,0,90,9,100, - 13,100,14,132,0,90,10,100,15,100,16,132,0,90,11,100, - 17,83,0,41,18,218,16,95,78,97,109,101,115,112,97,99, - 101,76,111,97,100,101,114,99,4,0,0,0,0,0,0,0, - 4,0,0,0,4,0,0,0,67,0,0,0,115,18,0,0, - 0,116,0,124,1,124,2,124,3,131,3,124,0,95,1,100, - 0,83,0,41,1,78,41,2,114,224,0,0,0,114,226,0, - 0,0,41,4,114,100,0,0,0,114,98,0,0,0,114,35, - 0,0,0,114,230,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,114,179,0,0,0,228,3,0,0, - 115,2,0,0,0,0,1,122,25,95,78,97,109,101,115,112, - 97,99,101,76,111,97,100,101,114,46,95,95,105,110,105,116, - 95,95,99,2,0,0,0,0,0,0,0,2,0,0,0,2, - 0,0,0,67,0,0,0,115,12,0,0,0,100,1,106,0, - 124,1,106,1,131,1,83,0,41,2,122,115,82,101,116,117, - 114,110,32,114,101,112,114,32,102,111,114,32,116,104,101,32, - 109,111,100,117,108,101,46,10,10,32,32,32,32,32,32,32, - 32,84,104,101,32,109,101,116,104,111,100,32,105,115,32,100, - 101,112,114,101,99,97,116,101,100,46,32,32,84,104,101,32, - 105,109,112,111,114,116,32,109,97,99,104,105,110,101,114,121, - 32,100,111,101,115,32,116,104,101,32,106,111,98,32,105,116, - 115,101,108,102,46,10,10,32,32,32,32,32,32,32,32,122, - 25,60,109,111,100,117,108,101,32,123,33,114,125,32,40,110, - 97,109,101,115,112,97,99,101,41,62,41,2,114,47,0,0, - 0,114,105,0,0,0,41,2,114,164,0,0,0,114,184,0, - 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,218,11,109,111,100,117,108,101,95,114,101,112,114,231,3, - 0,0,115,2,0,0,0,0,7,122,28,95,78,97,109,101, - 115,112,97,99,101,76,111,97,100,101,114,46,109,111,100,117, - 108,101,95,114,101,112,114,99,2,0,0,0,0,0,0,0, - 2,0,0,0,1,0,0,0,67,0,0,0,115,4,0,0, - 0,100,1,83,0,41,2,78,84,114,4,0,0,0,41,2, - 114,100,0,0,0,114,119,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,153,0,0,0,240,3, - 0,0,115,2,0,0,0,0,1,122,27,95,78,97,109,101, - 115,112,97,99,101,76,111,97,100,101,114,46,105,115,95,112, - 97,99,107,97,103,101,99,2,0,0,0,0,0,0,0,2, - 0,0,0,1,0,0,0,67,0,0,0,115,4,0,0,0, - 100,1,83,0,41,2,78,114,30,0,0,0,114,4,0,0, - 0,41,2,114,100,0,0,0,114,119,0,0,0,114,4,0, - 0,0,114,4,0,0,0,114,5,0,0,0,114,196,0,0, - 0,243,3,0,0,115,2,0,0,0,0,1,122,27,95,78, - 97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,103, - 101,116,95,115,111,117,114,99,101,99,2,0,0,0,0,0, - 0,0,2,0,0,0,6,0,0,0,67,0,0,0,115,18, - 0,0,0,116,0,100,1,100,2,100,3,100,4,100,5,144, - 1,131,3,83,0,41,6,78,114,30,0,0,0,122,8,60, - 115,116,114,105,110,103,62,114,183,0,0,0,114,198,0,0, - 0,84,41,1,114,199,0,0,0,41,2,114,100,0,0,0, - 114,119,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,181,0,0,0,246,3,0,0,115,2,0, - 0,0,0,1,122,25,95,78,97,109,101,115,112,97,99,101, - 76,111,97,100,101,114,46,103,101,116,95,99,111,100,101,99, - 2,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0, - 67,0,0,0,115,4,0,0,0,100,1,83,0,41,2,122, - 42,85,115,101,32,100,101,102,97,117,108,116,32,115,101,109, - 97,110,116,105,99,115,32,102,111,114,32,109,111,100,117,108, - 101,32,99,114,101,97,116,105,111,110,46,78,114,4,0,0, - 0,41,2,114,100,0,0,0,114,158,0,0,0,114,4,0, - 0,0,114,4,0,0,0,114,5,0,0,0,114,180,0,0, - 0,249,3,0,0,115,0,0,0,0,122,30,95,78,97,109, - 101,115,112,97,99,101,76,111,97,100,101,114,46,99,114,101, - 97,116,101,95,109,111,100,117,108,101,99,2,0,0,0,0, - 0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,115, - 4,0,0,0,100,0,83,0,41,1,78,114,4,0,0,0, - 41,2,114,100,0,0,0,114,184,0,0,0,114,4,0,0, - 0,114,4,0,0,0,114,5,0,0,0,114,185,0,0,0, - 252,3,0,0,115,2,0,0,0,0,1,122,28,95,78,97, - 109,101,115,112,97,99,101,76,111,97,100,101,114,46,101,120, - 101,99,95,109,111,100,117,108,101,99,2,0,0,0,0,0, - 0,0,2,0,0,0,3,0,0,0,67,0,0,0,115,26, - 0,0,0,116,0,106,1,100,1,124,0,106,2,131,2,1, - 0,116,0,106,3,124,0,124,1,131,2,83,0,41,2,122, - 98,76,111,97,100,32,97,32,110,97,109,101,115,112,97,99, - 101,32,109,111,100,117,108,101,46,10,10,32,32,32,32,32, - 32,32,32,84,104,105,115,32,109,101,116,104,111,100,32,105, - 115,32,100,101,112,114,101,99,97,116,101,100,46,32,32,85, - 115,101,32,101,120,101,99,95,109,111,100,117,108,101,40,41, - 32,105,110,115,116,101,97,100,46,10,10,32,32,32,32,32, - 32,32,32,122,38,110,97,109,101,115,112,97,99,101,32,109, - 111,100,117,108,101,32,108,111,97,100,101,100,32,119,105,116, - 104,32,112,97,116,104,32,123,33,114,125,41,4,114,114,0, - 0,0,114,129,0,0,0,114,226,0,0,0,114,186,0,0, - 0,41,2,114,100,0,0,0,114,119,0,0,0,114,4,0, - 0,0,114,4,0,0,0,114,5,0,0,0,114,187,0,0, - 0,255,3,0,0,115,6,0,0,0,0,7,6,1,8,1, - 122,28,95,78,97,109,101,115,112,97,99,101,76,111,97,100, - 101,114,46,108,111,97,100,95,109,111,100,117,108,101,78,41, - 12,114,105,0,0,0,114,104,0,0,0,114,106,0,0,0, - 114,179,0,0,0,114,177,0,0,0,114,244,0,0,0,114, - 153,0,0,0,114,196,0,0,0,114,181,0,0,0,114,180, - 0,0,0,114,185,0,0,0,114,187,0,0,0,114,4,0, - 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,243,0,0,0,227,3,0,0,115,16,0,0,0,8, - 1,8,3,12,9,8,3,8,3,8,3,8,3,8,3,114, - 243,0,0,0,99,0,0,0,0,0,0,0,0,0,0,0, - 0,5,0,0,0,64,0,0,0,115,108,0,0,0,101,0, - 90,1,100,0,90,2,100,1,90,3,101,4,100,2,100,3, - 132,0,131,1,90,5,101,4,100,4,100,5,132,0,131,1, - 90,6,101,4,100,6,100,7,132,0,131,1,90,7,101,4, - 100,8,100,9,132,0,131,1,90,8,101,4,100,10,100,11, - 100,12,132,1,131,1,90,9,101,4,100,10,100,10,100,13, - 100,14,132,2,131,1,90,10,101,4,100,10,100,15,100,16, - 132,1,131,1,90,11,100,10,83,0,41,17,218,10,80,97, - 116,104,70,105,110,100,101,114,122,62,77,101,116,97,32,112, - 97,116,104,32,102,105,110,100,101,114,32,102,111,114,32,115, - 121,115,46,112,97,116,104,32,97,110,100,32,112,97,99,107, - 97,103,101,32,95,95,112,97,116,104,95,95,32,97,116,116, - 114,105,98,117,116,101,115,46,99,1,0,0,0,0,0,0, - 0,2,0,0,0,4,0,0,0,67,0,0,0,115,42,0, - 0,0,120,36,116,0,106,1,106,2,131,0,68,0,93,22, - 125,1,116,3,124,1,100,1,131,2,114,12,124,1,106,4, - 131,0,1,0,113,12,87,0,100,2,83,0,41,3,122,125, - 67,97,108,108,32,116,104,101,32,105,110,118,97,108,105,100, - 97,116,101,95,99,97,99,104,101,115,40,41,32,109,101,116, - 104,111,100,32,111,110,32,97,108,108,32,112,97,116,104,32, - 101,110,116,114,121,32,102,105,110,100,101,114,115,10,32,32, - 32,32,32,32,32,32,115,116,111,114,101,100,32,105,110,32, - 115,121,115,46,112,97,116,104,95,105,109,112,111,114,116,101, - 114,95,99,97,99,104,101,115,32,40,119,104,101,114,101,32, - 105,109,112,108,101,109,101,110,116,101,100,41,46,218,17,105, - 110,118,97,108,105,100,97,116,101,95,99,97,99,104,101,115, - 78,41,5,114,7,0,0,0,218,19,112,97,116,104,95,105, - 109,112,111,114,116,101,114,95,99,97,99,104,101,218,6,118, - 97,108,117,101,115,114,108,0,0,0,114,246,0,0,0,41, - 2,114,164,0,0,0,218,6,102,105,110,100,101,114,114,4, - 0,0,0,114,4,0,0,0,114,5,0,0,0,114,246,0, - 0,0,17,4,0,0,115,6,0,0,0,0,4,16,1,10, - 1,122,28,80,97,116,104,70,105,110,100,101,114,46,105,110, - 118,97,108,105,100,97,116,101,95,99,97,99,104,101,115,99, - 2,0,0,0,0,0,0,0,3,0,0,0,12,0,0,0, - 67,0,0,0,115,86,0,0,0,116,0,106,1,100,1,107, - 9,114,30,116,0,106,1,12,0,114,30,116,2,106,3,100, - 2,116,4,131,2,1,0,120,50,116,0,106,1,68,0,93, - 36,125,2,121,8,124,2,124,1,131,1,83,0,4,0,116, - 5,107,10,114,72,1,0,1,0,1,0,119,38,89,0,113, - 38,88,0,113,38,87,0,100,1,83,0,100,1,83,0,41, - 3,122,113,83,101,97,114,99,104,32,115,101,113,117,101,110, - 99,101,32,111,102,32,104,111,111,107,115,32,102,111,114,32, - 97,32,102,105,110,100,101,114,32,102,111,114,32,39,112,97, - 116,104,39,46,10,10,32,32,32,32,32,32,32,32,73,102, - 32,39,104,111,111,107,115,39,32,105,115,32,102,97,108,115, - 101,32,116,104,101,110,32,117,115,101,32,115,121,115,46,112, - 97,116,104,95,104,111,111,107,115,46,10,10,32,32,32,32, - 32,32,32,32,78,122,23,115,121,115,46,112,97,116,104,95, - 104,111,111,107,115,32,105,115,32,101,109,112,116,121,41,6, - 114,7,0,0,0,218,10,112,97,116,104,95,104,111,111,107, - 115,114,60,0,0,0,114,61,0,0,0,114,118,0,0,0, - 114,99,0,0,0,41,3,114,164,0,0,0,114,35,0,0, - 0,90,4,104,111,111,107,114,4,0,0,0,114,4,0,0, - 0,114,5,0,0,0,218,11,95,112,97,116,104,95,104,111, - 111,107,115,25,4,0,0,115,16,0,0,0,0,7,18,1, - 12,1,12,1,2,1,8,1,14,1,12,2,122,22,80,97, - 116,104,70,105,110,100,101,114,46,95,112,97,116,104,95,104, - 111,111,107,115,99,2,0,0,0,0,0,0,0,3,0,0, - 0,19,0,0,0,67,0,0,0,115,102,0,0,0,124,1, - 100,1,107,2,114,42,121,12,116,0,106,1,131,0,125,1, - 87,0,110,20,4,0,116,2,107,10,114,40,1,0,1,0, - 1,0,100,2,83,0,88,0,121,14,116,3,106,4,124,1, - 25,0,125,2,87,0,110,40,4,0,116,5,107,10,114,96, - 1,0,1,0,1,0,124,0,106,6,124,1,131,1,125,2, - 124,2,116,3,106,4,124,1,60,0,89,0,110,2,88,0, - 124,2,83,0,41,3,122,210,71,101,116,32,116,104,101,32, - 102,105,110,100,101,114,32,102,111,114,32,116,104,101,32,112, - 97,116,104,32,101,110,116,114,121,32,102,114,111,109,32,115, - 121,115,46,112,97,116,104,95,105,109,112,111,114,116,101,114, - 95,99,97,99,104,101,46,10,10,32,32,32,32,32,32,32, - 32,73,102,32,116,104,101,32,112,97,116,104,32,101,110,116, - 114,121,32,105,115,32,110,111,116,32,105,110,32,116,104,101, - 32,99,97,99,104,101,44,32,102,105,110,100,32,116,104,101, - 32,97,112,112,114,111,112,114,105,97,116,101,32,102,105,110, - 100,101,114,10,32,32,32,32,32,32,32,32,97,110,100,32, - 99,97,99,104,101,32,105,116,46,32,73,102,32,110,111,32, - 102,105,110,100,101,114,32,105,115,32,97,118,97,105,108,97, - 98,108,101,44,32,115,116,111,114,101,32,78,111,110,101,46, - 10,10,32,32,32,32,32,32,32,32,114,30,0,0,0,78, - 41,7,114,3,0,0,0,114,45,0,0,0,218,17,70,105, - 108,101,78,111,116,70,111,117,110,100,69,114,114,111,114,114, - 7,0,0,0,114,247,0,0,0,114,131,0,0,0,114,251, - 0,0,0,41,3,114,164,0,0,0,114,35,0,0,0,114, - 249,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,218,20,95,112,97,116,104,95,105,109,112,111,114, - 116,101,114,95,99,97,99,104,101,42,4,0,0,115,22,0, - 0,0,0,8,8,1,2,1,12,1,14,3,6,1,2,1, - 14,1,14,1,10,1,16,1,122,31,80,97,116,104,70,105, - 110,100,101,114,46,95,112,97,116,104,95,105,109,112,111,114, - 116,101,114,95,99,97,99,104,101,99,3,0,0,0,0,0, - 0,0,6,0,0,0,3,0,0,0,67,0,0,0,115,82, - 0,0,0,116,0,124,2,100,1,131,2,114,26,124,2,106, - 1,124,1,131,1,92,2,125,3,125,4,110,14,124,2,106, - 2,124,1,131,1,125,3,103,0,125,4,124,3,100,0,107, - 9,114,60,116,3,106,4,124,1,124,3,131,2,83,0,116, - 3,106,5,124,1,100,0,131,2,125,5,124,4,124,5,95, - 6,124,5,83,0,41,2,78,114,117,0,0,0,41,7,114, - 108,0,0,0,114,117,0,0,0,114,176,0,0,0,114,114, - 0,0,0,114,173,0,0,0,114,154,0,0,0,114,150,0, - 0,0,41,6,114,164,0,0,0,114,119,0,0,0,114,249, - 0,0,0,114,120,0,0,0,114,121,0,0,0,114,158,0, - 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,218,16,95,108,101,103,97,99,121,95,103,101,116,95,115, - 112,101,99,64,4,0,0,115,18,0,0,0,0,4,10,1, - 16,2,10,1,4,1,8,1,12,1,12,1,6,1,122,27, - 80,97,116,104,70,105,110,100,101,114,46,95,108,101,103,97, - 99,121,95,103,101,116,95,115,112,101,99,78,99,4,0,0, - 0,0,0,0,0,9,0,0,0,5,0,0,0,67,0,0, - 0,115,170,0,0,0,103,0,125,4,120,160,124,2,68,0, - 93,130,125,5,116,0,124,5,116,1,116,2,102,2,131,2, - 115,30,113,10,124,0,106,3,124,5,131,1,125,6,124,6, - 100,1,107,9,114,10,116,4,124,6,100,2,131,2,114,72, - 124,6,106,5,124,1,124,3,131,2,125,7,110,12,124,0, - 106,6,124,1,124,6,131,2,125,7,124,7,100,1,107,8, - 114,94,113,10,124,7,106,7,100,1,107,9,114,108,124,7, - 83,0,124,7,106,8,125,8,124,8,100,1,107,8,114,130, - 116,9,100,3,131,1,130,1,124,4,106,10,124,8,131,1, - 1,0,113,10,87,0,116,11,106,12,124,1,100,1,131,2, - 125,7,124,4,124,7,95,8,124,7,83,0,100,1,83,0, - 41,4,122,63,70,105,110,100,32,116,104,101,32,108,111,97, - 100,101,114,32,111,114,32,110,97,109,101,115,112,97,99,101, - 95,112,97,116,104,32,102,111,114,32,116,104,105,115,32,109, - 111,100,117,108,101,47,112,97,99,107,97,103,101,32,110,97, - 109,101,46,78,114,175,0,0,0,122,19,115,112,101,99,32, - 109,105,115,115,105,110,103,32,108,111,97,100,101,114,41,13, - 114,137,0,0,0,114,69,0,0,0,218,5,98,121,116,101, - 115,114,253,0,0,0,114,108,0,0,0,114,175,0,0,0, - 114,254,0,0,0,114,120,0,0,0,114,150,0,0,0,114, - 99,0,0,0,114,143,0,0,0,114,114,0,0,0,114,154, - 0,0,0,41,9,114,164,0,0,0,114,119,0,0,0,114, - 35,0,0,0,114,174,0,0,0,218,14,110,97,109,101,115, - 112,97,99,101,95,112,97,116,104,90,5,101,110,116,114,121, - 114,249,0,0,0,114,158,0,0,0,114,121,0,0,0,114, - 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,9, - 95,103,101,116,95,115,112,101,99,79,4,0,0,115,40,0, - 0,0,0,5,4,1,10,1,14,1,2,1,10,1,8,1, - 10,1,14,2,12,1,8,1,2,1,10,1,4,1,6,1, - 8,1,8,5,14,2,12,1,6,1,122,20,80,97,116,104, - 70,105,110,100,101,114,46,95,103,101,116,95,115,112,101,99, - 99,4,0,0,0,0,0,0,0,6,0,0,0,4,0,0, - 0,67,0,0,0,115,104,0,0,0,124,2,100,1,107,8, - 114,14,116,0,106,1,125,2,124,0,106,2,124,1,124,2, - 124,3,131,3,125,4,124,4,100,1,107,8,114,42,100,1, - 83,0,110,58,124,4,106,3,100,1,107,8,114,96,124,4, - 106,4,125,5,124,5,114,90,100,2,124,4,95,5,116,6, - 124,1,124,5,124,0,106,2,131,3,124,4,95,4,124,4, - 83,0,113,100,100,1,83,0,110,4,124,4,83,0,100,1, - 83,0,41,3,122,98,102,105,110,100,32,116,104,101,32,109, - 111,100,117,108,101,32,111,110,32,115,121,115,46,112,97,116, - 104,32,111,114,32,39,112,97,116,104,39,32,98,97,115,101, - 100,32,111,110,32,115,121,115,46,112,97,116,104,95,104,111, - 111,107,115,32,97,110,100,10,32,32,32,32,32,32,32,32, - 115,121,115,46,112,97,116,104,95,105,109,112,111,114,116,101, - 114,95,99,97,99,104,101,46,78,90,9,110,97,109,101,115, - 112,97,99,101,41,7,114,7,0,0,0,114,35,0,0,0, - 114,1,1,0,0,114,120,0,0,0,114,150,0,0,0,114, - 152,0,0,0,114,224,0,0,0,41,6,114,164,0,0,0, - 114,119,0,0,0,114,35,0,0,0,114,174,0,0,0,114, - 158,0,0,0,114,0,1,0,0,114,4,0,0,0,114,4, - 0,0,0,114,5,0,0,0,114,175,0,0,0,111,4,0, - 0,115,26,0,0,0,0,4,8,1,6,1,14,1,8,1, - 6,1,10,1,6,1,4,3,6,1,16,1,6,2,6,2, - 122,20,80,97,116,104,70,105,110,100,101,114,46,102,105,110, - 100,95,115,112,101,99,99,3,0,0,0,0,0,0,0,4, - 0,0,0,3,0,0,0,67,0,0,0,115,30,0,0,0, - 124,0,106,0,124,1,124,2,131,2,125,3,124,3,100,1, - 107,8,114,24,100,1,83,0,124,3,106,1,83,0,41,2, - 122,170,102,105,110,100,32,116,104,101,32,109,111,100,117,108, - 101,32,111,110,32,115,121,115,46,112,97,116,104,32,111,114, - 32,39,112,97,116,104,39,32,98,97,115,101,100,32,111,110, - 32,115,121,115,46,112,97,116,104,95,104,111,111,107,115,32, - 97,110,100,10,32,32,32,32,32,32,32,32,115,121,115,46, - 112,97,116,104,95,105,109,112,111,114,116,101,114,95,99,97, - 99,104,101,46,10,10,32,32,32,32,32,32,32,32,84,104, - 105,115,32,109,101,116,104,111,100,32,105,115,32,100,101,112, - 114,101,99,97,116,101,100,46,32,32,85,115,101,32,102,105, - 110,100,95,115,112,101,99,40,41,32,105,110,115,116,101,97, - 100,46,10,10,32,32,32,32,32,32,32,32,78,41,2,114, - 175,0,0,0,114,120,0,0,0,41,4,114,164,0,0,0, - 114,119,0,0,0,114,35,0,0,0,114,158,0,0,0,114, - 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,176, - 0,0,0,133,4,0,0,115,8,0,0,0,0,8,12,1, - 8,1,4,1,122,22,80,97,116,104,70,105,110,100,101,114, - 46,102,105,110,100,95,109,111,100,117,108,101,41,12,114,105, - 0,0,0,114,104,0,0,0,114,106,0,0,0,114,107,0, - 0,0,114,177,0,0,0,114,246,0,0,0,114,251,0,0, - 0,114,253,0,0,0,114,254,0,0,0,114,1,1,0,0, - 114,175,0,0,0,114,176,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,245, - 0,0,0,13,4,0,0,115,22,0,0,0,8,2,4,2, - 12,8,12,17,12,22,12,15,2,1,12,31,2,1,14,21, - 2,1,114,245,0,0,0,99,0,0,0,0,0,0,0,0, - 0,0,0,0,3,0,0,0,64,0,0,0,115,90,0,0, - 0,101,0,90,1,100,0,90,2,100,1,90,3,100,2,100, - 3,132,0,90,4,100,4,100,5,132,0,90,5,101,6,90, - 7,100,6,100,7,132,0,90,8,100,8,100,9,132,0,90, - 9,100,10,100,11,100,12,132,1,90,10,100,13,100,14,132, - 0,90,11,101,12,100,15,100,16,132,0,131,1,90,13,100, - 17,100,18,132,0,90,14,100,10,83,0,41,19,218,10,70, - 105,108,101,70,105,110,100,101,114,122,172,70,105,108,101,45, - 98,97,115,101,100,32,102,105,110,100,101,114,46,10,10,32, - 32,32,32,73,110,116,101,114,97,99,116,105,111,110,115,32, - 119,105,116,104,32,116,104,101,32,102,105,108,101,32,115,121, - 115,116,101,109,32,97,114,101,32,99,97,99,104,101,100,32, - 102,111,114,32,112,101,114,102,111,114,109,97,110,99,101,44, - 32,98,101,105,110,103,10,32,32,32,32,114,101,102,114,101, - 115,104,101,100,32,119,104,101,110,32,116,104,101,32,100,105, - 114,101,99,116,111,114,121,32,116,104,101,32,102,105,110,100, - 101,114,32,105,115,32,104,97,110,100,108,105,110,103,32,104, - 97,115,32,98,101,101,110,32,109,111,100,105,102,105,101,100, - 46,10,10,32,32,32,32,99,2,0,0,0,0,0,0,0, - 5,0,0,0,5,0,0,0,7,0,0,0,115,88,0,0, - 0,103,0,125,3,120,40,124,2,68,0,93,32,92,2,137, - 0,125,4,124,3,106,0,135,0,102,1,100,1,100,2,134, - 0,124,4,68,0,131,1,131,1,1,0,113,10,87,0,124, - 3,124,0,95,1,124,1,112,58,100,3,124,0,95,2,100, - 6,124,0,95,3,116,4,131,0,124,0,95,5,116,4,131, - 0,124,0,95,6,100,5,83,0,41,7,122,154,73,110,105, - 116,105,97,108,105,122,101,32,119,105,116,104,32,116,104,101, - 32,112,97,116,104,32,116,111,32,115,101,97,114,99,104,32, - 111,110,32,97,110,100,32,97,32,118,97,114,105,97,98,108, - 101,32,110,117,109,98,101,114,32,111,102,10,32,32,32,32, - 32,32,32,32,50,45,116,117,112,108,101,115,32,99,111,110, - 116,97,105,110,105,110,103,32,116,104,101,32,108,111,97,100, - 101,114,32,97,110,100,32,116,104,101,32,102,105,108,101,32, - 115,117,102,102,105,120,101,115,32,116,104,101,32,108,111,97, - 100,101,114,10,32,32,32,32,32,32,32,32,114,101,99,111, - 103,110,105,122,101,115,46,99,1,0,0,0,0,0,0,0, - 2,0,0,0,3,0,0,0,51,0,0,0,115,22,0,0, - 0,124,0,93,14,125,1,124,1,136,0,102,2,86,0,1, - 0,113,2,100,0,83,0,41,1,78,114,4,0,0,0,41, - 2,114,22,0,0,0,114,219,0,0,0,41,1,114,120,0, - 0,0,114,4,0,0,0,114,5,0,0,0,114,221,0,0, - 0,162,4,0,0,115,2,0,0,0,4,0,122,38,70,105, - 108,101,70,105,110,100,101,114,46,95,95,105,110,105,116,95, - 95,46,60,108,111,99,97,108,115,62,46,60,103,101,110,101, - 120,112,114,62,114,58,0,0,0,114,29,0,0,0,78,114, - 87,0,0,0,41,7,114,143,0,0,0,218,8,95,108,111, - 97,100,101,114,115,114,35,0,0,0,218,11,95,112,97,116, - 104,95,109,116,105,109,101,218,3,115,101,116,218,11,95,112, - 97,116,104,95,99,97,99,104,101,218,19,95,114,101,108,97, - 120,101,100,95,112,97,116,104,95,99,97,99,104,101,41,5, - 114,100,0,0,0,114,35,0,0,0,218,14,108,111,97,100, - 101,114,95,100,101,116,97,105,108,115,90,7,108,111,97,100, - 101,114,115,114,160,0,0,0,114,4,0,0,0,41,1,114, - 120,0,0,0,114,5,0,0,0,114,179,0,0,0,156,4, - 0,0,115,16,0,0,0,0,4,4,1,14,1,28,1,6, - 2,10,1,6,1,8,1,122,19,70,105,108,101,70,105,110, - 100,101,114,46,95,95,105,110,105,116,95,95,99,1,0,0, - 0,0,0,0,0,1,0,0,0,2,0,0,0,67,0,0, - 0,115,10,0,0,0,100,3,124,0,95,0,100,2,83,0, - 41,4,122,31,73,110,118,97,108,105,100,97,116,101,32,116, - 104,101,32,100,105,114,101,99,116,111,114,121,32,109,116,105, - 109,101,46,114,29,0,0,0,78,114,87,0,0,0,41,1, - 114,4,1,0,0,41,1,114,100,0,0,0,114,4,0,0, - 0,114,4,0,0,0,114,5,0,0,0,114,246,0,0,0, - 170,4,0,0,115,2,0,0,0,0,2,122,28,70,105,108, - 101,70,105,110,100,101,114,46,105,110,118,97,108,105,100,97, - 116,101,95,99,97,99,104,101,115,99,2,0,0,0,0,0, - 0,0,3,0,0,0,2,0,0,0,67,0,0,0,115,42, - 0,0,0,124,0,106,0,124,1,131,1,125,2,124,2,100, - 1,107,8,114,26,100,1,103,0,102,2,83,0,124,2,106, - 1,124,2,106,2,112,38,103,0,102,2,83,0,41,2,122, - 197,84,114,121,32,116,111,32,102,105,110,100,32,97,32,108, - 111,97,100,101,114,32,102,111,114,32,116,104,101,32,115,112, - 101,99,105,102,105,101,100,32,109,111,100,117,108,101,44,32, - 111,114,32,116,104,101,32,110,97,109,101,115,112,97,99,101, - 10,32,32,32,32,32,32,32,32,112,97,99,107,97,103,101, - 32,112,111,114,116,105,111,110,115,46,32,82,101,116,117,114, - 110,115,32,40,108,111,97,100,101,114,44,32,108,105,115,116, - 45,111,102,45,112,111,114,116,105,111,110,115,41,46,10,10, - 32,32,32,32,32,32,32,32,84,104,105,115,32,109,101,116, - 104,111,100,32,105,115,32,100,101,112,114,101,99,97,116,101, - 100,46,32,32,85,115,101,32,102,105,110,100,95,115,112,101, - 99,40,41,32,105,110,115,116,101,97,100,46,10,10,32,32, - 32,32,32,32,32,32,78,41,3,114,175,0,0,0,114,120, - 0,0,0,114,150,0,0,0,41,3,114,100,0,0,0,114, - 119,0,0,0,114,158,0,0,0,114,4,0,0,0,114,4, - 0,0,0,114,5,0,0,0,114,117,0,0,0,176,4,0, - 0,115,8,0,0,0,0,7,10,1,8,1,8,1,122,22, - 70,105,108,101,70,105,110,100,101,114,46,102,105,110,100,95, - 108,111,97,100,101,114,99,6,0,0,0,0,0,0,0,7, - 0,0,0,7,0,0,0,67,0,0,0,115,30,0,0,0, - 124,1,124,2,124,3,131,2,125,6,116,0,124,2,124,3, - 100,1,124,6,100,2,124,4,144,2,131,2,83,0,41,3, - 78,114,120,0,0,0,114,150,0,0,0,41,1,114,161,0, - 0,0,41,7,114,100,0,0,0,114,159,0,0,0,114,119, - 0,0,0,114,35,0,0,0,90,4,115,109,115,108,114,174, - 0,0,0,114,120,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,114,1,1,0,0,188,4,0,0, - 115,6,0,0,0,0,1,10,1,12,1,122,20,70,105,108, - 101,70,105,110,100,101,114,46,95,103,101,116,95,115,112,101, - 99,78,99,3,0,0,0,0,0,0,0,14,0,0,0,15, - 0,0,0,67,0,0,0,115,100,1,0,0,100,1,125,3, - 124,1,106,0,100,2,131,1,100,3,25,0,125,4,121,24, - 116,1,124,0,106,2,112,34,116,3,106,4,131,0,131,1, - 106,5,125,5,87,0,110,24,4,0,116,6,107,10,114,66, - 1,0,1,0,1,0,100,10,125,5,89,0,110,2,88,0, - 124,5,124,0,106,7,107,3,114,92,124,0,106,8,131,0, - 1,0,124,5,124,0,95,7,116,9,131,0,114,114,124,0, - 106,10,125,6,124,4,106,11,131,0,125,7,110,10,124,0, - 106,12,125,6,124,4,125,7,124,7,124,6,107,6,114,218, - 116,13,124,0,106,2,124,4,131,2,125,8,120,72,124,0, - 106,14,68,0,93,54,92,2,125,9,125,10,100,5,124,9, - 23,0,125,11,116,13,124,8,124,11,131,2,125,12,116,15, - 124,12,131,1,114,152,124,0,106,16,124,10,124,1,124,12, - 124,8,103,1,124,2,131,5,83,0,113,152,87,0,116,17, - 124,8,131,1,125,3,120,90,124,0,106,14,68,0,93,80, - 92,2,125,9,125,10,116,13,124,0,106,2,124,4,124,9, - 23,0,131,2,125,12,116,18,106,19,100,6,124,12,100,7, - 100,3,144,1,131,2,1,0,124,7,124,9,23,0,124,6, - 107,6,114,226,116,15,124,12,131,1,114,226,124,0,106,16, - 124,10,124,1,124,12,100,8,124,2,131,5,83,0,113,226, - 87,0,124,3,144,1,114,96,116,18,106,19,100,9,124,8, - 131,2,1,0,116,18,106,20,124,1,100,8,131,2,125,13, - 124,8,103,1,124,13,95,21,124,13,83,0,100,8,83,0, - 41,11,122,102,84,114,121,32,116,111,32,102,105,110,100,32, - 97,32,115,112,101,99,32,102,111,114,32,116,104,101,32,115, - 112,101,99,105,102,105,101,100,32,109,111,100,117,108,101,46, - 32,32,82,101,116,117,114,110,115,32,116,104,101,10,32,32, - 32,32,32,32,32,32,109,97,116,99,104,105,110,103,32,115, - 112,101,99,44,32,111,114,32,78,111,110,101,32,105,102,32, - 110,111,116,32,102,111,117,110,100,46,70,114,58,0,0,0, - 114,56,0,0,0,114,29,0,0,0,114,179,0,0,0,122, - 9,116,114,121,105,110,103,32,123,125,90,9,118,101,114,98, - 111,115,105,116,121,78,122,25,112,111,115,115,105,98,108,101, - 32,110,97,109,101,115,112,97,99,101,32,102,111,114,32,123, - 125,114,87,0,0,0,41,22,114,32,0,0,0,114,39,0, - 0,0,114,35,0,0,0,114,3,0,0,0,114,45,0,0, - 0,114,213,0,0,0,114,40,0,0,0,114,4,1,0,0, - 218,11,95,102,105,108,108,95,99,97,99,104,101,114,6,0, - 0,0,114,7,1,0,0,114,88,0,0,0,114,6,1,0, - 0,114,28,0,0,0,114,3,1,0,0,114,44,0,0,0, - 114,1,1,0,0,114,46,0,0,0,114,114,0,0,0,114, - 129,0,0,0,114,154,0,0,0,114,150,0,0,0,41,14, - 114,100,0,0,0,114,119,0,0,0,114,174,0,0,0,90, - 12,105,115,95,110,97,109,101,115,112,97,99,101,90,11,116, - 97,105,108,95,109,111,100,117,108,101,114,126,0,0,0,90, - 5,99,97,99,104,101,90,12,99,97,99,104,101,95,109,111, - 100,117,108,101,90,9,98,97,115,101,95,112,97,116,104,114, - 219,0,0,0,114,159,0,0,0,90,13,105,110,105,116,95, - 102,105,108,101,110,97,109,101,90,9,102,117,108,108,95,112, - 97,116,104,114,158,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,114,175,0,0,0,193,4,0,0, - 115,70,0,0,0,0,3,4,1,14,1,2,1,24,1,14, - 1,10,1,10,1,8,1,6,2,6,1,6,1,10,2,6, - 1,4,2,8,1,12,1,16,1,8,1,10,1,8,1,24, - 4,8,2,16,1,16,1,18,1,12,1,8,1,10,1,12, - 1,6,1,12,1,12,1,8,1,4,1,122,20,70,105,108, - 101,70,105,110,100,101,114,46,102,105,110,100,95,115,112,101, - 99,99,1,0,0,0,0,0,0,0,9,0,0,0,13,0, - 0,0,67,0,0,0,115,194,0,0,0,124,0,106,0,125, - 1,121,22,116,1,106,2,124,1,112,22,116,1,106,3,131, - 0,131,1,125,2,87,0,110,30,4,0,116,4,116,5,116, - 6,102,3,107,10,114,58,1,0,1,0,1,0,103,0,125, - 2,89,0,110,2,88,0,116,7,106,8,106,9,100,1,131, - 1,115,84,116,10,124,2,131,1,124,0,95,11,110,78,116, - 10,131,0,125,3,120,64,124,2,68,0,93,56,125,4,124, - 4,106,12,100,2,131,1,92,3,125,5,125,6,125,7,124, - 6,114,138,100,3,106,13,124,5,124,7,106,14,131,0,131, - 2,125,8,110,4,124,5,125,8,124,3,106,15,124,8,131, - 1,1,0,113,96,87,0,124,3,124,0,95,11,116,7,106, - 8,106,9,116,16,131,1,114,190,100,4,100,5,132,0,124, - 2,68,0,131,1,124,0,95,17,100,6,83,0,41,7,122, - 68,70,105,108,108,32,116,104,101,32,99,97,99,104,101,32, - 111,102,32,112,111,116,101,110,116,105,97,108,32,109,111,100, - 117,108,101,115,32,97,110,100,32,112,97,99,107,97,103,101, - 115,32,102,111,114,32,116,104,105,115,32,100,105,114,101,99, - 116,111,114,121,46,114,0,0,0,0,114,58,0,0,0,122, - 5,123,125,46,123,125,99,1,0,0,0,0,0,0,0,2, - 0,0,0,3,0,0,0,83,0,0,0,115,20,0,0,0, - 104,0,124,0,93,12,125,1,124,1,106,0,131,0,146,2, - 113,4,83,0,114,4,0,0,0,41,1,114,88,0,0,0, - 41,2,114,22,0,0,0,90,2,102,110,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,250,9,60,115,101,116, - 99,111,109,112,62,12,5,0,0,115,2,0,0,0,6,0, - 122,41,70,105,108,101,70,105,110,100,101,114,46,95,102,105, - 108,108,95,99,97,99,104,101,46,60,108,111,99,97,108,115, - 62,46,60,115,101,116,99,111,109,112,62,78,41,18,114,35, - 0,0,0,114,3,0,0,0,90,7,108,105,115,116,100,105, - 114,114,45,0,0,0,114,252,0,0,0,218,15,80,101,114, - 109,105,115,115,105,111,110,69,114,114,111,114,218,18,78,111, - 116,65,68,105,114,101,99,116,111,114,121,69,114,114,111,114, - 114,7,0,0,0,114,8,0,0,0,114,9,0,0,0,114, - 5,1,0,0,114,6,1,0,0,114,83,0,0,0,114,47, - 0,0,0,114,88,0,0,0,218,3,97,100,100,114,10,0, - 0,0,114,7,1,0,0,41,9,114,100,0,0,0,114,35, - 0,0,0,90,8,99,111,110,116,101,110,116,115,90,21,108, - 111,119,101,114,95,115,117,102,102,105,120,95,99,111,110,116, - 101,110,116,115,114,241,0,0,0,114,98,0,0,0,114,231, - 0,0,0,114,219,0,0,0,90,8,110,101,119,95,110,97, - 109,101,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,9,1,0,0,239,4,0,0,115,34,0,0,0,0, - 2,6,1,2,1,22,1,20,3,10,3,12,1,12,7,6, - 1,10,1,16,1,4,1,18,2,4,1,14,1,6,1,12, - 1,122,22,70,105,108,101,70,105,110,100,101,114,46,95,102, - 105,108,108,95,99,97,99,104,101,99,1,0,0,0,0,0, - 0,0,3,0,0,0,3,0,0,0,7,0,0,0,115,18, - 0,0,0,135,0,135,1,102,2,100,1,100,2,134,0,125, - 2,124,2,83,0,41,3,97,20,1,0,0,65,32,99,108, - 97,115,115,32,109,101,116,104,111,100,32,119,104,105,99,104, - 32,114,101,116,117,114,110,115,32,97,32,99,108,111,115,117, - 114,101,32,116,111,32,117,115,101,32,111,110,32,115,121,115, - 46,112,97,116,104,95,104,111,111,107,10,32,32,32,32,32, - 32,32,32,119,104,105,99,104,32,119,105,108,108,32,114,101, - 116,117,114,110,32,97,110,32,105,110,115,116,97,110,99,101, - 32,117,115,105,110,103,32,116,104,101,32,115,112,101,99,105, - 102,105,101,100,32,108,111,97,100,101,114,115,32,97,110,100, - 32,116,104,101,32,112,97,116,104,10,32,32,32,32,32,32, - 32,32,99,97,108,108,101,100,32,111,110,32,116,104,101,32, - 99,108,111,115,117,114,101,46,10,10,32,32,32,32,32,32, - 32,32,73,102,32,116,104,101,32,112,97,116,104,32,99,97, - 108,108,101,100,32,111,110,32,116,104,101,32,99,108,111,115, - 117,114,101,32,105,115,32,110,111,116,32,97,32,100,105,114, - 101,99,116,111,114,121,44,32,73,109,112,111,114,116,69,114, - 114,111,114,32,105,115,10,32,32,32,32,32,32,32,32,114, - 97,105,115,101,100,46,10,10,32,32,32,32,32,32,32,32, - 99,1,0,0,0,0,0,0,0,1,0,0,0,4,0,0, - 0,19,0,0,0,115,32,0,0,0,116,0,124,0,131,1, - 115,22,116,1,100,1,100,2,124,0,144,1,131,1,130,1, - 136,0,124,0,136,1,140,1,83,0,41,3,122,45,80,97, - 116,104,32,104,111,111,107,32,102,111,114,32,105,109,112,111, - 114,116,108,105,98,46,109,97,99,104,105,110,101,114,121,46, - 70,105,108,101,70,105,110,100,101,114,46,122,30,111,110,108, - 121,32,100,105,114,101,99,116,111,114,105,101,115,32,97,114, - 101,32,115,117,112,112,111,114,116,101,100,114,35,0,0,0, - 41,2,114,46,0,0,0,114,99,0,0,0,41,1,114,35, - 0,0,0,41,2,114,164,0,0,0,114,8,1,0,0,114, - 4,0,0,0,114,5,0,0,0,218,24,112,97,116,104,95, - 104,111,111,107,95,102,111,114,95,70,105,108,101,70,105,110, - 100,101,114,24,5,0,0,115,6,0,0,0,0,2,8,1, - 14,1,122,54,70,105,108,101,70,105,110,100,101,114,46,112, - 97,116,104,95,104,111,111,107,46,60,108,111,99,97,108,115, - 62,46,112,97,116,104,95,104,111,111,107,95,102,111,114,95, - 70,105,108,101,70,105,110,100,101,114,114,4,0,0,0,41, - 3,114,164,0,0,0,114,8,1,0,0,114,14,1,0,0, - 114,4,0,0,0,41,2,114,164,0,0,0,114,8,1,0, - 0,114,5,0,0,0,218,9,112,97,116,104,95,104,111,111, - 107,14,5,0,0,115,4,0,0,0,0,10,14,6,122,20, - 70,105,108,101,70,105,110,100,101,114,46,112,97,116,104,95, - 104,111,111,107,99,1,0,0,0,0,0,0,0,1,0,0, - 0,2,0,0,0,67,0,0,0,115,12,0,0,0,100,1, - 106,0,124,0,106,1,131,1,83,0,41,2,78,122,16,70, - 105,108,101,70,105,110,100,101,114,40,123,33,114,125,41,41, - 2,114,47,0,0,0,114,35,0,0,0,41,1,114,100,0, - 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,240,0,0,0,32,5,0,0,115,2,0,0,0,0, - 1,122,19,70,105,108,101,70,105,110,100,101,114,46,95,95, - 114,101,112,114,95,95,41,15,114,105,0,0,0,114,104,0, - 0,0,114,106,0,0,0,114,107,0,0,0,114,179,0,0, - 0,114,246,0,0,0,114,123,0,0,0,114,176,0,0,0, - 114,117,0,0,0,114,1,1,0,0,114,175,0,0,0,114, - 9,1,0,0,114,177,0,0,0,114,15,1,0,0,114,240, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,114,2,1,0,0,147,4,0,0, - 115,20,0,0,0,8,7,4,2,8,14,8,4,4,2,8, - 12,8,5,10,46,8,31,12,18,114,2,1,0,0,99,4, - 0,0,0,0,0,0,0,6,0,0,0,11,0,0,0,67, - 0,0,0,115,148,0,0,0,124,0,106,0,100,1,131,1, - 125,4,124,0,106,0,100,2,131,1,125,5,124,4,115,66, - 124,5,114,36,124,5,106,1,125,4,110,30,124,2,124,3, - 107,2,114,56,116,2,124,1,124,2,131,2,125,4,110,10, - 116,3,124,1,124,2,131,2,125,4,124,5,115,86,116,4, - 124,1,124,2,100,3,124,4,144,1,131,2,125,5,121,36, - 124,5,124,0,100,2,60,0,124,4,124,0,100,1,60,0, - 124,2,124,0,100,4,60,0,124,3,124,0,100,5,60,0, - 87,0,110,20,4,0,116,5,107,10,114,142,1,0,1,0, - 1,0,89,0,110,2,88,0,100,0,83,0,41,6,78,218, - 10,95,95,108,111,97,100,101,114,95,95,218,8,95,95,115, - 112,101,99,95,95,114,120,0,0,0,90,8,95,95,102,105, - 108,101,95,95,90,10,95,95,99,97,99,104,101,100,95,95, - 41,6,218,3,103,101,116,114,120,0,0,0,114,217,0,0, - 0,114,212,0,0,0,114,161,0,0,0,218,9,69,120,99, - 101,112,116,105,111,110,41,6,90,2,110,115,114,98,0,0, - 0,90,8,112,97,116,104,110,97,109,101,90,9,99,112,97, - 116,104,110,97,109,101,114,120,0,0,0,114,158,0,0,0, + 122,16,70,105,108,101,70,105,110,100,101,114,40,123,33,114, + 125,41,41,2,114,47,0,0,0,114,35,0,0,0,41,1, + 114,100,0,0,0,114,4,0,0,0,114,4,0,0,0,114, + 5,0,0,0,114,240,0,0,0,33,5,0,0,115,2,0, + 0,0,0,1,122,19,70,105,108,101,70,105,110,100,101,114, + 46,95,95,114,101,112,114,95,95,41,15,114,105,0,0,0, + 114,104,0,0,0,114,106,0,0,0,114,107,0,0,0,114, + 179,0,0,0,114,246,0,0,0,114,123,0,0,0,114,176, + 0,0,0,114,117,0,0,0,114,1,1,0,0,114,175,0, + 0,0,114,9,1,0,0,114,177,0,0,0,114,15,1,0, + 0,114,240,0,0,0,114,4,0,0,0,114,4,0,0,0, + 114,4,0,0,0,114,5,0,0,0,114,2,1,0,0,148, + 4,0,0,115,20,0,0,0,8,7,4,2,8,14,8,4, + 4,2,8,12,8,5,10,46,8,31,12,18,114,2,1,0, + 0,99,4,0,0,0,0,0,0,0,6,0,0,0,11,0, + 0,0,67,0,0,0,115,148,0,0,0,124,0,106,0,100, + 1,131,1,125,4,124,0,106,0,100,2,131,1,125,5,124, + 4,115,66,124,5,114,36,124,5,106,1,125,4,110,30,124, + 2,124,3,107,2,114,56,116,2,124,1,124,2,131,2,125, + 4,110,10,116,3,124,1,124,2,131,2,125,4,124,5,115, + 86,116,4,124,1,124,2,100,3,124,4,144,1,131,2,125, + 5,121,36,124,5,124,0,100,2,60,0,124,4,124,0,100, + 1,60,0,124,2,124,0,100,4,60,0,124,3,124,0,100, + 5,60,0,87,0,110,20,4,0,116,5,107,10,114,142,1, + 0,1,0,1,0,89,0,110,2,88,0,100,0,83,0,41, + 6,78,218,10,95,95,108,111,97,100,101,114,95,95,218,8, + 95,95,115,112,101,99,95,95,114,120,0,0,0,90,8,95, + 95,102,105,108,101,95,95,90,10,95,95,99,97,99,104,101, + 100,95,95,41,6,218,3,103,101,116,114,120,0,0,0,114, + 217,0,0,0,114,212,0,0,0,114,161,0,0,0,218,9, + 69,120,99,101,112,116,105,111,110,41,6,90,2,110,115,114, + 98,0,0,0,90,8,112,97,116,104,110,97,109,101,90,9, + 99,112,97,116,104,110,97,109,101,114,120,0,0,0,114,158, + 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, + 0,0,218,14,95,102,105,120,95,117,112,95,109,111,100,117, + 108,101,39,5,0,0,115,34,0,0,0,0,2,10,1,10, + 1,4,1,4,1,8,1,8,1,12,2,10,1,4,1,16, + 1,2,1,8,1,8,1,8,1,12,1,14,2,114,20,1, + 0,0,99,0,0,0,0,0,0,0,0,3,0,0,0,3, + 0,0,0,67,0,0,0,115,38,0,0,0,116,0,116,1, + 106,2,131,0,102,2,125,0,116,3,116,4,102,2,125,1, + 116,5,116,6,102,2,125,2,124,0,124,1,124,2,103,3, + 83,0,41,1,122,95,82,101,116,117,114,110,115,32,97,32, + 108,105,115,116,32,111,102,32,102,105,108,101,45,98,97,115, + 101,100,32,109,111,100,117,108,101,32,108,111,97,100,101,114, + 115,46,10,10,32,32,32,32,69,97,99,104,32,105,116,101, + 109,32,105,115,32,97,32,116,117,112,108,101,32,40,108,111, + 97,100,101,114,44,32,115,117,102,102,105,120,101,115,41,46, + 10,32,32,32,32,41,7,114,218,0,0,0,114,139,0,0, + 0,218,18,101,120,116,101,110,115,105,111,110,95,115,117,102, + 102,105,120,101,115,114,212,0,0,0,114,84,0,0,0,114, + 217,0,0,0,114,74,0,0,0,41,3,90,10,101,120,116, + 101,110,115,105,111,110,115,90,6,115,111,117,114,99,101,90, + 8,98,121,116,101,99,111,100,101,114,4,0,0,0,114,4, + 0,0,0,114,5,0,0,0,114,155,0,0,0,62,5,0, + 0,115,8,0,0,0,0,5,12,1,8,1,8,1,114,155, + 0,0,0,99,1,0,0,0,0,0,0,0,12,0,0,0, + 12,0,0,0,67,0,0,0,115,188,1,0,0,124,0,97, + 0,116,0,106,1,97,1,116,0,106,2,97,2,116,1,106, + 3,116,4,25,0,125,1,120,56,100,26,68,0,93,48,125, + 2,124,2,116,1,106,3,107,7,114,58,116,0,106,5,124, + 2,131,1,125,3,110,10,116,1,106,3,124,2,25,0,125, + 3,116,6,124,1,124,2,124,3,131,3,1,0,113,32,87, + 0,100,5,100,6,103,1,102,2,100,7,100,8,100,6,103, + 2,102,2,102,2,125,4,120,118,124,4,68,0,93,102,92, + 2,125,5,125,6,116,7,100,9,100,10,132,0,124,6,68, + 0,131,1,131,1,115,142,116,8,130,1,124,6,100,11,25, + 0,125,7,124,5,116,1,106,3,107,6,114,174,116,1,106, + 3,124,5,25,0,125,8,80,0,113,112,121,16,116,0,106, + 5,124,5,131,1,125,8,80,0,87,0,113,112,4,0,116, + 9,107,10,114,212,1,0,1,0,1,0,119,112,89,0,113, + 112,88,0,113,112,87,0,116,9,100,12,131,1,130,1,116, + 6,124,1,100,13,124,8,131,3,1,0,116,6,124,1,100, + 14,124,7,131,3,1,0,116,6,124,1,100,15,100,16,106, + 10,124,6,131,1,131,3,1,0,121,14,116,0,106,5,100, + 17,131,1,125,9,87,0,110,26,4,0,116,9,107,10,144, + 1,114,52,1,0,1,0,1,0,100,18,125,9,89,0,110, + 2,88,0,116,6,124,1,100,17,124,9,131,3,1,0,116, + 0,106,5,100,19,131,1,125,10,116,6,124,1,100,19,124, + 10,131,3,1,0,124,5,100,7,107,2,144,1,114,120,116, + 0,106,5,100,20,131,1,125,11,116,6,124,1,100,21,124, + 11,131,3,1,0,116,6,124,1,100,22,116,11,131,0,131, + 3,1,0,116,12,106,13,116,2,106,14,131,0,131,1,1, + 0,124,5,100,7,107,2,144,1,114,184,116,15,106,16,100, + 23,131,1,1,0,100,24,116,12,107,6,144,1,114,184,100, + 25,116,17,95,18,100,18,83,0,41,27,122,205,83,101,116, + 117,112,32,116,104,101,32,112,97,116,104,45,98,97,115,101, + 100,32,105,109,112,111,114,116,101,114,115,32,102,111,114,32, + 105,109,112,111,114,116,108,105,98,32,98,121,32,105,109,112, + 111,114,116,105,110,103,32,110,101,101,100,101,100,10,32,32, + 32,32,98,117,105,108,116,45,105,110,32,109,111,100,117,108, + 101,115,32,97,110,100,32,105,110,106,101,99,116,105,110,103, + 32,116,104,101,109,32,105,110,116,111,32,116,104,101,32,103, + 108,111,98,97,108,32,110,97,109,101,115,112,97,99,101,46, + 10,10,32,32,32,32,79,116,104,101,114,32,99,111,109,112, + 111,110,101,110,116,115,32,97,114,101,32,101,120,116,114,97, + 99,116,101,100,32,102,114,111,109,32,116,104,101,32,99,111, + 114,101,32,98,111,111,116,115,116,114,97,112,32,109,111,100, + 117,108,101,46,10,10,32,32,32,32,114,49,0,0,0,114, + 60,0,0,0,218,8,98,117,105,108,116,105,110,115,114,136, + 0,0,0,90,5,112,111,115,105,120,250,1,47,218,2,110, + 116,250,1,92,99,1,0,0,0,0,0,0,0,2,0,0, + 0,3,0,0,0,115,0,0,0,115,26,0,0,0,124,0, + 93,18,125,1,116,0,124,1,131,1,100,0,107,2,86,0, + 1,0,113,2,100,1,83,0,41,2,114,29,0,0,0,78, + 41,1,114,31,0,0,0,41,2,114,22,0,0,0,114,77, + 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, + 0,0,114,221,0,0,0,98,5,0,0,115,2,0,0,0, + 4,0,122,25,95,115,101,116,117,112,46,60,108,111,99,97, + 108,115,62,46,60,103,101,110,101,120,112,114,62,114,59,0, + 0,0,122,30,105,109,112,111,114,116,108,105,98,32,114,101, + 113,117,105,114,101,115,32,112,111,115,105,120,32,111,114,32, + 110,116,114,3,0,0,0,114,25,0,0,0,114,21,0,0, + 0,114,30,0,0,0,90,7,95,116,104,114,101,97,100,78, + 90,8,95,119,101,97,107,114,101,102,90,6,119,105,110,114, + 101,103,114,163,0,0,0,114,6,0,0,0,122,4,46,112, + 121,119,122,6,95,100,46,112,121,100,84,41,4,122,3,95, + 105,111,122,9,95,119,97,114,110,105,110,103,115,122,8,98, + 117,105,108,116,105,110,115,122,7,109,97,114,115,104,97,108, + 41,19,114,114,0,0,0,114,7,0,0,0,114,139,0,0, + 0,114,233,0,0,0,114,105,0,0,0,90,18,95,98,117, + 105,108,116,105,110,95,102,114,111,109,95,110,97,109,101,114, + 109,0,0,0,218,3,97,108,108,218,14,65,115,115,101,114, + 116,105,111,110,69,114,114,111,114,114,99,0,0,0,114,26, + 0,0,0,114,11,0,0,0,114,223,0,0,0,114,143,0, + 0,0,114,21,1,0,0,114,84,0,0,0,114,157,0,0, + 0,114,162,0,0,0,114,167,0,0,0,41,12,218,17,95, + 98,111,111,116,115,116,114,97,112,95,109,111,100,117,108,101, + 90,11,115,101,108,102,95,109,111,100,117,108,101,90,12,98, + 117,105,108,116,105,110,95,110,97,109,101,90,14,98,117,105, + 108,116,105,110,95,109,111,100,117,108,101,90,10,111,115,95, + 100,101,116,97,105,108,115,90,10,98,117,105,108,116,105,110, + 95,111,115,114,21,0,0,0,114,25,0,0,0,90,9,111, + 115,95,109,111,100,117,108,101,90,13,116,104,114,101,97,100, + 95,109,111,100,117,108,101,90,14,119,101,97,107,114,101,102, + 95,109,111,100,117,108,101,90,13,119,105,110,114,101,103,95, + 109,111,100,117,108,101,114,4,0,0,0,114,4,0,0,0, + 114,5,0,0,0,218,6,95,115,101,116,117,112,73,5,0, + 0,115,82,0,0,0,0,8,4,1,6,1,6,3,10,1, + 10,1,10,1,12,2,10,1,16,3,22,1,14,2,22,1, + 8,1,10,1,10,1,4,2,2,1,10,1,6,1,14,1, + 12,2,8,1,12,1,12,1,18,3,2,1,14,1,16,2, + 10,1,12,3,10,1,12,3,10,1,10,1,12,3,14,1, + 14,1,10,1,10,1,10,1,114,29,1,0,0,99,1,0, + 0,0,0,0,0,0,2,0,0,0,3,0,0,0,67,0, + 0,0,115,84,0,0,0,116,0,124,0,131,1,1,0,116, + 1,131,0,125,1,116,2,106,3,106,4,116,5,106,6,124, + 1,140,0,103,1,131,1,1,0,116,7,106,8,100,1,107, + 2,114,56,116,2,106,9,106,10,116,11,131,1,1,0,116, + 2,106,9,106,10,116,12,131,1,1,0,116,5,124,0,95, + 5,116,13,124,0,95,13,100,2,83,0,41,3,122,41,73, + 110,115,116,97,108,108,32,116,104,101,32,112,97,116,104,45, + 98,97,115,101,100,32,105,109,112,111,114,116,32,99,111,109, + 112,111,110,101,110,116,115,46,114,24,1,0,0,78,41,14, + 114,29,1,0,0,114,155,0,0,0,114,7,0,0,0,114, + 250,0,0,0,114,143,0,0,0,114,2,1,0,0,114,15, + 1,0,0,114,3,0,0,0,114,105,0,0,0,218,9,109, + 101,116,97,95,112,97,116,104,114,157,0,0,0,114,162,0, + 0,0,114,245,0,0,0,114,212,0,0,0,41,2,114,28, + 1,0,0,90,17,115,117,112,112,111,114,116,101,100,95,108, + 111,97,100,101,114,115,114,4,0,0,0,114,4,0,0,0, + 114,5,0,0,0,218,8,95,105,110,115,116,97,108,108,141, + 5,0,0,115,16,0,0,0,0,2,8,1,6,1,20,1, + 10,1,12,1,12,4,6,1,114,31,1,0,0,41,3,122, + 3,119,105,110,114,1,0,0,0,114,2,0,0,0,41,56, + 114,107,0,0,0,114,10,0,0,0,114,11,0,0,0,114, + 17,0,0,0,114,19,0,0,0,114,28,0,0,0,114,38, + 0,0,0,114,39,0,0,0,114,43,0,0,0,114,44,0, + 0,0,114,46,0,0,0,114,55,0,0,0,218,4,116,121, + 112,101,218,8,95,95,99,111,100,101,95,95,114,138,0,0, + 0,114,15,0,0,0,114,128,0,0,0,114,14,0,0,0, + 114,18,0,0,0,90,17,95,82,65,87,95,77,65,71,73, + 67,95,78,85,77,66,69,82,114,73,0,0,0,114,72,0, + 0,0,114,84,0,0,0,114,74,0,0,0,90,23,68,69, + 66,85,71,95,66,89,84,69,67,79,68,69,95,83,85,70, + 70,73,88,69,83,90,27,79,80,84,73,77,73,90,69,68, + 95,66,89,84,69,67,79,68,69,95,83,85,70,70,73,88, + 69,83,114,79,0,0,0,114,85,0,0,0,114,91,0,0, + 0,114,95,0,0,0,114,97,0,0,0,114,116,0,0,0, + 114,123,0,0,0,114,135,0,0,0,114,141,0,0,0,114, + 144,0,0,0,114,149,0,0,0,218,6,111,98,106,101,99, + 116,114,156,0,0,0,114,161,0,0,0,114,162,0,0,0, + 114,178,0,0,0,114,188,0,0,0,114,204,0,0,0,114, + 212,0,0,0,114,217,0,0,0,114,223,0,0,0,114,218, + 0,0,0,114,224,0,0,0,114,243,0,0,0,114,245,0, + 0,0,114,2,1,0,0,114,20,1,0,0,114,155,0,0, + 0,114,29,1,0,0,114,31,1,0,0,114,4,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218, - 14,95,102,105,120,95,117,112,95,109,111,100,117,108,101,38, - 5,0,0,115,34,0,0,0,0,2,10,1,10,1,4,1, - 4,1,8,1,8,1,12,2,10,1,4,1,16,1,2,1, - 8,1,8,1,8,1,12,1,14,2,114,20,1,0,0,99, - 0,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0, - 67,0,0,0,115,38,0,0,0,116,0,116,1,106,2,131, - 0,102,2,125,0,116,3,116,4,102,2,125,1,116,5,116, - 6,102,2,125,2,124,0,124,1,124,2,103,3,83,0,41, - 1,122,95,82,101,116,117,114,110,115,32,97,32,108,105,115, - 116,32,111,102,32,102,105,108,101,45,98,97,115,101,100,32, - 109,111,100,117,108,101,32,108,111,97,100,101,114,115,46,10, - 10,32,32,32,32,69,97,99,104,32,105,116,101,109,32,105, - 115,32,97,32,116,117,112,108,101,32,40,108,111,97,100,101, - 114,44,32,115,117,102,102,105,120,101,115,41,46,10,32,32, - 32,32,41,7,114,218,0,0,0,114,139,0,0,0,218,18, - 101,120,116,101,110,115,105,111,110,95,115,117,102,102,105,120, - 101,115,114,212,0,0,0,114,84,0,0,0,114,217,0,0, - 0,114,74,0,0,0,41,3,90,10,101,120,116,101,110,115, - 105,111,110,115,90,6,115,111,117,114,99,101,90,8,98,121, - 116,101,99,111,100,101,114,4,0,0,0,114,4,0,0,0, - 114,5,0,0,0,114,155,0,0,0,61,5,0,0,115,8, - 0,0,0,0,5,12,1,8,1,8,1,114,155,0,0,0, - 99,1,0,0,0,0,0,0,0,12,0,0,0,12,0,0, - 0,67,0,0,0,115,188,1,0,0,124,0,97,0,116,0, - 106,1,97,1,116,0,106,2,97,2,116,1,106,3,116,4, - 25,0,125,1,120,56,100,26,68,0,93,48,125,2,124,2, - 116,1,106,3,107,7,114,58,116,0,106,5,124,2,131,1, - 125,3,110,10,116,1,106,3,124,2,25,0,125,3,116,6, - 124,1,124,2,124,3,131,3,1,0,113,32,87,0,100,5, - 100,6,103,1,102,2,100,7,100,8,100,6,103,2,102,2, - 102,2,125,4,120,118,124,4,68,0,93,102,92,2,125,5, - 125,6,116,7,100,9,100,10,132,0,124,6,68,0,131,1, - 131,1,115,142,116,8,130,1,124,6,100,11,25,0,125,7, - 124,5,116,1,106,3,107,6,114,174,116,1,106,3,124,5, - 25,0,125,8,80,0,113,112,121,16,116,0,106,5,124,5, - 131,1,125,8,80,0,87,0,113,112,4,0,116,9,107,10, - 114,212,1,0,1,0,1,0,119,112,89,0,113,112,88,0, - 113,112,87,0,116,9,100,12,131,1,130,1,116,6,124,1, - 100,13,124,8,131,3,1,0,116,6,124,1,100,14,124,7, - 131,3,1,0,116,6,124,1,100,15,100,16,106,10,124,6, - 131,1,131,3,1,0,121,14,116,0,106,5,100,17,131,1, - 125,9,87,0,110,26,4,0,116,9,107,10,144,1,114,52, - 1,0,1,0,1,0,100,18,125,9,89,0,110,2,88,0, - 116,6,124,1,100,17,124,9,131,3,1,0,116,0,106,5, - 100,19,131,1,125,10,116,6,124,1,100,19,124,10,131,3, - 1,0,124,5,100,7,107,2,144,1,114,120,116,0,106,5, - 100,20,131,1,125,11,116,6,124,1,100,21,124,11,131,3, - 1,0,116,6,124,1,100,22,116,11,131,0,131,3,1,0, - 116,12,106,13,116,2,106,14,131,0,131,1,1,0,124,5, - 100,7,107,2,144,1,114,184,116,15,106,16,100,23,131,1, - 1,0,100,24,116,12,107,6,144,1,114,184,100,25,116,17, - 95,18,100,18,83,0,41,27,122,205,83,101,116,117,112,32, - 116,104,101,32,112,97,116,104,45,98,97,115,101,100,32,105, - 109,112,111,114,116,101,114,115,32,102,111,114,32,105,109,112, - 111,114,116,108,105,98,32,98,121,32,105,109,112,111,114,116, - 105,110,103,32,110,101,101,100,101,100,10,32,32,32,32,98, - 117,105,108,116,45,105,110,32,109,111,100,117,108,101,115,32, - 97,110,100,32,105,110,106,101,99,116,105,110,103,32,116,104, - 101,109,32,105,110,116,111,32,116,104,101,32,103,108,111,98, - 97,108,32,110,97,109,101,115,112,97,99,101,46,10,10,32, - 32,32,32,79,116,104,101,114,32,99,111,109,112,111,110,101, - 110,116,115,32,97,114,101,32,101,120,116,114,97,99,116,101, - 100,32,102,114,111,109,32,116,104,101,32,99,111,114,101,32, - 98,111,111,116,115,116,114,97,112,32,109,111,100,117,108,101, - 46,10,10,32,32,32,32,114,49,0,0,0,114,60,0,0, - 0,218,8,98,117,105,108,116,105,110,115,114,136,0,0,0, - 90,5,112,111,115,105,120,250,1,47,218,2,110,116,250,1, - 92,99,1,0,0,0,0,0,0,0,2,0,0,0,3,0, - 0,0,115,0,0,0,115,26,0,0,0,124,0,93,18,125, - 1,116,0,124,1,131,1,100,0,107,2,86,0,1,0,113, - 2,100,1,83,0,41,2,114,29,0,0,0,78,41,1,114, - 31,0,0,0,41,2,114,22,0,0,0,114,77,0,0,0, - 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 221,0,0,0,97,5,0,0,115,2,0,0,0,4,0,122, - 25,95,115,101,116,117,112,46,60,108,111,99,97,108,115,62, - 46,60,103,101,110,101,120,112,114,62,114,59,0,0,0,122, - 30,105,109,112,111,114,116,108,105,98,32,114,101,113,117,105, - 114,101,115,32,112,111,115,105,120,32,111,114,32,110,116,114, - 3,0,0,0,114,25,0,0,0,114,21,0,0,0,114,30, - 0,0,0,90,7,95,116,104,114,101,97,100,78,90,8,95, - 119,101,97,107,114,101,102,90,6,119,105,110,114,101,103,114, - 163,0,0,0,114,6,0,0,0,122,4,46,112,121,119,122, - 6,95,100,46,112,121,100,84,41,4,122,3,95,105,111,122, - 9,95,119,97,114,110,105,110,103,115,122,8,98,117,105,108, - 116,105,110,115,122,7,109,97,114,115,104,97,108,41,19,114, - 114,0,0,0,114,7,0,0,0,114,139,0,0,0,114,233, - 0,0,0,114,105,0,0,0,90,18,95,98,117,105,108,116, - 105,110,95,102,114,111,109,95,110,97,109,101,114,109,0,0, - 0,218,3,97,108,108,218,14,65,115,115,101,114,116,105,111, - 110,69,114,114,111,114,114,99,0,0,0,114,26,0,0,0, - 114,11,0,0,0,114,223,0,0,0,114,143,0,0,0,114, - 21,1,0,0,114,84,0,0,0,114,157,0,0,0,114,162, - 0,0,0,114,167,0,0,0,41,12,218,17,95,98,111,111, - 116,115,116,114,97,112,95,109,111,100,117,108,101,90,11,115, - 101,108,102,95,109,111,100,117,108,101,90,12,98,117,105,108, - 116,105,110,95,110,97,109,101,90,14,98,117,105,108,116,105, - 110,95,109,111,100,117,108,101,90,10,111,115,95,100,101,116, - 97,105,108,115,90,10,98,117,105,108,116,105,110,95,111,115, - 114,21,0,0,0,114,25,0,0,0,90,9,111,115,95,109, - 111,100,117,108,101,90,13,116,104,114,101,97,100,95,109,111, - 100,117,108,101,90,14,119,101,97,107,114,101,102,95,109,111, - 100,117,108,101,90,13,119,105,110,114,101,103,95,109,111,100, - 117,108,101,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,218,6,95,115,101,116,117,112,72,5,0,0,115,82, - 0,0,0,0,8,4,1,6,1,6,3,10,1,10,1,10, - 1,12,2,10,1,16,3,22,1,14,2,22,1,8,1,10, - 1,10,1,4,2,2,1,10,1,6,1,14,1,12,2,8, - 1,12,1,12,1,18,3,2,1,14,1,16,2,10,1,12, - 3,10,1,12,3,10,1,10,1,12,3,14,1,14,1,10, - 1,10,1,10,1,114,29,1,0,0,99,1,0,0,0,0, - 0,0,0,2,0,0,0,3,0,0,0,67,0,0,0,115, - 84,0,0,0,116,0,124,0,131,1,1,0,116,1,131,0, - 125,1,116,2,106,3,106,4,116,5,106,6,124,1,140,0, - 103,1,131,1,1,0,116,7,106,8,100,1,107,2,114,56, - 116,2,106,9,106,10,116,11,131,1,1,0,116,2,106,9, - 106,10,116,12,131,1,1,0,116,5,124,0,95,5,116,13, - 124,0,95,13,100,2,83,0,41,3,122,41,73,110,115,116, - 97,108,108,32,116,104,101,32,112,97,116,104,45,98,97,115, - 101,100,32,105,109,112,111,114,116,32,99,111,109,112,111,110, - 101,110,116,115,46,114,24,1,0,0,78,41,14,114,29,1, - 0,0,114,155,0,0,0,114,7,0,0,0,114,250,0,0, - 0,114,143,0,0,0,114,2,1,0,0,114,15,1,0,0, - 114,3,0,0,0,114,105,0,0,0,218,9,109,101,116,97, - 95,112,97,116,104,114,157,0,0,0,114,162,0,0,0,114, - 245,0,0,0,114,212,0,0,0,41,2,114,28,1,0,0, - 90,17,115,117,112,112,111,114,116,101,100,95,108,111,97,100, - 101,114,115,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,218,8,95,105,110,115,116,97,108,108,140,5,0,0, - 115,16,0,0,0,0,2,8,1,6,1,20,1,10,1,12, - 1,12,4,6,1,114,31,1,0,0,41,3,122,3,119,105, - 110,114,1,0,0,0,114,2,0,0,0,41,56,114,107,0, - 0,0,114,10,0,0,0,114,11,0,0,0,114,17,0,0, - 0,114,19,0,0,0,114,28,0,0,0,114,38,0,0,0, - 114,39,0,0,0,114,43,0,0,0,114,44,0,0,0,114, - 46,0,0,0,114,55,0,0,0,218,4,116,121,112,101,218, - 8,95,95,99,111,100,101,95,95,114,138,0,0,0,114,15, - 0,0,0,114,128,0,0,0,114,14,0,0,0,114,18,0, - 0,0,90,17,95,82,65,87,95,77,65,71,73,67,95,78, - 85,77,66,69,82,114,73,0,0,0,114,72,0,0,0,114, - 84,0,0,0,114,74,0,0,0,90,23,68,69,66,85,71, - 95,66,89,84,69,67,79,68,69,95,83,85,70,70,73,88, - 69,83,90,27,79,80,84,73,77,73,90,69,68,95,66,89, - 84,69,67,79,68,69,95,83,85,70,70,73,88,69,83,114, - 79,0,0,0,114,85,0,0,0,114,91,0,0,0,114,95, - 0,0,0,114,97,0,0,0,114,116,0,0,0,114,123,0, - 0,0,114,135,0,0,0,114,141,0,0,0,114,144,0,0, - 0,114,149,0,0,0,218,6,111,98,106,101,99,116,114,156, - 0,0,0,114,161,0,0,0,114,162,0,0,0,114,178,0, - 0,0,114,188,0,0,0,114,204,0,0,0,114,212,0,0, - 0,114,217,0,0,0,114,223,0,0,0,114,218,0,0,0, - 114,224,0,0,0,114,243,0,0,0,114,245,0,0,0,114, - 2,1,0,0,114,20,1,0,0,114,155,0,0,0,114,29, - 1,0,0,114,31,1,0,0,114,4,0,0,0,114,4,0, - 0,0,114,4,0,0,0,114,5,0,0,0,218,8,60,109, - 111,100,117,108,101,62,8,0,0,0,115,102,0,0,0,4, - 17,4,3,8,12,8,5,8,5,8,6,8,12,8,10,8, - 9,8,5,8,7,10,22,10,116,16,1,12,2,4,1,4, - 2,6,2,6,2,8,2,16,44,8,33,8,19,8,12,8, - 12,8,28,8,17,14,55,14,12,12,10,8,14,6,3,8, - 1,12,65,14,64,14,29,16,110,14,41,18,45,18,16,4, - 3,18,53,14,60,14,42,14,127,0,7,14,127,0,20,10, - 23,8,11,8,68, + 8,60,109,111,100,117,108,101,62,8,0,0,0,115,102,0, + 0,0,4,17,4,3,8,12,8,5,8,5,8,6,8,12, + 8,10,8,9,8,5,8,7,10,22,10,117,16,1,12,2, + 4,1,4,2,6,2,6,2,8,2,16,44,8,33,8,19, + 8,12,8,12,8,28,8,17,14,55,14,12,12,10,8,14, + 6,3,8,1,12,65,14,64,14,29,16,110,14,41,18,45, + 18,16,4,3,18,53,14,60,14,42,14,127,0,7,14,127, + 0,20,10,23,8,11,8,68, }; diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -155,7 +155,7 @@ &&TARGET_BUILD_SET_UNPACK, &&TARGET_SETUP_ASYNC_WITH, &&TARGET_FORMAT_VALUE, - &&_unknown_opcode, + &&TARGET_BUILD_CONST_KEY_MAP, &&_unknown_opcode, &&_unknown_opcode, &&_unknown_opcode, -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 17:43:05 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 11 Jun 2016 21:43:05 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_update_pydoc_t?= =?utf-8?q?opics?= Message-ID: <20160611214305.81005.53178.82E7BB71@psf.io> https://hg.python.org/cpython/rev/d6d529e28649 changeset: 101897:d6d529e28649 branch: 2.7 parent: 101891:d8a0a016d8d4 user: Benjamin Peterson date: Sat Jun 11 14:42:05 2016 -0700 summary: update pydoc topics files: Lib/pydoc_data/topics.py | 13404 ++++++++++++++++++++++++- 1 files changed, 13324 insertions(+), 80 deletions(-) diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,81 +1,13325 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Wed Jan 6 03:48:54 2016 -topics = {'assert': u'\nThe "assert" statement\n**********************\n\nAssert statements are a convenient way to insert debugging assertions\ninto a program:\n\n assert_stmt ::= "assert" expression ["," expression]\n\nThe simple form, "assert expression", is equivalent to\n\n if __debug__:\n if not expression: raise AssertionError\n\nThe extended form, "assert expression1, expression2", is equivalent to\n\n if __debug__:\n if not expression1: raise AssertionError(expression2)\n\nThese equivalences assume that "__debug__" and "AssertionError" refer\nto the built-in variables with those names. In the current\nimplementation, the built-in variable "__debug__" is "True" under\nnormal circumstances, "False" when optimization is requested (command\nline option -O). The current code generator emits no code for an\nassert statement when optimization is requested at compile time. Note\nthat it is unnecessary to include the source code for the expression\nthat failed in the error message; it will be displayed as part of the\nstack trace.\n\nAssignments to "__debug__" are illegal. The value for the built-in\nvariable is determined when the interpreter starts.\n', - 'assignment': u'\nAssignment statements\n*********************\n\nAssignment statements are used to (re)bind names to values and to\nmodify attributes or items of mutable objects:\n\n assignment_stmt ::= (target_list "=")+ (expression_list | yield_expression)\n target_list ::= target ("," target)* [","]\n target ::= identifier\n | "(" target_list ")"\n | "[" target_list "]"\n | attributeref\n | subscription\n | slicing\n\n(See section Primaries for the syntax definitions for the last three\nsymbols.)\n\nAn assignment statement evaluates the expression list (remember that\nthis can be a single expression or a comma-separated list, the latter\nyielding a tuple) and assigns the single resulting object to each of\nthe target lists, from left to right.\n\nAssignment is defined recursively depending on the form of the target\n(list). When a target is part of a mutable object (an attribute\nreference, subscription or slicing), the mutable object must\nultimately perform the assignment and decide about its validity, and\nmay raise an exception if the assignment is unacceptable. The rules\nobserved by various types and the exceptions raised are given with the\ndefinition of the object types (see section The standard type\nhierarchy).\n\nAssignment of an object to a target list is recursively defined as\nfollows.\n\n* If the target list is a single target: The object is assigned to\n that target.\n\n* If the target list is a comma-separated list of targets: The\n object must be an iterable with the same number of items as there\n are targets in the target list, and the items are assigned, from\n left to right, to the corresponding targets.\n\nAssignment of an object to a single target is recursively defined as\nfollows.\n\n* If the target is an identifier (name):\n\n * If the name does not occur in a "global" statement in the\n current code block: the name is bound to the object in the current\n local namespace.\n\n * Otherwise: the name is bound to the object in the current global\n namespace.\n\n The name is rebound if it was already bound. This may cause the\n reference count for the object previously bound to the name to reach\n zero, causing the object to be deallocated and its destructor (if it\n has one) to be called.\n\n* If the target is a target list enclosed in parentheses or in\n square brackets: The object must be an iterable with the same number\n of items as there are targets in the target list, and its items are\n assigned, from left to right, to the corresponding targets.\n\n* If the target is an attribute reference: The primary expression in\n the reference is evaluated. It should yield an object with\n assignable attributes; if this is not the case, "TypeError" is\n raised. That object is then asked to assign the assigned object to\n the given attribute; if it cannot perform the assignment, it raises\n an exception (usually but not necessarily "AttributeError").\n\n Note: If the object is a class instance and the attribute reference\n occurs on both sides of the assignment operator, the RHS expression,\n "a.x" can access either an instance attribute or (if no instance\n attribute exists) a class attribute. The LHS target "a.x" is always\n set as an instance attribute, creating it if necessary. Thus, the\n two occurrences of "a.x" do not necessarily refer to the same\n attribute: if the RHS expression refers to a class attribute, the\n LHS creates a new instance attribute as the target of the\n assignment:\n\n class Cls:\n x = 3 # class variable\n inst = Cls()\n inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x as 3\n\n This description does not necessarily apply to descriptor\n attributes, such as properties created with "property()".\n\n* If the target is a subscription: The primary expression in the\n reference is evaluated. It should yield either a mutable sequence\n object (such as a list) or a mapping object (such as a dictionary).\n Next, the subscript expression is evaluated.\n\n If the primary is a mutable sequence object (such as a list), the\n subscript must yield a plain integer. If it is negative, the\n sequence\'s length is added to it. The resulting value must be a\n nonnegative integer less than the sequence\'s length, and the\n sequence is asked to assign the assigned object to its item with\n that index. If the index is out of range, "IndexError" is raised\n (assignment to a subscripted sequence cannot add new items to a\n list).\n\n If the primary is a mapping object (such as a dictionary), the\n subscript must have a type compatible with the mapping\'s key type,\n and the mapping is then asked to create a key/datum pair which maps\n the subscript to the assigned object. This can either replace an\n existing key/value pair with the same key value, or insert a new\n key/value pair (if no key with the same value existed).\n\n* If the target is a slicing: The primary expression in the\n reference is evaluated. It should yield a mutable sequence object\n (such as a list). The assigned object should be a sequence object\n of the same type. Next, the lower and upper bound expressions are\n evaluated, insofar they are present; defaults are zero and the\n sequence\'s length. The bounds should evaluate to (small) integers.\n If either bound is negative, the sequence\'s length is added to it.\n The resulting bounds are clipped to lie between zero and the\n sequence\'s length, inclusive. Finally, the sequence object is asked\n to replace the slice with the items of the assigned sequence. The\n length of the slice may be different from the length of the assigned\n sequence, thus changing the length of the target sequence, if the\n object allows it.\n\n**CPython implementation detail:** In the current implementation, the\nsyntax for targets is taken to be the same as for expressions, and\ninvalid syntax is rejected during the code generation phase, causing\nless detailed error messages.\n\nWARNING: Although the definition of assignment implies that overlaps\nbetween the left-hand side and the right-hand side are \'safe\' (for\nexample "a, b = b, a" swaps two variables), overlaps *within* the\ncollection of assigned-to variables are not safe! For instance, the\nfollowing program prints "[0, 2]":\n\n x = [0, 1]\n i = 0\n i, x[i] = 1, 2\n print x\n\n\nAugmented assignment statements\n===============================\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n augtarget ::= identifier | attributeref | subscription | slicing\n augop ::= "+=" | "-=" | "*=" | "/=" | "//=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section Primaries for the syntax definitions for the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like "x += 1" can be rewritten as\n"x = x + 1" to achieve a similar, but not exactly equal effect. In the\naugmented version, "x" is only evaluated once. Also, when possible,\nthe actual operation is performed *in-place*, meaning that rather than\ncreating a new object and assigning that to the target, the old object\nis modified instead.\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same caveat about\nclass and instance attributes applies as for regular assignments.\n', - 'atom-identifiers': u'\nIdentifiers (Names)\n*******************\n\nAn identifier occurring as an atom is a name. See section Identifiers\nand keywords for lexical definition and section Naming and binding for\ndocumentation of naming and binding.\n\nWhen the name is bound to an object, evaluation of the atom yields\nthat object. When a name is not bound, an attempt to evaluate it\nraises a "NameError" exception.\n\n**Private name mangling:** When an identifier that textually occurs in\na class definition begins with two or more underscore characters and\ndoes not end in two or more underscores, it is considered a *private\nname* of that class. Private names are transformed to a longer form\nbefore code is generated for them. The transformation inserts the\nclass name, with leading underscores removed and a single underscore\ninserted, in front of the name. For example, the identifier "__spam"\noccurring in a class named "Ham" will be transformed to "_Ham__spam".\nThis transformation is independent of the syntactical context in which\nthe identifier is used. If the transformed name is extremely long\n(longer than 255 characters), implementation defined truncation may\nhappen. If the class name consists only of underscores, no\ntransformation is done.\n', - 'atom-literals': u"\nLiterals\n********\n\nPython supports string literals and various numeric literals:\n\n literal ::= stringliteral | integer | longinteger\n | floatnumber | imagnumber\n\nEvaluation of a literal yields an object of the given type (string,\ninteger, long integer, floating point number, complex number) with the\ngiven value. The value may be approximated in the case of floating\npoint and imaginary (complex) literals. See section Literals for\ndetails.\n\nAll literals correspond to immutable data types, and hence the\nobject's identity is less important than its value. Multiple\nevaluations of literals with the same value (either the same\noccurrence in the program text or a different occurrence) may obtain\nthe same object or a different object with the same value.\n", - 'attribute-access': u'\nCustomizing attribute access\n****************************\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of "x.name") for\nclass instances.\n\nobject.__getattr__(self, name)\n\n Called when an attribute lookup has not found the attribute in the\n usual places (i.e. it is not an instance attribute nor is it found\n in the class tree for "self"). "name" is the attribute name. This\n method should return the (computed) attribute value or raise an\n "AttributeError" exception.\n\n Note that if the attribute is found through the normal mechanism,\n "__getattr__()" is not called. (This is an intentional asymmetry\n between "__getattr__()" and "__setattr__()".) This is done both for\n efficiency reasons and because otherwise "__getattr__()" would have\n no way to access other attributes of the instance. Note that at\n least for instance variables, you can fake total control by not\n inserting any values in the instance attribute dictionary (but\n instead inserting them in another object). See the\n "__getattribute__()" method below for a way to actually get total\n control in new-style classes.\n\nobject.__setattr__(self, name, value)\n\n Called when an attribute assignment is attempted. This is called\n instead of the normal mechanism (i.e. store the value in the\n instance dictionary). *name* is the attribute name, *value* is the\n value to be assigned to it.\n\n If "__setattr__()" wants to assign to an instance attribute, it\n should not simply execute "self.name = value" --- this would cause\n a recursive call to itself. Instead, it should insert the value in\n the dictionary of instance attributes, e.g., "self.__dict__[name] =\n value". For new-style classes, rather than accessing the instance\n dictionary, it should call the base class method with the same\n name, for example, "object.__setattr__(self, name, value)".\n\nobject.__delattr__(self, name)\n\n Like "__setattr__()" but for attribute deletion instead of\n assignment. This should only be implemented if "del obj.name" is\n meaningful for the object.\n\n\nMore attribute access for new-style classes\n===========================================\n\nThe following methods only apply to new-style classes.\n\nobject.__getattribute__(self, name)\n\n Called unconditionally to implement attribute accesses for\n instances of the class. If the class also defines "__getattr__()",\n the latter will not be called unless "__getattribute__()" either\n calls it explicitly or raises an "AttributeError". This method\n should return the (computed) attribute value or raise an\n "AttributeError" exception. In order to avoid infinite recursion in\n this method, its implementation should always call the base class\n method with the same name to access any attributes it needs, for\n example, "object.__getattribute__(self, name)".\n\n Note: This method may still be bypassed when looking up special\n methods as the result of implicit invocation via language syntax\n or built-in functions. See Special method lookup for new-style\n classes.\n\n\nImplementing Descriptors\n========================\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in an\n*owner* class (the descriptor must be in either the owner\'s class\ndictionary or in the class dictionary for one of its parents). In the\nexamples below, "the attribute" refers to the attribute whose name is\nthe key of the property in the owner class\' "__dict__".\n\nobject.__get__(self, instance, owner)\n\n Called to get the attribute of the owner class (class attribute\n access) or of an instance of that class (instance attribute\n access). *owner* is always the owner class, while *instance* is the\n instance that the attribute was accessed through, or "None" when\n the attribute is accessed through the *owner*. This method should\n return the (computed) attribute value or raise an "AttributeError"\n exception.\n\nobject.__set__(self, instance, value)\n\n Called to set the attribute on an instance *instance* of the owner\n class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n Called to delete the attribute on an instance *instance* of the\n owner class.\n\n\nInvoking Descriptors\n====================\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol: "__get__()", "__set__()", and\n"__delete__()". If any of those methods are defined for an object, it\nis said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, "a.x" has a\nlookup chain starting with "a.__dict__[\'x\']", then\n"type(a).__dict__[\'x\']", and continuing through the base classes of\n"type(a)" excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead. Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called. Note that descriptors are only invoked for new\nstyle objects or classes (ones that subclass "object()" or "type()").\n\nThe starting point for descriptor invocation is a binding, "a.x". How\nthe arguments are assembled depends on "a":\n\nDirect Call\n The simplest and least common call is when user code directly\n invokes a descriptor method: "x.__get__(a)".\n\nInstance Binding\n If binding to a new-style object instance, "a.x" is transformed\n into the call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n\nClass Binding\n If binding to a new-style class, "A.x" is transformed into the\n call: "A.__dict__[\'x\'].__get__(None, A)".\n\nSuper Binding\n If "a" is an instance of "super", then the binding "super(B,\n obj).m()" searches "obj.__class__.__mro__" for the base class "A"\n immediately preceding "B" and then invokes the descriptor with the\n call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined. A descriptor can define\nany combination of "__get__()", "__set__()" and "__delete__()". If it\ndoes not define "__get__()", then accessing the attribute will return\nthe descriptor object itself unless there is a value in the object\'s\ninstance dictionary. If the descriptor defines "__set__()" and/or\n"__delete__()", it is a data descriptor; if it defines neither, it is\na non-data descriptor. Normally, data descriptors define both\n"__get__()" and "__set__()", while non-data descriptors have just the\n"__get__()" method. Data descriptors with "__set__()" and "__get__()"\ndefined always override a redefinition in an instance dictionary. In\ncontrast, non-data descriptors can be overridden by instances.\n\nPython methods (including "staticmethod()" and "classmethod()") are\nimplemented as non-data descriptors. Accordingly, instances can\nredefine and override methods. This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe "property()" function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n=========\n\nBy default, instances of both old and new-style classes have a\ndictionary for attribute storage. This wastes space for objects\nhaving very few instance variables. The space consumption can become\nacute when creating large numbers of instances.\n\nThe default can be overridden by defining *__slots__* in a new-style\nclass definition. The *__slots__* declaration takes a sequence of\ninstance variables and reserves just enough space in each instance to\nhold a value for each variable. Space is saved because *__dict__* is\nnot created for each instance.\n\n__slots__\n\n This class variable can be assigned a string, iterable, or sequence\n of strings with variable names used by instances. If defined in a\n new-style class, *__slots__* reserves space for the declared\n variables and prevents the automatic creation of *__dict__* and\n *__weakref__* for each instance.\n\n New in version 2.2.\n\nNotes on using *__slots__*\n\n* When inheriting from a class without *__slots__*, the *__dict__*\n attribute of that class will always be accessible, so a *__slots__*\n definition in the subclass is meaningless.\n\n* Without a *__dict__* variable, instances cannot be assigned new\n variables not listed in the *__slots__* definition. Attempts to\n assign to an unlisted variable name raises "AttributeError". If\n dynamic assignment of new variables is desired, then add\n "\'__dict__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n Changed in version 2.3: Previously, adding "\'__dict__\'" to the\n *__slots__* declaration would not enable the assignment of new\n attributes not specifically listed in the sequence of instance\n variable names.\n\n* Without a *__weakref__* variable for each instance, classes\n defining *__slots__* do not support weak references to its\n instances. If weak reference support is needed, then add\n "\'__weakref__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n Changed in version 2.3: Previously, adding "\'__weakref__\'" to the\n *__slots__* declaration would not enable support for weak\n references.\n\n* *__slots__* are implemented at the class level by creating\n descriptors (Implementing Descriptors) for each variable name. As a\n result, class attributes cannot be used to set default values for\n instance variables defined by *__slots__*; otherwise, the class\n attribute would overwrite the descriptor assignment.\n\n* The action of a *__slots__* declaration is limited to the class\n where it is defined. As a result, subclasses will have a *__dict__*\n unless they also define *__slots__* (which must only contain names\n of any *additional* slots).\n\n* If a class defines a slot also defined in a base class, the\n instance variable defined by the base class slot is inaccessible\n (except by retrieving its descriptor directly from the base class).\n This renders the meaning of the program undefined. In the future, a\n check may be added to prevent this.\n\n* Nonempty *__slots__* does not work for classes derived from\n "variable-length" built-in types such as "long", "str" and "tuple".\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings\n may also be used; however, in the future, special meaning may be\n assigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n *__slots__*.\n\n Changed in version 2.6: Previously, *__class__* assignment raised an\n error if either new or old class had *__slots__*.\n', - 'attribute-references': u'\nAttribute references\n********************\n\nAn attribute reference is a primary followed by a period and a name:\n\n attributeref ::= primary "." identifier\n\nThe primary must evaluate to an object of a type that supports\nattribute references, e.g., a module, list, or an instance. This\nobject is then asked to produce the attribute whose name is the\nidentifier. If this attribute is not available, the exception\n"AttributeError" is raised. Otherwise, the type and value of the\nobject produced is determined by the object. Multiple evaluations of\nthe same attribute reference may yield different objects.\n', - 'augassign': u'\nAugmented assignment statements\n*******************************\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n augtarget ::= identifier | attributeref | subscription | slicing\n augop ::= "+=" | "-=" | "*=" | "/=" | "//=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section Primaries for the syntax definitions for the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like "x += 1" can be rewritten as\n"x = x + 1" to achieve a similar, but not exactly equal effect. In the\naugmented version, "x" is only evaluated once. Also, when possible,\nthe actual operation is performed *in-place*, meaning that rather than\ncreating a new object and assigning that to the target, the old object\nis modified instead.\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same caveat about\nclass and instance attributes applies as for regular assignments.\n', - 'binary': u'\nBinary arithmetic operations\n****************************\n\nThe binary arithmetic operations have the conventional priority\nlevels. Note that some of these operations also apply to certain non-\nnumeric types. Apart from the power operator, there are only two\nlevels, one for multiplicative operators and one for additive\noperators:\n\n m_expr ::= u_expr | m_expr "*" u_expr | m_expr "//" u_expr | m_expr "/" u_expr\n | m_expr "%" u_expr\n a_expr ::= m_expr | a_expr "+" m_expr | a_expr "-" m_expr\n\nThe "*" (multiplication) operator yields the product of its arguments.\nThe arguments must either both be numbers, or one argument must be an\ninteger (plain or long) and the other must be a sequence. In the\nformer case, the numbers are converted to a common type and then\nmultiplied together. In the latter case, sequence repetition is\nperformed; a negative repetition factor yields an empty sequence.\n\nThe "/" (division) and "//" (floor division) operators yield the\nquotient of their arguments. The numeric arguments are first\nconverted to a common type. Plain or long integer division yields an\ninteger of the same type; the result is that of mathematical division\nwith the \'floor\' function applied to the result. Division by zero\nraises the "ZeroDivisionError" exception.\n\nThe "%" (modulo) operator yields the remainder from the division of\nthe first argument by the second. The numeric arguments are first\nconverted to a common type. A zero right argument raises the\n"ZeroDivisionError" exception. The arguments may be floating point\nnumbers, e.g., "3.14%0.7" equals "0.34" (since "3.14" equals "4*0.7 +\n0.34".) The modulo operator always yields a result with the same sign\nas its second operand (or zero); the absolute value of the result is\nstrictly smaller than the absolute value of the second operand [2].\n\nThe integer division and modulo operators are connected by the\nfollowing identity: "x == (x/y)*y + (x%y)". Integer division and\nmodulo are also connected with the built-in function "divmod()":\n"divmod(x, y) == (x/y, x%y)". These identities don\'t hold for\nfloating point numbers; there similar identities hold approximately\nwhere "x/y" is replaced by "floor(x/y)" or "floor(x/y) - 1" [3].\n\nIn addition to performing the modulo operation on numbers, the "%"\noperator is also overloaded by string and unicode objects to perform\nstring formatting (also known as interpolation). The syntax for string\nformatting is described in the Python Library Reference, section\nString Formatting Operations.\n\nDeprecated since version 2.3: The floor division operator, the modulo\noperator, and the "divmod()" function are no longer defined for\ncomplex numbers. Instead, convert to a floating point number using\nthe "abs()" function if appropriate.\n\nThe "+" (addition) operator yields the sum of its arguments. The\narguments must either both be numbers or both sequences of the same\ntype. In the former case, the numbers are converted to a common type\nand then added together. In the latter case, the sequences are\nconcatenated.\n\nThe "-" (subtraction) operator yields the difference of its arguments.\nThe numeric arguments are first converted to a common type.\n', - 'bitwise': u'\nBinary bitwise operations\n*************************\n\nEach of the three bitwise operations has a different priority level:\n\n and_expr ::= shift_expr | and_expr "&" shift_expr\n xor_expr ::= and_expr | xor_expr "^" and_expr\n or_expr ::= xor_expr | or_expr "|" xor_expr\n\nThe "&" operator yields the bitwise AND of its arguments, which must\nbe plain or long integers. The arguments are converted to a common\ntype.\n\nThe "^" operator yields the bitwise XOR (exclusive OR) of its\narguments, which must be plain or long integers. The arguments are\nconverted to a common type.\n\nThe "|" operator yields the bitwise (inclusive) OR of its arguments,\nwhich must be plain or long integers. The arguments are converted to\na common type.\n', - 'bltin-code-objects': u'\nCode Objects\n************\n\nCode objects are used by the implementation to represent "pseudo-\ncompiled" executable Python code such as a function body. They differ\nfrom function objects because they don\'t contain a reference to their\nglobal execution environment. Code objects are returned by the built-\nin "compile()" function and can be extracted from function objects\nthrough their "func_code" attribute. See also the "code" module.\n\nA code object can be executed or evaluated by passing it (instead of a\nsource string) to the "exec" statement or the built-in "eval()"\nfunction.\n\nSee The standard type hierarchy for more information.\n', - 'bltin-ellipsis-object': u'\nThe Ellipsis Object\n*******************\n\nThis object is used by extended slice notation (see Slicings). It\nsupports no special operations. There is exactly one ellipsis object,\nnamed "Ellipsis" (a built-in name).\n\nIt is written as "Ellipsis". When in a subscript, it can also be\nwritten as "...", for example "seq[...]".\n', - 'bltin-file-objects': u'\nFile Objects\n************\n\nFile objects are implemented using C\'s "stdio" package and can be\ncreated with the built-in "open()" function. File objects are also\nreturned by some other built-in functions and methods, such as\n"os.popen()" and "os.fdopen()" and the "makefile()" method of socket\nobjects. Temporary files can be created using the "tempfile" module,\nand high-level file operations such as copying, moving, and deleting\nfiles and directories can be achieved with the "shutil" module.\n\nWhen a file operation fails for an I/O-related reason, the exception\n"IOError" is raised. This includes situations where the operation is\nnot defined for some reason, like "seek()" on a tty device or writing\na file opened for reading.\n\nFiles have the following methods:\n\nfile.close()\n\n Close the file. A closed file cannot be read or written any more.\n Any operation which requires that the file be open will raise a\n "ValueError" after the file has been closed. Calling "close()"\n more than once is allowed.\n\n As of Python 2.5, you can avoid having to call this method\n explicitly if you use the "with" statement. For example, the\n following code will automatically close *f* when the "with" block\n is exited:\n\n from __future__ import with_statement # This isn\'t required in Python 2.6\n\n with open("hello.txt") as f:\n for line in f:\n print line,\n\n In older versions of Python, you would have needed to do this to\n get the same effect:\n\n f = open("hello.txt")\n try:\n for line in f:\n print line,\n finally:\n f.close()\n\n Note: Not all "file-like" types in Python support use as a\n context manager for the "with" statement. If your code is\n intended to work with any file-like object, you can use the\n function "contextlib.closing()" instead of using the object\n directly.\n\nfile.flush()\n\n Flush the internal buffer, like "stdio"\'s "fflush()". This may be\n a no-op on some file-like objects.\n\n Note: "flush()" does not necessarily write the file\'s data to\n disk. Use "flush()" followed by "os.fsync()" to ensure this\n behavior.\n\nfile.fileno()\n\n Return the integer "file descriptor" that is used by the underlying\n implementation to request I/O operations from the operating system.\n This can be useful for other, lower level interfaces that use file\n descriptors, such as the "fcntl" module or "os.read()" and friends.\n\n Note: File-like objects which do not have a real file descriptor\n should *not* provide this method!\n\nfile.isatty()\n\n Return "True" if the file is connected to a tty(-like) device, else\n "False".\n\n Note: If a file-like object is not associated with a real file,\n this method should *not* be implemented.\n\nfile.next()\n\n A file object is its own iterator, for example "iter(f)" returns\n *f* (unless *f* is closed). When a file is used as an iterator,\n typically in a "for" loop (for example, "for line in f: print\n line.strip()"), the "next()" method is called repeatedly. This\n method returns the next input line, or raises "StopIteration" when\n EOF is hit when the file is open for reading (behavior is undefined\n when the file is open for writing). In order to make a "for" loop\n the most efficient way of looping over the lines of a file (a very\n common operation), the "next()" method uses a hidden read-ahead\n buffer. As a consequence of using a read-ahead buffer, combining\n "next()" with other file methods (like "readline()") does not work\n right. However, using "seek()" to reposition the file to an\n absolute position will flush the read-ahead buffer.\n\n New in version 2.3.\n\nfile.read([size])\n\n Read at most *size* bytes from the file (less if the read hits EOF\n before obtaining *size* bytes). If the *size* argument is negative\n or omitted, read all data until EOF is reached. The bytes are\n returned as a string object. An empty string is returned when EOF\n is encountered immediately. (For certain files, like ttys, it\n makes sense to continue reading after an EOF is hit.) Note that\n this method may call the underlying C function "fread()" more than\n once in an effort to acquire as close to *size* bytes as possible.\n Also note that when in non-blocking mode, less data than was\n requested may be returned, even if no *size* parameter was given.\n\n Note: This function is simply a wrapper for the underlying\n "fread()" C function, and will behave the same in corner cases,\n such as whether the EOF value is cached.\n\nfile.readline([size])\n\n Read one entire line from the file. A trailing newline character\n is kept in the string (but may be absent when a file ends with an\n incomplete line). [6] If the *size* argument is present and non-\n negative, it is a maximum byte count (including the trailing\n newline) and an incomplete line may be returned. When *size* is not\n 0, an empty string is returned *only* when EOF is encountered\n immediately.\n\n Note: Unlike "stdio"\'s "fgets()", the returned string contains\n null characters ("\'\\0\'") if they occurred in the input.\n\nfile.readlines([sizehint])\n\n Read until EOF using "readline()" and return a list containing the\n lines thus read. If the optional *sizehint* argument is present,\n instead of reading up to EOF, whole lines totalling approximately\n *sizehint* bytes (possibly after rounding up to an internal buffer\n size) are read. Objects implementing a file-like interface may\n choose to ignore *sizehint* if it cannot be implemented, or cannot\n be implemented efficiently.\n\nfile.xreadlines()\n\n This method returns the same thing as "iter(f)".\n\n New in version 2.1.\n\n Deprecated since version 2.3: Use "for line in file" instead.\n\nfile.seek(offset[, whence])\n\n Set the file\'s current position, like "stdio"\'s "fseek()". The\n *whence* argument is optional and defaults to "os.SEEK_SET" or "0"\n (absolute file positioning); other values are "os.SEEK_CUR" or "1"\n (seek relative to the current position) and "os.SEEK_END" or "2"\n (seek relative to the file\'s end). There is no return value.\n\n For example, "f.seek(2, os.SEEK_CUR)" advances the position by two\n and "f.seek(-3, os.SEEK_END)" sets the position to the third to\n last.\n\n Note that if the file is opened for appending (mode "\'a\'" or\n "\'a+\'"), any "seek()" operations will be undone at the next write.\n If the file is only opened for writing in append mode (mode "\'a\'"),\n this method is essentially a no-op, but it remains useful for files\n opened in append mode with reading enabled (mode "\'a+\'"). If the\n file is opened in text mode (without "\'b\'"), only offsets returned\n by "tell()" are legal. Use of other offsets causes undefined\n behavior.\n\n Note that not all file objects are seekable.\n\n Changed in version 2.6: Passing float values as offset has been\n deprecated.\n\nfile.tell()\n\n Return the file\'s current position, like "stdio"\'s "ftell()".\n\n Note: On Windows, "tell()" can return illegal values (after an\n "fgets()") when reading files with Unix-style line-endings. Use\n binary mode ("\'rb\'") to circumvent this problem.\n\nfile.truncate([size])\n\n Truncate the file\'s size. If the optional *size* argument is\n present, the file is truncated to (at most) that size. The size\n defaults to the current position. The current file position is not\n changed. Note that if a specified size exceeds the file\'s current\n size, the result is platform-dependent: possibilities include that\n the file may remain unchanged, increase to the specified size as if\n zero-filled, or increase to the specified size with undefined new\n content. Availability: Windows, many Unix variants.\n\nfile.write(str)\n\n Write a string to the file. There is no return value. Due to\n buffering, the string may not actually show up in the file until\n the "flush()" or "close()" method is called.\n\nfile.writelines(sequence)\n\n Write a sequence of strings to the file. The sequence can be any\n iterable object producing strings, typically a list of strings.\n There is no return value. (The name is intended to match\n "readlines()"; "writelines()" does not add line separators.)\n\nFiles support the iterator protocol. Each iteration returns the same\nresult as "readline()", and iteration ends when the "readline()"\nmethod returns an empty string.\n\nFile objects also offer a number of other interesting attributes.\nThese are not required for file-like objects, but should be\nimplemented if they make sense for the particular object.\n\nfile.closed\n\n bool indicating the current state of the file object. This is a\n read-only attribute; the "close()" method changes the value. It may\n not be available on all file-like objects.\n\nfile.encoding\n\n The encoding that this file uses. When Unicode strings are written\n to a file, they will be converted to byte strings using this\n encoding. In addition, when the file is connected to a terminal,\n the attribute gives the encoding that the terminal is likely to use\n (that information might be incorrect if the user has misconfigured\n the terminal). The attribute is read-only and may not be present\n on all file-like objects. It may also be "None", in which case the\n file uses the system default encoding for converting Unicode\n strings.\n\n New in version 2.3.\n\nfile.errors\n\n The Unicode error handler used along with the encoding.\n\n New in version 2.6.\n\nfile.mode\n\n The I/O mode for the file. If the file was created using the\n "open()" built-in function, this will be the value of the *mode*\n parameter. This is a read-only attribute and may not be present on\n all file-like objects.\n\nfile.name\n\n If the file object was created using "open()", the name of the\n file. Otherwise, some string that indicates the source of the file\n object, of the form "<...>". This is a read-only attribute and may\n not be present on all file-like objects.\n\nfile.newlines\n\n If Python was built with *universal newlines* enabled (the default)\n this read-only attribute exists, and for files opened in universal\n newline read mode it keeps track of the types of newlines\n encountered while reading the file. The values it can take are\n "\'\\r\'", "\'\\n\'", "\'\\r\\n\'", "None" (unknown, no newlines read yet) or\n a tuple containing all the newline types seen, to indicate that\n multiple newline conventions were encountered. For files not opened\n in universal newlines read mode the value of this attribute will be\n "None".\n\nfile.softspace\n\n Boolean that indicates whether a space character needs to be\n printed before another value when using the "print" statement.\n Classes that are trying to simulate a file object should also have\n a writable "softspace" attribute, which should be initialized to\n zero. This will be automatic for most classes implemented in\n Python (care may be needed for objects that override attribute\n access); types implemented in C will have to provide a writable\n "softspace" attribute.\n\n Note: This attribute is not used to control the "print"\n statement, but to allow the implementation of "print" to keep\n track of its internal state.\n', - 'bltin-null-object': u'\nThe Null Object\n***************\n\nThis object is returned by functions that don\'t explicitly return a\nvalue. It supports no special operations. There is exactly one null\nobject, named "None" (a built-in name).\n\nIt is written as "None".\n', - 'bltin-type-objects': u'\nType Objects\n************\n\nType objects represent the various object types. An object\'s type is\naccessed by the built-in function "type()". There are no special\noperations on types. The standard module "types" defines names for\nall standard built-in types.\n\nTypes are written like this: "".\n', - 'booleans': u'\nBoolean operations\n******************\n\n or_test ::= and_test | or_test "or" and_test\n and_test ::= not_test | and_test "and" not_test\n not_test ::= comparison | "not" not_test\n\nIn the context of Boolean operations, and also when expressions are\nused by control flow statements, the following values are interpreted\nas false: "False", "None", numeric zero of all types, and empty\nstrings and containers (including strings, tuples, lists,\ndictionaries, sets and frozensets). All other values are interpreted\nas true. (See the "__nonzero__()" special method for a way to change\nthis.)\n\nThe operator "not" yields "True" if its argument is false, "False"\notherwise.\n\nThe expression "x and y" first evaluates *x*; if *x* is false, its\nvalue is returned; otherwise, *y* is evaluated and the resulting value\nis returned.\n\nThe expression "x or y" first evaluates *x*; if *x* is true, its value\nis returned; otherwise, *y* is evaluated and the resulting value is\nreturned.\n\n(Note that neither "and" nor "or" restrict the value and type they\nreturn to "False" and "True", but rather return the last evaluated\nargument. This is sometimes useful, e.g., if "s" is a string that\nshould be replaced by a default value if it is empty, the expression\n"s or \'foo\'" yields the desired value. Because "not" has to invent a\nvalue anyway, it does not bother to return a value of the same type as\nits argument, so e.g., "not \'foo\'" yields "False", not "\'\'".)\n', - 'break': u'\nThe "break" statement\n*********************\n\n break_stmt ::= "break"\n\n"break" may only occur syntactically nested in a "for" or "while"\nloop, but not nested in a function or class definition within that\nloop.\n\nIt terminates the nearest enclosing loop, skipping the optional "else"\nclause if the loop has one.\n\nIf a "for" loop is terminated by "break", the loop control target\nkeeps its current value.\n\nWhen "break" passes control out of a "try" statement with a "finally"\nclause, that "finally" clause is executed before really leaving the\nloop.\n', - 'callable-types': u'\nEmulating callable objects\n**************************\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, "x(arg1, arg2, ...)" is a shorthand for\n "x.__call__(arg1, arg2, ...)".\n', - 'calls': u'\nCalls\n*****\n\nA call calls a callable object (e.g., a *function*) with a possibly\nempty series of *arguments*:\n\n call ::= primary "(" [argument_list [","]\n | expression genexpr_for] ")"\n argument_list ::= positional_arguments ["," keyword_arguments]\n ["," "*" expression] ["," keyword_arguments]\n ["," "**" expression]\n | keyword_arguments ["," "*" expression]\n ["," "**" expression]\n | "*" expression ["," keyword_arguments] ["," "**" expression]\n | "**" expression\n positional_arguments ::= expression ("," expression)*\n keyword_arguments ::= keyword_item ("," keyword_item)*\n keyword_item ::= identifier "=" expression\n\nA trailing comma may be present after the positional and keyword\narguments but does not affect the semantics.\n\nThe primary must evaluate to a callable object (user-defined\nfunctions, built-in functions, methods of built-in objects, class\nobjects, methods of class instances, and certain class instances\nthemselves are callable; extensions may define additional callable\nobject types). All argument expressions are evaluated before the call\nis attempted. Please refer to section Function definitions for the\nsyntax of formal *parameter* lists.\n\nIf keyword arguments are present, they are first converted to\npositional arguments, as follows. First, a list of unfilled slots is\ncreated for the formal parameters. If there are N positional\narguments, they are placed in the first N slots. Next, for each\nkeyword argument, the identifier is used to determine the\ncorresponding slot (if the identifier is the same as the first formal\nparameter name, the first slot is used, and so on). If the slot is\nalready filled, a "TypeError" exception is raised. Otherwise, the\nvalue of the argument is placed in the slot, filling it (even if the\nexpression is "None", it fills the slot). When all arguments have\nbeen processed, the slots that are still unfilled are filled with the\ncorresponding default value from the function definition. (Default\nvalues are calculated, once, when the function is defined; thus, a\nmutable object such as a list or dictionary used as default value will\nbe shared by all calls that don\'t specify an argument value for the\ncorresponding slot; this should usually be avoided.) If there are any\nunfilled slots for which no default value is specified, a "TypeError"\nexception is raised. Otherwise, the list of filled slots is used as\nthe argument list for the call.\n\n**CPython implementation detail:** An implementation may provide\nbuilt-in functions whose positional parameters do not have names, even\nif they are \'named\' for the purpose of documentation, and which\ntherefore cannot be supplied by keyword. In CPython, this is the case\nfor functions implemented in C that use "PyArg_ParseTuple()" to parse\ntheir arguments.\n\nIf there are more positional arguments than there are formal parameter\nslots, a "TypeError" exception is raised, unless a formal parameter\nusing the syntax "*identifier" is present; in this case, that formal\nparameter receives a tuple containing the excess positional arguments\n(or an empty tuple if there were no excess positional arguments).\n\nIf any keyword argument does not correspond to a formal parameter\nname, a "TypeError" exception is raised, unless a formal parameter\nusing the syntax "**identifier" is present; in this case, that formal\nparameter receives a dictionary containing the excess keyword\narguments (using the keywords as keys and the argument values as\ncorresponding values), or a (new) empty dictionary if there were no\nexcess keyword arguments.\n\nIf the syntax "*expression" appears in the function call, "expression"\nmust evaluate to an iterable. Elements from this iterable are treated\nas if they were additional positional arguments; if there are\npositional arguments *x1*, ..., *xN*, and "expression" evaluates to a\nsequence *y1*, ..., *yM*, this is equivalent to a call with M+N\npositional arguments *x1*, ..., *xN*, *y1*, ..., *yM*.\n\nA consequence of this is that although the "*expression" syntax may\nappear *after* some keyword arguments, it is processed *before* the\nkeyword arguments (and the "**expression" argument, if any -- see\nbelow). So:\n\n >>> def f(a, b):\n ... print a, b\n ...\n >>> f(b=1, *(2,))\n 2 1\n >>> f(a=1, *(2,))\n Traceback (most recent call last):\n File "", line 1, in ?\n TypeError: f() got multiple values for keyword argument \'a\'\n >>> f(1, *(2,))\n 1 2\n\nIt is unusual for both keyword arguments and the "*expression" syntax\nto be used in the same call, so in practice this confusion does not\narise.\n\nIf the syntax "**expression" appears in the function call,\n"expression" must evaluate to a mapping, the contents of which are\ntreated as additional keyword arguments. In the case of a keyword\nappearing in both "expression" and as an explicit keyword argument, a\n"TypeError" exception is raised.\n\nFormal parameters using the syntax "*identifier" or "**identifier"\ncannot be used as positional argument slots or as keyword argument\nnames. Formal parameters using the syntax "(sublist)" cannot be used\nas keyword argument names; the outermost sublist corresponds to a\nsingle unnamed argument slot, and the argument value is assigned to\nthe sublist using the usual tuple assignment rules after all other\nparameter processing is done.\n\nA call always returns some value, possibly "None", unless it raises an\nexception. How this value is computed depends on the type of the\ncallable object.\n\nIf it is---\n\na user-defined function:\n The code block for the function is executed, passing it the\n argument list. The first thing the code block will do is bind the\n formal parameters to the arguments; this is described in section\n Function definitions. When the code block executes a "return"\n statement, this specifies the return value of the function call.\n\na built-in function or method:\n The result is up to the interpreter; see Built-in Functions for the\n descriptions of built-in functions and methods.\n\na class object:\n A new instance of that class is returned.\n\na class instance method:\n The corresponding user-defined function is called, with an argument\n list that is one longer than the argument list of the call: the\n instance becomes the first argument.\n\na class instance:\n The class must define a "__call__()" method; the effect is then the\n same as if that method was called.\n', - 'class': u'\nClass definitions\n*****************\n\nA class definition defines a class object (see section The standard\ntype hierarchy):\n\n classdef ::= "class" classname [inheritance] ":" suite\n inheritance ::= "(" [expression_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. It first evaluates the\ninheritance list, if present. Each item in the inheritance list\nshould evaluate to a class object or class type which allows\nsubclassing. The class\'s suite is then executed in a new execution\nframe (see section Naming and binding), using a newly created local\nnamespace and the original global namespace. (Usually, the suite\ncontains only function definitions.) When the class\'s suite finishes\nexecution, its execution frame is discarded but its local namespace is\nsaved. [4] A class object is then created using the inheritance list\nfor the base classes and the saved local namespace for the attribute\ndictionary. The class name is bound to this class object in the\noriginal local namespace.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass variables; they are shared by all instances. To create instance\nvariables, they can be set in a method with "self.name = value". Both\nclass and instance variables are accessible through the notation\n""self.name"", and an instance variable hides a class variable with\nthe same name when accessed in this way. Class variables can be used\nas defaults for instance variables, but using mutable values there can\nlead to unexpected results. For *new-style class*es, descriptors can\nbe used to create instance variables with different implementation\ndetails.\n\nClass definitions, like function definitions, may be wrapped by one or\nmore *decorator* expressions. The evaluation rules for the decorator\nexpressions are the same as for functions. The result must be a class\nobject, which is then bound to the class name.\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack unless\n there is a "finally" clause which happens to raise another\n exception. That new exception causes the old one to be lost.\n\n[2] Currently, control "flows off the end" except in the case of\n an exception or the execution of a "return", "continue", or\n "break" statement.\n\n[3] A string literal appearing as the first statement in the\n function body is transformed into the function\'s "__doc__"\n attribute and therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s "__doc__" item and\n therefore the class\'s *docstring*.\n', - 'comparisons': u'\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation. Also unlike C, expressions like "a < b < c" have the\ninterpretation that is conventional in mathematics:\n\n comparison ::= or_expr ( comp_operator or_expr )*\n comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "<>" | "!="\n | "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: "True" or "False".\n\nComparisons can be chained arbitrarily, e.g., "x < y <= z" is\nequivalent to "x < y and y <= z", except that "y" is evaluated only\nonce (but in both cases "z" is not evaluated at all when "x < y" is\nfound to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then "a op1 b op2 c ... y\nopN z" is equivalent to "a op1 b and b op2 c and ... y opN z", except\nthat each expression is evaluated at most once.\n\nNote that "a op1 b op2 c" doesn\'t imply any kind of comparison between\n*a* and *c*, so that, e.g., "x < y > z" is perfectly legal (though\nperhaps not pretty).\n\nThe forms "<>" and "!=" are equivalent; for consistency with C, "!="\nis preferred; where "!=" is mentioned below "<>" is also accepted.\nThe "<>" spelling is considered obsolescent.\n\nThe operators "<", ">", "==", ">=", "<=", and "!=" compare the values\nof two objects. The objects need not have the same type. If both are\nnumbers, they are converted to a common type. Otherwise, objects of\ndifferent types *always* compare unequal, and are ordered consistently\nbut arbitrarily. You can control comparison behavior of objects of\nnon-built-in types by defining a "__cmp__" method or rich comparison\nmethods like "__gt__", described in section Special method names.\n\n(This unusual definition of comparison was used to simplify the\ndefinition of operations like sorting and the "in" and "not in"\noperators. In the future, the comparison rules for objects of\ndifferent types are likely to change.)\n\nComparison of objects of the same type depends on the type:\n\n* Numbers are compared arithmetically.\n\n* Strings are compared lexicographically using the numeric\n equivalents (the result of the built-in function "ord()") of their\n characters. Unicode and 8-bit strings are fully interoperable in\n this behavior. [4]\n\n* Tuples and lists are compared lexicographically using comparison\n of corresponding elements. This means that to compare equal, each\n element must compare equal and the two sequences must be of the same\n type and have the same length.\n\n If not equal, the sequences are ordered the same as their first\n differing elements. For example, "cmp([1,2,x], [1,2,y])" returns\n the same as "cmp(x,y)". If the corresponding element does not\n exist, the shorter sequence is ordered first (for example, "[1,2] <\n [1,2,3]").\n\n* Mappings (dictionaries) compare equal if and only if their sorted\n (key, value) lists compare equal. [5] Outcomes other than equality\n are resolved consistently, but are not otherwise defined. [6]\n\n* Most other objects of built-in types compare unequal unless they\n are the same object; the choice whether one object is considered\n smaller or larger than another one is made arbitrarily but\n consistently within one execution of a program.\n\nThe operators "in" and "not in" test for collection membership. "x in\ns" evaluates to true if *x* is a member of the collection *s*, and\nfalse otherwise. "x not in s" returns the negation of "x in s". The\ncollection membership test has traditionally been bound to sequences;\nan object is a member of a collection if the collection is a sequence\nand contains an element equal to that object. However, it make sense\nfor many other object types to support membership tests without being\na sequence. In particular, dictionaries (for keys) and sets support\nmembership testing.\n\nFor the list and tuple types, "x in y" is true if and only if there\nexists an index *i* such that "x == y[i]" is true.\n\nFor the Unicode and string types, "x in y" is true if and only if *x*\nis a substring of *y*. An equivalent test is "y.find(x) != -1".\nNote, *x* and *y* need not be the same type; consequently, "u\'ab\' in\n\'abc\'" will return "True". Empty strings are always considered to be a\nsubstring of any other string, so """ in "abc"" will return "True".\n\nChanged in version 2.3: Previously, *x* was required to be a string of\nlength "1".\n\nFor user-defined classes which define the "__contains__()" method, "x\nin y" is true if and only if "y.__contains__(x)" is true.\n\nFor user-defined classes which do not define "__contains__()" but do\ndefine "__iter__()", "x in y" is true if some value "z" with "x == z"\nis produced while iterating over "y". If an exception is raised\nduring the iteration, it is as if "in" raised that exception.\n\nLastly, the old-style iteration protocol is tried: if a class defines\n"__getitem__()", "x in y" is true if and only if there is a non-\nnegative integer index *i* such that "x == y[i]", and all lower\ninteger indices do not raise "IndexError" exception. (If any other\nexception is raised, it is as if "in" raised that exception).\n\nThe operator "not in" is defined to have the inverse true value of\n"in".\n\nThe operators "is" and "is not" test for object identity: "x is y" is\ntrue if and only if *x* and *y* are the same object. "x is not y"\nyields the inverse truth value. [7]\n', - 'compound': u'\nCompound statements\n*******************\n\nCompound statements contain (groups of) other statements; they affect\nor control the execution of those other statements in some way. In\ngeneral, compound statements span multiple lines, although in simple\nincarnations a whole compound statement may be contained in one line.\n\nThe "if", "while" and "for" statements implement traditional control\nflow constructs. "try" specifies exception handlers and/or cleanup\ncode for a group of statements. Function and class definitions are\nalso syntactically compound statements.\n\nCompound statements consist of one or more \'clauses.\' A clause\nconsists of a header and a \'suite.\' The clause headers of a\nparticular compound statement are all at the same indentation level.\nEach clause header begins with a uniquely identifying keyword and ends\nwith a colon. A suite is a group of statements controlled by a\nclause. A suite can be one or more semicolon-separated simple\nstatements on the same line as the header, following the header\'s\ncolon, or it can be one or more indented statements on subsequent\nlines. Only the latter form of suite can contain nested compound\nstatements; the following is illegal, mostly because it wouldn\'t be\nclear to which "if" clause a following "else" clause would belong:\n\n if test1: if test2: print x\n\nAlso note that the semicolon binds tighter than the colon in this\ncontext, so that in the following example, either all or none of the\n"print" statements are executed:\n\n if x < y < z: print x; print y; print z\n\nSummarizing:\n\n compound_stmt ::= if_stmt\n | while_stmt\n | for_stmt\n | try_stmt\n | with_stmt\n | funcdef\n | classdef\n | decorated\n suite ::= stmt_list NEWLINE | NEWLINE INDENT statement+ DEDENT\n statement ::= stmt_list NEWLINE | compound_stmt\n stmt_list ::= simple_stmt (";" simple_stmt)* [";"]\n\nNote that statements always end in a "NEWLINE" possibly followed by a\n"DEDENT". Also note that optional continuation clauses always begin\nwith a keyword that cannot start a statement, thus there are no\nambiguities (the \'dangling "else"\' problem is solved in Python by\nrequiring nested "if" statements to be indented).\n\nThe formatting of the grammar rules in the following sections places\neach clause on a separate line for clarity.\n\n\nThe "if" statement\n==================\n\nThe "if" statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section Boolean operations\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n\n\nThe "while" statement\n=====================\n\nThe "while" statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the "else" clause, if present, is executed\nand the loop terminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and goes back\nto testing the expression.\n\n\nThe "for" statement\n===================\n\nThe "for" statement is used to iterate over the elements of a sequence\n(such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n"expression_list". The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments, and then the suite is executed. When the items are\nexhausted (which is immediately when the sequence is empty), the suite\nin the "else" clause, if present, is executed, and the loop\nterminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and continues\nwith the next item, or with the "else" clause if there was no next\nitem.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nThe target list is not deleted when the loop is finished, but if the\nsequence is empty, it will not have been assigned to at all by the\nloop. Hint: the built-in function "range()" returns a sequence of\nintegers suitable to emulate the effect of Pascal\'s "for i := a to b\ndo"; e.g., "range(3)" returns the list "[0, 1, 2]".\n\nNote: There is a subtlety when the sequence is being modified by the\n loop (this can only occur for mutable sequences, i.e. lists). An\n internal counter is used to keep track of which item is used next,\n and this is incremented on each iteration. When this counter has\n reached the length of the sequence the loop terminates. This means\n that if the suite deletes the current (or a previous) item from the\n sequence, the next item will be skipped (since it gets the index of\n the current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n\n\nThe "try" statement\n===================\n\nThe "try" statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression [("as" | ",") identifier]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nChanged in version 2.5: In previous versions of Python,\n"try"..."except"..."finally" did not work. "try"..."except" had to be\nnested in "try"..."finally".\n\nThe "except" clause(s) specify one or more exception handlers. When no\nexception occurs in the "try" clause, no exception handler is\nexecuted. When an exception occurs in the "try" suite, a search for an\nexception handler is started. This search inspects the except clauses\nin turn until one is found that matches the exception. An expression-\nless except clause, if present, must be last; it matches any\nexception. For an except clause with an expression, that expression\nis evaluated, and the clause matches the exception if the resulting\nobject is "compatible" with the exception. An object is compatible\nwith an exception if it is the class or a base class of the exception\nobject, or a tuple containing an item compatible with the exception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire "try" statement raised\nthe exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified in that except clause, if present, and the except\nclause\'s suite is executed. All except clauses must have an\nexecutable block. When the end of this block is reached, execution\ncontinues normally after the entire try statement. (This means that\nif two nested handlers exist for the same exception, and the exception\noccurs in the try clause of the inner handler, the outer handler will\nnot handle the exception.)\n\nBefore an except clause\'s suite is executed, details about the\nexception are assigned to three variables in the "sys" module:\n"sys.exc_type" receives the object identifying the exception;\n"sys.exc_value" receives the exception\'s parameter;\n"sys.exc_traceback" receives a traceback object (see section The\nstandard type hierarchy) identifying the point in the program where\nthe exception occurred. These details are also available through the\n"sys.exc_info()" function, which returns a tuple "(exc_type,\nexc_value, exc_traceback)". Use of the corresponding variables is\ndeprecated in favor of this function, since their use is unsafe in a\nthreaded program. As of Python 1.5, the variables are restored to\ntheir previous values (before the call) when returning from a function\nthat handled an exception.\n\nThe optional "else" clause is executed if and when control flows off\nthe end of the "try" clause. [2] Exceptions in the "else" clause are\nnot handled by the preceding "except" clauses.\n\nIf "finally" is present, it specifies a \'cleanup\' handler. The "try"\nclause is executed, including any "except" and "else" clauses. If an\nexception occurs in any of the clauses and is not handled, the\nexception is temporarily saved. The "finally" clause is executed. If\nthere is a saved exception, it is re-raised at the end of the\n"finally" clause. If the "finally" clause raises another exception or\nexecutes a "return" or "break" statement, the saved exception is\ndiscarded:\n\n >>> def f():\n ... try:\n ... 1/0\n ... finally:\n ... return 42\n ...\n >>> f()\n 42\n\nThe exception information is not available to the program during\nexecution of the "finally" clause.\n\nWhen a "return", "break" or "continue" statement is executed in the\n"try" suite of a "try"..."finally" statement, the "finally" clause is\nalso executed \'on the way out.\' A "continue" statement is illegal in\nthe "finally" clause. (The reason is a problem with the current\nimplementation --- this restriction may be lifted in the future).\n\nThe return value of a function is determined by the last "return"\nstatement executed. Since the "finally" clause always executes, a\n"return" statement executed in the "finally" clause will always be the\nlast one executed:\n\n >>> def foo():\n ... try:\n ... return \'try\'\n ... finally:\n ... return \'finally\'\n ...\n >>> foo()\n \'finally\'\n\nAdditional information on exceptions can be found in section\nExceptions, and information on using the "raise" statement to generate\nexceptions may be found in section The raise statement.\n\n\nThe "with" statement\n====================\n\nNew in version 2.5.\n\nThe "with" statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section With Statement\nContext Managers). This allows common "try"..."except"..."finally"\nusage patterns to be encapsulated for convenient reuse.\n\n with_stmt ::= "with" with_item ("," with_item)* ":" suite\n with_item ::= expression ["as" target]\n\nThe execution of the "with" statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the "with_item")\n is evaluated to obtain a context manager.\n\n2. The context manager\'s "__exit__()" is loaded for later use.\n\n3. The context manager\'s "__enter__()" method is invoked.\n\n4. If a target was included in the "with" statement, the return\n value from "__enter__()" is assigned to it.\n\n Note: The "with" statement guarantees that if the "__enter__()"\n method returns without an error, then "__exit__()" will always be\n called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s "__exit__()" method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to "__exit__()". Otherwise, three\n "None" arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the "__exit__()" method was false, the exception is reraised.\n If the return value was true, the exception is suppressed, and\n execution continues with the statement following the "with"\n statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from "__exit__()" is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple "with" statements were nested:\n\n with A() as a, B() as b:\n suite\n\nis equivalent to\n\n with A() as a:\n with B() as b:\n suite\n\nNote: In Python 2.5, the "with" statement is only allowed when the\n "with_statement" feature has been enabled. It is always enabled in\n Python 2.6.\n\nChanged in version 2.7: Support for multiple context expressions.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python "with"\n statement.\n\n\nFunction definitions\n====================\n\nA function definition defines a user-defined function object (see\nsection The standard type hierarchy):\n\n decorated ::= decorators (classdef | funcdef)\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n funcdef ::= "def" funcname "(" [parameter_list] ")" ":" suite\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n ( "*" identifier ["," "**" identifier]\n | "**" identifier\n | defparameter [","] )\n defparameter ::= parameter ["=" expression]\n sublist ::= parameter ("," parameter)* [","]\n parameter ::= identifier | "(" sublist ")"\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code:\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to:\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more top-level *parameters* have the form *parameter* "="\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding *argument* may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters must also have a default value --- this is a syntactic\nrestriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.** This means that the expression is evaluated once, when\nthe function is defined, and that the same "pre-computed" value is\nused for each call. This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended. A way around this is to use "None" as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section Calls.\nA function call always assigns values to all parameters mentioned in\nthe parameter list, either from position arguments, from keyword\narguments, or from default values. If the form ""*identifier"" is\npresent, it is initialized to a tuple receiving any excess positional\nparameters, defaulting to the empty tuple. If the form\n""**identifier"" is present, it is initialized to a new dictionary\nreceiving any excess keyword arguments, defaulting to a new empty\ndictionary.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda\nexpressions, described in section Lambdas. Note that the lambda\nexpression is merely a shorthand for a simplified function definition;\na function defined in a ""def"" statement can be passed around or\nassigned to another name just like a function defined by a lambda\nexpression. The ""def"" form is actually more powerful since it\nallows the execution of multiple statements.\n\n**Programmer\'s note:** Functions are first-class objects. A ""def""\nform executed inside a function definition defines a local function\nthat can be returned or passed around. Free variables used in the\nnested function can access the local variables of the function\ncontaining the def. See section Naming and binding for details.\n\n\nClass definitions\n=================\n\nA class definition defines a class object (see section The standard\ntype hierarchy):\n\n classdef ::= "class" classname [inheritance] ":" suite\n inheritance ::= "(" [expression_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. It first evaluates the\ninheritance list, if present. Each item in the inheritance list\nshould evaluate to a class object or class type which allows\nsubclassing. The class\'s suite is then executed in a new execution\nframe (see section Naming and binding), using a newly created local\nnamespace and the original global namespace. (Usually, the suite\ncontains only function definitions.) When the class\'s suite finishes\nexecution, its execution frame is discarded but its local namespace is\nsaved. [4] A class object is then created using the inheritance list\nfor the base classes and the saved local namespace for the attribute\ndictionary. The class name is bound to this class object in the\noriginal local namespace.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass variables; they are shared by all instances. To create instance\nvariables, they can be set in a method with "self.name = value". Both\nclass and instance variables are accessible through the notation\n""self.name"", and an instance variable hides a class variable with\nthe same name when accessed in this way. Class variables can be used\nas defaults for instance variables, but using mutable values there can\nlead to unexpected results. For *new-style class*es, descriptors can\nbe used to create instance variables with different implementation\ndetails.\n\nClass definitions, like function definitions, may be wrapped by one or\nmore *decorator* expressions. The evaluation rules for the decorator\nexpressions are the same as for functions. The result must be a class\nobject, which is then bound to the class name.\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack unless\n there is a "finally" clause which happens to raise another\n exception. That new exception causes the old one to be lost.\n\n[2] Currently, control "flows off the end" except in the case of\n an exception or the execution of a "return", "continue", or\n "break" statement.\n\n[3] A string literal appearing as the first statement in the\n function body is transformed into the function\'s "__doc__"\n attribute and therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s "__doc__" item and\n therefore the class\'s *docstring*.\n', - 'context-managers': u'\nWith Statement Context Managers\n*******************************\n\nNew in version 2.5.\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a "with" statement. The context manager\nhandles the entry into, and the exit from, the desired runtime context\nfor the execution of the block of code. Context managers are normally\ninvoked using the "with" statement (described in section The with\nstatement), but can also be used by directly invoking their methods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see Context Manager Types.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The "with"\n statement will bind this method\'s return value to the target(s)\n specified in the "as" clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be "None".\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that "__exit__()" methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python "with"\n statement.\n', - 'continue': u'\nThe "continue" statement\n************************\n\n continue_stmt ::= "continue"\n\n"continue" may only occur syntactically nested in a "for" or "while"\nloop, but not nested in a function or class definition or "finally"\nclause within that loop. It continues with the next cycle of the\nnearest enclosing loop.\n\nWhen "continue" passes control out of a "try" statement with a\n"finally" clause, that "finally" clause is executed before really\nstarting the next loop cycle.\n', - 'conversions': u'\nArithmetic conversions\n**********************\n\nWhen a description of an arithmetic operator below uses the phrase\n"the numeric arguments are converted to a common type," the arguments\nare coerced using the coercion rules listed at Coercion rules. If\nboth arguments are standard numeric types, the following coercions are\napplied:\n\n* If either argument is a complex number, the other is converted to\n complex;\n\n* otherwise, if either argument is a floating point number, the\n other is converted to floating point;\n\n* otherwise, if either argument is a long integer, the other is\n converted to long integer;\n\n* otherwise, both must be plain integers and no conversion is\n necessary.\n\nSome additional rules apply for certain operators (e.g., a string left\nargument to the \'%\' operator). Extensions can define their own\ncoercions.\n', - 'customization': u'\nBasic customization\n*******************\n\nobject.__new__(cls[, ...])\n\n Called to create a new instance of class *cls*. "__new__()" is a\n static method (special-cased so you need not declare it as such)\n that takes the class of which an instance was requested as its\n first argument. The remaining arguments are those passed to the\n object constructor expression (the call to the class). The return\n value of "__new__()" should be the new object instance (usually an\n instance of *cls*).\n\n Typical implementations create a new instance of the class by\n invoking the superclass\'s "__new__()" method using\n "super(currentclass, cls).__new__(cls[, ...])" with appropriate\n arguments and then modifying the newly-created instance as\n necessary before returning it.\n\n If "__new__()" returns an instance of *cls*, then the new\n instance\'s "__init__()" method will be invoked like\n "__init__(self[, ...])", where *self* is the new instance and the\n remaining arguments are the same as were passed to "__new__()".\n\n If "__new__()" does not return an instance of *cls*, then the new\n instance\'s "__init__()" method will not be invoked.\n\n "__new__()" is intended mainly to allow subclasses of immutable\n types (like int, str, or tuple) to customize instance creation. It\n is also commonly overridden in custom metaclasses in order to\n customize class creation.\n\nobject.__init__(self[, ...])\n\n Called after the instance has been created (by "__new__()"), but\n before it is returned to the caller. The arguments are those\n passed to the class constructor expression. If a base class has an\n "__init__()" method, the derived class\'s "__init__()" method, if\n any, must explicitly call it to ensure proper initialization of the\n base class part of the instance; for example:\n "BaseClass.__init__(self, [args...])".\n\n Because "__new__()" and "__init__()" work together in constructing\n objects ("__new__()" to create it, and "__init__()" to customise\n it), no non-"None" value may be returned by "__init__()"; doing so\n will cause a "TypeError" to be raised at runtime.\n\nobject.__del__(self)\n\n Called when the instance is about to be destroyed. This is also\n called a destructor. If a base class has a "__del__()" method, the\n derived class\'s "__del__()" method, if any, must explicitly call it\n to ensure proper deletion of the base class part of the instance.\n Note that it is possible (though not recommended!) for the\n "__del__()" method to postpone destruction of the instance by\n creating a new reference to it. It may then be called at a later\n time when this new reference is deleted. It is not guaranteed that\n "__del__()" methods are called for objects that still exist when\n the interpreter exits.\n\n Note: "del x" doesn\'t directly call "x.__del__()" --- the former\n decrements the reference count for "x" by one, and the latter is\n only called when "x"\'s reference count reaches zero. Some common\n situations that may prevent the reference count of an object from\n going to zero include: circular references between objects (e.g.,\n a doubly-linked list or a tree data structure with parent and\n child pointers); a reference to the object on the stack frame of\n a function that caught an exception (the traceback stored in\n "sys.exc_traceback" keeps the stack frame alive); or a reference\n to the object on the stack frame that raised an unhandled\n exception in interactive mode (the traceback stored in\n "sys.last_traceback" keeps the stack frame alive). The first\n situation can only be remedied by explicitly breaking the cycles;\n the latter two situations can be resolved by storing "None" in\n "sys.exc_traceback" or "sys.last_traceback". Circular references\n which are garbage are detected when the option cycle detector is\n enabled (it\'s on by default), but can only be cleaned up if there\n are no Python-level "__del__()" methods involved. Refer to the\n documentation for the "gc" module for more information about how\n "__del__()" methods are handled by the cycle detector,\n particularly the description of the "garbage" value.\n\n Warning: Due to the precarious circumstances under which\n "__del__()" methods are invoked, exceptions that occur during\n their execution are ignored, and a warning is printed to\n "sys.stderr" instead. Also, when "__del__()" is invoked in\n response to a module being deleted (e.g., when execution of the\n program is done), other globals referenced by the "__del__()"\n method may already have been deleted or in the process of being\n torn down (e.g. the import machinery shutting down). For this\n reason, "__del__()" methods should do the absolute minimum needed\n to maintain external invariants. Starting with version 1.5,\n Python guarantees that globals whose name begins with a single\n underscore are deleted from their module before other globals are\n deleted; if no other references to such globals exist, this may\n help in assuring that imported modules are still available at the\n time when the "__del__()" method is called.\n\n See also the "-R" command-line option.\n\nobject.__repr__(self)\n\n Called by the "repr()" built-in function and by string conversions\n (reverse quotes) to compute the "official" string representation of\n an object. If at all possible, this should look like a valid\n Python expression that could be used to recreate an object with the\n same value (given an appropriate environment). If this is not\n possible, a string of the form "<...some useful description...>"\n should be returned. The return value must be a string object. If a\n class defines "__repr__()" but not "__str__()", then "__repr__()"\n is also used when an "informal" string representation of instances\n of that class is required.\n\n This is typically used for debugging, so it is important that the\n representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n Called by the "str()" built-in function and by the "print"\n statement to compute the "informal" string representation of an\n object. This differs from "__repr__()" in that it does not have to\n be a valid Python expression: a more convenient or concise\n representation may be used instead. The return value must be a\n string object.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n New in version 2.1.\n\n These are the so-called "rich comparison" methods, and are called\n for comparison operators in preference to "__cmp__()" below. The\n correspondence between operator symbols and method names is as\n follows: "xy" call "x.__ne__(y)",\n "x>y" calls "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n\n A rich comparison method may return the singleton "NotImplemented"\n if it does not implement the operation for a given pair of\n arguments. By convention, "False" and "True" are returned for a\n successful comparison. However, these methods can return any value,\n so if the comparison operator is used in a Boolean context (e.g.,\n in the condition of an "if" statement), Python will call "bool()"\n on the value to determine if the result is true or false.\n\n There are no implied relationships among the comparison operators.\n The truth of "x==y" does not imply that "x!=y" is false.\n Accordingly, when defining "__eq__()", one should also define\n "__ne__()" so that the operators will behave as expected. See the\n paragraph on "__hash__()" for some important notes on creating\n *hashable* objects which support custom comparison operations and\n are usable as dictionary keys.\n\n There are no swapped-argument versions of these methods (to be used\n when the left argument does not support the operation but the right\n argument does); rather, "__lt__()" and "__gt__()" are each other\'s\n reflection, "__le__()" and "__ge__()" are each other\'s reflection,\n and "__eq__()" and "__ne__()" are their own reflection.\n\n Arguments to rich comparison methods are never coerced.\n\n To automatically generate ordering operations from a single root\n operation, see "functools.total_ordering()".\n\nobject.__cmp__(self, other)\n\n Called by comparison operations if rich comparison (see above) is\n not defined. Should return a negative integer if "self < other",\n zero if "self == other", a positive integer if "self > other". If\n no "__cmp__()", "__eq__()" or "__ne__()" operation is defined,\n class instances are compared by object identity ("address"). See\n also the description of "__hash__()" for some important notes on\n creating *hashable* objects which support custom comparison\n operations and are usable as dictionary keys. (Note: the\n restriction that exceptions are not propagated by "__cmp__()" has\n been removed since Python 1.5.)\n\nobject.__rcmp__(self, other)\n\n Changed in version 2.1: No longer supported.\n\nobject.__hash__(self)\n\n Called by built-in function "hash()" and for operations on members\n of hashed collections including "set", "frozenset", and "dict".\n "__hash__()" should return an integer. The only required property\n is that objects which compare equal have the same hash value; it is\n advised to somehow mix together (e.g. using exclusive or) the hash\n values for the components of the object that also play a part in\n comparison of objects.\n\n If a class does not define a "__cmp__()" or "__eq__()" method it\n should not define a "__hash__()" operation either; if it defines\n "__cmp__()" or "__eq__()" but not "__hash__()", its instances will\n not be usable in hashed collections. If a class defines mutable\n objects and implements a "__cmp__()" or "__eq__()" method, it\n should not implement "__hash__()", since hashable collection\n implementations require that a object\'s hash value is immutable (if\n the object\'s hash value changes, it will be in the wrong hash\n bucket).\n\n User-defined classes have "__cmp__()" and "__hash__()" methods by\n default; with them, all objects compare unequal (except with\n themselves) and "x.__hash__()" returns a result derived from\n "id(x)".\n\n Classes which inherit a "__hash__()" method from a parent class but\n change the meaning of "__cmp__()" or "__eq__()" such that the hash\n value returned is no longer appropriate (e.g. by switching to a\n value-based concept of equality instead of the default identity\n based equality) can explicitly flag themselves as being unhashable\n by setting "__hash__ = None" in the class definition. Doing so\n means that not only will instances of the class raise an\n appropriate "TypeError" when a program attempts to retrieve their\n hash value, but they will also be correctly identified as\n unhashable when checking "isinstance(obj, collections.Hashable)"\n (unlike classes which define their own "__hash__()" to explicitly\n raise "TypeError").\n\n Changed in version 2.5: "__hash__()" may now also return a long\n integer object; the 32-bit integer is then derived from the hash of\n that object.\n\n Changed in version 2.6: "__hash__" may now be set to "None" to\n explicitly flag instances of a class as unhashable.\n\nobject.__nonzero__(self)\n\n Called to implement truth value testing and the built-in operation\n "bool()"; should return "False" or "True", or their integer\n equivalents "0" or "1". When this method is not defined,\n "__len__()" is called, if it is defined, and the object is\n considered true if its result is nonzero. If a class defines\n neither "__len__()" nor "__nonzero__()", all its instances are\n considered true.\n\nobject.__unicode__(self)\n\n Called to implement "unicode()" built-in; should return a Unicode\n object. When this method is not defined, string conversion is\n attempted, and the result of string conversion is converted to\n Unicode using the system default encoding.\n', - 'debugger': u'\n"pdb" --- The Python Debugger\n*****************************\n\n**Source code:** Lib/pdb.py\n\n======================================================================\n\nThe module "pdb" defines an interactive source code debugger for\nPython programs. It supports setting (conditional) breakpoints and\nsingle stepping at the source line level, inspection of stack frames,\nsource code listing, and evaluation of arbitrary Python code in the\ncontext of any stack frame. It also supports post-mortem debugging\nand can be called under program control.\n\nThe debugger is extensible --- it is actually defined as the class\n"Pdb". This is currently undocumented but easily understood by reading\nthe source. The extension interface uses the modules "bdb" and "cmd".\n\nThe debugger\'s prompt is "(Pdb)". Typical usage to run a program under\ncontrol of the debugger is:\n\n >>> import pdb\n >>> import mymodule\n >>> pdb.run(\'mymodule.test()\')\n > (0)?()\n (Pdb) continue\n > (1)?()\n (Pdb) continue\n NameError: \'spam\'\n > (1)?()\n (Pdb)\n\n"pdb.py" can also be invoked as a script to debug other scripts. For\nexample:\n\n python -m pdb myscript.py\n\nWhen invoked as a script, pdb will automatically enter post-mortem\ndebugging if the program being debugged exits abnormally. After post-\nmortem debugging (or after normal exit of the program), pdb will\nrestart the program. Automatic restarting preserves pdb\'s state (such\nas breakpoints) and in most cases is more useful than quitting the\ndebugger upon program\'s exit.\n\nNew in version 2.4: Restarting post-mortem behavior added.\n\nThe typical usage to break into the debugger from a running program is\nto insert\n\n import pdb; pdb.set_trace()\n\nat the location you want to break into the debugger. You can then\nstep through the code following this statement, and continue running\nwithout the debugger using the "c" command.\n\nThe typical usage to inspect a crashed program is:\n\n >>> import pdb\n >>> import mymodule\n >>> mymodule.test()\n Traceback (most recent call last):\n File "", line 1, in ?\n File "./mymodule.py", line 4, in test\n test2()\n File "./mymodule.py", line 3, in test2\n print spam\n NameError: spam\n >>> pdb.pm()\n > ./mymodule.py(3)test2()\n -> print spam\n (Pdb)\n\nThe module defines the following functions; each enters the debugger\nin a slightly different way:\n\npdb.run(statement[, globals[, locals]])\n\n Execute the *statement* (given as a string) under debugger control.\n The debugger prompt appears before any code is executed; you can\n set breakpoints and type "continue", or you can step through the\n statement using "step" or "next" (all these commands are explained\n below). The optional *globals* and *locals* arguments specify the\n environment in which the code is executed; by default the\n dictionary of the module "__main__" is used. (See the explanation\n of the "exec" statement or the "eval()" built-in function.)\n\npdb.runeval(expression[, globals[, locals]])\n\n Evaluate the *expression* (given as a string) under debugger\n control. When "runeval()" returns, it returns the value of the\n expression. Otherwise this function is similar to "run()".\n\npdb.runcall(function[, argument, ...])\n\n Call the *function* (a function or method object, not a string)\n with the given arguments. When "runcall()" returns, it returns\n whatever the function call returned. The debugger prompt appears\n as soon as the function is entered.\n\npdb.set_trace()\n\n Enter the debugger at the calling stack frame. This is useful to\n hard-code a breakpoint at a given point in a program, even if the\n code is not otherwise being debugged (e.g. when an assertion\n fails).\n\npdb.post_mortem([traceback])\n\n Enter post-mortem debugging of the given *traceback* object. If no\n *traceback* is given, it uses the one of the exception that is\n currently being handled (an exception must be being handled if the\n default is to be used).\n\npdb.pm()\n\n Enter post-mortem debugging of the traceback found in\n "sys.last_traceback".\n\nThe "run*" functions and "set_trace()" are aliases for instantiating\nthe "Pdb" class and calling the method of the same name. If you want\nto access further features, you have to do this yourself:\n\nclass pdb.Pdb(completekey=\'tab\', stdin=None, stdout=None, skip=None)\n\n "Pdb" is the debugger class.\n\n The *completekey*, *stdin* and *stdout* arguments are passed to the\n underlying "cmd.Cmd" class; see the description there.\n\n The *skip* argument, if given, must be an iterable of glob-style\n module name patterns. The debugger will not step into frames that\n originate in a module that matches one of these patterns. [1]\n\n Example call to enable tracing with *skip*:\n\n import pdb; pdb.Pdb(skip=[\'django.*\']).set_trace()\n\n New in version 2.7: The *skip* argument.\n\n run(statement[, globals[, locals]])\n runeval(expression[, globals[, locals]])\n runcall(function[, argument, ...])\n set_trace()\n\n See the documentation for the functions explained above.\n', - 'del': u'\nThe "del" statement\n*******************\n\n del_stmt ::= "del" target_list\n\nDeletion is recursively defined very similar to the way assignment is\ndefined. Rather than spelling it out in full details, here are some\nhints.\n\nDeletion of a target list recursively deletes each target, from left\nto right.\n\nDeletion of a name removes the binding of that name from the local or\nglobal namespace, depending on whether the name occurs in a "global"\nstatement in the same code block. If the name is unbound, a\n"NameError" exception will be raised.\n\nIt is illegal to delete a name from the local namespace if it occurs\nas a free variable in a nested block.\n\nDeletion of attribute references, subscriptions and slicings is passed\nto the primary object involved; deletion of a slicing is in general\nequivalent to assignment of an empty slice of the right type (but even\nthis is determined by the sliced object).\n', - 'dict': u'\nDictionary displays\n*******************\n\nA dictionary display is a possibly empty series of key/datum pairs\nenclosed in curly braces:\n\n dict_display ::= "{" [key_datum_list | dict_comprehension] "}"\n key_datum_list ::= key_datum ("," key_datum)* [","]\n key_datum ::= expression ":" expression\n dict_comprehension ::= expression ":" expression comp_for\n\nA dictionary display yields a new dictionary object.\n\nIf a comma-separated sequence of key/datum pairs is given, they are\nevaluated from left to right to define the entries of the dictionary:\neach key object is used as a key into the dictionary to store the\ncorresponding datum. This means that you can specify the same key\nmultiple times in the key/datum list, and the final dictionary\'s value\nfor that key will be the last one given.\n\nA dict comprehension, in contrast to list and set comprehensions,\nneeds two expressions separated with a colon followed by the usual\n"for" and "if" clauses. When the comprehension is run, the resulting\nkey and value elements are inserted in the new dictionary in the order\nthey are produced.\n\nRestrictions on the types of the key values are listed earlier in\nsection The standard type hierarchy. (To summarize, the key type\nshould be *hashable*, which excludes all mutable objects.) Clashes\nbetween duplicate keys are not detected; the last datum (textually\nrightmost in the display) stored for a given key value prevails.\n', - 'dynamic-features': u'\nInteraction with dynamic features\n*********************************\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nIf the wild card form of import --- "import *" --- is used in a\nfunction and the function contains or is a nested block with free\nvariables, the compiler will raise a "SyntaxError".\n\nIf "exec" is used in a function and the function contains or is a\nnested block with free variables, the compiler will raise a\n"SyntaxError" unless the exec explicitly specifies the local namespace\nfor the "exec". (In other words, "exec obj" would be illegal, but\n"exec obj in ns" would be legal.)\n\nThe "eval()", "execfile()", and "input()" functions and the "exec"\nstatement do not have access to the full environment for resolving\nnames. Names may be resolved in the local and global namespaces of\nthe caller. Free variables are not resolved in the nearest enclosing\nnamespace, but in the global namespace. [1] The "exec" statement and\nthe "eval()" and "execfile()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n', - 'else': u'\nThe "if" statement\n******************\n\nThe "if" statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section Boolean operations\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n', - 'exceptions': u'\nExceptions\n**********\n\nExceptions are a means of breaking out of the normal flow of control\nof a code block in order to handle errors or other exceptional\nconditions. An exception is *raised* at the point where the error is\ndetected; it may be *handled* by the surrounding code block or by any\ncode block that directly or indirectly invoked the code block where\nthe error occurred.\n\nThe Python interpreter raises an exception when it detects a run-time\nerror (such as division by zero). A Python program can also\nexplicitly raise an exception with the "raise" statement. Exception\nhandlers are specified with the "try" ... "except" statement. The\n"finally" clause of such a statement can be used to specify cleanup\ncode which does not handle the exception, but is executed whether an\nexception occurred or not in the preceding code.\n\nPython uses the "termination" model of error handling: an exception\nhandler can find out what happened and continue execution at an outer\nlevel, but it cannot repair the cause of the error and retry the\nfailing operation (except by re-entering the offending piece of code\nfrom the top).\n\nWhen an exception is not handled at all, the interpreter terminates\nexecution of the program, or returns to its interactive main loop. In\neither case, it prints a stack backtrace, except when the exception is\n"SystemExit".\n\nExceptions are identified by class instances. The "except" clause is\nselected depending on the class of the instance: it must reference the\nclass of the instance or a base class thereof. The instance can be\nreceived by the handler and can carry additional information about the\nexceptional condition.\n\nExceptions can also be identified by strings, in which case the\n"except" clause is selected by object identity. An arbitrary value\ncan be raised along with the identifying string which can be passed to\nthe handler.\n\nNote: Messages to exceptions are not part of the Python API. Their\n contents may change from one version of Python to the next without\n warning and should not be relied on by code which will run under\n multiple versions of the interpreter.\n\nSee also the description of the "try" statement in section The try\nstatement and "raise" statement in section The raise statement.\n\n-[ Footnotes ]-\n\n[1] This limitation occurs because the code that is executed by\n these operations is not available at the time the module is\n compiled.\n', - 'exec': u'\nThe "exec" statement\n********************\n\n exec_stmt ::= "exec" or_expr ["in" expression ["," expression]]\n\nThis statement supports dynamic execution of Python code. The first\nexpression should evaluate to either a Unicode string, a *Latin-1*\nencoded string, an open file object, a code object, or a tuple. If it\nis a string, the string is parsed as a suite of Python statements\nwhich is then executed (unless a syntax error occurs). [1] If it is an\nopen file, the file is parsed until EOF and executed. If it is a code\nobject, it is simply executed. For the interpretation of a tuple, see\nbelow. In all cases, the code that\'s executed is expected to be valid\nas file input (see section File input). Be aware that the "return"\nand "yield" statements may not be used outside of function definitions\neven within the context of code passed to the "exec" statement.\n\nIn all cases, if the optional parts are omitted, the code is executed\nin the current scope. If only the first expression after "in" is\nspecified, it should be a dictionary, which will be used for both the\nglobal and the local variables. If two expressions are given, they\nare used for the global and local variables, respectively. If\nprovided, *locals* can be any mapping object. Remember that at module\nlevel, globals and locals are the same dictionary. If two separate\nobjects are given as *globals* and *locals*, the code will be executed\nas if it were embedded in a class definition.\n\nThe first expression may also be a tuple of length 2 or 3. In this\ncase, the optional parts must be omitted. The form "exec(expr,\nglobals)" is equivalent to "exec expr in globals", while the form\n"exec(expr, globals, locals)" is equivalent to "exec expr in globals,\nlocals". The tuple form of "exec" provides compatibility with Python\n3, where "exec" is a function rather than a statement.\n\nChanged in version 2.4: Formerly, *locals* was required to be a\ndictionary.\n\nAs a side effect, an implementation may insert additional keys into\nthe dictionaries given besides those corresponding to variable names\nset by the executed code. For example, the current implementation may\nadd a reference to the dictionary of the built-in module "__builtin__"\nunder the key "__builtins__" (!).\n\n**Programmer\'s hints:** dynamic evaluation of expressions is supported\nby the built-in function "eval()". The built-in functions "globals()"\nand "locals()" return the current global and local dictionary,\nrespectively, which may be useful to pass around for use by "exec".\n\n-[ Footnotes ]-\n\n[1] Note that the parser only accepts the Unix-style end of line\n convention. If you are reading the code from a file, make sure to\n use *universal newlines* mode to convert Windows or Mac-style\n newlines.\n', - 'execmodel': u'\nExecution model\n***************\n\n\nNaming and binding\n==================\n\n*Names* refer to objects. Names are introduced by name binding\noperations. Each occurrence of a name in the program text refers to\nthe *binding* of that name established in the innermost function block\ncontaining the use.\n\nA *block* is a piece of Python program text that is executed as a\nunit. The following are blocks: a module, a function body, and a class\ndefinition. Each command typed interactively is a block. A script\nfile (a file given as standard input to the interpreter or specified\non the interpreter command line the first argument) is a code block.\nA script command (a command specified on the interpreter command line\nwith the \'**-c**\' option) is a code block. The file read by the\nbuilt-in function "execfile()" is a code block. The string argument\npassed to the built-in function "eval()" and to the "exec" statement\nis a code block. The expression read and evaluated by the built-in\nfunction "input()" is a code block.\n\nA code block is executed in an *execution frame*. A frame contains\nsome administrative information (used for debugging) and determines\nwhere and how execution continues after the code block\'s execution has\ncompleted.\n\nA *scope* defines the visibility of a name within a block. If a local\nvariable is defined in a block, its scope includes that block. If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces\na different binding for the name. The scope of names defined in a\nclass block is limited to the class block; it does not extend to the\ncode blocks of methods -- this includes generator expressions since\nthey are implemented using a function scope. This means that the\nfollowing will fail:\n\n class A:\n a = 42\n b = list(a + i for i in range(10))\n\nWhen a name is used in a code block, it is resolved using the nearest\nenclosing scope. The set of all such scopes visible to a code block\nis called the block\'s *environment*.\n\nIf a name is bound in a block, it is a local variable of that block.\nIf a name is bound at the module level, it is a global variable. (The\nvariables of the module code block are local and global.) If a\nvariable is used in a code block but not defined there, it is a *free\nvariable*.\n\nWhen a name is not found at all, a "NameError" exception is raised.\nIf the name refers to a local variable that has not been bound, a\n"UnboundLocalError" exception is raised. "UnboundLocalError" is a\nsubclass of "NameError".\n\nThe following constructs bind names: formal parameters to functions,\n"import" statements, class and function definitions (these bind the\nclass or function name in the defining block), and targets that are\nidentifiers if occurring in an assignment, "for" loop header, in the\nsecond position of an "except" clause header or after "as" in a "with"\nstatement. The "import" statement of the form "from ... import *"\nbinds all names defined in the imported module, except those beginning\nwith an underscore. This form may only be used at the module level.\n\nA target occurring in a "del" statement is also considered bound for\nthis purpose (though the actual semantics are to unbind the name). It\nis illegal to unbind a name that is referenced by an enclosing scope;\nthe compiler will report a "SyntaxError".\n\nEach assignment or import statement occurs within a block defined by a\nclass or function definition or at the module level (the top-level\ncode block).\n\nIf a name binding operation occurs anywhere within a code block, all\nuses of the name within the block are treated as references to the\ncurrent block. This can lead to errors when a name is used within a\nblock before it is bound. This rule is subtle. Python lacks\ndeclarations and allows name binding operations to occur anywhere\nwithin a code block. The local variables of a code block can be\ndetermined by scanning the entire text of the block for name binding\noperations.\n\nIf the global statement occurs within a block, all uses of the name\nspecified in the statement refer to the binding of that name in the\ntop-level namespace. Names are resolved in the top-level namespace by\nsearching the global namespace, i.e. the namespace of the module\ncontaining the code block, and the builtins namespace, the namespace\nof the module "__builtin__". The global namespace is searched first.\nIf the name is not found there, the builtins namespace is searched.\nThe global statement must precede all uses of the name.\n\nThe builtins namespace associated with the execution of a code block\nis actually found by looking up the name "__builtins__" in its global\nnamespace; this should be a dictionary or a module (in the latter case\nthe module\'s dictionary is used). By default, when in the "__main__"\nmodule, "__builtins__" is the built-in module "__builtin__" (note: no\n\'s\'); when in any other module, "__builtins__" is an alias for the\ndictionary of the "__builtin__" module itself. "__builtins__" can be\nset to a user-created dictionary to create a weak form of restricted\nexecution.\n\n**CPython implementation detail:** Users should not touch\n"__builtins__"; it is strictly an implementation detail. Users\nwanting to override values in the builtins namespace should "import"\nthe "__builtin__" (no \'s\') module and modify its attributes\nappropriately.\n\nThe namespace for a module is automatically created the first time a\nmodule is imported. The main module for a script is always called\n"__main__".\n\nThe "global" statement has the same scope as a name binding operation\nin the same block. If the nearest enclosing scope for a free variable\ncontains a global statement, the free variable is treated as a global.\n\nA class definition is an executable statement that may use and define\nnames. These references follow the normal rules for name resolution.\nThe namespace of the class definition becomes the attribute dictionary\nof the class. Names defined at the class scope are not visible in\nmethods.\n\n\nInteraction with dynamic features\n---------------------------------\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nIf the wild card form of import --- "import *" --- is used in a\nfunction and the function contains or is a nested block with free\nvariables, the compiler will raise a "SyntaxError".\n\nIf "exec" is used in a function and the function contains or is a\nnested block with free variables, the compiler will raise a\n"SyntaxError" unless the exec explicitly specifies the local namespace\nfor the "exec". (In other words, "exec obj" would be illegal, but\n"exec obj in ns" would be legal.)\n\nThe "eval()", "execfile()", and "input()" functions and the "exec"\nstatement do not have access to the full environment for resolving\nnames. Names may be resolved in the local and global namespaces of\nthe caller. Free variables are not resolved in the nearest enclosing\nnamespace, but in the global namespace. [1] The "exec" statement and\nthe "eval()" and "execfile()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n\n\nExceptions\n==========\n\nExceptions are a means of breaking out of the normal flow of control\nof a code block in order to handle errors or other exceptional\nconditions. An exception is *raised* at the point where the error is\ndetected; it may be *handled* by the surrounding code block or by any\ncode block that directly or indirectly invoked the code block where\nthe error occurred.\n\nThe Python interpreter raises an exception when it detects a run-time\nerror (such as division by zero). A Python program can also\nexplicitly raise an exception with the "raise" statement. Exception\nhandlers are specified with the "try" ... "except" statement. The\n"finally" clause of such a statement can be used to specify cleanup\ncode which does not handle the exception, but is executed whether an\nexception occurred or not in the preceding code.\n\nPython uses the "termination" model of error handling: an exception\nhandler can find out what happened and continue execution at an outer\nlevel, but it cannot repair the cause of the error and retry the\nfailing operation (except by re-entering the offending piece of code\nfrom the top).\n\nWhen an exception is not handled at all, the interpreter terminates\nexecution of the program, or returns to its interactive main loop. In\neither case, it prints a stack backtrace, except when the exception is\n"SystemExit".\n\nExceptions are identified by class instances. The "except" clause is\nselected depending on the class of the instance: it must reference the\nclass of the instance or a base class thereof. The instance can be\nreceived by the handler and can carry additional information about the\nexceptional condition.\n\nExceptions can also be identified by strings, in which case the\n"except" clause is selected by object identity. An arbitrary value\ncan be raised along with the identifying string which can be passed to\nthe handler.\n\nNote: Messages to exceptions are not part of the Python API. Their\n contents may change from one version of Python to the next without\n warning and should not be relied on by code which will run under\n multiple versions of the interpreter.\n\nSee also the description of the "try" statement in section The try\nstatement and "raise" statement in section The raise statement.\n\n-[ Footnotes ]-\n\n[1] This limitation occurs because the code that is executed by\n these operations is not available at the time the module is\n compiled.\n', - 'exprlists': u'\nExpression lists\n****************\n\n expression_list ::= expression ( "," expression )* [","]\n\nAn expression list containing at least one comma yields a tuple. The\nlength of the tuple is the number of expressions in the list. The\nexpressions are evaluated from left to right.\n\nThe trailing comma is required only to create a single tuple (a.k.a. a\n*singleton*); it is optional in all other cases. A single expression\nwithout a trailing comma doesn\'t create a tuple, but rather yields the\nvalue of that expression. (To create an empty tuple, use an empty pair\nof parentheses: "()".)\n', - 'floating': u'\nFloating point literals\n***********************\n\nFloating point literals are described by the following lexical\ndefinitions:\n\n floatnumber ::= pointfloat | exponentfloat\n pointfloat ::= [intpart] fraction | intpart "."\n exponentfloat ::= (intpart | pointfloat) exponent\n intpart ::= digit+\n fraction ::= "." digit+\n exponent ::= ("e" | "E") ["+" | "-"] digit+\n\nNote that the integer and exponent parts of floating point numbers can\nlook like octal integers, but are interpreted using radix 10. For\nexample, "077e010" is legal, and denotes the same number as "77e10".\nThe allowed range of floating point literals is implementation-\ndependent. Some examples of floating point literals:\n\n 3.14 10. .001 1e100 3.14e-10 0e0\n\nNote that numeric literals do not include a sign; a phrase like "-1"\nis actually an expression composed of the unary operator "-" and the\nliteral "1".\n', - 'for': u'\nThe "for" statement\n*******************\n\nThe "for" statement is used to iterate over the elements of a sequence\n(such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n"expression_list". The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments, and then the suite is executed. When the items are\nexhausted (which is immediately when the sequence is empty), the suite\nin the "else" clause, if present, is executed, and the loop\nterminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and continues\nwith the next item, or with the "else" clause if there was no next\nitem.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nThe target list is not deleted when the loop is finished, but if the\nsequence is empty, it will not have been assigned to at all by the\nloop. Hint: the built-in function "range()" returns a sequence of\nintegers suitable to emulate the effect of Pascal\'s "for i := a to b\ndo"; e.g., "range(3)" returns the list "[0, 1, 2]".\n\nNote: There is a subtlety when the sequence is being modified by the\n loop (this can only occur for mutable sequences, i.e. lists). An\n internal counter is used to keep track of which item is used next,\n and this is incremented on each iteration. When this counter has\n reached the length of the sequence the loop terminates. This means\n that if the suite deletes the current (or a previous) item from the\n sequence, the next item will be skipped (since it gets the index of\n the current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n', - 'formatstrings': u'\nFormat String Syntax\n********************\n\nThe "str.format()" method and the "Formatter" class share the same\nsyntax for format strings (although in the case of "Formatter",\nsubclasses can define their own format string syntax).\n\nFormat strings contain "replacement fields" surrounded by curly braces\n"{}". Anything that is not contained in braces is considered literal\ntext, which is copied unchanged to the output. If you need to include\na brace character in the literal text, it can be escaped by doubling:\n"{{" and "}}".\n\nThe grammar for a replacement field is as follows:\n\n replacement_field ::= "{" [field_name] ["!" conversion] [":" format_spec] "}"\n field_name ::= arg_name ("." attribute_name | "[" element_index "]")*\n arg_name ::= [identifier | integer]\n attribute_name ::= identifier\n element_index ::= integer | index_string\n index_string ::= +\n conversion ::= "r" | "s"\n format_spec ::= \n\nIn less formal terms, the replacement field can start with a\n*field_name* that specifies the object whose value is to be formatted\nand inserted into the output instead of the replacement field. The\n*field_name* is optionally followed by a *conversion* field, which is\npreceded by an exclamation point "\'!\'", and a *format_spec*, which is\npreceded by a colon "\':\'". These specify a non-default format for the\nreplacement value.\n\nSee also the Format Specification Mini-Language section.\n\nThe *field_name* itself begins with an *arg_name* that is either a\nnumber or a keyword. If it\'s a number, it refers to a positional\nargument, and if it\'s a keyword, it refers to a named keyword\nargument. If the numerical arg_names in a format string are 0, 1, 2,\n... in sequence, they can all be omitted (not just some) and the\nnumbers 0, 1, 2, ... will be automatically inserted in that order.\nBecause *arg_name* is not quote-delimited, it is not possible to\nspecify arbitrary dictionary keys (e.g., the strings "\'10\'" or\n"\':-]\'") within a format string. The *arg_name* can be followed by any\nnumber of index or attribute expressions. An expression of the form\n"\'.name\'" selects the named attribute using "getattr()", while an\nexpression of the form "\'[index]\'" does an index lookup using\n"__getitem__()".\n\nChanged in version 2.7: The positional argument specifiers can be\nomitted, so "\'{} {}\'" is equivalent to "\'{0} {1}\'".\n\nSome simple format string examples:\n\n "First, thou shalt count to {0}" # References first positional argument\n "Bring me a {}" # Implicitly references the first positional argument\n "From {} to {}" # Same as "From {0} to {1}"\n "My quest is {name}" # References keyword argument \'name\'\n "Weight in tons {0.weight}" # \'weight\' attribute of first positional arg\n "Units destroyed: {players[0]}" # First element of keyword argument \'players\'.\n\nThe *conversion* field causes a type coercion before formatting.\nNormally, the job of formatting a value is done by the "__format__()"\nmethod of the value itself. However, in some cases it is desirable to\nforce a type to be formatted as a string, overriding its own\ndefinition of formatting. By converting the value to a string before\ncalling "__format__()", the normal formatting logic is bypassed.\n\nTwo conversion flags are currently supported: "\'!s\'" which calls\n"str()" on the value, and "\'!r\'" which calls "repr()".\n\nSome examples:\n\n "Harold\'s a clever {0!s}" # Calls str() on the argument first\n "Bring out the holy {name!r}" # Calls repr() on the argument first\n\nThe *format_spec* field contains a specification of how the value\nshould be presented, including such details as field width, alignment,\npadding, decimal precision and so on. Each value type can define its\nown "formatting mini-language" or interpretation of the *format_spec*.\n\nMost built-in types support a common formatting mini-language, which\nis described in the next section.\n\nA *format_spec* field can also include nested replacement fields\nwithin it. These nested replacement fields can contain only a field\nname; conversion flags and format specifications are not allowed. The\nreplacement fields within the format_spec are substituted before the\n*format_spec* string is interpreted. This allows the formatting of a\nvalue to be dynamically specified.\n\nSee the Format examples section for some examples.\n\n\nFormat Specification Mini-Language\n==================================\n\n"Format specifications" are used within replacement fields contained\nwithin a format string to define how individual values are presented\n(see Format String Syntax). They can also be passed directly to the\nbuilt-in "format()" function. Each formattable type may define how\nthe format specification is to be interpreted.\n\nMost built-in types implement the following options for format\nspecifications, although some of the formatting options are only\nsupported by the numeric types.\n\nA general convention is that an empty format string ("""") produces\nthe same result as if you had called "str()" on the value. A non-empty\nformat string typically modifies the result.\n\nThe general form of a *standard format specifier* is:\n\n format_spec ::= [[fill]align][sign][#][0][width][,][.precision][type]\n fill ::= \n align ::= "<" | ">" | "=" | "^"\n sign ::= "+" | "-" | " "\n width ::= integer\n precision ::= integer\n type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"\n\nIf a valid *align* value is specified, it can be preceded by a *fill*\ncharacter that can be any character and defaults to a space if\nomitted. Note that it is not possible to use "{" and "}" as *fill*\nchar while using the "str.format()" method; this limitation however\ndoesn\'t affect the "format()" function.\n\nThe meaning of the various alignment options is as follows:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | "\'<\'" | Forces the field to be left-aligned within the available |\n | | space (this is the default for most objects). |\n +-----------+------------------------------------------------------------+\n | "\'>\'" | Forces the field to be right-aligned within the available |\n | | space (this is the default for numbers). |\n +-----------+------------------------------------------------------------+\n | "\'=\'" | Forces the padding to be placed after the sign (if any) |\n | | but before the digits. This is used for printing fields |\n | | in the form \'+000000120\'. This alignment option is only |\n | | valid for numeric types. |\n +-----------+------------------------------------------------------------+\n | "\'^\'" | Forces the field to be centered within the available |\n | | space. |\n +-----------+------------------------------------------------------------+\n\nNote that unless a minimum field width is defined, the field width\nwill always be the same size as the data to fill it, so that the\nalignment option has no meaning in this case.\n\nThe *sign* option is only valid for number types, and can be one of\nthe following:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | "\'+\'" | indicates that a sign should be used for both positive as |\n | | well as negative numbers. |\n +-----------+------------------------------------------------------------+\n | "\'-\'" | indicates that a sign should be used only for negative |\n | | numbers (this is the default behavior). |\n +-----------+------------------------------------------------------------+\n | space | indicates that a leading space should be used on positive |\n | | numbers, and a minus sign on negative numbers. |\n +-----------+------------------------------------------------------------+\n\nThe "\'#\'" option is only valid for integers, and only for binary,\noctal, or hexadecimal output. If present, it specifies that the\noutput will be prefixed by "\'0b\'", "\'0o\'", or "\'0x\'", respectively.\n\nThe "\',\'" option signals the use of a comma for a thousands separator.\nFor a locale aware separator, use the "\'n\'" integer presentation type\ninstead.\n\nChanged in version 2.7: Added the "\',\'" option (see also **PEP 378**).\n\n*width* is a decimal integer defining the minimum field width. If not\nspecified, then the field width will be determined by the content.\n\nPreceding the *width* field by a zero ("\'0\'") character enables sign-\naware zero-padding for numeric types. This is equivalent to a *fill*\ncharacter of "\'0\'" with an *alignment* type of "\'=\'".\n\nThe *precision* is a decimal number indicating how many digits should\nbe displayed after the decimal point for a floating point value\nformatted with "\'f\'" and "\'F\'", or before and after the decimal point\nfor a floating point value formatted with "\'g\'" or "\'G\'". For non-\nnumber types the field indicates the maximum field size - in other\nwords, how many characters will be used from the field content. The\n*precision* is not allowed for integer values.\n\nFinally, the *type* determines how the data should be presented.\n\nThe available string presentation types are:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | "\'s\'" | String format. This is the default type for strings and |\n | | may be omitted. |\n +-----------+------------------------------------------------------------+\n | None | The same as "\'s\'". |\n +-----------+------------------------------------------------------------+\n\nThe available integer presentation types are:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | "\'b\'" | Binary format. Outputs the number in base 2. |\n +-----------+------------------------------------------------------------+\n | "\'c\'" | Character. Converts the integer to the corresponding |\n | | unicode character before printing. |\n +-----------+------------------------------------------------------------+\n | "\'d\'" | Decimal Integer. Outputs the number in base 10. |\n +-----------+------------------------------------------------------------+\n | "\'o\'" | Octal format. Outputs the number in base 8. |\n +-----------+------------------------------------------------------------+\n | "\'x\'" | Hex format. Outputs the number in base 16, using lower- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | "\'X\'" | Hex format. Outputs the number in base 16, using upper- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | "\'n\'" | Number. This is the same as "\'d\'", except that it uses the |\n | | current locale setting to insert the appropriate number |\n | | separator characters. |\n +-----------+------------------------------------------------------------+\n | None | The same as "\'d\'". |\n +-----------+------------------------------------------------------------+\n\nIn addition to the above presentation types, integers can be formatted\nwith the floating point presentation types listed below (except "\'n\'"\nand None). When doing so, "float()" is used to convert the integer to\na floating point number before formatting.\n\nThe available presentation types for floating point and decimal values\nare:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | "\'e\'" | Exponent notation. Prints the number in scientific |\n | | notation using the letter \'e\' to indicate the exponent. |\n | | The default precision is "6". |\n +-----------+------------------------------------------------------------+\n | "\'E\'" | Exponent notation. Same as "\'e\'" except it uses an upper |\n | | case \'E\' as the separator character. |\n +-----------+------------------------------------------------------------+\n | "\'f\'" | Fixed point. Displays the number as a fixed-point number. |\n | | The default precision is "6". |\n +-----------+------------------------------------------------------------+\n | "\'F\'" | Fixed point. Same as "\'f\'". |\n +-----------+------------------------------------------------------------+\n | "\'g\'" | General format. For a given precision "p >= 1", this |\n | | rounds the number to "p" significant digits and then |\n | | formats the result in either fixed-point format or in |\n | | scientific notation, depending on its magnitude. The |\n | | precise rules are as follows: suppose that the result |\n | | formatted with presentation type "\'e\'" and precision "p-1" |\n | | would have exponent "exp". Then if "-4 <= exp < p", the |\n | | number is formatted with presentation type "\'f\'" and |\n | | precision "p-1-exp". Otherwise, the number is formatted |\n | | with presentation type "\'e\'" and precision "p-1". In both |\n | | cases insignificant trailing zeros are removed from the |\n | | significand, and the decimal point is also removed if |\n | | there are no remaining digits following it. Positive and |\n | | negative infinity, positive and negative zero, and nans, |\n | | are formatted as "inf", "-inf", "0", "-0" and "nan" |\n | | respectively, regardless of the precision. A precision of |\n | | "0" is treated as equivalent to a precision of "1". The |\n | | default precision is "6". |\n +-----------+------------------------------------------------------------+\n | "\'G\'" | General format. Same as "\'g\'" except switches to "\'E\'" if |\n | | the number gets too large. The representations of infinity |\n | | and NaN are uppercased, too. |\n +-----------+------------------------------------------------------------+\n | "\'n\'" | Number. This is the same as "\'g\'", except that it uses the |\n | | current locale setting to insert the appropriate number |\n | | separator characters. |\n +-----------+------------------------------------------------------------+\n | "\'%\'" | Percentage. Multiplies the number by 100 and displays in |\n | | fixed ("\'f\'") format, followed by a percent sign. |\n +-----------+------------------------------------------------------------+\n | None | The same as "\'g\'". |\n +-----------+------------------------------------------------------------+\n\n\nFormat examples\n===============\n\nThis section contains examples of the new format syntax and comparison\nwith the old "%"-formatting.\n\nIn most of the cases the syntax is similar to the old "%"-formatting,\nwith the addition of the "{}" and with ":" used instead of "%". For\nexample, "\'%03.2f\'" can be translated to "\'{:03.2f}\'".\n\nThe new format syntax also supports new and different options, shown\nin the follow examples.\n\nAccessing arguments by position:\n\n >>> \'{0}, {1}, {2}\'.format(\'a\', \'b\', \'c\')\n \'a, b, c\'\n >>> \'{}, {}, {}\'.format(\'a\', \'b\', \'c\') # 2.7+ only\n \'a, b, c\'\n >>> \'{2}, {1}, {0}\'.format(\'a\', \'b\', \'c\')\n \'c, b, a\'\n >>> \'{2}, {1}, {0}\'.format(*\'abc\') # unpacking argument sequence\n \'c, b, a\'\n >>> \'{0}{1}{0}\'.format(\'abra\', \'cad\') # arguments\' indices can be repeated\n \'abracadabra\'\n\nAccessing arguments by name:\n\n >>> \'Coordinates: {latitude}, {longitude}\'.format(latitude=\'37.24N\', longitude=\'-115.81W\')\n \'Coordinates: 37.24N, -115.81W\'\n >>> coord = {\'latitude\': \'37.24N\', \'longitude\': \'-115.81W\'}\n >>> \'Coordinates: {latitude}, {longitude}\'.format(**coord)\n \'Coordinates: 37.24N, -115.81W\'\n\nAccessing arguments\' attributes:\n\n >>> c = 3-5j\n >>> (\'The complex number {0} is formed from the real part {0.real} \'\n ... \'and the imaginary part {0.imag}.\').format(c)\n \'The complex number (3-5j) is formed from the real part 3.0 and the imaginary part -5.0.\'\n >>> class Point(object):\n ... def __init__(self, x, y):\n ... self.x, self.y = x, y\n ... def __str__(self):\n ... return \'Point({self.x}, {self.y})\'.format(self=self)\n ...\n >>> str(Point(4, 2))\n \'Point(4, 2)\'\n\nAccessing arguments\' items:\n\n >>> coord = (3, 5)\n >>> \'X: {0[0]}; Y: {0[1]}\'.format(coord)\n \'X: 3; Y: 5\'\n\nReplacing "%s" and "%r":\n\n >>> "repr() shows quotes: {!r}; str() doesn\'t: {!s}".format(\'test1\', \'test2\')\n "repr() shows quotes: \'test1\'; str() doesn\'t: test2"\n\nAligning the text and specifying a width:\n\n >>> \'{:<30}\'.format(\'left aligned\')\n \'left aligned \'\n >>> \'{:>30}\'.format(\'right aligned\')\n \' right aligned\'\n >>> \'{:^30}\'.format(\'centered\')\n \' centered \'\n >>> \'{:*^30}\'.format(\'centered\') # use \'*\' as a fill char\n \'***********centered***********\'\n\nReplacing "%+f", "%-f", and "% f" and specifying a sign:\n\n >>> \'{:+f}; {:+f}\'.format(3.14, -3.14) # show it always\n \'+3.140000; -3.140000\'\n >>> \'{: f}; {: f}\'.format(3.14, -3.14) # show a space for positive numbers\n \' 3.140000; -3.140000\'\n >>> \'{:-f}; {:-f}\'.format(3.14, -3.14) # show only the minus -- same as \'{:f}; {:f}\'\n \'3.140000; -3.140000\'\n\nReplacing "%x" and "%o" and converting the value to different bases:\n\n >>> # format also supports binary numbers\n >>> "int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}".format(42)\n \'int: 42; hex: 2a; oct: 52; bin: 101010\'\n >>> # with 0x, 0o, or 0b as prefix:\n >>> "int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: {0:#b}".format(42)\n \'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010\'\n\nUsing the comma as a thousands separator:\n\n >>> \'{:,}\'.format(1234567890)\n \'1,234,567,890\'\n\nExpressing a percentage:\n\n >>> points = 19.5\n >>> total = 22\n >>> \'Correct answers: {:.2%}\'.format(points/total)\n \'Correct answers: 88.64%\'\n\nUsing type-specific formatting:\n\n >>> import datetime\n >>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n >>> \'{:%Y-%m-%d %H:%M:%S}\'.format(d)\n \'2010-07-04 12:15:58\'\n\nNesting arguments and more complex examples:\n\n >>> for align, text in zip(\'<^>\', [\'left\', \'center\', \'right\']):\n ... \'{0:{fill}{align}16}\'.format(text, fill=align, align=align)\n ...\n \'left<<<<<<<<<<<<\'\n \'^^^^^center^^^^^\'\n \'>>>>>>>>>>>right\'\n >>>\n >>> octets = [192, 168, 0, 1]\n >>> \'{:02X}{:02X}{:02X}{:02X}\'.format(*octets)\n \'C0A80001\'\n >>> int(_, 16)\n 3232235521\n >>>\n >>> width = 5\n >>> for num in range(5,12):\n ... for base in \'dXob\':\n ... print \'{0:{width}{base}}\'.format(num, base=base, width=width),\n ... print\n ...\n 5 5 5 101\n 6 6 6 110\n 7 7 7 111\n 8 8 10 1000\n 9 9 11 1001\n 10 A 12 1010\n 11 B 13 1011\n', - 'function': u'\nFunction definitions\n********************\n\nA function definition defines a user-defined function object (see\nsection The standard type hierarchy):\n\n decorated ::= decorators (classdef | funcdef)\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n funcdef ::= "def" funcname "(" [parameter_list] ")" ":" suite\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n ( "*" identifier ["," "**" identifier]\n | "**" identifier\n | defparameter [","] )\n defparameter ::= parameter ["=" expression]\n sublist ::= parameter ("," parameter)* [","]\n parameter ::= identifier | "(" sublist ")"\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code:\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to:\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more top-level *parameters* have the form *parameter* "="\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding *argument* may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters must also have a default value --- this is a syntactic\nrestriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.** This means that the expression is evaluated once, when\nthe function is defined, and that the same "pre-computed" value is\nused for each call. This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended. A way around this is to use "None" as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section Calls.\nA function call always assigns values to all parameters mentioned in\nthe parameter list, either from position arguments, from keyword\narguments, or from default values. If the form ""*identifier"" is\npresent, it is initialized to a tuple receiving any excess positional\nparameters, defaulting to the empty tuple. If the form\n""**identifier"" is present, it is initialized to a new dictionary\nreceiving any excess keyword arguments, defaulting to a new empty\ndictionary.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda\nexpressions, described in section Lambdas. Note that the lambda\nexpression is merely a shorthand for a simplified function definition;\na function defined in a ""def"" statement can be passed around or\nassigned to another name just like a function defined by a lambda\nexpression. The ""def"" form is actually more powerful since it\nallows the execution of multiple statements.\n\n**Programmer\'s note:** Functions are first-class objects. A ""def""\nform executed inside a function definition defines a local function\nthat can be returned or passed around. Free variables used in the\nnested function can access the local variables of the function\ncontaining the def. See section Naming and binding for details.\n', - 'global': u'\nThe "global" statement\n**********************\n\n global_stmt ::= "global" identifier ("," identifier)*\n\nThe "global" statement is a declaration which holds for the entire\ncurrent code block. It means that the listed identifiers are to be\ninterpreted as globals. It would be impossible to assign to a global\nvariable without "global", although free variables may refer to\nglobals without being declared global.\n\nNames listed in a "global" statement must not be used in the same code\nblock textually preceding that "global" statement.\n\nNames listed in a "global" statement must not be defined as formal\nparameters or in a "for" loop control target, "class" definition,\nfunction definition, or "import" statement.\n\n**CPython implementation detail:** The current implementation does not\nenforce the latter two restrictions, but programs should not abuse\nthis freedom, as future implementations may enforce them or silently\nchange the meaning of the program.\n\n**Programmer\'s note:** the "global" is a directive to the parser. It\napplies only to code parsed at the same time as the "global"\nstatement. In particular, a "global" statement contained in an "exec"\nstatement does not affect the code block *containing* the "exec"\nstatement, and code contained in an "exec" statement is unaffected by\n"global" statements in the code containing the "exec" statement. The\nsame applies to the "eval()", "execfile()" and "compile()" functions.\n', - 'id-classes': u'\nReserved classes of identifiers\n*******************************\n\nCertain classes of identifiers (besides keywords) have special\nmeanings. These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n"_*"\n Not imported by "from module import *". The special identifier "_"\n is used in the interactive interpreter to store the result of the\n last evaluation; it is stored in the "__builtin__" module. When\n not in interactive mode, "_" has no special meaning and is not\n defined. See section The import statement.\n\n Note: The name "_" is often used in conjunction with\n internationalization; refer to the documentation for the\n "gettext" module for more information on this convention.\n\n"__*__"\n System-defined names. These names are defined by the interpreter\n and its implementation (including the standard library). Current\n system names are discussed in the Special method names section and\n elsewhere. More will likely be defined in future versions of\n Python. *Any* use of "__*__" names, in any context, that does not\n follow explicitly documented use, is subject to breakage without\n warning.\n\n"__*"\n Class-private names. Names in this category, when used within the\n context of a class definition, are re-written to use a mangled form\n to help avoid name clashes between "private" attributes of base and\n derived classes. See section Identifiers (Names).\n', - 'identifiers': u'\nIdentifiers and keywords\n************************\n\nIdentifiers (also referred to as *names*) are described by the\nfollowing lexical definitions:\n\n identifier ::= (letter|"_") (letter | digit | "_")*\n letter ::= lowercase | uppercase\n lowercase ::= "a"..."z"\n uppercase ::= "A"..."Z"\n digit ::= "0"..."9"\n\nIdentifiers are unlimited in length. Case is significant.\n\n\nKeywords\n========\n\nThe following identifiers are used as reserved words, or *keywords* of\nthe language, and cannot be used as ordinary identifiers. They must\nbe spelled exactly as written here:\n\n and del from not while\n as elif global or with\n assert else if pass yield\n break except import print\n class exec in raise\n continue finally is return\n def for lambda try\n\nChanged in version 2.4: "None" became a constant and is now recognized\nby the compiler as a name for the built-in object "None". Although it\nis not a keyword, you cannot assign a different object to it.\n\nChanged in version 2.5: Using "as" and "with" as identifiers triggers\na warning. To use them as keywords, enable the "with_statement"\nfuture feature .\n\nChanged in version 2.6: "as" and "with" are full keywords.\n\n\nReserved classes of identifiers\n===============================\n\nCertain classes of identifiers (besides keywords) have special\nmeanings. These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n"_*"\n Not imported by "from module import *". The special identifier "_"\n is used in the interactive interpreter to store the result of the\n last evaluation; it is stored in the "__builtin__" module. When\n not in interactive mode, "_" has no special meaning and is not\n defined. See section The import statement.\n\n Note: The name "_" is often used in conjunction with\n internationalization; refer to the documentation for the\n "gettext" module for more information on this convention.\n\n"__*__"\n System-defined names. These names are defined by the interpreter\n and its implementation (including the standard library). Current\n system names are discussed in the Special method names section and\n elsewhere. More will likely be defined in future versions of\n Python. *Any* use of "__*__" names, in any context, that does not\n follow explicitly documented use, is subject to breakage without\n warning.\n\n"__*"\n Class-private names. Names in this category, when used within the\n context of a class definition, are re-written to use a mangled form\n to help avoid name clashes between "private" attributes of base and\n derived classes. See section Identifiers (Names).\n', - 'if': u'\nThe "if" statement\n******************\n\nThe "if" statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section Boolean operations\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n', - 'imaginary': u'\nImaginary literals\n******************\n\nImaginary literals are described by the following lexical definitions:\n\n imagnumber ::= (floatnumber | intpart) ("j" | "J")\n\nAn imaginary literal yields a complex number with a real part of 0.0.\nComplex numbers are represented as a pair of floating point numbers\nand have the same restrictions on their range. To create a complex\nnumber with a nonzero real part, add a floating point number to it,\ne.g., "(3+4j)". Some examples of imaginary literals:\n\n 3.14j 10.j 10j .001j 1e100j 3.14e-10j\n', - 'import': u'\nThe "import" statement\n**********************\n\n import_stmt ::= "import" module ["as" name] ( "," module ["as" name] )*\n | "from" relative_module "import" identifier ["as" name]\n ( "," identifier ["as" name] )*\n | "from" relative_module "import" "(" identifier ["as" name]\n ( "," identifier ["as" name] )* [","] ")"\n | "from" module "import" "*"\n module ::= (identifier ".")* identifier\n relative_module ::= "."* module | "."+\n name ::= identifier\n\nImport statements are executed in two steps: (1) find a module, and\ninitialize it if necessary; (2) define a name or names in the local\nnamespace (of the scope where the "import" statement occurs). The\nstatement comes in two forms differing on whether it uses the "from"\nkeyword. The first form (without "from") repeats these steps for each\nidentifier in the list. The form with "from" performs step (1) once,\nand then performs step (2) repeatedly.\n\nTo understand how step (1) occurs, one must first understand how\nPython handles hierarchical naming of modules. To help organize\nmodules and provide a hierarchy in naming, Python has a concept of\npackages. A package can contain other packages and modules while\nmodules cannot contain other modules or packages. From a file system\nperspective, packages are directories and modules are files.\n\nOnce the name of the module is known (unless otherwise specified, the\nterm "module" will refer to both packages and modules), searching for\nthe module or package can begin. The first place checked is\n"sys.modules", the cache of all modules that have been imported\npreviously. If the module is found there then it is used in step (2)\nof import.\n\nIf the module is not found in the cache, then "sys.meta_path" is\nsearched (the specification for "sys.meta_path" can be found in **PEP\n302**). The object is a list of *finder* objects which are queried in\norder as to whether they know how to load the module by calling their\n"find_module()" method with the name of the module. If the module\nhappens to be contained within a package (as denoted by the existence\nof a dot in the name), then a second argument to "find_module()" is\ngiven as the value of the "__path__" attribute from the parent package\n(everything up to the last dot in the name of the module being\nimported). If a finder can find the module it returns a *loader*\n(discussed later) or returns "None".\n\nIf none of the finders on "sys.meta_path" are able to find the module\nthen some implicitly defined finders are queried. Implementations of\nPython vary in what implicit meta path finders are defined. The one\nthey all do define, though, is one that handles "sys.path_hooks",\n"sys.path_importer_cache", and "sys.path".\n\nThe implicit finder searches for the requested module in the "paths"\nspecified in one of two places ("paths" do not have to be file system\npaths). If the module being imported is supposed to be contained\nwithin a package then the second argument passed to "find_module()",\n"__path__" on the parent package, is used as the source of paths. If\nthe module is not contained in a package then "sys.path" is used as\nthe source of paths.\n\nOnce the source of paths is chosen it is iterated over to find a\nfinder that can handle that path. The dict at\n"sys.path_importer_cache" caches finders for paths and is checked for\na finder. If the path does not have a finder cached then\n"sys.path_hooks" is searched by calling each object in the list with a\nsingle argument of the path, returning a finder or raises\n"ImportError". If a finder is returned then it is cached in\n"sys.path_importer_cache" and then used for that path entry. If no\nfinder can be found but the path exists then a value of "None" is\nstored in "sys.path_importer_cache" to signify that an implicit, file-\nbased finder that handles modules stored as individual files should be\nused for that path. If the path does not exist then a finder which\nalways returns "None" is placed in the cache for the path.\n\nIf no finder can find the module then "ImportError" is raised.\nOtherwise some finder returned a loader whose "load_module()" method\nis called with the name of the module to load (see **PEP 302** for the\noriginal definition of loaders). A loader has several responsibilities\nto perform on a module it loads. First, if the module already exists\nin "sys.modules" (a possibility if the loader is called outside of the\nimport machinery) then it is to use that module for initialization and\nnot a new module. But if the module does not exist in "sys.modules"\nthen it is to be added to that dict before initialization begins. If\nan error occurs during loading of the module and it was added to\n"sys.modules" it is to be removed from the dict. If an error occurs\nbut the module was already in "sys.modules" it is left in the dict.\n\nThe loader must set several attributes on the module. "__name__" is to\nbe set to the name of the module. "__file__" is to be the "path" to\nthe file unless the module is built-in (and thus listed in\n"sys.builtin_module_names") in which case the attribute is not set. If\nwhat is being imported is a package then "__path__" is to be set to a\nlist of paths to be searched when looking for modules and packages\ncontained within the package being imported. "__package__" is optional\nbut should be set to the name of package that contains the module or\npackage (the empty string is used for module not contained in a\npackage). "__loader__" is also optional but should be set to the\nloader object that is loading the module.\n\nIf an error occurs during loading then the loader raises "ImportError"\nif some other exception is not already being propagated. Otherwise the\nloader returns the module that was loaded and initialized.\n\nWhen step (1) finishes without raising an exception, step (2) can\nbegin.\n\nThe first form of "import" statement binds the module name in the\nlocal namespace to the module object, and then goes on to import the\nnext identifier, if any. If the module name is followed by "as", the\nname following "as" is used as the local name for the module.\n\nThe "from" form does not bind the module name: it goes through the\nlist of identifiers, looks each one of them up in the module found in\nstep (1), and binds the name in the local namespace to the object thus\nfound. As with the first form of "import", an alternate local name\ncan be supplied by specifying ""as" localname". If a name is not\nfound, "ImportError" is raised. If the list of identifiers is\nreplaced by a star ("\'*\'"), all public names defined in the module are\nbound in the local namespace of the "import" statement..\n\nThe *public names* defined by a module are determined by checking the\nmodule\'s namespace for a variable named "__all__"; if defined, it must\nbe a sequence of strings which are names defined or imported by that\nmodule. The names given in "__all__" are all considered public and\nare required to exist. If "__all__" is not defined, the set of public\nnames includes all names found in the module\'s namespace which do not\nbegin with an underscore character ("\'_\'"). "__all__" should contain\nthe entire public API. It is intended to avoid accidentally exporting\nitems that are not part of the API (such as library modules which were\nimported and used within the module).\n\nThe "from" form with "*" may only occur in a module scope. If the\nwild card form of import --- "import *" --- is used in a function and\nthe function contains or is a nested block with free variables, the\ncompiler will raise a "SyntaxError".\n\nWhen specifying what module to import you do not have to specify the\nabsolute name of the module. When a module or package is contained\nwithin another package it is possible to make a relative import within\nthe same top package without having to mention the package name. By\nusing leading dots in the specified module or package after "from" you\ncan specify how high to traverse up the current package hierarchy\nwithout specifying exact names. One leading dot means the current\npackage where the module making the import exists. Two dots means up\none package level. Three dots is up two levels, etc. So if you execute\n"from . import mod" from a module in the "pkg" package then you will\nend up importing "pkg.mod". If you execute "from ..subpkg2 import mod"\nfrom within "pkg.subpkg1" you will import "pkg.subpkg2.mod". The\nspecification for relative imports is contained within **PEP 328**.\n\n"importlib.import_module()" is provided to support applications that\ndetermine which modules need to be loaded dynamically.\n\n\nFuture statements\n=================\n\nA *future statement* is a directive to the compiler that a particular\nmodule should be compiled using syntax or semantics that will be\navailable in a specified future release of Python. The future\nstatement is intended to ease migration to future versions of Python\nthat introduce incompatible changes to the language. It allows use of\nthe new features on a per-module basis before the release in which the\nfeature becomes standard.\n\n future_statement ::= "from" "__future__" "import" feature ["as" name]\n ("," feature ["as" name])*\n | "from" "__future__" "import" "(" feature ["as" name]\n ("," feature ["as" name])* [","] ")"\n feature ::= identifier\n name ::= identifier\n\nA future statement must appear near the top of the module. The only\nlines that can appear before a future statement are:\n\n* the module docstring (if any),\n\n* comments,\n\n* blank lines, and\n\n* other future statements.\n\nThe features recognized by Python 2.6 are "unicode_literals",\n"print_function", "absolute_import", "division", "generators",\n"nested_scopes" and "with_statement". "generators", "with_statement",\n"nested_scopes" are redundant in Python version 2.6 and above because\nthey are always enabled.\n\nA future statement is recognized and treated specially at compile\ntime: Changes to the semantics of core constructs are often\nimplemented by generating different code. It may even be the case\nthat a new feature introduces new incompatible syntax (such as a new\nreserved word), in which case the compiler may need to parse the\nmodule differently. Such decisions cannot be pushed off until\nruntime.\n\nFor any given release, the compiler knows which feature names have\nbeen defined, and raises a compile-time error if a future statement\ncontains a feature not known to it.\n\nThe direct runtime semantics are the same as for any import statement:\nthere is a standard module "__future__", described later, and it will\nbe imported in the usual way at the time the future statement is\nexecuted.\n\nThe interesting runtime semantics depend on the specific feature\nenabled by the future statement.\n\nNote that there is nothing special about the statement:\n\n import __future__ [as name]\n\nThat is not a future statement; it\'s an ordinary import statement with\nno special semantics or syntax restrictions.\n\nCode compiled by an "exec" statement or calls to the built-in\nfunctions "compile()" and "execfile()" that occur in a module "M"\ncontaining a future statement will, by default, use the new syntax or\nsemantics associated with the future statement. This can, starting\nwith Python 2.2 be controlled by optional arguments to "compile()" ---\nsee the documentation of that function for details.\n\nA future statement typed at an interactive interpreter prompt will\ntake effect for the rest of the interpreter session. If an\ninterpreter is started with the "-i" option, is passed a script name\nto execute, and the script includes a future statement, it will be in\neffect in the interactive session started after the script is\nexecuted.\n\nSee also:\n\n **PEP 236** - Back to the __future__\n The original proposal for the __future__ mechanism.\n', - 'in': u'\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation. Also unlike C, expressions like "a < b < c" have the\ninterpretation that is conventional in mathematics:\n\n comparison ::= or_expr ( comp_operator or_expr )*\n comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "<>" | "!="\n | "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: "True" or "False".\n\nComparisons can be chained arbitrarily, e.g., "x < y <= z" is\nequivalent to "x < y and y <= z", except that "y" is evaluated only\nonce (but in both cases "z" is not evaluated at all when "x < y" is\nfound to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then "a op1 b op2 c ... y\nopN z" is equivalent to "a op1 b and b op2 c and ... y opN z", except\nthat each expression is evaluated at most once.\n\nNote that "a op1 b op2 c" doesn\'t imply any kind of comparison between\n*a* and *c*, so that, e.g., "x < y > z" is perfectly legal (though\nperhaps not pretty).\n\nThe forms "<>" and "!=" are equivalent; for consistency with C, "!="\nis preferred; where "!=" is mentioned below "<>" is also accepted.\nThe "<>" spelling is considered obsolescent.\n\nThe operators "<", ">", "==", ">=", "<=", and "!=" compare the values\nof two objects. The objects need not have the same type. If both are\nnumbers, they are converted to a common type. Otherwise, objects of\ndifferent types *always* compare unequal, and are ordered consistently\nbut arbitrarily. You can control comparison behavior of objects of\nnon-built-in types by defining a "__cmp__" method or rich comparison\nmethods like "__gt__", described in section Special method names.\n\n(This unusual definition of comparison was used to simplify the\ndefinition of operations like sorting and the "in" and "not in"\noperators. In the future, the comparison rules for objects of\ndifferent types are likely to change.)\n\nComparison of objects of the same type depends on the type:\n\n* Numbers are compared arithmetically.\n\n* Strings are compared lexicographically using the numeric\n equivalents (the result of the built-in function "ord()") of their\n characters. Unicode and 8-bit strings are fully interoperable in\n this behavior. [4]\n\n* Tuples and lists are compared lexicographically using comparison\n of corresponding elements. This means that to compare equal, each\n element must compare equal and the two sequences must be of the same\n type and have the same length.\n\n If not equal, the sequences are ordered the same as their first\n differing elements. For example, "cmp([1,2,x], [1,2,y])" returns\n the same as "cmp(x,y)". If the corresponding element does not\n exist, the shorter sequence is ordered first (for example, "[1,2] <\n [1,2,3]").\n\n* Mappings (dictionaries) compare equal if and only if their sorted\n (key, value) lists compare equal. [5] Outcomes other than equality\n are resolved consistently, but are not otherwise defined. [6]\n\n* Most other objects of built-in types compare unequal unless they\n are the same object; the choice whether one object is considered\n smaller or larger than another one is made arbitrarily but\n consistently within one execution of a program.\n\nThe operators "in" and "not in" test for collection membership. "x in\ns" evaluates to true if *x* is a member of the collection *s*, and\nfalse otherwise. "x not in s" returns the negation of "x in s". The\ncollection membership test has traditionally been bound to sequences;\nan object is a member of a collection if the collection is a sequence\nand contains an element equal to that object. However, it make sense\nfor many other object types to support membership tests without being\na sequence. In particular, dictionaries (for keys) and sets support\nmembership testing.\n\nFor the list and tuple types, "x in y" is true if and only if there\nexists an index *i* such that "x == y[i]" is true.\n\nFor the Unicode and string types, "x in y" is true if and only if *x*\nis a substring of *y*. An equivalent test is "y.find(x) != -1".\nNote, *x* and *y* need not be the same type; consequently, "u\'ab\' in\n\'abc\'" will return "True". Empty strings are always considered to be a\nsubstring of any other string, so """ in "abc"" will return "True".\n\nChanged in version 2.3: Previously, *x* was required to be a string of\nlength "1".\n\nFor user-defined classes which define the "__contains__()" method, "x\nin y" is true if and only if "y.__contains__(x)" is true.\n\nFor user-defined classes which do not define "__contains__()" but do\ndefine "__iter__()", "x in y" is true if some value "z" with "x == z"\nis produced while iterating over "y". If an exception is raised\nduring the iteration, it is as if "in" raised that exception.\n\nLastly, the old-style iteration protocol is tried: if a class defines\n"__getitem__()", "x in y" is true if and only if there is a non-\nnegative integer index *i* such that "x == y[i]", and all lower\ninteger indices do not raise "IndexError" exception. (If any other\nexception is raised, it is as if "in" raised that exception).\n\nThe operator "not in" is defined to have the inverse true value of\n"in".\n\nThe operators "is" and "is not" test for object identity: "x is y" is\ntrue if and only if *x* and *y* are the same object. "x is not y"\nyields the inverse truth value. [7]\n', - 'integers': u'\nInteger and long integer literals\n*********************************\n\nInteger and long integer literals are described by the following\nlexical definitions:\n\n longinteger ::= integer ("l" | "L")\n integer ::= decimalinteger | octinteger | hexinteger | bininteger\n decimalinteger ::= nonzerodigit digit* | "0"\n octinteger ::= "0" ("o" | "O") octdigit+ | "0" octdigit+\n hexinteger ::= "0" ("x" | "X") hexdigit+\n bininteger ::= "0" ("b" | "B") bindigit+\n nonzerodigit ::= "1"..."9"\n octdigit ::= "0"..."7"\n bindigit ::= "0" | "1"\n hexdigit ::= digit | "a"..."f" | "A"..."F"\n\nAlthough both lower case "\'l\'" and upper case "\'L\'" are allowed as\nsuffix for long integers, it is strongly recommended to always use\n"\'L\'", since the letter "\'l\'" looks too much like the digit "\'1\'".\n\nPlain integer literals that are above the largest representable plain\ninteger (e.g., 2147483647 when using 32-bit arithmetic) are accepted\nas if they were long integers instead. [1] There is no limit for long\ninteger literals apart from what can be stored in available memory.\n\nSome examples of plain integer literals (first row) and long integer\nliterals (second and third rows):\n\n 7 2147483647 0177\n 3L 79228162514264337593543950336L 0377L 0x100000000L\n 79228162514264337593543950336 0xdeadbeef\n', - 'lambda': u'\nLambdas\n*******\n\n lambda_expr ::= "lambda" [parameter_list]: expression\n old_lambda_expr ::= "lambda" [parameter_list]: old_expression\n\nLambda expressions (sometimes called lambda forms) have the same\nsyntactic position as expressions. They are a shorthand to create\nanonymous functions; the expression "lambda arguments: expression"\nyields a function object. The unnamed object behaves like a function\nobject defined with\n\n def name(arguments):\n return expression\n\nSee section Function definitions for the syntax of parameter lists.\nNote that functions created with lambda expressions cannot contain\nstatements.\n', - 'lists': u'\nList displays\n*************\n\nA list display is a possibly empty series of expressions enclosed in\nsquare brackets:\n\n list_display ::= "[" [expression_list | list_comprehension] "]"\n list_comprehension ::= expression list_for\n list_for ::= "for" target_list "in" old_expression_list [list_iter]\n old_expression_list ::= old_expression [("," old_expression)+ [","]]\n old_expression ::= or_test | old_lambda_expr\n list_iter ::= list_for | list_if\n list_if ::= "if" old_expression [list_iter]\n\nA list display yields a new list object. Its contents are specified\nby providing either a list of expressions or a list comprehension.\nWhen a comma-separated list of expressions is supplied, its elements\nare evaluated from left to right and placed into the list object in\nthat order. When a list comprehension is supplied, it consists of a\nsingle expression followed by at least one "for" clause and zero or\nmore "for" or "if" clauses. In this case, the elements of the new\nlist are those that would be produced by considering each of the "for"\nor "if" clauses a block, nesting from left to right, and evaluating\nthe expression to produce a list element each time the innermost block\nis reached [1].\n', - 'naming': u'\nNaming and binding\n******************\n\n*Names* refer to objects. Names are introduced by name binding\noperations. Each occurrence of a name in the program text refers to\nthe *binding* of that name established in the innermost function block\ncontaining the use.\n\nA *block* is a piece of Python program text that is executed as a\nunit. The following are blocks: a module, a function body, and a class\ndefinition. Each command typed interactively is a block. A script\nfile (a file given as standard input to the interpreter or specified\non the interpreter command line the first argument) is a code block.\nA script command (a command specified on the interpreter command line\nwith the \'**-c**\' option) is a code block. The file read by the\nbuilt-in function "execfile()" is a code block. The string argument\npassed to the built-in function "eval()" and to the "exec" statement\nis a code block. The expression read and evaluated by the built-in\nfunction "input()" is a code block.\n\nA code block is executed in an *execution frame*. A frame contains\nsome administrative information (used for debugging) and determines\nwhere and how execution continues after the code block\'s execution has\ncompleted.\n\nA *scope* defines the visibility of a name within a block. If a local\nvariable is defined in a block, its scope includes that block. If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces\na different binding for the name. The scope of names defined in a\nclass block is limited to the class block; it does not extend to the\ncode blocks of methods -- this includes generator expressions since\nthey are implemented using a function scope. This means that the\nfollowing will fail:\n\n class A:\n a = 42\n b = list(a + i for i in range(10))\n\nWhen a name is used in a code block, it is resolved using the nearest\nenclosing scope. The set of all such scopes visible to a code block\nis called the block\'s *environment*.\n\nIf a name is bound in a block, it is a local variable of that block.\nIf a name is bound at the module level, it is a global variable. (The\nvariables of the module code block are local and global.) If a\nvariable is used in a code block but not defined there, it is a *free\nvariable*.\n\nWhen a name is not found at all, a "NameError" exception is raised.\nIf the name refers to a local variable that has not been bound, a\n"UnboundLocalError" exception is raised. "UnboundLocalError" is a\nsubclass of "NameError".\n\nThe following constructs bind names: formal parameters to functions,\n"import" statements, class and function definitions (these bind the\nclass or function name in the defining block), and targets that are\nidentifiers if occurring in an assignment, "for" loop header, in the\nsecond position of an "except" clause header or after "as" in a "with"\nstatement. The "import" statement of the form "from ... import *"\nbinds all names defined in the imported module, except those beginning\nwith an underscore. This form may only be used at the module level.\n\nA target occurring in a "del" statement is also considered bound for\nthis purpose (though the actual semantics are to unbind the name). It\nis illegal to unbind a name that is referenced by an enclosing scope;\nthe compiler will report a "SyntaxError".\n\nEach assignment or import statement occurs within a block defined by a\nclass or function definition or at the module level (the top-level\ncode block).\n\nIf a name binding operation occurs anywhere within a code block, all\nuses of the name within the block are treated as references to the\ncurrent block. This can lead to errors when a name is used within a\nblock before it is bound. This rule is subtle. Python lacks\ndeclarations and allows name binding operations to occur anywhere\nwithin a code block. The local variables of a code block can be\ndetermined by scanning the entire text of the block for name binding\noperations.\n\nIf the global statement occurs within a block, all uses of the name\nspecified in the statement refer to the binding of that name in the\ntop-level namespace. Names are resolved in the top-level namespace by\nsearching the global namespace, i.e. the namespace of the module\ncontaining the code block, and the builtins namespace, the namespace\nof the module "__builtin__". The global namespace is searched first.\nIf the name is not found there, the builtins namespace is searched.\nThe global statement must precede all uses of the name.\n\nThe builtins namespace associated with the execution of a code block\nis actually found by looking up the name "__builtins__" in its global\nnamespace; this should be a dictionary or a module (in the latter case\nthe module\'s dictionary is used). By default, when in the "__main__"\nmodule, "__builtins__" is the built-in module "__builtin__" (note: no\n\'s\'); when in any other module, "__builtins__" is an alias for the\ndictionary of the "__builtin__" module itself. "__builtins__" can be\nset to a user-created dictionary to create a weak form of restricted\nexecution.\n\n**CPython implementation detail:** Users should not touch\n"__builtins__"; it is strictly an implementation detail. Users\nwanting to override values in the builtins namespace should "import"\nthe "__builtin__" (no \'s\') module and modify its attributes\nappropriately.\n\nThe namespace for a module is automatically created the first time a\nmodule is imported. The main module for a script is always called\n"__main__".\n\nThe "global" statement has the same scope as a name binding operation\nin the same block. If the nearest enclosing scope for a free variable\ncontains a global statement, the free variable is treated as a global.\n\nA class definition is an executable statement that may use and define\nnames. These references follow the normal rules for name resolution.\nThe namespace of the class definition becomes the attribute dictionary\nof the class. Names defined at the class scope are not visible in\nmethods.\n\n\nInteraction with dynamic features\n=================================\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nIf the wild card form of import --- "import *" --- is used in a\nfunction and the function contains or is a nested block with free\nvariables, the compiler will raise a "SyntaxError".\n\nIf "exec" is used in a function and the function contains or is a\nnested block with free variables, the compiler will raise a\n"SyntaxError" unless the exec explicitly specifies the local namespace\nfor the "exec". (In other words, "exec obj" would be illegal, but\n"exec obj in ns" would be legal.)\n\nThe "eval()", "execfile()", and "input()" functions and the "exec"\nstatement do not have access to the full environment for resolving\nnames. Names may be resolved in the local and global namespaces of\nthe caller. Free variables are not resolved in the nearest enclosing\nnamespace, but in the global namespace. [1] The "exec" statement and\nthe "eval()" and "execfile()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n', - 'numbers': u'\nNumeric literals\n****************\n\nThere are four types of numeric literals: plain integers, long\nintegers, floating point numbers, and imaginary numbers. There are no\ncomplex literals (complex numbers can be formed by adding a real\nnumber and an imaginary number).\n\nNote that numeric literals do not include a sign; a phrase like "-1"\nis actually an expression composed of the unary operator \'"-"\' and the\nliteral "1".\n', - 'numeric-types': u'\nEmulating numeric types\n***********************\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "//", "%", "divmod()", "pow()", "**",\n "<<", ">>", "&", "^", "|"). For instance, to evaluate the\n expression "x + y", where *x* is an instance of a class that has an\n "__add__()" method, "x.__add__(y)" is called. The "__divmod__()"\n method should be the equivalent to using "__floordiv__()" and\n "__mod__()"; it should not be related to "__truediv__()" (described\n below). Note that "__pow__()" should be defined to accept an\n optional third argument if the ternary version of the built-in\n "pow()" function is to be supported.\n\n If one of those methods does not support the operation with the\n supplied arguments, it should return "NotImplemented".\n\nobject.__div__(self, other)\nobject.__truediv__(self, other)\n\n The division operator ("/") is implemented by these methods. The\n "__truediv__()" method is used when "__future__.division" is in\n effect, otherwise "__div__()" is used. If only one of these two\n methods is defined, the object will not support division in the\n alternate context; "TypeError" will be raised instead.\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rdiv__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "/", "%", "divmod()", "pow()", "**",\n "<<", ">>", "&", "^", "|") with reflected (swapped) operands.\n These functions are only called if the left operand does not\n support the corresponding operation and the operands are of\n different types. [2] For instance, to evaluate the expression "x -\n y", where *y* is an instance of a class that has an "__rsub__()"\n method, "y.__rsub__(x)" is called if "x.__sub__(y)" returns\n *NotImplemented*.\n\n Note that ternary "pow()" will not try calling "__rpow__()" (the\n coercion rules would become too complicated).\n\n Note: If the right operand\'s type is a subclass of the left\n operand\'s type and that subclass provides the reflected method\n for the operation, this method will be called before the left\n operand\'s non-reflected method. This behavior allows subclasses\n to override their ancestors\' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__idiv__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n These methods are called to implement the augmented arithmetic\n assignments ("+=", "-=", "*=", "/=", "//=", "%=", "**=", "<<=",\n ">>=", "&=", "^=", "|="). These methods should attempt to do the\n operation in-place (modifying *self*) and return the result (which\n could be, but does not have to be, *self*). If a specific method\n is not defined, the augmented assignment falls back to the normal\n methods. For instance, to execute the statement "x += y", where\n *x* is an instance of a class that has an "__iadd__()" method,\n "x.__iadd__(y)" is called. If *x* is an instance of a class that\n does not define a "__iadd__()" method, "x.__add__(y)" and\n "y.__radd__(x)" are considered, as with the evaluation of "x + y".\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n Called to implement the unary arithmetic operations ("-", "+",\n "abs()" and "~").\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__long__(self)\nobject.__float__(self)\n\n Called to implement the built-in functions "complex()", "int()",\n "long()", and "float()". Should return a value of the appropriate\n type.\n\nobject.__oct__(self)\nobject.__hex__(self)\n\n Called to implement the built-in functions "oct()" and "hex()".\n Should return a string value.\n\nobject.__index__(self)\n\n Called to implement "operator.index()". Also called whenever\n Python needs an integer object (such as in slicing). Must return\n an integer (int or long).\n\n New in version 2.5.\n\nobject.__coerce__(self, other)\n\n Called to implement "mixed-mode" numeric arithmetic. Should either\n return a 2-tuple containing *self* and *other* converted to a\n common numeric type, or "None" if conversion is impossible. When\n the common type would be the type of "other", it is sufficient to\n return "None", since the interpreter will also ask the other object\n to attempt a coercion (but sometimes, if the implementation of the\n other type cannot be changed, it is useful to do the conversion to\n the other type here). A return value of "NotImplemented" is\n equivalent to returning "None".\n', - 'objects': u'\nObjects, values and types\n*************************\n\n*Objects* are Python\'s abstraction for data. All data in a Python\nprogram is represented by objects or by relations between objects. (In\na sense, and in conformance to Von Neumann\'s model of a "stored\nprogram computer," code is also represented by objects.)\n\nEvery object has an identity, a type and a value. An object\'s\n*identity* never changes once it has been created; you may think of it\nas the object\'s address in memory. The \'"is"\' operator compares the\nidentity of two objects; the "id()" function returns an integer\nrepresenting its identity (currently implemented as its address). An\nobject\'s *type* is also unchangeable. [1] An object\'s type determines\nthe operations that the object supports (e.g., "does it have a\nlength?") and also defines the possible values for objects of that\ntype. The "type()" function returns an object\'s type (which is an\nobject itself). The *value* of some objects can change. Objects\nwhose value can change are said to be *mutable*; objects whose value\nis unchangeable once they are created are called *immutable*. (The\nvalue of an immutable container object that contains a reference to a\nmutable object can change when the latter\'s value is changed; however\nthe container is still considered immutable, because the collection of\nobjects it contains cannot be changed. So, immutability is not\nstrictly the same as having an unchangeable value, it is more subtle.)\nAn object\'s mutability is determined by its type; for instance,\nnumbers, strings and tuples are immutable, while dictionaries and\nlists are mutable.\n\nObjects are never explicitly destroyed; however, when they become\nunreachable they may be garbage-collected. An implementation is\nallowed to postpone garbage collection or omit it altogether --- it is\na matter of implementation quality how garbage collection is\nimplemented, as long as no objects are collected that are still\nreachable.\n\n**CPython implementation detail:** CPython currently uses a reference-\ncounting scheme with (optional) delayed detection of cyclically linked\ngarbage, which collects most objects as soon as they become\nunreachable, but is not guaranteed to collect garbage containing\ncircular references. See the documentation of the "gc" module for\ninformation on controlling the collection of cyclic garbage. Other\nimplementations act differently and CPython may change. Do not depend\non immediate finalization of objects when they become unreachable (ex:\nalways close files).\n\nNote that the use of the implementation\'s tracing or debugging\nfacilities may keep objects alive that would normally be collectable.\nAlso note that catching an exception with a \'"try"..."except"\'\nstatement may keep objects alive.\n\nSome objects contain references to "external" resources such as open\nfiles or windows. It is understood that these resources are freed\nwhen the object is garbage-collected, but since garbage collection is\nnot guaranteed to happen, such objects also provide an explicit way to\nrelease the external resource, usually a "close()" method. Programs\nare strongly recommended to explicitly close such objects. The\n\'"try"..."finally"\' statement provides a convenient way to do this.\n\nSome objects contain references to other objects; these are called\n*containers*. Examples of containers are tuples, lists and\ndictionaries. The references are part of a container\'s value. In\nmost cases, when we talk about the value of a container, we imply the\nvalues, not the identities of the contained objects; however, when we\ntalk about the mutability of a container, only the identities of the\nimmediately contained objects are implied. So, if an immutable\ncontainer (like a tuple) contains a reference to a mutable object, its\nvalue changes if that mutable object is changed.\n\nTypes affect almost all aspects of object behavior. Even the\nimportance of object identity is affected in some sense: for immutable\ntypes, operations that compute new values may actually return a\nreference to any existing object with the same type and value, while\nfor mutable objects this is not allowed. E.g., after "a = 1; b = 1",\n"a" and "b" may or may not refer to the same object with the value\none, depending on the implementation, but after "c = []; d = []", "c"\nand "d" are guaranteed to refer to two different, unique, newly\ncreated empty lists. (Note that "c = d = []" assigns the same object\nto both "c" and "d".)\n', - 'operator-summary': u'\nOperator precedence\n*******************\n\nThe following table summarizes the operator precedences in Python,\nfrom lowest precedence (least binding) to highest precedence (most\nbinding). Operators in the same box have the same precedence. Unless\nthe syntax is explicitly given, operators are binary. Operators in\nthe same box group left to right (except for comparisons, including\ntests, which all have the same precedence and chain from left to right\n--- see section Comparisons --- and exponentiation, which groups from\nright to left).\n\n+-------------------------------------------------+---------------------------------------+\n| Operator | Description |\n+=================================================+=======================================+\n| "lambda" | Lambda expression |\n+-------------------------------------------------+---------------------------------------+\n| "if" -- "else" | Conditional expression |\n+-------------------------------------------------+---------------------------------------+\n| "or" | Boolean OR |\n+-------------------------------------------------+---------------------------------------+\n| "and" | Boolean AND |\n+-------------------------------------------------+---------------------------------------+\n| "not" "x" | Boolean NOT |\n+-------------------------------------------------+---------------------------------------+\n| "in", "not in", "is", "is not", "<", "<=", ">", | Comparisons, including membership |\n| ">=", "<>", "!=", "==" | tests and identity tests |\n+-------------------------------------------------+---------------------------------------+\n| "|" | Bitwise OR |\n+-------------------------------------------------+---------------------------------------+\n| "^" | Bitwise XOR |\n+-------------------------------------------------+---------------------------------------+\n| "&" | Bitwise AND |\n+-------------------------------------------------+---------------------------------------+\n| "<<", ">>" | Shifts |\n+-------------------------------------------------+---------------------------------------+\n| "+", "-" | Addition and subtraction |\n+-------------------------------------------------+---------------------------------------+\n| "*", "/", "//", "%" | Multiplication, division, remainder |\n| | [8] |\n+-------------------------------------------------+---------------------------------------+\n| "+x", "-x", "~x" | Positive, negative, bitwise NOT |\n+-------------------------------------------------+---------------------------------------+\n| "**" | Exponentiation [9] |\n+-------------------------------------------------+---------------------------------------+\n| "x[index]", "x[index:index]", | Subscription, slicing, call, |\n| "x(arguments...)", "x.attribute" | attribute reference |\n+-------------------------------------------------+---------------------------------------+\n| "(expressions...)", "[expressions...]", "{key: | Binding or tuple display, list |\n| value...}", "`expressions...`" | display, dictionary display, string |\n| | conversion |\n+-------------------------------------------------+---------------------------------------+\n\n-[ Footnotes ]-\n\n[1] In Python 2.3 and later releases, a list comprehension "leaks"\n the control variables of each "for" it contains into the\n containing scope. However, this behavior is deprecated, and\n relying on it will not work in Python 3.\n\n[2] While "abs(x%y) < abs(y)" is true mathematically, for floats\n it may not be true numerically due to roundoff. For example, and\n assuming a platform on which a Python float is an IEEE 754 double-\n precision number, in order that "-1e-100 % 1e100" have the same\n sign as "1e100", the computed result is "-1e-100 + 1e100", which\n is numerically exactly equal to "1e100". The function\n "math.fmod()" returns a result whose sign matches the sign of the\n first argument instead, and so returns "-1e-100" in this case.\n Which approach is more appropriate depends on the application.\n\n[3] If x is very close to an exact integer multiple of y, it\'s\n possible for "floor(x/y)" to be one larger than "(x-x%y)/y" due to\n rounding. In such cases, Python returns the latter result, in\n order to preserve that "divmod(x,y)[0] * y + x % y" be very close\n to "x".\n\n[4] While comparisons between unicode strings make sense at the\n byte level, they may be counter-intuitive to users. For example,\n the strings "u"\\u00C7"" and "u"\\u0043\\u0327"" compare differently,\n even though they both represent the same unicode character (LATIN\n CAPITAL LETTER C WITH CEDILLA). To compare strings in a human\n recognizable way, compare using "unicodedata.normalize()".\n\n[5] The implementation computes this efficiently, without\n constructing lists or sorting.\n\n[6] Earlier versions of Python used lexicographic comparison of\n the sorted (key, value) lists, but this was very expensive for the\n common case of comparing for equality. An even earlier version of\n Python compared dictionaries by identity only, but this caused\n surprises because people expected to be able to test a dictionary\n for emptiness by comparing it to "{}".\n\n[7] Due to automatic garbage-collection, free lists, and the\n dynamic nature of descriptors, you may notice seemingly unusual\n behaviour in certain uses of the "is" operator, like those\n involving comparisons between instance methods, or constants.\n Check their documentation for more info.\n\n[8] The "%" operator is also used for string formatting; the same\n precedence applies.\n\n[9] The power operator "**" binds less tightly than an arithmetic\n or bitwise unary operator on its right, that is, "2**-1" is "0.5".\n', - 'pass': u'\nThe "pass" statement\n********************\n\n pass_stmt ::= "pass"\n\n"pass" is a null operation --- when it is executed, nothing happens.\nIt is useful as a placeholder when a statement is required\nsyntactically, but no code needs to be executed, for example:\n\n def f(arg): pass # a function that does nothing (yet)\n\n class C: pass # a class with no methods (yet)\n', - 'power': u'\nThe power operator\n******************\n\nThe power operator binds more tightly than unary operators on its\nleft; it binds less tightly than unary operators on its right. The\nsyntax is:\n\n power ::= primary ["**" u_expr]\n\nThus, in an unparenthesized sequence of power and unary operators, the\noperators are evaluated from right to left (this does not constrain\nthe evaluation order for the operands): "-1**2" results in "-1".\n\nThe power operator has the same semantics as the built-in "pow()"\nfunction, when called with two arguments: it yields its left argument\nraised to the power of its right argument. The numeric arguments are\nfirst converted to a common type. The result type is that of the\narguments after coercion.\n\nWith mixed operand types, the coercion rules for binary arithmetic\noperators apply. For int and long int operands, the result has the\nsame type as the operands (after coercion) unless the second argument\nis negative; in that case, all arguments are converted to float and a\nfloat result is delivered. For example, "10**2" returns "100", but\n"10**-2" returns "0.01". (This last feature was added in Python 2.2.\nIn Python 2.1 and before, if both arguments were of integer types and\nthe second argument was negative, an exception was raised).\n\nRaising "0.0" to a negative power results in a "ZeroDivisionError".\nRaising a negative number to a fractional power results in a\n"ValueError".\n', - 'print': u'\nThe "print" statement\n*********************\n\n print_stmt ::= "print" ([expression ("," expression)* [","]]\n | ">>" expression [("," expression)+ [","]])\n\n"print" evaluates each expression in turn and writes the resulting\nobject to standard output (see below). If an object is not a string,\nit is first converted to a string using the rules for string\nconversions. The (resulting or original) string is then written. A\nspace is written before each object is (converted and) written, unless\nthe output system believes it is positioned at the beginning of a\nline. This is the case (1) when no characters have yet been written\nto standard output, (2) when the last character written to standard\noutput is a whitespace character except "\' \'", or (3) when the last\nwrite operation on standard output was not a "print" statement. (In\nsome cases it may be functional to write an empty string to standard\noutput for this reason.)\n\nNote: Objects which act like file objects but which are not the\n built-in file objects often do not properly emulate this aspect of\n the file object\'s behavior, so it is best not to rely on this.\n\nA "\'\\n\'" character is written at the end, unless the "print" statement\nends with a comma. This is the only action if the statement contains\njust the keyword "print".\n\nStandard output is defined as the file object named "stdout" in the\nbuilt-in module "sys". If no such object exists, or if it does not\nhave a "write()" method, a "RuntimeError" exception is raised.\n\n"print" also has an extended form, defined by the second portion of\nthe syntax described above. This form is sometimes referred to as\n""print" chevron." In this form, the first expression after the ">>"\nmust evaluate to a "file-like" object, specifically an object that has\na "write()" method as described above. With this extended form, the\nsubsequent expressions are printed to this file object. If the first\nexpression evaluates to "None", then "sys.stdout" is used as the file\nfor output.\n', - 'raise': u'\nThe "raise" statement\n*********************\n\n raise_stmt ::= "raise" [expression ["," expression ["," expression]]]\n\nIf no expressions are present, "raise" re-raises the last exception\nthat was active in the current scope. If no exception is active in\nthe current scope, a "TypeError" exception is raised indicating that\nthis is an error (if running under IDLE, a "Queue.Empty" exception is\nraised instead).\n\nOtherwise, "raise" evaluates the expressions to get three objects,\nusing "None" as the value of omitted expressions. The first two\nobjects are used to determine the *type* and *value* of the exception.\n\nIf the first object is an instance, the type of the exception is the\nclass of the instance, the instance itself is the value, and the\nsecond object must be "None".\n\nIf the first object is a class, it becomes the type of the exception.\nThe second object is used to determine the exception value: If it is\nan instance of the class, the instance becomes the exception value. If\nthe second object is a tuple, it is used as the argument list for the\nclass constructor; if it is "None", an empty argument list is used,\nand any other object is treated as a single argument to the\nconstructor. The instance so created by calling the constructor is\nused as the exception value.\n\nIf a third object is present and not "None", it must be a traceback\nobject (see section The standard type hierarchy), and it is\nsubstituted instead of the current location as the place where the\nexception occurred. If the third object is present and not a\ntraceback object or "None", a "TypeError" exception is raised. The\nthree-expression form of "raise" is useful to re-raise an exception\ntransparently in an except clause, but "raise" with no expressions\nshould be preferred if the exception to be re-raised was the most\nrecently active exception in the current scope.\n\nAdditional information on exceptions can be found in section\nExceptions, and information about handling exceptions is in section\nThe try statement.\n', - 'return': u'\nThe "return" statement\n**********************\n\n return_stmt ::= "return" [expression_list]\n\n"return" may only occur syntactically nested in a function definition,\nnot within a nested class definition.\n\nIf an expression list is present, it is evaluated, else "None" is\nsubstituted.\n\n"return" leaves the current function call with the expression list (or\n"None") as return value.\n\nWhen "return" passes control out of a "try" statement with a "finally"\nclause, that "finally" clause is executed before really leaving the\nfunction.\n\nIn a generator function, the "return" statement is not allowed to\ninclude an "expression_list". In that context, a bare "return"\nindicates that the generator is done and will cause "StopIteration" to\nbe raised.\n', - 'sequence-types': u'\nEmulating container types\n*************************\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which "0 <= k < N" where\n*N* is the length of the sequence, or slice objects, which define a\nrange of items. (For backwards compatibility, the method\n"__getslice__()" (see below) can also be defined to handle simple, but\nnot extended slices.) It is also recommended that mappings provide the\nmethods "keys()", "values()", "items()", "has_key()", "get()",\n"clear()", "setdefault()", "iterkeys()", "itervalues()",\n"iteritems()", "pop()", "popitem()", "copy()", and "update()" behaving\nsimilar to those for Python\'s standard dictionary objects. The\n"UserDict" module provides a "DictMixin" class to help create those\nmethods from a base set of "__getitem__()", "__setitem__()",\n"__delitem__()", and "keys()". Mutable sequences should provide\nmethods "append()", "count()", "index()", "extend()", "insert()",\n"pop()", "remove()", "reverse()" and "sort()", like Python standard\nlist objects. Finally, sequence types should implement addition\n(meaning concatenation) and multiplication (meaning repetition) by\ndefining the methods "__add__()", "__radd__()", "__iadd__()",\n"__mul__()", "__rmul__()" and "__imul__()" described below; they\nshould not define "__coerce__()" or other numerical operators. It is\nrecommended that both mappings and sequences implement the\n"__contains__()" method to allow efficient use of the "in" operator;\nfor mappings, "in" should be equivalent of "has_key()"; for sequences,\nit should search through the values. It is further recommended that\nboth mappings and sequences implement the "__iter__()" method to allow\nefficient iteration through the container; for mappings, "__iter__()"\nshould be the same as "iterkeys()"; for sequences, it should iterate\nthrough the values.\n\nobject.__len__(self)\n\n Called to implement the built-in function "len()". Should return\n the length of the object, an integer ">=" 0. Also, an object that\n doesn\'t define a "__nonzero__()" method and whose "__len__()"\n method returns zero is considered to be false in a Boolean context.\n\nobject.__getitem__(self, key)\n\n Called to implement evaluation of "self[key]". For sequence types,\n the accepted keys should be integers and slice objects. Note that\n the special interpretation of negative indexes (if the class wishes\n to emulate a sequence type) is up to the "__getitem__()" method. If\n *key* is of an inappropriate type, "TypeError" may be raised; if of\n a value outside the set of indexes for the sequence (after any\n special interpretation of negative values), "IndexError" should be\n raised. For mapping types, if *key* is missing (not in the\n container), "KeyError" should be raised.\n\n Note: "for" loops expect that an "IndexError" will be raised for\n illegal indexes to allow proper detection of the end of the\n sequence.\n\nobject.__missing__(self, key)\n\n Called by "dict"."__getitem__()" to implement "self[key]" for dict\n subclasses when key is not in the dictionary.\n\nobject.__setitem__(self, key, value)\n\n Called to implement assignment to "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support changes to the values for keys, or if new keys\n can be added, or for sequences if elements can be replaced. The\n same exceptions should be raised for improper *key* values as for\n the "__getitem__()" method.\n\nobject.__delitem__(self, key)\n\n Called to implement deletion of "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support removal of keys, or for sequences if elements\n can be removed from the sequence. The same exceptions should be\n raised for improper *key* values as for the "__getitem__()" method.\n\nobject.__iter__(self)\n\n This method is called when an iterator is required for a container.\n This method should return a new iterator object that can iterate\n over all the objects in the container. For mappings, it should\n iterate over the keys of the container, and should also be made\n available as the method "iterkeys()".\n\n Iterator objects also need to implement this method; they are\n required to return themselves. For more information on iterator\n objects, see Iterator Types.\n\nobject.__reversed__(self)\n\n Called (if present) by the "reversed()" built-in to implement\n reverse iteration. It should return a new iterator object that\n iterates over all the objects in the container in reverse order.\n\n If the "__reversed__()" method is not provided, the "reversed()"\n built-in will fall back to using the sequence protocol ("__len__()"\n and "__getitem__()"). Objects that support the sequence protocol\n should only provide "__reversed__()" if they can provide an\n implementation that is more efficient than the one provided by\n "reversed()".\n\n New in version 2.6.\n\nThe membership test operators ("in" and "not in") are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n Called to implement membership test operators. Should return true\n if *item* is in *self*, false otherwise. For mapping objects, this\n should consider the keys of the mapping rather than the values or\n the key-item pairs.\n\n For objects that don\'t define "__contains__()", the membership test\n first tries iteration via "__iter__()", then the old sequence\n iteration protocol via "__getitem__()", see this section in the\n language reference.\n', - 'shifting': u'\nShifting operations\n*******************\n\nThe shifting operations have lower priority than the arithmetic\noperations:\n\n shift_expr ::= a_expr | shift_expr ( "<<" | ">>" ) a_expr\n\nThese operators accept plain or long integers as arguments. The\narguments are converted to a common type. They shift the first\nargument to the left or right by the number of bits given by the\nsecond argument.\n\nA right shift by *n* bits is defined as division by "pow(2, n)". A\nleft shift by *n* bits is defined as multiplication with "pow(2, n)".\nNegative shift counts raise a "ValueError" exception.\n\nNote: In the current implementation, the right-hand operand is\n required to be at most "sys.maxsize". If the right-hand operand is\n larger than "sys.maxsize" an "OverflowError" exception is raised.\n', - 'slicings': u'\nSlicings\n********\n\nA slicing selects a range of items in a sequence object (e.g., a\nstring, tuple or list). Slicings may be used as expressions or as\ntargets in assignment or "del" statements. The syntax for a slicing:\n\n slicing ::= simple_slicing | extended_slicing\n simple_slicing ::= primary "[" short_slice "]"\n extended_slicing ::= primary "[" slice_list "]"\n slice_list ::= slice_item ("," slice_item)* [","]\n slice_item ::= expression | proper_slice | ellipsis\n proper_slice ::= short_slice | long_slice\n short_slice ::= [lower_bound] ":" [upper_bound]\n long_slice ::= short_slice ":" [stride]\n lower_bound ::= expression\n upper_bound ::= expression\n stride ::= expression\n ellipsis ::= "..."\n\nThere is ambiguity in the formal syntax here: anything that looks like\nan expression list also looks like a slice list, so any subscription\ncan be interpreted as a slicing. Rather than further complicating the\nsyntax, this is disambiguated by defining that in this case the\ninterpretation as a subscription takes priority over the\ninterpretation as a slicing (this is the case if the slice list\ncontains no proper slice nor ellipses). Similarly, when the slice\nlist has exactly one short slice and no trailing comma, the\ninterpretation as a simple slicing takes priority over that as an\nextended slicing.\n\nThe semantics for a simple slicing are as follows. The primary must\nevaluate to a sequence object. The lower and upper bound expressions,\nif present, must evaluate to plain integers; defaults are zero and the\n"sys.maxint", respectively. If either bound is negative, the\nsequence\'s length is added to it. The slicing now selects all items\nwith index *k* such that "i <= k < j" where *i* and *j* are the\nspecified lower and upper bounds. This may be an empty sequence. It\nis not an error if *i* or *j* lie outside the range of valid indexes\n(such items don\'t exist so they aren\'t selected).\n\nThe semantics for an extended slicing are as follows. The primary\nmust evaluate to a mapping object, and it is indexed with a key that\nis constructed from the slice list, as follows. If the slice list\ncontains at least one comma, the key is a tuple containing the\nconversion of the slice items; otherwise, the conversion of the lone\nslice item is the key. The conversion of a slice item that is an\nexpression is that expression. The conversion of an ellipsis slice\nitem is the built-in "Ellipsis" object. The conversion of a proper\nslice is a slice object (see section The standard type hierarchy)\nwhose "start", "stop" and "step" attributes are the values of the\nexpressions given as lower bound, upper bound and stride,\nrespectively, substituting "None" for missing expressions.\n', - 'specialattrs': u'\nSpecial Attributes\n******************\n\nThe implementation adds a few special read-only attributes to several\nobject types, where they are relevant. Some of these are not reported\nby the "dir()" built-in function.\n\nobject.__dict__\n\n A dictionary or other mapping object used to store an object\'s\n (writable) attributes.\n\nobject.__methods__\n\n Deprecated since version 2.2: Use the built-in function "dir()" to\n get a list of an object\'s attributes. This attribute is no longer\n available.\n\nobject.__members__\n\n Deprecated since version 2.2: Use the built-in function "dir()" to\n get a list of an object\'s attributes. This attribute is no longer\n available.\n\ninstance.__class__\n\n The class to which a class instance belongs.\n\nclass.__bases__\n\n The tuple of base classes of a class object.\n\nclass.__name__\n\n The name of the class or type.\n\nThe following attributes are only supported by *new-style class*es.\n\nclass.__mro__\n\n This attribute is a tuple of classes that are considered when\n looking for base classes during method resolution.\n\nclass.mro()\n\n This method can be overridden by a metaclass to customize the\n method resolution order for its instances. It is called at class\n instantiation, and its result is stored in "__mro__".\n\nclass.__subclasses__()\n\n Each new-style class keeps a list of weak references to its\n immediate subclasses. This method returns a list of all those\n references still alive. Example:\n\n >>> int.__subclasses__()\n []\n\n-[ Footnotes ]-\n\n[1] Additional information on these special methods may be found\n in the Python Reference Manual (Basic customization).\n\n[2] As a consequence, the list "[1, 2]" is considered equal to\n "[1.0, 2.0]", and similarly for tuples.\n\n[3] They must have since the parser can\'t tell the type of the\n operands.\n\n[4] Cased characters are those with general category property\n being one of "Lu" (Letter, uppercase), "Ll" (Letter, lowercase),\n or "Lt" (Letter, titlecase).\n\n[5] To format only a tuple you should therefore provide a\n singleton tuple whose only element is the tuple to be formatted.\n\n[6] The advantage of leaving the newline on is that returning an\n empty string is then an unambiguous EOF indication. It is also\n possible (in cases where it might matter, for example, if you want\n to make an exact copy of a file while scanning its lines) to tell\n whether the last line of a file ended in a newline or not (yes\n this happens!).\n', - 'specialnames': u'\nSpecial method names\n********************\n\nA class can implement certain operations that are invoked by special\nsyntax (such as arithmetic operations or subscripting and slicing) by\ndefining methods with special names. This is Python\'s approach to\n*operator overloading*, allowing classes to define their own behavior\nwith respect to language operators. For instance, if a class defines\na method named "__getitem__()", and "x" is an instance of this class,\nthen "x[i]" is roughly equivalent to "x.__getitem__(i)" for old-style\nclasses and "type(x).__getitem__(x, i)" for new-style classes. Except\nwhere mentioned, attempts to execute an operation raise an exception\nwhen no appropriate method is defined (typically "AttributeError" or\n"TypeError").\n\nWhen implementing a class that emulates any built-in type, it is\nimportant that the emulation only be implemented to the degree that it\nmakes sense for the object being modelled. For example, some\nsequences may work well with retrieval of individual elements, but\nextracting a slice may not make sense. (One example of this is the\n"NodeList" interface in the W3C\'s Document Object Model.)\n\n\nBasic customization\n===================\n\nobject.__new__(cls[, ...])\n\n Called to create a new instance of class *cls*. "__new__()" is a\n static method (special-cased so you need not declare it as such)\n that takes the class of which an instance was requested as its\n first argument. The remaining arguments are those passed to the\n object constructor expression (the call to the class). The return\n value of "__new__()" should be the new object instance (usually an\n instance of *cls*).\n\n Typical implementations create a new instance of the class by\n invoking the superclass\'s "__new__()" method using\n "super(currentclass, cls).__new__(cls[, ...])" with appropriate\n arguments and then modifying the newly-created instance as\n necessary before returning it.\n\n If "__new__()" returns an instance of *cls*, then the new\n instance\'s "__init__()" method will be invoked like\n "__init__(self[, ...])", where *self* is the new instance and the\n remaining arguments are the same as were passed to "__new__()".\n\n If "__new__()" does not return an instance of *cls*, then the new\n instance\'s "__init__()" method will not be invoked.\n\n "__new__()" is intended mainly to allow subclasses of immutable\n types (like int, str, or tuple) to customize instance creation. It\n is also commonly overridden in custom metaclasses in order to\n customize class creation.\n\nobject.__init__(self[, ...])\n\n Called after the instance has been created (by "__new__()"), but\n before it is returned to the caller. The arguments are those\n passed to the class constructor expression. If a base class has an\n "__init__()" method, the derived class\'s "__init__()" method, if\n any, must explicitly call it to ensure proper initialization of the\n base class part of the instance; for example:\n "BaseClass.__init__(self, [args...])".\n\n Because "__new__()" and "__init__()" work together in constructing\n objects ("__new__()" to create it, and "__init__()" to customise\n it), no non-"None" value may be returned by "__init__()"; doing so\n will cause a "TypeError" to be raised at runtime.\n\nobject.__del__(self)\n\n Called when the instance is about to be destroyed. This is also\n called a destructor. If a base class has a "__del__()" method, the\n derived class\'s "__del__()" method, if any, must explicitly call it\n to ensure proper deletion of the base class part of the instance.\n Note that it is possible (though not recommended!) for the\n "__del__()" method to postpone destruction of the instance by\n creating a new reference to it. It may then be called at a later\n time when this new reference is deleted. It is not guaranteed that\n "__del__()" methods are called for objects that still exist when\n the interpreter exits.\n\n Note: "del x" doesn\'t directly call "x.__del__()" --- the former\n decrements the reference count for "x" by one, and the latter is\n only called when "x"\'s reference count reaches zero. Some common\n situations that may prevent the reference count of an object from\n going to zero include: circular references between objects (e.g.,\n a doubly-linked list or a tree data structure with parent and\n child pointers); a reference to the object on the stack frame of\n a function that caught an exception (the traceback stored in\n "sys.exc_traceback" keeps the stack frame alive); or a reference\n to the object on the stack frame that raised an unhandled\n exception in interactive mode (the traceback stored in\n "sys.last_traceback" keeps the stack frame alive). The first\n situation can only be remedied by explicitly breaking the cycles;\n the latter two situations can be resolved by storing "None" in\n "sys.exc_traceback" or "sys.last_traceback". Circular references\n which are garbage are detected when the option cycle detector is\n enabled (it\'s on by default), but can only be cleaned up if there\n are no Python-level "__del__()" methods involved. Refer to the\n documentation for the "gc" module for more information about how\n "__del__()" methods are handled by the cycle detector,\n particularly the description of the "garbage" value.\n\n Warning: Due to the precarious circumstances under which\n "__del__()" methods are invoked, exceptions that occur during\n their execution are ignored, and a warning is printed to\n "sys.stderr" instead. Also, when "__del__()" is invoked in\n response to a module being deleted (e.g., when execution of the\n program is done), other globals referenced by the "__del__()"\n method may already have been deleted or in the process of being\n torn down (e.g. the import machinery shutting down). For this\n reason, "__del__()" methods should do the absolute minimum needed\n to maintain external invariants. Starting with version 1.5,\n Python guarantees that globals whose name begins with a single\n underscore are deleted from their module before other globals are\n deleted; if no other references to such globals exist, this may\n help in assuring that imported modules are still available at the\n time when the "__del__()" method is called.\n\n See also the "-R" command-line option.\n\nobject.__repr__(self)\n\n Called by the "repr()" built-in function and by string conversions\n (reverse quotes) to compute the "official" string representation of\n an object. If at all possible, this should look like a valid\n Python expression that could be used to recreate an object with the\n same value (given an appropriate environment). If this is not\n possible, a string of the form "<...some useful description...>"\n should be returned. The return value must be a string object. If a\n class defines "__repr__()" but not "__str__()", then "__repr__()"\n is also used when an "informal" string representation of instances\n of that class is required.\n\n This is typically used for debugging, so it is important that the\n representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n Called by the "str()" built-in function and by the "print"\n statement to compute the "informal" string representation of an\n object. This differs from "__repr__()" in that it does not have to\n be a valid Python expression: a more convenient or concise\n representation may be used instead. The return value must be a\n string object.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n New in version 2.1.\n\n These are the so-called "rich comparison" methods, and are called\n for comparison operators in preference to "__cmp__()" below. The\n correspondence between operator symbols and method names is as\n follows: "xy" call "x.__ne__(y)",\n "x>y" calls "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n\n A rich comparison method may return the singleton "NotImplemented"\n if it does not implement the operation for a given pair of\n arguments. By convention, "False" and "True" are returned for a\n successful comparison. However, these methods can return any value,\n so if the comparison operator is used in a Boolean context (e.g.,\n in the condition of an "if" statement), Python will call "bool()"\n on the value to determine if the result is true or false.\n\n There are no implied relationships among the comparison operators.\n The truth of "x==y" does not imply that "x!=y" is false.\n Accordingly, when defining "__eq__()", one should also define\n "__ne__()" so that the operators will behave as expected. See the\n paragraph on "__hash__()" for some important notes on creating\n *hashable* objects which support custom comparison operations and\n are usable as dictionary keys.\n\n There are no swapped-argument versions of these methods (to be used\n when the left argument does not support the operation but the right\n argument does); rather, "__lt__()" and "__gt__()" are each other\'s\n reflection, "__le__()" and "__ge__()" are each other\'s reflection,\n and "__eq__()" and "__ne__()" are their own reflection.\n\n Arguments to rich comparison methods are never coerced.\n\n To automatically generate ordering operations from a single root\n operation, see "functools.total_ordering()".\n\nobject.__cmp__(self, other)\n\n Called by comparison operations if rich comparison (see above) is\n not defined. Should return a negative integer if "self < other",\n zero if "self == other", a positive integer if "self > other". If\n no "__cmp__()", "__eq__()" or "__ne__()" operation is defined,\n class instances are compared by object identity ("address"). See\n also the description of "__hash__()" for some important notes on\n creating *hashable* objects which support custom comparison\n operations and are usable as dictionary keys. (Note: the\n restriction that exceptions are not propagated by "__cmp__()" has\n been removed since Python 1.5.)\n\nobject.__rcmp__(self, other)\n\n Changed in version 2.1: No longer supported.\n\nobject.__hash__(self)\n\n Called by built-in function "hash()" and for operations on members\n of hashed collections including "set", "frozenset", and "dict".\n "__hash__()" should return an integer. The only required property\n is that objects which compare equal have the same hash value; it is\n advised to somehow mix together (e.g. using exclusive or) the hash\n values for the components of the object that also play a part in\n comparison of objects.\n\n If a class does not define a "__cmp__()" or "__eq__()" method it\n should not define a "__hash__()" operation either; if it defines\n "__cmp__()" or "__eq__()" but not "__hash__()", its instances will\n not be usable in hashed collections. If a class defines mutable\n objects and implements a "__cmp__()" or "__eq__()" method, it\n should not implement "__hash__()", since hashable collection\n implementations require that a object\'s hash value is immutable (if\n the object\'s hash value changes, it will be in the wrong hash\n bucket).\n\n User-defined classes have "__cmp__()" and "__hash__()" methods by\n default; with them, all objects compare unequal (except with\n themselves) and "x.__hash__()" returns a result derived from\n "id(x)".\n\n Classes which inherit a "__hash__()" method from a parent class but\n change the meaning of "__cmp__()" or "__eq__()" such that the hash\n value returned is no longer appropriate (e.g. by switching to a\n value-based concept of equality instead of the default identity\n based equality) can explicitly flag themselves as being unhashable\n by setting "__hash__ = None" in the class definition. Doing so\n means that not only will instances of the class raise an\n appropriate "TypeError" when a program attempts to retrieve their\n hash value, but they will also be correctly identified as\n unhashable when checking "isinstance(obj, collections.Hashable)"\n (unlike classes which define their own "__hash__()" to explicitly\n raise "TypeError").\n\n Changed in version 2.5: "__hash__()" may now also return a long\n integer object; the 32-bit integer is then derived from the hash of\n that object.\n\n Changed in version 2.6: "__hash__" may now be set to "None" to\n explicitly flag instances of a class as unhashable.\n\nobject.__nonzero__(self)\n\n Called to implement truth value testing and the built-in operation\n "bool()"; should return "False" or "True", or their integer\n equivalents "0" or "1". When this method is not defined,\n "__len__()" is called, if it is defined, and the object is\n considered true if its result is nonzero. If a class defines\n neither "__len__()" nor "__nonzero__()", all its instances are\n considered true.\n\nobject.__unicode__(self)\n\n Called to implement "unicode()" built-in; should return a Unicode\n object. When this method is not defined, string conversion is\n attempted, and the result of string conversion is converted to\n Unicode using the system default encoding.\n\n\nCustomizing attribute access\n============================\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of "x.name") for\nclass instances.\n\nobject.__getattr__(self, name)\n\n Called when an attribute lookup has not found the attribute in the\n usual places (i.e. it is not an instance attribute nor is it found\n in the class tree for "self"). "name" is the attribute name. This\n method should return the (computed) attribute value or raise an\n "AttributeError" exception.\n\n Note that if the attribute is found through the normal mechanism,\n "__getattr__()" is not called. (This is an intentional asymmetry\n between "__getattr__()" and "__setattr__()".) This is done both for\n efficiency reasons and because otherwise "__getattr__()" would have\n no way to access other attributes of the instance. Note that at\n least for instance variables, you can fake total control by not\n inserting any values in the instance attribute dictionary (but\n instead inserting them in another object). See the\n "__getattribute__()" method below for a way to actually get total\n control in new-style classes.\n\nobject.__setattr__(self, name, value)\n\n Called when an attribute assignment is attempted. This is called\n instead of the normal mechanism (i.e. store the value in the\n instance dictionary). *name* is the attribute name, *value* is the\n value to be assigned to it.\n\n If "__setattr__()" wants to assign to an instance attribute, it\n should not simply execute "self.name = value" --- this would cause\n a recursive call to itself. Instead, it should insert the value in\n the dictionary of instance attributes, e.g., "self.__dict__[name] =\n value". For new-style classes, rather than accessing the instance\n dictionary, it should call the base class method with the same\n name, for example, "object.__setattr__(self, name, value)".\n\nobject.__delattr__(self, name)\n\n Like "__setattr__()" but for attribute deletion instead of\n assignment. This should only be implemented if "del obj.name" is\n meaningful for the object.\n\n\nMore attribute access for new-style classes\n-------------------------------------------\n\nThe following methods only apply to new-style classes.\n\nobject.__getattribute__(self, name)\n\n Called unconditionally to implement attribute accesses for\n instances of the class. If the class also defines "__getattr__()",\n the latter will not be called unless "__getattribute__()" either\n calls it explicitly or raises an "AttributeError". This method\n should return the (computed) attribute value or raise an\n "AttributeError" exception. In order to avoid infinite recursion in\n this method, its implementation should always call the base class\n method with the same name to access any attributes it needs, for\n example, "object.__getattribute__(self, name)".\n\n Note: This method may still be bypassed when looking up special\n methods as the result of implicit invocation via language syntax\n or built-in functions. See Special method lookup for new-style\n classes.\n\n\nImplementing Descriptors\n------------------------\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in an\n*owner* class (the descriptor must be in either the owner\'s class\ndictionary or in the class dictionary for one of its parents). In the\nexamples below, "the attribute" refers to the attribute whose name is\nthe key of the property in the owner class\' "__dict__".\n\nobject.__get__(self, instance, owner)\n\n Called to get the attribute of the owner class (class attribute\n access) or of an instance of that class (instance attribute\n access). *owner* is always the owner class, while *instance* is the\n instance that the attribute was accessed through, or "None" when\n the attribute is accessed through the *owner*. This method should\n return the (computed) attribute value or raise an "AttributeError"\n exception.\n\nobject.__set__(self, instance, value)\n\n Called to set the attribute on an instance *instance* of the owner\n class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n Called to delete the attribute on an instance *instance* of the\n owner class.\n\n\nInvoking Descriptors\n--------------------\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol: "__get__()", "__set__()", and\n"__delete__()". If any of those methods are defined for an object, it\nis said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, "a.x" has a\nlookup chain starting with "a.__dict__[\'x\']", then\n"type(a).__dict__[\'x\']", and continuing through the base classes of\n"type(a)" excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead. Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called. Note that descriptors are only invoked for new\nstyle objects or classes (ones that subclass "object()" or "type()").\n\nThe starting point for descriptor invocation is a binding, "a.x". How\nthe arguments are assembled depends on "a":\n\nDirect Call\n The simplest and least common call is when user code directly\n invokes a descriptor method: "x.__get__(a)".\n\nInstance Binding\n If binding to a new-style object instance, "a.x" is transformed\n into the call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n\nClass Binding\n If binding to a new-style class, "A.x" is transformed into the\n call: "A.__dict__[\'x\'].__get__(None, A)".\n\nSuper Binding\n If "a" is an instance of "super", then the binding "super(B,\n obj).m()" searches "obj.__class__.__mro__" for the base class "A"\n immediately preceding "B" and then invokes the descriptor with the\n call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined. A descriptor can define\nany combination of "__get__()", "__set__()" and "__delete__()". If it\ndoes not define "__get__()", then accessing the attribute will return\nthe descriptor object itself unless there is a value in the object\'s\ninstance dictionary. If the descriptor defines "__set__()" and/or\n"__delete__()", it is a data descriptor; if it defines neither, it is\na non-data descriptor. Normally, data descriptors define both\n"__get__()" and "__set__()", while non-data descriptors have just the\n"__get__()" method. Data descriptors with "__set__()" and "__get__()"\ndefined always override a redefinition in an instance dictionary. In\ncontrast, non-data descriptors can be overridden by instances.\n\nPython methods (including "staticmethod()" and "classmethod()") are\nimplemented as non-data descriptors. Accordingly, instances can\nredefine and override methods. This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe "property()" function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n---------\n\nBy default, instances of both old and new-style classes have a\ndictionary for attribute storage. This wastes space for objects\nhaving very few instance variables. The space consumption can become\nacute when creating large numbers of instances.\n\nThe default can be overridden by defining *__slots__* in a new-style\nclass definition. The *__slots__* declaration takes a sequence of\ninstance variables and reserves just enough space in each instance to\nhold a value for each variable. Space is saved because *__dict__* is\nnot created for each instance.\n\n__slots__\n\n This class variable can be assigned a string, iterable, or sequence\n of strings with variable names used by instances. If defined in a\n new-style class, *__slots__* reserves space for the declared\n variables and prevents the automatic creation of *__dict__* and\n *__weakref__* for each instance.\n\n New in version 2.2.\n\nNotes on using *__slots__*\n\n* When inheriting from a class without *__slots__*, the *__dict__*\n attribute of that class will always be accessible, so a *__slots__*\n definition in the subclass is meaningless.\n\n* Without a *__dict__* variable, instances cannot be assigned new\n variables not listed in the *__slots__* definition. Attempts to\n assign to an unlisted variable name raises "AttributeError". If\n dynamic assignment of new variables is desired, then add\n "\'__dict__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n Changed in version 2.3: Previously, adding "\'__dict__\'" to the\n *__slots__* declaration would not enable the assignment of new\n attributes not specifically listed in the sequence of instance\n variable names.\n\n* Without a *__weakref__* variable for each instance, classes\n defining *__slots__* do not support weak references to its\n instances. If weak reference support is needed, then add\n "\'__weakref__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n Changed in version 2.3: Previously, adding "\'__weakref__\'" to the\n *__slots__* declaration would not enable support for weak\n references.\n\n* *__slots__* are implemented at the class level by creating\n descriptors (Implementing Descriptors) for each variable name. As a\n result, class attributes cannot be used to set default values for\n instance variables defined by *__slots__*; otherwise, the class\n attribute would overwrite the descriptor assignment.\n\n* The action of a *__slots__* declaration is limited to the class\n where it is defined. As a result, subclasses will have a *__dict__*\n unless they also define *__slots__* (which must only contain names\n of any *additional* slots).\n\n* If a class defines a slot also defined in a base class, the\n instance variable defined by the base class slot is inaccessible\n (except by retrieving its descriptor directly from the base class).\n This renders the meaning of the program undefined. In the future, a\n check may be added to prevent this.\n\n* Nonempty *__slots__* does not work for classes derived from\n "variable-length" built-in types such as "long", "str" and "tuple".\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings\n may also be used; however, in the future, special meaning may be\n assigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n *__slots__*.\n\n Changed in version 2.6: Previously, *__class__* assignment raised an\n error if either new or old class had *__slots__*.\n\n\nCustomizing class creation\n==========================\n\nBy default, new-style classes are constructed using "type()". A class\ndefinition is read into a separate namespace and the value of class\nname is bound to the result of "type(name, bases, dict)".\n\nWhen the class definition is read, if *__metaclass__* is defined then\nthe callable assigned to it will be called instead of "type()". This\nallows classes or functions to be written which monitor or alter the\nclass creation process:\n\n* Modifying the class dictionary prior to the class being created.\n\n* Returning an instance of another class -- essentially performing\n the role of a factory function.\n\nThese steps will have to be performed in the metaclass\'s "__new__()"\nmethod -- "type.__new__()" can then be called from this method to\ncreate a class with different properties. This example adds a new\nelement to the class dictionary before creating the class:\n\n class metacls(type):\n def __new__(mcs, name, bases, dict):\n dict[\'foo\'] = \'metacls was here\'\n return type.__new__(mcs, name, bases, dict)\n\nYou can of course also override other class methods (or add new\nmethods); for example defining a custom "__call__()" method in the\nmetaclass allows custom behavior when the class is called, e.g. not\nalways creating a new instance.\n\n__metaclass__\n\n This variable can be any callable accepting arguments for "name",\n "bases", and "dict". Upon class creation, the callable is used\n instead of the built-in "type()".\n\n New in version 2.2.\n\nThe appropriate metaclass is determined by the following precedence\nrules:\n\n* If "dict[\'__metaclass__\']" exists, it is used.\n\n* Otherwise, if there is at least one base class, its metaclass is\n used (this looks for a *__class__* attribute first and if not found,\n uses its type).\n\n* Otherwise, if a global variable named __metaclass__ exists, it is\n used.\n\n* Otherwise, the old-style, classic metaclass (types.ClassType) is\n used.\n\nThe potential uses for metaclasses are boundless. Some ideas that have\nbeen explored including logging, interface checking, automatic\ndelegation, automatic property creation, proxies, frameworks, and\nautomatic resource locking/synchronization.\n\n\nCustomizing instance and subclass checks\n========================================\n\nNew in version 2.6.\n\nThe following methods are used to override the default behavior of the\n"isinstance()" and "issubclass()" built-in functions.\n\nIn particular, the metaclass "abc.ABCMeta" implements these methods in\norder to allow the addition of Abstract Base Classes (ABCs) as\n"virtual base classes" to any class or type (including built-in\ntypes), including other ABCs.\n\nclass.__instancecheck__(self, instance)\n\n Return true if *instance* should be considered a (direct or\n indirect) instance of *class*. If defined, called to implement\n "isinstance(instance, class)".\n\nclass.__subclasscheck__(self, subclass)\n\n Return true if *subclass* should be considered a (direct or\n indirect) subclass of *class*. If defined, called to implement\n "issubclass(subclass, class)".\n\nNote that these methods are looked up on the type (metaclass) of a\nclass. They cannot be defined as class methods in the actual class.\nThis is consistent with the lookup of special methods that are called\non instances, only in this case the instance is itself a class.\n\nSee also:\n\n **PEP 3119** - Introducing Abstract Base Classes\n Includes the specification for customizing "isinstance()" and\n "issubclass()" behavior through "__instancecheck__()" and\n "__subclasscheck__()", with motivation for this functionality in\n the context of adding Abstract Base Classes (see the "abc"\n module) to the language.\n\n\nEmulating callable objects\n==========================\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, "x(arg1, arg2, ...)" is a shorthand for\n "x.__call__(arg1, arg2, ...)".\n\n\nEmulating container types\n=========================\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which "0 <= k < N" where\n*N* is the length of the sequence, or slice objects, which define a\nrange of items. (For backwards compatibility, the method\n"__getslice__()" (see below) can also be defined to handle simple, but\nnot extended slices.) It is also recommended that mappings provide the\nmethods "keys()", "values()", "items()", "has_key()", "get()",\n"clear()", "setdefault()", "iterkeys()", "itervalues()",\n"iteritems()", "pop()", "popitem()", "copy()", and "update()" behaving\nsimilar to those for Python\'s standard dictionary objects. The\n"UserDict" module provides a "DictMixin" class to help create those\nmethods from a base set of "__getitem__()", "__setitem__()",\n"__delitem__()", and "keys()". Mutable sequences should provide\nmethods "append()", "count()", "index()", "extend()", "insert()",\n"pop()", "remove()", "reverse()" and "sort()", like Python standard\nlist objects. Finally, sequence types should implement addition\n(meaning concatenation) and multiplication (meaning repetition) by\ndefining the methods "__add__()", "__radd__()", "__iadd__()",\n"__mul__()", "__rmul__()" and "__imul__()" described below; they\nshould not define "__coerce__()" or other numerical operators. It is\nrecommended that both mappings and sequences implement the\n"__contains__()" method to allow efficient use of the "in" operator;\nfor mappings, "in" should be equivalent of "has_key()"; for sequences,\nit should search through the values. It is further recommended that\nboth mappings and sequences implement the "__iter__()" method to allow\nefficient iteration through the container; for mappings, "__iter__()"\nshould be the same as "iterkeys()"; for sequences, it should iterate\nthrough the values.\n\nobject.__len__(self)\n\n Called to implement the built-in function "len()". Should return\n the length of the object, an integer ">=" 0. Also, an object that\n doesn\'t define a "__nonzero__()" method and whose "__len__()"\n method returns zero is considered to be false in a Boolean context.\n\nobject.__getitem__(self, key)\n\n Called to implement evaluation of "self[key]". For sequence types,\n the accepted keys should be integers and slice objects. Note that\n the special interpretation of negative indexes (if the class wishes\n to emulate a sequence type) is up to the "__getitem__()" method. If\n *key* is of an inappropriate type, "TypeError" may be raised; if of\n a value outside the set of indexes for the sequence (after any\n special interpretation of negative values), "IndexError" should be\n raised. For mapping types, if *key* is missing (not in the\n container), "KeyError" should be raised.\n\n Note: "for" loops expect that an "IndexError" will be raised for\n illegal indexes to allow proper detection of the end of the\n sequence.\n\nobject.__missing__(self, key)\n\n Called by "dict"."__getitem__()" to implement "self[key]" for dict\n subclasses when key is not in the dictionary.\n\nobject.__setitem__(self, key, value)\n\n Called to implement assignment to "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support changes to the values for keys, or if new keys\n can be added, or for sequences if elements can be replaced. The\n same exceptions should be raised for improper *key* values as for\n the "__getitem__()" method.\n\nobject.__delitem__(self, key)\n\n Called to implement deletion of "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support removal of keys, or for sequences if elements\n can be removed from the sequence. The same exceptions should be\n raised for improper *key* values as for the "__getitem__()" method.\n\nobject.__iter__(self)\n\n This method is called when an iterator is required for a container.\n This method should return a new iterator object that can iterate\n over all the objects in the container. For mappings, it should\n iterate over the keys of the container, and should also be made\n available as the method "iterkeys()".\n\n Iterator objects also need to implement this method; they are\n required to return themselves. For more information on iterator\n objects, see Iterator Types.\n\nobject.__reversed__(self)\n\n Called (if present) by the "reversed()" built-in to implement\n reverse iteration. It should return a new iterator object that\n iterates over all the objects in the container in reverse order.\n\n If the "__reversed__()" method is not provided, the "reversed()"\n built-in will fall back to using the sequence protocol ("__len__()"\n and "__getitem__()"). Objects that support the sequence protocol\n should only provide "__reversed__()" if they can provide an\n implementation that is more efficient than the one provided by\n "reversed()".\n\n New in version 2.6.\n\nThe membership test operators ("in" and "not in") are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n Called to implement membership test operators. Should return true\n if *item* is in *self*, false otherwise. For mapping objects, this\n should consider the keys of the mapping rather than the values or\n the key-item pairs.\n\n For objects that don\'t define "__contains__()", the membership test\n first tries iteration via "__iter__()", then the old sequence\n iteration protocol via "__getitem__()", see this section in the\n language reference.\n\n\nAdditional methods for emulation of sequence types\n==================================================\n\nThe following optional methods can be defined to further emulate\nsequence objects. Immutable sequences methods should at most only\ndefine "__getslice__()"; mutable sequences might define all three\nmethods.\n\nobject.__getslice__(self, i, j)\n\n Deprecated since version 2.0: Support slice objects as parameters\n to the "__getitem__()" method. (However, built-in types in CPython\n currently still implement "__getslice__()". Therefore, you have to\n override it in derived classes when implementing slicing.)\n\n Called to implement evaluation of "self[i:j]". The returned object\n should be of the same type as *self*. Note that missing *i* or *j*\n in the slice expression are replaced by zero or "sys.maxsize",\n respectively. If negative indexes are used in the slice, the\n length of the sequence is added to that index. If the instance does\n not implement the "__len__()" method, an "AttributeError" is\n raised. No guarantee is made that indexes adjusted this way are not\n still negative. Indexes which are greater than the length of the\n sequence are not modified. If no "__getslice__()" is found, a slice\n object is created instead, and passed to "__getitem__()" instead.\n\nobject.__setslice__(self, i, j, sequence)\n\n Called to implement assignment to "self[i:j]". Same notes for *i*\n and *j* as for "__getslice__()".\n\n This method is deprecated. If no "__setslice__()" is found, or for\n extended slicing of the form "self[i:j:k]", a slice object is\n created, and passed to "__setitem__()", instead of "__setslice__()"\n being called.\n\nobject.__delslice__(self, i, j)\n\n Called to implement deletion of "self[i:j]". Same notes for *i* and\n *j* as for "__getslice__()". This method is deprecated. If no\n "__delslice__()" is found, or for extended slicing of the form\n "self[i:j:k]", a slice object is created, and passed to\n "__delitem__()", instead of "__delslice__()" being called.\n\nNotice that these methods are only invoked when a single slice with a\nsingle colon is used, and the slice method is available. For slice\noperations involving extended slice notation, or in absence of the\nslice methods, "__getitem__()", "__setitem__()" or "__delitem__()" is\ncalled with a slice object as argument.\n\nThe following example demonstrate how to make your program or module\ncompatible with earlier versions of Python (assuming that methods\n"__getitem__()", "__setitem__()" and "__delitem__()" support slice\nobjects as arguments):\n\n class MyClass:\n ...\n def __getitem__(self, index):\n ...\n def __setitem__(self, index, value):\n ...\n def __delitem__(self, index):\n ...\n\n if sys.version_info < (2, 0):\n # They won\'t be defined if version is at least 2.0 final\n\n def __getslice__(self, i, j):\n return self[max(0, i):max(0, j):]\n def __setslice__(self, i, j, seq):\n self[max(0, i):max(0, j):] = seq\n def __delslice__(self, i, j):\n del self[max(0, i):max(0, j):]\n ...\n\nNote the calls to "max()"; these are necessary because of the handling\nof negative indices before the "__*slice__()" methods are called.\nWhen negative indexes are used, the "__*item__()" methods receive them\nas provided, but the "__*slice__()" methods get a "cooked" form of the\nindex values. For each negative index value, the length of the\nsequence is added to the index before calling the method (which may\nstill result in a negative index); this is the customary handling of\nnegative indexes by the built-in sequence types, and the "__*item__()"\nmethods are expected to do this as well. However, since they should\nalready be doing that, negative indexes cannot be passed in; they must\nbe constrained to the bounds of the sequence before being passed to\nthe "__*item__()" methods. Calling "max(0, i)" conveniently returns\nthe proper value.\n\n\nEmulating numeric types\n=======================\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "//", "%", "divmod()", "pow()", "**",\n "<<", ">>", "&", "^", "|"). For instance, to evaluate the\n expression "x + y", where *x* is an instance of a class that has an\n "__add__()" method, "x.__add__(y)" is called. The "__divmod__()"\n method should be the equivalent to using "__floordiv__()" and\n "__mod__()"; it should not be related to "__truediv__()" (described\n below). Note that "__pow__()" should be defined to accept an\n optional third argument if the ternary version of the built-in\n "pow()" function is to be supported.\n\n If one of those methods does not support the operation with the\n supplied arguments, it should return "NotImplemented".\n\nobject.__div__(self, other)\nobject.__truediv__(self, other)\n\n The division operator ("/") is implemented by these methods. The\n "__truediv__()" method is used when "__future__.division" is in\n effect, otherwise "__div__()" is used. If only one of these two\n methods is defined, the object will not support division in the\n alternate context; "TypeError" will be raised instead.\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rdiv__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "/", "%", "divmod()", "pow()", "**",\n "<<", ">>", "&", "^", "|") with reflected (swapped) operands.\n These functions are only called if the left operand does not\n support the corresponding operation and the operands are of\n different types. [2] For instance, to evaluate the expression "x -\n y", where *y* is an instance of a class that has an "__rsub__()"\n method, "y.__rsub__(x)" is called if "x.__sub__(y)" returns\n *NotImplemented*.\n\n Note that ternary "pow()" will not try calling "__rpow__()" (the\n coercion rules would become too complicated).\n\n Note: If the right operand\'s type is a subclass of the left\n operand\'s type and that subclass provides the reflected method\n for the operation, this method will be called before the left\n operand\'s non-reflected method. This behavior allows subclasses\n to override their ancestors\' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__idiv__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n These methods are called to implement the augmented arithmetic\n assignments ("+=", "-=", "*=", "/=", "//=", "%=", "**=", "<<=",\n ">>=", "&=", "^=", "|="). These methods should attempt to do the\n operation in-place (modifying *self*) and return the result (which\n could be, but does not have to be, *self*). If a specific method\n is not defined, the augmented assignment falls back to the normal\n methods. For instance, to execute the statement "x += y", where\n *x* is an instance of a class that has an "__iadd__()" method,\n "x.__iadd__(y)" is called. If *x* is an instance of a class that\n does not define a "__iadd__()" method, "x.__add__(y)" and\n "y.__radd__(x)" are considered, as with the evaluation of "x + y".\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n Called to implement the unary arithmetic operations ("-", "+",\n "abs()" and "~").\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__long__(self)\nobject.__float__(self)\n\n Called to implement the built-in functions "complex()", "int()",\n "long()", and "float()". Should return a value of the appropriate\n type.\n\nobject.__oct__(self)\nobject.__hex__(self)\n\n Called to implement the built-in functions "oct()" and "hex()".\n Should return a string value.\n\nobject.__index__(self)\n\n Called to implement "operator.index()". Also called whenever\n Python needs an integer object (such as in slicing). Must return\n an integer (int or long).\n\n New in version 2.5.\n\nobject.__coerce__(self, other)\n\n Called to implement "mixed-mode" numeric arithmetic. Should either\n return a 2-tuple containing *self* and *other* converted to a\n common numeric type, or "None" if conversion is impossible. When\n the common type would be the type of "other", it is sufficient to\n return "None", since the interpreter will also ask the other object\n to attempt a coercion (but sometimes, if the implementation of the\n other type cannot be changed, it is useful to do the conversion to\n the other type here). A return value of "NotImplemented" is\n equivalent to returning "None".\n\n\nCoercion rules\n==============\n\nThis section used to document the rules for coercion. As the language\nhas evolved, the coercion rules have become hard to document\nprecisely; documenting what one version of one particular\nimplementation does is undesirable. Instead, here are some informal\nguidelines regarding coercion. In Python 3, coercion will not be\nsupported.\n\n* If the left operand of a % operator is a string or Unicode object,\n no coercion takes place and the string formatting operation is\n invoked instead.\n\n* It is no longer recommended to define a coercion operation. Mixed-\n mode operations on types that don\'t define coercion pass the\n original arguments to the operation.\n\n* New-style classes (those derived from "object") never invoke the\n "__coerce__()" method in response to a binary operator; the only\n time "__coerce__()" is invoked is when the built-in function\n "coerce()" is called.\n\n* For most intents and purposes, an operator that returns\n "NotImplemented" is treated the same as one that is not implemented\n at all.\n\n* Below, "__op__()" and "__rop__()" are used to signify the generic\n method names corresponding to an operator; "__iop__()" is used for\n the corresponding in-place operator. For example, for the operator\n \'"+"\', "__add__()" and "__radd__()" are used for the left and right\n variant of the binary operator, and "__iadd__()" for the in-place\n variant.\n\n* For objects *x* and *y*, first "x.__op__(y)" is tried. If this is\n not implemented or returns "NotImplemented", "y.__rop__(x)" is\n tried. If this is also not implemented or returns "NotImplemented",\n a "TypeError" exception is raised. But see the following exception:\n\n* Exception to the previous item: if the left operand is an instance\n of a built-in type or a new-style class, and the right operand is an\n instance of a proper subclass of that type or class and overrides\n the base\'s "__rop__()" method, the right operand\'s "__rop__()"\n method is tried *before* the left operand\'s "__op__()" method.\n\n This is done so that a subclass can completely override binary\n operators. Otherwise, the left operand\'s "__op__()" method would\n always accept the right operand: when an instance of a given class\n is expected, an instance of a subclass of that class is always\n acceptable.\n\n* When either operand type defines a coercion, this coercion is\n called before that type\'s "__op__()" or "__rop__()" method is\n called, but no sooner. If the coercion returns an object of a\n different type for the operand whose coercion is invoked, part of\n the process is redone using the new object.\n\n* When an in-place operator (like \'"+="\') is used, if the left\n operand implements "__iop__()", it is invoked without any coercion.\n When the operation falls back to "__op__()" and/or "__rop__()", the\n normal coercion rules apply.\n\n* In "x + y", if *x* is a sequence that implements sequence\n concatenation, sequence concatenation is invoked.\n\n* In "x * y", if one operand is a sequence that implements sequence\n repetition, and the other is an integer ("int" or "long"), sequence\n repetition is invoked.\n\n* Rich comparisons (implemented by methods "__eq__()" and so on)\n never use coercion. Three-way comparison (implemented by\n "__cmp__()") does use coercion under the same conditions as other\n binary operations use it.\n\n* In the current implementation, the built-in numeric types "int",\n "long", "float", and "complex" do not use coercion. All these types\n implement a "__coerce__()" method, for use by the built-in\n "coerce()" function.\n\n Changed in version 2.7: The complex type no longer makes implicit\n calls to the "__coerce__()" method for mixed-type binary arithmetic\n operations.\n\n\nWith Statement Context Managers\n===============================\n\nNew in version 2.5.\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a "with" statement. The context manager\nhandles the entry into, and the exit from, the desired runtime context\nfor the execution of the block of code. Context managers are normally\ninvoked using the "with" statement (described in section The with\nstatement), but can also be used by directly invoking their methods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see Context Manager Types.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The "with"\n statement will bind this method\'s return value to the target(s)\n specified in the "as" clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be "None".\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that "__exit__()" methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python "with"\n statement.\n\n\nSpecial method lookup for old-style classes\n===========================================\n\nFor old-style classes, special methods are always looked up in exactly\nthe same way as any other method or attribute. This is the case\nregardless of whether the method is being looked up explicitly as in\n"x.__getitem__(i)" or implicitly as in "x[i]".\n\nThis behaviour means that special methods may exhibit different\nbehaviour for different instances of a single old-style class if the\nappropriate special attributes are set differently:\n\n >>> class C:\n ... pass\n ...\n >>> c1 = C()\n >>> c2 = C()\n >>> c1.__len__ = lambda: 5\n >>> c2.__len__ = lambda: 9\n >>> len(c1)\n 5\n >>> len(c2)\n 9\n\n\nSpecial method lookup for new-style classes\n===========================================\n\nFor new-style classes, implicit invocations of special methods are\nonly guaranteed to work correctly if defined on an object\'s type, not\nin the object\'s instance dictionary. That behaviour is the reason why\nthe following code raises an exception (unlike the equivalent example\nwith old-style classes):\n\n >>> class C(object):\n ... pass\n ...\n >>> c = C()\n >>> c.__len__ = lambda: 5\n >>> len(c)\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: object of type \'C\' has no len()\n\nThe rationale behind this behaviour lies with a number of special\nmethods such as "__hash__()" and "__repr__()" that are implemented by\nall objects, including type objects. If the implicit lookup of these\nmethods used the conventional lookup process, they would fail when\ninvoked on the type object itself:\n\n >>> 1 .__hash__() == hash(1)\n True\n >>> int.__hash__() == hash(int)\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: descriptor \'__hash__\' of \'int\' object needs an argument\n\nIncorrectly attempting to invoke an unbound method of a class in this\nway is sometimes referred to as \'metaclass confusion\', and is avoided\nby bypassing the instance when looking up special methods:\n\n >>> type(1).__hash__(1) == hash(1)\n True\n >>> type(int).__hash__(int) == hash(int)\n True\n\nIn addition to bypassing any instance attributes in the interest of\ncorrectness, implicit special method lookup generally also bypasses\nthe "__getattribute__()" method even of the object\'s metaclass:\n\n >>> class Meta(type):\n ... def __getattribute__(*args):\n ... print "Metaclass getattribute invoked"\n ... return type.__getattribute__(*args)\n ...\n >>> class C(object):\n ... __metaclass__ = Meta\n ... def __len__(self):\n ... return 10\n ... def __getattribute__(*args):\n ... print "Class getattribute invoked"\n ... return object.__getattribute__(*args)\n ...\n >>> c = C()\n >>> c.__len__() # Explicit lookup via instance\n Class getattribute invoked\n 10\n >>> type(c).__len__(c) # Explicit lookup via type\n Metaclass getattribute invoked\n 10\n >>> len(c) # Implicit lookup\n 10\n\nBypassing the "__getattribute__()" machinery in this fashion provides\nsignificant scope for speed optimisations within the interpreter, at\nthe cost of some flexibility in the handling of special methods (the\nspecial method *must* be set on the class object itself in order to be\nconsistently invoked by the interpreter).\n\n-[ Footnotes ]-\n\n[1] It *is* possible in some cases to change an object\'s type,\n under certain controlled conditions. It generally isn\'t a good\n idea though, since it can lead to some very strange behaviour if\n it is handled incorrectly.\n\n[2] For operands of the same type, it is assumed that if the non-\n reflected method (such as "__add__()") fails the operation is not\n supported, which is why the reflected method is not called.\n', - 'string-methods': u'\nString Methods\n**************\n\nBelow are listed the string methods which both 8-bit strings and\nUnicode objects support. Some of them are also available on\n"bytearray" objects.\n\nIn addition, Python\'s strings support the sequence type methods\ndescribed in the Sequence Types --- str, unicode, list, tuple,\nbytearray, buffer, xrange section. To output formatted strings use\ntemplate strings or the "%" operator described in the String\nFormatting Operations section. Also, see the "re" module for string\nfunctions based on regular expressions.\n\nstr.capitalize()\n\n Return a copy of the string with its first character capitalized\n and the rest lowercased.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.center(width[, fillchar])\n\n Return centered in a string of length *width*. Padding is done\n using the specified *fillchar* (default is a space).\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.count(sub[, start[, end]])\n\n Return the number of non-overlapping occurrences of substring *sub*\n in the range [*start*, *end*]. Optional arguments *start* and\n *end* are interpreted as in slice notation.\n\nstr.decode([encoding[, errors]])\n\n Decodes the string using the codec registered for *encoding*.\n *encoding* defaults to the default string encoding. *errors* may\n be given to set a different error handling scheme. The default is\n "\'strict\'", meaning that encoding errors raise "UnicodeError".\n Other possible values are "\'ignore\'", "\'replace\'" and any other\n name registered via "codecs.register_error()", see section Codec\n Base Classes.\n\n New in version 2.2.\n\n Changed in version 2.3: Support for other error handling schemes\n added.\n\n Changed in version 2.7: Support for keyword arguments added.\n\nstr.encode([encoding[, errors]])\n\n Return an encoded version of the string. Default encoding is the\n current default string encoding. *errors* may be given to set a\n different error handling scheme. The default for *errors* is\n "\'strict\'", meaning that encoding errors raise a "UnicodeError".\n Other possible values are "\'ignore\'", "\'replace\'",\n "\'xmlcharrefreplace\'", "\'backslashreplace\'" and any other name\n registered via "codecs.register_error()", see section Codec Base\n Classes. For a list of possible encodings, see section Standard\n Encodings.\n\n New in version 2.0.\n\n Changed in version 2.3: Support for "\'xmlcharrefreplace\'" and\n "\'backslashreplace\'" and other error handling schemes added.\n\n Changed in version 2.7: Support for keyword arguments added.\n\nstr.endswith(suffix[, start[, end]])\n\n Return "True" if the string ends with the specified *suffix*,\n otherwise return "False". *suffix* can also be a tuple of suffixes\n to look for. With optional *start*, test beginning at that\n position. With optional *end*, stop comparing at that position.\n\n Changed in version 2.5: Accept tuples as *suffix*.\n\nstr.expandtabs([tabsize])\n\n Return a copy of the string where all tab characters are replaced\n by one or more spaces, depending on the current column and the\n given tab size. Tab positions occur every *tabsize* characters\n (default is 8, giving tab positions at columns 0, 8, 16 and so on).\n To expand the string, the current column is set to zero and the\n string is examined character by character. If the character is a\n tab ("\\t"), one or more space characters are inserted in the result\n until the current column is equal to the next tab position. (The\n tab character itself is not copied.) If the character is a newline\n ("\\n") or return ("\\r"), it is copied and the current column is\n reset to zero. Any other character is copied unchanged and the\n current column is incremented by one regardless of how the\n character is represented when printed.\n\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs()\n \'01 012 0123 01234\'\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs(4)\n \'01 012 0123 01234\'\n\nstr.find(sub[, start[, end]])\n\n Return the lowest index in the string where substring *sub* is\n found within the slice "s[start:end]". Optional arguments *start*\n and *end* are interpreted as in slice notation. Return "-1" if\n *sub* is not found.\n\n Note: The "find()" method should be used only if you need to know\n the position of *sub*. To check if *sub* is a substring or not,\n use the "in" operator:\n\n >>> \'Py\' in \'Python\'\n True\n\nstr.format(*args, **kwargs)\n\n Perform a string formatting operation. The string on which this\n method is called can contain literal text or replacement fields\n delimited by braces "{}". Each replacement field contains either\n the numeric index of a positional argument, or the name of a\n keyword argument. Returns a copy of the string where each\n replacement field is replaced with the string value of the\n corresponding argument.\n\n >>> "The sum of 1 + 2 is {0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\n See Format String Syntax for a description of the various\n formatting options that can be specified in format strings.\n\n This method of string formatting is the new standard in Python 3,\n and should be preferred to the "%" formatting described in String\n Formatting Operations in new code.\n\n New in version 2.6.\n\nstr.index(sub[, start[, end]])\n\n Like "find()", but raise "ValueError" when the substring is not\n found.\n\nstr.isalnum()\n\n Return true if all characters in the string are alphanumeric and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isalpha()\n\n Return true if all characters in the string are alphabetic and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isdigit()\n\n Return true if all characters in the string are digits and there is\n at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.islower()\n\n Return true if all cased characters [4] in the string are lowercase\n and there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isspace()\n\n Return true if there are only whitespace characters in the string\n and there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.istitle()\n\n Return true if the string is a titlecased string and there is at\n least one character, for example uppercase characters may only\n follow uncased characters and lowercase characters only cased ones.\n Return false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isupper()\n\n Return true if all cased characters [4] in the string are uppercase\n and there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.join(iterable)\n\n Return a string which is the concatenation of the strings in the\n *iterable* *iterable*. The separator between elements is the\n string providing this method.\n\nstr.ljust(width[, fillchar])\n\n Return the string left justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.lower()\n\n Return a copy of the string with all the cased characters [4]\n converted to lowercase.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.lstrip([chars])\n\n Return a copy of the string with leading characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a prefix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.lstrip()\n \'spacious \'\n >>> \'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.partition(sep)\n\n Split the string at the first occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing the string itself, followed by\n two empty strings.\n\n New in version 2.5.\n\nstr.replace(old, new[, count])\n\n Return a copy of the string with all occurrences of substring *old*\n replaced by *new*. If the optional argument *count* is given, only\n the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n Return the highest index in the string where substring *sub* is\n found, such that *sub* is contained within "s[start:end]".\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return "-1" on failure.\n\nstr.rindex(sub[, start[, end]])\n\n Like "rfind()" but raises "ValueError" when the substring *sub* is\n not found.\n\nstr.rjust(width[, fillchar])\n\n Return the string right justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.rpartition(sep)\n\n Split the string at the last occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing two empty strings, followed by\n the string itself.\n\n New in version 2.5.\n\nstr.rsplit([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n are done, the *rightmost* ones. If *sep* is not specified or\n "None", any whitespace string is a separator. Except for splitting\n from the right, "rsplit()" behaves like "split()" which is\n described in detail below.\n\n New in version 2.4.\n\nstr.rstrip([chars])\n\n Return a copy of the string with trailing characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a suffix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.rstrip()\n \' spacious\'\n >>> \'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.split([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit*\n splits are done (thus, the list will have at most "maxsplit+1"\n elements). If *maxsplit* is not specified or "-1", then there is\n no limit on the number of splits (all possible splits are made).\n\n If *sep* is given, consecutive delimiters are not grouped together\n and are deemed to delimit empty strings (for example,\n "\'1,,2\'.split(\',\')" returns "[\'1\', \'\', \'2\']"). The *sep* argument\n may consist of multiple characters (for example,\n "\'1<>2<>3\'.split(\'<>\')" returns "[\'1\', \'2\', \'3\']"). Splitting an\n empty string with a specified separator returns "[\'\']".\n\n If *sep* is not specified or is "None", a different splitting\n algorithm is applied: runs of consecutive whitespace are regarded\n as a single separator, and the result will contain no empty strings\n at the start or end if the string has leading or trailing\n whitespace. Consequently, splitting an empty string or a string\n consisting of just whitespace with a "None" separator returns "[]".\n\n For example, "\' 1 2 3 \'.split()" returns "[\'1\', \'2\', \'3\']", and\n "\' 1 2 3 \'.split(None, 1)" returns "[\'1\', \'2 3 \']".\n\nstr.splitlines([keepends])\n\n Return a list of the lines in the string, breaking at line\n boundaries. This method uses the *universal newlines* approach to\n splitting lines. Line breaks are not included in the resulting list\n unless *keepends* is given and true.\n\n For example, "\'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines()" returns "[\'ab\n c\', \'\', \'de fg\', \'kl\']", while the same call with\n "splitlines(True)" returns "[\'ab c\\n\', \'\\n\', \'de fg\\r\', \'kl\\r\\n\']".\n\n Unlike "split()" when a delimiter string *sep* is given, this\n method returns an empty list for the empty string, and a terminal\n line break does not result in an extra line.\n\nstr.startswith(prefix[, start[, end]])\n\n Return "True" if string starts with the *prefix*, otherwise return\n "False". *prefix* can also be a tuple of prefixes to look for.\n With optional *start*, test string beginning at that position.\n With optional *end*, stop comparing string at that position.\n\n Changed in version 2.5: Accept tuples as *prefix*.\n\nstr.strip([chars])\n\n Return a copy of the string with the leading and trailing\n characters removed. The *chars* argument is a string specifying the\n set of characters to be removed. If omitted or "None", the *chars*\n argument defaults to removing whitespace. The *chars* argument is\n not a prefix or suffix; rather, all combinations of its values are\n stripped:\n\n >>> \' spacious \'.strip()\n \'spacious\'\n >>> \'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.swapcase()\n\n Return a copy of the string with uppercase characters converted to\n lowercase and vice versa.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.title()\n\n Return a titlecased version of the string where words start with an\n uppercase character and the remaining characters are lowercase.\n\n The algorithm uses a simple language-independent definition of a\n word as groups of consecutive letters. The definition works in\n many contexts but it means that apostrophes in contractions and\n possessives form word boundaries, which may not be the desired\n result:\n\n >>> "they\'re bill\'s friends from the UK".title()\n "They\'Re Bill\'S Friends From The Uk"\n\n A workaround for apostrophes can be constructed using regular\n expressions:\n\n >>> import re\n >>> def titlecase(s):\n ... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n ... lambda mo: mo.group(0)[0].upper() +\n ... mo.group(0)[1:].lower(),\n ... s)\n ...\n >>> titlecase("they\'re bill\'s friends.")\n "They\'re Bill\'s Friends."\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.translate(table[, deletechars])\n\n Return a copy of the string where all characters occurring in the\n optional argument *deletechars* are removed, and the remaining\n characters have been mapped through the given translation table,\n which must be a string of length 256.\n\n You can use the "maketrans()" helper function in the "string"\n module to create a translation table. For string objects, set the\n *table* argument to "None" for translations that only delete\n characters:\n\n >>> \'read this short text\'.translate(None, \'aeiou\')\n \'rd ths shrt txt\'\n\n New in version 2.6: Support for a "None" *table* argument.\n\n For Unicode objects, the "translate()" method does not accept the\n optional *deletechars* argument. Instead, it returns a copy of the\n *s* where all characters have been mapped through the given\n translation table which must be a mapping of Unicode ordinals to\n Unicode ordinals, Unicode strings or "None". Unmapped characters\n are left untouched. Characters mapped to "None" are deleted. Note,\n a more flexible approach is to create a custom character mapping\n codec using the "codecs" module (see "encodings.cp1251" for an\n example).\n\nstr.upper()\n\n Return a copy of the string with all the cased characters [4]\n converted to uppercase. Note that "str.upper().isupper()" might be\n "False" if "s" contains uncased characters or if the Unicode\n category of the resulting character(s) is not "Lu" (Letter,\n uppercase), but e.g. "Lt" (Letter, titlecase).\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.zfill(width)\n\n Return the numeric string left filled with zeros in a string of\n length *width*. A sign prefix is handled correctly. The original\n string is returned if *width* is less than or equal to "len(s)".\n\n New in version 2.2.2.\n\nThe following methods are present only on unicode objects:\n\nunicode.isnumeric()\n\n Return "True" if there are only numeric characters in S, "False"\n otherwise. Numeric characters include digit characters, and all\n characters that have the Unicode numeric value property, e.g.\n U+2155, VULGAR FRACTION ONE FIFTH.\n\nunicode.isdecimal()\n\n Return "True" if there are only decimal characters in S, "False"\n otherwise. Decimal characters include digit characters, and all\n characters that can be used to form decimal-radix numbers, e.g.\n U+0660, ARABIC-INDIC DIGIT ZERO.\n', - 'strings': u'\nString literals\n***************\n\nString literals are described by the following lexical definitions:\n\n stringliteral ::= [stringprefix](shortstring | longstring)\n stringprefix ::= "r" | "u" | "ur" | "R" | "U" | "UR" | "Ur" | "uR"\n | "b" | "B" | "br" | "Br" | "bR" | "BR"\n shortstring ::= "\'" shortstringitem* "\'" | \'"\' shortstringitem* \'"\'\n longstring ::= "\'\'\'" longstringitem* "\'\'\'"\n | \'"""\' longstringitem* \'"""\'\n shortstringitem ::= shortstringchar | escapeseq\n longstringitem ::= longstringchar | escapeseq\n shortstringchar ::= \n longstringchar ::= \n escapeseq ::= "\\" \n\nOne syntactic restriction not indicated by these productions is that\nwhitespace is not allowed between the "stringprefix" and the rest of\nthe string literal. The source character set is defined by the\nencoding declaration; it is ASCII if no encoding declaration is given\nin the source file; see section Encoding declarations.\n\nIn plain English: String literals can be enclosed in matching single\nquotes ("\'") or double quotes ("""). They can also be enclosed in\nmatching groups of three single or double quotes (these are generally\nreferred to as *triple-quoted strings*). The backslash ("\\")\ncharacter is used to escape characters that otherwise have a special\nmeaning, such as newline, backslash itself, or the quote character.\nString literals may optionally be prefixed with a letter "\'r\'" or\n"\'R\'"; such strings are called *raw strings* and use different rules\nfor interpreting backslash escape sequences. A prefix of "\'u\'" or\n"\'U\'" makes the string a Unicode string. Unicode strings use the\nUnicode character set as defined by the Unicode Consortium and ISO\n10646. Some additional escape sequences, described below, are\navailable in Unicode strings. A prefix of "\'b\'" or "\'B\'" is ignored in\nPython 2; it indicates that the literal should become a bytes literal\nin Python 3 (e.g. when code is automatically converted with 2to3). A\n"\'u\'" or "\'b\'" prefix may be followed by an "\'r\'" prefix.\n\nIn triple-quoted strings, unescaped newlines and quotes are allowed\n(and are retained), except that three unescaped quotes in a row\nterminate the string. (A "quote" is the character used to open the\nstring, i.e. either "\'" or """.)\n\nUnless an "\'r\'" or "\'R\'" prefix is present, escape sequences in\nstrings are interpreted according to rules similar to those used by\nStandard C. The recognized escape sequences are:\n\n+-------------------+-----------------------------------+---------+\n| Escape Sequence | Meaning | Notes |\n+===================+===================================+=========+\n| "\\newline" | Ignored | |\n+-------------------+-----------------------------------+---------+\n| "\\\\" | Backslash ("\\") | |\n+-------------------+-----------------------------------+---------+\n| "\\\'" | Single quote ("\'") | |\n+-------------------+-----------------------------------+---------+\n| "\\"" | Double quote (""") | |\n+-------------------+-----------------------------------+---------+\n| "\\a" | ASCII Bell (BEL) | |\n+-------------------+-----------------------------------+---------+\n| "\\b" | ASCII Backspace (BS) | |\n+-------------------+-----------------------------------+---------+\n| "\\f" | ASCII Formfeed (FF) | |\n+-------------------+-----------------------------------+---------+\n| "\\n" | ASCII Linefeed (LF) | |\n+-------------------+-----------------------------------+---------+\n| "\\N{name}" | Character named *name* in the | |\n| | Unicode database (Unicode only) | |\n+-------------------+-----------------------------------+---------+\n| "\\r" | ASCII Carriage Return (CR) | |\n+-------------------+-----------------------------------+---------+\n| "\\t" | ASCII Horizontal Tab (TAB) | |\n+-------------------+-----------------------------------+---------+\n| "\\uxxxx" | Character with 16-bit hex value | (1) |\n| | *xxxx* (Unicode only) | |\n+-------------------+-----------------------------------+---------+\n| "\\Uxxxxxxxx" | Character with 32-bit hex value | (2) |\n| | *xxxxxxxx* (Unicode only) | |\n+-------------------+-----------------------------------+---------+\n| "\\v" | ASCII Vertical Tab (VT) | |\n+-------------------+-----------------------------------+---------+\n| "\\ooo" | Character with octal value *ooo* | (3,5) |\n+-------------------+-----------------------------------+---------+\n| "\\xhh" | Character with hex value *hh* | (4,5) |\n+-------------------+-----------------------------------+---------+\n\nNotes:\n\n1. Individual code units which form parts of a surrogate pair can\n be encoded using this escape sequence.\n\n2. Any Unicode character can be encoded this way, but characters\n outside the Basic Multilingual Plane (BMP) will be encoded using a\n surrogate pair if Python is compiled to use 16-bit code units (the\n default).\n\n3. As in Standard C, up to three octal digits are accepted.\n\n4. Unlike in Standard C, exactly two hex digits are required.\n\n5. In a string literal, hexadecimal and octal escapes denote the\n byte with the given value; it is not necessary that the byte\n encodes a character in the source character set. In a Unicode\n literal, these escapes denote a Unicode character with the given\n value.\n\nUnlike Standard C, all unrecognized escape sequences are left in the\nstring unchanged, i.e., *the backslash is left in the string*. (This\nbehavior is useful when debugging: if an escape sequence is mistyped,\nthe resulting output is more easily recognized as broken.) It is also\nimportant to note that the escape sequences marked as "(Unicode only)"\nin the table above fall into the category of unrecognized escapes for\nnon-Unicode string literals.\n\nWhen an "\'r\'" or "\'R\'" prefix is present, a character following a\nbackslash is included in the string without change, and *all\nbackslashes are left in the string*. For example, the string literal\n"r"\\n"" consists of two characters: a backslash and a lowercase "\'n\'".\nString quotes can be escaped with a backslash, but the backslash\nremains in the string; for example, "r"\\""" is a valid string literal\nconsisting of two characters: a backslash and a double quote; "r"\\""\nis not a valid string literal (even a raw string cannot end in an odd\nnumber of backslashes). Specifically, *a raw string cannot end in a\nsingle backslash* (since the backslash would escape the following\nquote character). Note also that a single backslash followed by a\nnewline is interpreted as those two characters as part of the string,\n*not* as a line continuation.\n\nWhen an "\'r\'" or "\'R\'" prefix is used in conjunction with a "\'u\'" or\n"\'U\'" prefix, then the "\\uXXXX" and "\\UXXXXXXXX" escape sequences are\nprocessed while *all other backslashes are left in the string*. For\nexample, the string literal "ur"\\u0062\\n"" consists of three Unicode\ncharacters: \'LATIN SMALL LETTER B\', \'REVERSE SOLIDUS\', and \'LATIN\nSMALL LETTER N\'. Backslashes can be escaped with a preceding\nbackslash; however, both remain in the string. As a result, "\\uXXXX"\nescape sequences are only recognized when there are an odd number of\nbackslashes.\n', - 'subscriptions': u'\nSubscriptions\n*************\n\nA subscription selects an item of a sequence (string, tuple or list)\nor mapping (dictionary) object:\n\n subscription ::= primary "[" expression_list "]"\n\nThe primary must evaluate to an object of a sequence or mapping type.\n\nIf the primary is a mapping, the expression list must evaluate to an\nobject whose value is one of the keys of the mapping, and the\nsubscription selects the value in the mapping that corresponds to that\nkey. (The expression list is a tuple except if it has exactly one\nitem.)\n\nIf the primary is a sequence, the expression (list) must evaluate to a\nplain integer. If this value is negative, the length of the sequence\nis added to it (so that, e.g., "x[-1]" selects the last item of "x".)\nThe resulting value must be a nonnegative integer less than the number\nof items in the sequence, and the subscription selects the item whose\nindex is that value (counting from zero).\n\nA string\'s items are characters. A character is not a separate data\ntype but a string of exactly one character.\n', - 'truth': u'\nTruth Value Testing\n*******************\n\nAny object can be tested for truth value, for use in an "if" or\n"while" condition or as operand of the Boolean operations below. The\nfollowing values are considered false:\n\n* "None"\n\n* "False"\n\n* zero of any numeric type, for example, "0", "0L", "0.0", "0j".\n\n* any empty sequence, for example, "\'\'", "()", "[]".\n\n* any empty mapping, for example, "{}".\n\n* instances of user-defined classes, if the class defines a\n "__nonzero__()" or "__len__()" method, when that method returns the\n integer zero or "bool" value "False". [1]\n\nAll other values are considered true --- so objects of many types are\nalways true.\n\nOperations and built-in functions that have a Boolean result always\nreturn "0" or "False" for false and "1" or "True" for true, unless\notherwise stated. (Important exception: the Boolean operations "or"\nand "and" always return one of their operands.)\n', - 'try': u'\nThe "try" statement\n*******************\n\nThe "try" statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression [("as" | ",") identifier]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nChanged in version 2.5: In previous versions of Python,\n"try"..."except"..."finally" did not work. "try"..."except" had to be\nnested in "try"..."finally".\n\nThe "except" clause(s) specify one or more exception handlers. When no\nexception occurs in the "try" clause, no exception handler is\nexecuted. When an exception occurs in the "try" suite, a search for an\nexception handler is started. This search inspects the except clauses\nin turn until one is found that matches the exception. An expression-\nless except clause, if present, must be last; it matches any\nexception. For an except clause with an expression, that expression\nis evaluated, and the clause matches the exception if the resulting\nobject is "compatible" with the exception. An object is compatible\nwith an exception if it is the class or a base class of the exception\nobject, or a tuple containing an item compatible with the exception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire "try" statement raised\nthe exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified in that except clause, if present, and the except\nclause\'s suite is executed. All except clauses must have an\nexecutable block. When the end of this block is reached, execution\ncontinues normally after the entire try statement. (This means that\nif two nested handlers exist for the same exception, and the exception\noccurs in the try clause of the inner handler, the outer handler will\nnot handle the exception.)\n\nBefore an except clause\'s suite is executed, details about the\nexception are assigned to three variables in the "sys" module:\n"sys.exc_type" receives the object identifying the exception;\n"sys.exc_value" receives the exception\'s parameter;\n"sys.exc_traceback" receives a traceback object (see section The\nstandard type hierarchy) identifying the point in the program where\nthe exception occurred. These details are also available through the\n"sys.exc_info()" function, which returns a tuple "(exc_type,\nexc_value, exc_traceback)". Use of the corresponding variables is\ndeprecated in favor of this function, since their use is unsafe in a\nthreaded program. As of Python 1.5, the variables are restored to\ntheir previous values (before the call) when returning from a function\nthat handled an exception.\n\nThe optional "else" clause is executed if and when control flows off\nthe end of the "try" clause. [2] Exceptions in the "else" clause are\nnot handled by the preceding "except" clauses.\n\nIf "finally" is present, it specifies a \'cleanup\' handler. The "try"\nclause is executed, including any "except" and "else" clauses. If an\nexception occurs in any of the clauses and is not handled, the\nexception is temporarily saved. The "finally" clause is executed. If\nthere is a saved exception, it is re-raised at the end of the\n"finally" clause. If the "finally" clause raises another exception or\nexecutes a "return" or "break" statement, the saved exception is\ndiscarded:\n\n >>> def f():\n ... try:\n ... 1/0\n ... finally:\n ... return 42\n ...\n >>> f()\n 42\n\nThe exception information is not available to the program during\nexecution of the "finally" clause.\n\nWhen a "return", "break" or "continue" statement is executed in the\n"try" suite of a "try"..."finally" statement, the "finally" clause is\nalso executed \'on the way out.\' A "continue" statement is illegal in\nthe "finally" clause. (The reason is a problem with the current\nimplementation --- this restriction may be lifted in the future).\n\nThe return value of a function is determined by the last "return"\nstatement executed. Since the "finally" clause always executes, a\n"return" statement executed in the "finally" clause will always be the\nlast one executed:\n\n >>> def foo():\n ... try:\n ... return \'try\'\n ... finally:\n ... return \'finally\'\n ...\n >>> foo()\n \'finally\'\n\nAdditional information on exceptions can be found in section\nExceptions, and information on using the "raise" statement to generate\nexceptions may be found in section The raise statement.\n', - 'types': u'\nThe standard type hierarchy\n***************************\n\nBelow is a list of the types that are built into Python. Extension\nmodules (written in C, Java, or other languages, depending on the\nimplementation) can define additional types. Future versions of\nPython may add types to the type hierarchy (e.g., rational numbers,\nefficiently stored arrays of integers, etc.).\n\nSome of the type descriptions below contain a paragraph listing\n\'special attributes.\' These are attributes that provide access to the\nimplementation and are not intended for general use. Their definition\nmay change in the future.\n\nNone\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name "None". It\n is used to signify the absence of a value in many situations, e.g.,\n it is returned from functions that don\'t explicitly return\n anything. Its truth value is false.\n\nNotImplemented\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name\n "NotImplemented". Numeric methods and rich comparison methods may\n return this value if they do not implement the operation for the\n operands provided. (The interpreter will then try the reflected\n operation, or some other fallback, depending on the operator.) Its\n truth value is true.\n\nEllipsis\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name\n "Ellipsis". It is used to indicate the presence of the "..." syntax\n in a slice. Its truth value is true.\n\n"numbers.Number"\n These are created by numeric literals and returned as results by\n arithmetic operators and arithmetic built-in functions. Numeric\n objects are immutable; once created their value never changes.\n Python numbers are of course strongly related to mathematical\n numbers, but subject to the limitations of numerical representation\n in computers.\n\n Python distinguishes between integers, floating point numbers, and\n complex numbers:\n\n "numbers.Integral"\n These represent elements from the mathematical set of integers\n (positive and negative).\n\n There are three types of integers:\n\n Plain integers\n These represent numbers in the range -2147483648 through\n 2147483647. (The range may be larger on machines with a\n larger natural word size, but not smaller.) When the result\n of an operation would fall outside this range, the result is\n normally returned as a long integer (in some cases, the\n exception "OverflowError" is raised instead). For the\n purpose of shift and mask operations, integers are assumed to\n have a binary, 2\'s complement notation using 32 or more bits,\n and hiding no bits from the user (i.e., all 4294967296\n different bit patterns correspond to different values).\n\n Long integers\n These represent numbers in an unlimited range, subject to\n available (virtual) memory only. For the purpose of shift\n and mask operations, a binary representation is assumed, and\n negative numbers are represented in a variant of 2\'s\n complement which gives the illusion of an infinite string of\n sign bits extending to the left.\n\n Booleans\n These represent the truth values False and True. The two\n objects representing the values "False" and "True" are the\n only Boolean objects. The Boolean type is a subtype of plain\n integers, and Boolean values behave like the values 0 and 1,\n respectively, in almost all contexts, the exception being\n that when converted to a string, the strings ""False"" or\n ""True"" are returned, respectively.\n\n The rules for integer representation are intended to give the\n most meaningful interpretation of shift and mask operations\n involving negative integers and the least surprises when\n switching between the plain and long integer domains. Any\n operation, if it yields a result in the plain integer domain,\n will yield the same result in the long integer domain or when\n using mixed operands. The switch between domains is transparent\n to the programmer.\n\n "numbers.Real" ("float")\n These represent machine-level double precision floating point\n numbers. You are at the mercy of the underlying machine\n architecture (and C or Java implementation) for the accepted\n range and handling of overflow. Python does not support single-\n precision floating point numbers; the savings in processor and\n memory usage that are usually the reason for using these are\n dwarfed by the overhead of using objects in Python, so there is\n no reason to complicate the language with two kinds of floating\n point numbers.\n\n "numbers.Complex"\n These represent complex numbers as a pair of machine-level\n double precision floating point numbers. The same caveats apply\n as for floating point numbers. The real and imaginary parts of a\n complex number "z" can be retrieved through the read-only\n attributes "z.real" and "z.imag".\n\nSequences\n These represent finite ordered sets indexed by non-negative\n numbers. The built-in function "len()" returns the number of items\n of a sequence. When the length of a sequence is *n*, the index set\n contains the numbers 0, 1, ..., *n*-1. Item *i* of sequence *a* is\n selected by "a[i]".\n\n Sequences also support slicing: "a[i:j]" selects all items with\n index *k* such that *i* "<=" *k* "<" *j*. When used as an\n expression, a slice is a sequence of the same type. This implies\n that the index set is renumbered so that it starts at 0.\n\n Some sequences also support "extended slicing" with a third "step"\n parameter: "a[i:j:k]" selects all items of *a* with index *x* where\n "x = i + n*k", *n* ">=" "0" and *i* "<=" *x* "<" *j*.\n\n Sequences are distinguished according to their mutability:\n\n Immutable sequences\n An object of an immutable sequence type cannot change once it is\n created. (If the object contains references to other objects,\n these other objects may be mutable and may be changed; however,\n the collection of objects directly referenced by an immutable\n object cannot change.)\n\n The following types are immutable sequences:\n\n Strings\n The items of a string are characters. There is no separate\n character type; a character is represented by a string of one\n item. Characters represent (at least) 8-bit bytes. The\n built-in functions "chr()" and "ord()" convert between\n characters and nonnegative integers representing the byte\n values. Bytes with the values 0-127 usually represent the\n corresponding ASCII values, but the interpretation of values\n is up to the program. The string data type is also used to\n represent arrays of bytes, e.g., to hold data read from a\n file.\n\n (On systems whose native character set is not ASCII, strings\n may use EBCDIC in their internal representation, provided the\n functions "chr()" and "ord()" implement a mapping between\n ASCII and EBCDIC, and string comparison preserves the ASCII\n order. Or perhaps someone can propose a better rule?)\n\n Unicode\n The items of a Unicode object are Unicode code units. A\n Unicode code unit is represented by a Unicode object of one\n item and can hold either a 16-bit or 32-bit value\n representing a Unicode ordinal (the maximum value for the\n ordinal is given in "sys.maxunicode", and depends on how\n Python is configured at compile time). Surrogate pairs may\n be present in the Unicode object, and will be reported as two\n separate items. The built-in functions "unichr()" and\n "ord()" convert between code units and nonnegative integers\n representing the Unicode ordinals as defined in the Unicode\n Standard 3.0. Conversion from and to other encodings are\n possible through the Unicode method "encode()" and the built-\n in function "unicode()".\n\n Tuples\n The items of a tuple are arbitrary Python objects. Tuples of\n two or more items are formed by comma-separated lists of\n expressions. A tuple of one item (a \'singleton\') can be\n formed by affixing a comma to an expression (an expression by\n itself does not create a tuple, since parentheses must be\n usable for grouping of expressions). An empty tuple can be\n formed by an empty pair of parentheses.\n\n Mutable sequences\n Mutable sequences can be changed after they are created. The\n subscription and slicing notations can be used as the target of\n assignment and "del" (delete) statements.\n\n There are currently two intrinsic mutable sequence types:\n\n Lists\n The items of a list are arbitrary Python objects. Lists are\n formed by placing a comma-separated list of expressions in\n square brackets. (Note that there are no special cases needed\n to form lists of length 0 or 1.)\n\n Byte Arrays\n A bytearray object is a mutable array. They are created by\n the built-in "bytearray()" constructor. Aside from being\n mutable (and hence unhashable), byte arrays otherwise provide\n the same interface and functionality as immutable bytes\n objects.\n\n The extension module "array" provides an additional example of a\n mutable sequence type.\n\nSet types\n These represent unordered, finite sets of unique, immutable\n objects. As such, they cannot be indexed by any subscript. However,\n they can be iterated over, and the built-in function "len()"\n returns the number of items in a set. Common uses for sets are fast\n membership testing, removing duplicates from a sequence, and\n computing mathematical operations such as intersection, union,\n difference, and symmetric difference.\n\n For set elements, the same immutability rules apply as for\n dictionary keys. Note that numeric types obey the normal rules for\n numeric comparison: if two numbers compare equal (e.g., "1" and\n "1.0"), only one of them can be contained in a set.\n\n There are currently two intrinsic set types:\n\n Sets\n These represent a mutable set. They are created by the built-in\n "set()" constructor and can be modified afterwards by several\n methods, such as "add()".\n\n Frozen sets\n These represent an immutable set. They are created by the\n built-in "frozenset()" constructor. As a frozenset is immutable\n and *hashable*, it can be used again as an element of another\n set, or as a dictionary key.\n\nMappings\n These represent finite sets of objects indexed by arbitrary index\n sets. The subscript notation "a[k]" selects the item indexed by "k"\n from the mapping "a"; this can be used in expressions and as the\n target of assignments or "del" statements. The built-in function\n "len()" returns the number of items in a mapping.\n\n There is currently a single intrinsic mapping type:\n\n Dictionaries\n These represent finite sets of objects indexed by nearly\n arbitrary values. The only types of values not acceptable as\n keys are values containing lists or dictionaries or other\n mutable types that are compared by value rather than by object\n identity, the reason being that the efficient implementation of\n dictionaries requires a key\'s hash value to remain constant.\n Numeric types used for keys obey the normal rules for numeric\n comparison: if two numbers compare equal (e.g., "1" and "1.0")\n then they can be used interchangeably to index the same\n dictionary entry.\n\n Dictionaries are mutable; they can be created by the "{...}"\n notation (see section Dictionary displays).\n\n The extension modules "dbm", "gdbm", and "bsddb" provide\n additional examples of mapping types.\n\nCallable types\n These are the types to which the function call operation (see\n section Calls) can be applied:\n\n User-defined functions\n A user-defined function object is created by a function\n definition (see section Function definitions). It should be\n called with an argument list containing the same number of items\n as the function\'s formal parameter list.\n\n Special attributes:\n\n +-------------------------+---------------------------------+-------------+\n | Attribute | Meaning | |\n +=========================+=================================+=============+\n | "__doc__" "func_doc" | The function\'s documentation | Writable |\n | | string, or "None" if | |\n | | unavailable. | |\n +-------------------------+---------------------------------+-------------+\n | "__name__" "func_name" | The function\'s name. | Writable |\n +-------------------------+---------------------------------+-------------+\n | "__module__" | The name of the module the | Writable |\n | | function was defined in, or | |\n | | "None" if unavailable. | |\n +-------------------------+---------------------------------+-------------+\n | "__defaults__" | A tuple containing default | Writable |\n | "func_defaults" | argument values for those | |\n | | arguments that have defaults, | |\n | | or "None" if no arguments have | |\n | | a default value. | |\n +-------------------------+---------------------------------+-------------+\n | "__code__" "func_code" | The code object representing | Writable |\n | | the compiled function body. | |\n +-------------------------+---------------------------------+-------------+\n | "__globals__" | A reference to the dictionary | Read-only |\n | "func_globals" | that holds the function\'s | |\n | | global variables --- the global | |\n | | namespace of the module in | |\n | | which the function was defined. | |\n +-------------------------+---------------------------------+-------------+\n | "__dict__" "func_dict" | The namespace supporting | Writable |\n | | arbitrary function attributes. | |\n +-------------------------+---------------------------------+-------------+\n | "__closure__" | "None" or a tuple of cells that | Read-only |\n | "func_closure" | contain bindings for the | |\n | | function\'s free variables. | |\n +-------------------------+---------------------------------+-------------+\n\n Most of the attributes labelled "Writable" check the type of the\n assigned value.\n\n Changed in version 2.4: "func_name" is now writable.\n\n Changed in version 2.6: The double-underscore attributes\n "__closure__", "__code__", "__defaults__", and "__globals__"\n were introduced as aliases for the corresponding "func_*"\n attributes for forwards compatibility with Python 3.\n\n Function objects also support getting and setting arbitrary\n attributes, which can be used, for example, to attach metadata\n to functions. Regular attribute dot-notation is used to get and\n set such attributes. *Note that the current implementation only\n supports function attributes on user-defined functions. Function\n attributes on built-in functions may be supported in the\n future.*\n\n Additional information about a function\'s definition can be\n retrieved from its code object; see the description of internal\n types below.\n\n User-defined methods\n A user-defined method object combines a class, a class instance\n (or "None") and any callable object (normally a user-defined\n function).\n\n Special read-only attributes: "im_self" is the class instance\n object, "im_func" is the function object; "im_class" is the\n class of "im_self" for bound methods or the class that asked for\n the method for unbound methods; "__doc__" is the method\'s\n documentation (same as "im_func.__doc__"); "__name__" is the\n method name (same as "im_func.__name__"); "__module__" is the\n name of the module the method was defined in, or "None" if\n unavailable.\n\n Changed in version 2.2: "im_self" used to refer to the class\n that defined the method.\n\n Changed in version 2.6: For Python 3 forward-compatibility,\n "im_func" is also available as "__func__", and "im_self" as\n "__self__".\n\n Methods also support accessing (but not setting) the arbitrary\n function attributes on the underlying function object.\n\n User-defined method objects may be created when getting an\n attribute of a class (perhaps via an instance of that class), if\n that attribute is a user-defined function object, an unbound\n user-defined method object, or a class method object. When the\n attribute is a user-defined method object, a new method object\n is only created if the class from which it is being retrieved is\n the same as, or a derived class of, the class stored in the\n original method object; otherwise, the original method object is\n used as it is.\n\n When a user-defined method object is created by retrieving a\n user-defined function object from a class, its "im_self"\n attribute is "None" and the method object is said to be unbound.\n When one is created by retrieving a user-defined function object\n from a class via one of its instances, its "im_self" attribute\n is the instance, and the method object is said to be bound. In\n either case, the new method\'s "im_class" attribute is the class\n from which the retrieval takes place, and its "im_func"\n attribute is the original function object.\n\n When a user-defined method object is created by retrieving\n another method object from a class or instance, the behaviour is\n the same as for a function object, except that the "im_func"\n attribute of the new instance is not the original method object\n but its "im_func" attribute.\n\n When a user-defined method object is created by retrieving a\n class method object from a class or instance, its "im_self"\n attribute is the class itself, and its "im_func" attribute is\n the function object underlying the class method.\n\n When an unbound user-defined method object is called, the\n underlying function ("im_func") is called, with the restriction\n that the first argument must be an instance of the proper class\n ("im_class") or of a derived class thereof.\n\n When a bound user-defined method object is called, the\n underlying function ("im_func") is called, inserting the class\n instance ("im_self") in front of the argument list. For\n instance, when "C" is a class which contains a definition for a\n function "f()", and "x" is an instance of "C", calling "x.f(1)"\n is equivalent to calling "C.f(x, 1)".\n\n When a user-defined method object is derived from a class method\n object, the "class instance" stored in "im_self" will actually\n be the class itself, so that calling either "x.f(1)" or "C.f(1)"\n is equivalent to calling "f(C,1)" where "f" is the underlying\n function.\n\n Note that the transformation from function object to (unbound or\n bound) method object happens each time the attribute is\n retrieved from the class or instance. In some cases, a fruitful\n optimization is to assign the attribute to a local variable and\n call that local variable. Also notice that this transformation\n only happens for user-defined functions; other callable objects\n (and all non-callable objects) are retrieved without\n transformation. It is also important to note that user-defined\n functions which are attributes of a class instance are not\n converted to bound methods; this *only* happens when the\n function is an attribute of the class.\n\n Generator functions\n A function or method which uses the "yield" statement (see\n section The yield statement) is called a *generator function*.\n Such a function, when called, always returns an iterator object\n which can be used to execute the body of the function: calling\n the iterator\'s "next()" method will cause the function to\n execute until it provides a value using the "yield" statement.\n When the function executes a "return" statement or falls off the\n end, a "StopIteration" exception is raised and the iterator will\n have reached the end of the set of values to be returned.\n\n Built-in functions\n A built-in function object is a wrapper around a C function.\n Examples of built-in functions are "len()" and "math.sin()"\n ("math" is a standard built-in module). The number and type of\n the arguments are determined by the C function. Special read-\n only attributes: "__doc__" is the function\'s documentation\n string, or "None" if unavailable; "__name__" is the function\'s\n name; "__self__" is set to "None" (but see the next item);\n "__module__" is the name of the module the function was defined\n in or "None" if unavailable.\n\n Built-in methods\n This is really a different disguise of a built-in function, this\n time containing an object passed to the C function as an\n implicit extra argument. An example of a built-in method is\n "alist.append()", assuming *alist* is a list object. In this\n case, the special read-only attribute "__self__" is set to the\n object denoted by *alist*.\n\n Class Types\n Class types, or "new-style classes," are callable. These\n objects normally act as factories for new instances of\n themselves, but variations are possible for class types that\n override "__new__()". The arguments of the call are passed to\n "__new__()" and, in the typical case, to "__init__()" to\n initialize the new instance.\n\n Classic Classes\n Class objects are described below. When a class object is\n called, a new class instance (also described below) is created\n and returned. This implies a call to the class\'s "__init__()"\n method if it has one. Any arguments are passed on to the\n "__init__()" method. If there is no "__init__()" method, the\n class must be called without arguments.\n\n Class instances\n Class instances are described below. Class instances are\n callable only when the class has a "__call__()" method;\n "x(arguments)" is a shorthand for "x.__call__(arguments)".\n\nModules\n Modules are imported by the "import" statement (see section The\n import statement). A module object has a namespace implemented by a\n dictionary object (this is the dictionary referenced by the\n func_globals attribute of functions defined in the module).\n Attribute references are translated to lookups in this dictionary,\n e.g., "m.x" is equivalent to "m.__dict__["x"]". A module object\n does not contain the code object used to initialize the module\n (since it isn\'t needed once the initialization is done).\n\n Attribute assignment updates the module\'s namespace dictionary,\n e.g., "m.x = 1" is equivalent to "m.__dict__["x"] = 1".\n\n Special read-only attribute: "__dict__" is the module\'s namespace\n as a dictionary object.\n\n **CPython implementation detail:** Because of the way CPython\n clears module dictionaries, the module dictionary will be cleared\n when the module falls out of scope even if the dictionary still has\n live references. To avoid this, copy the dictionary or keep the\n module around while using its dictionary directly.\n\n Predefined (writable) attributes: "__name__" is the module\'s name;\n "__doc__" is the module\'s documentation string, or "None" if\n unavailable; "__file__" is the pathname of the file from which the\n module was loaded, if it was loaded from a file. The "__file__"\n attribute is not present for C modules that are statically linked\n into the interpreter; for extension modules loaded dynamically from\n a shared library, it is the pathname of the shared library file.\n\nClasses\n Both class types (new-style classes) and class objects (old-\n style/classic classes) are typically created by class definitions\n (see section Class definitions). A class has a namespace\n implemented by a dictionary object. Class attribute references are\n translated to lookups in this dictionary, e.g., "C.x" is translated\n to "C.__dict__["x"]" (although for new-style classes in particular\n there are a number of hooks which allow for other means of locating\n attributes). When the attribute name is not found there, the\n attribute search continues in the base classes. For old-style\n classes, the search is depth-first, left-to-right in the order of\n occurrence in the base class list. New-style classes use the more\n complex C3 method resolution order which behaves correctly even in\n the presence of \'diamond\' inheritance structures where there are\n multiple inheritance paths leading back to a common ancestor.\n Additional details on the C3 MRO used by new-style classes can be\n found in the documentation accompanying the 2.3 release at\n https://www.python.org/download/releases/2.3/mro/.\n\n When a class attribute reference (for class "C", say) would yield a\n user-defined function object or an unbound user-defined method\n object whose associated class is either "C" or one of its base\n classes, it is transformed into an unbound user-defined method\n object whose "im_class" attribute is "C". When it would yield a\n class method object, it is transformed into a bound user-defined\n method object whose "im_self" attribute is "C". When it would\n yield a static method object, it is transformed into the object\n wrapped by the static method object. See section Implementing\n Descriptors for another way in which attributes retrieved from a\n class may differ from those actually contained in its "__dict__"\n (note that only new-style classes support descriptors).\n\n Class attribute assignments update the class\'s dictionary, never\n the dictionary of a base class.\n\n A class object can be called (see above) to yield a class instance\n (see below).\n\n Special attributes: "__name__" is the class name; "__module__" is\n the module name in which the class was defined; "__dict__" is the\n dictionary containing the class\'s namespace; "__bases__" is a tuple\n (possibly empty or a singleton) containing the base classes, in the\n order of their occurrence in the base class list; "__doc__" is the\n class\'s documentation string, or None if undefined.\n\nClass instances\n A class instance is created by calling a class object (see above).\n A class instance has a namespace implemented as a dictionary which\n is the first place in which attribute references are searched.\n When an attribute is not found there, and the instance\'s class has\n an attribute by that name, the search continues with the class\n attributes. If a class attribute is found that is a user-defined\n function object or an unbound user-defined method object whose\n associated class is the class (call it "C") of the instance for\n which the attribute reference was initiated or one of its bases, it\n is transformed into a bound user-defined method object whose\n "im_class" attribute is "C" and whose "im_self" attribute is the\n instance. Static method and class method objects are also\n transformed, as if they had been retrieved from class "C"; see\n above under "Classes". See section Implementing Descriptors for\n another way in which attributes of a class retrieved via its\n instances may differ from the objects actually stored in the\n class\'s "__dict__". If no class attribute is found, and the\n object\'s class has a "__getattr__()" method, that is called to\n satisfy the lookup.\n\n Attribute assignments and deletions update the instance\'s\n dictionary, never a class\'s dictionary. If the class has a\n "__setattr__()" or "__delattr__()" method, this is called instead\n of updating the instance dictionary directly.\n\n Class instances can pretend to be numbers, sequences, or mappings\n if they have methods with certain special names. See section\n Special method names.\n\n Special attributes: "__dict__" is the attribute dictionary;\n "__class__" is the instance\'s class.\n\nFiles\n A file object represents an open file. File objects are created by\n the "open()" built-in function, and also by "os.popen()",\n "os.fdopen()", and the "makefile()" method of socket objects (and\n perhaps by other functions or methods provided by extension\n modules). The objects "sys.stdin", "sys.stdout" and "sys.stderr"\n are initialized to file objects corresponding to the interpreter\'s\n standard input, output and error streams. See File Objects for\n complete documentation of file objects.\n\nInternal types\n A few types used internally by the interpreter are exposed to the\n user. Their definitions may change with future versions of the\n interpreter, but they are mentioned here for completeness.\n\n Code objects\n Code objects represent *byte-compiled* executable Python code,\n or *bytecode*. The difference between a code object and a\n function object is that the function object contains an explicit\n reference to the function\'s globals (the module in which it was\n defined), while a code object contains no context; also the\n default argument values are stored in the function object, not\n in the code object (because they represent values calculated at\n run-time). Unlike function objects, code objects are immutable\n and contain no references (directly or indirectly) to mutable\n objects.\n\n Special read-only attributes: "co_name" gives the function name;\n "co_argcount" is the number of positional arguments (including\n arguments with default values); "co_nlocals" is the number of\n local variables used by the function (including arguments);\n "co_varnames" is a tuple containing the names of the local\n variables (starting with the argument names); "co_cellvars" is a\n tuple containing the names of local variables that are\n referenced by nested functions; "co_freevars" is a tuple\n containing the names of free variables; "co_code" is a string\n representing the sequence of bytecode instructions; "co_consts"\n is a tuple containing the literals used by the bytecode;\n "co_names" is a tuple containing the names used by the bytecode;\n "co_filename" is the filename from which the code was compiled;\n "co_firstlineno" is the first line number of the function;\n "co_lnotab" is a string encoding the mapping from bytecode\n offsets to line numbers (for details see the source code of the\n interpreter); "co_stacksize" is the required stack size\n (including local variables); "co_flags" is an integer encoding a\n number of flags for the interpreter.\n\n The following flag bits are defined for "co_flags": bit "0x04"\n is set if the function uses the "*arguments" syntax to accept an\n arbitrary number of positional arguments; bit "0x08" is set if\n the function uses the "**keywords" syntax to accept arbitrary\n keyword arguments; bit "0x20" is set if the function is a\n generator.\n\n Future feature declarations ("from __future__ import division")\n also use bits in "co_flags" to indicate whether a code object\n was compiled with a particular feature enabled: bit "0x2000" is\n set if the function was compiled with future division enabled;\n bits "0x10" and "0x1000" were used in earlier versions of\n Python.\n\n Other bits in "co_flags" are reserved for internal use.\n\n If a code object represents a function, the first item in\n "co_consts" is the documentation string of the function, or\n "None" if undefined.\n\n Frame objects\n Frame objects represent execution frames. They may occur in\n traceback objects (see below).\n\n Special read-only attributes: "f_back" is to the previous stack\n frame (towards the caller), or "None" if this is the bottom\n stack frame; "f_code" is the code object being executed in this\n frame; "f_locals" is the dictionary used to look up local\n variables; "f_globals" is used for global variables;\n "f_builtins" is used for built-in (intrinsic) names;\n "f_restricted" is a flag indicating whether the function is\n executing in restricted execution mode; "f_lasti" gives the\n precise instruction (this is an index into the bytecode string\n of the code object).\n\n Special writable attributes: "f_trace", if not "None", is a\n function called at the start of each source code line (this is\n used by the debugger); "f_exc_type", "f_exc_value",\n "f_exc_traceback" represent the last exception raised in the\n parent frame provided another exception was ever raised in the\n current frame (in all other cases they are None); "f_lineno" is\n the current line number of the frame --- writing to this from\n within a trace function jumps to the given line (only for the\n bottom-most frame). A debugger can implement a Jump command\n (aka Set Next Statement) by writing to f_lineno.\n\n Traceback objects\n Traceback objects represent a stack trace of an exception. A\n traceback object is created when an exception occurs. When the\n search for an exception handler unwinds the execution stack, at\n each unwound level a traceback object is inserted in front of\n the current traceback. When an exception handler is entered,\n the stack trace is made available to the program. (See section\n The try statement.) It is accessible as "sys.exc_traceback", and\n also as the third item of the tuple returned by\n "sys.exc_info()". The latter is the preferred interface, since\n it works correctly when the program is using multiple threads.\n When the program contains no suitable handler, the stack trace\n is written (nicely formatted) to the standard error stream; if\n the interpreter is interactive, it is also made available to the\n user as "sys.last_traceback".\n\n Special read-only attributes: "tb_next" is the next level in the\n stack trace (towards the frame where the exception occurred), or\n "None" if there is no next level; "tb_frame" points to the\n execution frame of the current level; "tb_lineno" gives the line\n number where the exception occurred; "tb_lasti" indicates the\n precise instruction. The line number and last instruction in\n the traceback may differ from the line number of its frame\n object if the exception occurred in a "try" statement with no\n matching except clause or with a finally clause.\n\n Slice objects\n Slice objects are used to represent slices when *extended slice\n syntax* is used. This is a slice using two colons, or multiple\n slices or ellipses separated by commas, e.g., "a[i:j:step]",\n "a[i:j, k:l]", or "a[..., i:j]". They are also created by the\n built-in "slice()" function.\n\n Special read-only attributes: "start" is the lower bound; "stop"\n is the upper bound; "step" is the step value; each is "None" if\n omitted. These attributes can have any type.\n\n Slice objects support one method:\n\n slice.indices(self, length)\n\n This method takes a single integer argument *length* and\n computes information about the extended slice that the slice\n object would describe if applied to a sequence of *length*\n items. It returns a tuple of three integers; respectively\n these are the *start* and *stop* indices and the *step* or\n stride length of the slice. Missing or out-of-bounds indices\n are handled in a manner consistent with regular slices.\n\n New in version 2.3.\n\n Static method objects\n Static method objects provide a way of defeating the\n transformation of function objects to method objects described\n above. A static method object is a wrapper around any other\n object, usually a user-defined method object. When a static\n method object is retrieved from a class or a class instance, the\n object actually returned is the wrapped object, which is not\n subject to any further transformation. Static method objects are\n not themselves callable, although the objects they wrap usually\n are. Static method objects are created by the built-in\n "staticmethod()" constructor.\n\n Class method objects\n A class method object, like a static method object, is a wrapper\n around another object that alters the way in which that object\n is retrieved from classes and class instances. The behaviour of\n class method objects upon such retrieval is described above,\n under "User-defined methods". Class method objects are created\n by the built-in "classmethod()" constructor.\n', - 'typesfunctions': u'\nFunctions\n*********\n\nFunction objects are created by function definitions. The only\noperation on a function object is to call it: "func(argument-list)".\n\nThere are really two flavors of function objects: built-in functions\nand user-defined functions. Both support the same operation (to call\nthe function), but the implementation is different, hence the\ndifferent object types.\n\nSee Function definitions for more information.\n', - 'typesmapping': u'\nMapping Types --- "dict"\n************************\n\nA *mapping* object maps *hashable* values to arbitrary objects.\nMappings are mutable objects. There is currently only one standard\nmapping type, the *dictionary*. (For other containers see the built\nin "list", "set", and "tuple" classes, and the "collections" module.)\n\nA dictionary\'s keys are *almost* arbitrary values. Values that are\nnot *hashable*, that is, values containing lists, dictionaries or\nother mutable types (that are compared by value rather than by object\nidentity) may not be used as keys. Numeric types used for keys obey\nthe normal rules for numeric comparison: if two numbers compare equal\n(such as "1" and "1.0") then they can be used interchangeably to index\nthe same dictionary entry. (Note however, that since computers store\nfloating-point numbers as approximations it is usually unwise to use\nthem as dictionary keys.)\n\nDictionaries can be created by placing a comma-separated list of "key:\nvalue" pairs within braces, for example: "{\'jack\': 4098, \'sjoerd\':\n4127}" or "{4098: \'jack\', 4127: \'sjoerd\'}", or by the "dict"\nconstructor.\n\nclass dict(**kwarg)\nclass dict(mapping, **kwarg)\nclass dict(iterable, **kwarg)\n\n Return a new dictionary initialized from an optional positional\n argument and a possibly empty set of keyword arguments.\n\n If no positional argument is given, an empty dictionary is created.\n If a positional argument is given and it is a mapping object, a\n dictionary is created with the same key-value pairs as the mapping\n object. Otherwise, the positional argument must be an *iterable*\n object. Each item in the iterable must itself be an iterable with\n exactly two objects. The first object of each item becomes a key\n in the new dictionary, and the second object the corresponding\n value. If a key occurs more than once, the last value for that key\n becomes the corresponding value in the new dictionary.\n\n If keyword arguments are given, the keyword arguments and their\n values are added to the dictionary created from the positional\n argument. If a key being added is already present, the value from\n the keyword argument replaces the value from the positional\n argument.\n\n To illustrate, the following examples all return a dictionary equal\n to "{"one": 1, "two": 2, "three": 3}":\n\n >>> a = dict(one=1, two=2, three=3)\n >>> b = {\'one\': 1, \'two\': 2, \'three\': 3}\n >>> c = dict(zip([\'one\', \'two\', \'three\'], [1, 2, 3]))\n >>> d = dict([(\'two\', 2), (\'one\', 1), (\'three\', 3)])\n >>> e = dict({\'three\': 3, \'one\': 1, \'two\': 2})\n >>> a == b == c == d == e\n True\n\n Providing keyword arguments as in the first example only works for\n keys that are valid Python identifiers. Otherwise, any valid keys\n can be used.\n\n New in version 2.2.\n\n Changed in version 2.3: Support for building a dictionary from\n keyword arguments added.\n\n These are the operations that dictionaries support (and therefore,\n custom mapping types should support too):\n\n len(d)\n\n Return the number of items in the dictionary *d*.\n\n d[key]\n\n Return the item of *d* with key *key*. Raises a "KeyError" if\n *key* is not in the map.\n\n If a subclass of dict defines a method "__missing__()" and *key*\n is not present, the "d[key]" operation calls that method with\n the key *key* as argument. The "d[key]" operation then returns\n or raises whatever is returned or raised by the\n "__missing__(key)" call. No other operations or methods invoke\n "__missing__()". If "__missing__()" is not defined, "KeyError"\n is raised. "__missing__()" must be a method; it cannot be an\n instance variable:\n\n >>> class Counter(dict):\n ... def __missing__(self, key):\n ... return 0\n >>> c = Counter()\n >>> c[\'red\']\n 0\n >>> c[\'red\'] += 1\n >>> c[\'red\']\n 1\n\n The example above shows part of the implementation of\n "collections.Counter". A different "__missing__" method is used\n by "collections.defaultdict".\n\n New in version 2.5: Recognition of __missing__ methods of dict\n subclasses.\n\n d[key] = value\n\n Set "d[key]" to *value*.\n\n del d[key]\n\n Remove "d[key]" from *d*. Raises a "KeyError" if *key* is not\n in the map.\n\n key in d\n\n Return "True" if *d* has a key *key*, else "False".\n\n New in version 2.2.\n\n key not in d\n\n Equivalent to "not key in d".\n\n New in version 2.2.\n\n iter(d)\n\n Return an iterator over the keys of the dictionary. This is a\n shortcut for "iterkeys()".\n\n clear()\n\n Remove all items from the dictionary.\n\n copy()\n\n Return a shallow copy of the dictionary.\n\n fromkeys(seq[, value])\n\n Create a new dictionary with keys from *seq* and values set to\n *value*.\n\n "fromkeys()" is a class method that returns a new dictionary.\n *value* defaults to "None".\n\n New in version 2.3.\n\n get(key[, default])\n\n Return the value for *key* if *key* is in the dictionary, else\n *default*. If *default* is not given, it defaults to "None", so\n that this method never raises a "KeyError".\n\n has_key(key)\n\n Test for the presence of *key* in the dictionary. "has_key()"\n is deprecated in favor of "key in d".\n\n items()\n\n Return a copy of the dictionary\'s list of "(key, value)" pairs.\n\n **CPython implementation detail:** Keys and values are listed in\n an arbitrary order which is non-random, varies across Python\n implementations, and depends on the dictionary\'s history of\n insertions and deletions.\n\n If "items()", "keys()", "values()", "iteritems()", "iterkeys()",\n and "itervalues()" are called with no intervening modifications\n to the dictionary, the lists will directly correspond. This\n allows the creation of "(value, key)" pairs using "zip()":\n "pairs = zip(d.values(), d.keys())". The same relationship\n holds for the "iterkeys()" and "itervalues()" methods: "pairs =\n zip(d.itervalues(), d.iterkeys())" provides the same value for\n "pairs". Another way to create the same list is "pairs = [(v, k)\n for (k, v) in d.iteritems()]".\n\n iteritems()\n\n Return an iterator over the dictionary\'s "(key, value)" pairs.\n See the note for "dict.items()".\n\n Using "iteritems()" while adding or deleting entries in the\n dictionary may raise a "RuntimeError" or fail to iterate over\n all entries.\n\n New in version 2.2.\n\n iterkeys()\n\n Return an iterator over the dictionary\'s keys. See the note for\n "dict.items()".\n\n Using "iterkeys()" while adding or deleting entries in the\n dictionary may raise a "RuntimeError" or fail to iterate over\n all entries.\n\n New in version 2.2.\n\n itervalues()\n\n Return an iterator over the dictionary\'s values. See the note\n for "dict.items()".\n\n Using "itervalues()" while adding or deleting entries in the\n dictionary may raise a "RuntimeError" or fail to iterate over\n all entries.\n\n New in version 2.2.\n\n keys()\n\n Return a copy of the dictionary\'s list of keys. See the note\n for "dict.items()".\n\n pop(key[, default])\n\n If *key* is in the dictionary, remove it and return its value,\n else return *default*. If *default* is not given and *key* is\n not in the dictionary, a "KeyError" is raised.\n\n New in version 2.3.\n\n popitem()\n\n Remove and return an arbitrary "(key, value)" pair from the\n dictionary.\n\n "popitem()" is useful to destructively iterate over a\n dictionary, as often used in set algorithms. If the dictionary\n is empty, calling "popitem()" raises a "KeyError".\n\n setdefault(key[, default])\n\n If *key* is in the dictionary, return its value. If not, insert\n *key* with a value of *default* and return *default*. *default*\n defaults to "None".\n\n update([other])\n\n Update the dictionary with the key/value pairs from *other*,\n overwriting existing keys. Return "None".\n\n "update()" accepts either another dictionary object or an\n iterable of key/value pairs (as tuples or other iterables of\n length two). If keyword arguments are specified, the dictionary\n is then updated with those key/value pairs: "d.update(red=1,\n blue=2)".\n\n Changed in version 2.4: Allowed the argument to be an iterable\n of key/value pairs and allowed keyword arguments.\n\n values()\n\n Return a copy of the dictionary\'s list of values. See the note\n for "dict.items()".\n\n viewitems()\n\n Return a new view of the dictionary\'s items ("(key, value)"\n pairs). See below for documentation of view objects.\n\n New in version 2.7.\n\n viewkeys()\n\n Return a new view of the dictionary\'s keys. See below for\n documentation of view objects.\n\n New in version 2.7.\n\n viewvalues()\n\n Return a new view of the dictionary\'s values. See below for\n documentation of view objects.\n\n New in version 2.7.\n\n Dictionaries compare equal if and only if they have the same "(key,\n value)" pairs.\n\n\nDictionary view objects\n=======================\n\nThe objects returned by "dict.viewkeys()", "dict.viewvalues()" and\n"dict.viewitems()" are *view objects*. They provide a dynamic view on\nthe dictionary\'s entries, which means that when the dictionary\nchanges, the view reflects these changes.\n\nDictionary views can be iterated over to yield their respective data,\nand support membership tests:\n\nlen(dictview)\n\n Return the number of entries in the dictionary.\n\niter(dictview)\n\n Return an iterator over the keys, values or items (represented as\n tuples of "(key, value)") in the dictionary.\n\n Keys and values are iterated over in an arbitrary order which is\n non-random, varies across Python implementations, and depends on\n the dictionary\'s history of insertions and deletions. If keys,\n values and items views are iterated over with no intervening\n modifications to the dictionary, the order of items will directly\n correspond. This allows the creation of "(value, key)" pairs using\n "zip()": "pairs = zip(d.values(), d.keys())". Another way to\n create the same list is "pairs = [(v, k) for (k, v) in d.items()]".\n\n Iterating views while adding or deleting entries in the dictionary\n may raise a "RuntimeError" or fail to iterate over all entries.\n\nx in dictview\n\n Return "True" if *x* is in the underlying dictionary\'s keys, values\n or items (in the latter case, *x* should be a "(key, value)"\n tuple).\n\nKeys views are set-like since their entries are unique and hashable.\nIf all values are hashable, so that (key, value) pairs are unique and\nhashable, then the items view is also set-like. (Values views are not\ntreated as set-like since the entries are generally not unique.) Then\nthese set operations are available ("other" refers either to another\nview or a set):\n\ndictview & other\n\n Return the intersection of the dictview and the other object as a\n new set.\n\ndictview | other\n\n Return the union of the dictview and the other object as a new set.\n\ndictview - other\n\n Return the difference between the dictview and the other object\n (all elements in *dictview* that aren\'t in *other*) as a new set.\n\ndictview ^ other\n\n Return the symmetric difference (all elements either in *dictview*\n or *other*, but not in both) of the dictview and the other object\n as a new set.\n\nAn example of dictionary view usage:\n\n >>> dishes = {\'eggs\': 2, \'sausage\': 1, \'bacon\': 1, \'spam\': 500}\n >>> keys = dishes.viewkeys()\n >>> values = dishes.viewvalues()\n\n >>> # iteration\n >>> n = 0\n >>> for val in values:\n ... n += val\n >>> print(n)\n 504\n\n >>> # keys and values are iterated over in the same order\n >>> list(keys)\n [\'eggs\', \'bacon\', \'sausage\', \'spam\']\n >>> list(values)\n [2, 1, 1, 500]\n\n >>> # view objects are dynamic and reflect dict changes\n >>> del dishes[\'eggs\']\n >>> del dishes[\'sausage\']\n >>> list(keys)\n [\'spam\', \'bacon\']\n\n >>> # set operations\n >>> keys & {\'eggs\', \'bacon\', \'salad\'}\n {\'bacon\'}\n', - 'typesmethods': u'\nMethods\n*******\n\nMethods are functions that are called using the attribute notation.\nThere are two flavors: built-in methods (such as "append()" on lists)\nand class instance methods. Built-in methods are described with the\ntypes that support them.\n\nThe implementation adds two special read-only attributes to class\ninstance methods: "m.im_self" is the object on which the method\noperates, and "m.im_func" is the function implementing the method.\nCalling "m(arg-1, arg-2, ..., arg-n)" is completely equivalent to\ncalling "m.im_func(m.im_self, arg-1, arg-2, ..., arg-n)".\n\nClass instance methods are either *bound* or *unbound*, referring to\nwhether the method was accessed through an instance or a class,\nrespectively. When a method is unbound, its "im_self" attribute will\nbe "None" and if called, an explicit "self" object must be passed as\nthe first argument. In this case, "self" must be an instance of the\nunbound method\'s class (or a subclass of that class), otherwise a\n"TypeError" is raised.\n\nLike function objects, methods objects support getting arbitrary\nattributes. However, since method attributes are actually stored on\nthe underlying function object ("meth.im_func"), setting method\nattributes on either bound or unbound methods is disallowed.\nAttempting to set an attribute on a method results in an\n"AttributeError" being raised. In order to set a method attribute,\nyou need to explicitly set it on the underlying function object:\n\n >>> class C:\n ... def method(self):\n ... pass\n ...\n >>> c = C()\n >>> c.method.whoami = \'my name is method\' # can\'t set on the method\n Traceback (most recent call last):\n File "", line 1, in \n AttributeError: \'instancemethod\' object has no attribute \'whoami\'\n >>> c.method.im_func.whoami = \'my name is method\'\n >>> c.method.whoami\n \'my name is method\'\n\nSee The standard type hierarchy for more information.\n', - 'typesmodules': u'\nModules\n*******\n\nThe only special operation on a module is attribute access: "m.name",\nwhere *m* is a module and *name* accesses a name defined in *m*\'s\nsymbol table. Module attributes can be assigned to. (Note that the\n"import" statement is not, strictly speaking, an operation on a module\nobject; "import foo" does not require a module object named *foo* to\nexist, rather it requires an (external) *definition* for a module\nnamed *foo* somewhere.)\n\nA special attribute of every module is "__dict__". This is the\ndictionary containing the module\'s symbol table. Modifying this\ndictionary will actually change the module\'s symbol table, but direct\nassignment to the "__dict__" attribute is not possible (you can write\n"m.__dict__[\'a\'] = 1", which defines "m.a" to be "1", but you can\'t\nwrite "m.__dict__ = {}"). Modifying "__dict__" directly is not\nrecommended.\n\nModules built into the interpreter are written like this: "". If loaded from a file, they are written as\n"".\n', - 'typesseq': u'\nSequence Types --- "str", "unicode", "list", "tuple", "bytearray", "buffer", "xrange"\n*************************************************************************************\n\nThere are seven sequence types: strings, Unicode strings, lists,\ntuples, bytearrays, buffers, and xrange objects.\n\nFor other containers see the built in "dict" and "set" classes, and\nthe "collections" module.\n\nString literals are written in single or double quotes: "\'xyzzy\'",\n""frobozz"". See String literals for more about string literals.\nUnicode strings are much like strings, but are specified in the syntax\nusing a preceding "\'u\'" character: "u\'abc\'", "u"def"". In addition to\nthe functionality described here, there are also string-specific\nmethods described in the String Methods section. Lists are constructed\nwith square brackets, separating items with commas: "[a, b, c]".\nTuples are constructed by the comma operator (not within square\nbrackets), with or without enclosing parentheses, but an empty tuple\nmust have the enclosing parentheses, such as "a, b, c" or "()". A\nsingle item tuple must have a trailing comma, such as "(d,)".\n\nBytearray objects are created with the built-in function\n"bytearray()".\n\nBuffer objects are not directly supported by Python syntax, but can be\ncreated by calling the built-in function "buffer()". They don\'t\nsupport concatenation or repetition.\n\nObjects of type xrange are similar to buffers in that there is no\nspecific syntax to create them, but they are created using the\n"xrange()" function. They don\'t support slicing, concatenation or\nrepetition, and using "in", "not in", "min()" or "max()" on them is\ninefficient.\n\nMost sequence types support the following operations. The "in" and\n"not in" operations have the same priorities as the comparison\noperations. The "+" and "*" operations have the same priority as the\ncorresponding numeric operations. [3] Additional methods are provided\nfor Mutable Sequence Types.\n\nThis table lists the sequence operations sorted in ascending priority.\nIn the table, *s* and *t* are sequences of the same type; *n*, *i* and\n*j* are integers:\n\n+--------------------+----------------------------------+------------+\n| Operation | Result | Notes |\n+====================+==================================+============+\n| "x in s" | "True" if an item of *s* is | (1) |\n| | equal to *x*, else "False" | |\n+--------------------+----------------------------------+------------+\n| "x not in s" | "False" if an item of *s* is | (1) |\n| | equal to *x*, else "True" | |\n+--------------------+----------------------------------+------------+\n| "s + t" | the concatenation of *s* and *t* | (6) |\n+--------------------+----------------------------------+------------+\n| "s * n, n * s" | equivalent to adding *s* to | (2) |\n| | itself *n* times | |\n+--------------------+----------------------------------+------------+\n| "s[i]" | *i*th item of *s*, origin 0 | (3) |\n+--------------------+----------------------------------+------------+\n| "s[i:j]" | slice of *s* from *i* to *j* | (3)(4) |\n+--------------------+----------------------------------+------------+\n| "s[i:j:k]" | slice of *s* from *i* to *j* | (3)(5) |\n| | with step *k* | |\n+--------------------+----------------------------------+------------+\n| "len(s)" | length of *s* | |\n+--------------------+----------------------------------+------------+\n| "min(s)" | smallest item of *s* | |\n+--------------------+----------------------------------+------------+\n| "max(s)" | largest item of *s* | |\n+--------------------+----------------------------------+------------+\n| "s.index(x)" | index of the first occurrence of | |\n| | *x* in *s* | |\n+--------------------+----------------------------------+------------+\n| "s.count(x)" | total number of occurrences of | |\n| | *x* in *s* | |\n+--------------------+----------------------------------+------------+\n\nSequence types also support comparisons. In particular, tuples and\nlists are compared lexicographically by comparing corresponding\nelements. This means that to compare equal, every element must compare\nequal and the two sequences must be of the same type and have the same\nlength. (For full details see Comparisons in the language reference.)\n\nNotes:\n\n1. When *s* is a string or Unicode string object the "in" and "not\n in" operations act like a substring test. In Python versions\n before 2.3, *x* had to be a string of length 1. In Python 2.3 and\n beyond, *x* may be a string of any length.\n\n2. Values of *n* less than "0" are treated as "0" (which yields an\n empty sequence of the same type as *s*). Note that items in the\n sequence *s* are not copied; they are referenced multiple times.\n This often haunts new Python programmers; consider:\n\n >>> lists = [[]] * 3\n >>> lists\n [[], [], []]\n >>> lists[0].append(3)\n >>> lists\n [[3], [3], [3]]\n\n What has happened is that "[[]]" is a one-element list containing\n an empty list, so all three elements of "[[]] * 3" are references\n to this single empty list. Modifying any of the elements of\n "lists" modifies this single list. You can create a list of\n different lists this way:\n\n >>> lists = [[] for i in range(3)]\n >>> lists[0].append(3)\n >>> lists[1].append(5)\n >>> lists[2].append(7)\n >>> lists\n [[3], [5], [7]]\n\n Further explanation is available in the FAQ entry How do I create a\n multidimensional list?.\n\n3. If *i* or *j* is negative, the index is relative to the end of\n the string: "len(s) + i" or "len(s) + j" is substituted. But note\n that "-0" is still "0".\n\n4. The slice of *s* from *i* to *j* is defined as the sequence of\n items with index *k* such that "i <= k < j". If *i* or *j* is\n greater than "len(s)", use "len(s)". If *i* is omitted or "None",\n use "0". If *j* is omitted or "None", use "len(s)". If *i* is\n greater than or equal to *j*, the slice is empty.\n\n5. The slice of *s* from *i* to *j* with step *k* is defined as the\n sequence of items with index "x = i + n*k" such that "0 <= n <\n (j-i)/k". In other words, the indices are "i", "i+k", "i+2*k",\n "i+3*k" and so on, stopping when *j* is reached (but never\n including *j*). If *i* or *j* is greater than "len(s)", use\n "len(s)". If *i* or *j* are omitted or "None", they become "end"\n values (which end depends on the sign of *k*). Note, *k* cannot be\n zero. If *k* is "None", it is treated like "1".\n\n6. **CPython implementation detail:** If *s* and *t* are both\n strings, some Python implementations such as CPython can usually\n perform an in-place optimization for assignments of the form "s = s\n + t" or "s += t". When applicable, this optimization makes\n quadratic run-time much less likely. This optimization is both\n version and implementation dependent. For performance sensitive\n code, it is preferable to use the "str.join()" method which assures\n consistent linear concatenation performance across versions and\n implementations.\n\n Changed in version 2.4: Formerly, string concatenation never\n occurred in-place.\n\n\nString Methods\n==============\n\nBelow are listed the string methods which both 8-bit strings and\nUnicode objects support. Some of them are also available on\n"bytearray" objects.\n\nIn addition, Python\'s strings support the sequence type methods\ndescribed in the Sequence Types --- str, unicode, list, tuple,\nbytearray, buffer, xrange section. To output formatted strings use\ntemplate strings or the "%" operator described in the String\nFormatting Operations section. Also, see the "re" module for string\nfunctions based on regular expressions.\n\nstr.capitalize()\n\n Return a copy of the string with its first character capitalized\n and the rest lowercased.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.center(width[, fillchar])\n\n Return centered in a string of length *width*. Padding is done\n using the specified *fillchar* (default is a space).\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.count(sub[, start[, end]])\n\n Return the number of non-overlapping occurrences of substring *sub*\n in the range [*start*, *end*]. Optional arguments *start* and\n *end* are interpreted as in slice notation.\n\nstr.decode([encoding[, errors]])\n\n Decodes the string using the codec registered for *encoding*.\n *encoding* defaults to the default string encoding. *errors* may\n be given to set a different error handling scheme. The default is\n "\'strict\'", meaning that encoding errors raise "UnicodeError".\n Other possible values are "\'ignore\'", "\'replace\'" and any other\n name registered via "codecs.register_error()", see section Codec\n Base Classes.\n\n New in version 2.2.\n\n Changed in version 2.3: Support for other error handling schemes\n added.\n\n Changed in version 2.7: Support for keyword arguments added.\n\nstr.encode([encoding[, errors]])\n\n Return an encoded version of the string. Default encoding is the\n current default string encoding. *errors* may be given to set a\n different error handling scheme. The default for *errors* is\n "\'strict\'", meaning that encoding errors raise a "UnicodeError".\n Other possible values are "\'ignore\'", "\'replace\'",\n "\'xmlcharrefreplace\'", "\'backslashreplace\'" and any other name\n registered via "codecs.register_error()", see section Codec Base\n Classes. For a list of possible encodings, see section Standard\n Encodings.\n\n New in version 2.0.\n\n Changed in version 2.3: Support for "\'xmlcharrefreplace\'" and\n "\'backslashreplace\'" and other error handling schemes added.\n\n Changed in version 2.7: Support for keyword arguments added.\n\nstr.endswith(suffix[, start[, end]])\n\n Return "True" if the string ends with the specified *suffix*,\n otherwise return "False". *suffix* can also be a tuple of suffixes\n to look for. With optional *start*, test beginning at that\n position. With optional *end*, stop comparing at that position.\n\n Changed in version 2.5: Accept tuples as *suffix*.\n\nstr.expandtabs([tabsize])\n\n Return a copy of the string where all tab characters are replaced\n by one or more spaces, depending on the current column and the\n given tab size. Tab positions occur every *tabsize* characters\n (default is 8, giving tab positions at columns 0, 8, 16 and so on).\n To expand the string, the current column is set to zero and the\n string is examined character by character. If the character is a\n tab ("\\t"), one or more space characters are inserted in the result\n until the current column is equal to the next tab position. (The\n tab character itself is not copied.) If the character is a newline\n ("\\n") or return ("\\r"), it is copied and the current column is\n reset to zero. Any other character is copied unchanged and the\n current column is incremented by one regardless of how the\n character is represented when printed.\n\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs()\n \'01 012 0123 01234\'\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs(4)\n \'01 012 0123 01234\'\n\nstr.find(sub[, start[, end]])\n\n Return the lowest index in the string where substring *sub* is\n found within the slice "s[start:end]". Optional arguments *start*\n and *end* are interpreted as in slice notation. Return "-1" if\n *sub* is not found.\n\n Note: The "find()" method should be used only if you need to know\n the position of *sub*. To check if *sub* is a substring or not,\n use the "in" operator:\n\n >>> \'Py\' in \'Python\'\n True\n\nstr.format(*args, **kwargs)\n\n Perform a string formatting operation. The string on which this\n method is called can contain literal text or replacement fields\n delimited by braces "{}". Each replacement field contains either\n the numeric index of a positional argument, or the name of a\n keyword argument. Returns a copy of the string where each\n replacement field is replaced with the string value of the\n corresponding argument.\n\n >>> "The sum of 1 + 2 is {0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\n See Format String Syntax for a description of the various\n formatting options that can be specified in format strings.\n\n This method of string formatting is the new standard in Python 3,\n and should be preferred to the "%" formatting described in String\n Formatting Operations in new code.\n\n New in version 2.6.\n\nstr.index(sub[, start[, end]])\n\n Like "find()", but raise "ValueError" when the substring is not\n found.\n\nstr.isalnum()\n\n Return true if all characters in the string are alphanumeric and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isalpha()\n\n Return true if all characters in the string are alphabetic and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isdigit()\n\n Return true if all characters in the string are digits and there is\n at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.islower()\n\n Return true if all cased characters [4] in the string are lowercase\n and there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isspace()\n\n Return true if there are only whitespace characters in the string\n and there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.istitle()\n\n Return true if the string is a titlecased string and there is at\n least one character, for example uppercase characters may only\n follow uncased characters and lowercase characters only cased ones.\n Return false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isupper()\n\n Return true if all cased characters [4] in the string are uppercase\n and there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.join(iterable)\n\n Return a string which is the concatenation of the strings in the\n *iterable* *iterable*. The separator between elements is the\n string providing this method.\n\nstr.ljust(width[, fillchar])\n\n Return the string left justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.lower()\n\n Return a copy of the string with all the cased characters [4]\n converted to lowercase.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.lstrip([chars])\n\n Return a copy of the string with leading characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a prefix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.lstrip()\n \'spacious \'\n >>> \'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.partition(sep)\n\n Split the string at the first occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing the string itself, followed by\n two empty strings.\n\n New in version 2.5.\n\nstr.replace(old, new[, count])\n\n Return a copy of the string with all occurrences of substring *old*\n replaced by *new*. If the optional argument *count* is given, only\n the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n Return the highest index in the string where substring *sub* is\n found, such that *sub* is contained within "s[start:end]".\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return "-1" on failure.\n\nstr.rindex(sub[, start[, end]])\n\n Like "rfind()" but raises "ValueError" when the substring *sub* is\n not found.\n\nstr.rjust(width[, fillchar])\n\n Return the string right justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.rpartition(sep)\n\n Split the string at the last occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing two empty strings, followed by\n the string itself.\n\n New in version 2.5.\n\nstr.rsplit([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n are done, the *rightmost* ones. If *sep* is not specified or\n "None", any whitespace string is a separator. Except for splitting\n from the right, "rsplit()" behaves like "split()" which is\n described in detail below.\n\n New in version 2.4.\n\nstr.rstrip([chars])\n\n Return a copy of the string with trailing characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a suffix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.rstrip()\n \' spacious\'\n >>> \'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.split([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit*\n splits are done (thus, the list will have at most "maxsplit+1"\n elements). If *maxsplit* is not specified or "-1", then there is\n no limit on the number of splits (all possible splits are made).\n\n If *sep* is given, consecutive delimiters are not grouped together\n and are deemed to delimit empty strings (for example,\n "\'1,,2\'.split(\',\')" returns "[\'1\', \'\', \'2\']"). The *sep* argument\n may consist of multiple characters (for example,\n "\'1<>2<>3\'.split(\'<>\')" returns "[\'1\', \'2\', \'3\']"). Splitting an\n empty string with a specified separator returns "[\'\']".\n\n If *sep* is not specified or is "None", a different splitting\n algorithm is applied: runs of consecutive whitespace are regarded\n as a single separator, and the result will contain no empty strings\n at the start or end if the string has leading or trailing\n whitespace. Consequently, splitting an empty string or a string\n consisting of just whitespace with a "None" separator returns "[]".\n\n For example, "\' 1 2 3 \'.split()" returns "[\'1\', \'2\', \'3\']", and\n "\' 1 2 3 \'.split(None, 1)" returns "[\'1\', \'2 3 \']".\n\nstr.splitlines([keepends])\n\n Return a list of the lines in the string, breaking at line\n boundaries. This method uses the *universal newlines* approach to\n splitting lines. Line breaks are not included in the resulting list\n unless *keepends* is given and true.\n\n For example, "\'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines()" returns "[\'ab\n c\', \'\', \'de fg\', \'kl\']", while the same call with\n "splitlines(True)" returns "[\'ab c\\n\', \'\\n\', \'de fg\\r\', \'kl\\r\\n\']".\n\n Unlike "split()" when a delimiter string *sep* is given, this\n method returns an empty list for the empty string, and a terminal\n line break does not result in an extra line.\n\nstr.startswith(prefix[, start[, end]])\n\n Return "True" if string starts with the *prefix*, otherwise return\n "False". *prefix* can also be a tuple of prefixes to look for.\n With optional *start*, test string beginning at that position.\n With optional *end*, stop comparing string at that position.\n\n Changed in version 2.5: Accept tuples as *prefix*.\n\nstr.strip([chars])\n\n Return a copy of the string with the leading and trailing\n characters removed. The *chars* argument is a string specifying the\n set of characters to be removed. If omitted or "None", the *chars*\n argument defaults to removing whitespace. The *chars* argument is\n not a prefix or suffix; rather, all combinations of its values are\n stripped:\n\n >>> \' spacious \'.strip()\n \'spacious\'\n >>> \'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.swapcase()\n\n Return a copy of the string with uppercase characters converted to\n lowercase and vice versa.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.title()\n\n Return a titlecased version of the string where words start with an\n uppercase character and the remaining characters are lowercase.\n\n The algorithm uses a simple language-independent definition of a\n word as groups of consecutive letters. The definition works in\n many contexts but it means that apostrophes in contractions and\n possessives form word boundaries, which may not be the desired\n result:\n\n >>> "they\'re bill\'s friends from the UK".title()\n "They\'Re Bill\'S Friends From The Uk"\n\n A workaround for apostrophes can be constructed using regular\n expressions:\n\n >>> import re\n >>> def titlecase(s):\n ... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n ... lambda mo: mo.group(0)[0].upper() +\n ... mo.group(0)[1:].lower(),\n ... s)\n ...\n >>> titlecase("they\'re bill\'s friends.")\n "They\'re Bill\'s Friends."\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.translate(table[, deletechars])\n\n Return a copy of the string where all characters occurring in the\n optional argument *deletechars* are removed, and the remaining\n characters have been mapped through the given translation table,\n which must be a string of length 256.\n\n You can use the "maketrans()" helper function in the "string"\n module to create a translation table. For string objects, set the\n *table* argument to "None" for translations that only delete\n characters:\n\n >>> \'read this short text\'.translate(None, \'aeiou\')\n \'rd ths shrt txt\'\n\n New in version 2.6: Support for a "None" *table* argument.\n\n For Unicode objects, the "translate()" method does not accept the\n optional *deletechars* argument. Instead, it returns a copy of the\n *s* where all characters have been mapped through the given\n translation table which must be a mapping of Unicode ordinals to\n Unicode ordinals, Unicode strings or "None". Unmapped characters\n are left untouched. Characters mapped to "None" are deleted. Note,\n a more flexible approach is to create a custom character mapping\n codec using the "codecs" module (see "encodings.cp1251" for an\n example).\n\nstr.upper()\n\n Return a copy of the string with all the cased characters [4]\n converted to uppercase. Note that "str.upper().isupper()" might be\n "False" if "s" contains uncased characters or if the Unicode\n category of the resulting character(s) is not "Lu" (Letter,\n uppercase), but e.g. "Lt" (Letter, titlecase).\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.zfill(width)\n\n Return the numeric string left filled with zeros in a string of\n length *width*. A sign prefix is handled correctly. The original\n string is returned if *width* is less than or equal to "len(s)".\n\n New in version 2.2.2.\n\nThe following methods are present only on unicode objects:\n\nunicode.isnumeric()\n\n Return "True" if there are only numeric characters in S, "False"\n otherwise. Numeric characters include digit characters, and all\n characters that have the Unicode numeric value property, e.g.\n U+2155, VULGAR FRACTION ONE FIFTH.\n\nunicode.isdecimal()\n\n Return "True" if there are only decimal characters in S, "False"\n otherwise. Decimal characters include digit characters, and all\n characters that can be used to form decimal-radix numbers, e.g.\n U+0660, ARABIC-INDIC DIGIT ZERO.\n\n\nString Formatting Operations\n============================\n\nString and Unicode objects have one unique built-in operation: the "%"\noperator (modulo). This is also known as the string *formatting* or\n*interpolation* operator. Given "format % values" (where *format* is\na string or Unicode object), "%" conversion specifications in *format*\nare replaced with zero or more elements of *values*. The effect is\nsimilar to the using "sprintf()" in the C language. If *format* is a\nUnicode object, or if any of the objects being converted using the\n"%s" conversion are Unicode objects, the result will also be a Unicode\nobject.\n\nIf *format* requires a single argument, *values* may be a single non-\ntuple object. [5] Otherwise, *values* must be a tuple with exactly\nthe number of items specified by the format string, or a single\nmapping object (for example, a dictionary).\n\nA conversion specifier contains two or more characters and has the\nfollowing components, which must occur in this order:\n\n1. The "\'%\'" character, which marks the start of the specifier.\n\n2. Mapping key (optional), consisting of a parenthesised sequence\n of characters (for example, "(somename)").\n\n3. Conversion flags (optional), which affect the result of some\n conversion types.\n\n4. Minimum field width (optional). If specified as an "\'*\'"\n (asterisk), the actual width is read from the next element of the\n tuple in *values*, and the object to convert comes after the\n minimum field width and optional precision.\n\n5. Precision (optional), given as a "\'.\'" (dot) followed by the\n precision. If specified as "\'*\'" (an asterisk), the actual width\n is read from the next element of the tuple in *values*, and the\n value to convert comes after the precision.\n\n6. Length modifier (optional).\n\n7. Conversion type.\n\nWhen the right argument is a dictionary (or other mapping type), then\nthe formats in the string *must* include a parenthesised mapping key\ninto that dictionary inserted immediately after the "\'%\'" character.\nThe mapping key selects the value to be formatted from the mapping.\nFor example:\n\n>>> print \'%(language)s has %(number)03d quote types.\' % \\\n... {"language": "Python", "number": 2}\nPython has 002 quote types.\n\nIn this case no "*" specifiers may occur in a format (since they\nrequire a sequential parameter list).\n\nThe conversion flag characters are:\n\n+-----------+-----------------------------------------------------------------------+\n| Flag | Meaning |\n+===========+=======================================================================+\n| "\'#\'" | The value conversion will use the "alternate form" (where defined |\n| | below). |\n+-----------+-----------------------------------------------------------------------+\n| "\'0\'" | The conversion will be zero padded for numeric values. |\n+-----------+-----------------------------------------------------------------------+\n| "\'-\'" | The converted value is left adjusted (overrides the "\'0\'" conversion |\n| | if both are given). |\n+-----------+-----------------------------------------------------------------------+\n| "\' \'" | (a space) A blank should be left before a positive number (or empty |\n| | string) produced by a signed conversion. |\n+-----------+-----------------------------------------------------------------------+\n| "\'+\'" | A sign character ("\'+\'" or "\'-\'") will precede the conversion |\n| | (overrides a "space" flag). |\n+-----------+-----------------------------------------------------------------------+\n\nA length modifier ("h", "l", or "L") may be present, but is ignored as\nit is not necessary for Python -- so e.g. "%ld" is identical to "%d".\n\nThe conversion types are:\n\n+--------------+-------------------------------------------------------+---------+\n| Conversion | Meaning | Notes |\n+==============+=======================================================+=========+\n| "\'d\'" | Signed integer decimal. | |\n+--------------+-------------------------------------------------------+---------+\n| "\'i\'" | Signed integer decimal. | |\n+--------------+-------------------------------------------------------+---------+\n| "\'o\'" | Signed octal value. | (1) |\n+--------------+-------------------------------------------------------+---------+\n| "\'u\'" | Obsolete type -- it is identical to "\'d\'". | (7) |\n+--------------+-------------------------------------------------------+---------+\n| "\'x\'" | Signed hexadecimal (lowercase). | (2) |\n+--------------+-------------------------------------------------------+---------+\n| "\'X\'" | Signed hexadecimal (uppercase). | (2) |\n+--------------+-------------------------------------------------------+---------+\n| "\'e\'" | Floating point exponential format (lowercase). | (3) |\n+--------------+-------------------------------------------------------+---------+\n| "\'E\'" | Floating point exponential format (uppercase). | (3) |\n+--------------+-------------------------------------------------------+---------+\n| "\'f\'" | Floating point decimal format. | (3) |\n+--------------+-------------------------------------------------------+---------+\n| "\'F\'" | Floating point decimal format. | (3) |\n+--------------+-------------------------------------------------------+---------+\n| "\'g\'" | Floating point format. Uses lowercase exponential | (4) |\n| | format if exponent is less than -4 or not less than | |\n| | precision, decimal format otherwise. | |\n+--------------+-------------------------------------------------------+---------+\n| "\'G\'" | Floating point format. Uses uppercase exponential | (4) |\n| | format if exponent is less than -4 or not less than | |\n| | precision, decimal format otherwise. | |\n+--------------+-------------------------------------------------------+---------+\n| "\'c\'" | Single character (accepts integer or single character | |\n| | string). | |\n+--------------+-------------------------------------------------------+---------+\n| "\'r\'" | String (converts any Python object using repr()). | (5) |\n+--------------+-------------------------------------------------------+---------+\n| "\'s\'" | String (converts any Python object using "str()"). | (6) |\n+--------------+-------------------------------------------------------+---------+\n| "\'%\'" | No argument is converted, results in a "\'%\'" | |\n| | character in the result. | |\n+--------------+-------------------------------------------------------+---------+\n\nNotes:\n\n1. The alternate form causes a leading zero ("\'0\'") to be inserted\n between left-hand padding and the formatting of the number if the\n leading character of the result is not already a zero.\n\n2. The alternate form causes a leading "\'0x\'" or "\'0X\'" (depending\n on whether the "\'x\'" or "\'X\'" format was used) to be inserted\n between left-hand padding and the formatting of the number if the\n leading character of the result is not already a zero.\n\n3. The alternate form causes the result to always contain a decimal\n point, even if no digits follow it.\n\n The precision determines the number of digits after the decimal\n point and defaults to 6.\n\n4. The alternate form causes the result to always contain a decimal\n point, and trailing zeroes are not removed as they would otherwise\n be.\n\n The precision determines the number of significant digits before\n and after the decimal point and defaults to 6.\n\n5. The "%r" conversion was added in Python 2.0.\n\n The precision determines the maximal number of characters used.\n\n6. If the object or format provided is a "unicode" string, the\n resulting string will also be "unicode".\n\n The precision determines the maximal number of characters used.\n\n7. See **PEP 237**.\n\nSince Python strings have an explicit length, "%s" conversions do not\nassume that "\'\\0\'" is the end of the string.\n\nChanged in version 2.7: "%f" conversions for numbers whose absolute\nvalue is over 1e50 are no longer replaced by "%g" conversions.\n\nAdditional string operations are defined in standard modules "string"\nand "re".\n\n\nXRange Type\n===========\n\nThe "xrange" type is an immutable sequence which is commonly used for\nlooping. The advantage of the "xrange" type is that an "xrange"\nobject will always take the same amount of memory, no matter the size\nof the range it represents. There are no consistent performance\nadvantages.\n\nXRange objects have very little behavior: they only support indexing,\niteration, and the "len()" function.\n\n\nMutable Sequence Types\n======================\n\nList and "bytearray" objects support additional operations that allow\nin-place modification of the object. Other mutable sequence types\n(when added to the language) should also support these operations.\nStrings and tuples are immutable sequence types: such objects cannot\nbe modified once created. The following operations are defined on\nmutable sequence types (where *x* is an arbitrary object):\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| "s[i] = x" | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j] = t" | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j]" | same as "s[i:j] = []" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j:k] = t" | the elements of "s[i:j:k]" are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j:k]" | removes the elements of | |\n| | "s[i:j:k]" from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.append(x)" | same as "s[len(s):len(s)] = [x]" | (2) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.extend(x)" or "s += t" | for the most part the same as | (3) |\n| | "s[len(s):len(s)] = x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s *= n" | updates *s* with its contents | (11) |\n| | repeated *n* times | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.count(x)" | return number of *i*\'s for which | |\n| | "s[i] == x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.index(x[, i[, j]])" | return smallest *k* such that | (4) |\n| | "s[k] == x" and "i <= k < j" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.insert(i, x)" | same as "s[i:i] = [x]" | (5) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.pop([i])" | same as "x = s[i]; del s[i]; | (6) |\n| | return x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.remove(x)" | same as "del s[s.index(x)]" | (4) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.reverse()" | reverses the items of *s* in | (7) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.sort([cmp[, key[, | sort the items of *s* in place | (7)(8)(9)(10) |\n| reverse]]])" | | |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. The C implementation of Python has historically accepted\n multiple parameters and implicitly joined them into a tuple; this\n no longer works in Python 2.0. Use of this misfeature has been\n deprecated since Python 1.4.\n\n3. *x* can be any iterable object.\n\n4. Raises "ValueError" when *x* is not found in *s*. When a\n negative index is passed as the second or third parameter to the\n "index()" method, the list length is added, as for slice indices.\n If it is still negative, it is truncated to zero, as for slice\n indices.\n\n Changed in version 2.3: Previously, "index()" didn\'t have arguments\n for specifying start and stop positions.\n\n5. When a negative index is passed as the first parameter to the\n "insert()" method, the list length is added, as for slice indices.\n If it is still negative, it is truncated to zero, as for slice\n indices.\n\n Changed in version 2.3: Previously, all negative indices were\n truncated to zero.\n\n6. The "pop()" method\'s optional argument *i* defaults to "-1", so\n that by default the last item is removed and returned.\n\n7. The "sort()" and "reverse()" methods modify the list in place\n for economy of space when sorting or reversing a large list. To\n remind you that they operate by side effect, they don\'t return the\n sorted or reversed list.\n\n8. The "sort()" method takes optional arguments for controlling the\n comparisons.\n\n *cmp* specifies a custom comparison function of two arguments (list\n items) which should return a negative, zero or positive number\n depending on whether the first argument is considered smaller than,\n equal to, or larger than the second argument: "cmp=lambda x,y:\n cmp(x.lower(), y.lower())". The default value is "None".\n\n *key* specifies a function of one argument that is used to extract\n a comparison key from each list element: "key=str.lower". The\n default value is "None".\n\n *reverse* is a boolean value. If set to "True", then the list\n elements are sorted as if each comparison were reversed.\n\n In general, the *key* and *reverse* conversion processes are much\n faster than specifying an equivalent *cmp* function. This is\n because *cmp* is called multiple times for each list element while\n *key* and *reverse* touch each element only once. Use\n "functools.cmp_to_key()" to convert an old-style *cmp* function to\n a *key* function.\n\n Changed in version 2.3: Support for "None" as an equivalent to\n omitting *cmp* was added.\n\n Changed in version 2.4: Support for *key* and *reverse* was added.\n\n9. Starting with Python 2.3, the "sort()" method is guaranteed to\n be stable. A sort is stable if it guarantees not to change the\n relative order of elements that compare equal --- this is helpful\n for sorting in multiple passes (for example, sort by department,\n then by salary grade).\n\n10. **CPython implementation detail:** While a list is being\n sorted, the effect of attempting to mutate, or even inspect, the\n list is undefined. The C implementation of Python 2.3 and newer\n makes the list appear empty for the duration, and raises\n "ValueError" if it can detect that the list has been mutated\n during a sort.\n\n11. The value *n* is an integer, or an object implementing\n "__index__()". Zero and negative values of *n* clear the\n sequence. Items in the sequence are not copied; they are\n referenced multiple times, as explained for "s * n" under Sequence\n Types --- str, unicode, list, tuple, bytearray, buffer, xrange.\n', - 'typesseq-mutable': u'\nMutable Sequence Types\n**********************\n\nList and "bytearray" objects support additional operations that allow\nin-place modification of the object. Other mutable sequence types\n(when added to the language) should also support these operations.\nStrings and tuples are immutable sequence types: such objects cannot\nbe modified once created. The following operations are defined on\nmutable sequence types (where *x* is an arbitrary object):\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| "s[i] = x" | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j] = t" | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j]" | same as "s[i:j] = []" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j:k] = t" | the elements of "s[i:j:k]" are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j:k]" | removes the elements of | |\n| | "s[i:j:k]" from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.append(x)" | same as "s[len(s):len(s)] = [x]" | (2) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.extend(x)" or "s += t" | for the most part the same as | (3) |\n| | "s[len(s):len(s)] = x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s *= n" | updates *s* with its contents | (11) |\n| | repeated *n* times | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.count(x)" | return number of *i*\'s for which | |\n| | "s[i] == x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.index(x[, i[, j]])" | return smallest *k* such that | (4) |\n| | "s[k] == x" and "i <= k < j" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.insert(i, x)" | same as "s[i:i] = [x]" | (5) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.pop([i])" | same as "x = s[i]; del s[i]; | (6) |\n| | return x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.remove(x)" | same as "del s[s.index(x)]" | (4) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.reverse()" | reverses the items of *s* in | (7) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.sort([cmp[, key[, | sort the items of *s* in place | (7)(8)(9)(10) |\n| reverse]]])" | | |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. The C implementation of Python has historically accepted\n multiple parameters and implicitly joined them into a tuple; this\n no longer works in Python 2.0. Use of this misfeature has been\n deprecated since Python 1.4.\n\n3. *x* can be any iterable object.\n\n4. Raises "ValueError" when *x* is not found in *s*. When a\n negative index is passed as the second or third parameter to the\n "index()" method, the list length is added, as for slice indices.\n If it is still negative, it is truncated to zero, as for slice\n indices.\n\n Changed in version 2.3: Previously, "index()" didn\'t have arguments\n for specifying start and stop positions.\n\n5. When a negative index is passed as the first parameter to the\n "insert()" method, the list length is added, as for slice indices.\n If it is still negative, it is truncated to zero, as for slice\n indices.\n\n Changed in version 2.3: Previously, all negative indices were\n truncated to zero.\n\n6. The "pop()" method\'s optional argument *i* defaults to "-1", so\n that by default the last item is removed and returned.\n\n7. The "sort()" and "reverse()" methods modify the list in place\n for economy of space when sorting or reversing a large list. To\n remind you that they operate by side effect, they don\'t return the\n sorted or reversed list.\n\n8. The "sort()" method takes optional arguments for controlling the\n comparisons.\n\n *cmp* specifies a custom comparison function of two arguments (list\n items) which should return a negative, zero or positive number\n depending on whether the first argument is considered smaller than,\n equal to, or larger than the second argument: "cmp=lambda x,y:\n cmp(x.lower(), y.lower())". The default value is "None".\n\n *key* specifies a function of one argument that is used to extract\n a comparison key from each list element: "key=str.lower". The\n default value is "None".\n\n *reverse* is a boolean value. If set to "True", then the list\n elements are sorted as if each comparison were reversed.\n\n In general, the *key* and *reverse* conversion processes are much\n faster than specifying an equivalent *cmp* function. This is\n because *cmp* is called multiple times for each list element while\n *key* and *reverse* touch each element only once. Use\n "functools.cmp_to_key()" to convert an old-style *cmp* function to\n a *key* function.\n\n Changed in version 2.3: Support for "None" as an equivalent to\n omitting *cmp* was added.\n\n Changed in version 2.4: Support for *key* and *reverse* was added.\n\n9. Starting with Python 2.3, the "sort()" method is guaranteed to\n be stable. A sort is stable if it guarantees not to change the\n relative order of elements that compare equal --- this is helpful\n for sorting in multiple passes (for example, sort by department,\n then by salary grade).\n\n10. **CPython implementation detail:** While a list is being\n sorted, the effect of attempting to mutate, or even inspect, the\n list is undefined. The C implementation of Python 2.3 and newer\n makes the list appear empty for the duration, and raises\n "ValueError" if it can detect that the list has been mutated\n during a sort.\n\n11. The value *n* is an integer, or an object implementing\n "__index__()". Zero and negative values of *n* clear the\n sequence. Items in the sequence are not copied; they are\n referenced multiple times, as explained for "s * n" under Sequence\n Types --- str, unicode, list, tuple, bytearray, buffer, xrange.\n', - 'unary': u'\nUnary arithmetic and bitwise operations\n***************************************\n\nAll unary arithmetic and bitwise operations have the same priority:\n\n u_expr ::= power | "-" u_expr | "+" u_expr | "~" u_expr\n\nThe unary "-" (minus) operator yields the negation of its numeric\nargument.\n\nThe unary "+" (plus) operator yields its numeric argument unchanged.\n\nThe unary "~" (invert) operator yields the bitwise inversion of its\nplain or long integer argument. The bitwise inversion of "x" is\ndefined as "-(x+1)". It only applies to integral numbers.\n\nIn all three cases, if the argument does not have the proper type, a\n"TypeError" exception is raised.\n', - 'while': u'\nThe "while" statement\n*********************\n\nThe "while" statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the "else" clause, if present, is executed\nand the loop terminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and goes back\nto testing the expression.\n', - 'with': u'\nThe "with" statement\n********************\n\nNew in version 2.5.\n\nThe "with" statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section With Statement\nContext Managers). This allows common "try"..."except"..."finally"\nusage patterns to be encapsulated for convenient reuse.\n\n with_stmt ::= "with" with_item ("," with_item)* ":" suite\n with_item ::= expression ["as" target]\n\nThe execution of the "with" statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the "with_item")\n is evaluated to obtain a context manager.\n\n2. The context manager\'s "__exit__()" is loaded for later use.\n\n3. The context manager\'s "__enter__()" method is invoked.\n\n4. If a target was included in the "with" statement, the return\n value from "__enter__()" is assigned to it.\n\n Note: The "with" statement guarantees that if the "__enter__()"\n method returns without an error, then "__exit__()" will always be\n called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s "__exit__()" method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to "__exit__()". Otherwise, three\n "None" arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the "__exit__()" method was false, the exception is reraised.\n If the return value was true, the exception is suppressed, and\n execution continues with the statement following the "with"\n statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from "__exit__()" is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple "with" statements were nested:\n\n with A() as a, B() as b:\n suite\n\nis equivalent to\n\n with A() as a:\n with B() as b:\n suite\n\nNote: In Python 2.5, the "with" statement is only allowed when the\n "with_statement" feature has been enabled. It is always enabled in\n Python 2.6.\n\nChanged in version 2.7: Support for multiple context expressions.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python "with"\n statement.\n', - 'yield': u'\nThe "yield" statement\n*********************\n\n yield_stmt ::= yield_expression\n\nThe "yield" statement is only used when defining a generator function,\nand is only used in the body of the generator function. Using a\n"yield" statement in a function definition is sufficient to cause that\ndefinition to create a generator function instead of a normal\nfunction.\n\nWhen a generator function is called, it returns an iterator known as a\ngenerator iterator, or more commonly, a generator. The body of the\ngenerator function is executed by calling the generator\'s "next()"\nmethod repeatedly until it raises an exception.\n\nWhen a "yield" statement is executed, the state of the generator is\nfrozen and the value of "expression_list" is returned to "next()"\'s\ncaller. By "frozen" we mean that all local state is retained,\nincluding the current bindings of local variables, the instruction\npointer, and the internal evaluation stack: enough information is\nsaved so that the next time "next()" is invoked, the function can\nproceed exactly as if the "yield" statement were just another external\ncall.\n\nAs of Python version 2.5, the "yield" statement is now allowed in the\n"try" clause of a "try" ... "finally" construct. If the generator is\nnot resumed before it is finalized (by reaching a zero reference count\nor by being garbage collected), the generator-iterator\'s "close()"\nmethod will be called, allowing any pending "finally" clauses to\nexecute.\n\nFor full details of "yield" semantics, refer to the Yield expressions\nsection.\n\nNote: In Python 2.2, the "yield" statement was only allowed when the\n "generators" feature has been enabled. This "__future__" import\n statement was used to enable the feature:\n\n from __future__ import generators\n\nSee also:\n\n **PEP 0255** - Simple Generators\n The proposal for adding generators and the "yield" statement to\n Python.\n\n **PEP 0342** - Coroutines via Enhanced Generators\n The proposal that, among other generator enhancements, proposed\n allowing "yield" to appear inside a "try" ... "finally" block.\n'} +# Autogenerated by Sphinx on Sat Jun 11 14:41:12 2016 +topics = {'assert': '\n' + 'The "assert" statement\n' + '**********************\n' + '\n' + 'Assert statements are a convenient way to insert debugging ' + 'assertions\n' + 'into a program:\n' + '\n' + ' assert_stmt ::= "assert" expression ["," expression]\n' + '\n' + 'The simple form, "assert expression", is equivalent to\n' + '\n' + ' if __debug__:\n' + ' if not expression: raise AssertionError\n' + '\n' + 'The extended form, "assert expression1, expression2", is ' + 'equivalent to\n' + '\n' + ' if __debug__:\n' + ' if not expression1: raise AssertionError(expression2)\n' + '\n' + 'These equivalences assume that "__debug__" and "AssertionError" ' + 'refer\n' + 'to the built-in variables with those names. In the current\n' + 'implementation, the built-in variable "__debug__" is "True" under\n' + 'normal circumstances, "False" when optimization is requested ' + '(command\n' + 'line option -O). The current code generator emits no code for an\n' + 'assert statement when optimization is requested at compile time. ' + 'Note\n' + 'that it is unnecessary to include the source code for the ' + 'expression\n' + 'that failed in the error message; it will be displayed as part of ' + 'the\n' + 'stack trace.\n' + '\n' + 'Assignments to "__debug__" are illegal. The value for the ' + 'built-in\n' + 'variable is determined when the interpreter starts.\n', + 'assignment': '\n' + 'Assignment statements\n' + '*********************\n' + '\n' + 'Assignment statements are used to (re)bind names to values and ' + 'to\n' + 'modify attributes or items of mutable objects:\n' + '\n' + ' assignment_stmt ::= (target_list "=")+ (expression_list | ' + 'yield_expression)\n' + ' target_list ::= target ("," target)* [","]\n' + ' target ::= identifier\n' + ' | "(" target_list ")"\n' + ' | "[" [target_list] "]"\n' + ' | attributeref\n' + ' | subscription\n' + ' | slicing\n' + '\n' + '(See section Primaries for the syntax definitions for the last ' + 'three\n' + 'symbols.)\n' + '\n' + 'An assignment statement evaluates the expression list ' + '(remember that\n' + 'this can be a single expression or a comma-separated list, the ' + 'latter\n' + 'yielding a tuple) and assigns the single resulting object to ' + 'each of\n' + 'the target lists, from left to right.\n' + '\n' + 'Assignment is defined recursively depending on the form of the ' + 'target\n' + '(list). When a target is part of a mutable object (an ' + 'attribute\n' + 'reference, subscription or slicing), the mutable object must\n' + 'ultimately perform the assignment and decide about its ' + 'validity, and\n' + 'may raise an exception if the assignment is unacceptable. The ' + 'rules\n' + 'observed by various types and the exceptions raised are given ' + 'with the\n' + 'definition of the object types (see section The standard type\n' + 'hierarchy).\n' + '\n' + 'Assignment of an object to a target list is recursively ' + 'defined as\n' + 'follows.\n' + '\n' + '* If the target list is a single target: The object is ' + 'assigned to\n' + ' that target.\n' + '\n' + '* If the target list is a comma-separated list of targets: ' + 'The\n' + ' object must be an iterable with the same number of items as ' + 'there\n' + ' are targets in the target list, and the items are assigned, ' + 'from\n' + ' left to right, to the corresponding targets.\n' + '\n' + 'Assignment of an object to a single target is recursively ' + 'defined as\n' + 'follows.\n' + '\n' + '* If the target is an identifier (name):\n' + '\n' + ' * If the name does not occur in a "global" statement in the\n' + ' current code block: the name is bound to the object in the ' + 'current\n' + ' local namespace.\n' + '\n' + ' * Otherwise: the name is bound to the object in the current ' + 'global\n' + ' namespace.\n' + '\n' + ' The name is rebound if it was already bound. This may cause ' + 'the\n' + ' reference count for the object previously bound to the name ' + 'to reach\n' + ' zero, causing the object to be deallocated and its ' + 'destructor (if it\n' + ' has one) to be called.\n' + '\n' + '* If the target is a target list enclosed in parentheses or ' + 'in\n' + ' square brackets: The object must be an iterable with the ' + 'same number\n' + ' of items as there are targets in the target list, and its ' + 'items are\n' + ' assigned, from left to right, to the corresponding targets.\n' + '\n' + '* If the target is an attribute reference: The primary ' + 'expression in\n' + ' the reference is evaluated. It should yield an object with\n' + ' assignable attributes; if this is not the case, "TypeError" ' + 'is\n' + ' raised. That object is then asked to assign the assigned ' + 'object to\n' + ' the given attribute; if it cannot perform the assignment, it ' + 'raises\n' + ' an exception (usually but not necessarily ' + '"AttributeError").\n' + '\n' + ' Note: If the object is a class instance and the attribute ' + 'reference\n' + ' occurs on both sides of the assignment operator, the RHS ' + 'expression,\n' + ' "a.x" can access either an instance attribute or (if no ' + 'instance\n' + ' attribute exists) a class attribute. The LHS target "a.x" ' + 'is always\n' + ' set as an instance attribute, creating it if necessary. ' + 'Thus, the\n' + ' two occurrences of "a.x" do not necessarily refer to the ' + 'same\n' + ' attribute: if the RHS expression refers to a class ' + 'attribute, the\n' + ' LHS creates a new instance attribute as the target of the\n' + ' assignment:\n' + '\n' + ' class Cls:\n' + ' x = 3 # class variable\n' + ' inst = Cls()\n' + ' inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x ' + 'as 3\n' + '\n' + ' This description does not necessarily apply to descriptor\n' + ' attributes, such as properties created with "property()".\n' + '\n' + '* If the target is a subscription: The primary expression in ' + 'the\n' + ' reference is evaluated. It should yield either a mutable ' + 'sequence\n' + ' object (such as a list) or a mapping object (such as a ' + 'dictionary).\n' + ' Next, the subscript expression is evaluated.\n' + '\n' + ' If the primary is a mutable sequence object (such as a ' + 'list), the\n' + ' subscript must yield a plain integer. If it is negative, ' + 'the\n' + " sequence's length is added to it. The resulting value must " + 'be a\n' + " nonnegative integer less than the sequence's length, and " + 'the\n' + ' sequence is asked to assign the assigned object to its item ' + 'with\n' + ' that index. If the index is out of range, "IndexError" is ' + 'raised\n' + ' (assignment to a subscripted sequence cannot add new items ' + 'to a\n' + ' list).\n' + '\n' + ' If the primary is a mapping object (such as a dictionary), ' + 'the\n' + " subscript must have a type compatible with the mapping's key " + 'type,\n' + ' and the mapping is then asked to create a key/datum pair ' + 'which maps\n' + ' the subscript to the assigned object. This can either ' + 'replace an\n' + ' existing key/value pair with the same key value, or insert a ' + 'new\n' + ' key/value pair (if no key with the same value existed).\n' + '\n' + '* If the target is a slicing: The primary expression in the\n' + ' reference is evaluated. It should yield a mutable sequence ' + 'object\n' + ' (such as a list). The assigned object should be a sequence ' + 'object\n' + ' of the same type. Next, the lower and upper bound ' + 'expressions are\n' + ' evaluated, insofar they are present; defaults are zero and ' + 'the\n' + " sequence's length. The bounds should evaluate to (small) " + 'integers.\n' + " If either bound is negative, the sequence's length is added " + 'to it.\n' + ' The resulting bounds are clipped to lie between zero and ' + 'the\n' + " sequence's length, inclusive. Finally, the sequence object " + 'is asked\n' + ' to replace the slice with the items of the assigned ' + 'sequence. The\n' + ' length of the slice may be different from the length of the ' + 'assigned\n' + ' sequence, thus changing the length of the target sequence, ' + 'if the\n' + ' object allows it.\n' + '\n' + '**CPython implementation detail:** In the current ' + 'implementation, the\n' + 'syntax for targets is taken to be the same as for expressions, ' + 'and\n' + 'invalid syntax is rejected during the code generation phase, ' + 'causing\n' + 'less detailed error messages.\n' + '\n' + 'WARNING: Although the definition of assignment implies that ' + 'overlaps\n' + "between the left-hand side and the right-hand side are 'safe' " + '(for\n' + 'example "a, b = b, a" swaps two variables), overlaps *within* ' + 'the\n' + 'collection of assigned-to variables are not safe! For ' + 'instance, the\n' + 'following program prints "[0, 2]":\n' + '\n' + ' x = [0, 1]\n' + ' i = 0\n' + ' i, x[i] = 1, 2\n' + ' print x\n' + '\n' + '\n' + 'Augmented assignment statements\n' + '===============================\n' + '\n' + 'Augmented assignment is the combination, in a single ' + 'statement, of a\n' + 'binary operation and an assignment statement:\n' + '\n' + ' augmented_assignment_stmt ::= augtarget augop ' + '(expression_list | yield_expression)\n' + ' augtarget ::= identifier | attributeref | ' + 'subscription | slicing\n' + ' augop ::= "+=" | "-=" | "*=" | "/=" | ' + '"//=" | "%=" | "**="\n' + ' | ">>=" | "<<=" | "&=" | "^=" | "|="\n' + '\n' + '(See section Primaries for the syntax definitions for the last ' + 'three\n' + 'symbols.)\n' + '\n' + 'An augmented assignment evaluates the target (which, unlike ' + 'normal\n' + 'assignment statements, cannot be an unpacking) and the ' + 'expression\n' + 'list, performs the binary operation specific to the type of ' + 'assignment\n' + 'on the two operands, and assigns the result to the original ' + 'target.\n' + 'The target is only evaluated once.\n' + '\n' + 'An augmented assignment expression like "x += 1" can be ' + 'rewritten as\n' + '"x = x + 1" to achieve a similar, but not exactly equal ' + 'effect. In the\n' + 'augmented version, "x" is only evaluated once. Also, when ' + 'possible,\n' + 'the actual operation is performed *in-place*, meaning that ' + 'rather than\n' + 'creating a new object and assigning that to the target, the ' + 'old object\n' + 'is modified instead.\n' + '\n' + 'With the exception of assigning to tuples and multiple targets ' + 'in a\n' + 'single statement, the assignment done by augmented assignment\n' + 'statements is handled the same way as normal assignments. ' + 'Similarly,\n' + 'with the exception of the possible *in-place* behavior, the ' + 'binary\n' + 'operation performed by augmented assignment is the same as the ' + 'normal\n' + 'binary operations.\n' + '\n' + 'For targets which are attribute references, the same caveat ' + 'about\n' + 'class and instance attributes applies as for regular ' + 'assignments.\n', + 'atom-identifiers': '\n' + 'Identifiers (Names)\n' + '*******************\n' + '\n' + 'An identifier occurring as an atom is a name. See ' + 'section Identifiers\n' + 'and keywords for lexical definition and section Naming ' + 'and binding for\n' + 'documentation of naming and binding.\n' + '\n' + 'When the name is bound to an object, evaluation of the ' + 'atom yields\n' + 'that object. When a name is not bound, an attempt to ' + 'evaluate it\n' + 'raises a "NameError" exception.\n' + '\n' + '**Private name mangling:** When an identifier that ' + 'textually occurs in\n' + 'a class definition begins with two or more underscore ' + 'characters and\n' + 'does not end in two or more underscores, it is ' + 'considered a *private\n' + 'name* of that class. Private names are transformed to a ' + 'longer form\n' + 'before code is generated for them. The transformation ' + 'inserts the\n' + 'class name, with leading underscores removed and a ' + 'single underscore\n' + 'inserted, in front of the name. For example, the ' + 'identifier "__spam"\n' + 'occurring in a class named "Ham" will be transformed to ' + '"_Ham__spam".\n' + 'This transformation is independent of the syntactical ' + 'context in which\n' + 'the identifier is used. If the transformed name is ' + 'extremely long\n' + '(longer than 255 characters), implementation defined ' + 'truncation may\n' + 'happen. If the class name consists only of underscores, ' + 'no\n' + 'transformation is done.\n', + 'atom-literals': '\n' + 'Literals\n' + '********\n' + '\n' + 'Python supports string literals and various numeric ' + 'literals:\n' + '\n' + ' literal ::= stringliteral | integer | longinteger\n' + ' | floatnumber | imagnumber\n' + '\n' + 'Evaluation of a literal yields an object of the given type ' + '(string,\n' + 'integer, long integer, floating point number, complex ' + 'number) with the\n' + 'given value. The value may be approximated in the case of ' + 'floating\n' + 'point and imaginary (complex) literals. See section ' + 'Literals for\n' + 'details.\n' + '\n' + 'All literals correspond to immutable data types, and hence ' + 'the\n' + "object's identity is less important than its value. " + 'Multiple\n' + 'evaluations of literals with the same value (either the ' + 'same\n' + 'occurrence in the program text or a different occurrence) ' + 'may obtain\n' + 'the same object or a different object with the same ' + 'value.\n', + 'attribute-access': '\n' + 'Customizing attribute access\n' + '****************************\n' + '\n' + 'The following methods can be defined to customize the ' + 'meaning of\n' + 'attribute access (use of, assignment to, or deletion of ' + '"x.name") for\n' + 'class instances.\n' + '\n' + 'object.__getattr__(self, name)\n' + '\n' + ' Called when an attribute lookup has not found the ' + 'attribute in the\n' + ' usual places (i.e. it is not an instance attribute ' + 'nor is it found\n' + ' in the class tree for "self"). "name" is the ' + 'attribute name. This\n' + ' method should return the (computed) attribute value ' + 'or raise an\n' + ' "AttributeError" exception.\n' + '\n' + ' Note that if the attribute is found through the ' + 'normal mechanism,\n' + ' "__getattr__()" is not called. (This is an ' + 'intentional asymmetry\n' + ' between "__getattr__()" and "__setattr__()".) This is ' + 'done both for\n' + ' efficiency reasons and because otherwise ' + '"__getattr__()" would have\n' + ' no way to access other attributes of the instance. ' + 'Note that at\n' + ' least for instance variables, you can fake total ' + 'control by not\n' + ' inserting any values in the instance attribute ' + 'dictionary (but\n' + ' instead inserting them in another object). See the\n' + ' "__getattribute__()" method below for a way to ' + 'actually get total\n' + ' control in new-style classes.\n' + '\n' + 'object.__setattr__(self, name, value)\n' + '\n' + ' Called when an attribute assignment is attempted. ' + 'This is called\n' + ' instead of the normal mechanism (i.e. store the value ' + 'in the\n' + ' instance dictionary). *name* is the attribute name, ' + '*value* is the\n' + ' value to be assigned to it.\n' + '\n' + ' If "__setattr__()" wants to assign to an instance ' + 'attribute, it\n' + ' should not simply execute "self.name = value" --- ' + 'this would cause\n' + ' a recursive call to itself. Instead, it should ' + 'insert the value in\n' + ' the dictionary of instance attributes, e.g., ' + '"self.__dict__[name] =\n' + ' value". For new-style classes, rather than accessing ' + 'the instance\n' + ' dictionary, it should call the base class method with ' + 'the same\n' + ' name, for example, "object.__setattr__(self, name, ' + 'value)".\n' + '\n' + 'object.__delattr__(self, name)\n' + '\n' + ' Like "__setattr__()" but for attribute deletion ' + 'instead of\n' + ' assignment. This should only be implemented if "del ' + 'obj.name" is\n' + ' meaningful for the object.\n' + '\n' + '\n' + 'More attribute access for new-style classes\n' + '===========================================\n' + '\n' + 'The following methods only apply to new-style classes.\n' + '\n' + 'object.__getattribute__(self, name)\n' + '\n' + ' Called unconditionally to implement attribute ' + 'accesses for\n' + ' instances of the class. If the class also defines ' + '"__getattr__()",\n' + ' the latter will not be called unless ' + '"__getattribute__()" either\n' + ' calls it explicitly or raises an "AttributeError". ' + 'This method\n' + ' should return the (computed) attribute value or raise ' + 'an\n' + ' "AttributeError" exception. In order to avoid ' + 'infinite recursion in\n' + ' this method, its implementation should always call ' + 'the base class\n' + ' method with the same name to access any attributes it ' + 'needs, for\n' + ' example, "object.__getattribute__(self, name)".\n' + '\n' + ' Note: This method may still be bypassed when looking ' + 'up special\n' + ' methods as the result of implicit invocation via ' + 'language syntax\n' + ' or built-in functions. See Special method lookup ' + 'for new-style\n' + ' classes.\n' + '\n' + '\n' + 'Implementing Descriptors\n' + '========================\n' + '\n' + 'The following methods only apply when an instance of the ' + 'class\n' + 'containing the method (a so-called *descriptor* class) ' + 'appears in an\n' + '*owner* class (the descriptor must be in either the ' + "owner's class\n" + 'dictionary or in the class dictionary for one of its ' + 'parents). In the\n' + 'examples below, "the attribute" refers to the attribute ' + 'whose name is\n' + "the key of the property in the owner class' " + '"__dict__".\n' + '\n' + 'object.__get__(self, instance, owner)\n' + '\n' + ' Called to get the attribute of the owner class (class ' + 'attribute\n' + ' access) or of an instance of that class (instance ' + 'attribute\n' + ' access). *owner* is always the owner class, while ' + '*instance* is the\n' + ' instance that the attribute was accessed through, or ' + '"None" when\n' + ' the attribute is accessed through the *owner*. This ' + 'method should\n' + ' return the (computed) attribute value or raise an ' + '"AttributeError"\n' + ' exception.\n' + '\n' + 'object.__set__(self, instance, value)\n' + '\n' + ' Called to set the attribute on an instance *instance* ' + 'of the owner\n' + ' class to a new value, *value*.\n' + '\n' + 'object.__delete__(self, instance)\n' + '\n' + ' Called to delete the attribute on an instance ' + '*instance* of the\n' + ' owner class.\n' + '\n' + '\n' + 'Invoking Descriptors\n' + '====================\n' + '\n' + 'In general, a descriptor is an object attribute with ' + '"binding\n' + 'behavior", one whose attribute access has been ' + 'overridden by methods\n' + 'in the descriptor protocol: "__get__()", "__set__()", ' + 'and\n' + '"__delete__()". If any of those methods are defined for ' + 'an object, it\n' + 'is said to be a descriptor.\n' + '\n' + 'The default behavior for attribute access is to get, ' + 'set, or delete\n' + "the attribute from an object's dictionary. For instance, " + '"a.x" has a\n' + 'lookup chain starting with "a.__dict__[\'x\']", then\n' + '"type(a).__dict__[\'x\']", and continuing through the ' + 'base classes of\n' + '"type(a)" excluding metaclasses.\n' + '\n' + 'However, if the looked-up value is an object defining ' + 'one of the\n' + 'descriptor methods, then Python may override the default ' + 'behavior and\n' + 'invoke the descriptor method instead. Where this occurs ' + 'in the\n' + 'precedence chain depends on which descriptor methods ' + 'were defined and\n' + 'how they were called. Note that descriptors are only ' + 'invoked for new\n' + 'style objects or classes (ones that subclass "object()" ' + 'or "type()").\n' + '\n' + 'The starting point for descriptor invocation is a ' + 'binding, "a.x". How\n' + 'the arguments are assembled depends on "a":\n' + '\n' + 'Direct Call\n' + ' The simplest and least common call is when user code ' + 'directly\n' + ' invokes a descriptor method: "x.__get__(a)".\n' + '\n' + 'Instance Binding\n' + ' If binding to a new-style object instance, "a.x" is ' + 'transformed\n' + ' into the call: "type(a).__dict__[\'x\'].__get__(a, ' + 'type(a))".\n' + '\n' + 'Class Binding\n' + ' If binding to a new-style class, "A.x" is transformed ' + 'into the\n' + ' call: "A.__dict__[\'x\'].__get__(None, A)".\n' + '\n' + 'Super Binding\n' + ' If "a" is an instance of "super", then the binding ' + '"super(B,\n' + ' obj).m()" searches "obj.__class__.__mro__" for the ' + 'base class "A"\n' + ' immediately preceding "B" and then invokes the ' + 'descriptor with the\n' + ' call: "A.__dict__[\'m\'].__get__(obj, ' + 'obj.__class__)".\n' + '\n' + 'For instance bindings, the precedence of descriptor ' + 'invocation depends\n' + 'on the which descriptor methods are defined. A ' + 'descriptor can define\n' + 'any combination of "__get__()", "__set__()" and ' + '"__delete__()". If it\n' + 'does not define "__get__()", then accessing the ' + 'attribute will return\n' + 'the descriptor object itself unless there is a value in ' + "the object's\n" + 'instance dictionary. If the descriptor defines ' + '"__set__()" and/or\n' + '"__delete__()", it is a data descriptor; if it defines ' + 'neither, it is\n' + 'a non-data descriptor. Normally, data descriptors ' + 'define both\n' + '"__get__()" and "__set__()", while non-data descriptors ' + 'have just the\n' + '"__get__()" method. Data descriptors with "__set__()" ' + 'and "__get__()"\n' + 'defined always override a redefinition in an instance ' + 'dictionary. In\n' + 'contrast, non-data descriptors can be overridden by ' + 'instances.\n' + '\n' + 'Python methods (including "staticmethod()" and ' + '"classmethod()") are\n' + 'implemented as non-data descriptors. Accordingly, ' + 'instances can\n' + 'redefine and override methods. This allows individual ' + 'instances to\n' + 'acquire behaviors that differ from other instances of ' + 'the same class.\n' + '\n' + 'The "property()" function is implemented as a data ' + 'descriptor.\n' + 'Accordingly, instances cannot override the behavior of a ' + 'property.\n' + '\n' + '\n' + '__slots__\n' + '=========\n' + '\n' + 'By default, instances of both old and new-style classes ' + 'have a\n' + 'dictionary for attribute storage. This wastes space for ' + 'objects\n' + 'having very few instance variables. The space ' + 'consumption can become\n' + 'acute when creating large numbers of instances.\n' + '\n' + 'The default can be overridden by defining *__slots__* in ' + 'a new-style\n' + 'class definition. The *__slots__* declaration takes a ' + 'sequence of\n' + 'instance variables and reserves just enough space in ' + 'each instance to\n' + 'hold a value for each variable. Space is saved because ' + '*__dict__* is\n' + 'not created for each instance.\n' + '\n' + '__slots__\n' + '\n' + ' This class variable can be assigned a string, ' + 'iterable, or sequence\n' + ' of strings with variable names used by instances. If ' + 'defined in a\n' + ' new-style class, *__slots__* reserves space for the ' + 'declared\n' + ' variables and prevents the automatic creation of ' + '*__dict__* and\n' + ' *__weakref__* for each instance.\n' + '\n' + ' New in version 2.2.\n' + '\n' + 'Notes on using *__slots__*\n' + '\n' + '* When inheriting from a class without *__slots__*, the ' + '*__dict__*\n' + ' attribute of that class will always be accessible, so ' + 'a *__slots__*\n' + ' definition in the subclass is meaningless.\n' + '\n' + '* Without a *__dict__* variable, instances cannot be ' + 'assigned new\n' + ' variables not listed in the *__slots__* definition. ' + 'Attempts to\n' + ' assign to an unlisted variable name raises ' + '"AttributeError". If\n' + ' dynamic assignment of new variables is desired, then ' + 'add\n' + ' "\'__dict__\'" to the sequence of strings in the ' + '*__slots__*\n' + ' declaration.\n' + '\n' + ' Changed in version 2.3: Previously, adding ' + '"\'__dict__\'" to the\n' + ' *__slots__* declaration would not enable the ' + 'assignment of new\n' + ' attributes not specifically listed in the sequence of ' + 'instance\n' + ' variable names.\n' + '\n' + '* Without a *__weakref__* variable for each instance, ' + 'classes\n' + ' defining *__slots__* do not support weak references to ' + 'its\n' + ' instances. If weak reference support is needed, then ' + 'add\n' + ' "\'__weakref__\'" to the sequence of strings in the ' + '*__slots__*\n' + ' declaration.\n' + '\n' + ' Changed in version 2.3: Previously, adding ' + '"\'__weakref__\'" to the\n' + ' *__slots__* declaration would not enable support for ' + 'weak\n' + ' references.\n' + '\n' + '* *__slots__* are implemented at the class level by ' + 'creating\n' + ' descriptors (Implementing Descriptors) for each ' + 'variable name. As a\n' + ' result, class attributes cannot be used to set default ' + 'values for\n' + ' instance variables defined by *__slots__*; otherwise, ' + 'the class\n' + ' attribute would overwrite the descriptor assignment.\n' + '\n' + '* The action of a *__slots__* declaration is limited to ' + 'the class\n' + ' where it is defined. As a result, subclasses will ' + 'have a *__dict__*\n' + ' unless they also define *__slots__* (which must only ' + 'contain names\n' + ' of any *additional* slots).\n' + '\n' + '* If a class defines a slot also defined in a base ' + 'class, the\n' + ' instance variable defined by the base class slot is ' + 'inaccessible\n' + ' (except by retrieving its descriptor directly from the ' + 'base class).\n' + ' This renders the meaning of the program undefined. In ' + 'the future, a\n' + ' check may be added to prevent this.\n' + '\n' + '* Nonempty *__slots__* does not work for classes derived ' + 'from\n' + ' "variable-length" built-in types such as "long", "str" ' + 'and "tuple".\n' + '\n' + '* Any non-string iterable may be assigned to ' + '*__slots__*. Mappings\n' + ' may also be used; however, in the future, special ' + 'meaning may be\n' + ' assigned to the values corresponding to each key.\n' + '\n' + '* *__class__* assignment works only if both classes have ' + 'the same\n' + ' *__slots__*.\n' + '\n' + ' Changed in version 2.6: Previously, *__class__* ' + 'assignment raised an\n' + ' error if either new or old class had *__slots__*.\n', + 'attribute-references': '\n' + 'Attribute references\n' + '********************\n' + '\n' + 'An attribute reference is a primary followed by a ' + 'period and a name:\n' + '\n' + ' attributeref ::= primary "." identifier\n' + '\n' + 'The primary must evaluate to an object of a type ' + 'that supports\n' + 'attribute references, e.g., a module, list, or an ' + 'instance. This\n' + 'object is then asked to produce the attribute whose ' + 'name is the\n' + 'identifier. If this attribute is not available, the ' + 'exception\n' + '"AttributeError" is raised. Otherwise, the type and ' + 'value of the\n' + 'object produced is determined by the object. ' + 'Multiple evaluations of\n' + 'the same attribute reference may yield different ' + 'objects.\n', + 'augassign': '\n' + 'Augmented assignment statements\n' + '*******************************\n' + '\n' + 'Augmented assignment is the combination, in a single statement, ' + 'of a\n' + 'binary operation and an assignment statement:\n' + '\n' + ' augmented_assignment_stmt ::= augtarget augop ' + '(expression_list | yield_expression)\n' + ' augtarget ::= identifier | attributeref | ' + 'subscription | slicing\n' + ' augop ::= "+=" | "-=" | "*=" | "/=" | ' + '"//=" | "%=" | "**="\n' + ' | ">>=" | "<<=" | "&=" | "^=" | "|="\n' + '\n' + '(See section Primaries for the syntax definitions for the last ' + 'three\n' + 'symbols.)\n' + '\n' + 'An augmented assignment evaluates the target (which, unlike ' + 'normal\n' + 'assignment statements, cannot be an unpacking) and the ' + 'expression\n' + 'list, performs the binary operation specific to the type of ' + 'assignment\n' + 'on the two operands, and assigns the result to the original ' + 'target.\n' + 'The target is only evaluated once.\n' + '\n' + 'An augmented assignment expression like "x += 1" can be ' + 'rewritten as\n' + '"x = x + 1" to achieve a similar, but not exactly equal effect. ' + 'In the\n' + 'augmented version, "x" is only evaluated once. Also, when ' + 'possible,\n' + 'the actual operation is performed *in-place*, meaning that ' + 'rather than\n' + 'creating a new object and assigning that to the target, the old ' + 'object\n' + 'is modified instead.\n' + '\n' + 'With the exception of assigning to tuples and multiple targets ' + 'in a\n' + 'single statement, the assignment done by augmented assignment\n' + 'statements is handled the same way as normal assignments. ' + 'Similarly,\n' + 'with the exception of the possible *in-place* behavior, the ' + 'binary\n' + 'operation performed by augmented assignment is the same as the ' + 'normal\n' + 'binary operations.\n' + '\n' + 'For targets which are attribute references, the same caveat ' + 'about\n' + 'class and instance attributes applies as for regular ' + 'assignments.\n', + 'binary': '\n' + 'Binary arithmetic operations\n' + '****************************\n' + '\n' + 'The binary arithmetic operations have the conventional priority\n' + 'levels. Note that some of these operations also apply to certain ' + 'non-\n' + 'numeric types. Apart from the power operator, there are only two\n' + 'levels, one for multiplicative operators and one for additive\n' + 'operators:\n' + '\n' + ' m_expr ::= u_expr | m_expr "*" u_expr | m_expr "//" u_expr | ' + 'm_expr "/" u_expr\n' + ' | m_expr "%" u_expr\n' + ' a_expr ::= m_expr | a_expr "+" m_expr | a_expr "-" m_expr\n' + '\n' + 'The "*" (multiplication) operator yields the product of its ' + 'arguments.\n' + 'The arguments must either both be numbers, or one argument must be ' + 'an\n' + 'integer (plain or long) and the other must be a sequence. In the\n' + 'former case, the numbers are converted to a common type and then\n' + 'multiplied together. In the latter case, sequence repetition is\n' + 'performed; a negative repetition factor yields an empty sequence.\n' + '\n' + 'The "/" (division) and "//" (floor division) operators yield the\n' + 'quotient of their arguments. The numeric arguments are first\n' + 'converted to a common type. Plain or long integer division yields ' + 'an\n' + 'integer of the same type; the result is that of mathematical ' + 'division\n' + "with the 'floor' function applied to the result. Division by zero\n" + 'raises the "ZeroDivisionError" exception.\n' + '\n' + 'The "%" (modulo) operator yields the remainder from the division ' + 'of\n' + 'the first argument by the second. The numeric arguments are ' + 'first\n' + 'converted to a common type. A zero right argument raises the\n' + '"ZeroDivisionError" exception. The arguments may be floating ' + 'point\n' + 'numbers, e.g., "3.14%0.7" equals "0.34" (since "3.14" equals ' + '"4*0.7 +\n' + '0.34".) The modulo operator always yields a result with the same ' + 'sign\n' + 'as its second operand (or zero); the absolute value of the result ' + 'is\n' + 'strictly smaller than the absolute value of the second operand ' + '[2].\n' + '\n' + 'The integer division and modulo operators are connected by the\n' + 'following identity: "x == (x/y)*y + (x%y)". Integer division and\n' + 'modulo are also connected with the built-in function "divmod()":\n' + '"divmod(x, y) == (x/y, x%y)". These identities don\'t hold for\n' + 'floating point numbers; there similar identities hold ' + 'approximately\n' + 'where "x/y" is replaced by "floor(x/y)" or "floor(x/y) - 1" [3].\n' + '\n' + 'In addition to performing the modulo operation on numbers, the ' + '"%"\n' + 'operator is also overloaded by string and unicode objects to ' + 'perform\n' + 'string formatting (also known as interpolation). The syntax for ' + 'string\n' + 'formatting is described in the Python Library Reference, section\n' + 'String Formatting Operations.\n' + '\n' + 'Deprecated since version 2.3: The floor division operator, the ' + 'modulo\n' + 'operator, and the "divmod()" function are no longer defined for\n' + 'complex numbers. Instead, convert to a floating point number ' + 'using\n' + 'the "abs()" function if appropriate.\n' + '\n' + 'The "+" (addition) operator yields the sum of its arguments. The\n' + 'arguments must either both be numbers or both sequences of the ' + 'same\n' + 'type. In the former case, the numbers are converted to a common ' + 'type\n' + 'and then added together. In the latter case, the sequences are\n' + 'concatenated.\n' + '\n' + 'The "-" (subtraction) operator yields the difference of its ' + 'arguments.\n' + 'The numeric arguments are first converted to a common type.\n', + 'bitwise': '\n' + 'Binary bitwise operations\n' + '*************************\n' + '\n' + 'Each of the three bitwise operations has a different priority ' + 'level:\n' + '\n' + ' and_expr ::= shift_expr | and_expr "&" shift_expr\n' + ' xor_expr ::= and_expr | xor_expr "^" and_expr\n' + ' or_expr ::= xor_expr | or_expr "|" xor_expr\n' + '\n' + 'The "&" operator yields the bitwise AND of its arguments, which ' + 'must\n' + 'be plain or long integers. The arguments are converted to a ' + 'common\n' + 'type.\n' + '\n' + 'The "^" operator yields the bitwise XOR (exclusive OR) of its\n' + 'arguments, which must be plain or long integers. The arguments ' + 'are\n' + 'converted to a common type.\n' + '\n' + 'The "|" operator yields the bitwise (inclusive) OR of its ' + 'arguments,\n' + 'which must be plain or long integers. The arguments are ' + 'converted to\n' + 'a common type.\n', + 'bltin-code-objects': '\n' + 'Code Objects\n' + '************\n' + '\n' + 'Code objects are used by the implementation to ' + 'represent "pseudo-\n' + 'compiled" executable Python code such as a function ' + 'body. They differ\n' + "from function objects because they don't contain a " + 'reference to their\n' + 'global execution environment. Code objects are ' + 'returned by the built-\n' + 'in "compile()" function and can be extracted from ' + 'function objects\n' + 'through their "func_code" attribute. See also the ' + '"code" module.\n' + '\n' + 'A code object can be executed or evaluated by passing ' + 'it (instead of a\n' + 'source string) to the "exec" statement or the built-in ' + '"eval()"\n' + 'function.\n' + '\n' + 'See The standard type hierarchy for more ' + 'information.\n', + 'bltin-ellipsis-object': '\n' + 'The Ellipsis Object\n' + '*******************\n' + '\n' + 'This object is used by extended slice notation (see ' + 'Slicings). It\n' + 'supports no special operations. There is exactly ' + 'one ellipsis object,\n' + 'named "Ellipsis" (a built-in name).\n' + '\n' + 'It is written as "Ellipsis". When in a subscript, ' + 'it can also be\n' + 'written as "...", for example "seq[...]".\n', + 'bltin-file-objects': '\n' + 'File Objects\n' + '************\n' + '\n' + 'File objects are implemented using C\'s "stdio" ' + 'package and can be\n' + 'created with the built-in "open()" function. File ' + 'objects are also\n' + 'returned by some other built-in functions and methods, ' + 'such as\n' + '"os.popen()" and "os.fdopen()" and the "makefile()" ' + 'method of socket\n' + 'objects. Temporary files can be created using the ' + '"tempfile" module,\n' + 'and high-level file operations such as copying, ' + 'moving, and deleting\n' + 'files and directories can be achieved with the ' + '"shutil" module.\n' + '\n' + 'When a file operation fails for an I/O-related reason, ' + 'the exception\n' + '"IOError" is raised. This includes situations where ' + 'the operation is\n' + 'not defined for some reason, like "seek()" on a tty ' + 'device or writing\n' + 'a file opened for reading.\n' + '\n' + 'Files have the following methods:\n' + '\n' + 'file.close()\n' + '\n' + ' Close the file. A closed file cannot be read or ' + 'written any more.\n' + ' Any operation which requires that the file be open ' + 'will raise a\n' + ' "ValueError" after the file has been closed. ' + 'Calling "close()"\n' + ' more than once is allowed.\n' + '\n' + ' As of Python 2.5, you can avoid having to call this ' + 'method\n' + ' explicitly if you use the "with" statement. For ' + 'example, the\n' + ' following code will automatically close *f* when ' + 'the "with" block\n' + ' is exited:\n' + '\n' + ' from __future__ import with_statement # This ' + "isn't required in Python 2.6\n" + '\n' + ' with open("hello.txt") as f:\n' + ' for line in f:\n' + ' print line,\n' + '\n' + ' In older versions of Python, you would have needed ' + 'to do this to\n' + ' get the same effect:\n' + '\n' + ' f = open("hello.txt")\n' + ' try:\n' + ' for line in f:\n' + ' print line,\n' + ' finally:\n' + ' f.close()\n' + '\n' + ' Note: Not all "file-like" types in Python support ' + 'use as a\n' + ' context manager for the "with" statement. If ' + 'your code is\n' + ' intended to work with any file-like object, you ' + 'can use the\n' + ' function "contextlib.closing()" instead of using ' + 'the object\n' + ' directly.\n' + '\n' + 'file.flush()\n' + '\n' + ' Flush the internal buffer, like "stdio"\'s ' + '"fflush()". This may be\n' + ' a no-op on some file-like objects.\n' + '\n' + ' Note: "flush()" does not necessarily write the ' + "file's data to\n" + ' disk. Use "flush()" followed by "os.fsync()" to ' + 'ensure this\n' + ' behavior.\n' + '\n' + 'file.fileno()\n' + '\n' + ' Return the integer "file descriptor" that is used ' + 'by the underlying\n' + ' implementation to request I/O operations from the ' + 'operating system.\n' + ' This can be useful for other, lower level ' + 'interfaces that use file\n' + ' descriptors, such as the "fcntl" module or ' + '"os.read()" and friends.\n' + '\n' + ' Note: File-like objects which do not have a real ' + 'file descriptor\n' + ' should *not* provide this method!\n' + '\n' + 'file.isatty()\n' + '\n' + ' Return "True" if the file is connected to a ' + 'tty(-like) device, else\n' + ' "False".\n' + '\n' + ' Note: If a file-like object is not associated with ' + 'a real file,\n' + ' this method should *not* be implemented.\n' + '\n' + 'file.next()\n' + '\n' + ' A file object is its own iterator, for example ' + '"iter(f)" returns\n' + ' *f* (unless *f* is closed). When a file is used as ' + 'an iterator,\n' + ' typically in a "for" loop (for example, "for line ' + 'in f: print\n' + ' line.strip()"), the "next()" method is called ' + 'repeatedly. This\n' + ' method returns the next input line, or raises ' + '"StopIteration" when\n' + ' EOF is hit when the file is open for reading ' + '(behavior is undefined\n' + ' when the file is open for writing). In order to ' + 'make a "for" loop\n' + ' the most efficient way of looping over the lines of ' + 'a file (a very\n' + ' common operation), the "next()" method uses a ' + 'hidden read-ahead\n' + ' buffer. As a consequence of using a read-ahead ' + 'buffer, combining\n' + ' "next()" with other file methods (like ' + '"readline()") does not work\n' + ' right. However, using "seek()" to reposition the ' + 'file to an\n' + ' absolute position will flush the read-ahead ' + 'buffer.\n' + '\n' + ' New in version 2.3.\n' + '\n' + 'file.read([size])\n' + '\n' + ' Read at most *size* bytes from the file (less if ' + 'the read hits EOF\n' + ' before obtaining *size* bytes). If the *size* ' + 'argument is negative\n' + ' or omitted, read all data until EOF is reached. ' + 'The bytes are\n' + ' returned as a string object. An empty string is ' + 'returned when EOF\n' + ' is encountered immediately. (For certain files, ' + 'like ttys, it\n' + ' makes sense to continue reading after an EOF is ' + 'hit.) Note that\n' + ' this method may call the underlying C function ' + '"fread()" more than\n' + ' once in an effort to acquire as close to *size* ' + 'bytes as possible.\n' + ' Also note that when in non-blocking mode, less data ' + 'than was\n' + ' requested may be returned, even if no *size* ' + 'parameter was given.\n' + '\n' + ' Note: This function is simply a wrapper for the ' + 'underlying\n' + ' "fread()" C function, and will behave the same in ' + 'corner cases,\n' + ' such as whether the EOF value is cached.\n' + '\n' + 'file.readline([size])\n' + '\n' + ' Read one entire line from the file. A trailing ' + 'newline character\n' + ' is kept in the string (but may be absent when a ' + 'file ends with an\n' + ' incomplete line). [6] If the *size* argument is ' + 'present and non-\n' + ' negative, it is a maximum byte count (including the ' + 'trailing\n' + ' newline) and an incomplete line may be returned. ' + 'When *size* is not\n' + ' 0, an empty string is returned *only* when EOF is ' + 'encountered\n' + ' immediately.\n' + '\n' + ' Note: Unlike "stdio"\'s "fgets()", the returned ' + 'string contains\n' + ' null characters ("\'\\0\'") if they occurred in ' + 'the input.\n' + '\n' + 'file.readlines([sizehint])\n' + '\n' + ' Read until EOF using "readline()" and return a list ' + 'containing the\n' + ' lines thus read. If the optional *sizehint* ' + 'argument is present,\n' + ' instead of reading up to EOF, whole lines totalling ' + 'approximately\n' + ' *sizehint* bytes (possibly after rounding up to an ' + 'internal buffer\n' + ' size) are read. Objects implementing a file-like ' + 'interface may\n' + ' choose to ignore *sizehint* if it cannot be ' + 'implemented, or cannot\n' + ' be implemented efficiently.\n' + '\n' + 'file.xreadlines()\n' + '\n' + ' This method returns the same thing as "iter(f)".\n' + '\n' + ' New in version 2.1.\n' + '\n' + ' Deprecated since version 2.3: Use "for line in ' + 'file" instead.\n' + '\n' + 'file.seek(offset[, whence])\n' + '\n' + ' Set the file\'s current position, like "stdio"\'s ' + '"fseek()". The\n' + ' *whence* argument is optional and defaults to ' + '"os.SEEK_SET" or "0"\n' + ' (absolute file positioning); other values are ' + '"os.SEEK_CUR" or "1"\n' + ' (seek relative to the current position) and ' + '"os.SEEK_END" or "2"\n' + " (seek relative to the file's end). There is no " + 'return value.\n' + '\n' + ' For example, "f.seek(2, os.SEEK_CUR)" advances the ' + 'position by two\n' + ' and "f.seek(-3, os.SEEK_END)" sets the position to ' + 'the third to\n' + ' last.\n' + '\n' + ' Note that if the file is opened for appending (mode ' + '"\'a\'" or\n' + ' "\'a+\'"), any "seek()" operations will be undone ' + 'at the next write.\n' + ' If the file is only opened for writing in append ' + 'mode (mode "\'a\'"),\n' + ' this method is essentially a no-op, but it remains ' + 'useful for files\n' + ' opened in append mode with reading enabled (mode ' + '"\'a+\'"). If the\n' + ' file is opened in text mode (without "\'b\'"), only ' + 'offsets returned\n' + ' by "tell()" are legal. Use of other offsets causes ' + 'undefined\n' + ' behavior.\n' + '\n' + ' Note that not all file objects are seekable.\n' + '\n' + ' Changed in version 2.6: Passing float values as ' + 'offset has been\n' + ' deprecated.\n' + '\n' + 'file.tell()\n' + '\n' + " Return the file's current position, like " + '"stdio"\'s "ftell()".\n' + '\n' + ' Note: On Windows, "tell()" can return illegal ' + 'values (after an\n' + ' "fgets()") when reading files with Unix-style ' + 'line-endings. Use\n' + ' binary mode ("\'rb\'") to circumvent this ' + 'problem.\n' + '\n' + 'file.truncate([size])\n' + '\n' + " Truncate the file's size. If the optional *size* " + 'argument is\n' + ' present, the file is truncated to (at most) that ' + 'size. The size\n' + ' defaults to the current position. The current file ' + 'position is not\n' + ' changed. Note that if a specified size exceeds the ' + "file's current\n" + ' size, the result is platform-dependent: ' + 'possibilities include that\n' + ' the file may remain unchanged, increase to the ' + 'specified size as if\n' + ' zero-filled, or increase to the specified size with ' + 'undefined new\n' + ' content. Availability: Windows, many Unix ' + 'variants.\n' + '\n' + 'file.write(str)\n' + '\n' + ' Write a string to the file. There is no return ' + 'value. Due to\n' + ' buffering, the string may not actually show up in ' + 'the file until\n' + ' the "flush()" or "close()" method is called.\n' + '\n' + 'file.writelines(sequence)\n' + '\n' + ' Write a sequence of strings to the file. The ' + 'sequence can be any\n' + ' iterable object producing strings, typically a list ' + 'of strings.\n' + ' There is no return value. (The name is intended to ' + 'match\n' + ' "readlines()"; "writelines()" does not add line ' + 'separators.)\n' + '\n' + 'Files support the iterator protocol. Each iteration ' + 'returns the same\n' + 'result as "readline()", and iteration ends when the ' + '"readline()"\n' + 'method returns an empty string.\n' + '\n' + 'File objects also offer a number of other interesting ' + 'attributes.\n' + 'These are not required for file-like objects, but ' + 'should be\n' + 'implemented if they make sense for the particular ' + 'object.\n' + '\n' + 'file.closed\n' + '\n' + ' bool indicating the current state of the file ' + 'object. This is a\n' + ' read-only attribute; the "close()" method changes ' + 'the value. It may\n' + ' not be available on all file-like objects.\n' + '\n' + 'file.encoding\n' + '\n' + ' The encoding that this file uses. When Unicode ' + 'strings are written\n' + ' to a file, they will be converted to byte strings ' + 'using this\n' + ' encoding. In addition, when the file is connected ' + 'to a terminal,\n' + ' the attribute gives the encoding that the terminal ' + 'is likely to use\n' + ' (that information might be incorrect if the user ' + 'has misconfigured\n' + ' the terminal). The attribute is read-only and may ' + 'not be present\n' + ' on all file-like objects. It may also be "None", in ' + 'which case the\n' + ' file uses the system default encoding for ' + 'converting Unicode\n' + ' strings.\n' + '\n' + ' New in version 2.3.\n' + '\n' + 'file.errors\n' + '\n' + ' The Unicode error handler used along with the ' + 'encoding.\n' + '\n' + ' New in version 2.6.\n' + '\n' + 'file.mode\n' + '\n' + ' The I/O mode for the file. If the file was created ' + 'using the\n' + ' "open()" built-in function, this will be the value ' + 'of the *mode*\n' + ' parameter. This is a read-only attribute and may ' + 'not be present on\n' + ' all file-like objects.\n' + '\n' + 'file.name\n' + '\n' + ' If the file object was created using "open()", the ' + 'name of the\n' + ' file. Otherwise, some string that indicates the ' + 'source of the file\n' + ' object, of the form "<...>". This is a read-only ' + 'attribute and may\n' + ' not be present on all file-like objects.\n' + '\n' + 'file.newlines\n' + '\n' + ' If Python was built with *universal newlines* ' + 'enabled (the default)\n' + ' this read-only attribute exists, and for files ' + 'opened in universal\n' + ' newline read mode it keeps track of the types of ' + 'newlines\n' + ' encountered while reading the file. The values it ' + 'can take are\n' + ' "\'\\r\'", "\'\\n\'", "\'\\r\\n\'", "None" ' + '(unknown, no newlines read yet) or\n' + ' a tuple containing all the newline types seen, to ' + 'indicate that\n' + ' multiple newline conventions were encountered. For ' + 'files not opened\n' + ' in universal newlines read mode the value of this ' + 'attribute will be\n' + ' "None".\n' + '\n' + 'file.softspace\n' + '\n' + ' Boolean that indicates whether a space character ' + 'needs to be\n' + ' printed before another value when using the "print" ' + 'statement.\n' + ' Classes that are trying to simulate a file object ' + 'should also have\n' + ' a writable "softspace" attribute, which should be ' + 'initialized to\n' + ' zero. This will be automatic for most classes ' + 'implemented in\n' + ' Python (care may be needed for objects that ' + 'override attribute\n' + ' access); types implemented in C will have to ' + 'provide a writable\n' + ' "softspace" attribute.\n' + '\n' + ' Note: This attribute is not used to control the ' + '"print"\n' + ' statement, but to allow the implementation of ' + '"print" to keep\n' + ' track of its internal state.\n', + 'bltin-null-object': '\n' + 'The Null Object\n' + '***************\n' + '\n' + "This object is returned by functions that don't " + 'explicitly return a\n' + 'value. It supports no special operations. There is ' + 'exactly one null\n' + 'object, named "None" (a built-in name).\n' + '\n' + 'It is written as "None".\n', + 'bltin-type-objects': '\n' + 'Type Objects\n' + '************\n' + '\n' + 'Type objects represent the various object types. An ' + "object's type is\n" + 'accessed by the built-in function "type()". There are ' + 'no special\n' + 'operations on types. The standard module "types" ' + 'defines names for\n' + 'all standard built-in types.\n' + '\n' + 'Types are written like this: "".\n', + 'booleans': '\n' + 'Boolean operations\n' + '******************\n' + '\n' + ' or_test ::= and_test | or_test "or" and_test\n' + ' and_test ::= not_test | and_test "and" not_test\n' + ' not_test ::= comparison | "not" not_test\n' + '\n' + 'In the context of Boolean operations, and also when expressions ' + 'are\n' + 'used by control flow statements, the following values are ' + 'interpreted\n' + 'as false: "False", "None", numeric zero of all types, and empty\n' + 'strings and containers (including strings, tuples, lists,\n' + 'dictionaries, sets and frozensets). All other values are ' + 'interpreted\n' + 'as true. (See the "__nonzero__()" special method for a way to ' + 'change\n' + 'this.)\n' + '\n' + 'The operator "not" yields "True" if its argument is false, ' + '"False"\n' + 'otherwise.\n' + '\n' + 'The expression "x and y" first evaluates *x*; if *x* is false, ' + 'its\n' + 'value is returned; otherwise, *y* is evaluated and the resulting ' + 'value\n' + 'is returned.\n' + '\n' + 'The expression "x or y" first evaluates *x*; if *x* is true, its ' + 'value\n' + 'is returned; otherwise, *y* is evaluated and the resulting value ' + 'is\n' + 'returned.\n' + '\n' + '(Note that neither "and" nor "or" restrict the value and type ' + 'they\n' + 'return to "False" and "True", but rather return the last ' + 'evaluated\n' + 'argument. This is sometimes useful, e.g., if "s" is a string ' + 'that\n' + 'should be replaced by a default value if it is empty, the ' + 'expression\n' + '"s or \'foo\'" yields the desired value. Because "not" has to ' + 'invent a\n' + 'value anyway, it does not bother to return a value of the same ' + 'type as\n' + 'its argument, so e.g., "not \'foo\'" yields "False", not ' + '"\'\'".)\n', + 'break': '\n' + 'The "break" statement\n' + '*********************\n' + '\n' + ' break_stmt ::= "break"\n' + '\n' + '"break" may only occur syntactically nested in a "for" or "while"\n' + 'loop, but not nested in a function or class definition within that\n' + 'loop.\n' + '\n' + 'It terminates the nearest enclosing loop, skipping the optional ' + '"else"\n' + 'clause if the loop has one.\n' + '\n' + 'If a "for" loop is terminated by "break", the loop control target\n' + 'keeps its current value.\n' + '\n' + 'When "break" passes control out of a "try" statement with a ' + '"finally"\n' + 'clause, that "finally" clause is executed before really leaving ' + 'the\n' + 'loop.\n', + 'callable-types': '\n' + 'Emulating callable objects\n' + '**************************\n' + '\n' + 'object.__call__(self[, args...])\n' + '\n' + ' Called when the instance is "called" as a function; if ' + 'this method\n' + ' is defined, "x(arg1, arg2, ...)" is a shorthand for\n' + ' "x.__call__(arg1, arg2, ...)".\n', + 'calls': '\n' + 'Calls\n' + '*****\n' + '\n' + 'A call calls a callable object (e.g., a *function*) with a ' + 'possibly\n' + 'empty series of *arguments*:\n' + '\n' + ' call ::= primary "(" [argument_list [","]\n' + ' | expression genexpr_for] ")"\n' + ' argument_list ::= positional_arguments ["," ' + 'keyword_arguments]\n' + ' ["," "*" expression] ["," ' + 'keyword_arguments]\n' + ' ["," "**" expression]\n' + ' | keyword_arguments ["," "*" expression]\n' + ' ["," "**" expression]\n' + ' | "*" expression ["," keyword_arguments] ["," ' + '"**" expression]\n' + ' | "**" expression\n' + ' positional_arguments ::= expression ("," expression)*\n' + ' keyword_arguments ::= keyword_item ("," keyword_item)*\n' + ' keyword_item ::= identifier "=" expression\n' + '\n' + 'A trailing comma may be present after the positional and keyword\n' + 'arguments but does not affect the semantics.\n' + '\n' + 'The primary must evaluate to a callable object (user-defined\n' + 'functions, built-in functions, methods of built-in objects, class\n' + 'objects, methods of class instances, and certain class instances\n' + 'themselves are callable; extensions may define additional callable\n' + 'object types). All argument expressions are evaluated before the ' + 'call\n' + 'is attempted. Please refer to section Function definitions for ' + 'the\n' + 'syntax of formal *parameter* lists.\n' + '\n' + 'If keyword arguments are present, they are first converted to\n' + 'positional arguments, as follows. First, a list of unfilled slots ' + 'is\n' + 'created for the formal parameters. If there are N positional\n' + 'arguments, they are placed in the first N slots. Next, for each\n' + 'keyword argument, the identifier is used to determine the\n' + 'corresponding slot (if the identifier is the same as the first ' + 'formal\n' + 'parameter name, the first slot is used, and so on). If the slot ' + 'is\n' + 'already filled, a "TypeError" exception is raised. Otherwise, the\n' + 'value of the argument is placed in the slot, filling it (even if ' + 'the\n' + 'expression is "None", it fills the slot). When all arguments have\n' + 'been processed, the slots that are still unfilled are filled with ' + 'the\n' + 'corresponding default value from the function definition. ' + '(Default\n' + 'values are calculated, once, when the function is defined; thus, a\n' + 'mutable object such as a list or dictionary used as default value ' + 'will\n' + "be shared by all calls that don't specify an argument value for " + 'the\n' + 'corresponding slot; this should usually be avoided.) If there are ' + 'any\n' + 'unfilled slots for which no default value is specified, a ' + '"TypeError"\n' + 'exception is raised. Otherwise, the list of filled slots is used ' + 'as\n' + 'the argument list for the call.\n' + '\n' + '**CPython implementation detail:** An implementation may provide\n' + 'built-in functions whose positional parameters do not have names, ' + 'even\n' + "if they are 'named' for the purpose of documentation, and which\n" + 'therefore cannot be supplied by keyword. In CPython, this is the ' + 'case\n' + 'for functions implemented in C that use "PyArg_ParseTuple()" to ' + 'parse\n' + 'their arguments.\n' + '\n' + 'If there are more positional arguments than there are formal ' + 'parameter\n' + 'slots, a "TypeError" exception is raised, unless a formal ' + 'parameter\n' + 'using the syntax "*identifier" is present; in this case, that ' + 'formal\n' + 'parameter receives a tuple containing the excess positional ' + 'arguments\n' + '(or an empty tuple if there were no excess positional arguments).\n' + '\n' + 'If any keyword argument does not correspond to a formal parameter\n' + 'name, a "TypeError" exception is raised, unless a formal parameter\n' + 'using the syntax "**identifier" is present; in this case, that ' + 'formal\n' + 'parameter receives a dictionary containing the excess keyword\n' + 'arguments (using the keywords as keys and the argument values as\n' + 'corresponding values), or a (new) empty dictionary if there were ' + 'no\n' + 'excess keyword arguments.\n' + '\n' + 'If the syntax "*expression" appears in the function call, ' + '"expression"\n' + 'must evaluate to an iterable. Elements from this iterable are ' + 'treated\n' + 'as if they were additional positional arguments; if there are\n' + 'positional arguments *x1*, ..., *xN*, and "expression" evaluates to ' + 'a\n' + 'sequence *y1*, ..., *yM*, this is equivalent to a call with M+N\n' + 'positional arguments *x1*, ..., *xN*, *y1*, ..., *yM*.\n' + '\n' + 'A consequence of this is that although the "*expression" syntax ' + 'may\n' + 'appear *after* some keyword arguments, it is processed *before* ' + 'the\n' + 'keyword arguments (and the "**expression" argument, if any -- see\n' + 'below). So:\n' + '\n' + ' >>> def f(a, b):\n' + ' ... print a, b\n' + ' ...\n' + ' >>> f(b=1, *(2,))\n' + ' 2 1\n' + ' >>> f(a=1, *(2,))\n' + ' Traceback (most recent call last):\n' + ' File "", line 1, in ?\n' + " TypeError: f() got multiple values for keyword argument 'a'\n" + ' >>> f(1, *(2,))\n' + ' 1 2\n' + '\n' + 'It is unusual for both keyword arguments and the "*expression" ' + 'syntax\n' + 'to be used in the same call, so in practice this confusion does ' + 'not\n' + 'arise.\n' + '\n' + 'If the syntax "**expression" appears in the function call,\n' + '"expression" must evaluate to a mapping, the contents of which are\n' + 'treated as additional keyword arguments. In the case of a keyword\n' + 'appearing in both "expression" and as an explicit keyword argument, ' + 'a\n' + '"TypeError" exception is raised.\n' + '\n' + 'Formal parameters using the syntax "*identifier" or "**identifier"\n' + 'cannot be used as positional argument slots or as keyword argument\n' + 'names. Formal parameters using the syntax "(sublist)" cannot be ' + 'used\n' + 'as keyword argument names; the outermost sublist corresponds to a\n' + 'single unnamed argument slot, and the argument value is assigned ' + 'to\n' + 'the sublist using the usual tuple assignment rules after all other\n' + 'parameter processing is done.\n' + '\n' + 'A call always returns some value, possibly "None", unless it raises ' + 'an\n' + 'exception. How this value is computed depends on the type of the\n' + 'callable object.\n' + '\n' + 'If it is---\n' + '\n' + 'a user-defined function:\n' + ' The code block for the function is executed, passing it the\n' + ' argument list. The first thing the code block will do is bind ' + 'the\n' + ' formal parameters to the arguments; this is described in ' + 'section\n' + ' Function definitions. When the code block executes a "return"\n' + ' statement, this specifies the return value of the function ' + 'call.\n' + '\n' + 'a built-in function or method:\n' + ' The result is up to the interpreter; see Built-in Functions for ' + 'the\n' + ' descriptions of built-in functions and methods.\n' + '\n' + 'a class object:\n' + ' A new instance of that class is returned.\n' + '\n' + 'a class instance method:\n' + ' The corresponding user-defined function is called, with an ' + 'argument\n' + ' list that is one longer than the argument list of the call: the\n' + ' instance becomes the first argument.\n' + '\n' + 'a class instance:\n' + ' The class must define a "__call__()" method; the effect is then ' + 'the\n' + ' same as if that method was called.\n', + 'class': '\n' + 'Class definitions\n' + '*****************\n' + '\n' + 'A class definition defines a class object (see section The ' + 'standard\n' + 'type hierarchy):\n' + '\n' + ' classdef ::= "class" classname [inheritance] ":" suite\n' + ' inheritance ::= "(" [expression_list] ")"\n' + ' classname ::= identifier\n' + '\n' + 'A class definition is an executable statement. It first evaluates ' + 'the\n' + 'inheritance list, if present. Each item in the inheritance list\n' + 'should evaluate to a class object or class type which allows\n' + "subclassing. The class's suite is then executed in a new " + 'execution\n' + 'frame (see section Naming and binding), using a newly created ' + 'local\n' + 'namespace and the original global namespace. (Usually, the suite\n' + "contains only function definitions.) When the class's suite " + 'finishes\n' + 'execution, its execution frame is discarded but its local namespace ' + 'is\n' + 'saved. [4] A class object is then created using the inheritance ' + 'list\n' + 'for the base classes and the saved local namespace for the ' + 'attribute\n' + 'dictionary. The class name is bound to this class object in the\n' + 'original local namespace.\n' + '\n' + "**Programmer's note:** Variables defined in the class definition " + 'are\n' + 'class variables; they are shared by all instances. To create ' + 'instance\n' + 'variables, they can be set in a method with "self.name = value". ' + 'Both\n' + 'class and instance variables are accessible through the notation\n' + '""self.name"", and an instance variable hides a class variable ' + 'with\n' + 'the same name when accessed in this way. Class variables can be ' + 'used\n' + 'as defaults for instance variables, but using mutable values there ' + 'can\n' + 'lead to unexpected results. For *new-style class*es, descriptors ' + 'can\n' + 'be used to create instance variables with different implementation\n' + 'details.\n' + '\n' + 'Class definitions, like function definitions, may be wrapped by one ' + 'or\n' + 'more *decorator* expressions. The evaluation rules for the ' + 'decorator\n' + 'expressions are the same as for functions. The result must be a ' + 'class\n' + 'object, which is then bound to the class name.\n' + '\n' + '-[ Footnotes ]-\n' + '\n' + '[1] The exception is propagated to the invocation stack unless\n' + ' there is a "finally" clause which happens to raise another\n' + ' exception. That new exception causes the old one to be lost.\n' + '\n' + '[2] Currently, control "flows off the end" except in the case of\n' + ' an exception or the execution of a "return", "continue", or\n' + ' "break" statement.\n' + '\n' + '[3] A string literal appearing as the first statement in the\n' + ' function body is transformed into the function\'s "__doc__"\n' + " attribute and therefore the function's *docstring*.\n" + '\n' + '[4] A string literal appearing as the first statement in the class\n' + ' body is transformed into the namespace\'s "__doc__" item and\n' + " therefore the class's *docstring*.\n", + 'comparisons': '\n' + 'Comparisons\n' + '***********\n' + '\n' + 'Unlike C, all comparison operations in Python have the same ' + 'priority,\n' + 'which is lower than that of any arithmetic, shifting or ' + 'bitwise\n' + 'operation. Also unlike C, expressions like "a < b < c" have ' + 'the\n' + 'interpretation that is conventional in mathematics:\n' + '\n' + ' comparison ::= or_expr ( comp_operator or_expr )*\n' + ' comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "<>" | ' + '"!="\n' + ' | "is" ["not"] | ["not"] "in"\n' + '\n' + 'Comparisons yield boolean values: "True" or "False".\n' + '\n' + 'Comparisons can be chained arbitrarily, e.g., "x < y <= z" ' + 'is\n' + 'equivalent to "x < y and y <= z", except that "y" is ' + 'evaluated only\n' + 'once (but in both cases "z" is not evaluated at all when "x < ' + 'y" is\n' + 'found to be false).\n' + '\n' + 'Formally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and ' + '*op1*,\n' + '*op2*, ..., *opN* are comparison operators, then "a op1 b op2 ' + 'c ... y\n' + 'opN z" is equivalent to "a op1 b and b op2 c and ... y opN ' + 'z", except\n' + 'that each expression is evaluated at most once.\n' + '\n' + 'Note that "a op1 b op2 c" doesn\'t imply any kind of ' + 'comparison between\n' + '*a* and *c*, so that, e.g., "x < y > z" is perfectly legal ' + '(though\n' + 'perhaps not pretty).\n' + '\n' + 'The forms "<>" and "!=" are equivalent; for consistency with ' + 'C, "!="\n' + 'is preferred; where "!=" is mentioned below "<>" is also ' + 'accepted.\n' + 'The "<>" spelling is considered obsolescent.\n' + '\n' + 'The operators "<", ">", "==", ">=", "<=", and "!=" compare ' + 'the values\n' + 'of two objects. The objects need not have the same type. If ' + 'both are\n' + 'numbers, they are converted to a common type. Otherwise, ' + 'objects of\n' + 'different types *always* compare unequal, and are ordered ' + 'consistently\n' + 'but arbitrarily. You can control comparison behavior of ' + 'objects of\n' + 'non-built-in types by defining a "__cmp__" method or rich ' + 'comparison\n' + 'methods like "__gt__", described in section Special method ' + 'names.\n' + '\n' + '(This unusual definition of comparison was used to simplify ' + 'the\n' + 'definition of operations like sorting and the "in" and "not ' + 'in"\n' + 'operators. In the future, the comparison rules for objects ' + 'of\n' + 'different types are likely to change.)\n' + '\n' + 'Comparison of objects of the same type depends on the type:\n' + '\n' + '* Numbers are compared arithmetically.\n' + '\n' + '* Strings are compared lexicographically using the numeric\n' + ' equivalents (the result of the built-in function "ord()") ' + 'of their\n' + ' characters. Unicode and 8-bit strings are fully ' + 'interoperable in\n' + ' this behavior. [4]\n' + '\n' + '* Tuples and lists are compared lexicographically using ' + 'comparison\n' + ' of corresponding elements. This means that to compare ' + 'equal, each\n' + ' element must compare equal and the two sequences must be of ' + 'the same\n' + ' type and have the same length.\n' + '\n' + ' If not equal, the sequences are ordered the same as their ' + 'first\n' + ' differing elements. For example, "cmp([1,2,x], [1,2,y])" ' + 'returns\n' + ' the same as "cmp(x,y)". If the corresponding element does ' + 'not\n' + ' exist, the shorter sequence is ordered first (for example, ' + '"[1,2] <\n' + ' [1,2,3]").\n' + '\n' + '* Mappings (dictionaries) compare equal if and only if their ' + 'sorted\n' + ' (key, value) lists compare equal. [5] Outcomes other than ' + 'equality\n' + ' are resolved consistently, but are not otherwise defined. ' + '[6]\n' + '\n' + '* Most other objects of built-in types compare unequal unless ' + 'they\n' + ' are the same object; the choice whether one object is ' + 'considered\n' + ' smaller or larger than another one is made arbitrarily but\n' + ' consistently within one execution of a program.\n' + '\n' + 'The operators "in" and "not in" test for collection ' + 'membership. "x in\n' + 's" evaluates to true if *x* is a member of the collection ' + '*s*, and\n' + 'false otherwise. "x not in s" returns the negation of "x in ' + 's". The\n' + 'collection membership test has traditionally been bound to ' + 'sequences;\n' + 'an object is a member of a collection if the collection is a ' + 'sequence\n' + 'and contains an element equal to that object. However, it ' + 'make sense\n' + 'for many other object types to support membership tests ' + 'without being\n' + 'a sequence. In particular, dictionaries (for keys) and sets ' + 'support\n' + 'membership testing.\n' + '\n' + 'For the list and tuple types, "x in y" is true if and only if ' + 'there\n' + 'exists an index *i* such that either "x is y[i]" or "x == ' + 'y[i]" is\n' + 'true.\n' + '\n' + 'For the Unicode and string types, "x in y" is true if and ' + 'only if *x*\n' + 'is a substring of *y*. An equivalent test is "y.find(x) != ' + '-1".\n' + 'Note, *x* and *y* need not be the same type; consequently, ' + '"u\'ab\' in\n' + '\'abc\'" will return "True". Empty strings are always ' + 'considered to be a\n' + 'substring of any other string, so """ in "abc"" will return ' + '"True".\n' + '\n' + 'Changed in version 2.3: Previously, *x* was required to be a ' + 'string of\n' + 'length "1".\n' + '\n' + 'For user-defined classes which define the "__contains__()" ' + 'method, "x\n' + 'in y" is true if and only if "y.__contains__(x)" is true.\n' + '\n' + 'For user-defined classes which do not define "__contains__()" ' + 'but do\n' + 'define "__iter__()", "x in y" is true if some value "z" with ' + '"x == z"\n' + 'is produced while iterating over "y". If an exception is ' + 'raised\n' + 'during the iteration, it is as if "in" raised that ' + 'exception.\n' + '\n' + 'Lastly, the old-style iteration protocol is tried: if a class ' + 'defines\n' + '"__getitem__()", "x in y" is true if and only if there is a ' + 'non-\n' + 'negative integer index *i* such that "x == y[i]", and all ' + 'lower\n' + 'integer indices do not raise "IndexError" exception. (If any ' + 'other\n' + 'exception is raised, it is as if "in" raised that ' + 'exception).\n' + '\n' + 'The operator "not in" is defined to have the inverse true ' + 'value of\n' + '"in".\n' + '\n' + 'The operators "is" and "is not" test for object identity: "x ' + 'is y" is\n' + 'true if and only if *x* and *y* are the same object. "x is ' + 'not y"\n' + 'yields the inverse truth value. [7]\n', + 'compound': '\n' + 'Compound statements\n' + '*******************\n' + '\n' + 'Compound statements contain (groups of) other statements; they ' + 'affect\n' + 'or control the execution of those other statements in some way. ' + 'In\n' + 'general, compound statements span multiple lines, although in ' + 'simple\n' + 'incarnations a whole compound statement may be contained in one ' + 'line.\n' + '\n' + 'The "if", "while" and "for" statements implement traditional ' + 'control\n' + 'flow constructs. "try" specifies exception handlers and/or ' + 'cleanup\n' + 'code for a group of statements. Function and class definitions ' + 'are\n' + 'also syntactically compound statements.\n' + '\n' + "Compound statements consist of one or more 'clauses.' A clause\n" + "consists of a header and a 'suite.' The clause headers of a\n" + 'particular compound statement are all at the same indentation ' + 'level.\n' + 'Each clause header begins with a uniquely identifying keyword ' + 'and ends\n' + 'with a colon. A suite is a group of statements controlled by a\n' + 'clause. A suite can be one or more semicolon-separated simple\n' + 'statements on the same line as the header, following the ' + "header's\n" + 'colon, or it can be one or more indented statements on ' + 'subsequent\n' + 'lines. Only the latter form of suite can contain nested ' + 'compound\n' + "statements; the following is illegal, mostly because it wouldn't " + 'be\n' + 'clear to which "if" clause a following "else" clause would ' + 'belong:\n' + '\n' + ' if test1: if test2: print x\n' + '\n' + 'Also note that the semicolon binds tighter than the colon in ' + 'this\n' + 'context, so that in the following example, either all or none of ' + 'the\n' + '"print" statements are executed:\n' + '\n' + ' if x < y < z: print x; print y; print z\n' + '\n' + 'Summarizing:\n' + '\n' + ' compound_stmt ::= if_stmt\n' + ' | while_stmt\n' + ' | for_stmt\n' + ' | try_stmt\n' + ' | with_stmt\n' + ' | funcdef\n' + ' | classdef\n' + ' | decorated\n' + ' suite ::= stmt_list NEWLINE | NEWLINE INDENT ' + 'statement+ DEDENT\n' + ' statement ::= stmt_list NEWLINE | compound_stmt\n' + ' stmt_list ::= simple_stmt (";" simple_stmt)* [";"]\n' + '\n' + 'Note that statements always end in a "NEWLINE" possibly followed ' + 'by a\n' + '"DEDENT". Also note that optional continuation clauses always ' + 'begin\n' + 'with a keyword that cannot start a statement, thus there are no\n' + 'ambiguities (the \'dangling "else"\' problem is solved in Python ' + 'by\n' + 'requiring nested "if" statements to be indented).\n' + '\n' + 'The formatting of the grammar rules in the following sections ' + 'places\n' + 'each clause on a separate line for clarity.\n' + '\n' + '\n' + 'The "if" statement\n' + '==================\n' + '\n' + 'The "if" statement is used for conditional execution:\n' + '\n' + ' if_stmt ::= "if" expression ":" suite\n' + ' ( "elif" expression ":" suite )*\n' + ' ["else" ":" suite]\n' + '\n' + 'It selects exactly one of the suites by evaluating the ' + 'expressions one\n' + 'by one until one is found to be true (see section Boolean ' + 'operations\n' + 'for the definition of true and false); then that suite is ' + 'executed\n' + '(and no other part of the "if" statement is executed or ' + 'evaluated).\n' + 'If all expressions are false, the suite of the "else" clause, ' + 'if\n' + 'present, is executed.\n' + '\n' + '\n' + 'The "while" statement\n' + '=====================\n' + '\n' + 'The "while" statement is used for repeated execution as long as ' + 'an\n' + 'expression is true:\n' + '\n' + ' while_stmt ::= "while" expression ":" suite\n' + ' ["else" ":" suite]\n' + '\n' + 'This repeatedly tests the expression and, if it is true, ' + 'executes the\n' + 'first suite; if the expression is false (which may be the first ' + 'time\n' + 'it is tested) the suite of the "else" clause, if present, is ' + 'executed\n' + 'and the loop terminates.\n' + '\n' + 'A "break" statement executed in the first suite terminates the ' + 'loop\n' + 'without executing the "else" clause\'s suite. A "continue" ' + 'statement\n' + 'executed in the first suite skips the rest of the suite and goes ' + 'back\n' + 'to testing the expression.\n' + '\n' + '\n' + 'The "for" statement\n' + '===================\n' + '\n' + 'The "for" statement is used to iterate over the elements of a ' + 'sequence\n' + '(such as a string, tuple or list) or other iterable object:\n' + '\n' + ' for_stmt ::= "for" target_list "in" expression_list ":" ' + 'suite\n' + ' ["else" ":" suite]\n' + '\n' + 'The expression list is evaluated once; it should yield an ' + 'iterable\n' + 'object. An iterator is created for the result of the\n' + '"expression_list". The suite is then executed once for each ' + 'item\n' + 'provided by the iterator, in the order of ascending indices. ' + 'Each\n' + 'item in turn is assigned to the target list using the standard ' + 'rules\n' + 'for assignments, and then the suite is executed. When the items ' + 'are\n' + 'exhausted (which is immediately when the sequence is empty), the ' + 'suite\n' + 'in the "else" clause, if present, is executed, and the loop\n' + 'terminates.\n' + '\n' + 'A "break" statement executed in the first suite terminates the ' + 'loop\n' + 'without executing the "else" clause\'s suite. A "continue" ' + 'statement\n' + 'executed in the first suite skips the rest of the suite and ' + 'continues\n' + 'with the next item, or with the "else" clause if there was no ' + 'next\n' + 'item.\n' + '\n' + 'The suite may assign to the variable(s) in the target list; this ' + 'does\n' + 'not affect the next item assigned to it.\n' + '\n' + 'The target list is not deleted when the loop is finished, but if ' + 'the\n' + 'sequence is empty, it will not have been assigned to at all by ' + 'the\n' + 'loop. Hint: the built-in function "range()" returns a sequence ' + 'of\n' + 'integers suitable to emulate the effect of Pascal\'s "for i := a ' + 'to b\n' + 'do"; e.g., "range(3)" returns the list "[0, 1, 2]".\n' + '\n' + 'Note: There is a subtlety when the sequence is being modified by ' + 'the\n' + ' loop (this can only occur for mutable sequences, i.e. lists). ' + 'An\n' + ' internal counter is used to keep track of which item is used ' + 'next,\n' + ' and this is incremented on each iteration. When this counter ' + 'has\n' + ' reached the length of the sequence the loop terminates. This ' + 'means\n' + ' that if the suite deletes the current (or a previous) item ' + 'from the\n' + ' sequence, the next item will be skipped (since it gets the ' + 'index of\n' + ' the current item which has already been treated). Likewise, ' + 'if the\n' + ' suite inserts an item in the sequence before the current item, ' + 'the\n' + ' current item will be treated again the next time through the ' + 'loop.\n' + ' This can lead to nasty bugs that can be avoided by making a\n' + ' temporary copy using a slice of the whole sequence, e.g.,\n' + '\n' + ' for x in a[:]:\n' + ' if x < 0: a.remove(x)\n' + '\n' + '\n' + 'The "try" statement\n' + '===================\n' + '\n' + 'The "try" statement specifies exception handlers and/or cleanup ' + 'code\n' + 'for a group of statements:\n' + '\n' + ' try_stmt ::= try1_stmt | try2_stmt\n' + ' try1_stmt ::= "try" ":" suite\n' + ' ("except" [expression [("as" | ",") ' + 'identifier]] ":" suite)+\n' + ' ["else" ":" suite]\n' + ' ["finally" ":" suite]\n' + ' try2_stmt ::= "try" ":" suite\n' + ' "finally" ":" suite\n' + '\n' + 'Changed in version 2.5: In previous versions of Python,\n' + '"try"..."except"..."finally" did not work. "try"..."except" had ' + 'to be\n' + 'nested in "try"..."finally".\n' + '\n' + 'The "except" clause(s) specify one or more exception handlers. ' + 'When no\n' + 'exception occurs in the "try" clause, no exception handler is\n' + 'executed. When an exception occurs in the "try" suite, a search ' + 'for an\n' + 'exception handler is started. This search inspects the except ' + 'clauses\n' + 'in turn until one is found that matches the exception. An ' + 'expression-\n' + 'less except clause, if present, must be last; it matches any\n' + 'exception. For an except clause with an expression, that ' + 'expression\n' + 'is evaluated, and the clause matches the exception if the ' + 'resulting\n' + 'object is "compatible" with the exception. An object is ' + 'compatible\n' + 'with an exception if it is the class or a base class of the ' + 'exception\n' + 'object, or a tuple containing an item compatible with the ' + 'exception.\n' + '\n' + 'If no except clause matches the exception, the search for an ' + 'exception\n' + 'handler continues in the surrounding code and on the invocation ' + 'stack.\n' + '[1]\n' + '\n' + 'If the evaluation of an expression in the header of an except ' + 'clause\n' + 'raises an exception, the original search for a handler is ' + 'canceled and\n' + 'a search starts for the new exception in the surrounding code ' + 'and on\n' + 'the call stack (it is treated as if the entire "try" statement ' + 'raised\n' + 'the exception).\n' + '\n' + 'When a matching except clause is found, the exception is ' + 'assigned to\n' + 'the target specified in that except clause, if present, and the ' + 'except\n' + "clause's suite is executed. All except clauses must have an\n" + 'executable block. When the end of this block is reached, ' + 'execution\n' + 'continues normally after the entire try statement. (This means ' + 'that\n' + 'if two nested handlers exist for the same exception, and the ' + 'exception\n' + 'occurs in the try clause of the inner handler, the outer handler ' + 'will\n' + 'not handle the exception.)\n' + '\n' + "Before an except clause's suite is executed, details about the\n" + 'exception are assigned to three variables in the "sys" module:\n' + '"sys.exc_type" receives the object identifying the exception;\n' + '"sys.exc_value" receives the exception\'s parameter;\n' + '"sys.exc_traceback" receives a traceback object (see section ' + 'The\n' + 'standard type hierarchy) identifying the point in the program ' + 'where\n' + 'the exception occurred. These details are also available through ' + 'the\n' + '"sys.exc_info()" function, which returns a tuple "(exc_type,\n' + 'exc_value, exc_traceback)". Use of the corresponding variables ' + 'is\n' + 'deprecated in favor of this function, since their use is unsafe ' + 'in a\n' + 'threaded program. As of Python 1.5, the variables are restored ' + 'to\n' + 'their previous values (before the call) when returning from a ' + 'function\n' + 'that handled an exception.\n' + '\n' + 'The optional "else" clause is executed if and when control flows ' + 'off\n' + 'the end of the "try" clause. [2] Exceptions in the "else" clause ' + 'are\n' + 'not handled by the preceding "except" clauses.\n' + '\n' + 'If "finally" is present, it specifies a \'cleanup\' handler. ' + 'The "try"\n' + 'clause is executed, including any "except" and "else" clauses. ' + 'If an\n' + 'exception occurs in any of the clauses and is not handled, the\n' + 'exception is temporarily saved. The "finally" clause is ' + 'executed. If\n' + 'there is a saved exception, it is re-raised at the end of the\n' + '"finally" clause. If the "finally" clause raises another ' + 'exception or\n' + 'executes a "return" or "break" statement, the saved exception ' + 'is\n' + 'discarded:\n' + '\n' + ' >>> def f():\n' + ' ... try:\n' + ' ... 1/0\n' + ' ... finally:\n' + ' ... return 42\n' + ' ...\n' + ' >>> f()\n' + ' 42\n' + '\n' + 'The exception information is not available to the program ' + 'during\n' + 'execution of the "finally" clause.\n' + '\n' + 'When a "return", "break" or "continue" statement is executed in ' + 'the\n' + '"try" suite of a "try"..."finally" statement, the "finally" ' + 'clause is\n' + 'also executed \'on the way out.\' A "continue" statement is ' + 'illegal in\n' + 'the "finally" clause. (The reason is a problem with the current\n' + 'implementation --- this restriction may be lifted in the ' + 'future).\n' + '\n' + 'The return value of a function is determined by the last ' + '"return"\n' + 'statement executed. Since the "finally" clause always executes, ' + 'a\n' + '"return" statement executed in the "finally" clause will always ' + 'be the\n' + 'last one executed:\n' + '\n' + ' >>> def foo():\n' + ' ... try:\n' + " ... return 'try'\n" + ' ... finally:\n' + " ... return 'finally'\n" + ' ...\n' + ' >>> foo()\n' + " 'finally'\n" + '\n' + 'Additional information on exceptions can be found in section\n' + 'Exceptions, and information on using the "raise" statement to ' + 'generate\n' + 'exceptions may be found in section The raise statement.\n' + '\n' + '\n' + 'The "with" statement\n' + '====================\n' + '\n' + 'New in version 2.5.\n' + '\n' + 'The "with" statement is used to wrap the execution of a block ' + 'with\n' + 'methods defined by a context manager (see section With ' + 'Statement\n' + 'Context Managers). This allows common ' + '"try"..."except"..."finally"\n' + 'usage patterns to be encapsulated for convenient reuse.\n' + '\n' + ' with_stmt ::= "with" with_item ("," with_item)* ":" suite\n' + ' with_item ::= expression ["as" target]\n' + '\n' + 'The execution of the "with" statement with one "item" proceeds ' + 'as\n' + 'follows:\n' + '\n' + '1. The context expression (the expression given in the ' + '"with_item")\n' + ' is evaluated to obtain a context manager.\n' + '\n' + '2. The context manager\'s "__exit__()" is loaded for later use.\n' + '\n' + '3. The context manager\'s "__enter__()" method is invoked.\n' + '\n' + '4. If a target was included in the "with" statement, the return\n' + ' value from "__enter__()" is assigned to it.\n' + '\n' + ' Note: The "with" statement guarantees that if the ' + '"__enter__()"\n' + ' method returns without an error, then "__exit__()" will ' + 'always be\n' + ' called. Thus, if an error occurs during the assignment to ' + 'the\n' + ' target list, it will be treated the same as an error ' + 'occurring\n' + ' within the suite would be. See step 6 below.\n' + '\n' + '5. The suite is executed.\n' + '\n' + '6. The context manager\'s "__exit__()" method is invoked. If an\n' + ' exception caused the suite to be exited, its type, value, ' + 'and\n' + ' traceback are passed as arguments to "__exit__()". Otherwise, ' + 'three\n' + ' "None" arguments are supplied.\n' + '\n' + ' If the suite was exited due to an exception, and the return ' + 'value\n' + ' from the "__exit__()" method was false, the exception is ' + 'reraised.\n' + ' If the return value was true, the exception is suppressed, ' + 'and\n' + ' execution continues with the statement following the "with"\n' + ' statement.\n' + '\n' + ' If the suite was exited for any reason other than an ' + 'exception, the\n' + ' return value from "__exit__()" is ignored, and execution ' + 'proceeds\n' + ' at the normal location for the kind of exit that was taken.\n' + '\n' + 'With more than one item, the context managers are processed as ' + 'if\n' + 'multiple "with" statements were nested:\n' + '\n' + ' with A() as a, B() as b:\n' + ' suite\n' + '\n' + 'is equivalent to\n' + '\n' + ' with A() as a:\n' + ' with B() as b:\n' + ' suite\n' + '\n' + 'Note: In Python 2.5, the "with" statement is only allowed when ' + 'the\n' + ' "with_statement" feature has been enabled. It is always ' + 'enabled in\n' + ' Python 2.6.\n' + '\n' + 'Changed in version 2.7: Support for multiple context ' + 'expressions.\n' + '\n' + 'See also:\n' + '\n' + ' **PEP 343** - The "with" statement\n' + ' The specification, background, and examples for the Python ' + '"with"\n' + ' statement.\n' + '\n' + '\n' + 'Function definitions\n' + '====================\n' + '\n' + 'A function definition defines a user-defined function object ' + '(see\n' + 'section The standard type hierarchy):\n' + '\n' + ' decorated ::= decorators (classdef | funcdef)\n' + ' decorators ::= decorator+\n' + ' decorator ::= "@" dotted_name ["(" [argument_list [","]] ' + '")"] NEWLINE\n' + ' funcdef ::= "def" funcname "(" [parameter_list] ")" ' + '":" suite\n' + ' dotted_name ::= identifier ("." identifier)*\n' + ' parameter_list ::= (defparameter ",")*\n' + ' ( "*" identifier ["," "**" identifier]\n' + ' | "**" identifier\n' + ' | defparameter [","] )\n' + ' defparameter ::= parameter ["=" expression]\n' + ' sublist ::= parameter ("," parameter)* [","]\n' + ' parameter ::= identifier | "(" sublist ")"\n' + ' funcname ::= identifier\n' + '\n' + 'A function definition is an executable statement. Its execution ' + 'binds\n' + 'the function name in the current local namespace to a function ' + 'object\n' + '(a wrapper around the executable code for the function). This\n' + 'function object contains a reference to the current global ' + 'namespace\n' + 'as the global namespace to be used when the function is called.\n' + '\n' + 'The function definition does not execute the function body; this ' + 'gets\n' + 'executed only when the function is called. [3]\n' + '\n' + 'A function definition may be wrapped by one or more *decorator*\n' + 'expressions. Decorator expressions are evaluated when the ' + 'function is\n' + 'defined, in the scope that contains the function definition. ' + 'The\n' + 'result must be a callable, which is invoked with the function ' + 'object\n' + 'as the only argument. The returned value is bound to the ' + 'function name\n' + 'instead of the function object. Multiple decorators are applied ' + 'in\n' + 'nested fashion. For example, the following code:\n' + '\n' + ' @f1(arg)\n' + ' @f2\n' + ' def func(): pass\n' + '\n' + 'is equivalent to:\n' + '\n' + ' def func(): pass\n' + ' func = f1(arg)(f2(func))\n' + '\n' + 'When one or more top-level *parameters* have the form ' + '*parameter* "="\n' + '*expression*, the function is said to have "default parameter ' + 'values."\n' + 'For a parameter with a default value, the corresponding ' + '*argument* may\n' + "be omitted from a call, in which case the parameter's default " + 'value is\n' + 'substituted. If a parameter has a default value, all following\n' + 'parameters must also have a default value --- this is a ' + 'syntactic\n' + 'restriction that is not expressed by the grammar.\n' + '\n' + '**Default parameter values are evaluated when the function ' + 'definition\n' + 'is executed.** This means that the expression is evaluated ' + 'once, when\n' + 'the function is defined, and that the same "pre-computed" value ' + 'is\n' + 'used for each call. This is especially important to understand ' + 'when a\n' + 'default parameter is a mutable object, such as a list or a ' + 'dictionary:\n' + 'if the function modifies the object (e.g. by appending an item ' + 'to a\n' + 'list), the default value is in effect modified. This is ' + 'generally not\n' + 'what was intended. A way around this is to use "None" as the\n' + 'default, and explicitly test for it in the body of the function, ' + 'e.g.:\n' + '\n' + ' def whats_on_the_telly(penguin=None):\n' + ' if penguin is None:\n' + ' penguin = []\n' + ' penguin.append("property of the zoo")\n' + ' return penguin\n' + '\n' + 'Function call semantics are described in more detail in section ' + 'Calls.\n' + 'A function call always assigns values to all parameters ' + 'mentioned in\n' + 'the parameter list, either from position arguments, from ' + 'keyword\n' + 'arguments, or from default values. If the form ""*identifier"" ' + 'is\n' + 'present, it is initialized to a tuple receiving any excess ' + 'positional\n' + 'parameters, defaulting to the empty tuple. If the form\n' + '""**identifier"" is present, it is initialized to a new ' + 'dictionary\n' + 'receiving any excess keyword arguments, defaulting to a new ' + 'empty\n' + 'dictionary.\n' + '\n' + 'It is also possible to create anonymous functions (functions not ' + 'bound\n' + 'to a name), for immediate use in expressions. This uses lambda\n' + 'expressions, described in section Lambdas. Note that the ' + 'lambda\n' + 'expression is merely a shorthand for a simplified function ' + 'definition;\n' + 'a function defined in a ""def"" statement can be passed around ' + 'or\n' + 'assigned to another name just like a function defined by a ' + 'lambda\n' + 'expression. The ""def"" form is actually more powerful since ' + 'it\n' + 'allows the execution of multiple statements.\n' + '\n' + "**Programmer's note:** Functions are first-class objects. A " + '""def""\n' + 'form executed inside a function definition defines a local ' + 'function\n' + 'that can be returned or passed around. Free variables used in ' + 'the\n' + 'nested function can access the local variables of the function\n' + 'containing the def. See section Naming and binding for ' + 'details.\n' + '\n' + '\n' + 'Class definitions\n' + '=================\n' + '\n' + 'A class definition defines a class object (see section The ' + 'standard\n' + 'type hierarchy):\n' + '\n' + ' classdef ::= "class" classname [inheritance] ":" suite\n' + ' inheritance ::= "(" [expression_list] ")"\n' + ' classname ::= identifier\n' + '\n' + 'A class definition is an executable statement. It first ' + 'evaluates the\n' + 'inheritance list, if present. Each item in the inheritance ' + 'list\n' + 'should evaluate to a class object or class type which allows\n' + "subclassing. The class's suite is then executed in a new " + 'execution\n' + 'frame (see section Naming and binding), using a newly created ' + 'local\n' + 'namespace and the original global namespace. (Usually, the ' + 'suite\n' + "contains only function definitions.) When the class's suite " + 'finishes\n' + 'execution, its execution frame is discarded but its local ' + 'namespace is\n' + 'saved. [4] A class object is then created using the inheritance ' + 'list\n' + 'for the base classes and the saved local namespace for the ' + 'attribute\n' + 'dictionary. The class name is bound to this class object in ' + 'the\n' + 'original local namespace.\n' + '\n' + "**Programmer's note:** Variables defined in the class definition " + 'are\n' + 'class variables; they are shared by all instances. To create ' + 'instance\n' + 'variables, they can be set in a method with "self.name = ' + 'value". Both\n' + 'class and instance variables are accessible through the ' + 'notation\n' + '""self.name"", and an instance variable hides a class variable ' + 'with\n' + 'the same name when accessed in this way. Class variables can be ' + 'used\n' + 'as defaults for instance variables, but using mutable values ' + 'there can\n' + 'lead to unexpected results. For *new-style class*es, ' + 'descriptors can\n' + 'be used to create instance variables with different ' + 'implementation\n' + 'details.\n' + '\n' + 'Class definitions, like function definitions, may be wrapped by ' + 'one or\n' + 'more *decorator* expressions. The evaluation rules for the ' + 'decorator\n' + 'expressions are the same as for functions. The result must be a ' + 'class\n' + 'object, which is then bound to the class name.\n' + '\n' + '-[ Footnotes ]-\n' + '\n' + '[1] The exception is propagated to the invocation stack unless\n' + ' there is a "finally" clause which happens to raise another\n' + ' exception. That new exception causes the old one to be ' + 'lost.\n' + '\n' + '[2] Currently, control "flows off the end" except in the case ' + 'of\n' + ' an exception or the execution of a "return", "continue", or\n' + ' "break" statement.\n' + '\n' + '[3] A string literal appearing as the first statement in the\n' + ' function body is transformed into the function\'s "__doc__"\n' + " attribute and therefore the function's *docstring*.\n" + '\n' + '[4] A string literal appearing as the first statement in the ' + 'class\n' + ' body is transformed into the namespace\'s "__doc__" item ' + 'and\n' + " therefore the class's *docstring*.\n", + 'context-managers': '\n' + 'With Statement Context Managers\n' + '*******************************\n' + '\n' + 'New in version 2.5.\n' + '\n' + 'A *context manager* is an object that defines the ' + 'runtime context to\n' + 'be established when executing a "with" statement. The ' + 'context manager\n' + 'handles the entry into, and the exit from, the desired ' + 'runtime context\n' + 'for the execution of the block of code. Context ' + 'managers are normally\n' + 'invoked using the "with" statement (described in section ' + 'The with\n' + 'statement), but can also be used by directly invoking ' + 'their methods.\n' + '\n' + 'Typical uses of context managers include saving and ' + 'restoring various\n' + 'kinds of global state, locking and unlocking resources, ' + 'closing opened\n' + 'files, etc.\n' + '\n' + 'For more information on context managers, see Context ' + 'Manager Types.\n' + '\n' + 'object.__enter__(self)\n' + '\n' + ' Enter the runtime context related to this object. The ' + '"with"\n' + " statement will bind this method's return value to the " + 'target(s)\n' + ' specified in the "as" clause of the statement, if ' + 'any.\n' + '\n' + 'object.__exit__(self, exc_type, exc_value, traceback)\n' + '\n' + ' Exit the runtime context related to this object. The ' + 'parameters\n' + ' describe the exception that caused the context to be ' + 'exited. If the\n' + ' context was exited without an exception, all three ' + 'arguments will\n' + ' be "None".\n' + '\n' + ' If an exception is supplied, and the method wishes to ' + 'suppress the\n' + ' exception (i.e., prevent it from being propagated), ' + 'it should\n' + ' return a true value. Otherwise, the exception will be ' + 'processed\n' + ' normally upon exit from this method.\n' + '\n' + ' Note that "__exit__()" methods should not reraise the ' + 'passed-in\n' + " exception; this is the caller's responsibility.\n" + '\n' + 'See also:\n' + '\n' + ' **PEP 343** - The "with" statement\n' + ' The specification, background, and examples for the ' + 'Python "with"\n' + ' statement.\n', + 'continue': '\n' + 'The "continue" statement\n' + '************************\n' + '\n' + ' continue_stmt ::= "continue"\n' + '\n' + '"continue" may only occur syntactically nested in a "for" or ' + '"while"\n' + 'loop, but not nested in a function or class definition or ' + '"finally"\n' + 'clause within that loop. It continues with the next cycle of ' + 'the\n' + 'nearest enclosing loop.\n' + '\n' + 'When "continue" passes control out of a "try" statement with a\n' + '"finally" clause, that "finally" clause is executed before ' + 'really\n' + 'starting the next loop cycle.\n', + 'conversions': '\n' + 'Arithmetic conversions\n' + '**********************\n' + '\n' + 'When a description of an arithmetic operator below uses the ' + 'phrase\n' + '"the numeric arguments are converted to a common type," the ' + 'arguments\n' + 'are coerced using the coercion rules listed at Coercion ' + 'rules. If\n' + 'both arguments are standard numeric types, the following ' + 'coercions are\n' + 'applied:\n' + '\n' + '* If either argument is a complex number, the other is ' + 'converted to\n' + ' complex;\n' + '\n' + '* otherwise, if either argument is a floating point number, ' + 'the\n' + ' other is converted to floating point;\n' + '\n' + '* otherwise, if either argument is a long integer, the other ' + 'is\n' + ' converted to long integer;\n' + '\n' + '* otherwise, both must be plain integers and no conversion ' + 'is\n' + ' necessary.\n' + '\n' + 'Some additional rules apply for certain operators (e.g., a ' + 'string left\n' + "argument to the '%' operator). Extensions can define their " + 'own\n' + 'coercions.\n', + 'customization': '\n' + 'Basic customization\n' + '*******************\n' + '\n' + 'object.__new__(cls[, ...])\n' + '\n' + ' Called to create a new instance of class *cls*. ' + '"__new__()" is a\n' + ' static method (special-cased so you need not declare it ' + 'as such)\n' + ' that takes the class of which an instance was requested ' + 'as its\n' + ' first argument. The remaining arguments are those ' + 'passed to the\n' + ' object constructor expression (the call to the class). ' + 'The return\n' + ' value of "__new__()" should be the new object instance ' + '(usually an\n' + ' instance of *cls*).\n' + '\n' + ' Typical implementations create a new instance of the ' + 'class by\n' + ' invoking the superclass\'s "__new__()" method using\n' + ' "super(currentclass, cls).__new__(cls[, ...])" with ' + 'appropriate\n' + ' arguments and then modifying the newly-created instance ' + 'as\n' + ' necessary before returning it.\n' + '\n' + ' If "__new__()" returns an instance of *cls*, then the ' + 'new\n' + ' instance\'s "__init__()" method will be invoked like\n' + ' "__init__(self[, ...])", where *self* is the new ' + 'instance and the\n' + ' remaining arguments are the same as were passed to ' + '"__new__()".\n' + '\n' + ' If "__new__()" does not return an instance of *cls*, ' + 'then the new\n' + ' instance\'s "__init__()" method will not be invoked.\n' + '\n' + ' "__new__()" is intended mainly to allow subclasses of ' + 'immutable\n' + ' types (like int, str, or tuple) to customize instance ' + 'creation. It\n' + ' is also commonly overridden in custom metaclasses in ' + 'order to\n' + ' customize class creation.\n' + '\n' + 'object.__init__(self[, ...])\n' + '\n' + ' Called after the instance has been created (by ' + '"__new__()"), but\n' + ' before it is returned to the caller. The arguments are ' + 'those\n' + ' passed to the class constructor expression. If a base ' + 'class has an\n' + ' "__init__()" method, the derived class\'s "__init__()" ' + 'method, if\n' + ' any, must explicitly call it to ensure proper ' + 'initialization of the\n' + ' base class part of the instance; for example:\n' + ' "BaseClass.__init__(self, [args...])".\n' + '\n' + ' Because "__new__()" and "__init__()" work together in ' + 'constructing\n' + ' objects ("__new__()" to create it, and "__init__()" to ' + 'customise\n' + ' it), no non-"None" value may be returned by ' + '"__init__()"; doing so\n' + ' will cause a "TypeError" to be raised at runtime.\n' + '\n' + 'object.__del__(self)\n' + '\n' + ' Called when the instance is about to be destroyed. This ' + 'is also\n' + ' called a destructor. If a base class has a "__del__()" ' + 'method, the\n' + ' derived class\'s "__del__()" method, if any, must ' + 'explicitly call it\n' + ' to ensure proper deletion of the base class part of the ' + 'instance.\n' + ' Note that it is possible (though not recommended!) for ' + 'the\n' + ' "__del__()" method to postpone destruction of the ' + 'instance by\n' + ' creating a new reference to it. It may then be called ' + 'at a later\n' + ' time when this new reference is deleted. It is not ' + 'guaranteed that\n' + ' "__del__()" methods are called for objects that still ' + 'exist when\n' + ' the interpreter exits.\n' + '\n' + ' Note: "del x" doesn\'t directly call "x.__del__()" --- ' + 'the former\n' + ' decrements the reference count for "x" by one, and the ' + 'latter is\n' + ' only called when "x"\'s reference count reaches zero. ' + 'Some common\n' + ' situations that may prevent the reference count of an ' + 'object from\n' + ' going to zero include: circular references between ' + 'objects (e.g.,\n' + ' a doubly-linked list or a tree data structure with ' + 'parent and\n' + ' child pointers); a reference to the object on the ' + 'stack frame of\n' + ' a function that caught an exception (the traceback ' + 'stored in\n' + ' "sys.exc_traceback" keeps the stack frame alive); or a ' + 'reference\n' + ' to the object on the stack frame that raised an ' + 'unhandled\n' + ' exception in interactive mode (the traceback stored ' + 'in\n' + ' "sys.last_traceback" keeps the stack frame alive). ' + 'The first\n' + ' situation can only be remedied by explicitly breaking ' + 'the cycles;\n' + ' the latter two situations can be resolved by storing ' + '"None" in\n' + ' "sys.exc_traceback" or "sys.last_traceback". Circular ' + 'references\n' + ' which are garbage are detected when the option cycle ' + 'detector is\n' + " enabled (it's on by default), but can only be cleaned " + 'up if there\n' + ' are no Python-level "__del__()" methods involved. ' + 'Refer to the\n' + ' documentation for the "gc" module for more information ' + 'about how\n' + ' "__del__()" methods are handled by the cycle ' + 'detector,\n' + ' particularly the description of the "garbage" value.\n' + '\n' + ' Warning: Due to the precarious circumstances under ' + 'which\n' + ' "__del__()" methods are invoked, exceptions that occur ' + 'during\n' + ' their execution are ignored, and a warning is printed ' + 'to\n' + ' "sys.stderr" instead. Also, when "__del__()" is ' + 'invoked in\n' + ' response to a module being deleted (e.g., when ' + 'execution of the\n' + ' program is done), other globals referenced by the ' + '"__del__()"\n' + ' method may already have been deleted or in the process ' + 'of being\n' + ' torn down (e.g. the import machinery shutting down). ' + 'For this\n' + ' reason, "__del__()" methods should do the absolute ' + 'minimum needed\n' + ' to maintain external invariants. Starting with ' + 'version 1.5,\n' + ' Python guarantees that globals whose name begins with ' + 'a single\n' + ' underscore are deleted from their module before other ' + 'globals are\n' + ' deleted; if no other references to such globals exist, ' + 'this may\n' + ' help in assuring that imported modules are still ' + 'available at the\n' + ' time when the "__del__()" method is called.\n' + '\n' + ' See also the "-R" command-line option.\n' + '\n' + 'object.__repr__(self)\n' + '\n' + ' Called by the "repr()" built-in function and by string ' + 'conversions\n' + ' (reverse quotes) to compute the "official" string ' + 'representation of\n' + ' an object. If at all possible, this should look like a ' + 'valid\n' + ' Python expression that could be used to recreate an ' + 'object with the\n' + ' same value (given an appropriate environment). If this ' + 'is not\n' + ' possible, a string of the form "<...some useful ' + 'description...>"\n' + ' should be returned. The return value must be a string ' + 'object. If a\n' + ' class defines "__repr__()" but not "__str__()", then ' + '"__repr__()"\n' + ' is also used when an "informal" string representation of ' + 'instances\n' + ' of that class is required.\n' + '\n' + ' This is typically used for debugging, so it is important ' + 'that the\n' + ' representation is information-rich and unambiguous.\n' + '\n' + 'object.__str__(self)\n' + '\n' + ' Called by the "str()" built-in function and by the ' + '"print"\n' + ' statement to compute the "informal" string ' + 'representation of an\n' + ' object. This differs from "__repr__()" in that it does ' + 'not have to\n' + ' be a valid Python expression: a more convenient or ' + 'concise\n' + ' representation may be used instead. The return value ' + 'must be a\n' + ' string object.\n' + '\n' + 'object.__lt__(self, other)\n' + 'object.__le__(self, other)\n' + 'object.__eq__(self, other)\n' + 'object.__ne__(self, other)\n' + 'object.__gt__(self, other)\n' + 'object.__ge__(self, other)\n' + '\n' + ' New in version 2.1.\n' + '\n' + ' These are the so-called "rich comparison" methods, and ' + 'are called\n' + ' for comparison operators in preference to "__cmp__()" ' + 'below. The\n' + ' correspondence between operator symbols and method names ' + 'is as\n' + ' follows: "xy" call ' + '"x.__ne__(y)",\n' + ' "x>y" calls "x.__gt__(y)", and "x>=y" calls ' + '"x.__ge__(y)".\n' + '\n' + ' A rich comparison method may return the singleton ' + '"NotImplemented"\n' + ' if it does not implement the operation for a given pair ' + 'of\n' + ' arguments. By convention, "False" and "True" are ' + 'returned for a\n' + ' successful comparison. However, these methods can return ' + 'any value,\n' + ' so if the comparison operator is used in a Boolean ' + 'context (e.g.,\n' + ' in the condition of an "if" statement), Python will call ' + '"bool()"\n' + ' on the value to determine if the result is true or ' + 'false.\n' + '\n' + ' There are no implied relationships among the comparison ' + 'operators.\n' + ' The truth of "x==y" does not imply that "x!=y" is ' + 'false.\n' + ' Accordingly, when defining "__eq__()", one should also ' + 'define\n' + ' "__ne__()" so that the operators will behave as ' + 'expected. See the\n' + ' paragraph on "__hash__()" for some important notes on ' + 'creating\n' + ' *hashable* objects which support custom comparison ' + 'operations and\n' + ' are usable as dictionary keys.\n' + '\n' + ' There are no swapped-argument versions of these methods ' + '(to be used\n' + ' when the left argument does not support the operation ' + 'but the right\n' + ' argument does); rather, "__lt__()" and "__gt__()" are ' + "each other's\n" + ' reflection, "__le__()" and "__ge__()" are each other\'s ' + 'reflection,\n' + ' and "__eq__()" and "__ne__()" are their own reflection.\n' + '\n' + ' Arguments to rich comparison methods are never coerced.\n' + '\n' + ' To automatically generate ordering operations from a ' + 'single root\n' + ' operation, see "functools.total_ordering()".\n' + '\n' + 'object.__cmp__(self, other)\n' + '\n' + ' Called by comparison operations if rich comparison (see ' + 'above) is\n' + ' not defined. Should return a negative integer if "self ' + '< other",\n' + ' zero if "self == other", a positive integer if "self > ' + 'other". If\n' + ' no "__cmp__()", "__eq__()" or "__ne__()" operation is ' + 'defined,\n' + ' class instances are compared by object identity ' + '("address"). See\n' + ' also the description of "__hash__()" for some important ' + 'notes on\n' + ' creating *hashable* objects which support custom ' + 'comparison\n' + ' operations and are usable as dictionary keys. (Note: ' + 'the\n' + ' restriction that exceptions are not propagated by ' + '"__cmp__()" has\n' + ' been removed since Python 1.5.)\n' + '\n' + 'object.__rcmp__(self, other)\n' + '\n' + ' Changed in version 2.1: No longer supported.\n' + '\n' + 'object.__hash__(self)\n' + '\n' + ' Called by built-in function "hash()" and for operations ' + 'on members\n' + ' of hashed collections including "set", "frozenset", and ' + '"dict".\n' + ' "__hash__()" should return an integer. The only ' + 'required property\n' + ' is that objects which compare equal have the same hash ' + 'value; it is\n' + ' advised to somehow mix together (e.g. using exclusive ' + 'or) the hash\n' + ' values for the components of the object that also play a ' + 'part in\n' + ' comparison of objects.\n' + '\n' + ' If a class does not define a "__cmp__()" or "__eq__()" ' + 'method it\n' + ' should not define a "__hash__()" operation either; if it ' + 'defines\n' + ' "__cmp__()" or "__eq__()" but not "__hash__()", its ' + 'instances will\n' + ' not be usable in hashed collections. If a class defines ' + 'mutable\n' + ' objects and implements a "__cmp__()" or "__eq__()" ' + 'method, it\n' + ' should not implement "__hash__()", since hashable ' + 'collection\n' + " implementations require that a object's hash value is " + 'immutable (if\n' + " the object's hash value changes, it will be in the wrong " + 'hash\n' + ' bucket).\n' + '\n' + ' User-defined classes have "__cmp__()" and "__hash__()" ' + 'methods by\n' + ' default; with them, all objects compare unequal (except ' + 'with\n' + ' themselves) and "x.__hash__()" returns a result derived ' + 'from\n' + ' "id(x)".\n' + '\n' + ' Classes which inherit a "__hash__()" method from a ' + 'parent class but\n' + ' change the meaning of "__cmp__()" or "__eq__()" such ' + 'that the hash\n' + ' value returned is no longer appropriate (e.g. by ' + 'switching to a\n' + ' value-based concept of equality instead of the default ' + 'identity\n' + ' based equality) can explicitly flag themselves as being ' + 'unhashable\n' + ' by setting "__hash__ = None" in the class definition. ' + 'Doing so\n' + ' means that not only will instances of the class raise ' + 'an\n' + ' appropriate "TypeError" when a program attempts to ' + 'retrieve their\n' + ' hash value, but they will also be correctly identified ' + 'as\n' + ' unhashable when checking "isinstance(obj, ' + 'collections.Hashable)"\n' + ' (unlike classes which define their own "__hash__()" to ' + 'explicitly\n' + ' raise "TypeError").\n' + '\n' + ' Changed in version 2.5: "__hash__()" may now also return ' + 'a long\n' + ' integer object; the 32-bit integer is then derived from ' + 'the hash of\n' + ' that object.\n' + '\n' + ' Changed in version 2.6: "__hash__" may now be set to ' + '"None" to\n' + ' explicitly flag instances of a class as unhashable.\n' + '\n' + 'object.__nonzero__(self)\n' + '\n' + ' Called to implement truth value testing and the built-in ' + 'operation\n' + ' "bool()"; should return "False" or "True", or their ' + 'integer\n' + ' equivalents "0" or "1". When this method is not ' + 'defined,\n' + ' "__len__()" is called, if it is defined, and the object ' + 'is\n' + ' considered true if its result is nonzero. If a class ' + 'defines\n' + ' neither "__len__()" nor "__nonzero__()", all its ' + 'instances are\n' + ' considered true.\n' + '\n' + 'object.__unicode__(self)\n' + '\n' + ' Called to implement "unicode()" built-in; should return ' + 'a Unicode\n' + ' object. When this method is not defined, string ' + 'conversion is\n' + ' attempted, and the result of string conversion is ' + 'converted to\n' + ' Unicode using the system default encoding.\n', + 'debugger': '\n' + '"pdb" --- The Python Debugger\n' + '*****************************\n' + '\n' + '**Source code:** Lib/pdb.py\n' + '\n' + '======================================================================\n' + '\n' + 'The module "pdb" defines an interactive source code debugger ' + 'for\n' + 'Python programs. It supports setting (conditional) breakpoints ' + 'and\n' + 'single stepping at the source line level, inspection of stack ' + 'frames,\n' + 'source code listing, and evaluation of arbitrary Python code in ' + 'the\n' + 'context of any stack frame. It also supports post-mortem ' + 'debugging\n' + 'and can be called under program control.\n' + '\n' + 'The debugger is extensible --- it is actually defined as the ' + 'class\n' + '"Pdb". This is currently undocumented but easily understood by ' + 'reading\n' + 'the source. The extension interface uses the modules "bdb" and ' + '"cmd".\n' + '\n' + 'The debugger\'s prompt is "(Pdb)". Typical usage to run a ' + 'program under\n' + 'control of the debugger is:\n' + '\n' + ' >>> import pdb\n' + ' >>> import mymodule\n' + " >>> pdb.run('mymodule.test()')\n" + ' > (0)?()\n' + ' (Pdb) continue\n' + ' > (1)?()\n' + ' (Pdb) continue\n' + " NameError: 'spam'\n" + ' > (1)?()\n' + ' (Pdb)\n' + '\n' + '"pdb.py" can also be invoked as a script to debug other ' + 'scripts. For\n' + 'example:\n' + '\n' + ' python -m pdb myscript.py\n' + '\n' + 'When invoked as a script, pdb will automatically enter ' + 'post-mortem\n' + 'debugging if the program being debugged exits abnormally. After ' + 'post-\n' + 'mortem debugging (or after normal exit of the program), pdb ' + 'will\n' + "restart the program. Automatic restarting preserves pdb's state " + '(such\n' + 'as breakpoints) and in most cases is more useful than quitting ' + 'the\n' + "debugger upon program's exit.\n" + '\n' + 'New in version 2.4: Restarting post-mortem behavior added.\n' + '\n' + 'The typical usage to break into the debugger from a running ' + 'program is\n' + 'to insert\n' + '\n' + ' import pdb; pdb.set_trace()\n' + '\n' + 'at the location you want to break into the debugger. You can ' + 'then\n' + 'step through the code following this statement, and continue ' + 'running\n' + 'without the debugger using the "c" command.\n' + '\n' + 'The typical usage to inspect a crashed program is:\n' + '\n' + ' >>> import pdb\n' + ' >>> import mymodule\n' + ' >>> mymodule.test()\n' + ' Traceback (most recent call last):\n' + ' File "", line 1, in ?\n' + ' File "./mymodule.py", line 4, in test\n' + ' test2()\n' + ' File "./mymodule.py", line 3, in test2\n' + ' print spam\n' + ' NameError: spam\n' + ' >>> pdb.pm()\n' + ' > ./mymodule.py(3)test2()\n' + ' -> print spam\n' + ' (Pdb)\n' + '\n' + 'The module defines the following functions; each enters the ' + 'debugger\n' + 'in a slightly different way:\n' + '\n' + 'pdb.run(statement[, globals[, locals]])\n' + '\n' + ' Execute the *statement* (given as a string) under debugger ' + 'control.\n' + ' The debugger prompt appears before any code is executed; you ' + 'can\n' + ' set breakpoints and type "continue", or you can step through ' + 'the\n' + ' statement using "step" or "next" (all these commands are ' + 'explained\n' + ' below). The optional *globals* and *locals* arguments ' + 'specify the\n' + ' environment in which the code is executed; by default the\n' + ' dictionary of the module "__main__" is used. (See the ' + 'explanation\n' + ' of the "exec" statement or the "eval()" built-in function.)\n' + '\n' + 'pdb.runeval(expression[, globals[, locals]])\n' + '\n' + ' Evaluate the *expression* (given as a string) under debugger\n' + ' control. When "runeval()" returns, it returns the value of ' + 'the\n' + ' expression. Otherwise this function is similar to "run()".\n' + '\n' + 'pdb.runcall(function[, argument, ...])\n' + '\n' + ' Call the *function* (a function or method object, not a ' + 'string)\n' + ' with the given arguments. When "runcall()" returns, it ' + 'returns\n' + ' whatever the function call returned. The debugger prompt ' + 'appears\n' + ' as soon as the function is entered.\n' + '\n' + 'pdb.set_trace()\n' + '\n' + ' Enter the debugger at the calling stack frame. This is ' + 'useful to\n' + ' hard-code a breakpoint at a given point in a program, even if ' + 'the\n' + ' code is not otherwise being debugged (e.g. when an assertion\n' + ' fails).\n' + '\n' + 'pdb.post_mortem([traceback])\n' + '\n' + ' Enter post-mortem debugging of the given *traceback* object. ' + 'If no\n' + ' *traceback* is given, it uses the one of the exception that ' + 'is\n' + ' currently being handled (an exception must be being handled ' + 'if the\n' + ' default is to be used).\n' + '\n' + 'pdb.pm()\n' + '\n' + ' Enter post-mortem debugging of the traceback found in\n' + ' "sys.last_traceback".\n' + '\n' + 'The "run*" functions and "set_trace()" are aliases for ' + 'instantiating\n' + 'the "Pdb" class and calling the method of the same name. If you ' + 'want\n' + 'to access further features, you have to do this yourself:\n' + '\n' + "class pdb.Pdb(completekey='tab', stdin=None, stdout=None, " + 'skip=None)\n' + '\n' + ' "Pdb" is the debugger class.\n' + '\n' + ' The *completekey*, *stdin* and *stdout* arguments are passed ' + 'to the\n' + ' underlying "cmd.Cmd" class; see the description there.\n' + '\n' + ' The *skip* argument, if given, must be an iterable of ' + 'glob-style\n' + ' module name patterns. The debugger will not step into frames ' + 'that\n' + ' originate in a module that matches one of these patterns. ' + '[1]\n' + '\n' + ' Example call to enable tracing with *skip*:\n' + '\n' + " import pdb; pdb.Pdb(skip=['django.*']).set_trace()\n" + '\n' + ' New in version 2.7: The *skip* argument.\n' + '\n' + ' run(statement[, globals[, locals]])\n' + ' runeval(expression[, globals[, locals]])\n' + ' runcall(function[, argument, ...])\n' + ' set_trace()\n' + '\n' + ' See the documentation for the functions explained above.\n', + 'del': '\n' + 'The "del" statement\n' + '*******************\n' + '\n' + ' del_stmt ::= "del" target_list\n' + '\n' + 'Deletion is recursively defined very similar to the way assignment ' + 'is\n' + 'defined. Rather than spelling it out in full details, here are some\n' + 'hints.\n' + '\n' + 'Deletion of a target list recursively deletes each target, from left\n' + 'to right.\n' + '\n' + 'Deletion of a name removes the binding of that name from the local ' + 'or\n' + 'global namespace, depending on whether the name occurs in a "global"\n' + 'statement in the same code block. If the name is unbound, a\n' + '"NameError" exception will be raised.\n' + '\n' + 'It is illegal to delete a name from the local namespace if it occurs\n' + 'as a free variable in a nested block.\n' + '\n' + 'Deletion of attribute references, subscriptions and slicings is ' + 'passed\n' + 'to the primary object involved; deletion of a slicing is in general\n' + 'equivalent to assignment of an empty slice of the right type (but ' + 'even\n' + 'this is determined by the sliced object).\n', + 'dict': '\n' + 'Dictionary displays\n' + '*******************\n' + '\n' + 'A dictionary display is a possibly empty series of key/datum pairs\n' + 'enclosed in curly braces:\n' + '\n' + ' dict_display ::= "{" [key_datum_list | dict_comprehension] ' + '"}"\n' + ' key_datum_list ::= key_datum ("," key_datum)* [","]\n' + ' key_datum ::= expression ":" expression\n' + ' dict_comprehension ::= expression ":" expression comp_for\n' + '\n' + 'A dictionary display yields a new dictionary object.\n' + '\n' + 'If a comma-separated sequence of key/datum pairs is given, they are\n' + 'evaluated from left to right to define the entries of the ' + 'dictionary:\n' + 'each key object is used as a key into the dictionary to store the\n' + 'corresponding datum. This means that you can specify the same key\n' + "multiple times in the key/datum list, and the final dictionary's " + 'value\n' + 'for that key will be the last one given.\n' + '\n' + 'A dict comprehension, in contrast to list and set comprehensions,\n' + 'needs two expressions separated with a colon followed by the usual\n' + '"for" and "if" clauses. When the comprehension is run, the ' + 'resulting\n' + 'key and value elements are inserted in the new dictionary in the ' + 'order\n' + 'they are produced.\n' + '\n' + 'Restrictions on the types of the key values are listed earlier in\n' + 'section The standard type hierarchy. (To summarize, the key type\n' + 'should be *hashable*, which excludes all mutable objects.) Clashes\n' + 'between duplicate keys are not detected; the last datum (textually\n' + 'rightmost in the display) stored for a given key value prevails.\n', + 'dynamic-features': '\n' + 'Interaction with dynamic features\n' + '*********************************\n' + '\n' + 'There are several cases where Python statements are ' + 'illegal when used\n' + 'in conjunction with nested scopes that contain free ' + 'variables.\n' + '\n' + 'If a variable is referenced in an enclosing scope, it is ' + 'illegal to\n' + 'delete the name. An error will be reported at compile ' + 'time.\n' + '\n' + 'If the wild card form of import --- "import *" --- is ' + 'used in a\n' + 'function and the function contains or is a nested block ' + 'with free\n' + 'variables, the compiler will raise a "SyntaxError".\n' + '\n' + 'If "exec" is used in a function and the function ' + 'contains or is a\n' + 'nested block with free variables, the compiler will ' + 'raise a\n' + '"SyntaxError" unless the exec explicitly specifies the ' + 'local namespace\n' + 'for the "exec". (In other words, "exec obj" would be ' + 'illegal, but\n' + '"exec obj in ns" would be legal.)\n' + '\n' + 'The "eval()", "execfile()", and "input()" functions and ' + 'the "exec"\n' + 'statement do not have access to the full environment for ' + 'resolving\n' + 'names. Names may be resolved in the local and global ' + 'namespaces of\n' + 'the caller. Free variables are not resolved in the ' + 'nearest enclosing\n' + 'namespace, but in the global namespace. [1] The "exec" ' + 'statement and\n' + 'the "eval()" and "execfile()" functions have optional ' + 'arguments to\n' + 'override the global and local namespace. If only one ' + 'namespace is\n' + 'specified, it is used for both.\n', + 'else': '\n' + 'The "if" statement\n' + '******************\n' + '\n' + 'The "if" statement is used for conditional execution:\n' + '\n' + ' if_stmt ::= "if" expression ":" suite\n' + ' ( "elif" expression ":" suite )*\n' + ' ["else" ":" suite]\n' + '\n' + 'It selects exactly one of the suites by evaluating the expressions ' + 'one\n' + 'by one until one is found to be true (see section Boolean ' + 'operations\n' + 'for the definition of true and false); then that suite is executed\n' + '(and no other part of the "if" statement is executed or evaluated).\n' + 'If all expressions are false, the suite of the "else" clause, if\n' + 'present, is executed.\n', + 'exceptions': '\n' + 'Exceptions\n' + '**********\n' + '\n' + 'Exceptions are a means of breaking out of the normal flow of ' + 'control\n' + 'of a code block in order to handle errors or other ' + 'exceptional\n' + 'conditions. An exception is *raised* at the point where the ' + 'error is\n' + 'detected; it may be *handled* by the surrounding code block or ' + 'by any\n' + 'code block that directly or indirectly invoked the code block ' + 'where\n' + 'the error occurred.\n' + '\n' + 'The Python interpreter raises an exception when it detects a ' + 'run-time\n' + 'error (such as division by zero). A Python program can also\n' + 'explicitly raise an exception with the "raise" statement. ' + 'Exception\n' + 'handlers are specified with the "try" ... "except" statement. ' + 'The\n' + '"finally" clause of such a statement can be used to specify ' + 'cleanup\n' + 'code which does not handle the exception, but is executed ' + 'whether an\n' + 'exception occurred or not in the preceding code.\n' + '\n' + 'Python uses the "termination" model of error handling: an ' + 'exception\n' + 'handler can find out what happened and continue execution at ' + 'an outer\n' + 'level, but it cannot repair the cause of the error and retry ' + 'the\n' + 'failing operation (except by re-entering the offending piece ' + 'of code\n' + 'from the top).\n' + '\n' + 'When an exception is not handled at all, the interpreter ' + 'terminates\n' + 'execution of the program, or returns to its interactive main ' + 'loop. In\n' + 'either case, it prints a stack backtrace, except when the ' + 'exception is\n' + '"SystemExit".\n' + '\n' + 'Exceptions are identified by class instances. The "except" ' + 'clause is\n' + 'selected depending on the class of the instance: it must ' + 'reference the\n' + 'class of the instance or a base class thereof. The instance ' + 'can be\n' + 'received by the handler and can carry additional information ' + 'about the\n' + 'exceptional condition.\n' + '\n' + 'Exceptions can also be identified by strings, in which case ' + 'the\n' + '"except" clause is selected by object identity. An arbitrary ' + 'value\n' + 'can be raised along with the identifying string which can be ' + 'passed to\n' + 'the handler.\n' + '\n' + 'Note: Messages to exceptions are not part of the Python API. ' + 'Their\n' + ' contents may change from one version of Python to the next ' + 'without\n' + ' warning and should not be relied on by code which will run ' + 'under\n' + ' multiple versions of the interpreter.\n' + '\n' + 'See also the description of the "try" statement in section The ' + 'try\n' + 'statement and "raise" statement in section The raise ' + 'statement.\n' + '\n' + '-[ Footnotes ]-\n' + '\n' + '[1] This limitation occurs because the code that is executed ' + 'by\n' + ' these operations is not available at the time the module ' + 'is\n' + ' compiled.\n', + 'exec': '\n' + 'The "exec" statement\n' + '********************\n' + '\n' + ' exec_stmt ::= "exec" or_expr ["in" expression ["," expression]]\n' + '\n' + 'This statement supports dynamic execution of Python code. The ' + 'first\n' + 'expression should evaluate to either a Unicode string, a *Latin-1*\n' + 'encoded string, an open file object, a code object, or a tuple. If ' + 'it\n' + 'is a string, the string is parsed as a suite of Python statements\n' + 'which is then executed (unless a syntax error occurs). [1] If it is ' + 'an\n' + 'open file, the file is parsed until EOF and executed. If it is a ' + 'code\n' + 'object, it is simply executed. For the interpretation of a tuple, ' + 'see\n' + "below. In all cases, the code that's executed is expected to be " + 'valid\n' + 'as file input (see section File input). Be aware that the "return"\n' + 'and "yield" statements may not be used outside of function ' + 'definitions\n' + 'even within the context of code passed to the "exec" statement.\n' + '\n' + 'In all cases, if the optional parts are omitted, the code is ' + 'executed\n' + 'in the current scope. If only the first expression after "in" is\n' + 'specified, it should be a dictionary, which will be used for both ' + 'the\n' + 'global and the local variables. If two expressions are given, they\n' + 'are used for the global and local variables, respectively. If\n' + 'provided, *locals* can be any mapping object. Remember that at ' + 'module\n' + 'level, globals and locals are the same dictionary. If two separate\n' + 'objects are given as *globals* and *locals*, the code will be ' + 'executed\n' + 'as if it were embedded in a class definition.\n' + '\n' + 'The first expression may also be a tuple of length 2 or 3. In this\n' + 'case, the optional parts must be omitted. The form "exec(expr,\n' + 'globals)" is equivalent to "exec expr in globals", while the form\n' + '"exec(expr, globals, locals)" is equivalent to "exec expr in ' + 'globals,\n' + 'locals". The tuple form of "exec" provides compatibility with ' + 'Python\n' + '3, where "exec" is a function rather than a statement.\n' + '\n' + 'Changed in version 2.4: Formerly, *locals* was required to be a\n' + 'dictionary.\n' + '\n' + 'As a side effect, an implementation may insert additional keys into\n' + 'the dictionaries given besides those corresponding to variable ' + 'names\n' + 'set by the executed code. For example, the current implementation ' + 'may\n' + 'add a reference to the dictionary of the built-in module ' + '"__builtin__"\n' + 'under the key "__builtins__" (!).\n' + '\n' + "**Programmer's hints:** dynamic evaluation of expressions is " + 'supported\n' + 'by the built-in function "eval()". The built-in functions ' + '"globals()"\n' + 'and "locals()" return the current global and local dictionary,\n' + 'respectively, which may be useful to pass around for use by "exec".\n' + '\n' + '-[ Footnotes ]-\n' + '\n' + '[1] Note that the parser only accepts the Unix-style end of line\n' + ' convention. If you are reading the code from a file, make sure ' + 'to\n' + ' use *universal newlines* mode to convert Windows or Mac-style\n' + ' newlines.\n', + 'execmodel': '\n' + 'Execution model\n' + '***************\n' + '\n' + '\n' + 'Naming and binding\n' + '==================\n' + '\n' + '*Names* refer to objects. Names are introduced by name ' + 'binding\n' + 'operations. Each occurrence of a name in the program text ' + 'refers to\n' + 'the *binding* of that name established in the innermost ' + 'function block\n' + 'containing the use.\n' + '\n' + 'A *block* is a piece of Python program text that is executed as ' + 'a\n' + 'unit. The following are blocks: a module, a function body, and ' + 'a class\n' + 'definition. Each command typed interactively is a block. A ' + 'script\n' + 'file (a file given as standard input to the interpreter or ' + 'specified\n' + 'on the interpreter command line the first argument) is a code ' + 'block.\n' + 'A script command (a command specified on the interpreter ' + 'command line\n' + "with the '**-c**' option) is a code block. The file read by " + 'the\n' + 'built-in function "execfile()" is a code block. The string ' + 'argument\n' + 'passed to the built-in function "eval()" and to the "exec" ' + 'statement\n' + 'is a code block. The expression read and evaluated by the ' + 'built-in\n' + 'function "input()" is a code block.\n' + '\n' + 'A code block is executed in an *execution frame*. A frame ' + 'contains\n' + 'some administrative information (used for debugging) and ' + 'determines\n' + "where and how execution continues after the code block's " + 'execution has\n' + 'completed.\n' + '\n' + 'A *scope* defines the visibility of a name within a block. If ' + 'a local\n' + 'variable is defined in a block, its scope includes that block. ' + 'If the\n' + 'definition occurs in a function block, the scope extends to any ' + 'blocks\n' + 'contained within the defining one, unless a contained block ' + 'introduces\n' + 'a different binding for the name. The scope of names defined ' + 'in a\n' + 'class block is limited to the class block; it does not extend ' + 'to the\n' + 'code blocks of methods -- this includes generator expressions ' + 'since\n' + 'they are implemented using a function scope. This means that ' + 'the\n' + 'following will fail:\n' + '\n' + ' class A:\n' + ' a = 42\n' + ' b = list(a + i for i in range(10))\n' + '\n' + 'When a name is used in a code block, it is resolved using the ' + 'nearest\n' + 'enclosing scope. The set of all such scopes visible to a code ' + 'block\n' + "is called the block's *environment*.\n" + '\n' + 'If a name is bound in a block, it is a local variable of that ' + 'block.\n' + 'If a name is bound at the module level, it is a global ' + 'variable. (The\n' + 'variables of the module code block are local and global.) If ' + 'a\n' + 'variable is used in a code block but not defined there, it is a ' + '*free\n' + 'variable*.\n' + '\n' + 'When a name is not found at all, a "NameError" exception is ' + 'raised.\n' + 'If the name refers to a local variable that has not been bound, ' + 'a\n' + '"UnboundLocalError" exception is raised. "UnboundLocalError" ' + 'is a\n' + 'subclass of "NameError".\n' + '\n' + 'The following constructs bind names: formal parameters to ' + 'functions,\n' + '"import" statements, class and function definitions (these bind ' + 'the\n' + 'class or function name in the defining block), and targets that ' + 'are\n' + 'identifiers if occurring in an assignment, "for" loop header, ' + 'in the\n' + 'second position of an "except" clause header or after "as" in a ' + '"with"\n' + 'statement. The "import" statement of the form "from ... import ' + '*"\n' + 'binds all names defined in the imported module, except those ' + 'beginning\n' + 'with an underscore. This form may only be used at the module ' + 'level.\n' + '\n' + 'A target occurring in a "del" statement is also considered ' + 'bound for\n' + 'this purpose (though the actual semantics are to unbind the ' + 'name). It\n' + 'is illegal to unbind a name that is referenced by an enclosing ' + 'scope;\n' + 'the compiler will report a "SyntaxError".\n' + '\n' + 'Each assignment or import statement occurs within a block ' + 'defined by a\n' + 'class or function definition or at the module level (the ' + 'top-level\n' + 'code block).\n' + '\n' + 'If a name binding operation occurs anywhere within a code ' + 'block, all\n' + 'uses of the name within the block are treated as references to ' + 'the\n' + 'current block. This can lead to errors when a name is used ' + 'within a\n' + 'block before it is bound. This rule is subtle. Python lacks\n' + 'declarations and allows name binding operations to occur ' + 'anywhere\n' + 'within a code block. The local variables of a code block can ' + 'be\n' + 'determined by scanning the entire text of the block for name ' + 'binding\n' + 'operations.\n' + '\n' + 'If the global statement occurs within a block, all uses of the ' + 'name\n' + 'specified in the statement refer to the binding of that name in ' + 'the\n' + 'top-level namespace. Names are resolved in the top-level ' + 'namespace by\n' + 'searching the global namespace, i.e. the namespace of the ' + 'module\n' + 'containing the code block, and the builtins namespace, the ' + 'namespace\n' + 'of the module "__builtin__". The global namespace is searched ' + 'first.\n' + 'If the name is not found there, the builtins namespace is ' + 'searched.\n' + 'The global statement must precede all uses of the name.\n' + '\n' + 'The builtins namespace associated with the execution of a code ' + 'block\n' + 'is actually found by looking up the name "__builtins__" in its ' + 'global\n' + 'namespace; this should be a dictionary or a module (in the ' + 'latter case\n' + "the module's dictionary is used). By default, when in the " + '"__main__"\n' + 'module, "__builtins__" is the built-in module "__builtin__" ' + '(note: no\n' + '\'s\'); when in any other module, "__builtins__" is an alias ' + 'for the\n' + 'dictionary of the "__builtin__" module itself. "__builtins__" ' + 'can be\n' + 'set to a user-created dictionary to create a weak form of ' + 'restricted\n' + 'execution.\n' + '\n' + '**CPython implementation detail:** Users should not touch\n' + '"__builtins__"; it is strictly an implementation detail. ' + 'Users\n' + 'wanting to override values in the builtins namespace should ' + '"import"\n' + 'the "__builtin__" (no \'s\') module and modify its attributes\n' + 'appropriately.\n' + '\n' + 'The namespace for a module is automatically created the first ' + 'time a\n' + 'module is imported. The main module for a script is always ' + 'called\n' + '"__main__".\n' + '\n' + 'The "global" statement has the same scope as a name binding ' + 'operation\n' + 'in the same block. If the nearest enclosing scope for a free ' + 'variable\n' + 'contains a global statement, the free variable is treated as a ' + 'global.\n' + '\n' + 'A class definition is an executable statement that may use and ' + 'define\n' + 'names. These references follow the normal rules for name ' + 'resolution.\n' + 'The namespace of the class definition becomes the attribute ' + 'dictionary\n' + 'of the class. Names defined at the class scope are not visible ' + 'in\n' + 'methods.\n' + '\n' + '\n' + 'Interaction with dynamic features\n' + '---------------------------------\n' + '\n' + 'There are several cases where Python statements are illegal ' + 'when used\n' + 'in conjunction with nested scopes that contain free variables.\n' + '\n' + 'If a variable is referenced in an enclosing scope, it is ' + 'illegal to\n' + 'delete the name. An error will be reported at compile time.\n' + '\n' + 'If the wild card form of import --- "import *" --- is used in ' + 'a\n' + 'function and the function contains or is a nested block with ' + 'free\n' + 'variables, the compiler will raise a "SyntaxError".\n' + '\n' + 'If "exec" is used in a function and the function contains or is ' + 'a\n' + 'nested block with free variables, the compiler will raise a\n' + '"SyntaxError" unless the exec explicitly specifies the local ' + 'namespace\n' + 'for the "exec". (In other words, "exec obj" would be illegal, ' + 'but\n' + '"exec obj in ns" would be legal.)\n' + '\n' + 'The "eval()", "execfile()", and "input()" functions and the ' + '"exec"\n' + 'statement do not have access to the full environment for ' + 'resolving\n' + 'names. Names may be resolved in the local and global ' + 'namespaces of\n' + 'the caller. Free variables are not resolved in the nearest ' + 'enclosing\n' + 'namespace, but in the global namespace. [1] The "exec" ' + 'statement and\n' + 'the "eval()" and "execfile()" functions have optional arguments ' + 'to\n' + 'override the global and local namespace. If only one namespace ' + 'is\n' + 'specified, it is used for both.\n' + '\n' + '\n' + 'Exceptions\n' + '==========\n' + '\n' + 'Exceptions are a means of breaking out of the normal flow of ' + 'control\n' + 'of a code block in order to handle errors or other exceptional\n' + 'conditions. An exception is *raised* at the point where the ' + 'error is\n' + 'detected; it may be *handled* by the surrounding code block or ' + 'by any\n' + 'code block that directly or indirectly invoked the code block ' + 'where\n' + 'the error occurred.\n' + '\n' + 'The Python interpreter raises an exception when it detects a ' + 'run-time\n' + 'error (such as division by zero). A Python program can also\n' + 'explicitly raise an exception with the "raise" statement. ' + 'Exception\n' + 'handlers are specified with the "try" ... "except" statement. ' + 'The\n' + '"finally" clause of such a statement can be used to specify ' + 'cleanup\n' + 'code which does not handle the exception, but is executed ' + 'whether an\n' + 'exception occurred or not in the preceding code.\n' + '\n' + 'Python uses the "termination" model of error handling: an ' + 'exception\n' + 'handler can find out what happened and continue execution at an ' + 'outer\n' + 'level, but it cannot repair the cause of the error and retry ' + 'the\n' + 'failing operation (except by re-entering the offending piece of ' + 'code\n' + 'from the top).\n' + '\n' + 'When an exception is not handled at all, the interpreter ' + 'terminates\n' + 'execution of the program, or returns to its interactive main ' + 'loop. In\n' + 'either case, it prints a stack backtrace, except when the ' + 'exception is\n' + '"SystemExit".\n' + '\n' + 'Exceptions are identified by class instances. The "except" ' + 'clause is\n' + 'selected depending on the class of the instance: it must ' + 'reference the\n' + 'class of the instance or a base class thereof. The instance ' + 'can be\n' + 'received by the handler and can carry additional information ' + 'about the\n' + 'exceptional condition.\n' + '\n' + 'Exceptions can also be identified by strings, in which case ' + 'the\n' + '"except" clause is selected by object identity. An arbitrary ' + 'value\n' + 'can be raised along with the identifying string which can be ' + 'passed to\n' + 'the handler.\n' + '\n' + 'Note: Messages to exceptions are not part of the Python API. ' + 'Their\n' + ' contents may change from one version of Python to the next ' + 'without\n' + ' warning and should not be relied on by code which will run ' + 'under\n' + ' multiple versions of the interpreter.\n' + '\n' + 'See also the description of the "try" statement in section The ' + 'try\n' + 'statement and "raise" statement in section The raise ' + 'statement.\n' + '\n' + '-[ Footnotes ]-\n' + '\n' + '[1] This limitation occurs because the code that is executed ' + 'by\n' + ' these operations is not available at the time the module ' + 'is\n' + ' compiled.\n', + 'exprlists': '\n' + 'Expression lists\n' + '****************\n' + '\n' + ' expression_list ::= expression ( "," expression )* [","]\n' + '\n' + 'An expression list containing at least one comma yields a ' + 'tuple. The\n' + 'length of the tuple is the number of expressions in the list. ' + 'The\n' + 'expressions are evaluated from left to right.\n' + '\n' + 'The trailing comma is required only to create a single tuple ' + '(a.k.a. a\n' + '*singleton*); it is optional in all other cases. A single ' + 'expression\n' + "without a trailing comma doesn't create a tuple, but rather " + 'yields the\n' + 'value of that expression. (To create an empty tuple, use an ' + 'empty pair\n' + 'of parentheses: "()".)\n', + 'floating': '\n' + 'Floating point literals\n' + '***********************\n' + '\n' + 'Floating point literals are described by the following lexical\n' + 'definitions:\n' + '\n' + ' floatnumber ::= pointfloat | exponentfloat\n' + ' pointfloat ::= [intpart] fraction | intpart "."\n' + ' exponentfloat ::= (intpart | pointfloat) exponent\n' + ' intpart ::= digit+\n' + ' fraction ::= "." digit+\n' + ' exponent ::= ("e" | "E") ["+" | "-"] digit+\n' + '\n' + 'Note that the integer and exponent parts of floating point ' + 'numbers can\n' + 'look like octal integers, but are interpreted using radix 10. ' + 'For\n' + 'example, "077e010" is legal, and denotes the same number as ' + '"77e10".\n' + 'The allowed range of floating point literals is implementation-\n' + 'dependent. Some examples of floating point literals:\n' + '\n' + ' 3.14 10. .001 1e100 3.14e-10 0e0\n' + '\n' + 'Note that numeric literals do not include a sign; a phrase like ' + '"-1"\n' + 'is actually an expression composed of the unary operator "-" and ' + 'the\n' + 'literal "1".\n', + 'for': '\n' + 'The "for" statement\n' + '*******************\n' + '\n' + 'The "for" statement is used to iterate over the elements of a ' + 'sequence\n' + '(such as a string, tuple or list) or other iterable object:\n' + '\n' + ' for_stmt ::= "for" target_list "in" expression_list ":" suite\n' + ' ["else" ":" suite]\n' + '\n' + 'The expression list is evaluated once; it should yield an iterable\n' + 'object. An iterator is created for the result of the\n' + '"expression_list". The suite is then executed once for each item\n' + 'provided by the iterator, in the order of ascending indices. Each\n' + 'item in turn is assigned to the target list using the standard rules\n' + 'for assignments, and then the suite is executed. When the items are\n' + 'exhausted (which is immediately when the sequence is empty), the ' + 'suite\n' + 'in the "else" clause, if present, is executed, and the loop\n' + 'terminates.\n' + '\n' + 'A "break" statement executed in the first suite terminates the loop\n' + 'without executing the "else" clause\'s suite. A "continue" ' + 'statement\n' + 'executed in the first suite skips the rest of the suite and ' + 'continues\n' + 'with the next item, or with the "else" clause if there was no next\n' + 'item.\n' + '\n' + 'The suite may assign to the variable(s) in the target list; this ' + 'does\n' + 'not affect the next item assigned to it.\n' + '\n' + 'The target list is not deleted when the loop is finished, but if the\n' + 'sequence is empty, it will not have been assigned to at all by the\n' + 'loop. Hint: the built-in function "range()" returns a sequence of\n' + 'integers suitable to emulate the effect of Pascal\'s "for i := a to ' + 'b\n' + 'do"; e.g., "range(3)" returns the list "[0, 1, 2]".\n' + '\n' + 'Note: There is a subtlety when the sequence is being modified by the\n' + ' loop (this can only occur for mutable sequences, i.e. lists). An\n' + ' internal counter is used to keep track of which item is used next,\n' + ' and this is incremented on each iteration. When this counter has\n' + ' reached the length of the sequence the loop terminates. This ' + 'means\n' + ' that if the suite deletes the current (or a previous) item from ' + 'the\n' + ' sequence, the next item will be skipped (since it gets the index ' + 'of\n' + ' the current item which has already been treated). Likewise, if ' + 'the\n' + ' suite inserts an item in the sequence before the current item, the\n' + ' current item will be treated again the next time through the loop.\n' + ' This can lead to nasty bugs that can be avoided by making a\n' + ' temporary copy using a slice of the whole sequence, e.g.,\n' + '\n' + ' for x in a[:]:\n' + ' if x < 0: a.remove(x)\n', + 'formatstrings': '\n' + 'Format String Syntax\n' + '********************\n' + '\n' + 'The "str.format()" method and the "Formatter" class share ' + 'the same\n' + 'syntax for format strings (although in the case of ' + '"Formatter",\n' + 'subclasses can define their own format string syntax).\n' + '\n' + 'Format strings contain "replacement fields" surrounded by ' + 'curly braces\n' + '"{}". Anything that is not contained in braces is ' + 'considered literal\n' + 'text, which is copied unchanged to the output. If you need ' + 'to include\n' + 'a brace character in the literal text, it can be escaped by ' + 'doubling:\n' + '"{{" and "}}".\n' + '\n' + 'The grammar for a replacement field is as follows:\n' + '\n' + ' replacement_field ::= "{" [field_name] ["!" ' + 'conversion] [":" format_spec] "}"\n' + ' field_name ::= arg_name ("." attribute_name | ' + '"[" element_index "]")*\n' + ' arg_name ::= [identifier | integer]\n' + ' attribute_name ::= identifier\n' + ' element_index ::= integer | index_string\n' + ' index_string ::= +\n' + ' conversion ::= "r" | "s"\n' + ' format_spec ::= \n' + '\n' + 'In less formal terms, the replacement field can start with ' + 'a\n' + '*field_name* that specifies the object whose value is to be ' + 'formatted\n' + 'and inserted into the output instead of the replacement ' + 'field. The\n' + '*field_name* is optionally followed by a *conversion* ' + 'field, which is\n' + 'preceded by an exclamation point "\'!\'", and a ' + '*format_spec*, which is\n' + 'preceded by a colon "\':\'". These specify a non-default ' + 'format for the\n' + 'replacement value.\n' + '\n' + 'See also the Format Specification Mini-Language section.\n' + '\n' + 'The *field_name* itself begins with an *arg_name* that is ' + 'either a\n' + "number or a keyword. If it's a number, it refers to a " + 'positional\n' + "argument, and if it's a keyword, it refers to a named " + 'keyword\n' + 'argument. If the numerical arg_names in a format string ' + 'are 0, 1, 2,\n' + '... in sequence, they can all be omitted (not just some) ' + 'and the\n' + 'numbers 0, 1, 2, ... will be automatically inserted in that ' + 'order.\n' + 'Because *arg_name* is not quote-delimited, it is not ' + 'possible to\n' + 'specify arbitrary dictionary keys (e.g., the strings ' + '"\'10\'" or\n' + '"\':-]\'") within a format string. The *arg_name* can be ' + 'followed by any\n' + 'number of index or attribute expressions. An expression of ' + 'the form\n' + '"\'.name\'" selects the named attribute using "getattr()", ' + 'while an\n' + 'expression of the form "\'[index]\'" does an index lookup ' + 'using\n' + '"__getitem__()".\n' + '\n' + 'Changed in version 2.7: The positional argument specifiers ' + 'can be\n' + 'omitted, so "\'{} {}\'" is equivalent to "\'{0} {1}\'".\n' + '\n' + 'Some simple format string examples:\n' + '\n' + ' "First, thou shalt count to {0}" # References first ' + 'positional argument\n' + ' "Bring me a {}" # Implicitly ' + 'references the first positional argument\n' + ' "From {} to {}" # Same as "From {0} to ' + '{1}"\n' + ' "My quest is {name}" # References keyword ' + "argument 'name'\n" + ' "Weight in tons {0.weight}" # \'weight\' attribute ' + 'of first positional arg\n' + ' "Units destroyed: {players[0]}" # First element of ' + "keyword argument 'players'.\n" + '\n' + 'The *conversion* field causes a type coercion before ' + 'formatting.\n' + 'Normally, the job of formatting a value is done by the ' + '"__format__()"\n' + 'method of the value itself. However, in some cases it is ' + 'desirable to\n' + 'force a type to be formatted as a string, overriding its ' + 'own\n' + 'definition of formatting. By converting the value to a ' + 'string before\n' + 'calling "__format__()", the normal formatting logic is ' + 'bypassed.\n' + '\n' + 'Two conversion flags are currently supported: "\'!s\'" ' + 'which calls\n' + '"str()" on the value, and "\'!r\'" which calls "repr()".\n' + '\n' + 'Some examples:\n' + '\n' + ' "Harold\'s a clever {0!s}" # Calls str() on the ' + 'argument first\n' + ' "Bring out the holy {name!r}" # Calls repr() on the ' + 'argument first\n' + '\n' + 'The *format_spec* field contains a specification of how the ' + 'value\n' + 'should be presented, including such details as field width, ' + 'alignment,\n' + 'padding, decimal precision and so on. Each value type can ' + 'define its\n' + 'own "formatting mini-language" or interpretation of the ' + '*format_spec*.\n' + '\n' + 'Most built-in types support a common formatting ' + 'mini-language, which\n' + 'is described in the next section.\n' + '\n' + 'A *format_spec* field can also include nested replacement ' + 'fields\n' + 'within it. These nested replacement fields may contain a ' + 'field name,\n' + 'conversion flag and format specification, but deeper ' + 'nesting is not\n' + 'allowed. The replacement fields within the format_spec ' + 'are\n' + 'substituted before the *format_spec* string is interpreted. ' + 'This\n' + 'allows the formatting of a value to be dynamically ' + 'specified.\n' + '\n' + 'See the Format examples section for some examples.\n' + '\n' + '\n' + 'Format Specification Mini-Language\n' + '==================================\n' + '\n' + '"Format specifications" are used within replacement fields ' + 'contained\n' + 'within a format string to define how individual values are ' + 'presented\n' + '(see Format String Syntax). They can also be passed ' + 'directly to the\n' + 'built-in "format()" function. Each formattable type may ' + 'define how\n' + 'the format specification is to be interpreted.\n' + '\n' + 'Most built-in types implement the following options for ' + 'format\n' + 'specifications, although some of the formatting options are ' + 'only\n' + 'supported by the numeric types.\n' + '\n' + 'A general convention is that an empty format string ("""") ' + 'produces\n' + 'the same result as if you had called "str()" on the value. ' + 'A non-empty\n' + 'format string typically modifies the result.\n' + '\n' + 'The general form of a *standard format specifier* is:\n' + '\n' + ' format_spec ::= ' + '[[fill]align][sign][#][0][width][,][.precision][type]\n' + ' fill ::= \n' + ' align ::= "<" | ">" | "=" | "^"\n' + ' sign ::= "+" | "-" | " "\n' + ' width ::= integer\n' + ' precision ::= integer\n' + ' type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" ' + '| "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"\n' + '\n' + 'If a valid *align* value is specified, it can be preceded ' + 'by a *fill*\n' + 'character that can be any character and defaults to a space ' + 'if\n' + 'omitted. It is not possible to use a literal curly brace ' + '(""{"" or\n' + '""}"") as the *fill* character when using the ' + '"str.format()" method.\n' + 'However, it is possible to insert a curly brace with a ' + 'nested\n' + "replacement field. This limitation doesn't affect the " + '"format()"\n' + 'function.\n' + '\n' + 'The meaning of the various alignment options is as ' + 'follows:\n' + '\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | Option | ' + 'Meaning ' + '|\n' + ' ' + '+===========+============================================================+\n' + ' | "\'<\'" | Forces the field to be left-aligned ' + 'within the available |\n' + ' | | space (this is the default for most ' + 'objects). |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | "\'>\'" | Forces the field to be right-aligned ' + 'within the available |\n' + ' | | space (this is the default for ' + 'numbers). |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | "\'=\'" | Forces the padding to be placed after ' + 'the sign (if any) |\n' + ' | | but before the digits. This is used for ' + 'printing fields |\n' + " | | in the form '+000000120'. This alignment " + 'option is only |\n' + ' | | valid for numeric types. It becomes the ' + "default when '0' |\n" + ' | | immediately precedes the field ' + 'width. |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | "\'^\'" | Forces the field to be centered within ' + 'the available |\n' + ' | | ' + 'space. ' + '|\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + '\n' + 'Note that unless a minimum field width is defined, the ' + 'field width\n' + 'will always be the same size as the data to fill it, so ' + 'that the\n' + 'alignment option has no meaning in this case.\n' + '\n' + 'The *sign* option is only valid for number types, and can ' + 'be one of\n' + 'the following:\n' + '\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | Option | ' + 'Meaning ' + '|\n' + ' ' + '+===========+============================================================+\n' + ' | "\'+\'" | indicates that a sign should be used for ' + 'both positive as |\n' + ' | | well as negative ' + 'numbers. |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | "\'-\'" | indicates that a sign should be used ' + 'only for negative |\n' + ' | | numbers (this is the default ' + 'behavior). |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | space | indicates that a leading space should be ' + 'used on positive |\n' + ' | | numbers, and a minus sign on negative ' + 'numbers. |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + '\n' + 'The "\'#\'" option is only valid for integers, and only for ' + 'binary,\n' + 'octal, or hexadecimal output. If present, it specifies ' + 'that the\n' + 'output will be prefixed by "\'0b\'", "\'0o\'", or "\'0x\'", ' + 'respectively.\n' + '\n' + 'The "\',\'" option signals the use of a comma for a ' + 'thousands separator.\n' + 'For a locale aware separator, use the "\'n\'" integer ' + 'presentation type\n' + 'instead.\n' + '\n' + 'Changed in version 2.7: Added the "\',\'" option (see also ' + '**PEP 378**).\n' + '\n' + '*width* is a decimal integer defining the minimum field ' + 'width. If not\n' + 'specified, then the field width will be determined by the ' + 'content.\n' + '\n' + 'When no explicit alignment is given, preceding the *width* ' + 'field by a\n' + 'zero ("\'0\'") character enables sign-aware zero-padding ' + 'for numeric\n' + 'types. This is equivalent to a *fill* character of "\'0\'" ' + 'with an\n' + '*alignment* type of "\'=\'".\n' + '\n' + 'The *precision* is a decimal number indicating how many ' + 'digits should\n' + 'be displayed after the decimal point for a floating point ' + 'value\n' + 'formatted with "\'f\'" and "\'F\'", or before and after the ' + 'decimal point\n' + 'for a floating point value formatted with "\'g\'" or ' + '"\'G\'". For non-\n' + 'number types the field indicates the maximum field size - ' + 'in other\n' + 'words, how many characters will be used from the field ' + 'content. The\n' + '*precision* is not allowed for integer values.\n' + '\n' + 'Finally, the *type* determines how the data should be ' + 'presented.\n' + '\n' + 'The available string presentation types are:\n' + '\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | Type | ' + 'Meaning ' + '|\n' + ' ' + '+===========+============================================================+\n' + ' | "\'s\'" | String format. This is the default type ' + 'for strings and |\n' + ' | | may be ' + 'omitted. |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | None | The same as ' + '"\'s\'". |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + '\n' + 'The available integer presentation types are:\n' + '\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | Type | ' + 'Meaning ' + '|\n' + ' ' + '+===========+============================================================+\n' + ' | "\'b\'" | Binary format. Outputs the number in ' + 'base 2. |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | "\'c\'" | Character. Converts the integer to the ' + 'corresponding |\n' + ' | | unicode character before ' + 'printing. |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | "\'d\'" | Decimal Integer. Outputs the number in ' + 'base 10. |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | "\'o\'" | Octal format. Outputs the number in base ' + '8. |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | "\'x\'" | Hex format. Outputs the number in base ' + '16, using lower- |\n' + ' | | case letters for the digits above ' + '9. |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | "\'X\'" | Hex format. Outputs the number in base ' + '16, using upper- |\n' + ' | | case letters for the digits above ' + '9. |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | "\'n\'" | Number. This is the same as "\'d\'", ' + 'except that it uses the |\n' + ' | | current locale setting to insert the ' + 'appropriate number |\n' + ' | | separator ' + 'characters. |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | None | The same as ' + '"\'d\'". |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + '\n' + 'In addition to the above presentation types, integers can ' + 'be formatted\n' + 'with the floating point presentation types listed below ' + '(except "\'n\'"\n' + 'and None). When doing so, "float()" is used to convert the ' + 'integer to\n' + 'a floating point number before formatting.\n' + '\n' + 'The available presentation types for floating point and ' + 'decimal values\n' + 'are:\n' + '\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | Type | ' + 'Meaning ' + '|\n' + ' ' + '+===========+============================================================+\n' + ' | "\'e\'" | Exponent notation. Prints the number in ' + 'scientific |\n' + " | | notation using the letter 'e' to indicate " + 'the exponent. |\n' + ' | | The default precision is ' + '"6". |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | "\'E\'" | Exponent notation. Same as "\'e\'" ' + 'except it uses an upper |\n' + " | | case 'E' as the separator " + 'character. |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | "\'f\'" | Fixed point. Displays the number as a ' + 'fixed-point number. |\n' + ' | | The default precision is ' + '"6". |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | "\'F\'" | Fixed point. Same as ' + '"\'f\'". |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | "\'g\'" | General format. For a given precision ' + '"p >= 1", this |\n' + ' | | rounds the number to "p" significant ' + 'digits and then |\n' + ' | | formats the result in either fixed-point ' + 'format or in |\n' + ' | | scientific notation, depending on its ' + 'magnitude. The |\n' + ' | | precise rules are as follows: suppose that ' + 'the result |\n' + ' | | formatted with presentation type "\'e\'" ' + 'and precision "p-1" |\n' + ' | | would have exponent "exp". Then if "-4 <= ' + 'exp < p", the |\n' + ' | | number is formatted with presentation type ' + '"\'f\'" and |\n' + ' | | precision "p-1-exp". Otherwise, the ' + 'number is formatted |\n' + ' | | with presentation type "\'e\'" and ' + 'precision "p-1". In both |\n' + ' | | cases insignificant trailing zeros are ' + 'removed from the |\n' + ' | | significand, and the decimal point is also ' + 'removed if |\n' + ' | | there are no remaining digits following ' + 'it. Positive and |\n' + ' | | negative infinity, positive and negative ' + 'zero, and nans, |\n' + ' | | are formatted as "inf", "-inf", "0", "-0" ' + 'and "nan" |\n' + ' | | respectively, regardless of the ' + 'precision. A precision of |\n' + ' | | "0" is treated as equivalent to a ' + 'precision of "1". The |\n' + ' | | default precision is ' + '"6". |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | "\'G\'" | General format. Same as "\'g\'" except ' + 'switches to "\'E\'" if |\n' + ' | | the number gets too large. The ' + 'representations of infinity |\n' + ' | | and NaN are uppercased, ' + 'too. |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | "\'n\'" | Number. This is the same as "\'g\'", ' + 'except that it uses the |\n' + ' | | current locale setting to insert the ' + 'appropriate number |\n' + ' | | separator ' + 'characters. |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | "\'%\'" | Percentage. Multiplies the number by 100 ' + 'and displays in |\n' + ' | | fixed ("\'f\'") format, followed by a ' + 'percent sign. |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + ' | None | The same as ' + '"\'g\'". |\n' + ' ' + '+-----------+------------------------------------------------------------+\n' + '\n' + '\n' + 'Format examples\n' + '===============\n' + '\n' + 'This section contains examples of the "str.format()" syntax ' + 'and\n' + 'comparison with the old "%"-formatting.\n' + '\n' + 'In most of the cases the syntax is similar to the old ' + '"%"-formatting,\n' + 'with the addition of the "{}" and with ":" used instead of ' + '"%". For\n' + 'example, "\'%03.2f\'" can be translated to "\'{:03.2f}\'".\n' + '\n' + 'The new format syntax also supports new and different ' + 'options, shown\n' + 'in the follow examples.\n' + '\n' + 'Accessing arguments by position:\n' + '\n' + " >>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n" + " 'a, b, c'\n" + " >>> '{}, {}, {}'.format('a', 'b', 'c') # 2.7+ only\n" + " 'a, b, c'\n" + " >>> '{2}, {1}, {0}'.format('a', 'b', 'c')\n" + " 'c, b, a'\n" + " >>> '{2}, {1}, {0}'.format(*'abc') # unpacking " + 'argument sequence\n' + " 'c, b, a'\n" + " >>> '{0}{1}{0}'.format('abra', 'cad') # arguments' " + 'indices can be repeated\n' + " 'abracadabra'\n" + '\n' + 'Accessing arguments by name:\n' + '\n' + " >>> 'Coordinates: {latitude}, " + "{longitude}'.format(latitude='37.24N', " + "longitude='-115.81W')\n" + " 'Coordinates: 37.24N, -115.81W'\n" + " >>> coord = {'latitude': '37.24N', 'longitude': " + "'-115.81W'}\n" + " >>> 'Coordinates: {latitude}, " + "{longitude}'.format(**coord)\n" + " 'Coordinates: 37.24N, -115.81W'\n" + '\n' + "Accessing arguments' attributes:\n" + '\n' + ' >>> c = 3-5j\n' + " >>> ('The complex number {0} is formed from the real " + "part {0.real} '\n" + " ... 'and the imaginary part {0.imag}.').format(c)\n" + " 'The complex number (3-5j) is formed from the real part " + "3.0 and the imaginary part -5.0.'\n" + ' >>> class Point(object):\n' + ' ... def __init__(self, x, y):\n' + ' ... self.x, self.y = x, y\n' + ' ... def __str__(self):\n' + " ... return 'Point({self.x}, " + "{self.y})'.format(self=self)\n" + ' ...\n' + ' >>> str(Point(4, 2))\n' + " 'Point(4, 2)'\n" + '\n' + "Accessing arguments' items:\n" + '\n' + ' >>> coord = (3, 5)\n' + " >>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" + " 'X: 3; Y: 5'\n" + '\n' + 'Replacing "%s" and "%r":\n' + '\n' + ' >>> "repr() shows quotes: {!r}; str() doesn\'t: ' + '{!s}".format(\'test1\', \'test2\')\n' + ' "repr() shows quotes: \'test1\'; str() doesn\'t: test2"\n' + '\n' + 'Aligning the text and specifying a width:\n' + '\n' + " >>> '{:<30}'.format('left aligned')\n" + " 'left aligned '\n" + " >>> '{:>30}'.format('right aligned')\n" + " ' right aligned'\n" + " >>> '{:^30}'.format('centered')\n" + " ' centered '\n" + " >>> '{:*^30}'.format('centered') # use '*' as a fill " + 'char\n' + " '***********centered***********'\n" + '\n' + 'Replacing "%+f", "%-f", and "% f" and specifying a sign:\n' + '\n' + " >>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it " + 'always\n' + " '+3.140000; -3.140000'\n" + " >>> '{: f}; {: f}'.format(3.14, -3.14) # show a space " + 'for positive numbers\n' + " ' 3.140000; -3.140000'\n" + " >>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the " + "minus -- same as '{:f}; {:f}'\n" + " '3.140000; -3.140000'\n" + '\n' + 'Replacing "%x" and "%o" and converting the value to ' + 'different bases:\n' + '\n' + ' >>> # format also supports binary numbers\n' + ' >>> "int: {0:d}; hex: {0:x}; oct: {0:o}; bin: ' + '{0:b}".format(42)\n' + " 'int: 42; hex: 2a; oct: 52; bin: 101010'\n" + ' >>> # with 0x, 0o, or 0b as prefix:\n' + ' >>> "int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: ' + '{0:#b}".format(42)\n' + " 'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'\n" + '\n' + 'Using the comma as a thousands separator:\n' + '\n' + " >>> '{:,}'.format(1234567890)\n" + " '1,234,567,890'\n" + '\n' + 'Expressing a percentage:\n' + '\n' + ' >>> points = 19.5\n' + ' >>> total = 22\n' + " >>> 'Correct answers: {:.2%}'.format(points/total)\n" + " 'Correct answers: 88.64%'\n" + '\n' + 'Using type-specific formatting:\n' + '\n' + ' >>> import datetime\n' + ' >>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n' + " >>> '{:%Y-%m-%d %H:%M:%S}'.format(d)\n" + " '2010-07-04 12:15:58'\n" + '\n' + 'Nesting arguments and more complex examples:\n' + '\n' + " >>> for align, text in zip('<^>', ['left', 'center', " + "'right']):\n" + " ... '{0:{fill}{align}16}'.format(text, fill=align, " + 'align=align)\n' + ' ...\n' + " 'left<<<<<<<<<<<<'\n" + " '^^^^^center^^^^^'\n" + " '>>>>>>>>>>>right'\n" + ' >>>\n' + ' >>> octets = [192, 168, 0, 1]\n' + " >>> '{:02X}{:02X}{:02X}{:02X}'.format(*octets)\n" + " 'C0A80001'\n" + ' >>> int(_, 16)\n' + ' 3232235521\n' + ' >>>\n' + ' >>> width = 5\n' + ' >>> for num in range(5,12):\n' + " ... for base in 'dXob':\n" + " ... print '{0:{width}{base}}'.format(num, " + 'base=base, width=width),\n' + ' ... print\n' + ' ...\n' + ' 5 5 5 101\n' + ' 6 6 6 110\n' + ' 7 7 7 111\n' + ' 8 8 10 1000\n' + ' 9 9 11 1001\n' + ' 10 A 12 1010\n' + ' 11 B 13 1011\n', + 'function': '\n' + 'Function definitions\n' + '********************\n' + '\n' + 'A function definition defines a user-defined function object ' + '(see\n' + 'section The standard type hierarchy):\n' + '\n' + ' decorated ::= decorators (classdef | funcdef)\n' + ' decorators ::= decorator+\n' + ' decorator ::= "@" dotted_name ["(" [argument_list [","]] ' + '")"] NEWLINE\n' + ' funcdef ::= "def" funcname "(" [parameter_list] ")" ' + '":" suite\n' + ' dotted_name ::= identifier ("." identifier)*\n' + ' parameter_list ::= (defparameter ",")*\n' + ' ( "*" identifier ["," "**" identifier]\n' + ' | "**" identifier\n' + ' | defparameter [","] )\n' + ' defparameter ::= parameter ["=" expression]\n' + ' sublist ::= parameter ("," parameter)* [","]\n' + ' parameter ::= identifier | "(" sublist ")"\n' + ' funcname ::= identifier\n' + '\n' + 'A function definition is an executable statement. Its execution ' + 'binds\n' + 'the function name in the current local namespace to a function ' + 'object\n' + '(a wrapper around the executable code for the function). This\n' + 'function object contains a reference to the current global ' + 'namespace\n' + 'as the global namespace to be used when the function is called.\n' + '\n' + 'The function definition does not execute the function body; this ' + 'gets\n' + 'executed only when the function is called. [3]\n' + '\n' + 'A function definition may be wrapped by one or more *decorator*\n' + 'expressions. Decorator expressions are evaluated when the ' + 'function is\n' + 'defined, in the scope that contains the function definition. ' + 'The\n' + 'result must be a callable, which is invoked with the function ' + 'object\n' + 'as the only argument. The returned value is bound to the ' + 'function name\n' + 'instead of the function object. Multiple decorators are applied ' + 'in\n' + 'nested fashion. For example, the following code:\n' + '\n' + ' @f1(arg)\n' + ' @f2\n' + ' def func(): pass\n' + '\n' + 'is equivalent to:\n' + '\n' + ' def func(): pass\n' + ' func = f1(arg)(f2(func))\n' + '\n' + 'When one or more top-level *parameters* have the form ' + '*parameter* "="\n' + '*expression*, the function is said to have "default parameter ' + 'values."\n' + 'For a parameter with a default value, the corresponding ' + '*argument* may\n' + "be omitted from a call, in which case the parameter's default " + 'value is\n' + 'substituted. If a parameter has a default value, all following\n' + 'parameters must also have a default value --- this is a ' + 'syntactic\n' + 'restriction that is not expressed by the grammar.\n' + '\n' + '**Default parameter values are evaluated when the function ' + 'definition\n' + 'is executed.** This means that the expression is evaluated ' + 'once, when\n' + 'the function is defined, and that the same "pre-computed" value ' + 'is\n' + 'used for each call. This is especially important to understand ' + 'when a\n' + 'default parameter is a mutable object, such as a list or a ' + 'dictionary:\n' + 'if the function modifies the object (e.g. by appending an item ' + 'to a\n' + 'list), the default value is in effect modified. This is ' + 'generally not\n' + 'what was intended. A way around this is to use "None" as the\n' + 'default, and explicitly test for it in the body of the function, ' + 'e.g.:\n' + '\n' + ' def whats_on_the_telly(penguin=None):\n' + ' if penguin is None:\n' + ' penguin = []\n' + ' penguin.append("property of the zoo")\n' + ' return penguin\n' + '\n' + 'Function call semantics are described in more detail in section ' + 'Calls.\n' + 'A function call always assigns values to all parameters ' + 'mentioned in\n' + 'the parameter list, either from position arguments, from ' + 'keyword\n' + 'arguments, or from default values. If the form ""*identifier"" ' + 'is\n' + 'present, it is initialized to a tuple receiving any excess ' + 'positional\n' + 'parameters, defaulting to the empty tuple. If the form\n' + '""**identifier"" is present, it is initialized to a new ' + 'dictionary\n' + 'receiving any excess keyword arguments, defaulting to a new ' + 'empty\n' + 'dictionary.\n' + '\n' + 'It is also possible to create anonymous functions (functions not ' + 'bound\n' + 'to a name), for immediate use in expressions. This uses lambda\n' + 'expressions, described in section Lambdas. Note that the ' + 'lambda\n' + 'expression is merely a shorthand for a simplified function ' + 'definition;\n' + 'a function defined in a ""def"" statement can be passed around ' + 'or\n' + 'assigned to another name just like a function defined by a ' + 'lambda\n' + 'expression. The ""def"" form is actually more powerful since ' + 'it\n' + 'allows the execution of multiple statements.\n' + '\n' + "**Programmer's note:** Functions are first-class objects. A " + '""def""\n' + 'form executed inside a function definition defines a local ' + 'function\n' + 'that can be returned or passed around. Free variables used in ' + 'the\n' + 'nested function can access the local variables of the function\n' + 'containing the def. See section Naming and binding for ' + 'details.\n', + 'global': '\n' + 'The "global" statement\n' + '**********************\n' + '\n' + ' global_stmt ::= "global" identifier ("," identifier)*\n' + '\n' + 'The "global" statement is a declaration which holds for the ' + 'entire\n' + 'current code block. It means that the listed identifiers are to ' + 'be\n' + 'interpreted as globals. It would be impossible to assign to a ' + 'global\n' + 'variable without "global", although free variables may refer to\n' + 'globals without being declared global.\n' + '\n' + 'Names listed in a "global" statement must not be used in the same ' + 'code\n' + 'block textually preceding that "global" statement.\n' + '\n' + 'Names listed in a "global" statement must not be defined as ' + 'formal\n' + 'parameters or in a "for" loop control target, "class" definition,\n' + 'function definition, or "import" statement.\n' + '\n' + '**CPython implementation detail:** The current implementation does ' + 'not\n' + 'enforce the latter two restrictions, but programs should not ' + 'abuse\n' + 'this freedom, as future implementations may enforce them or ' + 'silently\n' + 'change the meaning of the program.\n' + '\n' + '**Programmer\'s note:** the "global" is a directive to the ' + 'parser. It\n' + 'applies only to code parsed at the same time as the "global"\n' + 'statement. In particular, a "global" statement contained in an ' + '"exec"\n' + 'statement does not affect the code block *containing* the "exec"\n' + 'statement, and code contained in an "exec" statement is unaffected ' + 'by\n' + '"global" statements in the code containing the "exec" statement. ' + 'The\n' + 'same applies to the "eval()", "execfile()" and "compile()" ' + 'functions.\n', + 'id-classes': '\n' + 'Reserved classes of identifiers\n' + '*******************************\n' + '\n' + 'Certain classes of identifiers (besides keywords) have ' + 'special\n' + 'meanings. These classes are identified by the patterns of ' + 'leading and\n' + 'trailing underscore characters:\n' + '\n' + '"_*"\n' + ' Not imported by "from module import *". The special ' + 'identifier "_"\n' + ' is used in the interactive interpreter to store the result ' + 'of the\n' + ' last evaluation; it is stored in the "__builtin__" module. ' + 'When\n' + ' not in interactive mode, "_" has no special meaning and is ' + 'not\n' + ' defined. See section The import statement.\n' + '\n' + ' Note: The name "_" is often used in conjunction with\n' + ' internationalization; refer to the documentation for the\n' + ' "gettext" module for more information on this ' + 'convention.\n' + '\n' + '"__*__"\n' + ' System-defined names. These names are defined by the ' + 'interpreter\n' + ' and its implementation (including the standard library). ' + 'Current\n' + ' system names are discussed in the Special method names ' + 'section and\n' + ' elsewhere. More will likely be defined in future versions ' + 'of\n' + ' Python. *Any* use of "__*__" names, in any context, that ' + 'does not\n' + ' follow explicitly documented use, is subject to breakage ' + 'without\n' + ' warning.\n' + '\n' + '"__*"\n' + ' Class-private names. Names in this category, when used ' + 'within the\n' + ' context of a class definition, are re-written to use a ' + 'mangled form\n' + ' to help avoid name clashes between "private" attributes of ' + 'base and\n' + ' derived classes. See section Identifiers (Names).\n', + 'identifiers': '\n' + 'Identifiers and keywords\n' + '************************\n' + '\n' + 'Identifiers (also referred to as *names*) are described by ' + 'the\n' + 'following lexical definitions:\n' + '\n' + ' identifier ::= (letter|"_") (letter | digit | "_")*\n' + ' letter ::= lowercase | uppercase\n' + ' lowercase ::= "a"..."z"\n' + ' uppercase ::= "A"..."Z"\n' + ' digit ::= "0"..."9"\n' + '\n' + 'Identifiers are unlimited in length. Case is significant.\n' + '\n' + '\n' + 'Keywords\n' + '========\n' + '\n' + 'The following identifiers are used as reserved words, or ' + '*keywords* of\n' + 'the language, and cannot be used as ordinary identifiers. ' + 'They must\n' + 'be spelled exactly as written here:\n' + '\n' + ' and del from not while\n' + ' as elif global or with\n' + ' assert else if pass yield\n' + ' break except import print\n' + ' class exec in raise\n' + ' continue finally is return\n' + ' def for lambda try\n' + '\n' + 'Changed in version 2.4: "None" became a constant and is now ' + 'recognized\n' + 'by the compiler as a name for the built-in object "None". ' + 'Although it\n' + 'is not a keyword, you cannot assign a different object to ' + 'it.\n' + '\n' + 'Changed in version 2.5: Using "as" and "with" as identifiers ' + 'triggers\n' + 'a warning. To use them as keywords, enable the ' + '"with_statement"\n' + 'future feature .\n' + '\n' + 'Changed in version 2.6: "as" and "with" are full keywords.\n' + '\n' + '\n' + 'Reserved classes of identifiers\n' + '===============================\n' + '\n' + 'Certain classes of identifiers (besides keywords) have ' + 'special\n' + 'meanings. These classes are identified by the patterns of ' + 'leading and\n' + 'trailing underscore characters:\n' + '\n' + '"_*"\n' + ' Not imported by "from module import *". The special ' + 'identifier "_"\n' + ' is used in the interactive interpreter to store the result ' + 'of the\n' + ' last evaluation; it is stored in the "__builtin__" ' + 'module. When\n' + ' not in interactive mode, "_" has no special meaning and is ' + 'not\n' + ' defined. See section The import statement.\n' + '\n' + ' Note: The name "_" is often used in conjunction with\n' + ' internationalization; refer to the documentation for ' + 'the\n' + ' "gettext" module for more information on this ' + 'convention.\n' + '\n' + '"__*__"\n' + ' System-defined names. These names are defined by the ' + 'interpreter\n' + ' and its implementation (including the standard library). ' + 'Current\n' + ' system names are discussed in the Special method names ' + 'section and\n' + ' elsewhere. More will likely be defined in future versions ' + 'of\n' + ' Python. *Any* use of "__*__" names, in any context, that ' + 'does not\n' + ' follow explicitly documented use, is subject to breakage ' + 'without\n' + ' warning.\n' + '\n' + '"__*"\n' + ' Class-private names. Names in this category, when used ' + 'within the\n' + ' context of a class definition, are re-written to use a ' + 'mangled form\n' + ' to help avoid name clashes between "private" attributes of ' + 'base and\n' + ' derived classes. See section Identifiers (Names).\n', + 'if': '\n' + 'The "if" statement\n' + '******************\n' + '\n' + 'The "if" statement is used for conditional execution:\n' + '\n' + ' if_stmt ::= "if" expression ":" suite\n' + ' ( "elif" expression ":" suite )*\n' + ' ["else" ":" suite]\n' + '\n' + 'It selects exactly one of the suites by evaluating the expressions ' + 'one\n' + 'by one until one is found to be true (see section Boolean operations\n' + 'for the definition of true and false); then that suite is executed\n' + '(and no other part of the "if" statement is executed or evaluated).\n' + 'If all expressions are false, the suite of the "else" clause, if\n' + 'present, is executed.\n', + 'imaginary': '\n' + 'Imaginary literals\n' + '******************\n' + '\n' + 'Imaginary literals are described by the following lexical ' + 'definitions:\n' + '\n' + ' imagnumber ::= (floatnumber | intpart) ("j" | "J")\n' + '\n' + 'An imaginary literal yields a complex number with a real part ' + 'of 0.0.\n' + 'Complex numbers are represented as a pair of floating point ' + 'numbers\n' + 'and have the same restrictions on their range. To create a ' + 'complex\n' + 'number with a nonzero real part, add a floating point number to ' + 'it,\n' + 'e.g., "(3+4j)". Some examples of imaginary literals:\n' + '\n' + ' 3.14j 10.j 10j .001j 1e100j 3.14e-10j\n', + 'import': '\n' + 'The "import" statement\n' + '**********************\n' + '\n' + ' import_stmt ::= "import" module ["as" name] ( "," module ' + '["as" name] )*\n' + ' | "from" relative_module "import" identifier ' + '["as" name]\n' + ' ( "," identifier ["as" name] )*\n' + ' | "from" relative_module "import" "(" ' + 'identifier ["as" name]\n' + ' ( "," identifier ["as" name] )* [","] ")"\n' + ' | "from" module "import" "*"\n' + ' module ::= (identifier ".")* identifier\n' + ' relative_module ::= "."* module | "."+\n' + ' name ::= identifier\n' + '\n' + 'Import statements are executed in two steps: (1) find a module, ' + 'and\n' + 'initialize it if necessary; (2) define a name or names in the ' + 'local\n' + 'namespace (of the scope where the "import" statement occurs). The\n' + 'statement comes in two forms differing on whether it uses the ' + '"from"\n' + 'keyword. The first form (without "from") repeats these steps for ' + 'each\n' + 'identifier in the list. The form with "from" performs step (1) ' + 'once,\n' + 'and then performs step (2) repeatedly.\n' + '\n' + 'To understand how step (1) occurs, one must first understand how\n' + 'Python handles hierarchical naming of modules. To help organize\n' + 'modules and provide a hierarchy in naming, Python has a concept ' + 'of\n' + 'packages. A package can contain other packages and modules while\n' + 'modules cannot contain other modules or packages. From a file ' + 'system\n' + 'perspective, packages are directories and modules are files.\n' + '\n' + 'Once the name of the module is known (unless otherwise specified, ' + 'the\n' + 'term "module" will refer to both packages and modules), searching ' + 'for\n' + 'the module or package can begin. The first place checked is\n' + '"sys.modules", the cache of all modules that have been imported\n' + 'previously. If the module is found there then it is used in step ' + '(2)\n' + 'of import.\n' + '\n' + 'If the module is not found in the cache, then "sys.meta_path" is\n' + 'searched (the specification for "sys.meta_path" can be found in ' + '**PEP\n' + '302**). The object is a list of *finder* objects which are queried ' + 'in\n' + 'order as to whether they know how to load the module by calling ' + 'their\n' + '"find_module()" method with the name of the module. If the module\n' + 'happens to be contained within a package (as denoted by the ' + 'existence\n' + 'of a dot in the name), then a second argument to "find_module()" ' + 'is\n' + 'given as the value of the "__path__" attribute from the parent ' + 'package\n' + '(everything up to the last dot in the name of the module being\n' + 'imported). If a finder can find the module it returns a *loader*\n' + '(discussed later) or returns "None".\n' + '\n' + 'If none of the finders on "sys.meta_path" are able to find the ' + 'module\n' + 'then some implicitly defined finders are queried. Implementations ' + 'of\n' + 'Python vary in what implicit meta path finders are defined. The ' + 'one\n' + 'they all do define, though, is one that handles "sys.path_hooks",\n' + '"sys.path_importer_cache", and "sys.path".\n' + '\n' + 'The implicit finder searches for the requested module in the ' + '"paths"\n' + 'specified in one of two places ("paths" do not have to be file ' + 'system\n' + 'paths). If the module being imported is supposed to be contained\n' + 'within a package then the second argument passed to ' + '"find_module()",\n' + '"__path__" on the parent package, is used as the source of paths. ' + 'If\n' + 'the module is not contained in a package then "sys.path" is used ' + 'as\n' + 'the source of paths.\n' + '\n' + 'Once the source of paths is chosen it is iterated over to find a\n' + 'finder that can handle that path. The dict at\n' + '"sys.path_importer_cache" caches finders for paths and is checked ' + 'for\n' + 'a finder. If the path does not have a finder cached then\n' + '"sys.path_hooks" is searched by calling each object in the list ' + 'with a\n' + 'single argument of the path, returning a finder or raises\n' + '"ImportError". If a finder is returned then it is cached in\n' + '"sys.path_importer_cache" and then used for that path entry. If ' + 'no\n' + 'finder can be found but the path exists then a value of "None" is\n' + 'stored in "sys.path_importer_cache" to signify that an implicit, ' + 'file-\n' + 'based finder that handles modules stored as individual files ' + 'should be\n' + 'used for that path. If the path does not exist then a finder ' + 'which\n' + 'always returns "None" is placed in the cache for the path.\n' + '\n' + 'If no finder can find the module then "ImportError" is raised.\n' + 'Otherwise some finder returned a loader whose "load_module()" ' + 'method\n' + 'is called with the name of the module to load (see **PEP 302** for ' + 'the\n' + 'original definition of loaders). A loader has several ' + 'responsibilities\n' + 'to perform on a module it loads. First, if the module already ' + 'exists\n' + 'in "sys.modules" (a possibility if the loader is called outside of ' + 'the\n' + 'import machinery) then it is to use that module for initialization ' + 'and\n' + 'not a new module. But if the module does not exist in ' + '"sys.modules"\n' + 'then it is to be added to that dict before initialization begins. ' + 'If\n' + 'an error occurs during loading of the module and it was added to\n' + '"sys.modules" it is to be removed from the dict. If an error ' + 'occurs\n' + 'but the module was already in "sys.modules" it is left in the ' + 'dict.\n' + '\n' + 'The loader must set several attributes on the module. "__name__" ' + 'is to\n' + 'be set to the name of the module. "__file__" is to be the "path" ' + 'to\n' + 'the file unless the module is built-in (and thus listed in\n' + '"sys.builtin_module_names") in which case the attribute is not ' + 'set. If\n' + 'what is being imported is a package then "__path__" is to be set ' + 'to a\n' + 'list of paths to be searched when looking for modules and ' + 'packages\n' + 'contained within the package being imported. "__package__" is ' + 'optional\n' + 'but should be set to the name of package that contains the module ' + 'or\n' + 'package (the empty string is used for module not contained in a\n' + 'package). "__loader__" is also optional but should be set to the\n' + 'loader object that is loading the module.\n' + '\n' + 'If an error occurs during loading then the loader raises ' + '"ImportError"\n' + 'if some other exception is not already being propagated. Otherwise ' + 'the\n' + 'loader returns the module that was loaded and initialized.\n' + '\n' + 'When step (1) finishes without raising an exception, step (2) can\n' + 'begin.\n' + '\n' + 'The first form of "import" statement binds the module name in the\n' + 'local namespace to the module object, and then goes on to import ' + 'the\n' + 'next identifier, if any. If the module name is followed by "as", ' + 'the\n' + 'name following "as" is used as the local name for the module.\n' + '\n' + 'The "from" form does not bind the module name: it goes through ' + 'the\n' + 'list of identifiers, looks each one of them up in the module found ' + 'in\n' + 'step (1), and binds the name in the local namespace to the object ' + 'thus\n' + 'found. As with the first form of "import", an alternate local ' + 'name\n' + 'can be supplied by specifying ""as" localname". If a name is not\n' + 'found, "ImportError" is raised. If the list of identifiers is\n' + 'replaced by a star ("\'*\'"), all public names defined in the ' + 'module are\n' + 'bound in the local namespace of the "import" statement..\n' + '\n' + 'The *public names* defined by a module are determined by checking ' + 'the\n' + 'module\'s namespace for a variable named "__all__"; if defined, it ' + 'must\n' + 'be a sequence of strings which are names defined or imported by ' + 'that\n' + 'module. The names given in "__all__" are all considered public ' + 'and\n' + 'are required to exist. If "__all__" is not defined, the set of ' + 'public\n' + "names includes all names found in the module's namespace which do " + 'not\n' + 'begin with an underscore character ("\'_\'"). "__all__" should ' + 'contain\n' + 'the entire public API. It is intended to avoid accidentally ' + 'exporting\n' + 'items that are not part of the API (such as library modules which ' + 'were\n' + 'imported and used within the module).\n' + '\n' + 'The "from" form with "*" may only occur in a module scope. If ' + 'the\n' + 'wild card form of import --- "import *" --- is used in a function ' + 'and\n' + 'the function contains or is a nested block with free variables, ' + 'the\n' + 'compiler will raise a "SyntaxError".\n' + '\n' + 'When specifying what module to import you do not have to specify ' + 'the\n' + 'absolute name of the module. When a module or package is ' + 'contained\n' + 'within another package it is possible to make a relative import ' + 'within\n' + 'the same top package without having to mention the package name. ' + 'By\n' + 'using leading dots in the specified module or package after "from" ' + 'you\n' + 'can specify how high to traverse up the current package hierarchy\n' + 'without specifying exact names. One leading dot means the current\n' + 'package where the module making the import exists. Two dots means ' + 'up\n' + 'one package level. Three dots is up two levels, etc. So if you ' + 'execute\n' + '"from . import mod" from a module in the "pkg" package then you ' + 'will\n' + 'end up importing "pkg.mod". If you execute "from ..subpkg2 import ' + 'mod"\n' + 'from within "pkg.subpkg1" you will import "pkg.subpkg2.mod". The\n' + 'specification for relative imports is contained within **PEP ' + '328**.\n' + '\n' + '"importlib.import_module()" is provided to support applications ' + 'that\n' + 'determine which modules need to be loaded dynamically.\n' + '\n' + '\n' + 'Future statements\n' + '=================\n' + '\n' + 'A *future statement* is a directive to the compiler that a ' + 'particular\n' + 'module should be compiled using syntax or semantics that will be\n' + 'available in a specified future release of Python. The future\n' + 'statement is intended to ease migration to future versions of ' + 'Python\n' + 'that introduce incompatible changes to the language. It allows ' + 'use of\n' + 'the new features on a per-module basis before the release in which ' + 'the\n' + 'feature becomes standard.\n' + '\n' + ' future_statement ::= "from" "__future__" "import" feature ["as" ' + 'name]\n' + ' ("," feature ["as" name])*\n' + ' | "from" "__future__" "import" "(" feature ' + '["as" name]\n' + ' ("," feature ["as" name])* [","] ")"\n' + ' feature ::= identifier\n' + ' name ::= identifier\n' + '\n' + 'A future statement must appear near the top of the module. The ' + 'only\n' + 'lines that can appear before a future statement are:\n' + '\n' + '* the module docstring (if any),\n' + '\n' + '* comments,\n' + '\n' + '* blank lines, and\n' + '\n' + '* other future statements.\n' + '\n' + 'The features recognized by Python 2.6 are "unicode_literals",\n' + '"print_function", "absolute_import", "division", "generators",\n' + '"nested_scopes" and "with_statement". "generators", ' + '"with_statement",\n' + '"nested_scopes" are redundant in Python version 2.6 and above ' + 'because\n' + 'they are always enabled.\n' + '\n' + 'A future statement is recognized and treated specially at compile\n' + 'time: Changes to the semantics of core constructs are often\n' + 'implemented by generating different code. It may even be the ' + 'case\n' + 'that a new feature introduces new incompatible syntax (such as a ' + 'new\n' + 'reserved word), in which case the compiler may need to parse the\n' + 'module differently. Such decisions cannot be pushed off until\n' + 'runtime.\n' + '\n' + 'For any given release, the compiler knows which feature names ' + 'have\n' + 'been defined, and raises a compile-time error if a future ' + 'statement\n' + 'contains a feature not known to it.\n' + '\n' + 'The direct runtime semantics are the same as for any import ' + 'statement:\n' + 'there is a standard module "__future__", described later, and it ' + 'will\n' + 'be imported in the usual way at the time the future statement is\n' + 'executed.\n' + '\n' + 'The interesting runtime semantics depend on the specific feature\n' + 'enabled by the future statement.\n' + '\n' + 'Note that there is nothing special about the statement:\n' + '\n' + ' import __future__ [as name]\n' + '\n' + "That is not a future statement; it's an ordinary import statement " + 'with\n' + 'no special semantics or syntax restrictions.\n' + '\n' + 'Code compiled by an "exec" statement or calls to the built-in\n' + 'functions "compile()" and "execfile()" that occur in a module "M"\n' + 'containing a future statement will, by default, use the new ' + 'syntax or\n' + 'semantics associated with the future statement. This can, ' + 'starting\n' + 'with Python 2.2 be controlled by optional arguments to "compile()" ' + '---\n' + 'see the documentation of that function for details.\n' + '\n' + 'A future statement typed at an interactive interpreter prompt ' + 'will\n' + 'take effect for the rest of the interpreter session. If an\n' + 'interpreter is started with the "-i" option, is passed a script ' + 'name\n' + 'to execute, and the script includes a future statement, it will be ' + 'in\n' + 'effect in the interactive session started after the script is\n' + 'executed.\n' + '\n' + 'See also:\n' + '\n' + ' **PEP 236** - Back to the __future__\n' + ' The original proposal for the __future__ mechanism.\n', + 'in': '\n' + 'Comparisons\n' + '***********\n' + '\n' + 'Unlike C, all comparison operations in Python have the same priority,\n' + 'which is lower than that of any arithmetic, shifting or bitwise\n' + 'operation. Also unlike C, expressions like "a < b < c" have the\n' + 'interpretation that is conventional in mathematics:\n' + '\n' + ' comparison ::= or_expr ( comp_operator or_expr )*\n' + ' comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "<>" | "!="\n' + ' | "is" ["not"] | ["not"] "in"\n' + '\n' + 'Comparisons yield boolean values: "True" or "False".\n' + '\n' + 'Comparisons can be chained arbitrarily, e.g., "x < y <= z" is\n' + 'equivalent to "x < y and y <= z", except that "y" is evaluated only\n' + 'once (but in both cases "z" is not evaluated at all when "x < y" is\n' + 'found to be false).\n' + '\n' + 'Formally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n' + '*op2*, ..., *opN* are comparison operators, then "a op1 b op2 c ... y\n' + 'opN z" is equivalent to "a op1 b and b op2 c and ... y opN z", except\n' + 'that each expression is evaluated at most once.\n' + '\n' + 'Note that "a op1 b op2 c" doesn\'t imply any kind of comparison ' + 'between\n' + '*a* and *c*, so that, e.g., "x < y > z" is perfectly legal (though\n' + 'perhaps not pretty).\n' + '\n' + 'The forms "<>" and "!=" are equivalent; for consistency with C, "!="\n' + 'is preferred; where "!=" is mentioned below "<>" is also accepted.\n' + 'The "<>" spelling is considered obsolescent.\n' + '\n' + 'The operators "<", ">", "==", ">=", "<=", and "!=" compare the values\n' + 'of two objects. The objects need not have the same type. If both are\n' + 'numbers, they are converted to a common type. Otherwise, objects of\n' + 'different types *always* compare unequal, and are ordered ' + 'consistently\n' + 'but arbitrarily. You can control comparison behavior of objects of\n' + 'non-built-in types by defining a "__cmp__" method or rich comparison\n' + 'methods like "__gt__", described in section Special method names.\n' + '\n' + '(This unusual definition of comparison was used to simplify the\n' + 'definition of operations like sorting and the "in" and "not in"\n' + 'operators. In the future, the comparison rules for objects of\n' + 'different types are likely to change.)\n' + '\n' + 'Comparison of objects of the same type depends on the type:\n' + '\n' + '* Numbers are compared arithmetically.\n' + '\n' + '* Strings are compared lexicographically using the numeric\n' + ' equivalents (the result of the built-in function "ord()") of their\n' + ' characters. Unicode and 8-bit strings are fully interoperable in\n' + ' this behavior. [4]\n' + '\n' + '* Tuples and lists are compared lexicographically using comparison\n' + ' of corresponding elements. This means that to compare equal, each\n' + ' element must compare equal and the two sequences must be of the ' + 'same\n' + ' type and have the same length.\n' + '\n' + ' If not equal, the sequences are ordered the same as their first\n' + ' differing elements. For example, "cmp([1,2,x], [1,2,y])" returns\n' + ' the same as "cmp(x,y)". If the corresponding element does not\n' + ' exist, the shorter sequence is ordered first (for example, "[1,2] <\n' + ' [1,2,3]").\n' + '\n' + '* Mappings (dictionaries) compare equal if and only if their sorted\n' + ' (key, value) lists compare equal. [5] Outcomes other than equality\n' + ' are resolved consistently, but are not otherwise defined. [6]\n' + '\n' + '* Most other objects of built-in types compare unequal unless they\n' + ' are the same object; the choice whether one object is considered\n' + ' smaller or larger than another one is made arbitrarily but\n' + ' consistently within one execution of a program.\n' + '\n' + 'The operators "in" and "not in" test for collection membership. "x ' + 'in\n' + 's" evaluates to true if *x* is a member of the collection *s*, and\n' + 'false otherwise. "x not in s" returns the negation of "x in s". The\n' + 'collection membership test has traditionally been bound to sequences;\n' + 'an object is a member of a collection if the collection is a sequence\n' + 'and contains an element equal to that object. However, it make sense\n' + 'for many other object types to support membership tests without being\n' + 'a sequence. In particular, dictionaries (for keys) and sets support\n' + 'membership testing.\n' + '\n' + 'For the list and tuple types, "x in y" is true if and only if there\n' + 'exists an index *i* such that either "x is y[i]" or "x == y[i]" is\n' + 'true.\n' + '\n' + 'For the Unicode and string types, "x in y" is true if and only if *x*\n' + 'is a substring of *y*. An equivalent test is "y.find(x) != -1".\n' + 'Note, *x* and *y* need not be the same type; consequently, "u\'ab\' ' + 'in\n' + '\'abc\'" will return "True". Empty strings are always considered to be ' + 'a\n' + 'substring of any other string, so """ in "abc"" will return "True".\n' + '\n' + 'Changed in version 2.3: Previously, *x* was required to be a string ' + 'of\n' + 'length "1".\n' + '\n' + 'For user-defined classes which define the "__contains__()" method, "x\n' + 'in y" is true if and only if "y.__contains__(x)" is true.\n' + '\n' + 'For user-defined classes which do not define "__contains__()" but do\n' + 'define "__iter__()", "x in y" is true if some value "z" with "x == z"\n' + 'is produced while iterating over "y". If an exception is raised\n' + 'during the iteration, it is as if "in" raised that exception.\n' + '\n' + 'Lastly, the old-style iteration protocol is tried: if a class defines\n' + '"__getitem__()", "x in y" is true if and only if there is a non-\n' + 'negative integer index *i* such that "x == y[i]", and all lower\n' + 'integer indices do not raise "IndexError" exception. (If any other\n' + 'exception is raised, it is as if "in" raised that exception).\n' + '\n' + 'The operator "not in" is defined to have the inverse true value of\n' + '"in".\n' + '\n' + 'The operators "is" and "is not" test for object identity: "x is y" is\n' + 'true if and only if *x* and *y* are the same object. "x is not y"\n' + 'yields the inverse truth value. [7]\n', + 'integers': '\n' + 'Integer and long integer literals\n' + '*********************************\n' + '\n' + 'Integer and long integer literals are described by the ' + 'following\n' + 'lexical definitions:\n' + '\n' + ' longinteger ::= integer ("l" | "L")\n' + ' integer ::= decimalinteger | octinteger | hexinteger | ' + 'bininteger\n' + ' decimalinteger ::= nonzerodigit digit* | "0"\n' + ' octinteger ::= "0" ("o" | "O") octdigit+ | "0" octdigit+\n' + ' hexinteger ::= "0" ("x" | "X") hexdigit+\n' + ' bininteger ::= "0" ("b" | "B") bindigit+\n' + ' nonzerodigit ::= "1"..."9"\n' + ' octdigit ::= "0"..."7"\n' + ' bindigit ::= "0" | "1"\n' + ' hexdigit ::= digit | "a"..."f" | "A"..."F"\n' + '\n' + 'Although both lower case "\'l\'" and upper case "\'L\'" are ' + 'allowed as\n' + 'suffix for long integers, it is strongly recommended to always ' + 'use\n' + '"\'L\'", since the letter "\'l\'" looks too much like the digit ' + '"\'1\'".\n' + '\n' + 'Plain integer literals that are above the largest representable ' + 'plain\n' + 'integer (e.g., 2147483647 when using 32-bit arithmetic) are ' + 'accepted\n' + 'as if they were long integers instead. [1] There is no limit ' + 'for long\n' + 'integer literals apart from what can be stored in available ' + 'memory.\n' + '\n' + 'Some examples of plain integer literals (first row) and long ' + 'integer\n' + 'literals (second and third rows):\n' + '\n' + ' 7 2147483647 0177\n' + ' 3L 79228162514264337593543950336L 0377L 0x100000000L\n' + ' 79228162514264337593543950336 0xdeadbeef\n', + 'lambda': '\n' + 'Lambdas\n' + '*******\n' + '\n' + ' lambda_expr ::= "lambda" [parameter_list]: expression\n' + ' old_lambda_expr ::= "lambda" [parameter_list]: old_expression\n' + '\n' + 'Lambda expressions (sometimes called lambda forms) have the same\n' + 'syntactic position as expressions. They are a shorthand to ' + 'create\n' + 'anonymous functions; the expression "lambda arguments: ' + 'expression"\n' + 'yields a function object. The unnamed object behaves like a ' + 'function\n' + 'object defined with\n' + '\n' + ' def name(arguments):\n' + ' return expression\n' + '\n' + 'See section Function definitions for the syntax of parameter ' + 'lists.\n' + 'Note that functions created with lambda expressions cannot ' + 'contain\n' + 'statements.\n', + 'lists': '\n' + 'List displays\n' + '*************\n' + '\n' + 'A list display is a possibly empty series of expressions enclosed ' + 'in\n' + 'square brackets:\n' + '\n' + ' list_display ::= "[" [expression_list | ' + 'list_comprehension] "]"\n' + ' list_comprehension ::= expression list_for\n' + ' list_for ::= "for" target_list "in" ' + 'old_expression_list [list_iter]\n' + ' old_expression_list ::= old_expression [("," old_expression)+ ' + '[","]]\n' + ' old_expression ::= or_test | old_lambda_expr\n' + ' list_iter ::= list_for | list_if\n' + ' list_if ::= "if" old_expression [list_iter]\n' + '\n' + 'A list display yields a new list object. Its contents are ' + 'specified\n' + 'by providing either a list of expressions or a list comprehension.\n' + 'When a comma-separated list of expressions is supplied, its ' + 'elements\n' + 'are evaluated from left to right and placed into the list object ' + 'in\n' + 'that order. When a list comprehension is supplied, it consists of ' + 'a\n' + 'single expression followed by at least one "for" clause and zero ' + 'or\n' + 'more "for" or "if" clauses. In this case, the elements of the new\n' + 'list are those that would be produced by considering each of the ' + '"for"\n' + 'or "if" clauses a block, nesting from left to right, and ' + 'evaluating\n' + 'the expression to produce a list element each time the innermost ' + 'block\n' + 'is reached [1].\n', + 'naming': '\n' + 'Naming and binding\n' + '******************\n' + '\n' + '*Names* refer to objects. Names are introduced by name binding\n' + 'operations. Each occurrence of a name in the program text refers ' + 'to\n' + 'the *binding* of that name established in the innermost function ' + 'block\n' + 'containing the use.\n' + '\n' + 'A *block* is a piece of Python program text that is executed as a\n' + 'unit. The following are blocks: a module, a function body, and a ' + 'class\n' + 'definition. Each command typed interactively is a block. A ' + 'script\n' + 'file (a file given as standard input to the interpreter or ' + 'specified\n' + 'on the interpreter command line the first argument) is a code ' + 'block.\n' + 'A script command (a command specified on the interpreter command ' + 'line\n' + "with the '**-c**' option) is a code block. The file read by the\n" + 'built-in function "execfile()" is a code block. The string ' + 'argument\n' + 'passed to the built-in function "eval()" and to the "exec" ' + 'statement\n' + 'is a code block. The expression read and evaluated by the ' + 'built-in\n' + 'function "input()" is a code block.\n' + '\n' + 'A code block is executed in an *execution frame*. A frame ' + 'contains\n' + 'some administrative information (used for debugging) and ' + 'determines\n' + "where and how execution continues after the code block's execution " + 'has\n' + 'completed.\n' + '\n' + 'A *scope* defines the visibility of a name within a block. If a ' + 'local\n' + 'variable is defined in a block, its scope includes that block. If ' + 'the\n' + 'definition occurs in a function block, the scope extends to any ' + 'blocks\n' + 'contained within the defining one, unless a contained block ' + 'introduces\n' + 'a different binding for the name. The scope of names defined in ' + 'a\n' + 'class block is limited to the class block; it does not extend to ' + 'the\n' + 'code blocks of methods -- this includes generator expressions ' + 'since\n' + 'they are implemented using a function scope. This means that the\n' + 'following will fail:\n' + '\n' + ' class A:\n' + ' a = 42\n' + ' b = list(a + i for i in range(10))\n' + '\n' + 'When a name is used in a code block, it is resolved using the ' + 'nearest\n' + 'enclosing scope. The set of all such scopes visible to a code ' + 'block\n' + "is called the block's *environment*.\n" + '\n' + 'If a name is bound in a block, it is a local variable of that ' + 'block.\n' + 'If a name is bound at the module level, it is a global variable. ' + '(The\n' + 'variables of the module code block are local and global.) If a\n' + 'variable is used in a code block but not defined there, it is a ' + '*free\n' + 'variable*.\n' + '\n' + 'When a name is not found at all, a "NameError" exception is ' + 'raised.\n' + 'If the name refers to a local variable that has not been bound, a\n' + '"UnboundLocalError" exception is raised. "UnboundLocalError" is ' + 'a\n' + 'subclass of "NameError".\n' + '\n' + 'The following constructs bind names: formal parameters to ' + 'functions,\n' + '"import" statements, class and function definitions (these bind ' + 'the\n' + 'class or function name in the defining block), and targets that ' + 'are\n' + 'identifiers if occurring in an assignment, "for" loop header, in ' + 'the\n' + 'second position of an "except" clause header or after "as" in a ' + '"with"\n' + 'statement. The "import" statement of the form "from ... import ' + '*"\n' + 'binds all names defined in the imported module, except those ' + 'beginning\n' + 'with an underscore. This form may only be used at the module ' + 'level.\n' + '\n' + 'A target occurring in a "del" statement is also considered bound ' + 'for\n' + 'this purpose (though the actual semantics are to unbind the ' + 'name). It\n' + 'is illegal to unbind a name that is referenced by an enclosing ' + 'scope;\n' + 'the compiler will report a "SyntaxError".\n' + '\n' + 'Each assignment or import statement occurs within a block defined ' + 'by a\n' + 'class or function definition or at the module level (the ' + 'top-level\n' + 'code block).\n' + '\n' + 'If a name binding operation occurs anywhere within a code block, ' + 'all\n' + 'uses of the name within the block are treated as references to ' + 'the\n' + 'current block. This can lead to errors when a name is used within ' + 'a\n' + 'block before it is bound. This rule is subtle. Python lacks\n' + 'declarations and allows name binding operations to occur anywhere\n' + 'within a code block. The local variables of a code block can be\n' + 'determined by scanning the entire text of the block for name ' + 'binding\n' + 'operations.\n' + '\n' + 'If the global statement occurs within a block, all uses of the ' + 'name\n' + 'specified in the statement refer to the binding of that name in ' + 'the\n' + 'top-level namespace. Names are resolved in the top-level namespace ' + 'by\n' + 'searching the global namespace, i.e. the namespace of the module\n' + 'containing the code block, and the builtins namespace, the ' + 'namespace\n' + 'of the module "__builtin__". The global namespace is searched ' + 'first.\n' + 'If the name is not found there, the builtins namespace is ' + 'searched.\n' + 'The global statement must precede all uses of the name.\n' + '\n' + 'The builtins namespace associated with the execution of a code ' + 'block\n' + 'is actually found by looking up the name "__builtins__" in its ' + 'global\n' + 'namespace; this should be a dictionary or a module (in the latter ' + 'case\n' + "the module's dictionary is used). By default, when in the " + '"__main__"\n' + 'module, "__builtins__" is the built-in module "__builtin__" (note: ' + 'no\n' + '\'s\'); when in any other module, "__builtins__" is an alias for ' + 'the\n' + 'dictionary of the "__builtin__" module itself. "__builtins__" can ' + 'be\n' + 'set to a user-created dictionary to create a weak form of ' + 'restricted\n' + 'execution.\n' + '\n' + '**CPython implementation detail:** Users should not touch\n' + '"__builtins__"; it is strictly an implementation detail. Users\n' + 'wanting to override values in the builtins namespace should ' + '"import"\n' + 'the "__builtin__" (no \'s\') module and modify its attributes\n' + 'appropriately.\n' + '\n' + 'The namespace for a module is automatically created the first time ' + 'a\n' + 'module is imported. The main module for a script is always ' + 'called\n' + '"__main__".\n' + '\n' + 'The "global" statement has the same scope as a name binding ' + 'operation\n' + 'in the same block. If the nearest enclosing scope for a free ' + 'variable\n' + 'contains a global statement, the free variable is treated as a ' + 'global.\n' + '\n' + 'A class definition is an executable statement that may use and ' + 'define\n' + 'names. These references follow the normal rules for name ' + 'resolution.\n' + 'The namespace of the class definition becomes the attribute ' + 'dictionary\n' + 'of the class. Names defined at the class scope are not visible ' + 'in\n' + 'methods.\n' + '\n' + '\n' + 'Interaction with dynamic features\n' + '=================================\n' + '\n' + 'There are several cases where Python statements are illegal when ' + 'used\n' + 'in conjunction with nested scopes that contain free variables.\n' + '\n' + 'If a variable is referenced in an enclosing scope, it is illegal ' + 'to\n' + 'delete the name. An error will be reported at compile time.\n' + '\n' + 'If the wild card form of import --- "import *" --- is used in a\n' + 'function and the function contains or is a nested block with free\n' + 'variables, the compiler will raise a "SyntaxError".\n' + '\n' + 'If "exec" is used in a function and the function contains or is a\n' + 'nested block with free variables, the compiler will raise a\n' + '"SyntaxError" unless the exec explicitly specifies the local ' + 'namespace\n' + 'for the "exec". (In other words, "exec obj" would be illegal, ' + 'but\n' + '"exec obj in ns" would be legal.)\n' + '\n' + 'The "eval()", "execfile()", and "input()" functions and the ' + '"exec"\n' + 'statement do not have access to the full environment for ' + 'resolving\n' + 'names. Names may be resolved in the local and global namespaces ' + 'of\n' + 'the caller. Free variables are not resolved in the nearest ' + 'enclosing\n' + 'namespace, but in the global namespace. [1] The "exec" statement ' + 'and\n' + 'the "eval()" and "execfile()" functions have optional arguments ' + 'to\n' + 'override the global and local namespace. If only one namespace ' + 'is\n' + 'specified, it is used for both.\n', + 'numbers': '\n' + 'Numeric literals\n' + '****************\n' + '\n' + 'There are four types of numeric literals: plain integers, long\n' + 'integers, floating point numbers, and imaginary numbers. There ' + 'are no\n' + 'complex literals (complex numbers can be formed by adding a real\n' + 'number and an imaginary number).\n' + '\n' + 'Note that numeric literals do not include a sign; a phrase like ' + '"-1"\n' + 'is actually an expression composed of the unary operator \'"-"\' ' + 'and the\n' + 'literal "1".\n', + 'numeric-types': '\n' + 'Emulating numeric types\n' + '***********************\n' + '\n' + 'The following methods can be defined to emulate numeric ' + 'objects.\n' + 'Methods corresponding to operations that are not supported ' + 'by the\n' + 'particular kind of number implemented (e.g., bitwise ' + 'operations for\n' + 'non-integral numbers) should be left undefined.\n' + '\n' + 'object.__add__(self, other)\n' + 'object.__sub__(self, other)\n' + 'object.__mul__(self, other)\n' + 'object.__floordiv__(self, other)\n' + 'object.__mod__(self, other)\n' + 'object.__divmod__(self, other)\n' + 'object.__pow__(self, other[, modulo])\n' + 'object.__lshift__(self, other)\n' + 'object.__rshift__(self, other)\n' + 'object.__and__(self, other)\n' + 'object.__xor__(self, other)\n' + 'object.__or__(self, other)\n' + '\n' + ' These methods are called to implement the binary ' + 'arithmetic\n' + ' operations ("+", "-", "*", "//", "%", "divmod()", ' + '"pow()", "**",\n' + ' "<<", ">>", "&", "^", "|"). For instance, to evaluate ' + 'the\n' + ' expression "x + y", where *x* is an instance of a class ' + 'that has an\n' + ' "__add__()" method, "x.__add__(y)" is called. The ' + '"__divmod__()"\n' + ' method should be the equivalent to using ' + '"__floordiv__()" and\n' + ' "__mod__()"; it should not be related to "__truediv__()" ' + '(described\n' + ' below). Note that "__pow__()" should be defined to ' + 'accept an\n' + ' optional third argument if the ternary version of the ' + 'built-in\n' + ' "pow()" function is to be supported.\n' + '\n' + ' If one of those methods does not support the operation ' + 'with the\n' + ' supplied arguments, it should return "NotImplemented".\n' + '\n' + 'object.__div__(self, other)\n' + 'object.__truediv__(self, other)\n' + '\n' + ' The division operator ("/") is implemented by these ' + 'methods. The\n' + ' "__truediv__()" method is used when ' + '"__future__.division" is in\n' + ' effect, otherwise "__div__()" is used. If only one of ' + 'these two\n' + ' methods is defined, the object will not support division ' + 'in the\n' + ' alternate context; "TypeError" will be raised instead.\n' + '\n' + 'object.__radd__(self, other)\n' + 'object.__rsub__(self, other)\n' + 'object.__rmul__(self, other)\n' + 'object.__rdiv__(self, other)\n' + 'object.__rtruediv__(self, other)\n' + 'object.__rfloordiv__(self, other)\n' + 'object.__rmod__(self, other)\n' + 'object.__rdivmod__(self, other)\n' + 'object.__rpow__(self, other)\n' + 'object.__rlshift__(self, other)\n' + 'object.__rrshift__(self, other)\n' + 'object.__rand__(self, other)\n' + 'object.__rxor__(self, other)\n' + 'object.__ror__(self, other)\n' + '\n' + ' These methods are called to implement the binary ' + 'arithmetic\n' + ' operations ("+", "-", "*", "/", "%", "divmod()", ' + '"pow()", "**",\n' + ' "<<", ">>", "&", "^", "|") with reflected (swapped) ' + 'operands.\n' + ' These functions are only called if the left operand does ' + 'not\n' + ' support the corresponding operation and the operands are ' + 'of\n' + ' different types. [2] For instance, to evaluate the ' + 'expression "x -\n' + ' y", where *y* is an instance of a class that has an ' + '"__rsub__()"\n' + ' method, "y.__rsub__(x)" is called if "x.__sub__(y)" ' + 'returns\n' + ' *NotImplemented*.\n' + '\n' + ' Note that ternary "pow()" will not try calling ' + '"__rpow__()" (the\n' + ' coercion rules would become too complicated).\n' + '\n' + " Note: If the right operand's type is a subclass of the " + 'left\n' + " operand's type and that subclass provides the " + 'reflected method\n' + ' for the operation, this method will be called before ' + 'the left\n' + " operand's non-reflected method. This behavior allows " + 'subclasses\n' + " to override their ancestors' operations.\n" + '\n' + 'object.__iadd__(self, other)\n' + 'object.__isub__(self, other)\n' + 'object.__imul__(self, other)\n' + 'object.__idiv__(self, other)\n' + 'object.__itruediv__(self, other)\n' + 'object.__ifloordiv__(self, other)\n' + 'object.__imod__(self, other)\n' + 'object.__ipow__(self, other[, modulo])\n' + 'object.__ilshift__(self, other)\n' + 'object.__irshift__(self, other)\n' + 'object.__iand__(self, other)\n' + 'object.__ixor__(self, other)\n' + 'object.__ior__(self, other)\n' + '\n' + ' These methods are called to implement the augmented ' + 'arithmetic\n' + ' assignments ("+=", "-=", "*=", "/=", "//=", "%=", "**=", ' + '"<<=",\n' + ' ">>=", "&=", "^=", "|="). These methods should attempt ' + 'to do the\n' + ' operation in-place (modifying *self*) and return the ' + 'result (which\n' + ' could be, but does not have to be, *self*). If a ' + 'specific method\n' + ' is not defined, the augmented assignment falls back to ' + 'the normal\n' + ' methods. For instance, to execute the statement "x += ' + 'y", where\n' + ' *x* is an instance of a class that has an "__iadd__()" ' + 'method,\n' + ' "x.__iadd__(y)" is called. If *x* is an instance of a ' + 'class that\n' + ' does not define a "__iadd__()" method, "x.__add__(y)" ' + 'and\n' + ' "y.__radd__(x)" are considered, as with the evaluation ' + 'of "x + y".\n' + '\n' + 'object.__neg__(self)\n' + 'object.__pos__(self)\n' + 'object.__abs__(self)\n' + 'object.__invert__(self)\n' + '\n' + ' Called to implement the unary arithmetic operations ' + '("-", "+",\n' + ' "abs()" and "~").\n' + '\n' + 'object.__complex__(self)\n' + 'object.__int__(self)\n' + 'object.__long__(self)\n' + 'object.__float__(self)\n' + '\n' + ' Called to implement the built-in functions "complex()", ' + '"int()",\n' + ' "long()", and "float()". Should return a value of the ' + 'appropriate\n' + ' type.\n' + '\n' + 'object.__oct__(self)\n' + 'object.__hex__(self)\n' + '\n' + ' Called to implement the built-in functions "oct()" and ' + '"hex()".\n' + ' Should return a string value.\n' + '\n' + 'object.__index__(self)\n' + '\n' + ' Called to implement "operator.index()". Also called ' + 'whenever\n' + ' Python needs an integer object (such as in slicing). ' + 'Must return\n' + ' an integer (int or long).\n' + '\n' + ' New in version 2.5.\n' + '\n' + 'object.__coerce__(self, other)\n' + '\n' + ' Called to implement "mixed-mode" numeric arithmetic. ' + 'Should either\n' + ' return a 2-tuple containing *self* and *other* converted ' + 'to a\n' + ' common numeric type, or "None" if conversion is ' + 'impossible. When\n' + ' the common type would be the type of "other", it is ' + 'sufficient to\n' + ' return "None", since the interpreter will also ask the ' + 'other object\n' + ' to attempt a coercion (but sometimes, if the ' + 'implementation of the\n' + ' other type cannot be changed, it is useful to do the ' + 'conversion to\n' + ' the other type here). A return value of ' + '"NotImplemented" is\n' + ' equivalent to returning "None".\n', + 'objects': '\n' + 'Objects, values and types\n' + '*************************\n' + '\n' + "*Objects* are Python's abstraction for data. All data in a " + 'Python\n' + 'program is represented by objects or by relations between ' + 'objects. (In\n' + 'a sense, and in conformance to Von Neumann\'s model of a "stored\n' + 'program computer," code is also represented by objects.)\n' + '\n' + "Every object has an identity, a type and a value. An object's\n" + '*identity* never changes once it has been created; you may think ' + 'of it\n' + 'as the object\'s address in memory. The \'"is"\' operator ' + 'compares the\n' + 'identity of two objects; the "id()" function returns an integer\n' + 'representing its identity (currently implemented as its address). ' + 'An\n' + "object's *type* is also unchangeable. [1] An object's type " + 'determines\n' + 'the operations that the object supports (e.g., "does it have a\n' + 'length?") and also defines the possible values for objects of ' + 'that\n' + 'type. The "type()" function returns an object\'s type (which is ' + 'an\n' + 'object itself). The *value* of some objects can change. ' + 'Objects\n' + 'whose value can change are said to be *mutable*; objects whose ' + 'value\n' + 'is unchangeable once they are created are called *immutable*. ' + '(The\n' + 'value of an immutable container object that contains a reference ' + 'to a\n' + "mutable object can change when the latter's value is changed; " + 'however\n' + 'the container is still considered immutable, because the ' + 'collection of\n' + 'objects it contains cannot be changed. So, immutability is not\n' + 'strictly the same as having an unchangeable value, it is more ' + 'subtle.)\n' + "An object's mutability is determined by its type; for instance,\n" + 'numbers, strings and tuples are immutable, while dictionaries ' + 'and\n' + 'lists are mutable.\n' + '\n' + 'Objects are never explicitly destroyed; however, when they ' + 'become\n' + 'unreachable they may be garbage-collected. An implementation is\n' + 'allowed to postpone garbage collection or omit it altogether --- ' + 'it is\n' + 'a matter of implementation quality how garbage collection is\n' + 'implemented, as long as no objects are collected that are still\n' + 'reachable.\n' + '\n' + '**CPython implementation detail:** CPython currently uses a ' + 'reference-\n' + 'counting scheme with (optional) delayed detection of cyclically ' + 'linked\n' + 'garbage, which collects most objects as soon as they become\n' + 'unreachable, but is not guaranteed to collect garbage containing\n' + 'circular references. See the documentation of the "gc" module ' + 'for\n' + 'information on controlling the collection of cyclic garbage. ' + 'Other\n' + 'implementations act differently and CPython may change. Do not ' + 'depend\n' + 'on immediate finalization of objects when they become unreachable ' + '(ex:\n' + 'always close files).\n' + '\n' + "Note that the use of the implementation's tracing or debugging\n" + 'facilities may keep objects alive that would normally be ' + 'collectable.\n' + 'Also note that catching an exception with a \'"try"..."except"\'\n' + 'statement may keep objects alive.\n' + '\n' + 'Some objects contain references to "external" resources such as ' + 'open\n' + 'files or windows. It is understood that these resources are ' + 'freed\n' + 'when the object is garbage-collected, but since garbage ' + 'collection is\n' + 'not guaranteed to happen, such objects also provide an explicit ' + 'way to\n' + 'release the external resource, usually a "close()" method. ' + 'Programs\n' + 'are strongly recommended to explicitly close such objects. The\n' + '\'"try"..."finally"\' statement provides a convenient way to do ' + 'this.\n' + '\n' + 'Some objects contain references to other objects; these are ' + 'called\n' + '*containers*. Examples of containers are tuples, lists and\n' + "dictionaries. The references are part of a container's value. " + 'In\n' + 'most cases, when we talk about the value of a container, we imply ' + 'the\n' + 'values, not the identities of the contained objects; however, ' + 'when we\n' + 'talk about the mutability of a container, only the identities of ' + 'the\n' + 'immediately contained objects are implied. So, if an immutable\n' + 'container (like a tuple) contains a reference to a mutable ' + 'object, its\n' + 'value changes if that mutable object is changed.\n' + '\n' + 'Types affect almost all aspects of object behavior. Even the\n' + 'importance of object identity is affected in some sense: for ' + 'immutable\n' + 'types, operations that compute new values may actually return a\n' + 'reference to any existing object with the same type and value, ' + 'while\n' + 'for mutable objects this is not allowed. E.g., after "a = 1; b = ' + '1",\n' + '"a" and "b" may or may not refer to the same object with the ' + 'value\n' + 'one, depending on the implementation, but after "c = []; d = []", ' + '"c"\n' + 'and "d" are guaranteed to refer to two different, unique, newly\n' + 'created empty lists. (Note that "c = d = []" assigns the same ' + 'object\n' + 'to both "c" and "d".)\n', + 'operator-summary': '\n' + 'Operator precedence\n' + '*******************\n' + '\n' + 'The following table summarizes the operator precedences ' + 'in Python,\n' + 'from lowest precedence (least binding) to highest ' + 'precedence (most\n' + 'binding). Operators in the same box have the same ' + 'precedence. Unless\n' + 'the syntax is explicitly given, operators are binary. ' + 'Operators in\n' + 'the same box group left to right (except for ' + 'comparisons, including\n' + 'tests, which all have the same precedence and chain from ' + 'left to right\n' + '--- see section Comparisons --- and exponentiation, ' + 'which groups from\n' + 'right to left).\n' + '\n' + '+-------------------------------------------------+---------------------------------------+\n' + '| Operator | ' + 'Description |\n' + '+=================================================+=======================================+\n' + '| "lambda" | ' + 'Lambda expression |\n' + '+-------------------------------------------------+---------------------------------------+\n' + '| "if" -- "else" | ' + 'Conditional expression |\n' + '+-------------------------------------------------+---------------------------------------+\n' + '| "or" | ' + 'Boolean OR |\n' + '+-------------------------------------------------+---------------------------------------+\n' + '| "and" | ' + 'Boolean AND |\n' + '+-------------------------------------------------+---------------------------------------+\n' + '| "not" "x" | ' + 'Boolean NOT |\n' + '+-------------------------------------------------+---------------------------------------+\n' + '| "in", "not in", "is", "is not", "<", "<=", ">", | ' + 'Comparisons, including membership |\n' + '| ">=", "<>", "!=", "==" | ' + 'tests and identity tests |\n' + '+-------------------------------------------------+---------------------------------------+\n' + '| "|" | ' + 'Bitwise OR |\n' + '+-------------------------------------------------+---------------------------------------+\n' + '| "^" | ' + 'Bitwise XOR |\n' + '+-------------------------------------------------+---------------------------------------+\n' + '| "&" | ' + 'Bitwise AND |\n' + '+-------------------------------------------------+---------------------------------------+\n' + '| "<<", ">>" | ' + 'Shifts |\n' + '+-------------------------------------------------+---------------------------------------+\n' + '| "+", "-" | ' + 'Addition and subtraction |\n' + '+-------------------------------------------------+---------------------------------------+\n' + '| "*", "/", "//", "%" | ' + 'Multiplication, division, remainder |\n' + '| | ' + '[8] |\n' + '+-------------------------------------------------+---------------------------------------+\n' + '| "+x", "-x", "~x" | ' + 'Positive, negative, bitwise NOT |\n' + '+-------------------------------------------------+---------------------------------------+\n' + '| "**" | ' + 'Exponentiation [9] |\n' + '+-------------------------------------------------+---------------------------------------+\n' + '| "x[index]", "x[index:index]", | ' + 'Subscription, slicing, call, |\n' + '| "x(arguments...)", "x.attribute" | ' + 'attribute reference |\n' + '+-------------------------------------------------+---------------------------------------+\n' + '| "(expressions...)", "[expressions...]", "{key: | ' + 'Binding or tuple display, list |\n' + '| value...}", "`expressions...`" | ' + 'display, dictionary display, string |\n' + '| | ' + 'conversion |\n' + '+-------------------------------------------------+---------------------------------------+\n' + '\n' + '-[ Footnotes ]-\n' + '\n' + '[1] In Python 2.3 and later releases, a list ' + 'comprehension "leaks"\n' + ' the control variables of each "for" it contains into ' + 'the\n' + ' containing scope. However, this behavior is ' + 'deprecated, and\n' + ' relying on it will not work in Python 3.\n' + '\n' + '[2] While "abs(x%y) < abs(y)" is true mathematically, ' + 'for floats\n' + ' it may not be true numerically due to roundoff. For ' + 'example, and\n' + ' assuming a platform on which a Python float is an ' + 'IEEE 754 double-\n' + ' precision number, in order that "-1e-100 % 1e100" ' + 'have the same\n' + ' sign as "1e100", the computed result is "-1e-100 + ' + '1e100", which\n' + ' is numerically exactly equal to "1e100". The ' + 'function\n' + ' "math.fmod()" returns a result whose sign matches ' + 'the sign of the\n' + ' first argument instead, and so returns "-1e-100" in ' + 'this case.\n' + ' Which approach is more appropriate depends on the ' + 'application.\n' + '\n' + '[3] If x is very close to an exact integer multiple of ' + "y, it's\n" + ' possible for "floor(x/y)" to be one larger than ' + '"(x-x%y)/y" due to\n' + ' rounding. In such cases, Python returns the latter ' + 'result, in\n' + ' order to preserve that "divmod(x,y)[0] * y + x % y" ' + 'be very close\n' + ' to "x".\n' + '\n' + '[4] While comparisons between unicode strings make sense ' + 'at the\n' + ' byte level, they may be counter-intuitive to users. ' + 'For example,\n' + ' the strings "u"\\u00C7"" and "u"\\u0043\\u0327"" ' + 'compare differently,\n' + ' even though they both represent the same unicode ' + 'character (LATIN\n' + ' CAPITAL LETTER C WITH CEDILLA). To compare strings ' + 'in a human\n' + ' recognizable way, compare using ' + '"unicodedata.normalize()".\n' + '\n' + '[5] The implementation computes this efficiently, ' + 'without\n' + ' constructing lists or sorting.\n' + '\n' + '[6] Earlier versions of Python used lexicographic ' + 'comparison of\n' + ' the sorted (key, value) lists, but this was very ' + 'expensive for the\n' + ' common case of comparing for equality. An even ' + 'earlier version of\n' + ' Python compared dictionaries by identity only, but ' + 'this caused\n' + ' surprises because people expected to be able to test ' + 'a dictionary\n' + ' for emptiness by comparing it to "{}".\n' + '\n' + '[7] Due to automatic garbage-collection, free lists, and ' + 'the\n' + ' dynamic nature of descriptors, you may notice ' + 'seemingly unusual\n' + ' behaviour in certain uses of the "is" operator, like ' + 'those\n' + ' involving comparisons between instance methods, or ' + 'constants.\n' + ' Check their documentation for more info.\n' + '\n' + '[8] The "%" operator is also used for string formatting; ' + 'the same\n' + ' precedence applies.\n' + '\n' + '[9] The power operator "**" binds less tightly than an ' + 'arithmetic\n' + ' or bitwise unary operator on its right, that is, ' + '"2**-1" is "0.5".\n', + 'pass': '\n' + 'The "pass" statement\n' + '********************\n' + '\n' + ' pass_stmt ::= "pass"\n' + '\n' + '"pass" is a null operation --- when it is executed, nothing ' + 'happens.\n' + 'It is useful as a placeholder when a statement is required\n' + 'syntactically, but no code needs to be executed, for example:\n' + '\n' + ' def f(arg): pass # a function that does nothing (yet)\n' + '\n' + ' class C: pass # a class with no methods (yet)\n', + 'power': '\n' + 'The power operator\n' + '******************\n' + '\n' + 'The power operator binds more tightly than unary operators on its\n' + 'left; it binds less tightly than unary operators on its right. ' + 'The\n' + 'syntax is:\n' + '\n' + ' power ::= primary ["**" u_expr]\n' + '\n' + 'Thus, in an unparenthesized sequence of power and unary operators, ' + 'the\n' + 'operators are evaluated from right to left (this does not ' + 'constrain\n' + 'the evaluation order for the operands): "-1**2" results in "-1".\n' + '\n' + 'The power operator has the same semantics as the built-in "pow()"\n' + 'function, when called with two arguments: it yields its left ' + 'argument\n' + 'raised to the power of its right argument. The numeric arguments ' + 'are\n' + 'first converted to a common type. The result type is that of the\n' + 'arguments after coercion.\n' + '\n' + 'With mixed operand types, the coercion rules for binary arithmetic\n' + 'operators apply. For int and long int operands, the result has the\n' + 'same type as the operands (after coercion) unless the second ' + 'argument\n' + 'is negative; in that case, all arguments are converted to float and ' + 'a\n' + 'float result is delivered. For example, "10**2" returns "100", but\n' + '"10**-2" returns "0.01". (This last feature was added in Python ' + '2.2.\n' + 'In Python 2.1 and before, if both arguments were of integer types ' + 'and\n' + 'the second argument was negative, an exception was raised).\n' + '\n' + 'Raising "0.0" to a negative power results in a ' + '"ZeroDivisionError".\n' + 'Raising a negative number to a fractional power results in a\n' + '"ValueError".\n', + 'print': '\n' + 'The "print" statement\n' + '*********************\n' + '\n' + ' print_stmt ::= "print" ([expression ("," expression)* [","]]\n' + ' | ">>" expression [("," expression)+ [","]])\n' + '\n' + '"print" evaluates each expression in turn and writes the resulting\n' + 'object to standard output (see below). If an object is not a ' + 'string,\n' + 'it is first converted to a string using the rules for string\n' + 'conversions. The (resulting or original) string is then written. ' + 'A\n' + 'space is written before each object is (converted and) written, ' + 'unless\n' + 'the output system believes it is positioned at the beginning of a\n' + 'line. This is the case (1) when no characters have yet been ' + 'written\n' + 'to standard output, (2) when the last character written to ' + 'standard\n' + 'output is a whitespace character except "\' \'", or (3) when the ' + 'last\n' + 'write operation on standard output was not a "print" statement. ' + '(In\n' + 'some cases it may be functional to write an empty string to ' + 'standard\n' + 'output for this reason.)\n' + '\n' + 'Note: Objects which act like file objects but which are not the\n' + ' built-in file objects often do not properly emulate this aspect ' + 'of\n' + " the file object's behavior, so it is best not to rely on this.\n" + '\n' + 'A "\'\\n\'" character is written at the end, unless the "print" ' + 'statement\n' + 'ends with a comma. This is the only action if the statement ' + 'contains\n' + 'just the keyword "print".\n' + '\n' + 'Standard output is defined as the file object named "stdout" in ' + 'the\n' + 'built-in module "sys". If no such object exists, or if it does ' + 'not\n' + 'have a "write()" method, a "RuntimeError" exception is raised.\n' + '\n' + '"print" also has an extended form, defined by the second portion ' + 'of\n' + 'the syntax described above. This form is sometimes referred to as\n' + '""print" chevron." In this form, the first expression after the ' + '">>"\n' + 'must evaluate to a "file-like" object, specifically an object that ' + 'has\n' + 'a "write()" method as described above. With this extended form, ' + 'the\n' + 'subsequent expressions are printed to this file object. If the ' + 'first\n' + 'expression evaluates to "None", then "sys.stdout" is used as the ' + 'file\n' + 'for output.\n', + 'raise': '\n' + 'The "raise" statement\n' + '*********************\n' + '\n' + ' raise_stmt ::= "raise" [expression ["," expression ["," ' + 'expression]]]\n' + '\n' + 'If no expressions are present, "raise" re-raises the last ' + 'exception\n' + 'that was active in the current scope. If no exception is active ' + 'in\n' + 'the current scope, a "TypeError" exception is raised indicating ' + 'that\n' + 'this is an error (if running under IDLE, a "Queue.Empty" exception ' + 'is\n' + 'raised instead).\n' + '\n' + 'Otherwise, "raise" evaluates the expressions to get three objects,\n' + 'using "None" as the value of omitted expressions. The first two\n' + 'objects are used to determine the *type* and *value* of the ' + 'exception.\n' + '\n' + 'If the first object is an instance, the type of the exception is ' + 'the\n' + 'class of the instance, the instance itself is the value, and the\n' + 'second object must be "None".\n' + '\n' + 'If the first object is a class, it becomes the type of the ' + 'exception.\n' + 'The second object is used to determine the exception value: If it ' + 'is\n' + 'an instance of the class, the instance becomes the exception value. ' + 'If\n' + 'the second object is a tuple, it is used as the argument list for ' + 'the\n' + 'class constructor; if it is "None", an empty argument list is ' + 'used,\n' + 'and any other object is treated as a single argument to the\n' + 'constructor. The instance so created by calling the constructor ' + 'is\n' + 'used as the exception value.\n' + '\n' + 'If a third object is present and not "None", it must be a ' + 'traceback\n' + 'object (see section The standard type hierarchy), and it is\n' + 'substituted instead of the current location as the place where the\n' + 'exception occurred. If the third object is present and not a\n' + 'traceback object or "None", a "TypeError" exception is raised. ' + 'The\n' + 'three-expression form of "raise" is useful to re-raise an ' + 'exception\n' + 'transparently in an except clause, but "raise" with no expressions\n' + 'should be preferred if the exception to be re-raised was the most\n' + 'recently active exception in the current scope.\n' + '\n' + 'Additional information on exceptions can be found in section\n' + 'Exceptions, and information about handling exceptions is in ' + 'section\n' + 'The try statement.\n', + 'return': '\n' + 'The "return" statement\n' + '**********************\n' + '\n' + ' return_stmt ::= "return" [expression_list]\n' + '\n' + '"return" may only occur syntactically nested in a function ' + 'definition,\n' + 'not within a nested class definition.\n' + '\n' + 'If an expression list is present, it is evaluated, else "None" is\n' + 'substituted.\n' + '\n' + '"return" leaves the current function call with the expression list ' + '(or\n' + '"None") as return value.\n' + '\n' + 'When "return" passes control out of a "try" statement with a ' + '"finally"\n' + 'clause, that "finally" clause is executed before really leaving ' + 'the\n' + 'function.\n' + '\n' + 'In a generator function, the "return" statement is not allowed to\n' + 'include an "expression_list". In that context, a bare "return"\n' + 'indicates that the generator is done and will cause ' + '"StopIteration" to\n' + 'be raised.\n', + 'sequence-types': '\n' + 'Emulating container types\n' + '*************************\n' + '\n' + 'The following methods can be defined to implement ' + 'container objects.\n' + 'Containers usually are sequences (such as lists or tuples) ' + 'or mappings\n' + '(like dictionaries), but can represent other containers as ' + 'well. The\n' + 'first set of methods is used either to emulate a sequence ' + 'or to\n' + 'emulate a mapping; the difference is that for a sequence, ' + 'the\n' + 'allowable keys should be the integers *k* for which "0 <= ' + 'k < N" where\n' + '*N* is the length of the sequence, or slice objects, which ' + 'define a\n' + 'range of items. (For backwards compatibility, the method\n' + '"__getslice__()" (see below) can also be defined to handle ' + 'simple, but\n' + 'not extended slices.) It is also recommended that mappings ' + 'provide the\n' + 'methods "keys()", "values()", "items()", "has_key()", ' + '"get()",\n' + '"clear()", "setdefault()", "iterkeys()", "itervalues()",\n' + '"iteritems()", "pop()", "popitem()", "copy()", and ' + '"update()" behaving\n' + "similar to those for Python's standard dictionary " + 'objects. The\n' + '"UserDict" module provides a "DictMixin" class to help ' + 'create those\n' + 'methods from a base set of "__getitem__()", ' + '"__setitem__()",\n' + '"__delitem__()", and "keys()". Mutable sequences should ' + 'provide\n' + 'methods "append()", "count()", "index()", "extend()", ' + '"insert()",\n' + '"pop()", "remove()", "reverse()" and "sort()", like Python ' + 'standard\n' + 'list objects. Finally, sequence types should implement ' + 'addition\n' + '(meaning concatenation) and multiplication (meaning ' + 'repetition) by\n' + 'defining the methods "__add__()", "__radd__()", ' + '"__iadd__()",\n' + '"__mul__()", "__rmul__()" and "__imul__()" described ' + 'below; they\n' + 'should not define "__coerce__()" or other numerical ' + 'operators. It is\n' + 'recommended that both mappings and sequences implement ' + 'the\n' + '"__contains__()" method to allow efficient use of the "in" ' + 'operator;\n' + 'for mappings, "in" should be equivalent of "has_key()"; ' + 'for sequences,\n' + 'it should search through the values. It is further ' + 'recommended that\n' + 'both mappings and sequences implement the "__iter__()" ' + 'method to allow\n' + 'efficient iteration through the container; for mappings, ' + '"__iter__()"\n' + 'should be the same as "iterkeys()"; for sequences, it ' + 'should iterate\n' + 'through the values.\n' + '\n' + 'object.__len__(self)\n' + '\n' + ' Called to implement the built-in function "len()". ' + 'Should return\n' + ' the length of the object, an integer ">=" 0. Also, an ' + 'object that\n' + ' doesn\'t define a "__nonzero__()" method and whose ' + '"__len__()"\n' + ' method returns zero is considered to be false in a ' + 'Boolean context.\n' + '\n' + 'object.__getitem__(self, key)\n' + '\n' + ' Called to implement evaluation of "self[key]". For ' + 'sequence types,\n' + ' the accepted keys should be integers and slice ' + 'objects. Note that\n' + ' the special interpretation of negative indexes (if the ' + 'class wishes\n' + ' to emulate a sequence type) is up to the ' + '"__getitem__()" method. If\n' + ' *key* is of an inappropriate type, "TypeError" may be ' + 'raised; if of\n' + ' a value outside the set of indexes for the sequence ' + '(after any\n' + ' special interpretation of negative values), ' + '"IndexError" should be\n' + ' raised. For mapping types, if *key* is missing (not in ' + 'the\n' + ' container), "KeyError" should be raised.\n' + '\n' + ' Note: "for" loops expect that an "IndexError" will be ' + 'raised for\n' + ' illegal indexes to allow proper detection of the end ' + 'of the\n' + ' sequence.\n' + '\n' + 'object.__missing__(self, key)\n' + '\n' + ' Called by "dict"."__getitem__()" to implement ' + '"self[key]" for dict\n' + ' subclasses when key is not in the dictionary.\n' + '\n' + 'object.__setitem__(self, key, value)\n' + '\n' + ' Called to implement assignment to "self[key]". Same ' + 'note as for\n' + ' "__getitem__()". This should only be implemented for ' + 'mappings if\n' + ' the objects support changes to the values for keys, or ' + 'if new keys\n' + ' can be added, or for sequences if elements can be ' + 'replaced. The\n' + ' same exceptions should be raised for improper *key* ' + 'values as for\n' + ' the "__getitem__()" method.\n' + '\n' + 'object.__delitem__(self, key)\n' + '\n' + ' Called to implement deletion of "self[key]". Same note ' + 'as for\n' + ' "__getitem__()". This should only be implemented for ' + 'mappings if\n' + ' the objects support removal of keys, or for sequences ' + 'if elements\n' + ' can be removed from the sequence. The same exceptions ' + 'should be\n' + ' raised for improper *key* values as for the ' + '"__getitem__()" method.\n' + '\n' + 'object.__iter__(self)\n' + '\n' + ' This method is called when an iterator is required for ' + 'a container.\n' + ' This method should return a new iterator object that ' + 'can iterate\n' + ' over all the objects in the container. For mappings, ' + 'it should\n' + ' iterate over the keys of the container, and should also ' + 'be made\n' + ' available as the method "iterkeys()".\n' + '\n' + ' Iterator objects also need to implement this method; ' + 'they are\n' + ' required to return themselves. For more information on ' + 'iterator\n' + ' objects, see Iterator Types.\n' + '\n' + 'object.__reversed__(self)\n' + '\n' + ' Called (if present) by the "reversed()" built-in to ' + 'implement\n' + ' reverse iteration. It should return a new iterator ' + 'object that\n' + ' iterates over all the objects in the container in ' + 'reverse order.\n' + '\n' + ' If the "__reversed__()" method is not provided, the ' + '"reversed()"\n' + ' built-in will fall back to using the sequence protocol ' + '("__len__()"\n' + ' and "__getitem__()"). Objects that support the ' + 'sequence protocol\n' + ' should only provide "__reversed__()" if they can ' + 'provide an\n' + ' implementation that is more efficient than the one ' + 'provided by\n' + ' "reversed()".\n' + '\n' + ' New in version 2.6.\n' + '\n' + 'The membership test operators ("in" and "not in") are ' + 'normally\n' + 'implemented as an iteration through a sequence. However, ' + 'container\n' + 'objects can supply the following special method with a ' + 'more efficient\n' + 'implementation, which also does not require the object be ' + 'a sequence.\n' + '\n' + 'object.__contains__(self, item)\n' + '\n' + ' Called to implement membership test operators. Should ' + 'return true\n' + ' if *item* is in *self*, false otherwise. For mapping ' + 'objects, this\n' + ' should consider the keys of the mapping rather than the ' + 'values or\n' + ' the key-item pairs.\n' + '\n' + ' For objects that don\'t define "__contains__()", the ' + 'membership test\n' + ' first tries iteration via "__iter__()", then the old ' + 'sequence\n' + ' iteration protocol via "__getitem__()", see this ' + 'section in the\n' + ' language reference.\n', + 'shifting': '\n' + 'Shifting operations\n' + '*******************\n' + '\n' + 'The shifting operations have lower priority than the arithmetic\n' + 'operations:\n' + '\n' + ' shift_expr ::= a_expr | shift_expr ( "<<" | ">>" ) a_expr\n' + '\n' + 'These operators accept plain or long integers as arguments. ' + 'The\n' + 'arguments are converted to a common type. They shift the first\n' + 'argument to the left or right by the number of bits given by ' + 'the\n' + 'second argument.\n' + '\n' + 'A right shift by *n* bits is defined as division by "pow(2, ' + 'n)". A\n' + 'left shift by *n* bits is defined as multiplication with "pow(2, ' + 'n)".\n' + 'Negative shift counts raise a "ValueError" exception.\n' + '\n' + 'Note: In the current implementation, the right-hand operand is\n' + ' required to be at most "sys.maxsize". If the right-hand ' + 'operand is\n' + ' larger than "sys.maxsize" an "OverflowError" exception is ' + 'raised.\n', + 'slicings': '\n' + 'Slicings\n' + '********\n' + '\n' + 'A slicing selects a range of items in a sequence object (e.g., ' + 'a\n' + 'string, tuple or list). Slicings may be used as expressions or ' + 'as\n' + 'targets in assignment or "del" statements. The syntax for a ' + 'slicing:\n' + '\n' + ' slicing ::= simple_slicing | extended_slicing\n' + ' simple_slicing ::= primary "[" short_slice "]"\n' + ' extended_slicing ::= primary "[" slice_list "]"\n' + ' slice_list ::= slice_item ("," slice_item)* [","]\n' + ' slice_item ::= expression | proper_slice | ellipsis\n' + ' proper_slice ::= short_slice | long_slice\n' + ' short_slice ::= [lower_bound] ":" [upper_bound]\n' + ' long_slice ::= short_slice ":" [stride]\n' + ' lower_bound ::= expression\n' + ' upper_bound ::= expression\n' + ' stride ::= expression\n' + ' ellipsis ::= "..."\n' + '\n' + 'There is ambiguity in the formal syntax here: anything that ' + 'looks like\n' + 'an expression list also looks like a slice list, so any ' + 'subscription\n' + 'can be interpreted as a slicing. Rather than further ' + 'complicating the\n' + 'syntax, this is disambiguated by defining that in this case the\n' + 'interpretation as a subscription takes priority over the\n' + 'interpretation as a slicing (this is the case if the slice list\n' + 'contains no proper slice nor ellipses). Similarly, when the ' + 'slice\n' + 'list has exactly one short slice and no trailing comma, the\n' + 'interpretation as a simple slicing takes priority over that as ' + 'an\n' + 'extended slicing.\n' + '\n' + 'The semantics for a simple slicing are as follows. The primary ' + 'must\n' + 'evaluate to a sequence object. The lower and upper bound ' + 'expressions,\n' + 'if present, must evaluate to plain integers; defaults are zero ' + 'and the\n' + '"sys.maxint", respectively. If either bound is negative, the\n' + "sequence's length is added to it. The slicing now selects all " + 'items\n' + 'with index *k* such that "i <= k < j" where *i* and *j* are the\n' + 'specified lower and upper bounds. This may be an empty ' + 'sequence. It\n' + 'is not an error if *i* or *j* lie outside the range of valid ' + 'indexes\n' + "(such items don't exist so they aren't selected).\n" + '\n' + 'The semantics for an extended slicing are as follows. The ' + 'primary\n' + 'must evaluate to a mapping object, and it is indexed with a key ' + 'that\n' + 'is constructed from the slice list, as follows. If the slice ' + 'list\n' + 'contains at least one comma, the key is a tuple containing the\n' + 'conversion of the slice items; otherwise, the conversion of the ' + 'lone\n' + 'slice item is the key. The conversion of a slice item that is ' + 'an\n' + 'expression is that expression. The conversion of an ellipsis ' + 'slice\n' + 'item is the built-in "Ellipsis" object. The conversion of a ' + 'proper\n' + 'slice is a slice object (see section The standard type ' + 'hierarchy)\n' + 'whose "start", "stop" and "step" attributes are the values of ' + 'the\n' + 'expressions given as lower bound, upper bound and stride,\n' + 'respectively, substituting "None" for missing expressions.\n', + 'specialattrs': '\n' + 'Special Attributes\n' + '******************\n' + '\n' + 'The implementation adds a few special read-only attributes ' + 'to several\n' + 'object types, where they are relevant. Some of these are ' + 'not reported\n' + 'by the "dir()" built-in function.\n' + '\n' + 'object.__dict__\n' + '\n' + ' A dictionary or other mapping object used to store an ' + "object's\n" + ' (writable) attributes.\n' + '\n' + 'object.__methods__\n' + '\n' + ' Deprecated since version 2.2: Use the built-in function ' + '"dir()" to\n' + " get a list of an object's attributes. This attribute is " + 'no longer\n' + ' available.\n' + '\n' + 'object.__members__\n' + '\n' + ' Deprecated since version 2.2: Use the built-in function ' + '"dir()" to\n' + " get a list of an object's attributes. This attribute is " + 'no longer\n' + ' available.\n' + '\n' + 'instance.__class__\n' + '\n' + ' The class to which a class instance belongs.\n' + '\n' + 'class.__bases__\n' + '\n' + ' The tuple of base classes of a class object.\n' + '\n' + 'class.__name__\n' + '\n' + ' The name of the class or type.\n' + '\n' + 'The following attributes are only supported by *new-style ' + 'class*es.\n' + '\n' + 'class.__mro__\n' + '\n' + ' This attribute is a tuple of classes that are considered ' + 'when\n' + ' looking for base classes during method resolution.\n' + '\n' + 'class.mro()\n' + '\n' + ' This method can be overridden by a metaclass to customize ' + 'the\n' + ' method resolution order for its instances. It is called ' + 'at class\n' + ' instantiation, and its result is stored in "__mro__".\n' + '\n' + 'class.__subclasses__()\n' + '\n' + ' Each new-style class keeps a list of weak references to ' + 'its\n' + ' immediate subclasses. This method returns a list of all ' + 'those\n' + ' references still alive. Example:\n' + '\n' + ' >>> int.__subclasses__()\n' + " []\n" + '\n' + '-[ Footnotes ]-\n' + '\n' + '[1] Additional information on these special methods may be ' + 'found\n' + ' in the Python Reference Manual (Basic customization).\n' + '\n' + '[2] As a consequence, the list "[1, 2]" is considered equal ' + 'to\n' + ' "[1.0, 2.0]", and similarly for tuples.\n' + '\n' + "[3] They must have since the parser can't tell the type of " + 'the\n' + ' operands.\n' + '\n' + '[4] Cased characters are those with general category ' + 'property\n' + ' being one of "Lu" (Letter, uppercase), "Ll" (Letter, ' + 'lowercase),\n' + ' or "Lt" (Letter, titlecase).\n' + '\n' + '[5] To format only a tuple you should therefore provide a\n' + ' singleton tuple whose only element is the tuple to be ' + 'formatted.\n' + '\n' + '[6] The advantage of leaving the newline on is that ' + 'returning an\n' + ' empty string is then an unambiguous EOF indication. It ' + 'is also\n' + ' possible (in cases where it might matter, for example, ' + 'if you want\n' + ' to make an exact copy of a file while scanning its ' + 'lines) to tell\n' + ' whether the last line of a file ended in a newline or ' + 'not (yes\n' + ' this happens!).\n', + 'specialnames': '\n' + 'Special method names\n' + '********************\n' + '\n' + 'A class can implement certain operations that are invoked by ' + 'special\n' + 'syntax (such as arithmetic operations or subscripting and ' + 'slicing) by\n' + "defining methods with special names. This is Python's " + 'approach to\n' + '*operator overloading*, allowing classes to define their own ' + 'behavior\n' + 'with respect to language operators. For instance, if a ' + 'class defines\n' + 'a method named "__getitem__()", and "x" is an instance of ' + 'this class,\n' + 'then "x[i]" is roughly equivalent to "x.__getitem__(i)" for ' + 'old-style\n' + 'classes and "type(x).__getitem__(x, i)" for new-style ' + 'classes. Except\n' + 'where mentioned, attempts to execute an operation raise an ' + 'exception\n' + 'when no appropriate method is defined (typically ' + '"AttributeError" or\n' + '"TypeError").\n' + '\n' + 'When implementing a class that emulates any built-in type, ' + 'it is\n' + 'important that the emulation only be implemented to the ' + 'degree that it\n' + 'makes sense for the object being modelled. For example, ' + 'some\n' + 'sequences may work well with retrieval of individual ' + 'elements, but\n' + 'extracting a slice may not make sense. (One example of this ' + 'is the\n' + '"NodeList" interface in the W3C\'s Document Object Model.)\n' + '\n' + '\n' + 'Basic customization\n' + '===================\n' + '\n' + 'object.__new__(cls[, ...])\n' + '\n' + ' Called to create a new instance of class *cls*. ' + '"__new__()" is a\n' + ' static method (special-cased so you need not declare it ' + 'as such)\n' + ' that takes the class of which an instance was requested ' + 'as its\n' + ' first argument. The remaining arguments are those passed ' + 'to the\n' + ' object constructor expression (the call to the class). ' + 'The return\n' + ' value of "__new__()" should be the new object instance ' + '(usually an\n' + ' instance of *cls*).\n' + '\n' + ' Typical implementations create a new instance of the ' + 'class by\n' + ' invoking the superclass\'s "__new__()" method using\n' + ' "super(currentclass, cls).__new__(cls[, ...])" with ' + 'appropriate\n' + ' arguments and then modifying the newly-created instance ' + 'as\n' + ' necessary before returning it.\n' + '\n' + ' If "__new__()" returns an instance of *cls*, then the ' + 'new\n' + ' instance\'s "__init__()" method will be invoked like\n' + ' "__init__(self[, ...])", where *self* is the new instance ' + 'and the\n' + ' remaining arguments are the same as were passed to ' + '"__new__()".\n' + '\n' + ' If "__new__()" does not return an instance of *cls*, then ' + 'the new\n' + ' instance\'s "__init__()" method will not be invoked.\n' + '\n' + ' "__new__()" is intended mainly to allow subclasses of ' + 'immutable\n' + ' types (like int, str, or tuple) to customize instance ' + 'creation. It\n' + ' is also commonly overridden in custom metaclasses in ' + 'order to\n' + ' customize class creation.\n' + '\n' + 'object.__init__(self[, ...])\n' + '\n' + ' Called after the instance has been created (by ' + '"__new__()"), but\n' + ' before it is returned to the caller. The arguments are ' + 'those\n' + ' passed to the class constructor expression. If a base ' + 'class has an\n' + ' "__init__()" method, the derived class\'s "__init__()" ' + 'method, if\n' + ' any, must explicitly call it to ensure proper ' + 'initialization of the\n' + ' base class part of the instance; for example:\n' + ' "BaseClass.__init__(self, [args...])".\n' + '\n' + ' Because "__new__()" and "__init__()" work together in ' + 'constructing\n' + ' objects ("__new__()" to create it, and "__init__()" to ' + 'customise\n' + ' it), no non-"None" value may be returned by "__init__()"; ' + 'doing so\n' + ' will cause a "TypeError" to be raised at runtime.\n' + '\n' + 'object.__del__(self)\n' + '\n' + ' Called when the instance is about to be destroyed. This ' + 'is also\n' + ' called a destructor. If a base class has a "__del__()" ' + 'method, the\n' + ' derived class\'s "__del__()" method, if any, must ' + 'explicitly call it\n' + ' to ensure proper deletion of the base class part of the ' + 'instance.\n' + ' Note that it is possible (though not recommended!) for ' + 'the\n' + ' "__del__()" method to postpone destruction of the ' + 'instance by\n' + ' creating a new reference to it. It may then be called at ' + 'a later\n' + ' time when this new reference is deleted. It is not ' + 'guaranteed that\n' + ' "__del__()" methods are called for objects that still ' + 'exist when\n' + ' the interpreter exits.\n' + '\n' + ' Note: "del x" doesn\'t directly call "x.__del__()" --- ' + 'the former\n' + ' decrements the reference count for "x" by one, and the ' + 'latter is\n' + ' only called when "x"\'s reference count reaches zero. ' + 'Some common\n' + ' situations that may prevent the reference count of an ' + 'object from\n' + ' going to zero include: circular references between ' + 'objects (e.g.,\n' + ' a doubly-linked list or a tree data structure with ' + 'parent and\n' + ' child pointers); a reference to the object on the stack ' + 'frame of\n' + ' a function that caught an exception (the traceback ' + 'stored in\n' + ' "sys.exc_traceback" keeps the stack frame alive); or a ' + 'reference\n' + ' to the object on the stack frame that raised an ' + 'unhandled\n' + ' exception in interactive mode (the traceback stored in\n' + ' "sys.last_traceback" keeps the stack frame alive). The ' + 'first\n' + ' situation can only be remedied by explicitly breaking ' + 'the cycles;\n' + ' the latter two situations can be resolved by storing ' + '"None" in\n' + ' "sys.exc_traceback" or "sys.last_traceback". Circular ' + 'references\n' + ' which are garbage are detected when the option cycle ' + 'detector is\n' + " enabled (it's on by default), but can only be cleaned " + 'up if there\n' + ' are no Python-level "__del__()" methods involved. Refer ' + 'to the\n' + ' documentation for the "gc" module for more information ' + 'about how\n' + ' "__del__()" methods are handled by the cycle detector,\n' + ' particularly the description of the "garbage" value.\n' + '\n' + ' Warning: Due to the precarious circumstances under which\n' + ' "__del__()" methods are invoked, exceptions that occur ' + 'during\n' + ' their execution are ignored, and a warning is printed ' + 'to\n' + ' "sys.stderr" instead. Also, when "__del__()" is invoked ' + 'in\n' + ' response to a module being deleted (e.g., when ' + 'execution of the\n' + ' program is done), other globals referenced by the ' + '"__del__()"\n' + ' method may already have been deleted or in the process ' + 'of being\n' + ' torn down (e.g. the import machinery shutting down). ' + 'For this\n' + ' reason, "__del__()" methods should do the absolute ' + 'minimum needed\n' + ' to maintain external invariants. Starting with version ' + '1.5,\n' + ' Python guarantees that globals whose name begins with a ' + 'single\n' + ' underscore are deleted from their module before other ' + 'globals are\n' + ' deleted; if no other references to such globals exist, ' + 'this may\n' + ' help in assuring that imported modules are still ' + 'available at the\n' + ' time when the "__del__()" method is called.\n' + '\n' + ' See also the "-R" command-line option.\n' + '\n' + 'object.__repr__(self)\n' + '\n' + ' Called by the "repr()" built-in function and by string ' + 'conversions\n' + ' (reverse quotes) to compute the "official" string ' + 'representation of\n' + ' an object. If at all possible, this should look like a ' + 'valid\n' + ' Python expression that could be used to recreate an ' + 'object with the\n' + ' same value (given an appropriate environment). If this ' + 'is not\n' + ' possible, a string of the form "<...some useful ' + 'description...>"\n' + ' should be returned. The return value must be a string ' + 'object. If a\n' + ' class defines "__repr__()" but not "__str__()", then ' + '"__repr__()"\n' + ' is also used when an "informal" string representation of ' + 'instances\n' + ' of that class is required.\n' + '\n' + ' This is typically used for debugging, so it is important ' + 'that the\n' + ' representation is information-rich and unambiguous.\n' + '\n' + 'object.__str__(self)\n' + '\n' + ' Called by the "str()" built-in function and by the ' + '"print"\n' + ' statement to compute the "informal" string representation ' + 'of an\n' + ' object. This differs from "__repr__()" in that it does ' + 'not have to\n' + ' be a valid Python expression: a more convenient or ' + 'concise\n' + ' representation may be used instead. The return value must ' + 'be a\n' + ' string object.\n' + '\n' + 'object.__lt__(self, other)\n' + 'object.__le__(self, other)\n' + 'object.__eq__(self, other)\n' + 'object.__ne__(self, other)\n' + 'object.__gt__(self, other)\n' + 'object.__ge__(self, other)\n' + '\n' + ' New in version 2.1.\n' + '\n' + ' These are the so-called "rich comparison" methods, and ' + 'are called\n' + ' for comparison operators in preference to "__cmp__()" ' + 'below. The\n' + ' correspondence between operator symbols and method names ' + 'is as\n' + ' follows: "xy" call ' + '"x.__ne__(y)",\n' + ' "x>y" calls "x.__gt__(y)", and "x>=y" calls ' + '"x.__ge__(y)".\n' + '\n' + ' A rich comparison method may return the singleton ' + '"NotImplemented"\n' + ' if it does not implement the operation for a given pair ' + 'of\n' + ' arguments. By convention, "False" and "True" are returned ' + 'for a\n' + ' successful comparison. However, these methods can return ' + 'any value,\n' + ' so if the comparison operator is used in a Boolean ' + 'context (e.g.,\n' + ' in the condition of an "if" statement), Python will call ' + '"bool()"\n' + ' on the value to determine if the result is true or ' + 'false.\n' + '\n' + ' There are no implied relationships among the comparison ' + 'operators.\n' + ' The truth of "x==y" does not imply that "x!=y" is false.\n' + ' Accordingly, when defining "__eq__()", one should also ' + 'define\n' + ' "__ne__()" so that the operators will behave as ' + 'expected. See the\n' + ' paragraph on "__hash__()" for some important notes on ' + 'creating\n' + ' *hashable* objects which support custom comparison ' + 'operations and\n' + ' are usable as dictionary keys.\n' + '\n' + ' There are no swapped-argument versions of these methods ' + '(to be used\n' + ' when the left argument does not support the operation but ' + 'the right\n' + ' argument does); rather, "__lt__()" and "__gt__()" are ' + "each other's\n" + ' reflection, "__le__()" and "__ge__()" are each other\'s ' + 'reflection,\n' + ' and "__eq__()" and "__ne__()" are their own reflection.\n' + '\n' + ' Arguments to rich comparison methods are never coerced.\n' + '\n' + ' To automatically generate ordering operations from a ' + 'single root\n' + ' operation, see "functools.total_ordering()".\n' + '\n' + 'object.__cmp__(self, other)\n' + '\n' + ' Called by comparison operations if rich comparison (see ' + 'above) is\n' + ' not defined. Should return a negative integer if "self < ' + 'other",\n' + ' zero if "self == other", a positive integer if "self > ' + 'other". If\n' + ' no "__cmp__()", "__eq__()" or "__ne__()" operation is ' + 'defined,\n' + ' class instances are compared by object identity ' + '("address"). See\n' + ' also the description of "__hash__()" for some important ' + 'notes on\n' + ' creating *hashable* objects which support custom ' + 'comparison\n' + ' operations and are usable as dictionary keys. (Note: the\n' + ' restriction that exceptions are not propagated by ' + '"__cmp__()" has\n' + ' been removed since Python 1.5.)\n' + '\n' + 'object.__rcmp__(self, other)\n' + '\n' + ' Changed in version 2.1: No longer supported.\n' + '\n' + 'object.__hash__(self)\n' + '\n' + ' Called by built-in function "hash()" and for operations ' + 'on members\n' + ' of hashed collections including "set", "frozenset", and ' + '"dict".\n' + ' "__hash__()" should return an integer. The only required ' + 'property\n' + ' is that objects which compare equal have the same hash ' + 'value; it is\n' + ' advised to somehow mix together (e.g. using exclusive or) ' + 'the hash\n' + ' values for the components of the object that also play a ' + 'part in\n' + ' comparison of objects.\n' + '\n' + ' If a class does not define a "__cmp__()" or "__eq__()" ' + 'method it\n' + ' should not define a "__hash__()" operation either; if it ' + 'defines\n' + ' "__cmp__()" or "__eq__()" but not "__hash__()", its ' + 'instances will\n' + ' not be usable in hashed collections. If a class defines ' + 'mutable\n' + ' objects and implements a "__cmp__()" or "__eq__()" ' + 'method, it\n' + ' should not implement "__hash__()", since hashable ' + 'collection\n' + " implementations require that a object's hash value is " + 'immutable (if\n' + " the object's hash value changes, it will be in the wrong " + 'hash\n' + ' bucket).\n' + '\n' + ' User-defined classes have "__cmp__()" and "__hash__()" ' + 'methods by\n' + ' default; with them, all objects compare unequal (except ' + 'with\n' + ' themselves) and "x.__hash__()" returns a result derived ' + 'from\n' + ' "id(x)".\n' + '\n' + ' Classes which inherit a "__hash__()" method from a parent ' + 'class but\n' + ' change the meaning of "__cmp__()" or "__eq__()" such that ' + 'the hash\n' + ' value returned is no longer appropriate (e.g. by ' + 'switching to a\n' + ' value-based concept of equality instead of the default ' + 'identity\n' + ' based equality) can explicitly flag themselves as being ' + 'unhashable\n' + ' by setting "__hash__ = None" in the class definition. ' + 'Doing so\n' + ' means that not only will instances of the class raise an\n' + ' appropriate "TypeError" when a program attempts to ' + 'retrieve their\n' + ' hash value, but they will also be correctly identified ' + 'as\n' + ' unhashable when checking "isinstance(obj, ' + 'collections.Hashable)"\n' + ' (unlike classes which define their own "__hash__()" to ' + 'explicitly\n' + ' raise "TypeError").\n' + '\n' + ' Changed in version 2.5: "__hash__()" may now also return ' + 'a long\n' + ' integer object; the 32-bit integer is then derived from ' + 'the hash of\n' + ' that object.\n' + '\n' + ' Changed in version 2.6: "__hash__" may now be set to ' + '"None" to\n' + ' explicitly flag instances of a class as unhashable.\n' + '\n' + 'object.__nonzero__(self)\n' + '\n' + ' Called to implement truth value testing and the built-in ' + 'operation\n' + ' "bool()"; should return "False" or "True", or their ' + 'integer\n' + ' equivalents "0" or "1". When this method is not ' + 'defined,\n' + ' "__len__()" is called, if it is defined, and the object ' + 'is\n' + ' considered true if its result is nonzero. If a class ' + 'defines\n' + ' neither "__len__()" nor "__nonzero__()", all its ' + 'instances are\n' + ' considered true.\n' + '\n' + 'object.__unicode__(self)\n' + '\n' + ' Called to implement "unicode()" built-in; should return a ' + 'Unicode\n' + ' object. When this method is not defined, string ' + 'conversion is\n' + ' attempted, and the result of string conversion is ' + 'converted to\n' + ' Unicode using the system default encoding.\n' + '\n' + '\n' + 'Customizing attribute access\n' + '============================\n' + '\n' + 'The following methods can be defined to customize the ' + 'meaning of\n' + 'attribute access (use of, assignment to, or deletion of ' + '"x.name") for\n' + 'class instances.\n' + '\n' + 'object.__getattr__(self, name)\n' + '\n' + ' Called when an attribute lookup has not found the ' + 'attribute in the\n' + ' usual places (i.e. it is not an instance attribute nor is ' + 'it found\n' + ' in the class tree for "self"). "name" is the attribute ' + 'name. This\n' + ' method should return the (computed) attribute value or ' + 'raise an\n' + ' "AttributeError" exception.\n' + '\n' + ' Note that if the attribute is found through the normal ' + 'mechanism,\n' + ' "__getattr__()" is not called. (This is an intentional ' + 'asymmetry\n' + ' between "__getattr__()" and "__setattr__()".) This is ' + 'done both for\n' + ' efficiency reasons and because otherwise "__getattr__()" ' + 'would have\n' + ' no way to access other attributes of the instance. Note ' + 'that at\n' + ' least for instance variables, you can fake total control ' + 'by not\n' + ' inserting any values in the instance attribute dictionary ' + '(but\n' + ' instead inserting them in another object). See the\n' + ' "__getattribute__()" method below for a way to actually ' + 'get total\n' + ' control in new-style classes.\n' + '\n' + 'object.__setattr__(self, name, value)\n' + '\n' + ' Called when an attribute assignment is attempted. This ' + 'is called\n' + ' instead of the normal mechanism (i.e. store the value in ' + 'the\n' + ' instance dictionary). *name* is the attribute name, ' + '*value* is the\n' + ' value to be assigned to it.\n' + '\n' + ' If "__setattr__()" wants to assign to an instance ' + 'attribute, it\n' + ' should not simply execute "self.name = value" --- this ' + 'would cause\n' + ' a recursive call to itself. Instead, it should insert ' + 'the value in\n' + ' the dictionary of instance attributes, e.g., ' + '"self.__dict__[name] =\n' + ' value". For new-style classes, rather than accessing the ' + 'instance\n' + ' dictionary, it should call the base class method with the ' + 'same\n' + ' name, for example, "object.__setattr__(self, name, ' + 'value)".\n' + '\n' + 'object.__delattr__(self, name)\n' + '\n' + ' Like "__setattr__()" but for attribute deletion instead ' + 'of\n' + ' assignment. This should only be implemented if "del ' + 'obj.name" is\n' + ' meaningful for the object.\n' + '\n' + '\n' + 'More attribute access for new-style classes\n' + '-------------------------------------------\n' + '\n' + 'The following methods only apply to new-style classes.\n' + '\n' + 'object.__getattribute__(self, name)\n' + '\n' + ' Called unconditionally to implement attribute accesses ' + 'for\n' + ' instances of the class. If the class also defines ' + '"__getattr__()",\n' + ' the latter will not be called unless "__getattribute__()" ' + 'either\n' + ' calls it explicitly or raises an "AttributeError". This ' + 'method\n' + ' should return the (computed) attribute value or raise an\n' + ' "AttributeError" exception. In order to avoid infinite ' + 'recursion in\n' + ' this method, its implementation should always call the ' + 'base class\n' + ' method with the same name to access any attributes it ' + 'needs, for\n' + ' example, "object.__getattribute__(self, name)".\n' + '\n' + ' Note: This method may still be bypassed when looking up ' + 'special\n' + ' methods as the result of implicit invocation via ' + 'language syntax\n' + ' or built-in functions. See Special method lookup for ' + 'new-style\n' + ' classes.\n' + '\n' + '\n' + 'Implementing Descriptors\n' + '------------------------\n' + '\n' + 'The following methods only apply when an instance of the ' + 'class\n' + 'containing the method (a so-called *descriptor* class) ' + 'appears in an\n' + "*owner* class (the descriptor must be in either the owner's " + 'class\n' + 'dictionary or in the class dictionary for one of its ' + 'parents). In the\n' + 'examples below, "the attribute" refers to the attribute ' + 'whose name is\n' + 'the key of the property in the owner class\' "__dict__".\n' + '\n' + 'object.__get__(self, instance, owner)\n' + '\n' + ' Called to get the attribute of the owner class (class ' + 'attribute\n' + ' access) or of an instance of that class (instance ' + 'attribute\n' + ' access). *owner* is always the owner class, while ' + '*instance* is the\n' + ' instance that the attribute was accessed through, or ' + '"None" when\n' + ' the attribute is accessed through the *owner*. This ' + 'method should\n' + ' return the (computed) attribute value or raise an ' + '"AttributeError"\n' + ' exception.\n' + '\n' + 'object.__set__(self, instance, value)\n' + '\n' + ' Called to set the attribute on an instance *instance* of ' + 'the owner\n' + ' class to a new value, *value*.\n' + '\n' + 'object.__delete__(self, instance)\n' + '\n' + ' Called to delete the attribute on an instance *instance* ' + 'of the\n' + ' owner class.\n' + '\n' + '\n' + 'Invoking Descriptors\n' + '--------------------\n' + '\n' + 'In general, a descriptor is an object attribute with ' + '"binding\n' + 'behavior", one whose attribute access has been overridden by ' + 'methods\n' + 'in the descriptor protocol: "__get__()", "__set__()", and\n' + '"__delete__()". If any of those methods are defined for an ' + 'object, it\n' + 'is said to be a descriptor.\n' + '\n' + 'The default behavior for attribute access is to get, set, or ' + 'delete\n' + "the attribute from an object's dictionary. For instance, " + '"a.x" has a\n' + 'lookup chain starting with "a.__dict__[\'x\']", then\n' + '"type(a).__dict__[\'x\']", and continuing through the base ' + 'classes of\n' + '"type(a)" excluding metaclasses.\n' + '\n' + 'However, if the looked-up value is an object defining one of ' + 'the\n' + 'descriptor methods, then Python may override the default ' + 'behavior and\n' + 'invoke the descriptor method instead. Where this occurs in ' + 'the\n' + 'precedence chain depends on which descriptor methods were ' + 'defined and\n' + 'how they were called. Note that descriptors are only ' + 'invoked for new\n' + 'style objects or classes (ones that subclass "object()" or ' + '"type()").\n' + '\n' + 'The starting point for descriptor invocation is a binding, ' + '"a.x". How\n' + 'the arguments are assembled depends on "a":\n' + '\n' + 'Direct Call\n' + ' The simplest and least common call is when user code ' + 'directly\n' + ' invokes a descriptor method: "x.__get__(a)".\n' + '\n' + 'Instance Binding\n' + ' If binding to a new-style object instance, "a.x" is ' + 'transformed\n' + ' into the call: "type(a).__dict__[\'x\'].__get__(a, ' + 'type(a))".\n' + '\n' + 'Class Binding\n' + ' If binding to a new-style class, "A.x" is transformed ' + 'into the\n' + ' call: "A.__dict__[\'x\'].__get__(None, A)".\n' + '\n' + 'Super Binding\n' + ' If "a" is an instance of "super", then the binding ' + '"super(B,\n' + ' obj).m()" searches "obj.__class__.__mro__" for the base ' + 'class "A"\n' + ' immediately preceding "B" and then invokes the descriptor ' + 'with the\n' + ' call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n' + '\n' + 'For instance bindings, the precedence of descriptor ' + 'invocation depends\n' + 'on the which descriptor methods are defined. A descriptor ' + 'can define\n' + 'any combination of "__get__()", "__set__()" and ' + '"__delete__()". If it\n' + 'does not define "__get__()", then accessing the attribute ' + 'will return\n' + 'the descriptor object itself unless there is a value in the ' + "object's\n" + 'instance dictionary. If the descriptor defines "__set__()" ' + 'and/or\n' + '"__delete__()", it is a data descriptor; if it defines ' + 'neither, it is\n' + 'a non-data descriptor. Normally, data descriptors define ' + 'both\n' + '"__get__()" and "__set__()", while non-data descriptors have ' + 'just the\n' + '"__get__()" method. Data descriptors with "__set__()" and ' + '"__get__()"\n' + 'defined always override a redefinition in an instance ' + 'dictionary. In\n' + 'contrast, non-data descriptors can be overridden by ' + 'instances.\n' + '\n' + 'Python methods (including "staticmethod()" and ' + '"classmethod()") are\n' + 'implemented as non-data descriptors. Accordingly, instances ' + 'can\n' + 'redefine and override methods. This allows individual ' + 'instances to\n' + 'acquire behaviors that differ from other instances of the ' + 'same class.\n' + '\n' + 'The "property()" function is implemented as a data ' + 'descriptor.\n' + 'Accordingly, instances cannot override the behavior of a ' + 'property.\n' + '\n' + '\n' + '__slots__\n' + '---------\n' + '\n' + 'By default, instances of both old and new-style classes have ' + 'a\n' + 'dictionary for attribute storage. This wastes space for ' + 'objects\n' + 'having very few instance variables. The space consumption ' + 'can become\n' + 'acute when creating large numbers of instances.\n' + '\n' + 'The default can be overridden by defining *__slots__* in a ' + 'new-style\n' + 'class definition. The *__slots__* declaration takes a ' + 'sequence of\n' + 'instance variables and reserves just enough space in each ' + 'instance to\n' + 'hold a value for each variable. Space is saved because ' + '*__dict__* is\n' + 'not created for each instance.\n' + '\n' + '__slots__\n' + '\n' + ' This class variable can be assigned a string, iterable, ' + 'or sequence\n' + ' of strings with variable names used by instances. If ' + 'defined in a\n' + ' new-style class, *__slots__* reserves space for the ' + 'declared\n' + ' variables and prevents the automatic creation of ' + '*__dict__* and\n' + ' *__weakref__* for each instance.\n' + '\n' + ' New in version 2.2.\n' + '\n' + 'Notes on using *__slots__*\n' + '\n' + '* When inheriting from a class without *__slots__*, the ' + '*__dict__*\n' + ' attribute of that class will always be accessible, so a ' + '*__slots__*\n' + ' definition in the subclass is meaningless.\n' + '\n' + '* Without a *__dict__* variable, instances cannot be ' + 'assigned new\n' + ' variables not listed in the *__slots__* definition. ' + 'Attempts to\n' + ' assign to an unlisted variable name raises ' + '"AttributeError". If\n' + ' dynamic assignment of new variables is desired, then add\n' + ' "\'__dict__\'" to the sequence of strings in the ' + '*__slots__*\n' + ' declaration.\n' + '\n' + ' Changed in version 2.3: Previously, adding "\'__dict__\'" ' + 'to the\n' + ' *__slots__* declaration would not enable the assignment of ' + 'new\n' + ' attributes not specifically listed in the sequence of ' + 'instance\n' + ' variable names.\n' + '\n' + '* Without a *__weakref__* variable for each instance, ' + 'classes\n' + ' defining *__slots__* do not support weak references to ' + 'its\n' + ' instances. If weak reference support is needed, then add\n' + ' "\'__weakref__\'" to the sequence of strings in the ' + '*__slots__*\n' + ' declaration.\n' + '\n' + ' Changed in version 2.3: Previously, adding ' + '"\'__weakref__\'" to the\n' + ' *__slots__* declaration would not enable support for weak\n' + ' references.\n' + '\n' + '* *__slots__* are implemented at the class level by ' + 'creating\n' + ' descriptors (Implementing Descriptors) for each variable ' + 'name. As a\n' + ' result, class attributes cannot be used to set default ' + 'values for\n' + ' instance variables defined by *__slots__*; otherwise, the ' + 'class\n' + ' attribute would overwrite the descriptor assignment.\n' + '\n' + '* The action of a *__slots__* declaration is limited to the ' + 'class\n' + ' where it is defined. As a result, subclasses will have a ' + '*__dict__*\n' + ' unless they also define *__slots__* (which must only ' + 'contain names\n' + ' of any *additional* slots).\n' + '\n' + '* If a class defines a slot also defined in a base class, ' + 'the\n' + ' instance variable defined by the base class slot is ' + 'inaccessible\n' + ' (except by retrieving its descriptor directly from the ' + 'base class).\n' + ' This renders the meaning of the program undefined. In the ' + 'future, a\n' + ' check may be added to prevent this.\n' + '\n' + '* Nonempty *__slots__* does not work for classes derived ' + 'from\n' + ' "variable-length" built-in types such as "long", "str" and ' + '"tuple".\n' + '\n' + '* Any non-string iterable may be assigned to *__slots__*. ' + 'Mappings\n' + ' may also be used; however, in the future, special meaning ' + 'may be\n' + ' assigned to the values corresponding to each key.\n' + '\n' + '* *__class__* assignment works only if both classes have the ' + 'same\n' + ' *__slots__*.\n' + '\n' + ' Changed in version 2.6: Previously, *__class__* assignment ' + 'raised an\n' + ' error if either new or old class had *__slots__*.\n' + '\n' + '\n' + 'Customizing class creation\n' + '==========================\n' + '\n' + 'By default, new-style classes are constructed using ' + '"type()". A class\n' + 'definition is read into a separate namespace and the value ' + 'of class\n' + 'name is bound to the result of "type(name, bases, dict)".\n' + '\n' + 'When the class definition is read, if *__metaclass__* is ' + 'defined then\n' + 'the callable assigned to it will be called instead of ' + '"type()". This\n' + 'allows classes or functions to be written which monitor or ' + 'alter the\n' + 'class creation process:\n' + '\n' + '* Modifying the class dictionary prior to the class being ' + 'created.\n' + '\n' + '* Returning an instance of another class -- essentially ' + 'performing\n' + ' the role of a factory function.\n' + '\n' + "These steps will have to be performed in the metaclass's " + '"__new__()"\n' + 'method -- "type.__new__()" can then be called from this ' + 'method to\n' + 'create a class with different properties. This example adds ' + 'a new\n' + 'element to the class dictionary before creating the class:\n' + '\n' + ' class metacls(type):\n' + ' def __new__(mcs, name, bases, dict):\n' + " dict['foo'] = 'metacls was here'\n" + ' return type.__new__(mcs, name, bases, dict)\n' + '\n' + 'You can of course also override other class methods (or add ' + 'new\n' + 'methods); for example defining a custom "__call__()" method ' + 'in the\n' + 'metaclass allows custom behavior when the class is called, ' + 'e.g. not\n' + 'always creating a new instance.\n' + '\n' + '__metaclass__\n' + '\n' + ' This variable can be any callable accepting arguments for ' + '"name",\n' + ' "bases", and "dict". Upon class creation, the callable ' + 'is used\n' + ' instead of the built-in "type()".\n' + '\n' + ' New in version 2.2.\n' + '\n' + 'The appropriate metaclass is determined by the following ' + 'precedence\n' + 'rules:\n' + '\n' + '* If "dict[\'__metaclass__\']" exists, it is used.\n' + '\n' + '* Otherwise, if there is at least one base class, its ' + 'metaclass is\n' + ' used (this looks for a *__class__* attribute first and if ' + 'not found,\n' + ' uses its type).\n' + '\n' + '* Otherwise, if a global variable named __metaclass__ ' + 'exists, it is\n' + ' used.\n' + '\n' + '* Otherwise, the old-style, classic metaclass ' + '(types.ClassType) is\n' + ' used.\n' + '\n' + 'The potential uses for metaclasses are boundless. Some ideas ' + 'that have\n' + 'been explored including logging, interface checking, ' + 'automatic\n' + 'delegation, automatic property creation, proxies, ' + 'frameworks, and\n' + 'automatic resource locking/synchronization.\n' + '\n' + '\n' + 'Customizing instance and subclass checks\n' + '========================================\n' + '\n' + 'New in version 2.6.\n' + '\n' + 'The following methods are used to override the default ' + 'behavior of the\n' + '"isinstance()" and "issubclass()" built-in functions.\n' + '\n' + 'In particular, the metaclass "abc.ABCMeta" implements these ' + 'methods in\n' + 'order to allow the addition of Abstract Base Classes (ABCs) ' + 'as\n' + '"virtual base classes" to any class or type (including ' + 'built-in\n' + 'types), including other ABCs.\n' + '\n' + 'class.__instancecheck__(self, instance)\n' + '\n' + ' Return true if *instance* should be considered a (direct ' + 'or\n' + ' indirect) instance of *class*. If defined, called to ' + 'implement\n' + ' "isinstance(instance, class)".\n' + '\n' + 'class.__subclasscheck__(self, subclass)\n' + '\n' + ' Return true if *subclass* should be considered a (direct ' + 'or\n' + ' indirect) subclass of *class*. If defined, called to ' + 'implement\n' + ' "issubclass(subclass, class)".\n' + '\n' + 'Note that these methods are looked up on the type ' + '(metaclass) of a\n' + 'class. They cannot be defined as class methods in the ' + 'actual class.\n' + 'This is consistent with the lookup of special methods that ' + 'are called\n' + 'on instances, only in this case the instance is itself a ' + 'class.\n' + '\n' + 'See also:\n' + '\n' + ' **PEP 3119** - Introducing Abstract Base Classes\n' + ' Includes the specification for customizing ' + '"isinstance()" and\n' + ' "issubclass()" behavior through "__instancecheck__()" ' + 'and\n' + ' "__subclasscheck__()", with motivation for this ' + 'functionality in\n' + ' the context of adding Abstract Base Classes (see the ' + '"abc"\n' + ' module) to the language.\n' + '\n' + '\n' + 'Emulating callable objects\n' + '==========================\n' + '\n' + 'object.__call__(self[, args...])\n' + '\n' + ' Called when the instance is "called" as a function; if ' + 'this method\n' + ' is defined, "x(arg1, arg2, ...)" is a shorthand for\n' + ' "x.__call__(arg1, arg2, ...)".\n' + '\n' + '\n' + 'Emulating container types\n' + '=========================\n' + '\n' + 'The following methods can be defined to implement container ' + 'objects.\n' + 'Containers usually are sequences (such as lists or tuples) ' + 'or mappings\n' + '(like dictionaries), but can represent other containers as ' + 'well. The\n' + 'first set of methods is used either to emulate a sequence or ' + 'to\n' + 'emulate a mapping; the difference is that for a sequence, ' + 'the\n' + 'allowable keys should be the integers *k* for which "0 <= k ' + '< N" where\n' + '*N* is the length of the sequence, or slice objects, which ' + 'define a\n' + 'range of items. (For backwards compatibility, the method\n' + '"__getslice__()" (see below) can also be defined to handle ' + 'simple, but\n' + 'not extended slices.) It is also recommended that mappings ' + 'provide the\n' + 'methods "keys()", "values()", "items()", "has_key()", ' + '"get()",\n' + '"clear()", "setdefault()", "iterkeys()", "itervalues()",\n' + '"iteritems()", "pop()", "popitem()", "copy()", and ' + '"update()" behaving\n' + "similar to those for Python's standard dictionary objects. " + 'The\n' + '"UserDict" module provides a "DictMixin" class to help ' + 'create those\n' + 'methods from a base set of "__getitem__()", ' + '"__setitem__()",\n' + '"__delitem__()", and "keys()". Mutable sequences should ' + 'provide\n' + 'methods "append()", "count()", "index()", "extend()", ' + '"insert()",\n' + '"pop()", "remove()", "reverse()" and "sort()", like Python ' + 'standard\n' + 'list objects. Finally, sequence types should implement ' + 'addition\n' + '(meaning concatenation) and multiplication (meaning ' + 'repetition) by\n' + 'defining the methods "__add__()", "__radd__()", ' + '"__iadd__()",\n' + '"__mul__()", "__rmul__()" and "__imul__()" described below; ' + 'they\n' + 'should not define "__coerce__()" or other numerical ' + 'operators. It is\n' + 'recommended that both mappings and sequences implement the\n' + '"__contains__()" method to allow efficient use of the "in" ' + 'operator;\n' + 'for mappings, "in" should be equivalent of "has_key()"; for ' + 'sequences,\n' + 'it should search through the values. It is further ' + 'recommended that\n' + 'both mappings and sequences implement the "__iter__()" ' + 'method to allow\n' + 'efficient iteration through the container; for mappings, ' + '"__iter__()"\n' + 'should be the same as "iterkeys()"; for sequences, it should ' + 'iterate\n' + 'through the values.\n' + '\n' + 'object.__len__(self)\n' + '\n' + ' Called to implement the built-in function "len()". ' + 'Should return\n' + ' the length of the object, an integer ">=" 0. Also, an ' + 'object that\n' + ' doesn\'t define a "__nonzero__()" method and whose ' + '"__len__()"\n' + ' method returns zero is considered to be false in a ' + 'Boolean context.\n' + '\n' + 'object.__getitem__(self, key)\n' + '\n' + ' Called to implement evaluation of "self[key]". For ' + 'sequence types,\n' + ' the accepted keys should be integers and slice objects. ' + 'Note that\n' + ' the special interpretation of negative indexes (if the ' + 'class wishes\n' + ' to emulate a sequence type) is up to the "__getitem__()" ' + 'method. If\n' + ' *key* is of an inappropriate type, "TypeError" may be ' + 'raised; if of\n' + ' a value outside the set of indexes for the sequence ' + '(after any\n' + ' special interpretation of negative values), "IndexError" ' + 'should be\n' + ' raised. For mapping types, if *key* is missing (not in ' + 'the\n' + ' container), "KeyError" should be raised.\n' + '\n' + ' Note: "for" loops expect that an "IndexError" will be ' + 'raised for\n' + ' illegal indexes to allow proper detection of the end of ' + 'the\n' + ' sequence.\n' + '\n' + 'object.__missing__(self, key)\n' + '\n' + ' Called by "dict"."__getitem__()" to implement "self[key]" ' + 'for dict\n' + ' subclasses when key is not in the dictionary.\n' + '\n' + 'object.__setitem__(self, key, value)\n' + '\n' + ' Called to implement assignment to "self[key]". Same note ' + 'as for\n' + ' "__getitem__()". This should only be implemented for ' + 'mappings if\n' + ' the objects support changes to the values for keys, or if ' + 'new keys\n' + ' can be added, or for sequences if elements can be ' + 'replaced. The\n' + ' same exceptions should be raised for improper *key* ' + 'values as for\n' + ' the "__getitem__()" method.\n' + '\n' + 'object.__delitem__(self, key)\n' + '\n' + ' Called to implement deletion of "self[key]". Same note ' + 'as for\n' + ' "__getitem__()". This should only be implemented for ' + 'mappings if\n' + ' the objects support removal of keys, or for sequences if ' + 'elements\n' + ' can be removed from the sequence. The same exceptions ' + 'should be\n' + ' raised for improper *key* values as for the ' + '"__getitem__()" method.\n' + '\n' + 'object.__iter__(self)\n' + '\n' + ' This method is called when an iterator is required for a ' + 'container.\n' + ' This method should return a new iterator object that can ' + 'iterate\n' + ' over all the objects in the container. For mappings, it ' + 'should\n' + ' iterate over the keys of the container, and should also ' + 'be made\n' + ' available as the method "iterkeys()".\n' + '\n' + ' Iterator objects also need to implement this method; they ' + 'are\n' + ' required to return themselves. For more information on ' + 'iterator\n' + ' objects, see Iterator Types.\n' + '\n' + 'object.__reversed__(self)\n' + '\n' + ' Called (if present) by the "reversed()" built-in to ' + 'implement\n' + ' reverse iteration. It should return a new iterator ' + 'object that\n' + ' iterates over all the objects in the container in reverse ' + 'order.\n' + '\n' + ' If the "__reversed__()" method is not provided, the ' + '"reversed()"\n' + ' built-in will fall back to using the sequence protocol ' + '("__len__()"\n' + ' and "__getitem__()"). Objects that support the sequence ' + 'protocol\n' + ' should only provide "__reversed__()" if they can provide ' + 'an\n' + ' implementation that is more efficient than the one ' + 'provided by\n' + ' "reversed()".\n' + '\n' + ' New in version 2.6.\n' + '\n' + 'The membership test operators ("in" and "not in") are ' + 'normally\n' + 'implemented as an iteration through a sequence. However, ' + 'container\n' + 'objects can supply the following special method with a more ' + 'efficient\n' + 'implementation, which also does not require the object be a ' + 'sequence.\n' + '\n' + 'object.__contains__(self, item)\n' + '\n' + ' Called to implement membership test operators. Should ' + 'return true\n' + ' if *item* is in *self*, false otherwise. For mapping ' + 'objects, this\n' + ' should consider the keys of the mapping rather than the ' + 'values or\n' + ' the key-item pairs.\n' + '\n' + ' For objects that don\'t define "__contains__()", the ' + 'membership test\n' + ' first tries iteration via "__iter__()", then the old ' + 'sequence\n' + ' iteration protocol via "__getitem__()", see this section ' + 'in the\n' + ' language reference.\n' + '\n' + '\n' + 'Additional methods for emulation of sequence types\n' + '==================================================\n' + '\n' + 'The following optional methods can be defined to further ' + 'emulate\n' + 'sequence objects. Immutable sequences methods should at ' + 'most only\n' + 'define "__getslice__()"; mutable sequences might define all ' + 'three\n' + 'methods.\n' + '\n' + 'object.__getslice__(self, i, j)\n' + '\n' + ' Deprecated since version 2.0: Support slice objects as ' + 'parameters\n' + ' to the "__getitem__()" method. (However, built-in types ' + 'in CPython\n' + ' currently still implement "__getslice__()". Therefore, ' + 'you have to\n' + ' override it in derived classes when implementing ' + 'slicing.)\n' + '\n' + ' Called to implement evaluation of "self[i:j]". The ' + 'returned object\n' + ' should be of the same type as *self*. Note that missing ' + '*i* or *j*\n' + ' in the slice expression are replaced by zero or ' + '"sys.maxsize",\n' + ' respectively. If negative indexes are used in the slice, ' + 'the\n' + ' length of the sequence is added to that index. If the ' + 'instance does\n' + ' not implement the "__len__()" method, an "AttributeError" ' + 'is\n' + ' raised. No guarantee is made that indexes adjusted this ' + 'way are not\n' + ' still negative. Indexes which are greater than the ' + 'length of the\n' + ' sequence are not modified. If no "__getslice__()" is ' + 'found, a slice\n' + ' object is created instead, and passed to "__getitem__()" ' + 'instead.\n' + '\n' + 'object.__setslice__(self, i, j, sequence)\n' + '\n' + ' Called to implement assignment to "self[i:j]". Same notes ' + 'for *i*\n' + ' and *j* as for "__getslice__()".\n' + '\n' + ' This method is deprecated. If no "__setslice__()" is ' + 'found, or for\n' + ' extended slicing of the form "self[i:j:k]", a slice ' + 'object is\n' + ' created, and passed to "__setitem__()", instead of ' + '"__setslice__()"\n' + ' being called.\n' + '\n' + 'object.__delslice__(self, i, j)\n' + '\n' + ' Called to implement deletion of "self[i:j]". Same notes ' + 'for *i* and\n' + ' *j* as for "__getslice__()". This method is deprecated. ' + 'If no\n' + ' "__delslice__()" is found, or for extended slicing of the ' + 'form\n' + ' "self[i:j:k]", a slice object is created, and passed to\n' + ' "__delitem__()", instead of "__delslice__()" being ' + 'called.\n' + '\n' + 'Notice that these methods are only invoked when a single ' + 'slice with a\n' + 'single colon is used, and the slice method is available. ' + 'For slice\n' + 'operations involving extended slice notation, or in absence ' + 'of the\n' + 'slice methods, "__getitem__()", "__setitem__()" or ' + '"__delitem__()" is\n' + 'called with a slice object as argument.\n' + '\n' + 'The following example demonstrate how to make your program ' + 'or module\n' + 'compatible with earlier versions of Python (assuming that ' + 'methods\n' + '"__getitem__()", "__setitem__()" and "__delitem__()" support ' + 'slice\n' + 'objects as arguments):\n' + '\n' + ' class MyClass:\n' + ' ...\n' + ' def __getitem__(self, index):\n' + ' ...\n' + ' def __setitem__(self, index, value):\n' + ' ...\n' + ' def __delitem__(self, index):\n' + ' ...\n' + '\n' + ' if sys.version_info < (2, 0):\n' + " # They won't be defined if version is at least " + '2.0 final\n' + '\n' + ' def __getslice__(self, i, j):\n' + ' return self[max(0, i):max(0, j):]\n' + ' def __setslice__(self, i, j, seq):\n' + ' self[max(0, i):max(0, j):] = seq\n' + ' def __delslice__(self, i, j):\n' + ' del self[max(0, i):max(0, j):]\n' + ' ...\n' + '\n' + 'Note the calls to "max()"; these are necessary because of ' + 'the handling\n' + 'of negative indices before the "__*slice__()" methods are ' + 'called.\n' + 'When negative indexes are used, the "__*item__()" methods ' + 'receive them\n' + 'as provided, but the "__*slice__()" methods get a "cooked" ' + 'form of the\n' + 'index values. For each negative index value, the length of ' + 'the\n' + 'sequence is added to the index before calling the method ' + '(which may\n' + 'still result in a negative index); this is the customary ' + 'handling of\n' + 'negative indexes by the built-in sequence types, and the ' + '"__*item__()"\n' + 'methods are expected to do this as well. However, since ' + 'they should\n' + 'already be doing that, negative indexes cannot be passed in; ' + 'they must\n' + 'be constrained to the bounds of the sequence before being ' + 'passed to\n' + 'the "__*item__()" methods. Calling "max(0, i)" conveniently ' + 'returns\n' + 'the proper value.\n' + '\n' + '\n' + 'Emulating numeric types\n' + '=======================\n' + '\n' + 'The following methods can be defined to emulate numeric ' + 'objects.\n' + 'Methods corresponding to operations that are not supported ' + 'by the\n' + 'particular kind of number implemented (e.g., bitwise ' + 'operations for\n' + 'non-integral numbers) should be left undefined.\n' + '\n' + 'object.__add__(self, other)\n' + 'object.__sub__(self, other)\n' + 'object.__mul__(self, other)\n' + 'object.__floordiv__(self, other)\n' + 'object.__mod__(self, other)\n' + 'object.__divmod__(self, other)\n' + 'object.__pow__(self, other[, modulo])\n' + 'object.__lshift__(self, other)\n' + 'object.__rshift__(self, other)\n' + 'object.__and__(self, other)\n' + 'object.__xor__(self, other)\n' + 'object.__or__(self, other)\n' + '\n' + ' These methods are called to implement the binary ' + 'arithmetic\n' + ' operations ("+", "-", "*", "//", "%", "divmod()", ' + '"pow()", "**",\n' + ' "<<", ">>", "&", "^", "|"). For instance, to evaluate ' + 'the\n' + ' expression "x + y", where *x* is an instance of a class ' + 'that has an\n' + ' "__add__()" method, "x.__add__(y)" is called. The ' + '"__divmod__()"\n' + ' method should be the equivalent to using "__floordiv__()" ' + 'and\n' + ' "__mod__()"; it should not be related to "__truediv__()" ' + '(described\n' + ' below). Note that "__pow__()" should be defined to ' + 'accept an\n' + ' optional third argument if the ternary version of the ' + 'built-in\n' + ' "pow()" function is to be supported.\n' + '\n' + ' If one of those methods does not support the operation ' + 'with the\n' + ' supplied arguments, it should return "NotImplemented".\n' + '\n' + 'object.__div__(self, other)\n' + 'object.__truediv__(self, other)\n' + '\n' + ' The division operator ("/") is implemented by these ' + 'methods. The\n' + ' "__truediv__()" method is used when "__future__.division" ' + 'is in\n' + ' effect, otherwise "__div__()" is used. If only one of ' + 'these two\n' + ' methods is defined, the object will not support division ' + 'in the\n' + ' alternate context; "TypeError" will be raised instead.\n' + '\n' + 'object.__radd__(self, other)\n' + 'object.__rsub__(self, other)\n' + 'object.__rmul__(self, other)\n' + 'object.__rdiv__(self, other)\n' + 'object.__rtruediv__(self, other)\n' + 'object.__rfloordiv__(self, other)\n' + 'object.__rmod__(self, other)\n' + 'object.__rdivmod__(self, other)\n' + 'object.__rpow__(self, other)\n' + 'object.__rlshift__(self, other)\n' + 'object.__rrshift__(self, other)\n' + 'object.__rand__(self, other)\n' + 'object.__rxor__(self, other)\n' + 'object.__ror__(self, other)\n' + '\n' + ' These methods are called to implement the binary ' + 'arithmetic\n' + ' operations ("+", "-", "*", "/", "%", "divmod()", "pow()", ' + '"**",\n' + ' "<<", ">>", "&", "^", "|") with reflected (swapped) ' + 'operands.\n' + ' These functions are only called if the left operand does ' + 'not\n' + ' support the corresponding operation and the operands are ' + 'of\n' + ' different types. [2] For instance, to evaluate the ' + 'expression "x -\n' + ' y", where *y* is an instance of a class that has an ' + '"__rsub__()"\n' + ' method, "y.__rsub__(x)" is called if "x.__sub__(y)" ' + 'returns\n' + ' *NotImplemented*.\n' + '\n' + ' Note that ternary "pow()" will not try calling ' + '"__rpow__()" (the\n' + ' coercion rules would become too complicated).\n' + '\n' + " Note: If the right operand's type is a subclass of the " + 'left\n' + " operand's type and that subclass provides the reflected " + 'method\n' + ' for the operation, this method will be called before ' + 'the left\n' + " operand's non-reflected method. This behavior allows " + 'subclasses\n' + " to override their ancestors' operations.\n" + '\n' + 'object.__iadd__(self, other)\n' + 'object.__isub__(self, other)\n' + 'object.__imul__(self, other)\n' + 'object.__idiv__(self, other)\n' + 'object.__itruediv__(self, other)\n' + 'object.__ifloordiv__(self, other)\n' + 'object.__imod__(self, other)\n' + 'object.__ipow__(self, other[, modulo])\n' + 'object.__ilshift__(self, other)\n' + 'object.__irshift__(self, other)\n' + 'object.__iand__(self, other)\n' + 'object.__ixor__(self, other)\n' + 'object.__ior__(self, other)\n' + '\n' + ' These methods are called to implement the augmented ' + 'arithmetic\n' + ' assignments ("+=", "-=", "*=", "/=", "//=", "%=", "**=", ' + '"<<=",\n' + ' ">>=", "&=", "^=", "|="). These methods should attempt ' + 'to do the\n' + ' operation in-place (modifying *self*) and return the ' + 'result (which\n' + ' could be, but does not have to be, *self*). If a ' + 'specific method\n' + ' is not defined, the augmented assignment falls back to ' + 'the normal\n' + ' methods. For instance, to execute the statement "x += ' + 'y", where\n' + ' *x* is an instance of a class that has an "__iadd__()" ' + 'method,\n' + ' "x.__iadd__(y)" is called. If *x* is an instance of a ' + 'class that\n' + ' does not define a "__iadd__()" method, "x.__add__(y)" ' + 'and\n' + ' "y.__radd__(x)" are considered, as with the evaluation of ' + '"x + y".\n' + '\n' + 'object.__neg__(self)\n' + 'object.__pos__(self)\n' + 'object.__abs__(self)\n' + 'object.__invert__(self)\n' + '\n' + ' Called to implement the unary arithmetic operations ("-", ' + '"+",\n' + ' "abs()" and "~").\n' + '\n' + 'object.__complex__(self)\n' + 'object.__int__(self)\n' + 'object.__long__(self)\n' + 'object.__float__(self)\n' + '\n' + ' Called to implement the built-in functions "complex()", ' + '"int()",\n' + ' "long()", and "float()". Should return a value of the ' + 'appropriate\n' + ' type.\n' + '\n' + 'object.__oct__(self)\n' + 'object.__hex__(self)\n' + '\n' + ' Called to implement the built-in functions "oct()" and ' + '"hex()".\n' + ' Should return a string value.\n' + '\n' + 'object.__index__(self)\n' + '\n' + ' Called to implement "operator.index()". Also called ' + 'whenever\n' + ' Python needs an integer object (such as in slicing). ' + 'Must return\n' + ' an integer (int or long).\n' + '\n' + ' New in version 2.5.\n' + '\n' + 'object.__coerce__(self, other)\n' + '\n' + ' Called to implement "mixed-mode" numeric arithmetic. ' + 'Should either\n' + ' return a 2-tuple containing *self* and *other* converted ' + 'to a\n' + ' common numeric type, or "None" if conversion is ' + 'impossible. When\n' + ' the common type would be the type of "other", it is ' + 'sufficient to\n' + ' return "None", since the interpreter will also ask the ' + 'other object\n' + ' to attempt a coercion (but sometimes, if the ' + 'implementation of the\n' + ' other type cannot be changed, it is useful to do the ' + 'conversion to\n' + ' the other type here). A return value of "NotImplemented" ' + 'is\n' + ' equivalent to returning "None".\n' + '\n' + '\n' + 'Coercion rules\n' + '==============\n' + '\n' + 'This section used to document the rules for coercion. As ' + 'the language\n' + 'has evolved, the coercion rules have become hard to ' + 'document\n' + 'precisely; documenting what one version of one particular\n' + 'implementation does is undesirable. Instead, here are some ' + 'informal\n' + 'guidelines regarding coercion. In Python 3, coercion will ' + 'not be\n' + 'supported.\n' + '\n' + '* If the left operand of a % operator is a string or Unicode ' + 'object,\n' + ' no coercion takes place and the string formatting ' + 'operation is\n' + ' invoked instead.\n' + '\n' + '* It is no longer recommended to define a coercion ' + 'operation. Mixed-\n' + " mode operations on types that don't define coercion pass " + 'the\n' + ' original arguments to the operation.\n' + '\n' + '* New-style classes (those derived from "object") never ' + 'invoke the\n' + ' "__coerce__()" method in response to a binary operator; ' + 'the only\n' + ' time "__coerce__()" is invoked is when the built-in ' + 'function\n' + ' "coerce()" is called.\n' + '\n' + '* For most intents and purposes, an operator that returns\n' + ' "NotImplemented" is treated the same as one that is not ' + 'implemented\n' + ' at all.\n' + '\n' + '* Below, "__op__()" and "__rop__()" are used to signify the ' + 'generic\n' + ' method names corresponding to an operator; "__iop__()" is ' + 'used for\n' + ' the corresponding in-place operator. For example, for the ' + 'operator\n' + ' \'"+"\', "__add__()" and "__radd__()" are used for the ' + 'left and right\n' + ' variant of the binary operator, and "__iadd__()" for the ' + 'in-place\n' + ' variant.\n' + '\n' + '* For objects *x* and *y*, first "x.__op__(y)" is tried. If ' + 'this is\n' + ' not implemented or returns "NotImplemented", ' + '"y.__rop__(x)" is\n' + ' tried. If this is also not implemented or returns ' + '"NotImplemented",\n' + ' a "TypeError" exception is raised. But see the following ' + 'exception:\n' + '\n' + '* Exception to the previous item: if the left operand is an ' + 'instance\n' + ' of a built-in type or a new-style class, and the right ' + 'operand is an\n' + ' instance of a proper subclass of that type or class and ' + 'overrides\n' + ' the base\'s "__rop__()" method, the right operand\'s ' + '"__rop__()"\n' + ' method is tried *before* the left operand\'s "__op__()" ' + 'method.\n' + '\n' + ' This is done so that a subclass can completely override ' + 'binary\n' + ' operators. Otherwise, the left operand\'s "__op__()" ' + 'method would\n' + ' always accept the right operand: when an instance of a ' + 'given class\n' + ' is expected, an instance of a subclass of that class is ' + 'always\n' + ' acceptable.\n' + '\n' + '* When either operand type defines a coercion, this coercion ' + 'is\n' + ' called before that type\'s "__op__()" or "__rop__()" ' + 'method is\n' + ' called, but no sooner. If the coercion returns an object ' + 'of a\n' + ' different type for the operand whose coercion is invoked, ' + 'part of\n' + ' the process is redone using the new object.\n' + '\n' + '* When an in-place operator (like \'"+="\') is used, if the ' + 'left\n' + ' operand implements "__iop__()", it is invoked without any ' + 'coercion.\n' + ' When the operation falls back to "__op__()" and/or ' + '"__rop__()", the\n' + ' normal coercion rules apply.\n' + '\n' + '* In "x + y", if *x* is a sequence that implements sequence\n' + ' concatenation, sequence concatenation is invoked.\n' + '\n' + '* In "x * y", if one operand is a sequence that implements ' + 'sequence\n' + ' repetition, and the other is an integer ("int" or "long"), ' + 'sequence\n' + ' repetition is invoked.\n' + '\n' + '* Rich comparisons (implemented by methods "__eq__()" and so ' + 'on)\n' + ' never use coercion. Three-way comparison (implemented by\n' + ' "__cmp__()") does use coercion under the same conditions ' + 'as other\n' + ' binary operations use it.\n' + '\n' + '* In the current implementation, the built-in numeric types ' + '"int",\n' + ' "long", "float", and "complex" do not use coercion. All ' + 'these types\n' + ' implement a "__coerce__()" method, for use by the ' + 'built-in\n' + ' "coerce()" function.\n' + '\n' + ' Changed in version 2.7: The complex type no longer makes ' + 'implicit\n' + ' calls to the "__coerce__()" method for mixed-type binary ' + 'arithmetic\n' + ' operations.\n' + '\n' + '\n' + 'With Statement Context Managers\n' + '===============================\n' + '\n' + 'New in version 2.5.\n' + '\n' + 'A *context manager* is an object that defines the runtime ' + 'context to\n' + 'be established when executing a "with" statement. The ' + 'context manager\n' + 'handles the entry into, and the exit from, the desired ' + 'runtime context\n' + 'for the execution of the block of code. Context managers ' + 'are normally\n' + 'invoked using the "with" statement (described in section The ' + 'with\n' + 'statement), but can also be used by directly invoking their ' + 'methods.\n' + '\n' + 'Typical uses of context managers include saving and ' + 'restoring various\n' + 'kinds of global state, locking and unlocking resources, ' + 'closing opened\n' + 'files, etc.\n' + '\n' + 'For more information on context managers, see Context ' + 'Manager Types.\n' + '\n' + 'object.__enter__(self)\n' + '\n' + ' Enter the runtime context related to this object. The ' + '"with"\n' + " statement will bind this method's return value to the " + 'target(s)\n' + ' specified in the "as" clause of the statement, if any.\n' + '\n' + 'object.__exit__(self, exc_type, exc_value, traceback)\n' + '\n' + ' Exit the runtime context related to this object. The ' + 'parameters\n' + ' describe the exception that caused the context to be ' + 'exited. If the\n' + ' context was exited without an exception, all three ' + 'arguments will\n' + ' be "None".\n' + '\n' + ' If an exception is supplied, and the method wishes to ' + 'suppress the\n' + ' exception (i.e., prevent it from being propagated), it ' + 'should\n' + ' return a true value. Otherwise, the exception will be ' + 'processed\n' + ' normally upon exit from this method.\n' + '\n' + ' Note that "__exit__()" methods should not reraise the ' + 'passed-in\n' + " exception; this is the caller's responsibility.\n" + '\n' + 'See also:\n' + '\n' + ' **PEP 343** - The "with" statement\n' + ' The specification, background, and examples for the ' + 'Python "with"\n' + ' statement.\n' + '\n' + '\n' + 'Special method lookup for old-style classes\n' + '===========================================\n' + '\n' + 'For old-style classes, special methods are always looked up ' + 'in exactly\n' + 'the same way as any other method or attribute. This is the ' + 'case\n' + 'regardless of whether the method is being looked up ' + 'explicitly as in\n' + '"x.__getitem__(i)" or implicitly as in "x[i]".\n' + '\n' + 'This behaviour means that special methods may exhibit ' + 'different\n' + 'behaviour for different instances of a single old-style ' + 'class if the\n' + 'appropriate special attributes are set differently:\n' + '\n' + ' >>> class C:\n' + ' ... pass\n' + ' ...\n' + ' >>> c1 = C()\n' + ' >>> c2 = C()\n' + ' >>> c1.__len__ = lambda: 5\n' + ' >>> c2.__len__ = lambda: 9\n' + ' >>> len(c1)\n' + ' 5\n' + ' >>> len(c2)\n' + ' 9\n' + '\n' + '\n' + 'Special method lookup for new-style classes\n' + '===========================================\n' + '\n' + 'For new-style classes, implicit invocations of special ' + 'methods are\n' + "only guaranteed to work correctly if defined on an object's " + 'type, not\n' + "in the object's instance dictionary. That behaviour is the " + 'reason why\n' + 'the following code raises an exception (unlike the ' + 'equivalent example\n' + 'with old-style classes):\n' + '\n' + ' >>> class C(object):\n' + ' ... pass\n' + ' ...\n' + ' >>> c = C()\n' + ' >>> c.__len__ = lambda: 5\n' + ' >>> len(c)\n' + ' Traceback (most recent call last):\n' + ' File "", line 1, in \n' + " TypeError: object of type 'C' has no len()\n" + '\n' + 'The rationale behind this behaviour lies with a number of ' + 'special\n' + 'methods such as "__hash__()" and "__repr__()" that are ' + 'implemented by\n' + 'all objects, including type objects. If the implicit lookup ' + 'of these\n' + 'methods used the conventional lookup process, they would ' + 'fail when\n' + 'invoked on the type object itself:\n' + '\n' + ' >>> 1 .__hash__() == hash(1)\n' + ' True\n' + ' >>> int.__hash__() == hash(int)\n' + ' Traceback (most recent call last):\n' + ' File "", line 1, in \n' + " TypeError: descriptor '__hash__' of 'int' object needs an " + 'argument\n' + '\n' + 'Incorrectly attempting to invoke an unbound method of a ' + 'class in this\n' + "way is sometimes referred to as 'metaclass confusion', and " + 'is avoided\n' + 'by bypassing the instance when looking up special methods:\n' + '\n' + ' >>> type(1).__hash__(1) == hash(1)\n' + ' True\n' + ' >>> type(int).__hash__(int) == hash(int)\n' + ' True\n' + '\n' + 'In addition to bypassing any instance attributes in the ' + 'interest of\n' + 'correctness, implicit special method lookup generally also ' + 'bypasses\n' + 'the "__getattribute__()" method even of the object\'s ' + 'metaclass:\n' + '\n' + ' >>> class Meta(type):\n' + ' ... def __getattribute__(*args):\n' + ' ... print "Metaclass getattribute invoked"\n' + ' ... return type.__getattribute__(*args)\n' + ' ...\n' + ' >>> class C(object):\n' + ' ... __metaclass__ = Meta\n' + ' ... def __len__(self):\n' + ' ... return 10\n' + ' ... def __getattribute__(*args):\n' + ' ... print "Class getattribute invoked"\n' + ' ... return object.__getattribute__(*args)\n' + ' ...\n' + ' >>> c = C()\n' + ' >>> c.__len__() # Explicit lookup via ' + 'instance\n' + ' Class getattribute invoked\n' + ' 10\n' + ' >>> type(c).__len__(c) # Explicit lookup via ' + 'type\n' + ' Metaclass getattribute invoked\n' + ' 10\n' + ' >>> len(c) # Implicit lookup\n' + ' 10\n' + '\n' + 'Bypassing the "__getattribute__()" machinery in this fashion ' + 'provides\n' + 'significant scope for speed optimisations within the ' + 'interpreter, at\n' + 'the cost of some flexibility in the handling of special ' + 'methods (the\n' + 'special method *must* be set on the class object itself in ' + 'order to be\n' + 'consistently invoked by the interpreter).\n' + '\n' + '-[ Footnotes ]-\n' + '\n' + "[1] It *is* possible in some cases to change an object's " + 'type,\n' + " under certain controlled conditions. It generally isn't " + 'a good\n' + ' idea though, since it can lead to some very strange ' + 'behaviour if\n' + ' it is handled incorrectly.\n' + '\n' + '[2] For operands of the same type, it is assumed that if the ' + 'non-\n' + ' reflected method (such as "__add__()") fails the ' + 'operation is not\n' + ' supported, which is why the reflected method is not ' + 'called.\n', + 'string-methods': '\n' + 'String Methods\n' + '**************\n' + '\n' + 'Below are listed the string methods which both 8-bit ' + 'strings and\n' + 'Unicode objects support. Some of them are also available ' + 'on\n' + '"bytearray" objects.\n' + '\n' + "In addition, Python's strings support the sequence type " + 'methods\n' + 'described in the Sequence Types --- str, unicode, list, ' + 'tuple,\n' + 'bytearray, buffer, xrange section. To output formatted ' + 'strings use\n' + 'template strings or the "%" operator described in the ' + 'String\n' + 'Formatting Operations section. Also, see the "re" module ' + 'for string\n' + 'functions based on regular expressions.\n' + '\n' + 'str.capitalize()\n' + '\n' + ' Return a copy of the string with its first character ' + 'capitalized\n' + ' and the rest lowercased.\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.center(width[, fillchar])\n' + '\n' + ' Return centered in a string of length *width*. Padding ' + 'is done\n' + ' using the specified *fillchar* (default is a space).\n' + '\n' + ' Changed in version 2.4: Support for the *fillchar* ' + 'argument.\n' + '\n' + 'str.count(sub[, start[, end]])\n' + '\n' + ' Return the number of non-overlapping occurrences of ' + 'substring *sub*\n' + ' in the range [*start*, *end*]. Optional arguments ' + '*start* and\n' + ' *end* are interpreted as in slice notation.\n' + '\n' + 'str.decode([encoding[, errors]])\n' + '\n' + ' Decodes the string using the codec registered for ' + '*encoding*.\n' + ' *encoding* defaults to the default string encoding. ' + '*errors* may\n' + ' be given to set a different error handling scheme. The ' + 'default is\n' + ' "\'strict\'", meaning that encoding errors raise ' + '"UnicodeError".\n' + ' Other possible values are "\'ignore\'", "\'replace\'" ' + 'and any other\n' + ' name registered via "codecs.register_error()", see ' + 'section Codec\n' + ' Base Classes.\n' + '\n' + ' New in version 2.2.\n' + '\n' + ' Changed in version 2.3: Support for other error ' + 'handling schemes\n' + ' added.\n' + '\n' + ' Changed in version 2.7: Support for keyword arguments ' + 'added.\n' + '\n' + 'str.encode([encoding[, errors]])\n' + '\n' + ' Return an encoded version of the string. Default ' + 'encoding is the\n' + ' current default string encoding. *errors* may be given ' + 'to set a\n' + ' different error handling scheme. The default for ' + '*errors* is\n' + ' "\'strict\'", meaning that encoding errors raise a ' + '"UnicodeError".\n' + ' Other possible values are "\'ignore\'", "\'replace\'",\n' + ' "\'xmlcharrefreplace\'", "\'backslashreplace\'" and any ' + 'other name\n' + ' registered via "codecs.register_error()", see section ' + 'Codec Base\n' + ' Classes. For a list of possible encodings, see section ' + 'Standard\n' + ' Encodings.\n' + '\n' + ' New in version 2.0.\n' + '\n' + ' Changed in version 2.3: Support for ' + '"\'xmlcharrefreplace\'" and\n' + ' "\'backslashreplace\'" and other error handling schemes ' + 'added.\n' + '\n' + ' Changed in version 2.7: Support for keyword arguments ' + 'added.\n' + '\n' + 'str.endswith(suffix[, start[, end]])\n' + '\n' + ' Return "True" if the string ends with the specified ' + '*suffix*,\n' + ' otherwise return "False". *suffix* can also be a tuple ' + 'of suffixes\n' + ' to look for. With optional *start*, test beginning at ' + 'that\n' + ' position. With optional *end*, stop comparing at that ' + 'position.\n' + '\n' + ' Changed in version 2.5: Accept tuples as *suffix*.\n' + '\n' + 'str.expandtabs([tabsize])\n' + '\n' + ' Return a copy of the string where all tab characters ' + 'are replaced\n' + ' by one or more spaces, depending on the current column ' + 'and the\n' + ' given tab size. Tab positions occur every *tabsize* ' + 'characters\n' + ' (default is 8, giving tab positions at columns 0, 8, 16 ' + 'and so on).\n' + ' To expand the string, the current column is set to zero ' + 'and the\n' + ' string is examined character by character. If the ' + 'character is a\n' + ' tab ("\\t"), one or more space characters are inserted ' + 'in the result\n' + ' until the current column is equal to the next tab ' + 'position. (The\n' + ' tab character itself is not copied.) If the character ' + 'is a newline\n' + ' ("\\n") or return ("\\r"), it is copied and the current ' + 'column is\n' + ' reset to zero. Any other character is copied unchanged ' + 'and the\n' + ' current column is incremented by one regardless of how ' + 'the\n' + ' character is represented when printed.\n' + '\n' + " >>> '01\\t012\\t0123\\t01234'.expandtabs()\n" + " '01 012 0123 01234'\n" + " >>> '01\\t012\\t0123\\t01234'.expandtabs(4)\n" + " '01 012 0123 01234'\n" + '\n' + 'str.find(sub[, start[, end]])\n' + '\n' + ' Return the lowest index in the string where substring ' + '*sub* is\n' + ' found within the slice "s[start:end]". Optional ' + 'arguments *start*\n' + ' and *end* are interpreted as in slice notation. Return ' + '"-1" if\n' + ' *sub* is not found.\n' + '\n' + ' Note: The "find()" method should be used only if you ' + 'need to know\n' + ' the position of *sub*. To check if *sub* is a ' + 'substring or not,\n' + ' use the "in" operator:\n' + '\n' + " >>> 'Py' in 'Python'\n" + ' True\n' + '\n' + 'str.format(*args, **kwargs)\n' + '\n' + ' Perform a string formatting operation. The string on ' + 'which this\n' + ' method is called can contain literal text or ' + 'replacement fields\n' + ' delimited by braces "{}". Each replacement field ' + 'contains either\n' + ' the numeric index of a positional argument, or the name ' + 'of a\n' + ' keyword argument. Returns a copy of the string where ' + 'each\n' + ' replacement field is replaced with the string value of ' + 'the\n' + ' corresponding argument.\n' + '\n' + ' >>> "The sum of 1 + 2 is {0}".format(1+2)\n' + " 'The sum of 1 + 2 is 3'\n" + '\n' + ' See Format String Syntax for a description of the ' + 'various\n' + ' formatting options that can be specified in format ' + 'strings.\n' + '\n' + ' This method of string formatting is the new standard in ' + 'Python 3,\n' + ' and should be preferred to the "%" formatting described ' + 'in String\n' + ' Formatting Operations in new code.\n' + '\n' + ' New in version 2.6.\n' + '\n' + 'str.index(sub[, start[, end]])\n' + '\n' + ' Like "find()", but raise "ValueError" when the ' + 'substring is not\n' + ' found.\n' + '\n' + 'str.isalnum()\n' + '\n' + ' Return true if all characters in the string are ' + 'alphanumeric and\n' + ' there is at least one character, false otherwise.\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.isalpha()\n' + '\n' + ' Return true if all characters in the string are ' + 'alphabetic and\n' + ' there is at least one character, false otherwise.\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.isdigit()\n' + '\n' + ' Return true if all characters in the string are digits ' + 'and there is\n' + ' at least one character, false otherwise.\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.islower()\n' + '\n' + ' Return true if all cased characters [4] in the string ' + 'are lowercase\n' + ' and there is at least one cased character, false ' + 'otherwise.\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.isspace()\n' + '\n' + ' Return true if there are only whitespace characters in ' + 'the string\n' + ' and there is at least one character, false otherwise.\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.istitle()\n' + '\n' + ' Return true if the string is a titlecased string and ' + 'there is at\n' + ' least one character, for example uppercase characters ' + 'may only\n' + ' follow uncased characters and lowercase characters only ' + 'cased ones.\n' + ' Return false otherwise.\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.isupper()\n' + '\n' + ' Return true if all cased characters [4] in the string ' + 'are uppercase\n' + ' and there is at least one cased character, false ' + 'otherwise.\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.join(iterable)\n' + '\n' + ' Return a string which is the concatenation of the ' + 'strings in the\n' + ' *iterable* *iterable*. The separator between elements ' + 'is the\n' + ' string providing this method.\n' + '\n' + 'str.ljust(width[, fillchar])\n' + '\n' + ' Return the string left justified in a string of length ' + '*width*.\n' + ' Padding is done using the specified *fillchar* (default ' + 'is a\n' + ' space). The original string is returned if *width* is ' + 'less than or\n' + ' equal to "len(s)".\n' + '\n' + ' Changed in version 2.4: Support for the *fillchar* ' + 'argument.\n' + '\n' + 'str.lower()\n' + '\n' + ' Return a copy of the string with all the cased ' + 'characters [4]\n' + ' converted to lowercase.\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.lstrip([chars])\n' + '\n' + ' Return a copy of the string with leading characters ' + 'removed. The\n' + ' *chars* argument is a string specifying the set of ' + 'characters to be\n' + ' removed. If omitted or "None", the *chars* argument ' + 'defaults to\n' + ' removing whitespace. The *chars* argument is not a ' + 'prefix; rather,\n' + ' all combinations of its values are stripped:\n' + '\n' + " >>> ' spacious '.lstrip()\n" + " 'spacious '\n" + " >>> 'www.example.com'.lstrip('cmowz.')\n" + " 'example.com'\n" + '\n' + ' Changed in version 2.2.2: Support for the *chars* ' + 'argument.\n' + '\n' + 'str.partition(sep)\n' + '\n' + ' Split the string at the first occurrence of *sep*, and ' + 'return a\n' + ' 3-tuple containing the part before the separator, the ' + 'separator\n' + ' itself, and the part after the separator. If the ' + 'separator is not\n' + ' found, return a 3-tuple containing the string itself, ' + 'followed by\n' + ' two empty strings.\n' + '\n' + ' New in version 2.5.\n' + '\n' + 'str.replace(old, new[, count])\n' + '\n' + ' Return a copy of the string with all occurrences of ' + 'substring *old*\n' + ' replaced by *new*. If the optional argument *count* is ' + 'given, only\n' + ' the first *count* occurrences are replaced.\n' + '\n' + 'str.rfind(sub[, start[, end]])\n' + '\n' + ' Return the highest index in the string where substring ' + '*sub* is\n' + ' found, such that *sub* is contained within ' + '"s[start:end]".\n' + ' Optional arguments *start* and *end* are interpreted as ' + 'in slice\n' + ' notation. Return "-1" on failure.\n' + '\n' + 'str.rindex(sub[, start[, end]])\n' + '\n' + ' Like "rfind()" but raises "ValueError" when the ' + 'substring *sub* is\n' + ' not found.\n' + '\n' + 'str.rjust(width[, fillchar])\n' + '\n' + ' Return the string right justified in a string of length ' + '*width*.\n' + ' Padding is done using the specified *fillchar* (default ' + 'is a\n' + ' space). The original string is returned if *width* is ' + 'less than or\n' + ' equal to "len(s)".\n' + '\n' + ' Changed in version 2.4: Support for the *fillchar* ' + 'argument.\n' + '\n' + 'str.rpartition(sep)\n' + '\n' + ' Split the string at the last occurrence of *sep*, and ' + 'return a\n' + ' 3-tuple containing the part before the separator, the ' + 'separator\n' + ' itself, and the part after the separator. If the ' + 'separator is not\n' + ' found, return a 3-tuple containing two empty strings, ' + 'followed by\n' + ' the string itself.\n' + '\n' + ' New in version 2.5.\n' + '\n' + 'str.rsplit([sep[, maxsplit]])\n' + '\n' + ' Return a list of the words in the string, using *sep* ' + 'as the\n' + ' delimiter string. If *maxsplit* is given, at most ' + '*maxsplit* splits\n' + ' are done, the *rightmost* ones. If *sep* is not ' + 'specified or\n' + ' "None", any whitespace string is a separator. Except ' + 'for splitting\n' + ' from the right, "rsplit()" behaves like "split()" which ' + 'is\n' + ' described in detail below.\n' + '\n' + ' New in version 2.4.\n' + '\n' + 'str.rstrip([chars])\n' + '\n' + ' Return a copy of the string with trailing characters ' + 'removed. The\n' + ' *chars* argument is a string specifying the set of ' + 'characters to be\n' + ' removed. If omitted or "None", the *chars* argument ' + 'defaults to\n' + ' removing whitespace. The *chars* argument is not a ' + 'suffix; rather,\n' + ' all combinations of its values are stripped:\n' + '\n' + " >>> ' spacious '.rstrip()\n" + " ' spacious'\n" + " >>> 'mississippi'.rstrip('ipz')\n" + " 'mississ'\n" + '\n' + ' Changed in version 2.2.2: Support for the *chars* ' + 'argument.\n' + '\n' + 'str.split([sep[, maxsplit]])\n' + '\n' + ' Return a list of the words in the string, using *sep* ' + 'as the\n' + ' delimiter string. If *maxsplit* is given, at most ' + '*maxsplit*\n' + ' splits are done (thus, the list will have at most ' + '"maxsplit+1"\n' + ' elements). If *maxsplit* is not specified or "-1", ' + 'then there is\n' + ' no limit on the number of splits (all possible splits ' + 'are made).\n' + '\n' + ' If *sep* is given, consecutive delimiters are not ' + 'grouped together\n' + ' and are deemed to delimit empty strings (for example,\n' + ' "\'1,,2\'.split(\',\')" returns "[\'1\', \'\', ' + '\'2\']"). The *sep* argument\n' + ' may consist of multiple characters (for example,\n' + ' "\'1<>2<>3\'.split(\'<>\')" returns "[\'1\', \'2\', ' + '\'3\']"). Splitting an\n' + ' empty string with a specified separator returns ' + '"[\'\']".\n' + '\n' + ' If *sep* is not specified or is "None", a different ' + 'splitting\n' + ' algorithm is applied: runs of consecutive whitespace ' + 'are regarded\n' + ' as a single separator, and the result will contain no ' + 'empty strings\n' + ' at the start or end if the string has leading or ' + 'trailing\n' + ' whitespace. Consequently, splitting an empty string or ' + 'a string\n' + ' consisting of just whitespace with a "None" separator ' + 'returns "[]".\n' + '\n' + ' For example, "\' 1 2 3 \'.split()" returns "[\'1\', ' + '\'2\', \'3\']", and\n' + ' "\' 1 2 3 \'.split(None, 1)" returns "[\'1\', ' + '\'2 3 \']".\n' + '\n' + 'str.splitlines([keepends])\n' + '\n' + ' Return a list of the lines in the string, breaking at ' + 'line\n' + ' boundaries. This method uses the *universal newlines* ' + 'approach to\n' + ' splitting lines. Line breaks are not included in the ' + 'resulting list\n' + ' unless *keepends* is given and true.\n' + '\n' + ' For example, "\'ab c\\n\\nde ' + 'fg\\rkl\\r\\n\'.splitlines()" returns "[\'ab\n' + ' c\', \'\', \'de fg\', \'kl\']", while the same call ' + 'with\n' + ' "splitlines(True)" returns "[\'ab c\\n\', \'\\n\', \'de ' + 'fg\\r\', \'kl\\r\\n\']".\n' + '\n' + ' Unlike "split()" when a delimiter string *sep* is ' + 'given, this\n' + ' method returns an empty list for the empty string, and ' + 'a terminal\n' + ' line break does not result in an extra line.\n' + '\n' + 'str.startswith(prefix[, start[, end]])\n' + '\n' + ' Return "True" if string starts with the *prefix*, ' + 'otherwise return\n' + ' "False". *prefix* can also be a tuple of prefixes to ' + 'look for.\n' + ' With optional *start*, test string beginning at that ' + 'position.\n' + ' With optional *end*, stop comparing string at that ' + 'position.\n' + '\n' + ' Changed in version 2.5: Accept tuples as *prefix*.\n' + '\n' + 'str.strip([chars])\n' + '\n' + ' Return a copy of the string with the leading and ' + 'trailing\n' + ' characters removed. The *chars* argument is a string ' + 'specifying the\n' + ' set of characters to be removed. If omitted or "None", ' + 'the *chars*\n' + ' argument defaults to removing whitespace. The *chars* ' + 'argument is\n' + ' not a prefix or suffix; rather, all combinations of its ' + 'values are\n' + ' stripped:\n' + '\n' + " >>> ' spacious '.strip()\n" + " 'spacious'\n" + " >>> 'www.example.com'.strip('cmowz.')\n" + " 'example'\n" + '\n' + ' Changed in version 2.2.2: Support for the *chars* ' + 'argument.\n' + '\n' + 'str.swapcase()\n' + '\n' + ' Return a copy of the string with uppercase characters ' + 'converted to\n' + ' lowercase and vice versa.\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.title()\n' + '\n' + ' Return a titlecased version of the string where words ' + 'start with an\n' + ' uppercase character and the remaining characters are ' + 'lowercase.\n' + '\n' + ' The algorithm uses a simple language-independent ' + 'definition of a\n' + ' word as groups of consecutive letters. The definition ' + 'works in\n' + ' many contexts but it means that apostrophes in ' + 'contractions and\n' + ' possessives form word boundaries, which may not be the ' + 'desired\n' + ' result:\n' + '\n' + ' >>> "they\'re bill\'s friends from the UK".title()\n' + ' "They\'Re Bill\'S Friends From The Uk"\n' + '\n' + ' A workaround for apostrophes can be constructed using ' + 'regular\n' + ' expressions:\n' + '\n' + ' >>> import re\n' + ' >>> def titlecase(s):\n' + ' ... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n' + ' ... lambda mo: ' + 'mo.group(0)[0].upper() +\n' + ' ... ' + 'mo.group(0)[1:].lower(),\n' + ' ... s)\n' + ' ...\n' + ' >>> titlecase("they\'re bill\'s friends.")\n' + ' "They\'re Bill\'s Friends."\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.translate(table[, deletechars])\n' + '\n' + ' Return a copy of the string where all characters ' + 'occurring in the\n' + ' optional argument *deletechars* are removed, and the ' + 'remaining\n' + ' characters have been mapped through the given ' + 'translation table,\n' + ' which must be a string of length 256.\n' + '\n' + ' You can use the "maketrans()" helper function in the ' + '"string"\n' + ' module to create a translation table. For string ' + 'objects, set the\n' + ' *table* argument to "None" for translations that only ' + 'delete\n' + ' characters:\n' + '\n' + " >>> 'read this short text'.translate(None, 'aeiou')\n" + " 'rd ths shrt txt'\n" + '\n' + ' New in version 2.6: Support for a "None" *table* ' + 'argument.\n' + '\n' + ' For Unicode objects, the "translate()" method does not ' + 'accept the\n' + ' optional *deletechars* argument. Instead, it returns a ' + 'copy of the\n' + ' *s* where all characters have been mapped through the ' + 'given\n' + ' translation table which must be a mapping of Unicode ' + 'ordinals to\n' + ' Unicode ordinals, Unicode strings or "None". Unmapped ' + 'characters\n' + ' are left untouched. Characters mapped to "None" are ' + 'deleted. Note,\n' + ' a more flexible approach is to create a custom ' + 'character mapping\n' + ' codec using the "codecs" module (see "encodings.cp1251" ' + 'for an\n' + ' example).\n' + '\n' + 'str.upper()\n' + '\n' + ' Return a copy of the string with all the cased ' + 'characters [4]\n' + ' converted to uppercase. Note that ' + '"str.upper().isupper()" might be\n' + ' "False" if "s" contains uncased characters or if the ' + 'Unicode\n' + ' category of the resulting character(s) is not "Lu" ' + '(Letter,\n' + ' uppercase), but e.g. "Lt" (Letter, titlecase).\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.zfill(width)\n' + '\n' + ' Return the numeric string left filled with zeros in a ' + 'string of\n' + ' length *width*. A sign prefix is handled correctly. ' + 'The original\n' + ' string is returned if *width* is less than or equal to ' + '"len(s)".\n' + '\n' + ' New in version 2.2.2.\n' + '\n' + 'The following methods are present only on unicode ' + 'objects:\n' + '\n' + 'unicode.isnumeric()\n' + '\n' + ' Return "True" if there are only numeric characters in ' + 'S, "False"\n' + ' otherwise. Numeric characters include digit characters, ' + 'and all\n' + ' characters that have the Unicode numeric value ' + 'property, e.g.\n' + ' U+2155, VULGAR FRACTION ONE FIFTH.\n' + '\n' + 'unicode.isdecimal()\n' + '\n' + ' Return "True" if there are only decimal characters in ' + 'S, "False"\n' + ' otherwise. Decimal characters include digit characters, ' + 'and all\n' + ' characters that can be used to form decimal-radix ' + 'numbers, e.g.\n' + ' U+0660, ARABIC-INDIC DIGIT ZERO.\n', + 'strings': '\n' + 'String literals\n' + '***************\n' + '\n' + 'String literals are described by the following lexical ' + 'definitions:\n' + '\n' + ' stringliteral ::= [stringprefix](shortstring | longstring)\n' + ' stringprefix ::= "r" | "u" | "ur" | "R" | "U" | "UR" | "Ur" ' + '| "uR"\n' + ' | "b" | "B" | "br" | "Br" | "bR" | "BR"\n' + ' shortstring ::= "\'" shortstringitem* "\'" | \'"\' ' + 'shortstringitem* \'"\'\n' + ' longstring ::= "\'\'\'" longstringitem* "\'\'\'"\n' + ' | \'"""\' longstringitem* \'"""\'\n' + ' shortstringitem ::= shortstringchar | escapeseq\n' + ' longstringitem ::= longstringchar | escapeseq\n' + ' shortstringchar ::= \n' + ' longstringchar ::= \n' + ' escapeseq ::= "\\" \n' + '\n' + 'One syntactic restriction not indicated by these productions is ' + 'that\n' + 'whitespace is not allowed between the "stringprefix" and the rest ' + 'of\n' + 'the string literal. The source character set is defined by the\n' + 'encoding declaration; it is ASCII if no encoding declaration is ' + 'given\n' + 'in the source file; see section Encoding declarations.\n' + '\n' + 'In plain English: String literals can be enclosed in matching ' + 'single\n' + 'quotes ("\'") or double quotes ("""). They can also be enclosed ' + 'in\n' + 'matching groups of three single or double quotes (these are ' + 'generally\n' + 'referred to as *triple-quoted strings*). The backslash ("\\")\n' + 'character is used to escape characters that otherwise have a ' + 'special\n' + 'meaning, such as newline, backslash itself, or the quote ' + 'character.\n' + 'String literals may optionally be prefixed with a letter "\'r\'" ' + 'or\n' + '"\'R\'"; such strings are called *raw strings* and use different ' + 'rules\n' + 'for interpreting backslash escape sequences. A prefix of "\'u\'" ' + 'or\n' + '"\'U\'" makes the string a Unicode string. Unicode strings use ' + 'the\n' + 'Unicode character set as defined by the Unicode Consortium and ' + 'ISO\n' + '10646. Some additional escape sequences, described below, are\n' + 'available in Unicode strings. A prefix of "\'b\'" or "\'B\'" is ' + 'ignored in\n' + 'Python 2; it indicates that the literal should become a bytes ' + 'literal\n' + 'in Python 3 (e.g. when code is automatically converted with ' + '2to3). A\n' + '"\'u\'" or "\'b\'" prefix may be followed by an "\'r\'" prefix.\n' + '\n' + 'In triple-quoted strings, unescaped newlines and quotes are ' + 'allowed\n' + '(and are retained), except that three unescaped quotes in a row\n' + 'terminate the string. (A "quote" is the character used to open ' + 'the\n' + 'string, i.e. either "\'" or """.)\n' + '\n' + 'Unless an "\'r\'" or "\'R\'" prefix is present, escape sequences ' + 'in\n' + 'strings are interpreted according to rules similar to those used ' + 'by\n' + 'Standard C. The recognized escape sequences are:\n' + '\n' + '+-------------------+-----------------------------------+---------+\n' + '| Escape Sequence | Meaning | Notes ' + '|\n' + '+===================+===================================+=========+\n' + '| "\\newline" | Ignored ' + '| |\n' + '+-------------------+-----------------------------------+---------+\n' + '| "\\\\" | Backslash ("\\") ' + '| |\n' + '+-------------------+-----------------------------------+---------+\n' + '| "\\\'" | Single quote ("\'") ' + '| |\n' + '+-------------------+-----------------------------------+---------+\n' + '| "\\"" | Double quote (""") ' + '| |\n' + '+-------------------+-----------------------------------+---------+\n' + '| "\\a" | ASCII Bell (BEL) ' + '| |\n' + '+-------------------+-----------------------------------+---------+\n' + '| "\\b" | ASCII Backspace (BS) ' + '| |\n' + '+-------------------+-----------------------------------+---------+\n' + '| "\\f" | ASCII Formfeed (FF) ' + '| |\n' + '+-------------------+-----------------------------------+---------+\n' + '| "\\n" | ASCII Linefeed (LF) ' + '| |\n' + '+-------------------+-----------------------------------+---------+\n' + '| "\\N{name}" | Character named *name* in the ' + '| |\n' + '| | Unicode database (Unicode only) | ' + '|\n' + '+-------------------+-----------------------------------+---------+\n' + '| "\\r" | ASCII Carriage Return (CR) ' + '| |\n' + '+-------------------+-----------------------------------+---------+\n' + '| "\\t" | ASCII Horizontal Tab (TAB) ' + '| |\n' + '+-------------------+-----------------------------------+---------+\n' + '| "\\uxxxx" | Character with 16-bit hex value | ' + '(1) |\n' + '| | *xxxx* (Unicode only) | ' + '|\n' + '+-------------------+-----------------------------------+---------+\n' + '| "\\Uxxxxxxxx" | Character with 32-bit hex value | ' + '(2) |\n' + '| | *xxxxxxxx* (Unicode only) | ' + '|\n' + '+-------------------+-----------------------------------+---------+\n' + '| "\\v" | ASCII Vertical Tab (VT) ' + '| |\n' + '+-------------------+-----------------------------------+---------+\n' + '| "\\ooo" | Character with octal value *ooo* | ' + '(3,5) |\n' + '+-------------------+-----------------------------------+---------+\n' + '| "\\xhh" | Character with hex value *hh* | ' + '(4,5) |\n' + '+-------------------+-----------------------------------+---------+\n' + '\n' + 'Notes:\n' + '\n' + '1. Individual code units which form parts of a surrogate pair ' + 'can\n' + ' be encoded using this escape sequence.\n' + '\n' + '2. Any Unicode character can be encoded this way, but characters\n' + ' outside the Basic Multilingual Plane (BMP) will be encoded ' + 'using a\n' + ' surrogate pair if Python is compiled to use 16-bit code units ' + '(the\n' + ' default).\n' + '\n' + '3. As in Standard C, up to three octal digits are accepted.\n' + '\n' + '4. Unlike in Standard C, exactly two hex digits are required.\n' + '\n' + '5. In a string literal, hexadecimal and octal escapes denote the\n' + ' byte with the given value; it is not necessary that the byte\n' + ' encodes a character in the source character set. In a Unicode\n' + ' literal, these escapes denote a Unicode character with the ' + 'given\n' + ' value.\n' + '\n' + 'Unlike Standard C, all unrecognized escape sequences are left in ' + 'the\n' + 'string unchanged, i.e., *the backslash is left in the string*. ' + '(This\n' + 'behavior is useful when debugging: if an escape sequence is ' + 'mistyped,\n' + 'the resulting output is more easily recognized as broken.) It is ' + 'also\n' + 'important to note that the escape sequences marked as "(Unicode ' + 'only)"\n' + 'in the table above fall into the category of unrecognized escapes ' + 'for\n' + 'non-Unicode string literals.\n' + '\n' + 'When an "\'r\'" or "\'R\'" prefix is present, a character ' + 'following a\n' + 'backslash is included in the string without change, and *all\n' + 'backslashes are left in the string*. For example, the string ' + 'literal\n' + '"r"\\n"" consists of two characters: a backslash and a lowercase ' + '"\'n\'".\n' + 'String quotes can be escaped with a backslash, but the backslash\n' + 'remains in the string; for example, "r"\\""" is a valid string ' + 'literal\n' + 'consisting of two characters: a backslash and a double quote; ' + '"r"\\""\n' + 'is not a valid string literal (even a raw string cannot end in an ' + 'odd\n' + 'number of backslashes). Specifically, *a raw string cannot end ' + 'in a\n' + 'single backslash* (since the backslash would escape the ' + 'following\n' + 'quote character). Note also that a single backslash followed by ' + 'a\n' + 'newline is interpreted as those two characters as part of the ' + 'string,\n' + '*not* as a line continuation.\n' + '\n' + 'When an "\'r\'" or "\'R\'" prefix is used in conjunction with a ' + '"\'u\'" or\n' + '"\'U\'" prefix, then the "\\uXXXX" and "\\UXXXXXXXX" escape ' + 'sequences are\n' + 'processed while *all other backslashes are left in the string*. ' + 'For\n' + 'example, the string literal "ur"\\u0062\\n"" consists of three ' + 'Unicode\n' + "characters: 'LATIN SMALL LETTER B', 'REVERSE SOLIDUS', and " + "'LATIN\n" + "SMALL LETTER N'. Backslashes can be escaped with a preceding\n" + 'backslash; however, both remain in the string. As a result, ' + '"\\uXXXX"\n' + 'escape sequences are only recognized when there are an odd number ' + 'of\n' + 'backslashes.\n', + 'subscriptions': '\n' + 'Subscriptions\n' + '*************\n' + '\n' + 'A subscription selects an item of a sequence (string, tuple ' + 'or list)\n' + 'or mapping (dictionary) object:\n' + '\n' + ' subscription ::= primary "[" expression_list "]"\n' + '\n' + 'The primary must evaluate to an object of a sequence or ' + 'mapping type.\n' + '\n' + 'If the primary is a mapping, the expression list must ' + 'evaluate to an\n' + 'object whose value is one of the keys of the mapping, and ' + 'the\n' + 'subscription selects the value in the mapping that ' + 'corresponds to that\n' + 'key. (The expression list is a tuple except if it has ' + 'exactly one\n' + 'item.)\n' + '\n' + 'If the primary is a sequence, the expression (list) must ' + 'evaluate to a\n' + 'plain integer. If this value is negative, the length of ' + 'the sequence\n' + 'is added to it (so that, e.g., "x[-1]" selects the last ' + 'item of "x".)\n' + 'The resulting value must be a nonnegative integer less than ' + 'the number\n' + 'of items in the sequence, and the subscription selects the ' + 'item whose\n' + 'index is that value (counting from zero).\n' + '\n' + "A string's items are characters. A character is not a " + 'separate data\n' + 'type but a string of exactly one character.\n', + 'truth': '\n' + 'Truth Value Testing\n' + '*******************\n' + '\n' + 'Any object can be tested for truth value, for use in an "if" or\n' + '"while" condition or as operand of the Boolean operations below. ' + 'The\n' + 'following values are considered false:\n' + '\n' + '* "None"\n' + '\n' + '* "False"\n' + '\n' + '* zero of any numeric type, for example, "0", "0L", "0.0", "0j".\n' + '\n' + '* any empty sequence, for example, "\'\'", "()", "[]".\n' + '\n' + '* any empty mapping, for example, "{}".\n' + '\n' + '* instances of user-defined classes, if the class defines a\n' + ' "__nonzero__()" or "__len__()" method, when that method returns ' + 'the\n' + ' integer zero or "bool" value "False". [1]\n' + '\n' + 'All other values are considered true --- so objects of many types ' + 'are\n' + 'always true.\n' + '\n' + 'Operations and built-in functions that have a Boolean result ' + 'always\n' + 'return "0" or "False" for false and "1" or "True" for true, unless\n' + 'otherwise stated. (Important exception: the Boolean operations ' + '"or"\n' + 'and "and" always return one of their operands.)\n', + 'try': '\n' + 'The "try" statement\n' + '*******************\n' + '\n' + 'The "try" statement specifies exception handlers and/or cleanup code\n' + 'for a group of statements:\n' + '\n' + ' try_stmt ::= try1_stmt | try2_stmt\n' + ' try1_stmt ::= "try" ":" suite\n' + ' ("except" [expression [("as" | ",") identifier]] ":" ' + 'suite)+\n' + ' ["else" ":" suite]\n' + ' ["finally" ":" suite]\n' + ' try2_stmt ::= "try" ":" suite\n' + ' "finally" ":" suite\n' + '\n' + 'Changed in version 2.5: In previous versions of Python,\n' + '"try"..."except"..."finally" did not work. "try"..."except" had to ' + 'be\n' + 'nested in "try"..."finally".\n' + '\n' + 'The "except" clause(s) specify one or more exception handlers. When ' + 'no\n' + 'exception occurs in the "try" clause, no exception handler is\n' + 'executed. When an exception occurs in the "try" suite, a search for ' + 'an\n' + 'exception handler is started. This search inspects the except ' + 'clauses\n' + 'in turn until one is found that matches the exception. An ' + 'expression-\n' + 'less except clause, if present, must be last; it matches any\n' + 'exception. For an except clause with an expression, that expression\n' + 'is evaluated, and the clause matches the exception if the resulting\n' + 'object is "compatible" with the exception. An object is compatible\n' + 'with an exception if it is the class or a base class of the ' + 'exception\n' + 'object, or a tuple containing an item compatible with the exception.\n' + '\n' + 'If no except clause matches the exception, the search for an ' + 'exception\n' + 'handler continues in the surrounding code and on the invocation ' + 'stack.\n' + '[1]\n' + '\n' + 'If the evaluation of an expression in the header of an except clause\n' + 'raises an exception, the original search for a handler is canceled ' + 'and\n' + 'a search starts for the new exception in the surrounding code and on\n' + 'the call stack (it is treated as if the entire "try" statement ' + 'raised\n' + 'the exception).\n' + '\n' + 'When a matching except clause is found, the exception is assigned to\n' + 'the target specified in that except clause, if present, and the ' + 'except\n' + "clause's suite is executed. All except clauses must have an\n" + 'executable block. When the end of this block is reached, execution\n' + 'continues normally after the entire try statement. (This means that\n' + 'if two nested handlers exist for the same exception, and the ' + 'exception\n' + 'occurs in the try clause of the inner handler, the outer handler ' + 'will\n' + 'not handle the exception.)\n' + '\n' + "Before an except clause's suite is executed, details about the\n" + 'exception are assigned to three variables in the "sys" module:\n' + '"sys.exc_type" receives the object identifying the exception;\n' + '"sys.exc_value" receives the exception\'s parameter;\n' + '"sys.exc_traceback" receives a traceback object (see section The\n' + 'standard type hierarchy) identifying the point in the program where\n' + 'the exception occurred. These details are also available through the\n' + '"sys.exc_info()" function, which returns a tuple "(exc_type,\n' + 'exc_value, exc_traceback)". Use of the corresponding variables is\n' + 'deprecated in favor of this function, since their use is unsafe in a\n' + 'threaded program. As of Python 1.5, the variables are restored to\n' + 'their previous values (before the call) when returning from a ' + 'function\n' + 'that handled an exception.\n' + '\n' + 'The optional "else" clause is executed if and when control flows off\n' + 'the end of the "try" clause. [2] Exceptions in the "else" clause are\n' + 'not handled by the preceding "except" clauses.\n' + '\n' + 'If "finally" is present, it specifies a \'cleanup\' handler. The ' + '"try"\n' + 'clause is executed, including any "except" and "else" clauses. If ' + 'an\n' + 'exception occurs in any of the clauses and is not handled, the\n' + 'exception is temporarily saved. The "finally" clause is executed. ' + 'If\n' + 'there is a saved exception, it is re-raised at the end of the\n' + '"finally" clause. If the "finally" clause raises another exception ' + 'or\n' + 'executes a "return" or "break" statement, the saved exception is\n' + 'discarded:\n' + '\n' + ' >>> def f():\n' + ' ... try:\n' + ' ... 1/0\n' + ' ... finally:\n' + ' ... return 42\n' + ' ...\n' + ' >>> f()\n' + ' 42\n' + '\n' + 'The exception information is not available to the program during\n' + 'execution of the "finally" clause.\n' + '\n' + 'When a "return", "break" or "continue" statement is executed in the\n' + '"try" suite of a "try"..."finally" statement, the "finally" clause ' + 'is\n' + 'also executed \'on the way out.\' A "continue" statement is illegal ' + 'in\n' + 'the "finally" clause. (The reason is a problem with the current\n' + 'implementation --- this restriction may be lifted in the future).\n' + '\n' + 'The return value of a function is determined by the last "return"\n' + 'statement executed. Since the "finally" clause always executes, a\n' + '"return" statement executed in the "finally" clause will always be ' + 'the\n' + 'last one executed:\n' + '\n' + ' >>> def foo():\n' + ' ... try:\n' + " ... return 'try'\n" + ' ... finally:\n' + " ... return 'finally'\n" + ' ...\n' + ' >>> foo()\n' + " 'finally'\n" + '\n' + 'Additional information on exceptions can be found in section\n' + 'Exceptions, and information on using the "raise" statement to ' + 'generate\n' + 'exceptions may be found in section The raise statement.\n', + 'types': '\n' + 'The standard type hierarchy\n' + '***************************\n' + '\n' + 'Below is a list of the types that are built into Python. ' + 'Extension\n' + 'modules (written in C, Java, or other languages, depending on the\n' + 'implementation) can define additional types. Future versions of\n' + 'Python may add types to the type hierarchy (e.g., rational ' + 'numbers,\n' + 'efficiently stored arrays of integers, etc.).\n' + '\n' + 'Some of the type descriptions below contain a paragraph listing\n' + "'special attributes.' These are attributes that provide access to " + 'the\n' + 'implementation and are not intended for general use. Their ' + 'definition\n' + 'may change in the future.\n' + '\n' + 'None\n' + ' This type has a single value. There is a single object with ' + 'this\n' + ' value. This object is accessed through the built-in name "None". ' + 'It\n' + ' is used to signify the absence of a value in many situations, ' + 'e.g.,\n' + " it is returned from functions that don't explicitly return\n" + ' anything. Its truth value is false.\n' + '\n' + 'NotImplemented\n' + ' This type has a single value. There is a single object with ' + 'this\n' + ' value. This object is accessed through the built-in name\n' + ' "NotImplemented". Numeric methods and rich comparison methods ' + 'may\n' + ' return this value if they do not implement the operation for ' + 'the\n' + ' operands provided. (The interpreter will then try the ' + 'reflected\n' + ' operation, or some other fallback, depending on the operator.) ' + 'Its\n' + ' truth value is true.\n' + '\n' + 'Ellipsis\n' + ' This type has a single value. There is a single object with ' + 'this\n' + ' value. This object is accessed through the built-in name\n' + ' "Ellipsis". It is used to indicate the presence of the "..." ' + 'syntax\n' + ' in a slice. Its truth value is true.\n' + '\n' + '"numbers.Number"\n' + ' These are created by numeric literals and returned as results ' + 'by\n' + ' arithmetic operators and arithmetic built-in functions. ' + 'Numeric\n' + ' objects are immutable; once created their value never changes.\n' + ' Python numbers are of course strongly related to mathematical\n' + ' numbers, but subject to the limitations of numerical ' + 'representation\n' + ' in computers.\n' + '\n' + ' Python distinguishes between integers, floating point numbers, ' + 'and\n' + ' complex numbers:\n' + '\n' + ' "numbers.Integral"\n' + ' These represent elements from the mathematical set of ' + 'integers\n' + ' (positive and negative).\n' + '\n' + ' There are three types of integers:\n' + '\n' + ' Plain integers\n' + ' These represent numbers in the range -2147483648 through\n' + ' 2147483647. (The range may be larger on machines with a\n' + ' larger natural word size, but not smaller.) When the ' + 'result\n' + ' of an operation would fall outside this range, the result ' + 'is\n' + ' normally returned as a long integer (in some cases, the\n' + ' exception "OverflowError" is raised instead). For the\n' + ' purpose of shift and mask operations, integers are assumed ' + 'to\n' + " have a binary, 2's complement notation using 32 or more " + 'bits,\n' + ' and hiding no bits from the user (i.e., all 4294967296\n' + ' different bit patterns correspond to different values).\n' + '\n' + ' Long integers\n' + ' These represent numbers in an unlimited range, subject to\n' + ' available (virtual) memory only. For the purpose of ' + 'shift\n' + ' and mask operations, a binary representation is assumed, ' + 'and\n' + " negative numbers are represented in a variant of 2's\n" + ' complement which gives the illusion of an infinite string ' + 'of\n' + ' sign bits extending to the left.\n' + '\n' + ' Booleans\n' + ' These represent the truth values False and True. The two\n' + ' objects representing the values "False" and "True" are ' + 'the\n' + ' only Boolean objects. The Boolean type is a subtype of ' + 'plain\n' + ' integers, and Boolean values behave like the values 0 and ' + '1,\n' + ' respectively, in almost all contexts, the exception being\n' + ' that when converted to a string, the strings ""False"" or\n' + ' ""True"" are returned, respectively.\n' + '\n' + ' The rules for integer representation are intended to give ' + 'the\n' + ' most meaningful interpretation of shift and mask operations\n' + ' involving negative integers and the least surprises when\n' + ' switching between the plain and long integer domains. Any\n' + ' operation, if it yields a result in the plain integer ' + 'domain,\n' + ' will yield the same result in the long integer domain or ' + 'when\n' + ' using mixed operands. The switch between domains is ' + 'transparent\n' + ' to the programmer.\n' + '\n' + ' "numbers.Real" ("float")\n' + ' These represent machine-level double precision floating ' + 'point\n' + ' numbers. You are at the mercy of the underlying machine\n' + ' architecture (and C or Java implementation) for the accepted\n' + ' range and handling of overflow. Python does not support ' + 'single-\n' + ' precision floating point numbers; the savings in processor ' + 'and\n' + ' memory usage that are usually the reason for using these are\n' + ' dwarfed by the overhead of using objects in Python, so there ' + 'is\n' + ' no reason to complicate the language with two kinds of ' + 'floating\n' + ' point numbers.\n' + '\n' + ' "numbers.Complex"\n' + ' These represent complex numbers as a pair of machine-level\n' + ' double precision floating point numbers. The same caveats ' + 'apply\n' + ' as for floating point numbers. The real and imaginary parts ' + 'of a\n' + ' complex number "z" can be retrieved through the read-only\n' + ' attributes "z.real" and "z.imag".\n' + '\n' + 'Sequences\n' + ' These represent finite ordered sets indexed by non-negative\n' + ' numbers. The built-in function "len()" returns the number of ' + 'items\n' + ' of a sequence. When the length of a sequence is *n*, the index ' + 'set\n' + ' contains the numbers 0, 1, ..., *n*-1. Item *i* of sequence *a* ' + 'is\n' + ' selected by "a[i]".\n' + '\n' + ' Sequences also support slicing: "a[i:j]" selects all items with\n' + ' index *k* such that *i* "<=" *k* "<" *j*. When used as an\n' + ' expression, a slice is a sequence of the same type. This ' + 'implies\n' + ' that the index set is renumbered so that it starts at 0.\n' + '\n' + ' Some sequences also support "extended slicing" with a third ' + '"step"\n' + ' parameter: "a[i:j:k]" selects all items of *a* with index *x* ' + 'where\n' + ' "x = i + n*k", *n* ">=" "0" and *i* "<=" *x* "<" *j*.\n' + '\n' + ' Sequences are distinguished according to their mutability:\n' + '\n' + ' Immutable sequences\n' + ' An object of an immutable sequence type cannot change once it ' + 'is\n' + ' created. (If the object contains references to other ' + 'objects,\n' + ' these other objects may be mutable and may be changed; ' + 'however,\n' + ' the collection of objects directly referenced by an ' + 'immutable\n' + ' object cannot change.)\n' + '\n' + ' The following types are immutable sequences:\n' + '\n' + ' Strings\n' + ' The items of a string are characters. There is no ' + 'separate\n' + ' character type; a character is represented by a string of ' + 'one\n' + ' item. Characters represent (at least) 8-bit bytes. The\n' + ' built-in functions "chr()" and "ord()" convert between\n' + ' characters and nonnegative integers representing the byte\n' + ' values. Bytes with the values 0-127 usually represent ' + 'the\n' + ' corresponding ASCII values, but the interpretation of ' + 'values\n' + ' is up to the program. The string data type is also used ' + 'to\n' + ' represent arrays of bytes, e.g., to hold data read from a\n' + ' file.\n' + '\n' + ' (On systems whose native character set is not ASCII, ' + 'strings\n' + ' may use EBCDIC in their internal representation, provided ' + 'the\n' + ' functions "chr()" and "ord()" implement a mapping between\n' + ' ASCII and EBCDIC, and string comparison preserves the ' + 'ASCII\n' + ' order. Or perhaps someone can propose a better rule?)\n' + '\n' + ' Unicode\n' + ' The items of a Unicode object are Unicode code units. A\n' + ' Unicode code unit is represented by a Unicode object of ' + 'one\n' + ' item and can hold either a 16-bit or 32-bit value\n' + ' representing a Unicode ordinal (the maximum value for the\n' + ' ordinal is given in "sys.maxunicode", and depends on how\n' + ' Python is configured at compile time). Surrogate pairs ' + 'may\n' + ' be present in the Unicode object, and will be reported as ' + 'two\n' + ' separate items. The built-in functions "unichr()" and\n' + ' "ord()" convert between code units and nonnegative ' + 'integers\n' + ' representing the Unicode ordinals as defined in the ' + 'Unicode\n' + ' Standard 3.0. Conversion from and to other encodings are\n' + ' possible through the Unicode method "encode()" and the ' + 'built-\n' + ' in function "unicode()".\n' + '\n' + ' Tuples\n' + ' The items of a tuple are arbitrary Python objects. Tuples ' + 'of\n' + ' two or more items are formed by comma-separated lists of\n' + " expressions. A tuple of one item (a 'singleton') can be\n" + ' formed by affixing a comma to an expression (an expression ' + 'by\n' + ' itself does not create a tuple, since parentheses must be\n' + ' usable for grouping of expressions). An empty tuple can ' + 'be\n' + ' formed by an empty pair of parentheses.\n' + '\n' + ' Mutable sequences\n' + ' Mutable sequences can be changed after they are created. ' + 'The\n' + ' subscription and slicing notations can be used as the target ' + 'of\n' + ' assignment and "del" (delete) statements.\n' + '\n' + ' There are currently two intrinsic mutable sequence types:\n' + '\n' + ' Lists\n' + ' The items of a list are arbitrary Python objects. Lists ' + 'are\n' + ' formed by placing a comma-separated list of expressions ' + 'in\n' + ' square brackets. (Note that there are no special cases ' + 'needed\n' + ' to form lists of length 0 or 1.)\n' + '\n' + ' Byte Arrays\n' + ' A bytearray object is a mutable array. They are created ' + 'by\n' + ' the built-in "bytearray()" constructor. Aside from being\n' + ' mutable (and hence unhashable), byte arrays otherwise ' + 'provide\n' + ' the same interface and functionality as immutable bytes\n' + ' objects.\n' + '\n' + ' The extension module "array" provides an additional example ' + 'of a\n' + ' mutable sequence type.\n' + '\n' + 'Set types\n' + ' These represent unordered, finite sets of unique, immutable\n' + ' objects. As such, they cannot be indexed by any subscript. ' + 'However,\n' + ' they can be iterated over, and the built-in function "len()"\n' + ' returns the number of items in a set. Common uses for sets are ' + 'fast\n' + ' membership testing, removing duplicates from a sequence, and\n' + ' computing mathematical operations such as intersection, union,\n' + ' difference, and symmetric difference.\n' + '\n' + ' For set elements, the same immutability rules apply as for\n' + ' dictionary keys. Note that numeric types obey the normal rules ' + 'for\n' + ' numeric comparison: if two numbers compare equal (e.g., "1" and\n' + ' "1.0"), only one of them can be contained in a set.\n' + '\n' + ' There are currently two intrinsic set types:\n' + '\n' + ' Sets\n' + ' These represent a mutable set. They are created by the ' + 'built-in\n' + ' "set()" constructor and can be modified afterwards by ' + 'several\n' + ' methods, such as "add()".\n' + '\n' + ' Frozen sets\n' + ' These represent an immutable set. They are created by the\n' + ' built-in "frozenset()" constructor. As a frozenset is ' + 'immutable\n' + ' and *hashable*, it can be used again as an element of ' + 'another\n' + ' set, or as a dictionary key.\n' + '\n' + 'Mappings\n' + ' These represent finite sets of objects indexed by arbitrary ' + 'index\n' + ' sets. The subscript notation "a[k]" selects the item indexed by ' + '"k"\n' + ' from the mapping "a"; this can be used in expressions and as ' + 'the\n' + ' target of assignments or "del" statements. The built-in ' + 'function\n' + ' "len()" returns the number of items in a mapping.\n' + '\n' + ' There is currently a single intrinsic mapping type:\n' + '\n' + ' Dictionaries\n' + ' These represent finite sets of objects indexed by nearly\n' + ' arbitrary values. The only types of values not acceptable ' + 'as\n' + ' keys are values containing lists or dictionaries or other\n' + ' mutable types that are compared by value rather than by ' + 'object\n' + ' identity, the reason being that the efficient implementation ' + 'of\n' + " dictionaries requires a key's hash value to remain constant.\n" + ' Numeric types used for keys obey the normal rules for ' + 'numeric\n' + ' comparison: if two numbers compare equal (e.g., "1" and ' + '"1.0")\n' + ' then they can be used interchangeably to index the same\n' + ' dictionary entry.\n' + '\n' + ' Dictionaries are mutable; they can be created by the "{...}"\n' + ' notation (see section Dictionary displays).\n' + '\n' + ' The extension modules "dbm", "gdbm", and "bsddb" provide\n' + ' additional examples of mapping types.\n' + '\n' + 'Callable types\n' + ' These are the types to which the function call operation (see\n' + ' section Calls) can be applied:\n' + '\n' + ' User-defined functions\n' + ' A user-defined function object is created by a function\n' + ' definition (see section Function definitions). It should be\n' + ' called with an argument list containing the same number of ' + 'items\n' + " as the function's formal parameter list.\n" + '\n' + ' Special attributes:\n' + '\n' + ' ' + '+-------------------------+---------------------------------+-------------+\n' + ' | Attribute | Meaning ' + '| |\n' + ' ' + '+=========================+=================================+=============+\n' + ' | "__doc__" "func_doc" | The function\'s documentation ' + '| Writable |\n' + ' | | string, or "None" if ' + '| |\n' + ' | | unavailable. ' + '| |\n' + ' ' + '+-------------------------+---------------------------------+-------------+\n' + ' | "__name__" "func_name" | The function\'s name. ' + '| Writable |\n' + ' ' + '+-------------------------+---------------------------------+-------------+\n' + ' | "__module__" | The name of the module the | ' + 'Writable |\n' + ' | | function was defined in, or ' + '| |\n' + ' | | "None" if unavailable. ' + '| |\n' + ' ' + '+-------------------------+---------------------------------+-------------+\n' + ' | "__defaults__" | A tuple containing default | ' + 'Writable |\n' + ' | "func_defaults" | argument values for those ' + '| |\n' + ' | | arguments that have defaults, ' + '| |\n' + ' | | or "None" if no arguments have ' + '| |\n' + ' | | a default value. ' + '| |\n' + ' ' + '+-------------------------+---------------------------------+-------------+\n' + ' | "__code__" "func_code" | The code object representing | ' + 'Writable |\n' + ' | | the compiled function body. ' + '| |\n' + ' ' + '+-------------------------+---------------------------------+-------------+\n' + ' | "__globals__" | A reference to the dictionary | ' + 'Read-only |\n' + ' | "func_globals" | that holds the function\'s ' + '| |\n' + ' | | global variables --- the global ' + '| |\n' + ' | | namespace of the module in ' + '| |\n' + ' | | which the function was defined. ' + '| |\n' + ' ' + '+-------------------------+---------------------------------+-------------+\n' + ' | "__dict__" "func_dict" | The namespace supporting | ' + 'Writable |\n' + ' | | arbitrary function attributes. ' + '| |\n' + ' ' + '+-------------------------+---------------------------------+-------------+\n' + ' | "__closure__" | "None" or a tuple of cells that | ' + 'Read-only |\n' + ' | "func_closure" | contain bindings for the ' + '| |\n' + " | | function's free variables. " + '| |\n' + ' ' + '+-------------------------+---------------------------------+-------------+\n' + '\n' + ' Most of the attributes labelled "Writable" check the type of ' + 'the\n' + ' assigned value.\n' + '\n' + ' Changed in version 2.4: "func_name" is now writable.\n' + '\n' + ' Changed in version 2.6: The double-underscore attributes\n' + ' "__closure__", "__code__", "__defaults__", and "__globals__"\n' + ' were introduced as aliases for the corresponding "func_*"\n' + ' attributes for forwards compatibility with Python 3.\n' + '\n' + ' Function objects also support getting and setting arbitrary\n' + ' attributes, which can be used, for example, to attach ' + 'metadata\n' + ' to functions. Regular attribute dot-notation is used to get ' + 'and\n' + ' set such attributes. *Note that the current implementation ' + 'only\n' + ' supports function attributes on user-defined functions. ' + 'Function\n' + ' attributes on built-in functions may be supported in the\n' + ' future.*\n' + '\n' + " Additional information about a function's definition can be\n" + ' retrieved from its code object; see the description of ' + 'internal\n' + ' types below.\n' + '\n' + ' User-defined methods\n' + ' A user-defined method object combines a class, a class ' + 'instance\n' + ' (or "None") and any callable object (normally a user-defined\n' + ' function).\n' + '\n' + ' Special read-only attributes: "im_self" is the class ' + 'instance\n' + ' object, "im_func" is the function object; "im_class" is the\n' + ' class of "im_self" for bound methods or the class that asked ' + 'for\n' + ' the method for unbound methods; "__doc__" is the method\'s\n' + ' documentation (same as "im_func.__doc__"); "__name__" is the\n' + ' method name (same as "im_func.__name__"); "__module__" is ' + 'the\n' + ' name of the module the method was defined in, or "None" if\n' + ' unavailable.\n' + '\n' + ' Changed in version 2.2: "im_self" used to refer to the class\n' + ' that defined the method.\n' + '\n' + ' Changed in version 2.6: For Python 3 forward-compatibility,\n' + ' "im_func" is also available as "__func__", and "im_self" as\n' + ' "__self__".\n' + '\n' + ' Methods also support accessing (but not setting) the ' + 'arbitrary\n' + ' function attributes on the underlying function object.\n' + '\n' + ' User-defined method objects may be created when getting an\n' + ' attribute of a class (perhaps via an instance of that class), ' + 'if\n' + ' that attribute is a user-defined function object, an unbound\n' + ' user-defined method object, or a class method object. When ' + 'the\n' + ' attribute is a user-defined method object, a new method ' + 'object\n' + ' is only created if the class from which it is being retrieved ' + 'is\n' + ' the same as, or a derived class of, the class stored in the\n' + ' original method object; otherwise, the original method object ' + 'is\n' + ' used as it is.\n' + '\n' + ' When a user-defined method object is created by retrieving a\n' + ' user-defined function object from a class, its "im_self"\n' + ' attribute is "None" and the method object is said to be ' + 'unbound.\n' + ' When one is created by retrieving a user-defined function ' + 'object\n' + ' from a class via one of its instances, its "im_self" ' + 'attribute\n' + ' is the instance, and the method object is said to be bound. ' + 'In\n' + ' either case, the new method\'s "im_class" attribute is the ' + 'class\n' + ' from which the retrieval takes place, and its "im_func"\n' + ' attribute is the original function object.\n' + '\n' + ' When a user-defined method object is created by retrieving\n' + ' another method object from a class or instance, the behaviour ' + 'is\n' + ' the same as for a function object, except that the "im_func"\n' + ' attribute of the new instance is not the original method ' + 'object\n' + ' but its "im_func" attribute.\n' + '\n' + ' When a user-defined method object is created by retrieving a\n' + ' class method object from a class or instance, its "im_self"\n' + ' attribute is the class itself, and its "im_func" attribute ' + 'is\n' + ' the function object underlying the class method.\n' + '\n' + ' When an unbound user-defined method object is called, the\n' + ' underlying function ("im_func") is called, with the ' + 'restriction\n' + ' that the first argument must be an instance of the proper ' + 'class\n' + ' ("im_class") or of a derived class thereof.\n' + '\n' + ' When a bound user-defined method object is called, the\n' + ' underlying function ("im_func") is called, inserting the ' + 'class\n' + ' instance ("im_self") in front of the argument list. For\n' + ' instance, when "C" is a class which contains a definition for ' + 'a\n' + ' function "f()", and "x" is an instance of "C", calling ' + '"x.f(1)"\n' + ' is equivalent to calling "C.f(x, 1)".\n' + '\n' + ' When a user-defined method object is derived from a class ' + 'method\n' + ' object, the "class instance" stored in "im_self" will ' + 'actually\n' + ' be the class itself, so that calling either "x.f(1)" or ' + '"C.f(1)"\n' + ' is equivalent to calling "f(C,1)" where "f" is the ' + 'underlying\n' + ' function.\n' + '\n' + ' Note that the transformation from function object to (unbound ' + 'or\n' + ' bound) method object happens each time the attribute is\n' + ' retrieved from the class or instance. In some cases, a ' + 'fruitful\n' + ' optimization is to assign the attribute to a local variable ' + 'and\n' + ' call that local variable. Also notice that this ' + 'transformation\n' + ' only happens for user-defined functions; other callable ' + 'objects\n' + ' (and all non-callable objects) are retrieved without\n' + ' transformation. It is also important to note that ' + 'user-defined\n' + ' functions which are attributes of a class instance are not\n' + ' converted to bound methods; this *only* happens when the\n' + ' function is an attribute of the class.\n' + '\n' + ' Generator functions\n' + ' A function or method which uses the "yield" statement (see\n' + ' section The yield statement) is called a *generator ' + 'function*.\n' + ' Such a function, when called, always returns an iterator ' + 'object\n' + ' which can be used to execute the body of the function: ' + 'calling\n' + ' the iterator\'s "next()" method will cause the function to\n' + ' execute until it provides a value using the "yield" ' + 'statement.\n' + ' When the function executes a "return" statement or falls off ' + 'the\n' + ' end, a "StopIteration" exception is raised and the iterator ' + 'will\n' + ' have reached the end of the set of values to be returned.\n' + '\n' + ' Built-in functions\n' + ' A built-in function object is a wrapper around a C function.\n' + ' Examples of built-in functions are "len()" and "math.sin()"\n' + ' ("math" is a standard built-in module). The number and type ' + 'of\n' + ' the arguments are determined by the C function. Special ' + 'read-\n' + ' only attributes: "__doc__" is the function\'s documentation\n' + ' string, or "None" if unavailable; "__name__" is the ' + "function's\n" + ' name; "__self__" is set to "None" (but see the next item);\n' + ' "__module__" is the name of the module the function was ' + 'defined\n' + ' in or "None" if unavailable.\n' + '\n' + ' Built-in methods\n' + ' This is really a different disguise of a built-in function, ' + 'this\n' + ' time containing an object passed to the C function as an\n' + ' implicit extra argument. An example of a built-in method is\n' + ' "alist.append()", assuming *alist* is a list object. In this\n' + ' case, the special read-only attribute "__self__" is set to ' + 'the\n' + ' object denoted by *alist*.\n' + '\n' + ' Class Types\n' + ' Class types, or "new-style classes," are callable. These\n' + ' objects normally act as factories for new instances of\n' + ' themselves, but variations are possible for class types that\n' + ' override "__new__()". The arguments of the call are passed ' + 'to\n' + ' "__new__()" and, in the typical case, to "__init__()" to\n' + ' initialize the new instance.\n' + '\n' + ' Classic Classes\n' + ' Class objects are described below. When a class object is\n' + ' called, a new class instance (also described below) is ' + 'created\n' + " and returned. This implies a call to the class's " + '"__init__()"\n' + ' method if it has one. Any arguments are passed on to the\n' + ' "__init__()" method. If there is no "__init__()" method, ' + 'the\n' + ' class must be called without arguments.\n' + '\n' + ' Class instances\n' + ' Class instances are described below. Class instances are\n' + ' callable only when the class has a "__call__()" method;\n' + ' "x(arguments)" is a shorthand for "x.__call__(arguments)".\n' + '\n' + 'Modules\n' + ' Modules are imported by the "import" statement (see section The\n' + ' import statement). A module object has a namespace implemented ' + 'by a\n' + ' dictionary object (this is the dictionary referenced by the\n' + ' func_globals attribute of functions defined in the module).\n' + ' Attribute references are translated to lookups in this ' + 'dictionary,\n' + ' e.g., "m.x" is equivalent to "m.__dict__["x"]". A module object\n' + ' does not contain the code object used to initialize the module\n' + " (since it isn't needed once the initialization is done).\n" + '\n' + " Attribute assignment updates the module's namespace dictionary,\n" + ' e.g., "m.x = 1" is equivalent to "m.__dict__["x"] = 1".\n' + '\n' + ' Special read-only attribute: "__dict__" is the module\'s ' + 'namespace\n' + ' as a dictionary object.\n' + '\n' + ' **CPython implementation detail:** Because of the way CPython\n' + ' clears module dictionaries, the module dictionary will be ' + 'cleared\n' + ' when the module falls out of scope even if the dictionary still ' + 'has\n' + ' live references. To avoid this, copy the dictionary or keep ' + 'the\n' + ' module around while using its dictionary directly.\n' + '\n' + ' Predefined (writable) attributes: "__name__" is the module\'s ' + 'name;\n' + ' "__doc__" is the module\'s documentation string, or "None" if\n' + ' unavailable; "__file__" is the pathname of the file from which ' + 'the\n' + ' module was loaded, if it was loaded from a file. The "__file__"\n' + ' attribute is not present for C modules that are statically ' + 'linked\n' + ' into the interpreter; for extension modules loaded dynamically ' + 'from\n' + ' a shared library, it is the pathname of the shared library ' + 'file.\n' + '\n' + 'Classes\n' + ' Both class types (new-style classes) and class objects (old-\n' + ' style/classic classes) are typically created by class ' + 'definitions\n' + ' (see section Class definitions). A class has a namespace\n' + ' implemented by a dictionary object. Class attribute references ' + 'are\n' + ' translated to lookups in this dictionary, e.g., "C.x" is ' + 'translated\n' + ' to "C.__dict__["x"]" (although for new-style classes in ' + 'particular\n' + ' there are a number of hooks which allow for other means of ' + 'locating\n' + ' attributes). When the attribute name is not found there, the\n' + ' attribute search continues in the base classes. For old-style\n' + ' classes, the search is depth-first, left-to-right in the order ' + 'of\n' + ' occurrence in the base class list. New-style classes use the ' + 'more\n' + ' complex C3 method resolution order which behaves correctly even ' + 'in\n' + " the presence of 'diamond' inheritance structures where there " + 'are\n' + ' multiple inheritance paths leading back to a common ancestor.\n' + ' Additional details on the C3 MRO used by new-style classes can ' + 'be\n' + ' found in the documentation accompanying the 2.3 release at\n' + ' https://www.python.org/download/releases/2.3/mro/.\n' + '\n' + ' When a class attribute reference (for class "C", say) would ' + 'yield a\n' + ' user-defined function object or an unbound user-defined method\n' + ' object whose associated class is either "C" or one of its base\n' + ' classes, it is transformed into an unbound user-defined method\n' + ' object whose "im_class" attribute is "C". When it would yield a\n' + ' class method object, it is transformed into a bound ' + 'user-defined\n' + ' method object whose "im_self" attribute is "C". When it would\n' + ' yield a static method object, it is transformed into the object\n' + ' wrapped by the static method object. See section Implementing\n' + ' Descriptors for another way in which attributes retrieved from ' + 'a\n' + ' class may differ from those actually contained in its ' + '"__dict__"\n' + ' (note that only new-style classes support descriptors).\n' + '\n' + " Class attribute assignments update the class's dictionary, " + 'never\n' + ' the dictionary of a base class.\n' + '\n' + ' A class object can be called (see above) to yield a class ' + 'instance\n' + ' (see below).\n' + '\n' + ' Special attributes: "__name__" is the class name; "__module__" ' + 'is\n' + ' the module name in which the class was defined; "__dict__" is ' + 'the\n' + ' dictionary containing the class\'s namespace; "__bases__" is a ' + 'tuple\n' + ' (possibly empty or a singleton) containing the base classes, in ' + 'the\n' + ' order of their occurrence in the base class list; "__doc__" is ' + 'the\n' + " class's documentation string, or None if undefined.\n" + '\n' + 'Class instances\n' + ' A class instance is created by calling a class object (see ' + 'above).\n' + ' A class instance has a namespace implemented as a dictionary ' + 'which\n' + ' is the first place in which attribute references are searched.\n' + " When an attribute is not found there, and the instance's class " + 'has\n' + ' an attribute by that name, the search continues with the class\n' + ' attributes. If a class attribute is found that is a ' + 'user-defined\n' + ' function object or an unbound user-defined method object whose\n' + ' associated class is the class (call it "C") of the instance for\n' + ' which the attribute reference was initiated or one of its bases, ' + 'it\n' + ' is transformed into a bound user-defined method object whose\n' + ' "im_class" attribute is "C" and whose "im_self" attribute is ' + 'the\n' + ' instance. Static method and class method objects are also\n' + ' transformed, as if they had been retrieved from class "C"; see\n' + ' above under "Classes". See section Implementing Descriptors for\n' + ' another way in which attributes of a class retrieved via its\n' + ' instances may differ from the objects actually stored in the\n' + ' class\'s "__dict__". If no class attribute is found, and the\n' + ' object\'s class has a "__getattr__()" method, that is called to\n' + ' satisfy the lookup.\n' + '\n' + " Attribute assignments and deletions update the instance's\n" + " dictionary, never a class's dictionary. If the class has a\n" + ' "__setattr__()" or "__delattr__()" method, this is called ' + 'instead\n' + ' of updating the instance dictionary directly.\n' + '\n' + ' Class instances can pretend to be numbers, sequences, or ' + 'mappings\n' + ' if they have methods with certain special names. See section\n' + ' Special method names.\n' + '\n' + ' Special attributes: "__dict__" is the attribute dictionary;\n' + ' "__class__" is the instance\'s class.\n' + '\n' + 'Files\n' + ' A file object represents an open file. File objects are created ' + 'by\n' + ' the "open()" built-in function, and also by "os.popen()",\n' + ' "os.fdopen()", and the "makefile()" method of socket objects ' + '(and\n' + ' perhaps by other functions or methods provided by extension\n' + ' modules). The objects "sys.stdin", "sys.stdout" and ' + '"sys.stderr"\n' + ' are initialized to file objects corresponding to the ' + "interpreter's\n" + ' standard input, output and error streams. See File Objects for\n' + ' complete documentation of file objects.\n' + '\n' + 'Internal types\n' + ' A few types used internally by the interpreter are exposed to ' + 'the\n' + ' user. Their definitions may change with future versions of the\n' + ' interpreter, but they are mentioned here for completeness.\n' + '\n' + ' Code objects\n' + ' Code objects represent *byte-compiled* executable Python ' + 'code,\n' + ' or *bytecode*. The difference between a code object and a\n' + ' function object is that the function object contains an ' + 'explicit\n' + " reference to the function's globals (the module in which it " + 'was\n' + ' defined), while a code object contains no context; also the\n' + ' default argument values are stored in the function object, ' + 'not\n' + ' in the code object (because they represent values calculated ' + 'at\n' + ' run-time). Unlike function objects, code objects are ' + 'immutable\n' + ' and contain no references (directly or indirectly) to ' + 'mutable\n' + ' objects.\n' + '\n' + ' Special read-only attributes: "co_name" gives the function ' + 'name;\n' + ' "co_argcount" is the number of positional arguments ' + '(including\n' + ' arguments with default values); "co_nlocals" is the number ' + 'of\n' + ' local variables used by the function (including arguments);\n' + ' "co_varnames" is a tuple containing the names of the local\n' + ' variables (starting with the argument names); "co_cellvars" ' + 'is a\n' + ' tuple containing the names of local variables that are\n' + ' referenced by nested functions; "co_freevars" is a tuple\n' + ' containing the names of free variables; "co_code" is a ' + 'string\n' + ' representing the sequence of bytecode instructions; ' + '"co_consts"\n' + ' is a tuple containing the literals used by the bytecode;\n' + ' "co_names" is a tuple containing the names used by the ' + 'bytecode;\n' + ' "co_filename" is the filename from which the code was ' + 'compiled;\n' + ' "co_firstlineno" is the first line number of the function;\n' + ' "co_lnotab" is a string encoding the mapping from bytecode\n' + ' offsets to line numbers (for details see the source code of ' + 'the\n' + ' interpreter); "co_stacksize" is the required stack size\n' + ' (including local variables); "co_flags" is an integer ' + 'encoding a\n' + ' number of flags for the interpreter.\n' + '\n' + ' The following flag bits are defined for "co_flags": bit ' + '"0x04"\n' + ' is set if the function uses the "*arguments" syntax to accept ' + 'an\n' + ' arbitrary number of positional arguments; bit "0x08" is set ' + 'if\n' + ' the function uses the "**keywords" syntax to accept ' + 'arbitrary\n' + ' keyword arguments; bit "0x20" is set if the function is a\n' + ' generator.\n' + '\n' + ' Future feature declarations ("from __future__ import ' + 'division")\n' + ' also use bits in "co_flags" to indicate whether a code ' + 'object\n' + ' was compiled with a particular feature enabled: bit "0x2000" ' + 'is\n' + ' set if the function was compiled with future division ' + 'enabled;\n' + ' bits "0x10" and "0x1000" were used in earlier versions of\n' + ' Python.\n' + '\n' + ' Other bits in "co_flags" are reserved for internal use.\n' + '\n' + ' If a code object represents a function, the first item in\n' + ' "co_consts" is the documentation string of the function, or\n' + ' "None" if undefined.\n' + '\n' + ' Frame objects\n' + ' Frame objects represent execution frames. They may occur in\n' + ' traceback objects (see below).\n' + '\n' + ' Special read-only attributes: "f_back" is to the previous ' + 'stack\n' + ' frame (towards the caller), or "None" if this is the bottom\n' + ' stack frame; "f_code" is the code object being executed in ' + 'this\n' + ' frame; "f_locals" is the dictionary used to look up local\n' + ' variables; "f_globals" is used for global variables;\n' + ' "f_builtins" is used for built-in (intrinsic) names;\n' + ' "f_restricted" is a flag indicating whether the function is\n' + ' executing in restricted execution mode; "f_lasti" gives the\n' + ' precise instruction (this is an index into the bytecode ' + 'string\n' + ' of the code object).\n' + '\n' + ' Special writable attributes: "f_trace", if not "None", is a\n' + ' function called at the start of each source code line (this ' + 'is\n' + ' used by the debugger); "f_exc_type", "f_exc_value",\n' + ' "f_exc_traceback" represent the last exception raised in the\n' + ' parent frame provided another exception was ever raised in ' + 'the\n' + ' current frame (in all other cases they are None); "f_lineno" ' + 'is\n' + ' the current line number of the frame --- writing to this ' + 'from\n' + ' within a trace function jumps to the given line (only for ' + 'the\n' + ' bottom-most frame). A debugger can implement a Jump command\n' + ' (aka Set Next Statement) by writing to f_lineno.\n' + '\n' + ' Traceback objects\n' + ' Traceback objects represent a stack trace of an exception. ' + 'A\n' + ' traceback object is created when an exception occurs. When ' + 'the\n' + ' search for an exception handler unwinds the execution stack, ' + 'at\n' + ' each unwound level a traceback object is inserted in front ' + 'of\n' + ' the current traceback. When an exception handler is ' + 'entered,\n' + ' the stack trace is made available to the program. (See ' + 'section\n' + ' The try statement.) It is accessible as "sys.exc_traceback", ' + 'and\n' + ' also as the third item of the tuple returned by\n' + ' "sys.exc_info()". The latter is the preferred interface, ' + 'since\n' + ' it works correctly when the program is using multiple ' + 'threads.\n' + ' When the program contains no suitable handler, the stack ' + 'trace\n' + ' is written (nicely formatted) to the standard error stream; ' + 'if\n' + ' the interpreter is interactive, it is also made available to ' + 'the\n' + ' user as "sys.last_traceback".\n' + '\n' + ' Special read-only attributes: "tb_next" is the next level in ' + 'the\n' + ' stack trace (towards the frame where the exception occurred), ' + 'or\n' + ' "None" if there is no next level; "tb_frame" points to the\n' + ' execution frame of the current level; "tb_lineno" gives the ' + 'line\n' + ' number where the exception occurred; "tb_lasti" indicates ' + 'the\n' + ' precise instruction. The line number and last instruction ' + 'in\n' + ' the traceback may differ from the line number of its frame\n' + ' object if the exception occurred in a "try" statement with ' + 'no\n' + ' matching except clause or with a finally clause.\n' + '\n' + ' Slice objects\n' + ' Slice objects are used to represent slices when *extended ' + 'slice\n' + ' syntax* is used. This is a slice using two colons, or ' + 'multiple\n' + ' slices or ellipses separated by commas, e.g., "a[i:j:step]",\n' + ' "a[i:j, k:l]", or "a[..., i:j]". They are also created by ' + 'the\n' + ' built-in "slice()" function.\n' + '\n' + ' Special read-only attributes: "start" is the lower bound; ' + '"stop"\n' + ' is the upper bound; "step" is the step value; each is "None" ' + 'if\n' + ' omitted. These attributes can have any type.\n' + '\n' + ' Slice objects support one method:\n' + '\n' + ' slice.indices(self, length)\n' + '\n' + ' This method takes a single integer argument *length* and\n' + ' computes information about the extended slice that the ' + 'slice\n' + ' object would describe if applied to a sequence of ' + '*length*\n' + ' items. It returns a tuple of three integers; ' + 'respectively\n' + ' these are the *start* and *stop* indices and the *step* ' + 'or\n' + ' stride length of the slice. Missing or out-of-bounds ' + 'indices\n' + ' are handled in a manner consistent with regular slices.\n' + '\n' + ' New in version 2.3.\n' + '\n' + ' Static method objects\n' + ' Static method objects provide a way of defeating the\n' + ' transformation of function objects to method objects ' + 'described\n' + ' above. A static method object is a wrapper around any other\n' + ' object, usually a user-defined method object. When a static\n' + ' method object is retrieved from a class or a class instance, ' + 'the\n' + ' object actually returned is the wrapped object, which is not\n' + ' subject to any further transformation. Static method objects ' + 'are\n' + ' not themselves callable, although the objects they wrap ' + 'usually\n' + ' are. Static method objects are created by the built-in\n' + ' "staticmethod()" constructor.\n' + '\n' + ' Class method objects\n' + ' A class method object, like a static method object, is a ' + 'wrapper\n' + ' around another object that alters the way in which that ' + 'object\n' + ' is retrieved from classes and class instances. The behaviour ' + 'of\n' + ' class method objects upon such retrieval is described above,\n' + ' under "User-defined methods". Class method objects are ' + 'created\n' + ' by the built-in "classmethod()" constructor.\n', + 'typesfunctions': '\n' + 'Functions\n' + '*********\n' + '\n' + 'Function objects are created by function definitions. The ' + 'only\n' + 'operation on a function object is to call it: ' + '"func(argument-list)".\n' + '\n' + 'There are really two flavors of function objects: built-in ' + 'functions\n' + 'and user-defined functions. Both support the same ' + 'operation (to call\n' + 'the function), but the implementation is different, hence ' + 'the\n' + 'different object types.\n' + '\n' + 'See Function definitions for more information.\n', + 'typesmapping': '\n' + 'Mapping Types --- "dict"\n' + '************************\n' + '\n' + 'A *mapping* object maps *hashable* values to arbitrary ' + 'objects.\n' + 'Mappings are mutable objects. There is currently only one ' + 'standard\n' + 'mapping type, the *dictionary*. (For other containers see ' + 'the built\n' + 'in "list", "set", and "tuple" classes, and the "collections" ' + 'module.)\n' + '\n' + "A dictionary's keys are *almost* arbitrary values. Values " + 'that are\n' + 'not *hashable*, that is, values containing lists, ' + 'dictionaries or\n' + 'other mutable types (that are compared by value rather than ' + 'by object\n' + 'identity) may not be used as keys. Numeric types used for ' + 'keys obey\n' + 'the normal rules for numeric comparison: if two numbers ' + 'compare equal\n' + '(such as "1" and "1.0") then they can be used ' + 'interchangeably to index\n' + 'the same dictionary entry. (Note however, that since ' + 'computers store\n' + 'floating-point numbers as approximations it is usually ' + 'unwise to use\n' + 'them as dictionary keys.)\n' + '\n' + 'Dictionaries can be created by placing a comma-separated ' + 'list of "key:\n' + 'value" pairs within braces, for example: "{\'jack\': 4098, ' + "'sjoerd':\n" + '4127}" or "{4098: \'jack\', 4127: \'sjoerd\'}", or by the ' + '"dict"\n' + 'constructor.\n' + '\n' + 'class dict(**kwarg)\n' + 'class dict(mapping, **kwarg)\n' + 'class dict(iterable, **kwarg)\n' + '\n' + ' Return a new dictionary initialized from an optional ' + 'positional\n' + ' argument and a possibly empty set of keyword arguments.\n' + '\n' + ' If no positional argument is given, an empty dictionary ' + 'is created.\n' + ' If a positional argument is given and it is a mapping ' + 'object, a\n' + ' dictionary is created with the same key-value pairs as ' + 'the mapping\n' + ' object. Otherwise, the positional argument must be an ' + '*iterable*\n' + ' object. Each item in the iterable must itself be an ' + 'iterable with\n' + ' exactly two objects. The first object of each item ' + 'becomes a key\n' + ' in the new dictionary, and the second object the ' + 'corresponding\n' + ' value. If a key occurs more than once, the last value ' + 'for that key\n' + ' becomes the corresponding value in the new dictionary.\n' + '\n' + ' If keyword arguments are given, the keyword arguments and ' + 'their\n' + ' values are added to the dictionary created from the ' + 'positional\n' + ' argument. If a key being added is already present, the ' + 'value from\n' + ' the keyword argument replaces the value from the ' + 'positional\n' + ' argument.\n' + '\n' + ' To illustrate, the following examples all return a ' + 'dictionary equal\n' + ' to "{"one": 1, "two": 2, "three": 3}":\n' + '\n' + ' >>> a = dict(one=1, two=2, three=3)\n' + " >>> b = {'one': 1, 'two': 2, 'three': 3}\n" + " >>> c = dict(zip(['one', 'two', 'three'], [1, 2, 3]))\n" + " >>> d = dict([('two', 2), ('one', 1), ('three', 3)])\n" + " >>> e = dict({'three': 3, 'one': 1, 'two': 2})\n" + ' >>> a == b == c == d == e\n' + ' True\n' + '\n' + ' Providing keyword arguments as in the first example only ' + 'works for\n' + ' keys that are valid Python identifiers. Otherwise, any ' + 'valid keys\n' + ' can be used.\n' + '\n' + ' New in version 2.2.\n' + '\n' + ' Changed in version 2.3: Support for building a dictionary ' + 'from\n' + ' keyword arguments added.\n' + '\n' + ' These are the operations that dictionaries support (and ' + 'therefore,\n' + ' custom mapping types should support too):\n' + '\n' + ' len(d)\n' + '\n' + ' Return the number of items in the dictionary *d*.\n' + '\n' + ' d[key]\n' + '\n' + ' Return the item of *d* with key *key*. Raises a ' + '"KeyError" if\n' + ' *key* is not in the map.\n' + '\n' + ' If a subclass of dict defines a method "__missing__()" ' + 'and *key*\n' + ' is not present, the "d[key]" operation calls that ' + 'method with\n' + ' the key *key* as argument. The "d[key]" operation ' + 'then returns\n' + ' or raises whatever is returned or raised by the\n' + ' "__missing__(key)" call. No other operations or ' + 'methods invoke\n' + ' "__missing__()". If "__missing__()" is not defined, ' + '"KeyError"\n' + ' is raised. "__missing__()" must be a method; it cannot ' + 'be an\n' + ' instance variable:\n' + '\n' + ' >>> class Counter(dict):\n' + ' ... def __missing__(self, key):\n' + ' ... return 0\n' + ' >>> c = Counter()\n' + " >>> c['red']\n" + ' 0\n' + " >>> c['red'] += 1\n" + " >>> c['red']\n" + ' 1\n' + '\n' + ' The example above shows part of the implementation of\n' + ' "collections.Counter". A different "__missing__" ' + 'method is used\n' + ' by "collections.defaultdict".\n' + '\n' + ' New in version 2.5: Recognition of __missing__ methods ' + 'of dict\n' + ' subclasses.\n' + '\n' + ' d[key] = value\n' + '\n' + ' Set "d[key]" to *value*.\n' + '\n' + ' del d[key]\n' + '\n' + ' Remove "d[key]" from *d*. Raises a "KeyError" if ' + '*key* is not\n' + ' in the map.\n' + '\n' + ' key in d\n' + '\n' + ' Return "True" if *d* has a key *key*, else "False".\n' + '\n' + ' New in version 2.2.\n' + '\n' + ' key not in d\n' + '\n' + ' Equivalent to "not key in d".\n' + '\n' + ' New in version 2.2.\n' + '\n' + ' iter(d)\n' + '\n' + ' Return an iterator over the keys of the dictionary. ' + 'This is a\n' + ' shortcut for "iterkeys()".\n' + '\n' + ' clear()\n' + '\n' + ' Remove all items from the dictionary.\n' + '\n' + ' copy()\n' + '\n' + ' Return a shallow copy of the dictionary.\n' + '\n' + ' fromkeys(seq[, value])\n' + '\n' + ' Create a new dictionary with keys from *seq* and ' + 'values set to\n' + ' *value*.\n' + '\n' + ' "fromkeys()" is a class method that returns a new ' + 'dictionary.\n' + ' *value* defaults to "None".\n' + '\n' + ' New in version 2.3.\n' + '\n' + ' get(key[, default])\n' + '\n' + ' Return the value for *key* if *key* is in the ' + 'dictionary, else\n' + ' *default*. If *default* is not given, it defaults to ' + '"None", so\n' + ' that this method never raises a "KeyError".\n' + '\n' + ' has_key(key)\n' + '\n' + ' Test for the presence of *key* in the dictionary. ' + '"has_key()"\n' + ' is deprecated in favor of "key in d".\n' + '\n' + ' items()\n' + '\n' + ' Return a copy of the dictionary\'s list of "(key, ' + 'value)" pairs.\n' + '\n' + ' **CPython implementation detail:** Keys and values are ' + 'listed in\n' + ' an arbitrary order which is non-random, varies across ' + 'Python\n' + " implementations, and depends on the dictionary's " + 'history of\n' + ' insertions and deletions.\n' + '\n' + ' If "items()", "keys()", "values()", "iteritems()", ' + '"iterkeys()",\n' + ' and "itervalues()" are called with no intervening ' + 'modifications\n' + ' to the dictionary, the lists will directly ' + 'correspond. This\n' + ' allows the creation of "(value, key)" pairs using ' + '"zip()":\n' + ' "pairs = zip(d.values(), d.keys())". The same ' + 'relationship\n' + ' holds for the "iterkeys()" and "itervalues()" methods: ' + '"pairs =\n' + ' zip(d.itervalues(), d.iterkeys())" provides the same ' + 'value for\n' + ' "pairs". Another way to create the same list is "pairs ' + '= [(v, k)\n' + ' for (k, v) in d.iteritems()]".\n' + '\n' + ' iteritems()\n' + '\n' + ' Return an iterator over the dictionary\'s "(key, ' + 'value)" pairs.\n' + ' See the note for "dict.items()".\n' + '\n' + ' Using "iteritems()" while adding or deleting entries ' + 'in the\n' + ' dictionary may raise a "RuntimeError" or fail to ' + 'iterate over\n' + ' all entries.\n' + '\n' + ' New in version 2.2.\n' + '\n' + ' iterkeys()\n' + '\n' + " Return an iterator over the dictionary's keys. See " + 'the note for\n' + ' "dict.items()".\n' + '\n' + ' Using "iterkeys()" while adding or deleting entries in ' + 'the\n' + ' dictionary may raise a "RuntimeError" or fail to ' + 'iterate over\n' + ' all entries.\n' + '\n' + ' New in version 2.2.\n' + '\n' + ' itervalues()\n' + '\n' + " Return an iterator over the dictionary's values. See " + 'the note\n' + ' for "dict.items()".\n' + '\n' + ' Using "itervalues()" while adding or deleting entries ' + 'in the\n' + ' dictionary may raise a "RuntimeError" or fail to ' + 'iterate over\n' + ' all entries.\n' + '\n' + ' New in version 2.2.\n' + '\n' + ' keys()\n' + '\n' + " Return a copy of the dictionary's list of keys. See " + 'the note\n' + ' for "dict.items()".\n' + '\n' + ' pop(key[, default])\n' + '\n' + ' If *key* is in the dictionary, remove it and return ' + 'its value,\n' + ' else return *default*. If *default* is not given and ' + '*key* is\n' + ' not in the dictionary, a "KeyError" is raised.\n' + '\n' + ' New in version 2.3.\n' + '\n' + ' popitem()\n' + '\n' + ' Remove and return an arbitrary "(key, value)" pair ' + 'from the\n' + ' dictionary.\n' + '\n' + ' "popitem()" is useful to destructively iterate over a\n' + ' dictionary, as often used in set algorithms. If the ' + 'dictionary\n' + ' is empty, calling "popitem()" raises a "KeyError".\n' + '\n' + ' setdefault(key[, default])\n' + '\n' + ' If *key* is in the dictionary, return its value. If ' + 'not, insert\n' + ' *key* with a value of *default* and return *default*. ' + '*default*\n' + ' defaults to "None".\n' + '\n' + ' update([other])\n' + '\n' + ' Update the dictionary with the key/value pairs from ' + '*other*,\n' + ' overwriting existing keys. Return "None".\n' + '\n' + ' "update()" accepts either another dictionary object or ' + 'an\n' + ' iterable of key/value pairs (as tuples or other ' + 'iterables of\n' + ' length two). If keyword arguments are specified, the ' + 'dictionary\n' + ' is then updated with those key/value pairs: ' + '"d.update(red=1,\n' + ' blue=2)".\n' + '\n' + ' Changed in version 2.4: Allowed the argument to be an ' + 'iterable\n' + ' of key/value pairs and allowed keyword arguments.\n' + '\n' + ' values()\n' + '\n' + " Return a copy of the dictionary's list of values. See " + 'the note\n' + ' for "dict.items()".\n' + '\n' + ' viewitems()\n' + '\n' + ' Return a new view of the dictionary\'s items ("(key, ' + 'value)"\n' + ' pairs). See below for documentation of view objects.\n' + '\n' + ' New in version 2.7.\n' + '\n' + ' viewkeys()\n' + '\n' + " Return a new view of the dictionary's keys. See below " + 'for\n' + ' documentation of view objects.\n' + '\n' + ' New in version 2.7.\n' + '\n' + ' viewvalues()\n' + '\n' + " Return a new view of the dictionary's values. See " + 'below for\n' + ' documentation of view objects.\n' + '\n' + ' New in version 2.7.\n' + '\n' + ' Dictionaries compare equal if and only if they have the ' + 'same "(key,\n' + ' value)" pairs.\n' + '\n' + '\n' + 'Dictionary view objects\n' + '=======================\n' + '\n' + 'The objects returned by "dict.viewkeys()", ' + '"dict.viewvalues()" and\n' + '"dict.viewitems()" are *view objects*. They provide a ' + 'dynamic view on\n' + "the dictionary's entries, which means that when the " + 'dictionary\n' + 'changes, the view reflects these changes.\n' + '\n' + 'Dictionary views can be iterated over to yield their ' + 'respective data,\n' + 'and support membership tests:\n' + '\n' + 'len(dictview)\n' + '\n' + ' Return the number of entries in the dictionary.\n' + '\n' + 'iter(dictview)\n' + '\n' + ' Return an iterator over the keys, values or items ' + '(represented as\n' + ' tuples of "(key, value)") in the dictionary.\n' + '\n' + ' Keys and values are iterated over in an arbitrary order ' + 'which is\n' + ' non-random, varies across Python implementations, and ' + 'depends on\n' + " the dictionary's history of insertions and deletions. If " + 'keys,\n' + ' values and items views are iterated over with no ' + 'intervening\n' + ' modifications to the dictionary, the order of items will ' + 'directly\n' + ' correspond. This allows the creation of "(value, key)" ' + 'pairs using\n' + ' "zip()": "pairs = zip(d.values(), d.keys())". Another ' + 'way to\n' + ' create the same list is "pairs = [(v, k) for (k, v) in ' + 'd.items()]".\n' + '\n' + ' Iterating views while adding or deleting entries in the ' + 'dictionary\n' + ' may raise a "RuntimeError" or fail to iterate over all ' + 'entries.\n' + '\n' + 'x in dictview\n' + '\n' + ' Return "True" if *x* is in the underlying dictionary\'s ' + 'keys, values\n' + ' or items (in the latter case, *x* should be a "(key, ' + 'value)"\n' + ' tuple).\n' + '\n' + 'Keys views are set-like since their entries are unique and ' + 'hashable.\n' + 'If all values are hashable, so that (key, value) pairs are ' + 'unique and\n' + 'hashable, then the items view is also set-like. (Values ' + 'views are not\n' + 'treated as set-like since the entries are generally not ' + 'unique.) Then\n' + 'these set operations are available ("other" refers either to ' + 'another\n' + 'view or a set):\n' + '\n' + 'dictview & other\n' + '\n' + ' Return the intersection of the dictview and the other ' + 'object as a\n' + ' new set.\n' + '\n' + 'dictview | other\n' + '\n' + ' Return the union of the dictview and the other object as ' + 'a new set.\n' + '\n' + 'dictview - other\n' + '\n' + ' Return the difference between the dictview and the other ' + 'object\n' + " (all elements in *dictview* that aren't in *other*) as a " + 'new set.\n' + '\n' + 'dictview ^ other\n' + '\n' + ' Return the symmetric difference (all elements either in ' + '*dictview*\n' + ' or *other*, but not in both) of the dictview and the ' + 'other object\n' + ' as a new set.\n' + '\n' + 'An example of dictionary view usage:\n' + '\n' + " >>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, " + "'spam': 500}\n" + ' >>> keys = dishes.viewkeys()\n' + ' >>> values = dishes.viewvalues()\n' + '\n' + ' >>> # iteration\n' + ' >>> n = 0\n' + ' >>> for val in values:\n' + ' ... n += val\n' + ' >>> print(n)\n' + ' 504\n' + '\n' + ' >>> # keys and values are iterated over in the same ' + 'order\n' + ' >>> list(keys)\n' + " ['eggs', 'bacon', 'sausage', 'spam']\n" + ' >>> list(values)\n' + ' [2, 1, 1, 500]\n' + '\n' + ' >>> # view objects are dynamic and reflect dict changes\n' + " >>> del dishes['eggs']\n" + " >>> del dishes['sausage']\n" + ' >>> list(keys)\n' + " ['spam', 'bacon']\n" + '\n' + ' >>> # set operations\n' + " >>> keys & {'eggs', 'bacon', 'salad'}\n" + " {'bacon'}\n", + 'typesmethods': '\n' + 'Methods\n' + '*******\n' + '\n' + 'Methods are functions that are called using the attribute ' + 'notation.\n' + 'There are two flavors: built-in methods (such as "append()" ' + 'on lists)\n' + 'and class instance methods. Built-in methods are described ' + 'with the\n' + 'types that support them.\n' + '\n' + 'The implementation adds two special read-only attributes to ' + 'class\n' + 'instance methods: "m.im_self" is the object on which the ' + 'method\n' + 'operates, and "m.im_func" is the function implementing the ' + 'method.\n' + 'Calling "m(arg-1, arg-2, ..., arg-n)" is completely ' + 'equivalent to\n' + 'calling "m.im_func(m.im_self, arg-1, arg-2, ..., arg-n)".\n' + '\n' + 'Class instance methods are either *bound* or *unbound*, ' + 'referring to\n' + 'whether the method was accessed through an instance or a ' + 'class,\n' + 'respectively. When a method is unbound, its "im_self" ' + 'attribute will\n' + 'be "None" and if called, an explicit "self" object must be ' + 'passed as\n' + 'the first argument. In this case, "self" must be an ' + 'instance of the\n' + "unbound method's class (or a subclass of that class), " + 'otherwise a\n' + '"TypeError" is raised.\n' + '\n' + 'Like function objects, methods objects support getting ' + 'arbitrary\n' + 'attributes. However, since method attributes are actually ' + 'stored on\n' + 'the underlying function object ("meth.im_func"), setting ' + 'method\n' + 'attributes on either bound or unbound methods is ' + 'disallowed.\n' + 'Attempting to set an attribute on a method results in an\n' + '"AttributeError" being raised. In order to set a method ' + 'attribute,\n' + 'you need to explicitly set it on the underlying function ' + 'object:\n' + '\n' + ' >>> class C:\n' + ' ... def method(self):\n' + ' ... pass\n' + ' ...\n' + ' >>> c = C()\n' + " >>> c.method.whoami = 'my name is method' # can't set on " + 'the method\n' + ' Traceback (most recent call last):\n' + ' File "", line 1, in \n' + " AttributeError: 'instancemethod' object has no attribute " + "'whoami'\n" + " >>> c.method.im_func.whoami = 'my name is method'\n" + ' >>> c.method.whoami\n' + " 'my name is method'\n" + '\n' + 'See The standard type hierarchy for more information.\n', + 'typesmodules': '\n' + 'Modules\n' + '*******\n' + '\n' + 'The only special operation on a module is attribute access: ' + '"m.name",\n' + 'where *m* is a module and *name* accesses a name defined in ' + "*m*'s\n" + 'symbol table. Module attributes can be assigned to. (Note ' + 'that the\n' + '"import" statement is not, strictly speaking, an operation ' + 'on a module\n' + 'object; "import foo" does not require a module object named ' + '*foo* to\n' + 'exist, rather it requires an (external) *definition* for a ' + 'module\n' + 'named *foo* somewhere.)\n' + '\n' + 'A special attribute of every module is "__dict__". This is ' + 'the\n' + "dictionary containing the module's symbol table. Modifying " + 'this\n' + "dictionary will actually change the module's symbol table, " + 'but direct\n' + 'assignment to the "__dict__" attribute is not possible (you ' + 'can write\n' + '"m.__dict__[\'a\'] = 1", which defines "m.a" to be "1", but ' + "you can't\n" + 'write "m.__dict__ = {}"). Modifying "__dict__" directly is ' + 'not\n' + 'recommended.\n' + '\n' + 'Modules built into the interpreter are written like this: ' + '"". If loaded from a file, they are ' + 'written as\n' + '"".\n', + 'typesseq': '\n' + 'Sequence Types --- "str", "unicode", "list", "tuple", ' + '"bytearray", "buffer", "xrange"\n' + '*************************************************************************************\n' + '\n' + 'There are seven sequence types: strings, Unicode strings, ' + 'lists,\n' + 'tuples, bytearrays, buffers, and xrange objects.\n' + '\n' + 'For other containers see the built in "dict" and "set" classes, ' + 'and\n' + 'the "collections" module.\n' + '\n' + 'String literals are written in single or double quotes: ' + '"\'xyzzy\'",\n' + '""frobozz"". See String literals for more about string ' + 'literals.\n' + 'Unicode strings are much like strings, but are specified in the ' + 'syntax\n' + 'using a preceding "\'u\'" character: "u\'abc\'", "u"def"". In ' + 'addition to\n' + 'the functionality described here, there are also ' + 'string-specific\n' + 'methods described in the String Methods section. Lists are ' + 'constructed\n' + 'with square brackets, separating items with commas: "[a, b, ' + 'c]".\n' + 'Tuples are constructed by the comma operator (not within square\n' + 'brackets), with or without enclosing parentheses, but an empty ' + 'tuple\n' + 'must have the enclosing parentheses, such as "a, b, c" or "()". ' + 'A\n' + 'single item tuple must have a trailing comma, such as "(d,)".\n' + '\n' + 'Bytearray objects are created with the built-in function\n' + '"bytearray()".\n' + '\n' + 'Buffer objects are not directly supported by Python syntax, but ' + 'can be\n' + 'created by calling the built-in function "buffer()". They ' + "don't\n" + 'support concatenation or repetition.\n' + '\n' + 'Objects of type xrange are similar to buffers in that there is ' + 'no\n' + 'specific syntax to create them, but they are created using the\n' + '"xrange()" function. They don\'t support slicing, concatenation ' + 'or\n' + 'repetition, and using "in", "not in", "min()" or "max()" on them ' + 'is\n' + 'inefficient.\n' + '\n' + 'Most sequence types support the following operations. The "in" ' + 'and\n' + '"not in" operations have the same priorities as the comparison\n' + 'operations. The "+" and "*" operations have the same priority ' + 'as the\n' + 'corresponding numeric operations. [3] Additional methods are ' + 'provided\n' + 'for Mutable Sequence Types.\n' + '\n' + 'This table lists the sequence operations sorted in ascending ' + 'priority.\n' + 'In the table, *s* and *t* are sequences of the same type; *n*, ' + '*i* and\n' + '*j* are integers:\n' + '\n' + '+--------------------+----------------------------------+------------+\n' + '| Operation | Result | ' + 'Notes |\n' + '+====================+==================================+============+\n' + '| "x in s" | "True" if an item of *s* is | ' + '(1) |\n' + '| | equal to *x*, else "False" ' + '| |\n' + '+--------------------+----------------------------------+------------+\n' + '| "x not in s" | "False" if an item of *s* is | ' + '(1) |\n' + '| | equal to *x*, else "True" ' + '| |\n' + '+--------------------+----------------------------------+------------+\n' + '| "s + t" | the concatenation of *s* and *t* | ' + '(6) |\n' + '+--------------------+----------------------------------+------------+\n' + '| "s * n, n * s" | equivalent to adding *s* to | ' + '(2) |\n' + '| | itself *n* times ' + '| |\n' + '+--------------------+----------------------------------+------------+\n' + '| "s[i]" | *i*th item of *s*, origin 0 | ' + '(3) |\n' + '+--------------------+----------------------------------+------------+\n' + '| "s[i:j]" | slice of *s* from *i* to *j* | ' + '(3)(4) |\n' + '+--------------------+----------------------------------+------------+\n' + '| "s[i:j:k]" | slice of *s* from *i* to *j* | ' + '(3)(5) |\n' + '| | with step *k* ' + '| |\n' + '+--------------------+----------------------------------+------------+\n' + '| "len(s)" | length of *s* ' + '| |\n' + '+--------------------+----------------------------------+------------+\n' + '| "min(s)" | smallest item of *s* ' + '| |\n' + '+--------------------+----------------------------------+------------+\n' + '| "max(s)" | largest item of *s* ' + '| |\n' + '+--------------------+----------------------------------+------------+\n' + '| "s.index(x)" | index of the first occurrence of ' + '| |\n' + '| | *x* in *s* ' + '| |\n' + '+--------------------+----------------------------------+------------+\n' + '| "s.count(x)" | total number of occurrences of ' + '| |\n' + '| | *x* in *s* ' + '| |\n' + '+--------------------+----------------------------------+------------+\n' + '\n' + 'Sequence types also support comparisons. In particular, tuples ' + 'and\n' + 'lists are compared lexicographically by comparing corresponding\n' + 'elements. This means that to compare equal, every element must ' + 'compare\n' + 'equal and the two sequences must be of the same type and have ' + 'the same\n' + 'length. (For full details see Comparisons in the language ' + 'reference.)\n' + '\n' + 'Notes:\n' + '\n' + '1. When *s* is a string or Unicode string object the "in" and ' + '"not\n' + ' in" operations act like a substring test. In Python ' + 'versions\n' + ' before 2.3, *x* had to be a string of length 1. In Python 2.3 ' + 'and\n' + ' beyond, *x* may be a string of any length.\n' + '\n' + '2. Values of *n* less than "0" are treated as "0" (which yields ' + 'an\n' + ' empty sequence of the same type as *s*). Note that items in ' + 'the\n' + ' sequence *s* are not copied; they are referenced multiple ' + 'times.\n' + ' This often haunts new Python programmers; consider:\n' + '\n' + ' >>> lists = [[]] * 3\n' + ' >>> lists\n' + ' [[], [], []]\n' + ' >>> lists[0].append(3)\n' + ' >>> lists\n' + ' [[3], [3], [3]]\n' + '\n' + ' What has happened is that "[[]]" is a one-element list ' + 'containing\n' + ' an empty list, so all three elements of "[[]] * 3" are ' + 'references\n' + ' to this single empty list. Modifying any of the elements of\n' + ' "lists" modifies this single list. You can create a list of\n' + ' different lists this way:\n' + '\n' + ' >>> lists = [[] for i in range(3)]\n' + ' >>> lists[0].append(3)\n' + ' >>> lists[1].append(5)\n' + ' >>> lists[2].append(7)\n' + ' >>> lists\n' + ' [[3], [5], [7]]\n' + '\n' + ' Further explanation is available in the FAQ entry How do I ' + 'create a\n' + ' multidimensional list?.\n' + '\n' + '3. If *i* or *j* is negative, the index is relative to the end ' + 'of\n' + ' the string: "len(s) + i" or "len(s) + j" is substituted. But ' + 'note\n' + ' that "-0" is still "0".\n' + '\n' + '4. The slice of *s* from *i* to *j* is defined as the sequence ' + 'of\n' + ' items with index *k* such that "i <= k < j". If *i* or *j* ' + 'is\n' + ' greater than "len(s)", use "len(s)". If *i* is omitted or ' + '"None",\n' + ' use "0". If *j* is omitted or "None", use "len(s)". If *i* ' + 'is\n' + ' greater than or equal to *j*, the slice is empty.\n' + '\n' + '5. The slice of *s* from *i* to *j* with step *k* is defined as ' + 'the\n' + ' sequence of items with index "x = i + n*k" such that "0 <= n ' + '<\n' + ' (j-i)/k". In other words, the indices are "i", "i+k", ' + '"i+2*k",\n' + ' "i+3*k" and so on, stopping when *j* is reached (but never\n' + ' including *j*). If *i* or *j* is greater than "len(s)", use\n' + ' "len(s)". If *i* or *j* are omitted or "None", they become ' + '"end"\n' + ' values (which end depends on the sign of *k*). Note, *k* ' + 'cannot be\n' + ' zero. If *k* is "None", it is treated like "1".\n' + '\n' + '6. **CPython implementation detail:** If *s* and *t* are both\n' + ' strings, some Python implementations such as CPython can ' + 'usually\n' + ' perform an in-place optimization for assignments of the form ' + '"s = s\n' + ' + t" or "s += t". When applicable, this optimization makes\n' + ' quadratic run-time much less likely. This optimization is ' + 'both\n' + ' version and implementation dependent. For performance ' + 'sensitive\n' + ' code, it is preferable to use the "str.join()" method which ' + 'assures\n' + ' consistent linear concatenation performance across versions ' + 'and\n' + ' implementations.\n' + '\n' + ' Changed in version 2.4: Formerly, string concatenation never\n' + ' occurred in-place.\n' + '\n' + '\n' + 'String Methods\n' + '==============\n' + '\n' + 'Below are listed the string methods which both 8-bit strings ' + 'and\n' + 'Unicode objects support. Some of them are also available on\n' + '"bytearray" objects.\n' + '\n' + "In addition, Python's strings support the sequence type methods\n" + 'described in the Sequence Types --- str, unicode, list, tuple,\n' + 'bytearray, buffer, xrange section. To output formatted strings ' + 'use\n' + 'template strings or the "%" operator described in the String\n' + 'Formatting Operations section. Also, see the "re" module for ' + 'string\n' + 'functions based on regular expressions.\n' + '\n' + 'str.capitalize()\n' + '\n' + ' Return a copy of the string with its first character ' + 'capitalized\n' + ' and the rest lowercased.\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.center(width[, fillchar])\n' + '\n' + ' Return centered in a string of length *width*. Padding is ' + 'done\n' + ' using the specified *fillchar* (default is a space).\n' + '\n' + ' Changed in version 2.4: Support for the *fillchar* argument.\n' + '\n' + 'str.count(sub[, start[, end]])\n' + '\n' + ' Return the number of non-overlapping occurrences of substring ' + '*sub*\n' + ' in the range [*start*, *end*]. Optional arguments *start* ' + 'and\n' + ' *end* are interpreted as in slice notation.\n' + '\n' + 'str.decode([encoding[, errors]])\n' + '\n' + ' Decodes the string using the codec registered for ' + '*encoding*.\n' + ' *encoding* defaults to the default string encoding. *errors* ' + 'may\n' + ' be given to set a different error handling scheme. The ' + 'default is\n' + ' "\'strict\'", meaning that encoding errors raise ' + '"UnicodeError".\n' + ' Other possible values are "\'ignore\'", "\'replace\'" and any ' + 'other\n' + ' name registered via "codecs.register_error()", see section ' + 'Codec\n' + ' Base Classes.\n' + '\n' + ' New in version 2.2.\n' + '\n' + ' Changed in version 2.3: Support for other error handling ' + 'schemes\n' + ' added.\n' + '\n' + ' Changed in version 2.7: Support for keyword arguments added.\n' + '\n' + 'str.encode([encoding[, errors]])\n' + '\n' + ' Return an encoded version of the string. Default encoding is ' + 'the\n' + ' current default string encoding. *errors* may be given to ' + 'set a\n' + ' different error handling scheme. The default for *errors* ' + 'is\n' + ' "\'strict\'", meaning that encoding errors raise a ' + '"UnicodeError".\n' + ' Other possible values are "\'ignore\'", "\'replace\'",\n' + ' "\'xmlcharrefreplace\'", "\'backslashreplace\'" and any other ' + 'name\n' + ' registered via "codecs.register_error()", see section Codec ' + 'Base\n' + ' Classes. For a list of possible encodings, see section ' + 'Standard\n' + ' Encodings.\n' + '\n' + ' New in version 2.0.\n' + '\n' + ' Changed in version 2.3: Support for "\'xmlcharrefreplace\'" ' + 'and\n' + ' "\'backslashreplace\'" and other error handling schemes ' + 'added.\n' + '\n' + ' Changed in version 2.7: Support for keyword arguments added.\n' + '\n' + 'str.endswith(suffix[, start[, end]])\n' + '\n' + ' Return "True" if the string ends with the specified ' + '*suffix*,\n' + ' otherwise return "False". *suffix* can also be a tuple of ' + 'suffixes\n' + ' to look for. With optional *start*, test beginning at that\n' + ' position. With optional *end*, stop comparing at that ' + 'position.\n' + '\n' + ' Changed in version 2.5: Accept tuples as *suffix*.\n' + '\n' + 'str.expandtabs([tabsize])\n' + '\n' + ' Return a copy of the string where all tab characters are ' + 'replaced\n' + ' by one or more spaces, depending on the current column and ' + 'the\n' + ' given tab size. Tab positions occur every *tabsize* ' + 'characters\n' + ' (default is 8, giving tab positions at columns 0, 8, 16 and ' + 'so on).\n' + ' To expand the string, the current column is set to zero and ' + 'the\n' + ' string is examined character by character. If the character ' + 'is a\n' + ' tab ("\\t"), one or more space characters are inserted in the ' + 'result\n' + ' until the current column is equal to the next tab position. ' + '(The\n' + ' tab character itself is not copied.) If the character is a ' + 'newline\n' + ' ("\\n") or return ("\\r"), it is copied and the current ' + 'column is\n' + ' reset to zero. Any other character is copied unchanged and ' + 'the\n' + ' current column is incremented by one regardless of how the\n' + ' character is represented when printed.\n' + '\n' + " >>> '01\\t012\\t0123\\t01234'.expandtabs()\n" + " '01 012 0123 01234'\n" + " >>> '01\\t012\\t0123\\t01234'.expandtabs(4)\n" + " '01 012 0123 01234'\n" + '\n' + 'str.find(sub[, start[, end]])\n' + '\n' + ' Return the lowest index in the string where substring *sub* ' + 'is\n' + ' found within the slice "s[start:end]". Optional arguments ' + '*start*\n' + ' and *end* are interpreted as in slice notation. Return "-1" ' + 'if\n' + ' *sub* is not found.\n' + '\n' + ' Note: The "find()" method should be used only if you need to ' + 'know\n' + ' the position of *sub*. To check if *sub* is a substring or ' + 'not,\n' + ' use the "in" operator:\n' + '\n' + " >>> 'Py' in 'Python'\n" + ' True\n' + '\n' + 'str.format(*args, **kwargs)\n' + '\n' + ' Perform a string formatting operation. The string on which ' + 'this\n' + ' method is called can contain literal text or replacement ' + 'fields\n' + ' delimited by braces "{}". Each replacement field contains ' + 'either\n' + ' the numeric index of a positional argument, or the name of a\n' + ' keyword argument. Returns a copy of the string where each\n' + ' replacement field is replaced with the string value of the\n' + ' corresponding argument.\n' + '\n' + ' >>> "The sum of 1 + 2 is {0}".format(1+2)\n' + " 'The sum of 1 + 2 is 3'\n" + '\n' + ' See Format String Syntax for a description of the various\n' + ' formatting options that can be specified in format strings.\n' + '\n' + ' This method of string formatting is the new standard in ' + 'Python 3,\n' + ' and should be preferred to the "%" formatting described in ' + 'String\n' + ' Formatting Operations in new code.\n' + '\n' + ' New in version 2.6.\n' + '\n' + 'str.index(sub[, start[, end]])\n' + '\n' + ' Like "find()", but raise "ValueError" when the substring is ' + 'not\n' + ' found.\n' + '\n' + 'str.isalnum()\n' + '\n' + ' Return true if all characters in the string are alphanumeric ' + 'and\n' + ' there is at least one character, false otherwise.\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.isalpha()\n' + '\n' + ' Return true if all characters in the string are alphabetic ' + 'and\n' + ' there is at least one character, false otherwise.\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.isdigit()\n' + '\n' + ' Return true if all characters in the string are digits and ' + 'there is\n' + ' at least one character, false otherwise.\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.islower()\n' + '\n' + ' Return true if all cased characters [4] in the string are ' + 'lowercase\n' + ' and there is at least one cased character, false otherwise.\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.isspace()\n' + '\n' + ' Return true if there are only whitespace characters in the ' + 'string\n' + ' and there is at least one character, false otherwise.\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.istitle()\n' + '\n' + ' Return true if the string is a titlecased string and there is ' + 'at\n' + ' least one character, for example uppercase characters may ' + 'only\n' + ' follow uncased characters and lowercase characters only cased ' + 'ones.\n' + ' Return false otherwise.\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.isupper()\n' + '\n' + ' Return true if all cased characters [4] in the string are ' + 'uppercase\n' + ' and there is at least one cased character, false otherwise.\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.join(iterable)\n' + '\n' + ' Return a string which is the concatenation of the strings in ' + 'the\n' + ' *iterable* *iterable*. The separator between elements is ' + 'the\n' + ' string providing this method.\n' + '\n' + 'str.ljust(width[, fillchar])\n' + '\n' + ' Return the string left justified in a string of length ' + '*width*.\n' + ' Padding is done using the specified *fillchar* (default is a\n' + ' space). The original string is returned if *width* is less ' + 'than or\n' + ' equal to "len(s)".\n' + '\n' + ' Changed in version 2.4: Support for the *fillchar* argument.\n' + '\n' + 'str.lower()\n' + '\n' + ' Return a copy of the string with all the cased characters ' + '[4]\n' + ' converted to lowercase.\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.lstrip([chars])\n' + '\n' + ' Return a copy of the string with leading characters removed. ' + 'The\n' + ' *chars* argument is a string specifying the set of characters ' + 'to be\n' + ' removed. If omitted or "None", the *chars* argument defaults ' + 'to\n' + ' removing whitespace. The *chars* argument is not a prefix; ' + 'rather,\n' + ' all combinations of its values are stripped:\n' + '\n' + " >>> ' spacious '.lstrip()\n" + " 'spacious '\n" + " >>> 'www.example.com'.lstrip('cmowz.')\n" + " 'example.com'\n" + '\n' + ' Changed in version 2.2.2: Support for the *chars* argument.\n' + '\n' + 'str.partition(sep)\n' + '\n' + ' Split the string at the first occurrence of *sep*, and return ' + 'a\n' + ' 3-tuple containing the part before the separator, the ' + 'separator\n' + ' itself, and the part after the separator. If the separator ' + 'is not\n' + ' found, return a 3-tuple containing the string itself, ' + 'followed by\n' + ' two empty strings.\n' + '\n' + ' New in version 2.5.\n' + '\n' + 'str.replace(old, new[, count])\n' + '\n' + ' Return a copy of the string with all occurrences of substring ' + '*old*\n' + ' replaced by *new*. If the optional argument *count* is ' + 'given, only\n' + ' the first *count* occurrences are replaced.\n' + '\n' + 'str.rfind(sub[, start[, end]])\n' + '\n' + ' Return the highest index in the string where substring *sub* ' + 'is\n' + ' found, such that *sub* is contained within "s[start:end]".\n' + ' Optional arguments *start* and *end* are interpreted as in ' + 'slice\n' + ' notation. Return "-1" on failure.\n' + '\n' + 'str.rindex(sub[, start[, end]])\n' + '\n' + ' Like "rfind()" but raises "ValueError" when the substring ' + '*sub* is\n' + ' not found.\n' + '\n' + 'str.rjust(width[, fillchar])\n' + '\n' + ' Return the string right justified in a string of length ' + '*width*.\n' + ' Padding is done using the specified *fillchar* (default is a\n' + ' space). The original string is returned if *width* is less ' + 'than or\n' + ' equal to "len(s)".\n' + '\n' + ' Changed in version 2.4: Support for the *fillchar* argument.\n' + '\n' + 'str.rpartition(sep)\n' + '\n' + ' Split the string at the last occurrence of *sep*, and return ' + 'a\n' + ' 3-tuple containing the part before the separator, the ' + 'separator\n' + ' itself, and the part after the separator. If the separator ' + 'is not\n' + ' found, return a 3-tuple containing two empty strings, ' + 'followed by\n' + ' the string itself.\n' + '\n' + ' New in version 2.5.\n' + '\n' + 'str.rsplit([sep[, maxsplit]])\n' + '\n' + ' Return a list of the words in the string, using *sep* as the\n' + ' delimiter string. If *maxsplit* is given, at most *maxsplit* ' + 'splits\n' + ' are done, the *rightmost* ones. If *sep* is not specified ' + 'or\n' + ' "None", any whitespace string is a separator. Except for ' + 'splitting\n' + ' from the right, "rsplit()" behaves like "split()" which is\n' + ' described in detail below.\n' + '\n' + ' New in version 2.4.\n' + '\n' + 'str.rstrip([chars])\n' + '\n' + ' Return a copy of the string with trailing characters ' + 'removed. The\n' + ' *chars* argument is a string specifying the set of characters ' + 'to be\n' + ' removed. If omitted or "None", the *chars* argument defaults ' + 'to\n' + ' removing whitespace. The *chars* argument is not a suffix; ' + 'rather,\n' + ' all combinations of its values are stripped:\n' + '\n' + " >>> ' spacious '.rstrip()\n" + " ' spacious'\n" + " >>> 'mississippi'.rstrip('ipz')\n" + " 'mississ'\n" + '\n' + ' Changed in version 2.2.2: Support for the *chars* argument.\n' + '\n' + 'str.split([sep[, maxsplit]])\n' + '\n' + ' Return a list of the words in the string, using *sep* as the\n' + ' delimiter string. If *maxsplit* is given, at most ' + '*maxsplit*\n' + ' splits are done (thus, the list will have at most ' + '"maxsplit+1"\n' + ' elements). If *maxsplit* is not specified or "-1", then ' + 'there is\n' + ' no limit on the number of splits (all possible splits are ' + 'made).\n' + '\n' + ' If *sep* is given, consecutive delimiters are not grouped ' + 'together\n' + ' and are deemed to delimit empty strings (for example,\n' + ' "\'1,,2\'.split(\',\')" returns "[\'1\', \'\', \'2\']"). The ' + '*sep* argument\n' + ' may consist of multiple characters (for example,\n' + ' "\'1<>2<>3\'.split(\'<>\')" returns "[\'1\', \'2\', \'3\']"). ' + 'Splitting an\n' + ' empty string with a specified separator returns "[\'\']".\n' + '\n' + ' If *sep* is not specified or is "None", a different ' + 'splitting\n' + ' algorithm is applied: runs of consecutive whitespace are ' + 'regarded\n' + ' as a single separator, and the result will contain no empty ' + 'strings\n' + ' at the start or end if the string has leading or trailing\n' + ' whitespace. Consequently, splitting an empty string or a ' + 'string\n' + ' consisting of just whitespace with a "None" separator returns ' + '"[]".\n' + '\n' + ' For example, "\' 1 2 3 \'.split()" returns "[\'1\', ' + '\'2\', \'3\']", and\n' + ' "\' 1 2 3 \'.split(None, 1)" returns "[\'1\', \'2 3 ' + '\']".\n' + '\n' + 'str.splitlines([keepends])\n' + '\n' + ' Return a list of the lines in the string, breaking at line\n' + ' boundaries. This method uses the *universal newlines* ' + 'approach to\n' + ' splitting lines. Line breaks are not included in the ' + 'resulting list\n' + ' unless *keepends* is given and true.\n' + '\n' + ' For example, "\'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines()" ' + 'returns "[\'ab\n' + ' c\', \'\', \'de fg\', \'kl\']", while the same call with\n' + ' "splitlines(True)" returns "[\'ab c\\n\', \'\\n\', \'de ' + 'fg\\r\', \'kl\\r\\n\']".\n' + '\n' + ' Unlike "split()" when a delimiter string *sep* is given, ' + 'this\n' + ' method returns an empty list for the empty string, and a ' + 'terminal\n' + ' line break does not result in an extra line.\n' + '\n' + 'str.startswith(prefix[, start[, end]])\n' + '\n' + ' Return "True" if string starts with the *prefix*, otherwise ' + 'return\n' + ' "False". *prefix* can also be a tuple of prefixes to look ' + 'for.\n' + ' With optional *start*, test string beginning at that ' + 'position.\n' + ' With optional *end*, stop comparing string at that position.\n' + '\n' + ' Changed in version 2.5: Accept tuples as *prefix*.\n' + '\n' + 'str.strip([chars])\n' + '\n' + ' Return a copy of the string with the leading and trailing\n' + ' characters removed. The *chars* argument is a string ' + 'specifying the\n' + ' set of characters to be removed. If omitted or "None", the ' + '*chars*\n' + ' argument defaults to removing whitespace. The *chars* ' + 'argument is\n' + ' not a prefix or suffix; rather, all combinations of its ' + 'values are\n' + ' stripped:\n' + '\n' + " >>> ' spacious '.strip()\n" + " 'spacious'\n" + " >>> 'www.example.com'.strip('cmowz.')\n" + " 'example'\n" + '\n' + ' Changed in version 2.2.2: Support for the *chars* argument.\n' + '\n' + 'str.swapcase()\n' + '\n' + ' Return a copy of the string with uppercase characters ' + 'converted to\n' + ' lowercase and vice versa.\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.title()\n' + '\n' + ' Return a titlecased version of the string where words start ' + 'with an\n' + ' uppercase character and the remaining characters are ' + 'lowercase.\n' + '\n' + ' The algorithm uses a simple language-independent definition ' + 'of a\n' + ' word as groups of consecutive letters. The definition works ' + 'in\n' + ' many contexts but it means that apostrophes in contractions ' + 'and\n' + ' possessives form word boundaries, which may not be the ' + 'desired\n' + ' result:\n' + '\n' + ' >>> "they\'re bill\'s friends from the UK".title()\n' + ' "They\'Re Bill\'S Friends From The Uk"\n' + '\n' + ' A workaround for apostrophes can be constructed using ' + 'regular\n' + ' expressions:\n' + '\n' + ' >>> import re\n' + ' >>> def titlecase(s):\n' + ' ... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n' + ' ... lambda mo: mo.group(0)[0].upper() +\n' + ' ... mo.group(0)[1:].lower(),\n' + ' ... s)\n' + ' ...\n' + ' >>> titlecase("they\'re bill\'s friends.")\n' + ' "They\'re Bill\'s Friends."\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.translate(table[, deletechars])\n' + '\n' + ' Return a copy of the string where all characters occurring in ' + 'the\n' + ' optional argument *deletechars* are removed, and the ' + 'remaining\n' + ' characters have been mapped through the given translation ' + 'table,\n' + ' which must be a string of length 256.\n' + '\n' + ' You can use the "maketrans()" helper function in the ' + '"string"\n' + ' module to create a translation table. For string objects, set ' + 'the\n' + ' *table* argument to "None" for translations that only delete\n' + ' characters:\n' + '\n' + " >>> 'read this short text'.translate(None, 'aeiou')\n" + " 'rd ths shrt txt'\n" + '\n' + ' New in version 2.6: Support for a "None" *table* argument.\n' + '\n' + ' For Unicode objects, the "translate()" method does not accept ' + 'the\n' + ' optional *deletechars* argument. Instead, it returns a copy ' + 'of the\n' + ' *s* where all characters have been mapped through the given\n' + ' translation table which must be a mapping of Unicode ordinals ' + 'to\n' + ' Unicode ordinals, Unicode strings or "None". Unmapped ' + 'characters\n' + ' are left untouched. Characters mapped to "None" are deleted. ' + 'Note,\n' + ' a more flexible approach is to create a custom character ' + 'mapping\n' + ' codec using the "codecs" module (see "encodings.cp1251" for ' + 'an\n' + ' example).\n' + '\n' + 'str.upper()\n' + '\n' + ' Return a copy of the string with all the cased characters ' + '[4]\n' + ' converted to uppercase. Note that "str.upper().isupper()" ' + 'might be\n' + ' "False" if "s" contains uncased characters or if the Unicode\n' + ' category of the resulting character(s) is not "Lu" (Letter,\n' + ' uppercase), but e.g. "Lt" (Letter, titlecase).\n' + '\n' + ' For 8-bit strings, this method is locale-dependent.\n' + '\n' + 'str.zfill(width)\n' + '\n' + ' Return the numeric string left filled with zeros in a string ' + 'of\n' + ' length *width*. A sign prefix is handled correctly. The ' + 'original\n' + ' string is returned if *width* is less than or equal to ' + '"len(s)".\n' + '\n' + ' New in version 2.2.2.\n' + '\n' + 'The following methods are present only on unicode objects:\n' + '\n' + 'unicode.isnumeric()\n' + '\n' + ' Return "True" if there are only numeric characters in S, ' + '"False"\n' + ' otherwise. Numeric characters include digit characters, and ' + 'all\n' + ' characters that have the Unicode numeric value property, ' + 'e.g.\n' + ' U+2155, VULGAR FRACTION ONE FIFTH.\n' + '\n' + 'unicode.isdecimal()\n' + '\n' + ' Return "True" if there are only decimal characters in S, ' + '"False"\n' + ' otherwise. Decimal characters include digit characters, and ' + 'all\n' + ' characters that can be used to form decimal-radix numbers, ' + 'e.g.\n' + ' U+0660, ARABIC-INDIC DIGIT ZERO.\n' + '\n' + '\n' + 'String Formatting Operations\n' + '============================\n' + '\n' + 'String and Unicode objects have one unique built-in operation: ' + 'the "%"\n' + 'operator (modulo). This is also known as the string ' + '*formatting* or\n' + '*interpolation* operator. Given "format % values" (where ' + '*format* is\n' + 'a string or Unicode object), "%" conversion specifications in ' + '*format*\n' + 'are replaced with zero or more elements of *values*. The effect ' + 'is\n' + 'similar to the using "sprintf()" in the C language. If *format* ' + 'is a\n' + 'Unicode object, or if any of the objects being converted using ' + 'the\n' + '"%s" conversion are Unicode objects, the result will also be a ' + 'Unicode\n' + 'object.\n' + '\n' + 'If *format* requires a single argument, *values* may be a single ' + 'non-\n' + 'tuple object. [5] Otherwise, *values* must be a tuple with ' + 'exactly\n' + 'the number of items specified by the format string, or a single\n' + 'mapping object (for example, a dictionary).\n' + '\n' + 'A conversion specifier contains two or more characters and has ' + 'the\n' + 'following components, which must occur in this order:\n' + '\n' + '1. The "\'%\'" character, which marks the start of the ' + 'specifier.\n' + '\n' + '2. Mapping key (optional), consisting of a parenthesised ' + 'sequence\n' + ' of characters (for example, "(somename)").\n' + '\n' + '3. Conversion flags (optional), which affect the result of some\n' + ' conversion types.\n' + '\n' + '4. Minimum field width (optional). If specified as an "\'*\'"\n' + ' (asterisk), the actual width is read from the next element of ' + 'the\n' + ' tuple in *values*, and the object to convert comes after the\n' + ' minimum field width and optional precision.\n' + '\n' + '5. Precision (optional), given as a "\'.\'" (dot) followed by ' + 'the\n' + ' precision. If specified as "\'*\'" (an asterisk), the actual ' + 'width\n' + ' is read from the next element of the tuple in *values*, and ' + 'the\n' + ' value to convert comes after the precision.\n' + '\n' + '6. Length modifier (optional).\n' + '\n' + '7. Conversion type.\n' + '\n' + 'When the right argument is a dictionary (or other mapping type), ' + 'then\n' + 'the formats in the string *must* include a parenthesised mapping ' + 'key\n' + 'into that dictionary inserted immediately after the "\'%\'" ' + 'character.\n' + 'The mapping key selects the value to be formatted from the ' + 'mapping.\n' + 'For example:\n' + '\n' + ">>> print '%(language)s has %(number)03d quote types.' % \\\n" + '... {"language": "Python", "number": 2}\n' + 'Python has 002 quote types.\n' + '\n' + 'In this case no "*" specifiers may occur in a format (since ' + 'they\n' + 'require a sequential parameter list).\n' + '\n' + 'The conversion flag characters are:\n' + '\n' + '+-----------+-----------------------------------------------------------------------+\n' + '| Flag | ' + 'Meaning ' + '|\n' + '+===========+=======================================================================+\n' + '| "\'#\'" | The value conversion will use the "alternate ' + 'form" (where defined |\n' + '| | ' + 'below). ' + '|\n' + '+-----------+-----------------------------------------------------------------------+\n' + '| "\'0\'" | The conversion will be zero padded for numeric ' + 'values. |\n' + '+-----------+-----------------------------------------------------------------------+\n' + '| "\'-\'" | The converted value is left adjusted (overrides ' + 'the "\'0\'" conversion |\n' + '| | if both are ' + 'given). |\n' + '+-----------+-----------------------------------------------------------------------+\n' + '| "\' \'" | (a space) A blank should be left before a ' + 'positive number (or empty |\n' + '| | string) produced by a signed ' + 'conversion. |\n' + '+-----------+-----------------------------------------------------------------------+\n' + '| "\'+\'" | A sign character ("\'+\'" or "\'-\'") will ' + 'precede the conversion |\n' + '| | (overrides a "space" ' + 'flag). |\n' + '+-----------+-----------------------------------------------------------------------+\n' + '\n' + 'A length modifier ("h", "l", or "L") may be present, but is ' + 'ignored as\n' + 'it is not necessary for Python -- so e.g. "%ld" is identical to ' + '"%d".\n' + '\n' + 'The conversion types are:\n' + '\n' + '+--------------+-------------------------------------------------------+---------+\n' + '| Conversion | ' + 'Meaning | Notes ' + '|\n' + '+==============+=======================================================+=========+\n' + '| "\'d\'" | Signed integer ' + 'decimal. | |\n' + '+--------------+-------------------------------------------------------+---------+\n' + '| "\'i\'" | Signed integer ' + 'decimal. | |\n' + '+--------------+-------------------------------------------------------+---------+\n' + '| "\'o\'" | Signed octal ' + 'value. | (1) |\n' + '+--------------+-------------------------------------------------------+---------+\n' + '| "\'u\'" | Obsolete type -- it is identical to ' + '"\'d\'". | (7) |\n' + '+--------------+-------------------------------------------------------+---------+\n' + '| "\'x\'" | Signed hexadecimal ' + '(lowercase). | (2) |\n' + '+--------------+-------------------------------------------------------+---------+\n' + '| "\'X\'" | Signed hexadecimal ' + '(uppercase). | (2) |\n' + '+--------------+-------------------------------------------------------+---------+\n' + '| "\'e\'" | Floating point exponential format ' + '(lowercase). | (3) |\n' + '+--------------+-------------------------------------------------------+---------+\n' + '| "\'E\'" | Floating point exponential format ' + '(uppercase). | (3) |\n' + '+--------------+-------------------------------------------------------+---------+\n' + '| "\'f\'" | Floating point decimal ' + 'format. | (3) |\n' + '+--------------+-------------------------------------------------------+---------+\n' + '| "\'F\'" | Floating point decimal ' + 'format. | (3) |\n' + '+--------------+-------------------------------------------------------+---------+\n' + '| "\'g\'" | Floating point format. Uses lowercase ' + 'exponential | (4) |\n' + '| | format if exponent is less than -4 or not less ' + 'than | |\n' + '| | precision, decimal format ' + 'otherwise. | |\n' + '+--------------+-------------------------------------------------------+---------+\n' + '| "\'G\'" | Floating point format. Uses uppercase ' + 'exponential | (4) |\n' + '| | format if exponent is less than -4 or not less ' + 'than | |\n' + '| | precision, decimal format ' + 'otherwise. | |\n' + '+--------------+-------------------------------------------------------+---------+\n' + '| "\'c\'" | Single character (accepts integer or single ' + 'character | |\n' + '| | ' + 'string). | ' + '|\n' + '+--------------+-------------------------------------------------------+---------+\n' + '| "\'r\'" | String (converts any Python object using ' + 'repr()). | (5) |\n' + '+--------------+-------------------------------------------------------+---------+\n' + '| "\'s\'" | String (converts any Python object using ' + '"str()"). | (6) |\n' + '+--------------+-------------------------------------------------------+---------+\n' + '| "\'%\'" | No argument is converted, results in a ' + '"\'%\'" | |\n' + '| | character in the ' + 'result. | |\n' + '+--------------+-------------------------------------------------------+---------+\n' + '\n' + 'Notes:\n' + '\n' + '1. The alternate form causes a leading zero ("\'0\'") to be ' + 'inserted\n' + ' between left-hand padding and the formatting of the number if ' + 'the\n' + ' leading character of the result is not already a zero.\n' + '\n' + '2. The alternate form causes a leading "\'0x\'" or "\'0X\'" ' + '(depending\n' + ' on whether the "\'x\'" or "\'X\'" format was used) to be ' + 'inserted\n' + ' between left-hand padding and the formatting of the number if ' + 'the\n' + ' leading character of the result is not already a zero.\n' + '\n' + '3. The alternate form causes the result to always contain a ' + 'decimal\n' + ' point, even if no digits follow it.\n' + '\n' + ' The precision determines the number of digits after the ' + 'decimal\n' + ' point and defaults to 6.\n' + '\n' + '4. The alternate form causes the result to always contain a ' + 'decimal\n' + ' point, and trailing zeroes are not removed as they would ' + 'otherwise\n' + ' be.\n' + '\n' + ' The precision determines the number of significant digits ' + 'before\n' + ' and after the decimal point and defaults to 6.\n' + '\n' + '5. The "%r" conversion was added in Python 2.0.\n' + '\n' + ' The precision determines the maximal number of characters ' + 'used.\n' + '\n' + '6. If the object or format provided is a "unicode" string, the\n' + ' resulting string will also be "unicode".\n' + '\n' + ' The precision determines the maximal number of characters ' + 'used.\n' + '\n' + '7. See **PEP 237**.\n' + '\n' + 'Since Python strings have an explicit length, "%s" conversions ' + 'do not\n' + 'assume that "\'\\0\'" is the end of the string.\n' + '\n' + 'Changed in version 2.7: "%f" conversions for numbers whose ' + 'absolute\n' + 'value is over 1e50 are no longer replaced by "%g" conversions.\n' + '\n' + 'Additional string operations are defined in standard modules ' + '"string"\n' + 'and "re".\n' + '\n' + '\n' + 'XRange Type\n' + '===========\n' + '\n' + 'The "xrange" type is an immutable sequence which is commonly ' + 'used for\n' + 'looping. The advantage of the "xrange" type is that an ' + '"xrange"\n' + 'object will always take the same amount of memory, no matter the ' + 'size\n' + 'of the range it represents. There are no consistent ' + 'performance\n' + 'advantages.\n' + '\n' + 'XRange objects have very little behavior: they only support ' + 'indexing,\n' + 'iteration, and the "len()" function.\n' + '\n' + '\n' + 'Mutable Sequence Types\n' + '======================\n' + '\n' + 'List and "bytearray" objects support additional operations that ' + 'allow\n' + 'in-place modification of the object. Other mutable sequence ' + 'types\n' + '(when added to the language) should also support these ' + 'operations.\n' + 'Strings and tuples are immutable sequence types: such objects ' + 'cannot\n' + 'be modified once created. The following operations are defined ' + 'on\n' + 'mutable sequence types (where *x* is an arbitrary object):\n' + '\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| Operation | ' + 'Result | Notes |\n' + '+================================+==================================+=======================+\n' + '| "s[i] = x" | item *i* of *s* is replaced ' + 'by | |\n' + '| | ' + '*x* | |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s[i:j] = t" | slice of *s* from *i* to *j* ' + 'is | |\n' + '| | replaced by the contents of ' + 'the | |\n' + '| | iterable ' + '*t* | |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "del s[i:j]" | same as "s[i:j] = ' + '[]" | |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s[i:j:k] = t" | the elements of "s[i:j:k]" ' + 'are | (1) |\n' + '| | replaced by those of ' + '*t* | |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "del s[i:j:k]" | removes the elements ' + 'of | |\n' + '| | "s[i:j:k]" from the ' + 'list | |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s.append(x)" | same as "s[len(s):len(s)] = ' + '[x]" | (2) |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s.extend(x)" or "s += t" | for the most part the same ' + 'as | (3) |\n' + '| | "s[len(s):len(s)] = ' + 'x" | |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s *= n" | updates *s* with its ' + 'contents | (11) |\n' + '| | repeated *n* ' + 'times | |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s.count(x)" | return number of *i*\'s for ' + 'which | |\n' + '| | "s[i] == ' + 'x" | |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s.index(x[, i[, j]])" | return smallest *k* such ' + 'that | (4) |\n' + '| | "s[k] == x" and "i <= k < ' + 'j" | |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s.insert(i, x)" | same as "s[i:i] = ' + '[x]" | (5) |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s.pop([i])" | same as "x = s[i]; del ' + 's[i]; | (6) |\n' + '| | return ' + 'x" | |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s.remove(x)" | same as "del ' + 's[s.index(x)]" | (4) |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s.reverse()" | reverses the items of *s* ' + 'in | (7) |\n' + '| | ' + 'place | |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s.sort([cmp[, key[, | sort the items of *s* in ' + 'place | (7)(8)(9)(10) |\n' + '| reverse]]])" ' + '| | |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '\n' + 'Notes:\n' + '\n' + '1. *t* must have the same length as the slice it is replacing.\n' + '\n' + '2. The C implementation of Python has historically accepted\n' + ' multiple parameters and implicitly joined them into a tuple; ' + 'this\n' + ' no longer works in Python 2.0. Use of this misfeature has ' + 'been\n' + ' deprecated since Python 1.4.\n' + '\n' + '3. *x* can be any iterable object.\n' + '\n' + '4. Raises "ValueError" when *x* is not found in *s*. When a\n' + ' negative index is passed as the second or third parameter to ' + 'the\n' + ' "index()" method, the list length is added, as for slice ' + 'indices.\n' + ' If it is still negative, it is truncated to zero, as for ' + 'slice\n' + ' indices.\n' + '\n' + ' Changed in version 2.3: Previously, "index()" didn\'t have ' + 'arguments\n' + ' for specifying start and stop positions.\n' + '\n' + '5. When a negative index is passed as the first parameter to ' + 'the\n' + ' "insert()" method, the list length is added, as for slice ' + 'indices.\n' + ' If it is still negative, it is truncated to zero, as for ' + 'slice\n' + ' indices.\n' + '\n' + ' Changed in version 2.3: Previously, all negative indices ' + 'were\n' + ' truncated to zero.\n' + '\n' + '6. The "pop()" method\'s optional argument *i* defaults to "-1", ' + 'so\n' + ' that by default the last item is removed and returned.\n' + '\n' + '7. The "sort()" and "reverse()" methods modify the list in ' + 'place\n' + ' for economy of space when sorting or reversing a large list. ' + 'To\n' + " remind you that they operate by side effect, they don't " + 'return the\n' + ' sorted or reversed list.\n' + '\n' + '8. The "sort()" method takes optional arguments for controlling ' + 'the\n' + ' comparisons.\n' + '\n' + ' *cmp* specifies a custom comparison function of two arguments ' + '(list\n' + ' items) which should return a negative, zero or positive ' + 'number\n' + ' depending on whether the first argument is considered smaller ' + 'than,\n' + ' equal to, or larger than the second argument: "cmp=lambda ' + 'x,y:\n' + ' cmp(x.lower(), y.lower())". The default value is "None".\n' + '\n' + ' *key* specifies a function of one argument that is used to ' + 'extract\n' + ' a comparison key from each list element: "key=str.lower". ' + 'The\n' + ' default value is "None".\n' + '\n' + ' *reverse* is a boolean value. If set to "True", then the ' + 'list\n' + ' elements are sorted as if each comparison were reversed.\n' + '\n' + ' In general, the *key* and *reverse* conversion processes are ' + 'much\n' + ' faster than specifying an equivalent *cmp* function. This ' + 'is\n' + ' because *cmp* is called multiple times for each list element ' + 'while\n' + ' *key* and *reverse* touch each element only once. Use\n' + ' "functools.cmp_to_key()" to convert an old-style *cmp* ' + 'function to\n' + ' a *key* function.\n' + '\n' + ' Changed in version 2.3: Support for "None" as an equivalent ' + 'to\n' + ' omitting *cmp* was added.\n' + '\n' + ' Changed in version 2.4: Support for *key* and *reverse* was ' + 'added.\n' + '\n' + '9. Starting with Python 2.3, the "sort()" method is guaranteed ' + 'to\n' + ' be stable. A sort is stable if it guarantees not to change ' + 'the\n' + ' relative order of elements that compare equal --- this is ' + 'helpful\n' + ' for sorting in multiple passes (for example, sort by ' + 'department,\n' + ' then by salary grade).\n' + '\n' + '10. **CPython implementation detail:** While a list is being\n' + ' sorted, the effect of attempting to mutate, or even inspect, ' + 'the\n' + ' list is undefined. The C implementation of Python 2.3 and ' + 'newer\n' + ' makes the list appear empty for the duration, and raises\n' + ' "ValueError" if it can detect that the list has been ' + 'mutated\n' + ' during a sort.\n' + '\n' + '11. The value *n* is an integer, or an object implementing\n' + ' "__index__()". Zero and negative values of *n* clear the\n' + ' sequence. Items in the sequence are not copied; they are\n' + ' referenced multiple times, as explained for "s * n" under ' + 'Sequence\n' + ' Types --- str, unicode, list, tuple, bytearray, buffer, ' + 'xrange.\n', + 'typesseq-mutable': '\n' + 'Mutable Sequence Types\n' + '**********************\n' + '\n' + 'List and "bytearray" objects support additional ' + 'operations that allow\n' + 'in-place modification of the object. Other mutable ' + 'sequence types\n' + '(when added to the language) should also support these ' + 'operations.\n' + 'Strings and tuples are immutable sequence types: such ' + 'objects cannot\n' + 'be modified once created. The following operations are ' + 'defined on\n' + 'mutable sequence types (where *x* is an arbitrary ' + 'object):\n' + '\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| Operation | ' + 'Result | Notes ' + '|\n' + '+================================+==================================+=======================+\n' + '| "s[i] = x" | item *i* of *s* is ' + 'replaced by | |\n' + '| | ' + '*x* | ' + '|\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s[i:j] = t" | slice of *s* from *i* ' + 'to *j* is | |\n' + '| | replaced by the ' + 'contents of the | |\n' + '| | iterable ' + '*t* | |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "del s[i:j]" | same as "s[i:j] = ' + '[]" | |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s[i:j:k] = t" | the elements of ' + '"s[i:j:k]" are | (1) |\n' + '| | replaced by those of ' + '*t* | |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "del s[i:j:k]" | removes the elements ' + 'of | |\n' + '| | "s[i:j:k]" from the ' + 'list | |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s.append(x)" | same as ' + '"s[len(s):len(s)] = [x]" | (2) |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s.extend(x)" or "s += t" | for the most part the ' + 'same as | (3) |\n' + '| | "s[len(s):len(s)] = ' + 'x" | |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s *= n" | updates *s* with its ' + 'contents | (11) |\n' + '| | repeated *n* ' + 'times | |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s.count(x)" | return number of ' + "*i*'s for which | |\n" + '| | "s[i] == ' + 'x" | |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s.index(x[, i[, j]])" | return smallest *k* ' + 'such that | (4) |\n' + '| | "s[k] == x" and "i <= ' + 'k < j" | |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s.insert(i, x)" | same as "s[i:i] = ' + '[x]" | (5) |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s.pop([i])" | same as "x = s[i]; ' + 'del s[i]; | (6) |\n' + '| | return ' + 'x" | |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s.remove(x)" | same as "del ' + 's[s.index(x)]" | (4) |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s.reverse()" | reverses the items of ' + '*s* in | (7) |\n' + '| | ' + 'place | ' + '|\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '| "s.sort([cmp[, key[, | sort the items of *s* ' + 'in place | (7)(8)(9)(10) |\n' + '| reverse]]])" ' + '| ' + '| |\n' + '+--------------------------------+----------------------------------+-----------------------+\n' + '\n' + 'Notes:\n' + '\n' + '1. *t* must have the same length as the slice it is ' + 'replacing.\n' + '\n' + '2. The C implementation of Python has historically ' + 'accepted\n' + ' multiple parameters and implicitly joined them into a ' + 'tuple; this\n' + ' no longer works in Python 2.0. Use of this ' + 'misfeature has been\n' + ' deprecated since Python 1.4.\n' + '\n' + '3. *x* can be any iterable object.\n' + '\n' + '4. Raises "ValueError" when *x* is not found in *s*. ' + 'When a\n' + ' negative index is passed as the second or third ' + 'parameter to the\n' + ' "index()" method, the list length is added, as for ' + 'slice indices.\n' + ' If it is still negative, it is truncated to zero, as ' + 'for slice\n' + ' indices.\n' + '\n' + ' Changed in version 2.3: Previously, "index()" didn\'t ' + 'have arguments\n' + ' for specifying start and stop positions.\n' + '\n' + '5. When a negative index is passed as the first ' + 'parameter to the\n' + ' "insert()" method, the list length is added, as for ' + 'slice indices.\n' + ' If it is still negative, it is truncated to zero, as ' + 'for slice\n' + ' indices.\n' + '\n' + ' Changed in version 2.3: Previously, all negative ' + 'indices were\n' + ' truncated to zero.\n' + '\n' + '6. The "pop()" method\'s optional argument *i* defaults ' + 'to "-1", so\n' + ' that by default the last item is removed and ' + 'returned.\n' + '\n' + '7. The "sort()" and "reverse()" methods modify the list ' + 'in place\n' + ' for economy of space when sorting or reversing a ' + 'large list. To\n' + ' remind you that they operate by side effect, they ' + "don't return the\n" + ' sorted or reversed list.\n' + '\n' + '8. The "sort()" method takes optional arguments for ' + 'controlling the\n' + ' comparisons.\n' + '\n' + ' *cmp* specifies a custom comparison function of two ' + 'arguments (list\n' + ' items) which should return a negative, zero or ' + 'positive number\n' + ' depending on whether the first argument is considered ' + 'smaller than,\n' + ' equal to, or larger than the second argument: ' + '"cmp=lambda x,y:\n' + ' cmp(x.lower(), y.lower())". The default value is ' + '"None".\n' + '\n' + ' *key* specifies a function of one argument that is ' + 'used to extract\n' + ' a comparison key from each list element: ' + '"key=str.lower". The\n' + ' default value is "None".\n' + '\n' + ' *reverse* is a boolean value. If set to "True", then ' + 'the list\n' + ' elements are sorted as if each comparison were ' + 'reversed.\n' + '\n' + ' In general, the *key* and *reverse* conversion ' + 'processes are much\n' + ' faster than specifying an equivalent *cmp* function. ' + 'This is\n' + ' because *cmp* is called multiple times for each list ' + 'element while\n' + ' *key* and *reverse* touch each element only once. ' + 'Use\n' + ' "functools.cmp_to_key()" to convert an old-style ' + '*cmp* function to\n' + ' a *key* function.\n' + '\n' + ' Changed in version 2.3: Support for "None" as an ' + 'equivalent to\n' + ' omitting *cmp* was added.\n' + '\n' + ' Changed in version 2.4: Support for *key* and ' + '*reverse* was added.\n' + '\n' + '9. Starting with Python 2.3, the "sort()" method is ' + 'guaranteed to\n' + ' be stable. A sort is stable if it guarantees not to ' + 'change the\n' + ' relative order of elements that compare equal --- ' + 'this is helpful\n' + ' for sorting in multiple passes (for example, sort by ' + 'department,\n' + ' then by salary grade).\n' + '\n' + '10. **CPython implementation detail:** While a list is ' + 'being\n' + ' sorted, the effect of attempting to mutate, or even ' + 'inspect, the\n' + ' list is undefined. The C implementation of Python ' + '2.3 and newer\n' + ' makes the list appear empty for the duration, and ' + 'raises\n' + ' "ValueError" if it can detect that the list has been ' + 'mutated\n' + ' during a sort.\n' + '\n' + '11. The value *n* is an integer, or an object ' + 'implementing\n' + ' "__index__()". Zero and negative values of *n* ' + 'clear the\n' + ' sequence. Items in the sequence are not copied; ' + 'they are\n' + ' referenced multiple times, as explained for "s * n" ' + 'under Sequence\n' + ' Types --- str, unicode, list, tuple, bytearray, ' + 'buffer, xrange.\n', + 'unary': '\n' + 'Unary arithmetic and bitwise operations\n' + '***************************************\n' + '\n' + 'All unary arithmetic and bitwise operations have the same ' + 'priority:\n' + '\n' + ' u_expr ::= power | "-" u_expr | "+" u_expr | "~" u_expr\n' + '\n' + 'The unary "-" (minus) operator yields the negation of its numeric\n' + 'argument.\n' + '\n' + 'The unary "+" (plus) operator yields its numeric argument ' + 'unchanged.\n' + '\n' + 'The unary "~" (invert) operator yields the bitwise inversion of ' + 'its\n' + 'plain or long integer argument. The bitwise inversion of "x" is\n' + 'defined as "-(x+1)". It only applies to integral numbers.\n' + '\n' + 'In all three cases, if the argument does not have the proper type, ' + 'a\n' + '"TypeError" exception is raised.\n', + 'while': '\n' + 'The "while" statement\n' + '*********************\n' + '\n' + 'The "while" statement is used for repeated execution as long as an\n' + 'expression is true:\n' + '\n' + ' while_stmt ::= "while" expression ":" suite\n' + ' ["else" ":" suite]\n' + '\n' + 'This repeatedly tests the expression and, if it is true, executes ' + 'the\n' + 'first suite; if the expression is false (which may be the first ' + 'time\n' + 'it is tested) the suite of the "else" clause, if present, is ' + 'executed\n' + 'and the loop terminates.\n' + '\n' + 'A "break" statement executed in the first suite terminates the ' + 'loop\n' + 'without executing the "else" clause\'s suite. A "continue" ' + 'statement\n' + 'executed in the first suite skips the rest of the suite and goes ' + 'back\n' + 'to testing the expression.\n', + 'with': '\n' + 'The "with" statement\n' + '********************\n' + '\n' + 'New in version 2.5.\n' + '\n' + 'The "with" statement is used to wrap the execution of a block with\n' + 'methods defined by a context manager (see section With Statement\n' + 'Context Managers). This allows common "try"..."except"..."finally"\n' + 'usage patterns to be encapsulated for convenient reuse.\n' + '\n' + ' with_stmt ::= "with" with_item ("," with_item)* ":" suite\n' + ' with_item ::= expression ["as" target]\n' + '\n' + 'The execution of the "with" statement with one "item" proceeds as\n' + 'follows:\n' + '\n' + '1. The context expression (the expression given in the "with_item")\n' + ' is evaluated to obtain a context manager.\n' + '\n' + '2. The context manager\'s "__exit__()" is loaded for later use.\n' + '\n' + '3. The context manager\'s "__enter__()" method is invoked.\n' + '\n' + '4. If a target was included in the "with" statement, the return\n' + ' value from "__enter__()" is assigned to it.\n' + '\n' + ' Note: The "with" statement guarantees that if the "__enter__()"\n' + ' method returns without an error, then "__exit__()" will always ' + 'be\n' + ' called. Thus, if an error occurs during the assignment to the\n' + ' target list, it will be treated the same as an error occurring\n' + ' within the suite would be. See step 6 below.\n' + '\n' + '5. The suite is executed.\n' + '\n' + '6. The context manager\'s "__exit__()" method is invoked. If an\n' + ' exception caused the suite to be exited, its type, value, and\n' + ' traceback are passed as arguments to "__exit__()". Otherwise, ' + 'three\n' + ' "None" arguments are supplied.\n' + '\n' + ' If the suite was exited due to an exception, and the return ' + 'value\n' + ' from the "__exit__()" method was false, the exception is ' + 'reraised.\n' + ' If the return value was true, the exception is suppressed, and\n' + ' execution continues with the statement following the "with"\n' + ' statement.\n' + '\n' + ' If the suite was exited for any reason other than an exception, ' + 'the\n' + ' return value from "__exit__()" is ignored, and execution ' + 'proceeds\n' + ' at the normal location for the kind of exit that was taken.\n' + '\n' + 'With more than one item, the context managers are processed as if\n' + 'multiple "with" statements were nested:\n' + '\n' + ' with A() as a, B() as b:\n' + ' suite\n' + '\n' + 'is equivalent to\n' + '\n' + ' with A() as a:\n' + ' with B() as b:\n' + ' suite\n' + '\n' + 'Note: In Python 2.5, the "with" statement is only allowed when the\n' + ' "with_statement" feature has been enabled. It is always enabled ' + 'in\n' + ' Python 2.6.\n' + '\n' + 'Changed in version 2.7: Support for multiple context expressions.\n' + '\n' + 'See also:\n' + '\n' + ' **PEP 343** - The "with" statement\n' + ' The specification, background, and examples for the Python ' + '"with"\n' + ' statement.\n', + 'yield': '\n' + 'The "yield" statement\n' + '*********************\n' + '\n' + ' yield_stmt ::= yield_expression\n' + '\n' + 'The "yield" statement is only used when defining a generator ' + 'function,\n' + 'and is only used in the body of the generator function. Using a\n' + '"yield" statement in a function definition is sufficient to cause ' + 'that\n' + 'definition to create a generator function instead of a normal\n' + 'function.\n' + '\n' + 'When a generator function is called, it returns an iterator known ' + 'as a\n' + 'generator iterator, or more commonly, a generator. The body of ' + 'the\n' + "generator function is executed by calling the generator's " + '"next()"\n' + 'method repeatedly until it raises an exception.\n' + '\n' + 'When a "yield" statement is executed, the state of the generator ' + 'is\n' + 'frozen and the value of "expression_list" is returned to ' + '"next()"\'s\n' + 'caller. By "frozen" we mean that all local state is retained,\n' + 'including the current bindings of local variables, the instruction\n' + 'pointer, and the internal evaluation stack: enough information is\n' + 'saved so that the next time "next()" is invoked, the function can\n' + 'proceed exactly as if the "yield" statement were just another ' + 'external\n' + 'call.\n' + '\n' + 'As of Python version 2.5, the "yield" statement is now allowed in ' + 'the\n' + '"try" clause of a "try" ... "finally" construct. If the generator ' + 'is\n' + 'not resumed before it is finalized (by reaching a zero reference ' + 'count\n' + "or by being garbage collected), the generator-iterator's " + '"close()"\n' + 'method will be called, allowing any pending "finally" clauses to\n' + 'execute.\n' + '\n' + 'For full details of "yield" semantics, refer to the Yield ' + 'expressions\n' + 'section.\n' + '\n' + 'Note: In Python 2.2, the "yield" statement was only allowed when ' + 'the\n' + ' "generators" feature has been enabled. This "__future__" import\n' + ' statement was used to enable the feature:\n' + '\n' + ' from __future__ import generators\n' + '\n' + 'See also:\n' + '\n' + ' **PEP 255** - Simple Generators\n' + ' The proposal for adding generators and the "yield" statement ' + 'to\n' + ' Python.\n' + '\n' + ' **PEP 342** - Coroutines via Enhanced Generators\n' + ' The proposal that, among other generator enhancements, ' + 'proposed\n' + ' allowing "yield" to appear inside a "try" ... "finally" ' + 'block.\n'} -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 18:12:42 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 11 Jun 2016 22:12:42 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogMi43LjEyIHJlbGVh?= =?utf-8?q?se_candidate_1?= Message-ID: <20160611221242.11470.59225.9A39450A@psf.io> https://hg.python.org/cpython/rev/13912cd1e7e8 changeset: 101898:13912cd1e7e8 branch: 2.7 tag: v2.7.12rc1 user: Benjamin Peterson date: Sat Jun 11 14:46:26 2016 -0700 summary: 2.7.12 release candidate 1 files: Include/patchlevel.h | 8 ++++---- Misc/NEWS | 8 ++++---- README | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -22,12 +22,12 @@ /*--start constants--*/ #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 7 -#define PY_MICRO_VERSION 11 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL -#define PY_RELEASE_SERIAL 0 +#define PY_MICRO_VERSION 12 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA +#define PY_RELEASE_SERIAL 1 /* Version as a string */ -#define PY_VERSION "2.7.11+" +#define PY_VERSION "2.7.12rc1" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository). Empty diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,10 +2,10 @@ Python News +++++++++++ -What's New in Python 2.7.12? -============================ - -*Release date: XXXX-XX-XX* +What's New in Python 2.7.12 release candidate 1? +================================================ + +*Release date: 2016-06-12* Core and Builtins ----------------- diff --git a/README b/README --- a/README +++ b/README @@ -1,4 +1,4 @@ -This is Python version 2.7.11 +This is Python version 2.7.12 ============================= Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 18:12:43 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 11 Jun 2016 22:12:43 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogb2ZmIHRvIDIuNy4x?= =?utf-8?q?3?= Message-ID: <20160611221242.114404.82602.B4E141BE@psf.io> https://hg.python.org/cpython/rev/45444e30b415 changeset: 101900:45444e30b415 branch: 2.7 user: Benjamin Peterson date: Sat Jun 11 15:12:35 2016 -0700 summary: off to 2.7.13 files: Include/patchlevel.h | 2 +- Misc/NEWS | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -27,7 +27,7 @@ #define PY_RELEASE_SERIAL 1 /* Version as a string */ -#define PY_VERSION "2.7.12rc1" +#define PY_VERSION "2.7.12rc1+" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository). Empty diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,6 +2,18 @@ Python News +++++++++++ +What's New in Python 2.7.13? +============================ + +*Release date: XXXX-XX-XX* + +Core and Builtins +----------------- + +Library +------- + + What's New in Python 2.7.12 release candidate 1? ================================================ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 18:12:43 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 11 Jun 2016 22:12:43 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Added_tag_v2?= =?utf-8?q?=2E7=2E12rc1_for_changeset_13912cd1e7e8?= Message-ID: <20160611221242.114316.31359.D90AB641@psf.io> https://hg.python.org/cpython/rev/5811fcfe1043 changeset: 101899:5811fcfe1043 branch: 2.7 user: Benjamin Peterson date: Sat Jun 11 14:46:35 2016 -0700 summary: Added tag v2.7.12rc1 for changeset 13912cd1e7e8 files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -172,3 +172,4 @@ 15c95b7d81dcf821daade360741e00714667653f v2.7.10 82dd9545bd93d6e7a9821e1dabc7b25508d0fa3a v2.7.11rc1 6d1b6a68f775fada9877d295e62958bafa1ca11e v2.7.11 +13912cd1e7e8fc6986f42822f5439ae1f2bc0d7d v2.7.12rc1 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 19:59:29 2016 From: python-checkins at python.org (lukasz.langa) Date: Sat, 11 Jun 2016 23:59:29 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_3=2E5=2C_issue_=2327194?= Message-ID: <20160611235929.11544.69846.3ADC4F9D@psf.io> https://hg.python.org/cpython/rev/a4f918de25e5 changeset: 101902:a4f918de25e5 parent: 101896:27b0dbaf0ea8 parent: 101901:b63474aa8a5f user: ?ukasz Langa date: Sat Jun 11 16:56:18 2016 -0700 summary: Merge 3.5, issue #27194 files: Lib/tarfile.py | 4 ++-- Misc/ACKS | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/tarfile.py b/Lib/tarfile.py --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -2153,10 +2153,10 @@ for offset, size in tarinfo.sparse: target.seek(offset) copyfileobj(source, target, size, ReadError) + target.seek(tarinfo.size) + target.truncate() else: copyfileobj(source, target, tarinfo.size, ReadError) - target.seek(tarinfo.size) - target.truncate() def makeunknown(self, tarinfo, targetpath): """Make a file from a TarInfo object with an unknown type diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -462,6 +462,7 @@ Martin Franklin Kent Frazier Bruce Frederiksen +Jason Fried Robin Friedrich Bradley Froehle Ivan Frohne -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 19:59:29 2016 From: python-checkins at python.org (lukasz.langa) Date: Sat, 11 Jun 2016 23:59:29 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MTk0?= =?utf-8?q?=3A_superfluous_truncate_calls_in_tarfile=2Epy_slow_down_extrac?= =?utf-8?q?tion?= Message-ID: <20160611235929.87676.53234.13E0F302@psf.io> https://hg.python.org/cpython/rev/b63474aa8a5f changeset: 101901:b63474aa8a5f branch: 3.5 parent: 101893:f3c36afdedae user: ?ukasz Langa date: Sat Jun 11 16:42:36 2016 -0700 summary: Issue #27194: superfluous truncate calls in tarfile.py slow down extraction Patch by Jason Fried. files: Lib/tarfile.py | 4 ++-- Misc/ACKS | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/tarfile.py b/Lib/tarfile.py --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -2150,10 +2150,10 @@ for offset, size in tarinfo.sparse: target.seek(offset) copyfileobj(source, target, size, ReadError) + target.seek(tarinfo.size) + target.truncate() else: copyfileobj(source, target, tarinfo.size, ReadError) - target.seek(tarinfo.size) - target.truncate() def makeunknown(self, tarinfo, targetpath): """Make a file from a TarInfo object with an unknown type diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -458,6 +458,7 @@ Martin Franklin Kent Frazier Bruce Frederiksen +Jason Fried Robin Friedrich Bradley Froehle Ivan Frohne -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 20:56:50 2016 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 12 Jun 2016 00:56:50 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?q?=29=3A_merge_heads?= Message-ID: <20160612005649.10026.61339.95B3A361@psf.io> https://hg.python.org/cpython/rev/c3d193566986 changeset: 101904:c3d193566986 parent: 101903:13ea0a1d7dde parent: 101902:a4f918de25e5 user: Gregory P. Smith date: Sat Jun 11 17:56:40 2016 -0700 summary: merge heads files: Lib/tarfile.py | 4 ++-- Misc/ACKS | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/tarfile.py b/Lib/tarfile.py --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -2153,10 +2153,10 @@ for offset, size in tarinfo.sparse: target.seek(offset) copyfileobj(source, target, size, ReadError) + target.seek(tarinfo.size) + target.truncate() else: copyfileobj(source, target, tarinfo.size, ReadError) - target.seek(tarinfo.size) - target.truncate() def makeunknown(self, tarinfo, targetpath): """Make a file from a TarInfo object with an unknown type diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -462,6 +462,7 @@ Martin Franklin Kent Frazier Bruce Frederiksen +Jason Fried Robin Friedrich Bradley Froehle Ivan Frohne -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 20:56:50 2016 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 12 Jun 2016 00:56:50 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_issue15468_-_use_sha256_in?= =?utf-8?q?stead_of_md5_or_sha1_in_the_examples=2E?= Message-ID: <20160612005649.9990.36693.1F9CD232@psf.io> https://hg.python.org/cpython/rev/13ea0a1d7dde changeset: 101903:13ea0a1d7dde parent: 101896:27b0dbaf0ea8 user: Gregory P. Smith date: Sat Jun 11 17:56:12 2016 -0700 summary: issue15468 - use sha256 instead of md5 or sha1 in the examples. document that md5 may be missing in the rare case someone is using a "FIPS compliant" build. I've only ever heard of Redhat creating one of those - CPython itself offers no such build mode out of the box. files: Doc/library/hashlib.rst | 18 ++++++++++-------- 1 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Doc/library/hashlib.rst b/Doc/library/hashlib.rst --- a/Doc/library/hashlib.rst +++ b/Doc/library/hashlib.rst @@ -39,8 +39,8 @@ --------------- There is one constructor method named for each type of :dfn:`hash`. All return -a hash object with the same simple interface. For example: use :func:`sha1` to -create a SHA1 hash object. You can now feed this object with :term:`bytes-like +a hash object with the same simple interface. For example: use :func:`sha256` to +create a SHA-256 hash object. You can now feed this object with :term:`bytes-like objects ` (normally :class:`bytes`) using the :meth:`update` method. At any point you can ask it for the :dfn:`digest` of the concatenation of the data fed to it so far using the :meth:`digest` or @@ -59,21 +59,23 @@ .. index:: single: OpenSSL; (use in module hashlib) Constructors for hash algorithms that are always present in this module are -:func:`md5`, :func:`sha1`, :func:`sha224`, :func:`sha256`, :func:`sha384`, -and :func:`sha512`. Additional algorithms may also be available depending upon -the OpenSSL library that Python uses on your platform. +:func:`sha1`, :func:`sha224`, :func:`sha256`, :func:`sha384`, +and :func:`sha512`. :func:`md5` is normally available as well, though it +may be missing if you are using a rare "FIPS compliant" build of Python. +Additional algorithms may also be available depending upon the OpenSSL +library that Python uses on your platform. For example, to obtain the digest of the byte string ``b'Nobody inspects the spammish repetition'``:: >>> import hashlib - >>> m = hashlib.md5() + >>> m = hashlib.sha256() >>> m.update(b"Nobody inspects") >>> m.update(b" the spammish repetition") >>> m.digest() - b'\xbbd\x9c\x83\xdd\x1e\xa5\xc9\xd9\xde\xc9\xa1\x8d\xf0\xff\xe9' + b'\x03\x1e\xdd}Ae\x15\x93\xc5\xfe\\\x00o\xa5u+7\xfd\xdf\xf7\xbcN\x84:\xa6\xaf\x0c\x95\x0fK\x94\x06' >>> m.digest_size - 16 + 32 >>> m.block_size 64 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 21:02:20 2016 From: python-checkins at python.org (gregory.p.smith) Date: Sun, 12 Jun 2016 01:02:20 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Clarify_that_md5_is_in_the?= =?utf-8?q?_algorithms=5Fguaranteed_list_despite_what?= Message-ID: <20160612010219.99059.31791.60DD8A6B@psf.io> https://hg.python.org/cpython/rev/1cfd627bee05 changeset: 101905:1cfd627bee05 user: Gregory P. Smith date: Sat Jun 11 18:02:13 2016 -0700 summary: Clarify that md5 is in the algorithms_guaranteed list despite what some upstream vendors may do to their odd "FIPS compliant" builds. issue15468. files: Doc/library/hashlib.rst | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Doc/library/hashlib.rst b/Doc/library/hashlib.rst --- a/Doc/library/hashlib.rst +++ b/Doc/library/hashlib.rst @@ -104,7 +104,9 @@ .. data:: algorithms_guaranteed A set containing the names of the hash algorithms guaranteed to be supported - by this module on all platforms. + by this module on all platforms. Note that 'md5' is in this list despite + some upstream vendors offering an odd "FIPS compliant" Python build that + excludes it. .. versionadded:: 3.2 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 21:07:38 2016 From: python-checkins at python.org (lukasz.langa) Date: Sun, 12 Jun 2016 01:07:38 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?q?=29=3A_merge_heads?= Message-ID: <20160612010738.81210.72830.F5E8018B@psf.io> https://hg.python.org/cpython/rev/795502f83718 changeset: 101908:795502f83718 parent: 101907:389b7456a053 parent: 101905:1cfd627bee05 user: ?ukasz Langa date: Sat Jun 11 18:07:28 2016 -0700 summary: merge heads files: Doc/library/hashlib.rst | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Doc/library/hashlib.rst b/Doc/library/hashlib.rst --- a/Doc/library/hashlib.rst +++ b/Doc/library/hashlib.rst @@ -104,7 +104,9 @@ .. data:: algorithms_guaranteed A set containing the names of the hash algorithms guaranteed to be supported - by this module on all platforms. + by this module on all platforms. Note that 'md5' is in this list despite + some upstream vendors offering an odd "FIPS compliant" Python build that + excludes it. .. versionadded:: 3.2 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 21:07:38 2016 From: python-checkins at python.org (lukasz.langa) Date: Sun, 12 Jun 2016 01:07:38 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzE0MjA5?= =?utf-8?q?=3A_pkgutil=2Eiter=5Fzipimport=5Fmodules_ignores_the_prefix_for?= =?utf-8?q?_packages?= Message-ID: <20160612010737.81140.77904.1840766C@psf.io> https://hg.python.org/cpython/rev/9649acf7d472 changeset: 101906:9649acf7d472 branch: 3.5 parent: 101901:b63474aa8a5f user: ?ukasz Langa date: Sat Jun 11 18:02:46 2016 -0700 summary: Issue #14209: pkgutil.iter_zipimport_modules ignores the prefix for packages Patch by James Pickering. files: Lib/pkgutil.py | 2 +- Lib/test/test_pkgutil.py | 82 ++++++++++++++++++++++++++- Misc/ACKS | 1 + 3 files changed, 81 insertions(+), 4 deletions(-) diff --git a/Lib/pkgutil.py b/Lib/pkgutil.py --- a/Lib/pkgutil.py +++ b/Lib/pkgutil.py @@ -375,7 +375,7 @@ if len(fn)==2 and fn[1].startswith('__init__.py'): if fn[0] not in yielded: yielded[fn[0]] = 1 - yield fn[0], True + yield prefix + fn[0], True if len(fn)!=1: continue diff --git a/Lib/test/test_pkgutil.py b/Lib/test/test_pkgutil.py --- a/Lib/test/test_pkgutil.py +++ b/Lib/test/test_pkgutil.py @@ -7,7 +7,6 @@ import os import os.path import tempfile -import types import shutil import zipfile @@ -101,6 +100,83 @@ for t in pkgutil.walk_packages(path=[self.dirname]): self.fail("unexpected package found") + def test_walkpackages_filesys(self): + pkg1 = 'test_walkpackages_filesys' + pkg1_dir = os.path.join(self.dirname, pkg1) + os.mkdir(pkg1_dir) + f = open(os.path.join(pkg1_dir, '__init__.py'), "wb") + f.close() + os.mkdir(os.path.join(pkg1_dir, 'sub')) + f = open(os.path.join(pkg1_dir, 'sub', '__init__.py'), "wb") + f.close() + f = open(os.path.join(pkg1_dir, 'sub', 'mod.py'), "wb") + f.close() + + # Now, to juice it up, let's add the opposite packages, too. + pkg2 = 'sub' + pkg2_dir = os.path.join(self.dirname, pkg2) + os.mkdir(pkg2_dir) + f = open(os.path.join(pkg2_dir, '__init__.py'), "wb") + f.close() + os.mkdir(os.path.join(pkg2_dir, 'test_walkpackages_filesys')) + f = open(os.path.join(pkg2_dir, 'test_walkpackages_filesys', '__init__.py'), "wb") + f.close() + f = open(os.path.join(pkg2_dir, 'test_walkpackages_filesys', 'mod.py'), "wb") + f.close() + + expected = [ + 'sub', + 'sub.test_walkpackages_filesys', + 'sub.test_walkpackages_filesys.mod', + 'test_walkpackages_filesys', + 'test_walkpackages_filesys.sub', + 'test_walkpackages_filesys.sub.mod', + ] + actual= [e[1] for e in pkgutil.walk_packages([self.dirname])] + self.assertEqual(actual, expected) + + for pkg in expected: + if pkg.endswith('mod'): + continue + del sys.modules[pkg] + + def test_walkpackages_zipfile(self): + """Tests the same as test_walkpackages_filesys, only with a zip file.""" + + zip = 'test_walkpackages_zipfile.zip' + pkg1 = 'test_walkpackages_zipfile' + pkg2 = 'sub' + + zip_file = os.path.join(self.dirname, zip) + z = zipfile.ZipFile(zip_file, 'w') + z.writestr(pkg2 + '/__init__.py', "") + z.writestr(pkg2 + '/' + pkg1 + '/__init__.py', "") + z.writestr(pkg2 + '/' + pkg1 + '/mod.py', "") + z.writestr(pkg1 + '/__init__.py', "") + z.writestr(pkg1 + '/' + pkg2 + '/__init__.py', "") + z.writestr(pkg1 + '/' + pkg2 + '/mod.py', "") + z.close() + + sys.path.insert(0, zip_file) + expected = [ + 'sub', + 'sub.test_walkpackages_zipfile', + 'sub.test_walkpackages_zipfile.mod', + 'test_walkpackages_zipfile', + 'test_walkpackages_zipfile.sub', + 'test_walkpackages_zipfile.sub.mod', + ] + actual= [e[1] for e in pkgutil.walk_packages([zip_file])] + self.assertEqual(actual, expected) + del sys.path[0] + + for pkg in expected: + if pkg.endswith('mod'): + continue + del sys.modules[pkg] + + + class PkgutilPEP302Tests(unittest.TestCase): class MyTestLoader(object): @@ -324,11 +400,11 @@ def test_importer_deprecated(self): with self.check_deprecated(): - x = pkgutil.ImpImporter("") + pkgutil.ImpImporter("") def test_loader_deprecated(self): with self.check_deprecated(): - x = pkgutil.ImpLoader("", "", "", "") + pkgutil.ImpLoader("", "", "", "") def test_get_loader_avoids_emulation(self): with check_warnings() as w: diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1137,6 +1137,7 @@ Gavrie Philipson Adrian Phillips Christopher J. Phoenix +James Pickering Neale Pickett Jim St. Pierre Dan Pierson -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 21:07:38 2016 From: python-checkins at python.org (lukasz.langa) Date: Sun, 12 Jun 2016 01:07:38 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_3=2E5=2C_issue_=2314209?= Message-ID: <20160612010738.81381.34225.BB7E4215@psf.io> https://hg.python.org/cpython/rev/389b7456a053 changeset: 101907:389b7456a053 parent: 101904:c3d193566986 parent: 101906:9649acf7d472 user: ?ukasz Langa date: Sat Jun 11 18:05:42 2016 -0700 summary: Merge 3.5, issue #14209 files: Lib/pkgutil.py | 2 +- Lib/test/test_pkgutil.py | 82 ++++++++++++++++++++++++++- Misc/ACKS | 1 + 3 files changed, 81 insertions(+), 4 deletions(-) diff --git a/Lib/pkgutil.py b/Lib/pkgutil.py --- a/Lib/pkgutil.py +++ b/Lib/pkgutil.py @@ -375,7 +375,7 @@ if len(fn)==2 and fn[1].startswith('__init__.py'): if fn[0] not in yielded: yielded[fn[0]] = 1 - yield fn[0], True + yield prefix + fn[0], True if len(fn)!=1: continue diff --git a/Lib/test/test_pkgutil.py b/Lib/test/test_pkgutil.py --- a/Lib/test/test_pkgutil.py +++ b/Lib/test/test_pkgutil.py @@ -7,7 +7,6 @@ import os import os.path import tempfile -import types import shutil import zipfile @@ -101,6 +100,83 @@ for t in pkgutil.walk_packages(path=[self.dirname]): self.fail("unexpected package found") + def test_walkpackages_filesys(self): + pkg1 = 'test_walkpackages_filesys' + pkg1_dir = os.path.join(self.dirname, pkg1) + os.mkdir(pkg1_dir) + f = open(os.path.join(pkg1_dir, '__init__.py'), "wb") + f.close() + os.mkdir(os.path.join(pkg1_dir, 'sub')) + f = open(os.path.join(pkg1_dir, 'sub', '__init__.py'), "wb") + f.close() + f = open(os.path.join(pkg1_dir, 'sub', 'mod.py'), "wb") + f.close() + + # Now, to juice it up, let's add the opposite packages, too. + pkg2 = 'sub' + pkg2_dir = os.path.join(self.dirname, pkg2) + os.mkdir(pkg2_dir) + f = open(os.path.join(pkg2_dir, '__init__.py'), "wb") + f.close() + os.mkdir(os.path.join(pkg2_dir, 'test_walkpackages_filesys')) + f = open(os.path.join(pkg2_dir, 'test_walkpackages_filesys', '__init__.py'), "wb") + f.close() + f = open(os.path.join(pkg2_dir, 'test_walkpackages_filesys', 'mod.py'), "wb") + f.close() + + expected = [ + 'sub', + 'sub.test_walkpackages_filesys', + 'sub.test_walkpackages_filesys.mod', + 'test_walkpackages_filesys', + 'test_walkpackages_filesys.sub', + 'test_walkpackages_filesys.sub.mod', + ] + actual= [e[1] for e in pkgutil.walk_packages([self.dirname])] + self.assertEqual(actual, expected) + + for pkg in expected: + if pkg.endswith('mod'): + continue + del sys.modules[pkg] + + def test_walkpackages_zipfile(self): + """Tests the same as test_walkpackages_filesys, only with a zip file.""" + + zip = 'test_walkpackages_zipfile.zip' + pkg1 = 'test_walkpackages_zipfile' + pkg2 = 'sub' + + zip_file = os.path.join(self.dirname, zip) + z = zipfile.ZipFile(zip_file, 'w') + z.writestr(pkg2 + '/__init__.py', "") + z.writestr(pkg2 + '/' + pkg1 + '/__init__.py', "") + z.writestr(pkg2 + '/' + pkg1 + '/mod.py', "") + z.writestr(pkg1 + '/__init__.py', "") + z.writestr(pkg1 + '/' + pkg2 + '/__init__.py', "") + z.writestr(pkg1 + '/' + pkg2 + '/mod.py', "") + z.close() + + sys.path.insert(0, zip_file) + expected = [ + 'sub', + 'sub.test_walkpackages_zipfile', + 'sub.test_walkpackages_zipfile.mod', + 'test_walkpackages_zipfile', + 'test_walkpackages_zipfile.sub', + 'test_walkpackages_zipfile.sub.mod', + ] + actual= [e[1] for e in pkgutil.walk_packages([zip_file])] + self.assertEqual(actual, expected) + del sys.path[0] + + for pkg in expected: + if pkg.endswith('mod'): + continue + del sys.modules[pkg] + + + class PkgutilPEP302Tests(unittest.TestCase): class MyTestLoader(object): @@ -324,11 +400,11 @@ def test_importer_deprecated(self): with self.check_deprecated(): - x = pkgutil.ImpImporter("") + pkgutil.ImpImporter("") def test_loader_deprecated(self): with self.check_deprecated(): - x = pkgutil.ImpLoader("", "", "", "") + pkgutil.ImpLoader("", "", "", "") def test_get_loader_avoids_emulation(self): with check_warnings() as w: diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1147,6 +1147,7 @@ Adrian Phillips Dusty Phillips Christopher J. Phoenix +James Pickering Neale Pickett Jim St. Pierre Dan Pierson -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 22:06:35 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 12 Jun 2016 02:06:35 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI0MTM2?= =?utf-8?q?=3A_Document_generalized_unpacking=2C_PEP_448?= Message-ID: <20160612020635.20084.81516.4BD20D4C@psf.io> https://hg.python.org/cpython/rev/a7e04b4e51b2 changeset: 101909:a7e04b4e51b2 branch: 3.5 parent: 101906:9649acf7d472 user: Martin Panter date: Sun Jun 12 01:46:50 2016 +0000 summary: Issue #24136: Document generalized unpacking, PEP 448 Based on patches by Konstantin Molchanov and Neil Girdhar. files: Doc/library/functools.rst | 2 +- Doc/reference/expressions.rst | 82 +++++++++++++++------ Doc/reference/simple_stmts.rst | 6 +- Doc/whatsnew/3.5.rst | 4 +- Misc/NEWS | 2 + 5 files changed, 66 insertions(+), 30 deletions(-) diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -177,7 +177,7 @@ def newfunc(*fargs, **fkeywords): newkeywords = keywords.copy() newkeywords.update(fkeywords) - return func(*(args + fargs), **newkeywords) + return func(*args, *fargs, **newkeywords) newfunc.func = func newfunc.args = args newfunc.keywords = keywords diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -133,7 +133,7 @@ A parenthesized form is an optional expression list enclosed in parentheses: .. productionlist:: - parenth_form: "(" [`expression_list`] ")" + parenth_form: "(" [`starred_expression`] ")" A parenthesized expression list yields whatever that expression list yields: if the list contains at least one comma, it yields a tuple; otherwise, it yields @@ -202,7 +202,7 @@ brackets: .. productionlist:: - list_display: "[" [`expression_list` | `comprehension`] "]" + list_display: "[" [`starred_list` | `comprehension`] "]" A list display yields a new list object, the contents being specified by either a list of expressions or a comprehension. When a comma-separated list of @@ -223,7 +223,7 @@ displays by the lack of colons separating keys and values: .. productionlist:: - set_display: "{" (`expression_list` | `comprehension`) "}" + set_display: "{" (`starred_list` | `comprehension`) "}" A set display yields a new mutable set object, the contents being specified by either a sequence of expressions or a comprehension. When a comma-separated @@ -250,7 +250,7 @@ .. productionlist:: dict_display: "{" [`key_datum_list` | `dict_comprehension`] "}" key_datum_list: `key_datum` ("," `key_datum`)* [","] - key_datum: `expression` ":" `expression` + key_datum: `expression` ":" `expression` | "**" `or_expr` dict_comprehension: `expression` ":" `expression` `comp_for` A dictionary display yields a new dictionary object. @@ -261,6 +261,16 @@ that you can specify the same key multiple times in the key/datum list, and the final dictionary's value for that key will be the last one given. +.. index:: unpacking; dictionary, **; in dictionary displays + +A double asterisk ``**`` denotes :dfn:`dictionary unpacking`. +Its operand must be a :term:`mapping`. Each mapping item is added +to the new dictionary. Later values replace values already set by +earlier key/datum pairs and earlier dictionary unpackings. + +.. versionadded:: 3.5 + Unpacking into dictionary displays, originally proposed by :pep:`448`. + A dict comprehension, in contrast to list and set comprehensions, needs two expressions separated with a colon followed by the usual "for" and "if" clauses. When the comprehension is run, the resulting key and value elements are inserted @@ -649,15 +659,15 @@ .. productionlist:: call: `primary` "(" [`argument_list` [","] | `comprehension`] ")" - argument_list: `positional_arguments` ["," `keyword_arguments`] - : ["," "*" `expression`] ["," `keyword_arguments`] - : ["," "**" `expression`] - : | `keyword_arguments` ["," "*" `expression`] - : ["," `keyword_arguments`] ["," "**" `expression`] - : | "*" `expression` ["," `keyword_arguments`] ["," "**" `expression`] - : | "**" `expression` - positional_arguments: `expression` ("," `expression`)* - keyword_arguments: `keyword_item` ("," `keyword_item`)* + argument_list: `positional_arguments` ["," `starred_and_keywords`] + : ["," `keywords_arguments`] + : | `starred_and_keywords` ["," `keywords_arguments`] + : | `keywords_arguments` + positional_arguments: ["*"] `expression` ("," ["*"] `expression`)* + starred_and_keywords: ("*" `expression` | `keyword_item`) + : ("," "*" `expression` | "," `keyword_item`)* + keywords_arguments: (`keyword_item` | "**" `expression`) + : ("," `keyword_item` | "**" `expression`)* keyword_item: `identifier` "=" `expression` An optional trailing comma may be present after the positional and keyword arguments @@ -715,17 +725,18 @@ .. index:: single: *; in function calls + single: unpacking; in function calls If the syntax ``*expression`` appears in the function call, ``expression`` must -evaluate to an iterable. Elements from this iterable are treated as if they -were additional positional arguments; if there are positional arguments -*x1*, ..., *xN*, and ``expression`` evaluates to a sequence *y1*, ..., *yM*, -this is equivalent to a call with M+N positional arguments *x1*, ..., *xN*, -*y1*, ..., *yM*. +evaluate to an :term:`iterable`. Elements from these iterables are +treated as if they were additional positional arguments. For the call +``f(x1, x2, *y, x3, x4)``, if *y* evaluates to a sequence *y1*, ..., *yM*, +this is equivalent to a call with M+4 positional arguments *x1*, *x2*, +*y1*, ..., *yM*, *x3*, *x4*. A consequence of this is that although the ``*expression`` syntax may appear -*after* some keyword arguments, it is processed *before* the keyword arguments -(and the ``**expression`` argument, if any -- see below). So:: +*after* explicit keyword arguments, it is processed *before* the +keyword arguments (and any ``**expression`` arguments -- see below). So:: >>> def f(a, b): ... print(a, b) @@ -746,13 +757,20 @@ single: **; in function calls If the syntax ``**expression`` appears in the function call, ``expression`` must -evaluate to a mapping, the contents of which are treated as additional keyword -arguments. In the case of a keyword appearing in both ``expression`` and as an -explicit keyword argument, a :exc:`TypeError` exception is raised. +evaluate to a :term:`mapping`, the contents of which are treated as +additional keyword arguments. If a keyword is already present +(as an explicit keyword argument, or from another unpacking), +a :exc:`TypeError` exception is raised. Formal parameters using the syntax ``*identifier`` or ``**identifier`` cannot be used as positional argument slots or as keyword argument names. +.. versionchanged:: 3.5 + Function calls accept any number of ``*`` and ``**`` unpackings, + positional arguments may follow iterable unpackings (``*``), + and keyword arguments may follow dictionary unpackings (``**``). + Originally proposed by :pep:`448`. + A call always returns some value, possibly ``None``, unless it raises an exception. How this value is computed depends on the type of the callable object. @@ -1407,13 +1425,29 @@ .. productionlist:: expression_list: `expression` ( "," `expression` )* [","] + starred_list: `starred_item` ( "," `starred_item` )* [","] + starred_expression: `expression` | ( `starred_item` "," )* [`starred_item`] + starred_item: `expression` | "*" `or_expr` .. index:: object: tuple -An expression list containing at least one comma yields a tuple. The length of +Except when part of a list or set display, an expression list +containing at least one comma yields a tuple. The length of the tuple is the number of expressions in the list. The expressions are evaluated from left to right. +.. index:: + pair: iterable; unpacking + single: *; in expression lists + +An asterisk ``*`` denotes :dfn:`iterable unpacking`. Its operand must be +an :term:`iterable`. The iterable is expanded into a sequence of items, +which are included in the new tuple, list, or set, at the site of +the unpacking. + +.. versionadded:: 3.5 + Iterable unpacking in expression lists, originally proposed by :pep:`448`. + .. index:: pair: trailing; comma The trailing comma is required only to create a single tuple (a.k.a. a 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 @@ -45,7 +45,7 @@ expression statement is: .. productionlist:: - expression_stmt: `expression_list` + expression_stmt: `starred_expression` An expression statement evaluates the expression list (which may be a single expression). @@ -81,7 +81,7 @@ attributes or items of mutable objects: .. productionlist:: - assignment_stmt: (`target_list` "=")+ (`expression_list` | `yield_expression`) + assignment_stmt: (`target_list` "=")+ (`starred_expression` | `yield_expression`) target_list: `target` ("," `target`)* [","] target: `identifier` : | "(" `target_list` ")" @@ -892,7 +892,7 @@ nonlocal_stmt: "nonlocal" `identifier` ("," `identifier`)* .. XXX add when implemented - : ["=" (`target_list` "=")+ expression_list] + : ["=" (`target_list` "=")+ starred_expression] : | "nonlocal" identifier augop expression_list The :keyword:`nonlocal` statement causes the listed identifiers to refer to diff --git a/Doc/whatsnew/3.5.rst b/Doc/whatsnew/3.5.rst --- a/Doc/whatsnew/3.5.rst +++ b/Doc/whatsnew/3.5.rst @@ -320,7 +320,7 @@ :pep:`448` extends the allowed uses of the ``*`` iterable unpacking operator and ``**`` dictionary unpacking operator. It is now possible -to use an arbitrary number of unpackings in function calls:: +to use an arbitrary number of unpackings in :ref:`function calls `:: >>> print(*[1], *[2], 3, *[4, 5]) 1 2 3 4 5 @@ -333,7 +333,7 @@ 1 2 3 4 Similarly, tuple, list, set, and dictionary displays allow multiple -unpackings:: +unpackings (see :ref:`exprlists` and :ref:`dict`):: >>> *range(4), 4 (0, 1, 2, 3, 4) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -591,6 +591,8 @@ Documentation ------------- +- Issue #24136: Document the new PEP 448 unpacking syntax of 3.5. + - Issue #26736: Used HTTPS for external links in the documentation if possible. - Issue #6953: Rework the Readline module documentation to group related -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 22:06:36 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 12 Jun 2016 02:06:36 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2324136=3A_Adjust_f?= =?utf-8?q?-strings_doc_for_interable_unpacking?= Message-ID: <20160612020635.101606.14528.1B8045CD@psf.io> https://hg.python.org/cpython/rev/2c10f0e92256 changeset: 101911:2c10f0e92256 user: Martin Panter date: Sun Jun 12 01:56:24 2016 +0000 summary: Issue #24136: Adjust f-strings doc for interable unpacking 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 @@ -619,7 +619,8 @@ .. productionlist:: f_string: (`literal_char` | "{{" | "}}" | `replacement_field`)* replacement_field: "{" `f_expression` ["!" `conversion`] [":" `format_spec`] "}" - f_expression: `conditional_expression` ("," `conditional_expression`)* [","] + f_expression: (`conditional_expression` | "*" `or_expr`) + : ("," `conditional_expression` | "," "*" `or_expr`)* [","] : | `yield_expression` conversion: "s" | "r" | "a" format_spec: (`literal_char` | NULL | `replacement_field`)* -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 22:06:36 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 12 Jun 2016 02:06:36 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Drop_unused_import?= Message-ID: <20160612020635.114316.49204.3C23FE1B@psf.io> https://hg.python.org/cpython/rev/0146e422f0b3 changeset: 101912:0146e422f0b3 user: Martin Panter date: Sun Jun 12 01:56:50 2016 +0000 summary: Drop unused import files: Lib/_pyio.py | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/Lib/_pyio.py b/Lib/_pyio.py --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -6,7 +6,6 @@ import abc import codecs import errno -import array import stat import sys # Import _thread instead of threading to reduce startup cost -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 22:06:36 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 12 Jun 2016 02:06:36 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2324136=3A_Merge_unpacking_doc_from_3=2E5?= Message-ID: <20160612020635.101550.78754.37ED9A83@psf.io> https://hg.python.org/cpython/rev/4cf3389cd8e6 changeset: 101910:4cf3389cd8e6 parent: 101908:795502f83718 parent: 101909:a7e04b4e51b2 user: Martin Panter date: Sun Jun 12 01:55:03 2016 +0000 summary: Issue #24136: Merge unpacking doc from 3.5 files: Doc/library/functools.rst | 2 +- Doc/reference/expressions.rst | 82 +++++++++++++++------ Doc/reference/simple_stmts.rst | 6 +- Doc/whatsnew/3.5.rst | 4 +- Misc/NEWS | 2 + 5 files changed, 66 insertions(+), 30 deletions(-) diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -177,7 +177,7 @@ def newfunc(*fargs, **fkeywords): newkeywords = keywords.copy() newkeywords.update(fkeywords) - return func(*(args + fargs), **newkeywords) + return func(*args, *fargs, **newkeywords) newfunc.func = func newfunc.args = args newfunc.keywords = keywords diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -133,7 +133,7 @@ A parenthesized form is an optional expression list enclosed in parentheses: .. productionlist:: - parenth_form: "(" [`expression_list`] ")" + parenth_form: "(" [`starred_expression`] ")" A parenthesized expression list yields whatever that expression list yields: if the list contains at least one comma, it yields a tuple; otherwise, it yields @@ -202,7 +202,7 @@ brackets: .. productionlist:: - list_display: "[" [`expression_list` | `comprehension`] "]" + list_display: "[" [`starred_list` | `comprehension`] "]" A list display yields a new list object, the contents being specified by either a list of expressions or a comprehension. When a comma-separated list of @@ -223,7 +223,7 @@ displays by the lack of colons separating keys and values: .. productionlist:: - set_display: "{" (`expression_list` | `comprehension`) "}" + set_display: "{" (`starred_list` | `comprehension`) "}" A set display yields a new mutable set object, the contents being specified by either a sequence of expressions or a comprehension. When a comma-separated @@ -250,7 +250,7 @@ .. productionlist:: dict_display: "{" [`key_datum_list` | `dict_comprehension`] "}" key_datum_list: `key_datum` ("," `key_datum`)* [","] - key_datum: `expression` ":" `expression` + key_datum: `expression` ":" `expression` | "**" `or_expr` dict_comprehension: `expression` ":" `expression` `comp_for` A dictionary display yields a new dictionary object. @@ -261,6 +261,16 @@ that you can specify the same key multiple times in the key/datum list, and the final dictionary's value for that key will be the last one given. +.. index:: unpacking; dictionary, **; in dictionary displays + +A double asterisk ``**`` denotes :dfn:`dictionary unpacking`. +Its operand must be a :term:`mapping`. Each mapping item is added +to the new dictionary. Later values replace values already set by +earlier key/datum pairs and earlier dictionary unpackings. + +.. versionadded:: 3.5 + Unpacking into dictionary displays, originally proposed by :pep:`448`. + A dict comprehension, in contrast to list and set comprehensions, needs two expressions separated with a colon followed by the usual "for" and "if" clauses. When the comprehension is run, the resulting key and value elements are inserted @@ -649,15 +659,15 @@ .. productionlist:: call: `primary` "(" [`argument_list` [","] | `comprehension`] ")" - argument_list: `positional_arguments` ["," `keyword_arguments`] - : ["," "*" `expression`] ["," `keyword_arguments`] - : ["," "**" `expression`] - : | `keyword_arguments` ["," "*" `expression`] - : ["," `keyword_arguments`] ["," "**" `expression`] - : | "*" `expression` ["," `keyword_arguments`] ["," "**" `expression`] - : | "**" `expression` - positional_arguments: `expression` ("," `expression`)* - keyword_arguments: `keyword_item` ("," `keyword_item`)* + argument_list: `positional_arguments` ["," `starred_and_keywords`] + : ["," `keywords_arguments`] + : | `starred_and_keywords` ["," `keywords_arguments`] + : | `keywords_arguments` + positional_arguments: ["*"] `expression` ("," ["*"] `expression`)* + starred_and_keywords: ("*" `expression` | `keyword_item`) + : ("," "*" `expression` | "," `keyword_item`)* + keywords_arguments: (`keyword_item` | "**" `expression`) + : ("," `keyword_item` | "**" `expression`)* keyword_item: `identifier` "=" `expression` An optional trailing comma may be present after the positional and keyword arguments @@ -715,17 +725,18 @@ .. index:: single: *; in function calls + single: unpacking; in function calls If the syntax ``*expression`` appears in the function call, ``expression`` must -evaluate to an iterable. Elements from this iterable are treated as if they -were additional positional arguments; if there are positional arguments -*x1*, ..., *xN*, and ``expression`` evaluates to a sequence *y1*, ..., *yM*, -this is equivalent to a call with M+N positional arguments *x1*, ..., *xN*, -*y1*, ..., *yM*. +evaluate to an :term:`iterable`. Elements from these iterables are +treated as if they were additional positional arguments. For the call +``f(x1, x2, *y, x3, x4)``, if *y* evaluates to a sequence *y1*, ..., *yM*, +this is equivalent to a call with M+4 positional arguments *x1*, *x2*, +*y1*, ..., *yM*, *x3*, *x4*. A consequence of this is that although the ``*expression`` syntax may appear -*after* some keyword arguments, it is processed *before* the keyword arguments -(and the ``**expression`` argument, if any -- see below). So:: +*after* explicit keyword arguments, it is processed *before* the +keyword arguments (and any ``**expression`` arguments -- see below). So:: >>> def f(a, b): ... print(a, b) @@ -746,13 +757,20 @@ single: **; in function calls If the syntax ``**expression`` appears in the function call, ``expression`` must -evaluate to a mapping, the contents of which are treated as additional keyword -arguments. In the case of a keyword appearing in both ``expression`` and as an -explicit keyword argument, a :exc:`TypeError` exception is raised. +evaluate to a :term:`mapping`, the contents of which are treated as +additional keyword arguments. If a keyword is already present +(as an explicit keyword argument, or from another unpacking), +a :exc:`TypeError` exception is raised. Formal parameters using the syntax ``*identifier`` or ``**identifier`` cannot be used as positional argument slots or as keyword argument names. +.. versionchanged:: 3.5 + Function calls accept any number of ``*`` and ``**`` unpackings, + positional arguments may follow iterable unpackings (``*``), + and keyword arguments may follow dictionary unpackings (``**``). + Originally proposed by :pep:`448`. + A call always returns some value, possibly ``None``, unless it raises an exception. How this value is computed depends on the type of the callable object. @@ -1407,13 +1425,29 @@ .. productionlist:: expression_list: `expression` ( "," `expression` )* [","] + starred_list: `starred_item` ( "," `starred_item` )* [","] + starred_expression: `expression` | ( `starred_item` "," )* [`starred_item`] + starred_item: `expression` | "*" `or_expr` .. index:: object: tuple -An expression list containing at least one comma yields a tuple. The length of +Except when part of a list or set display, an expression list +containing at least one comma yields a tuple. The length of the tuple is the number of expressions in the list. The expressions are evaluated from left to right. +.. index:: + pair: iterable; unpacking + single: *; in expression lists + +An asterisk ``*`` denotes :dfn:`iterable unpacking`. Its operand must be +an :term:`iterable`. The iterable is expanded into a sequence of items, +which are included in the new tuple, list, or set, at the site of +the unpacking. + +.. versionadded:: 3.5 + Iterable unpacking in expression lists, originally proposed by :pep:`448`. + .. index:: pair: trailing; comma The trailing comma is required only to create a single tuple (a.k.a. a 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 @@ -45,7 +45,7 @@ expression statement is: .. productionlist:: - expression_stmt: `expression_list` + expression_stmt: `starred_expression` An expression statement evaluates the expression list (which may be a single expression). @@ -81,7 +81,7 @@ attributes or items of mutable objects: .. productionlist:: - assignment_stmt: (`target_list` "=")+ (`expression_list` | `yield_expression`) + assignment_stmt: (`target_list` "=")+ (`starred_expression` | `yield_expression`) target_list: `target` ("," `target`)* [","] target: `identifier` : | "(" [`target_list`] ")" @@ -892,7 +892,7 @@ nonlocal_stmt: "nonlocal" `identifier` ("," `identifier`)* .. XXX add when implemented - : ["=" (`target_list` "=")+ expression_list] + : ["=" (`target_list` "=")+ starred_expression] : | "nonlocal" identifier augop expression_list The :keyword:`nonlocal` statement causes the listed identifiers to refer to diff --git a/Doc/whatsnew/3.5.rst b/Doc/whatsnew/3.5.rst --- a/Doc/whatsnew/3.5.rst +++ b/Doc/whatsnew/3.5.rst @@ -320,7 +320,7 @@ :pep:`448` extends the allowed uses of the ``*`` iterable unpacking operator and ``**`` dictionary unpacking operator. It is now possible -to use an arbitrary number of unpackings in function calls:: +to use an arbitrary number of unpackings in :ref:`function calls `:: >>> print(*[1], *[2], 3, *[4, 5]) 1 2 3 4 5 @@ -333,7 +333,7 @@ 1 2 3 4 Similarly, tuple, list, set, and dictionary displays allow multiple -unpackings:: +unpackings (see :ref:`exprlists` and :ref:`dict`):: >>> *range(4), 4 (0, 1, 2, 3, 4) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -225,6 +225,8 @@ Documentation ------------- +- Issue #24136: Document the new PEP 448 unpacking syntax of 3.5. + - Issue #22558: Add remaining doc links to source code for Python-coded modules. Patch by Yoni Lavi. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 11 22:26:32 2016 From: python-checkins at python.org (eric.snow) Date: Sun, 12 Jun 2016 02:26:32 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Add_stricter_constraints_to_m?= =?utf-8?b?YW51YWxseSBzZXQgX19kZWZpbml0aW9uX29yZGVyX18u?= Message-ID: <20160612022632.9646.85137.8B0B21C9@psf.io> https://hg.python.org/peps/rev/53d1281bd9da changeset: 6369:53d1281bd9da user: Eric Snow date: Sat Jun 11 20:22:50 2016 -0600 summary: Add stricter constraints to manually set __definition_order__. files: pep-0520.txt | 39 ++++++++++++++++++++++++++++++++++----- 1 files changed, 34 insertions(+), 5 deletions(-) diff --git a/pep-0520.txt b/pep-0520.txt --- a/pep-0520.txt +++ b/pep-0520.txt @@ -61,19 +61,21 @@ * the order in which class attributes are defined is preserved in the new ``__definition_order__`` attribute on each class * "dunder" attributes (e.g. ``__init__``, ``__module__``) are ignored -* ``__definition_order__`` is a tuple +* ``__definition_order__`` is a ``tuple`` (or ``None``) * ``__definition_order__`` is a read-only attribute * ``__definition_order__`` is always set: - 1. if ``__definition_order__`` is defined in the class body then the - value is used as-is, though the attribute will still be read-only + 1. if ``__definition_order__`` is defined in the class body then it + must be a ``tuple`` of identifiers or ``None``; any other value + will result in ``TypeError`` 2. classes that do not have a class definition (e.g. builtins) have their ``__definition_order__`` set to ``None`` 3. classes for which `__prepare__()`` returned something other than ``OrderedDict`` (or a subclass) have their ``__definition_order__`` set to ``None`` (except where #1 applies) -The following code demonstrates roughly equivalent semantics:: +The following code demonstrates roughly equivalent semantics for the +default behavior:: class Meta(type): def __prepare__(cls, *args, **kwargs): @@ -115,7 +117,8 @@ Note that ``__definition_order__`` is centered on the class definition body. The use cases for dealing with the class namespace (``__dict__``) post-definition are a separate matter. ``__definition_order__`` would -be a significantly misleading name for a supporting feature. +be a significantly misleading name for a feature focused on more than +class definition. See [nick_concern_] for more discussion. @@ -127,6 +130,32 @@ ``__definition_order__``. Instead, for nearly everyone they would only be clutter, causing the same extra work for everyone. +Why None instead of an empty tuple? +----------------------------------- + +A key objective of adding ``__definition_order__`` is to preserve +information in class definitions which was lost prior to this PEP. +One consequence is that ``__definition_order__`` implies an original +class definition. Using ``None`` allows us to clearly distinquish +classes that do not have a definition order. An empty tuple clearly +indicates a class that came from a definition statement but did not +define any attributes there. + +Why None instead of not setting the attribute? +---------------------------------------------- + +The absence of an attribute requires more complex handling than ``None`` +does for consumers of ``__definition_order__``. + +Why constrain manually set values? +---------------------------------- + +If ``__definition_order__`` is manually set in the class body then it +will be used. We require it to be a tuple of identifiers (or ``None``) +so that consumers of ``__definition_order__`` may have a consistent +expectation for the value. That helps maximize the feature's +usefulness. + Why is __definition_order__ even necessary? ------------------------------------------- -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Sat Jun 11 22:26:33 2016 From: python-checkins at python.org (eric.snow) Date: Sun, 12 Jun 2016 02:26:33 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Clarify_some_example_code=2E?= Message-ID: <20160612022632.87542.49965.8FA0C8E0@psf.io> https://hg.python.org/peps/rev/eeda48b6daf3 changeset: 6370:eeda48b6daf3 user: Eric Snow date: Sat Jun 11 20:24:35 2016 -0600 summary: Clarify some example code. files: pep-0520.txt | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pep-0520.txt b/pep-0520.txt --- a/pep-0520.txt +++ b/pep-0520.txt @@ -85,8 +85,8 @@ ham = None eggs = 5 __definition_order__ = tuple(k for k in locals() - if (not k.startswith('__') or - not k.endswith('__'))) + if not (k.startswith('__') and + k.endswith('__'))) Note that [pep487_] proposes a similar solution, albeit as part of a broader proposal. -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Sat Jun 11 22:26:33 2016 From: python-checkins at python.org (eric.snow) Date: Sun, 12 Jun 2016 02:26:33 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Clarify_the_distinction_betwe?= =?utf-8?q?en_the_definition_ns_and_=5F=5Fdict=5F=5F=2E?= Message-ID: <20160612022632.101632.75927.E082A73D@psf.io> https://hg.python.org/peps/rev/b72a8581978c changeset: 6368:b72a8581978c user: Eric Snow date: Sat Jun 11 19:42:03 2016 -0600 summary: Clarify the distinction between the definition ns and __dict__. files: pep-0520.txt | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pep-0520.txt b/pep-0520.txt --- a/pep-0520.txt +++ b/pep-0520.txt @@ -14,15 +14,19 @@ Abstract ======== +When a class is defined using a ``class`` statement, the class body is +executed within a namespace. After the execution completes, that +namespace is copied into new ``dict`` and the original definition +namespace is discarded. The new copy is stored away as the class's +namespace and is exposed as ``__dict__`` through a read-only proxy. + This PEP changes the default class definition namespace to ``OrderedDict``. +The long-lived class namespace (``__dict__``) will remain a ``dict``. Furthermore, the order in which the attributes are defined in each class body will now be preserved in the ``__definition_order__`` attribute of the class. This allows introspection of the original definition order, e.g. by class decorators. -Note: just to be clear, this PEP is *not* about changing ``__dict__`` for -classes to ``OrderedDict``. - Motivation ========== -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Sat Jun 11 22:37:42 2016 From: python-checkins at python.org (larry.hastings) Date: Sun, 12 Jun 2016 02:37:42 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_PEP_101=3A_Updated_the_RM_and?= =?utf-8?q?_PE_list=2E__Removed_MvL_*sob*?= Message-ID: <20160612023741.10086.32290.C086FA53@psf.io> https://hg.python.org/peps/rev/77268d3788c3 changeset: 6371:77268d3788c3 user: Larry Hastings date: Sat Jun 11 19:37:39 2016 -0700 summary: PEP 101: Updated the RM and PE list. Removed MvL *sob* files: pep-0101.txt | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pep-0101.txt b/pep-0101.txt --- a/pep-0101.txt +++ b/pep-0101.txt @@ -66,11 +66,13 @@ done by the Release Manager (RM), the designated person performing the release. The roles and their current experts are: - * RM = Release Manager: Larry Hastings (US) - * WE = Windows: Martin von Loewis (Central Europe) and Steve Dower + * RM = Release Manager: Ned Deily (US), + Larry Hastings (US), + Benjamin Peterson (US) + * WE = Windows: Steve Dower * ME = Mac: Ned Deily (US) * DE = Docs: Georg Brandl (Central Europe) - * IE = Idle Expert: ?? + * IE = Idle Expert: Terry Reedy (US) NOTE: It is highly recommended that the RM contact the Experts the day before the release. Because the world is round and everyone lives -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Sat Jun 11 22:40:49 2016 From: python-checkins at python.org (eric.snow) Date: Sun, 12 Jun 2016 02:40:49 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Update_Post-History=2E?= Message-ID: <20160612024048.81084.31149.3EED9471@psf.io> https://hg.python.org/peps/rev/502e69ccfe29 changeset: 6372:502e69ccfe29 user: Eric Snow date: Sat Jun 11 20:38:55 2016 -0600 summary: Update Post-History. files: pep-0520.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/pep-0520.txt b/pep-0520.txt --- a/pep-0520.txt +++ b/pep-0520.txt @@ -8,7 +8,7 @@ Content-Type: text/x-rst Created: 7-Jun-2016 Python-Version: 3.6 -Post-History: 7-Jun-2016 +Post-History: 7-Jun-2016, 11-Jun-2016 Abstract -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Sat Jun 11 22:58:07 2016 From: python-checkins at python.org (ned.deily) Date: Sun, 12 Jun 2016 02:58:07 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_update_nad_email_address?= Message-ID: <20160612025807.26318.38143.34175397@psf.io> https://hg.python.org/peps/rev/310545d189c4 changeset: 6373:310545d189c4 user: Ned Deily date: Sat Jun 11 22:58:03 2016 -0400 summary: update nad email address files: pep-0101.txt | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pep-0101.txt b/pep-0101.txt --- a/pep-0101.txt +++ b/pep-0101.txt @@ -66,11 +66,11 @@ done by the Release Manager (RM), the designated person performing the release. The roles and their current experts are: - * RM = Release Manager: Ned Deily (US), + * RM = Release Manager: Ned Deily (US), Larry Hastings (US), Benjamin Peterson (US) * WE = Windows: Steve Dower - * ME = Mac: Ned Deily (US) + * ME = Mac: Ned Deily (US) * DE = Docs: Georg Brandl (Central Europe) * IE = Idle Expert: Terry Reedy (US) -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Sat Jun 11 23:50:03 2016 From: python-checkins at python.org (larry.hastings) Date: Sun, 12 Jun 2016 03:50:03 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_PEP_101=3A_Remind_you_how_to_?= =?utf-8?q?write_version_numbers_to_please_release=2Epy?= Message-ID: <20160612035002.101587.62542.664BD3A3@psf.io> https://hg.python.org/peps/rev/925163186788 changeset: 6374:925163186788 user: Larry Hastings date: Sat Jun 11 20:49:59 2016 -0700 summary: PEP 101: Remind you how to write version numbers to please release.py at the point that you actually call it for the first time. files: pep-0101.txt | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/pep-0101.txt b/pep-0101.txt --- a/pep-0101.txt +++ b/pep-0101.txt @@ -189,6 +189,11 @@ $ .../release/release.py --bump X.Y.ZaN + Reminder: X, Y, Z, and N should be integers. + a should be one of "a", "b", or "rc" (e.g. "3.4.3rc1"). + For final releases omit the aN ("3.4.3"). For the first + release of a new version Z should be 0 ("3.6.0"). + This automates updating various release numbers, but you will have to modify a few files manually. If your $EDITOR environment variable is set up correctly, release.py will pop up editor windows with the files -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Sun Jun 12 00:38:18 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 12 Jun 2016 04:38:18 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzE2NDg0?= =?utf-8?q?=3A_Fix_pydoc_link_and_test_on_Windows=2C_by_Kaushik_Nadikuditi?= Message-ID: <20160612043818.19970.39559.2E143098@psf.io> https://hg.python.org/cpython/rev/d84268ed62ac changeset: 101913:d84268ed62ac branch: 3.5 parent: 101909:a7e04b4e51b2 user: Martin Panter date: Sun Jun 12 04:24:06 2016 +0000 summary: Issue #16484: Fix pydoc link and test on Windows, by Kaushik Nadikuditi files: Lib/pydoc.py | 5 +++-- Lib/test/test_pydoc.py | 2 +- Misc/NEWS | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Lib/pydoc.py b/Lib/pydoc.py --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -28,7 +28,7 @@ Module docs for core modules are assumed to be in - http://docs.python.org/X.Y/library/ + https://docs.python.org/X.Y/library/ This can be overridden by setting the PYTHONDOCS environment variable to a different URL or to a local directory containing the Library @@ -395,6 +395,7 @@ docloc = os.environ.get("PYTHONDOCS", self.PYTHONDOCS) + basedir = os.path.normcase(basedir) if (isinstance(object, type(os)) and (object.__name__ in ('errno', 'exceptions', 'gc', 'imp', 'marshal', 'posix', 'signal', 'sys', @@ -402,7 +403,7 @@ (file.startswith(basedir) and not file.startswith(os.path.join(basedir, 'site-packages')))) and object.__name__ not in ('xml.etree', 'test.pydoc_mod')): - if docloc.startswith("http://"): + if docloc.startswith(("http://", "https://")): docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__.lower()) else: docloc = os.path.join(docloc, object.__name__.lower() + ".html") diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -356,7 +356,7 @@ def get_pydoc_link(module): "Returns a documentation web link of a module" dirname = os.path.dirname - basedir = os.path.join(dirname(dirname(__file__))) + basedir = dirname(dirname(__file__)) doc = pydoc.TextDoc() loc = doc.getdocloc(module, basedir=basedir) return loc diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -591,6 +591,10 @@ Documentation ------------- +- Issue #16484: Change the default PYTHONDOCS URL to "https:", and fix the + resulting links to use lowercase. Patch by Sean Rodman, test by Kaushik + Nadikuditi. + - Issue #24136: Document the new PEP 448 unpacking syntax of 3.5. - Issue #26736: Used HTTPS for external links in the documentation if possible. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 00:38:19 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 12 Jun 2016 04:38:19 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2316484=3A_Merge_pydoc_Windows_fixes_from_3=2E5?= Message-ID: <20160612043818.99116.86598.77921863@psf.io> https://hg.python.org/cpython/rev/84d1e5a4b1c5 changeset: 101914:84d1e5a4b1c5 parent: 101912:0146e422f0b3 parent: 101913:d84268ed62ac user: Martin Panter date: Sun Jun 12 04:31:25 2016 +0000 summary: Issue #16484: Merge pydoc Windows fixes from 3.5 files: Lib/pydoc.py | 5 +++-- Lib/test/test_pydoc.py | 2 +- Misc/NEWS | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Lib/pydoc.py b/Lib/pydoc.py --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -28,7 +28,7 @@ Module docs for core modules are assumed to be in - http://docs.python.org/X.Y/library/ + https://docs.python.org/X.Y/library/ This can be overridden by setting the PYTHONDOCS environment variable to a different URL or to a local directory containing the Library @@ -407,6 +407,7 @@ docloc = os.environ.get("PYTHONDOCS", self.PYTHONDOCS) + basedir = os.path.normcase(basedir) if (isinstance(object, type(os)) and (object.__name__ in ('errno', 'exceptions', 'gc', 'imp', 'marshal', 'posix', 'signal', 'sys', @@ -414,7 +415,7 @@ (file.startswith(basedir) and not file.startswith(os.path.join(basedir, 'site-packages')))) and object.__name__ not in ('xml.etree', 'test.pydoc_mod')): - if docloc.startswith("http://"): + if docloc.startswith(("http://", "https://")): docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__.lower()) else: docloc = os.path.join(docloc, object.__name__.lower() + ".html") diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -356,7 +356,7 @@ def get_pydoc_link(module): "Returns a documentation web link of a module" dirname = os.path.dirname - basedir = os.path.join(dirname(dirname(__file__))) + basedir = dirname(dirname(__file__)) doc = pydoc.TextDoc() loc = doc.getdocloc(module, basedir=basedir) return loc diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -225,6 +225,10 @@ Documentation ------------- +- Issue #16484: Change the default PYTHONDOCS URL to "https:", and fix the + resulting links to use lowercase. Patch by Sean Rodman, test by Kaushik + Nadikuditi. + - Issue #24136: Document the new PEP 448 unpacking syntax of 3.5. - Issue #22558: Add remaining doc links to source code for Python-coded modules. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 00:49:19 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 12 Jun 2016 04:49:19 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE2NDg0?= =?utf-8?q?=3A_PYTHONDOCS_still_uses_=E2=80=9Chttp=3A=E2=80=9D_in_Python_2?= Message-ID: <20160612044919.114435.19284.AE7A795E@psf.io> https://hg.python.org/cpython/rev/c60d2e4f4f96 changeset: 101915:c60d2e4f4f96 branch: 2.7 parent: 101900:45444e30b415 user: Martin Panter date: Sun Jun 12 04:38:34 2016 +0000 summary: Issue #16484: PYTHONDOCS still uses ?http:? in Python 2 files: Doc/library/pydoc.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/pydoc.rst b/Doc/library/pydoc.rst --- a/Doc/library/pydoc.rst +++ b/Doc/library/pydoc.rst @@ -80,7 +80,7 @@ Python interpreter and typed ``import spam``. Module docs for core modules are assumed to reside in -https://docs.python.org/library/. This can be overridden by setting the +http://docs.python.org/library/. This can be overridden by setting the :envvar:`PYTHONDOCS` environment variable to a different URL or to a local directory containing the Library Reference Manual pages. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 01:31:44 2016 From: python-checkins at python.org (larry.hastings) Date: Sun, 12 Jun 2016 05:31:44 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_PEP_101=3A_Update_which_files?= =?utf-8?q?_still_have_copyright_info=2E?= Message-ID: <20160612053144.20039.56624.845AF616@psf.io> https://hg.python.org/peps/rev/f4329cb38f7f changeset: 6375:f4329cb38f7f user: Larry Hastings date: Sat Jun 11 22:31:41 2016 -0700 summary: PEP 101: Update which files still have copyright info. files: pep-0101.txt | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pep-0101.txt b/pep-0101.txt --- a/pep-0101.txt +++ b/pep-0101.txt @@ -214,12 +214,12 @@ ___ README ___ LICENSE (make sure to change on trunk and the branch) ___ Python/getcopyright.c - ___ Doc/README.txt (at the end) ___ Doc/copyright.rst ___ Doc/license.rst - ___ PC/python_nt.rc sets up the DLL version resource for Windows + ___ PC/python_ver_rc.h sets up the DLL version resource for Windows (displayed when you right-click on the DLL and select - Properties). + Properties). This isn't a C include file, it's a Windows + "resource file" include file. ___ Check with the IE (if there is one ) to be sure that Lib/idlelib/NEWS.txt has been similarly updated. -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Sun Jun 12 02:28:43 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 12 Jun 2016 06:28:43 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Fix_typos_and_?= =?utf-8?q?English_grammar_in_documentation_and_code_comment?= Message-ID: <20160612062842.26318.56149.00BC749E@psf.io> https://hg.python.org/cpython/rev/aea854d018f9 changeset: 101919:aea854d018f9 branch: 3.5 parent: 101917:a2482e805dff user: Martin Panter date: Sun Jun 12 06:14:03 2016 +0000 summary: Fix typos and English grammar in documentation and code comment files: Doc/whatsnew/2.0.rst | 2 +- Lib/test/test_coroutines.py | 2 +- Misc/NEWS | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/whatsnew/2.0.rst b/Doc/whatsnew/2.0.rst --- a/Doc/whatsnew/2.0.rst +++ b/Doc/whatsnew/2.0.rst @@ -506,7 +506,7 @@ you'd use the :func:`apply` built-in function: ``apply(f, args, kw)`` calls the function :func:`f` with the argument tuple *args* and the keyword arguments in the dictionary *kw*. :func:`apply` is the same in 2.0, but thanks to a patch -from Greg Ewing, ``f(*args, **kw)`` as a shorter and clearer way to achieve the +from Greg Ewing, ``f(*args, **kw)`` is a shorter and clearer way to achieve the same effect. This syntax is symmetrical with the syntax for defining functions:: diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py --- a/Lib/test/test_coroutines.py +++ b/Lib/test/test_coroutines.py @@ -1423,7 +1423,7 @@ with warnings.catch_warnings(): warnings.simplefilter("error") - # Test that __aiter__ that returns an asyncronous iterator + # Test that __aiter__ that returns an asynchronous iterator # directly does not throw any warnings. run_async(main()) self.assertEqual(I, 111011) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2215,8 +2215,8 @@ writer failed in BufferedRWPair.close(). - Issue #23622: Unknown escapes in regular expressions that consist of ``'\'`` - and ASCII letter now raise a deprecation warning and will be forbidden in - Python 3.6. + and an ASCII letter now raise a deprecation warning and will be forbidden + in Python 3.6. - Issue #23671: string.Template now allows specifying the "self" parameter as a keyword argument. string.Formatter now allows specifying the "self" and -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 02:28:42 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 12 Jun 2016 06:28:42 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogIzE2NDg0OiBDaGFu?= =?utf-8?q?ge_PYTHONDOCS_to_=22https=3A=22=2C_and_fix_links_to_use_lowerca?= =?utf-8?q?se?= Message-ID: <20160612062842.26064.85668.109FFEB1@psf.io> https://hg.python.org/cpython/rev/ede10138327e changeset: 101916:ede10138327e branch: 2.7 user: Martin Panter date: Sun Jun 12 05:25:16 2016 +0000 summary: #16484: Change PYTHONDOCS to "https:", and fix links to use lowercase Implementation by Sean Rodman; test by Kaushik Nadikuditi. files: Doc/library/pydoc.rst | 2 +- Lib/pydoc.py | 17 +++++++++-------- Lib/test/test_pydoc.py | 14 ++++++++++++++ Misc/ACKS | 1 + Misc/NEWS | 7 +++++++ 5 files changed, 32 insertions(+), 9 deletions(-) diff --git a/Doc/library/pydoc.rst b/Doc/library/pydoc.rst --- a/Doc/library/pydoc.rst +++ b/Doc/library/pydoc.rst @@ -80,7 +80,7 @@ Python interpreter and typed ``import spam``. Module docs for core modules are assumed to reside in -http://docs.python.org/library/. This can be overridden by setting the +https://docs.python.org/library/. This can be overridden by setting the :envvar:`PYTHONDOCS` environment variable to a different URL or to a local directory containing the Library Reference Manual pages. diff --git a/Lib/pydoc.py b/Lib/pydoc.py --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -28,7 +28,7 @@ Module docs for core modules are assumed to be in - http://docs.python.org/library/ + https://docs.python.org/library/ This can be overridden by setting the PYTHONDOCS environment variable to a different URL or to a local directory containing the Library @@ -374,7 +374,9 @@ docmodule = docclass = docroutine = docother = docproperty = docdata = fail - def getdocloc(self, object): + def getdocloc(self, object, + basedir=os.path.join(sys.exec_prefix, "lib", + "python"+sys.version[0:3])): """Return the location of module docs or None""" try: @@ -383,9 +385,8 @@ file = '(built-in)' docloc = os.environ.get("PYTHONDOCS", - "http://docs.python.org/library") - basedir = os.path.join(sys.exec_prefix, "lib", - "python"+sys.version[0:3]) + "https://docs.python.org/library") + basedir = os.path.normcase(basedir) if (isinstance(object, type(os)) and (object.__name__ in ('errno', 'exceptions', 'gc', 'imp', 'marshal', 'posix', 'signal', 'sys', @@ -393,10 +394,10 @@ (file.startswith(basedir) and not file.startswith(os.path.join(basedir, 'site-packages')))) and object.__name__ not in ('xml.etree', 'test.pydoc_mod')): - if docloc.startswith("http://"): - docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__) + if docloc.startswith(("http://", "https://")): + docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__.lower()) else: - docloc = os.path.join(docloc, object.__name__ + ".html") + docloc = os.path.join(docloc, object.__name__.lower() + ".html") else: docloc = None return docloc diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -13,6 +13,7 @@ import xml.etree import types import test.test_support +import xml.etree.ElementTree from collections import namedtuple from test.script_helper import assert_python_ok from test.test_support import (TESTFN, rmtree, reap_children, captured_stdout, @@ -253,6 +254,14 @@ loc = "
      Module Docs" return output.strip(), loc +def get_pydoc_link(module): + "Returns a documentation web link of a module" + dirname = os.path.dirname + basedir = dirname(dirname(__file__)) + doc = pydoc.TextDoc() + loc = doc.getdocloc(module, basedir=basedir) + return loc + def get_pydoc_text(module): "Returns pydoc generated output as text" doc = pydoc.TextDoc() @@ -331,6 +340,11 @@ print_diffs(expected_text, result) self.fail("outputs are not equal, see diff above") + def test_mixed_case_module_names_are_lower_cased(self): + # issue16484 + doc_link = get_pydoc_link(xml.etree.ElementTree) + self.assertIn('xml.etree.elementtree', doc_link) + def test_issue8225(self): # Test issue8225 to ensure no doc link appears for xml.etree result, doc_loc = get_pydoc_text(xml.etree) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -965,6 +965,7 @@ R. David Murray Matti M?ki J?rg M?ller +Kaushik N Dale Nagata John Nagle Takahiro Nakayama diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,13 @@ Library ------- +Documentation +------------- + +- Issue #16484: Change the default PYTHONDOCS URL to "https:", and fix the + resulting links to use lowercase. Patch by Sean Rodman, test by Kaushik + Nadikuditi. + What's New in Python 2.7.12 release candidate 1? ================================================ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 02:28:42 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 12 Jun 2016 06:28:42 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Fix_buggy_RE_?= =?utf-8?b?4oCcXHBhcnJvdF9leGFtcGxlLnB54oCdLCB1bmNvdmVyZWQgYnkgSXNzdWUg?= =?utf-8?q?=2327030?= Message-ID: <20160612062842.19970.90517.9D8449AF@psf.io> https://hg.python.org/cpython/rev/a2482e805dff changeset: 101917:a2482e805dff branch: 3.5 parent: 101913:d84268ed62ac user: Martin Panter date: Sun Jun 12 06:07:35 2016 +0000 summary: Fix buggy RE ?\parrot_example.py?, uncovered by Issue #27030 files: Lib/lib2to3/tests/test_refactor.py | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/lib2to3/tests/test_refactor.py b/Lib/lib2to3/tests/test_refactor.py --- a/Lib/lib2to3/tests/test_refactor.py +++ b/Lib/lib2to3/tests/test_refactor.py @@ -9,6 +9,7 @@ import codecs import operator import io +import re import tempfile import shutil import unittest @@ -226,8 +227,8 @@ actually_write=False) # Testing that it logged this message when write=False was passed is # sufficient to see that it did not bail early after "No changes". - message_regex = r"Not writing changes to .*%s%s" % ( - os.sep, os.path.basename(test_file)) + message_regex = r"Not writing changes to .*%s" % \ + re.escape(os.sep + os.path.basename(test_file)) for message in debug_messages: if "Not writing changes" in message: self.assertRegex(message, message_regex) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 02:28:43 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 12 Jun 2016 06:28:43 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_typo_fixes_from_3=2E5?= Message-ID: <20160612062843.81084.39468.096F5A32@psf.io> https://hg.python.org/cpython/rev/230a34a997eb changeset: 101920:230a34a997eb parent: 101918:be193f8dbe4c parent: 101919:aea854d018f9 user: Martin Panter date: Sun Jun 12 06:16:51 2016 +0000 summary: Merge typo fixes from 3.5 files: Doc/whatsnew/2.0.rst | 2 +- Lib/test/test_coroutines.py | 2 +- Misc/NEWS | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/whatsnew/2.0.rst b/Doc/whatsnew/2.0.rst --- a/Doc/whatsnew/2.0.rst +++ b/Doc/whatsnew/2.0.rst @@ -506,7 +506,7 @@ you'd use the :func:`apply` built-in function: ``apply(f, args, kw)`` calls the function :func:`f` with the argument tuple *args* and the keyword arguments in the dictionary *kw*. :func:`apply` is the same in 2.0, but thanks to a patch -from Greg Ewing, ``f(*args, **kw)`` as a shorter and clearer way to achieve the +from Greg Ewing, ``f(*args, **kw)`` is a shorter and clearer way to achieve the same effect. This syntax is symmetrical with the syntax for defining functions:: diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py --- a/Lib/test/test_coroutines.py +++ b/Lib/test/test_coroutines.py @@ -1423,7 +1423,7 @@ with warnings.catch_warnings(): warnings.simplefilter("error") - # Test that __aiter__ that returns an asyncronous iterator + # Test that __aiter__ that returns an asynchronous iterator # directly does not throw any warnings. run_async(main()) self.assertEqual(I, 111011) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -3040,8 +3040,8 @@ writer failed in BufferedRWPair.close(). - Issue #23622: Unknown escapes in regular expressions that consist of ``'\'`` - and ASCII letter now raise a deprecation warning and will be forbidden in - Python 3.6. + and an ASCII letter now raise a deprecation warning and will be forbidden + in Python 3.6. - Issue #23671: string.Template now allows specifying the "self" parameter as a keyword argument. string.Formatter now allows specifying the "self" and -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 02:28:43 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 12 Jun 2016 06:28:43 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Fix_buggy_RE_?= =?utf-8?b?4oCcXHBhcnJvdF9leGFtcGxlLnB54oCdLCB1bmNvdmVyZWQgYnkgSXNzdWUg?= =?utf-8?q?=2327030?= Message-ID: <20160612062843.9990.73227.CEAB94F7@psf.io> https://hg.python.org/cpython/rev/c5411cfa0bd3 changeset: 101922:c5411cfa0bd3 branch: 2.7 parent: 101916:ede10138327e user: Martin Panter date: Sun Jun 12 06:07:35 2016 +0000 summary: Fix buggy RE ?\parrot_example.py?, uncovered by Issue #27030 files: Lib/lib2to3/tests/test_refactor.py | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/lib2to3/tests/test_refactor.py b/Lib/lib2to3/tests/test_refactor.py --- a/Lib/lib2to3/tests/test_refactor.py +++ b/Lib/lib2to3/tests/test_refactor.py @@ -8,6 +8,7 @@ import os import codecs import operator +import re import StringIO import tempfile import shutil @@ -226,8 +227,8 @@ actually_write=False) # Testing that it logged this message when write=False was passed is # sufficient to see that it did not bail early after "No changes". - message_regex = r"Not writing changes to .*%s%s" % ( - os.sep, os.path.basename(test_file)) + message_regex = r"Not writing changes to .*%s" % \ + re.escape(os.sep + os.path.basename(test_file)) for message in debug_messages: if "Not writing changes" in message: self.assertRegexpMatches(message, message_regex) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 02:28:43 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 12 Jun 2016 06:28:43 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Add_grammatical_article_to?= =?utf-8?b?IOKAnGFuIEFTQ0lJIGxldHRlcuKAnQ==?= Message-ID: <20160612062843.26206.3784.565C8E25@psf.io> https://hg.python.org/cpython/rev/7ed6b4a077c4 changeset: 101921:7ed6b4a077c4 user: Martin Panter date: Sun Jun 12 06:17:29 2016 +0000 summary: Add grammatical article to ?an ASCII letter? files: Doc/library/re.rst | 6 +++--- Misc/NEWS | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/re.rst b/Doc/library/re.rst --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -321,7 +321,7 @@ The special sequences consist of ``'\'`` and a character from the list below. -If the ordinary character is not ASCII digit or ASCII letter, then the +If the ordinary character is not an ASCII digit or an ASCII letter, then the resulting RE will match the second character. For example, ``\$`` matches the character ``'$'``. @@ -444,7 +444,7 @@ The ``'\u'`` and ``'\U'`` escape sequences have been added. .. versionchanged:: 3.6 - Unknown escapes consisting of ``'\'`` and ASCII letter now are errors. + Unknown escapes consisting of ``'\'`` and an ASCII letter now are errors. .. seealso:: @@ -743,7 +743,7 @@ Unmatched groups are replaced with an empty string. .. versionchanged:: 3.6 - Unknown escapes consisting of ``'\'`` and ASCII letter now are errors. + Unknown escapes consisting of ``'\'`` and an ASCII letter now are errors. .. function:: subn(pattern, repl, string, count=0, flags=0) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -56,7 +56,7 @@ - Issue #27029: Removed deprecated support of universal newlines mode from ZipFile.open(). -- Issue #27030: Unknown escapes consisting of ``'\'`` and ASCII letter in +- Issue #27030: Unknown escapes consisting of ``'\'`` and an ASCII letter in regular expressions now are errors. The re.LOCALE flag now can be used only with bytes patterns. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 02:28:43 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 12 Jun 2016 06:28:43 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Fix_typo_in_do?= =?utf-8?q?cumentation?= Message-ID: <20160612062843.27813.51108.FFD155C7@psf.io> https://hg.python.org/cpython/rev/7dfee711da42 changeset: 101923:7dfee711da42 branch: 2.7 user: Martin Panter date: Sun Jun 12 06:14:03 2016 +0000 summary: Fix typo in documentation files: Doc/whatsnew/2.0.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/whatsnew/2.0.rst b/Doc/whatsnew/2.0.rst --- a/Doc/whatsnew/2.0.rst +++ b/Doc/whatsnew/2.0.rst @@ -506,7 +506,7 @@ you'd use the :func:`apply` built-in function: ``apply(f, args, kw)`` calls the function :func:`f` with the argument tuple *args* and the keyword arguments in the dictionary *kw*. :func:`apply` is the same in 2.0, but thanks to a patch -from Greg Ewing, ``f(*args, **kw)`` as a shorter and clearer way to achieve the +from Greg Ewing, ``f(*args, **kw)`` is a shorter and clearer way to achieve the same effect. This syntax is symmetrical with the syntax for defining functions:: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 02:28:43 2016 From: python-checkins at python.org (martin.panter) Date: Sun, 12 Jun 2016 06:28:43 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327030=3A_Merge_RE_fix_from_3=2E5?= Message-ID: <20160612062842.81381.32145.5C268692@psf.io> https://hg.python.org/cpython/rev/be193f8dbe4c changeset: 101918:be193f8dbe4c parent: 101914:84d1e5a4b1c5 parent: 101917:a2482e805dff user: Martin Panter date: Sun Jun 12 06:08:29 2016 +0000 summary: Issue #27030: Merge RE fix from 3.5 files: Lib/lib2to3/tests/test_refactor.py | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/lib2to3/tests/test_refactor.py b/Lib/lib2to3/tests/test_refactor.py --- a/Lib/lib2to3/tests/test_refactor.py +++ b/Lib/lib2to3/tests/test_refactor.py @@ -8,6 +8,7 @@ import os import codecs import io +import re import tempfile import shutil import unittest @@ -222,8 +223,8 @@ actually_write=False) # Testing that it logged this message when write=False was passed is # sufficient to see that it did not bail early after "No changes". - message_regex = r"Not writing changes to .*%s%s" % ( - os.sep, os.path.basename(test_file)) + message_regex = r"Not writing changes to .*%s" % \ + re.escape(os.sep + os.path.basename(test_file)) for message in debug_messages: if "Not writing changes" in message: self.assertRegex(message, message_regex) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 02:49:47 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 12 Jun 2016 06:49:47 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2325455=3A_Fixed_a_crash_in_repr_of_ElementTree?= =?utf-8?q?=2EElement_with_recursive_tag=2E?= Message-ID: <20160612064946.81161.18314.F3D18A0F@psf.io> https://hg.python.org/cpython/rev/e3671a684ea0 changeset: 101927:e3671a684ea0 parent: 101925:194549801bd5 parent: 101926:e44bd1259bda user: Serhiy Storchaka date: Sun Jun 12 09:47:20 2016 +0300 summary: Issue #25455: Fixed a crash in repr of ElementTree.Element with recursive tag. files: Lib/test/test_xml_etree.py | 8 +++++++- Misc/NEWS | 2 ++ Modules/_elementtree.c | 19 ++++++++++++++++--- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -18,7 +18,7 @@ from itertools import product from test import support -from test.support import TESTFN, findfile, import_fresh_module, gc_collect +from test.support import TESTFN, findfile, import_fresh_module, gc_collect, swap_attr # pyET is the pure-Python implementation. # @@ -1864,6 +1864,12 @@ e.extend([ET.Element('bar')]) self.assertRaises(ValueError, e.remove, X('baz')) + def test_recursive_repr(self): + # Issue #25455 + e = ET.Element('foo') + with swap_attr(e, 'tag', e): + with self.assertRaises(RuntimeError): + repr(e) # Should not crash class MutatingElementPath(str): def __new__(cls, elem, *args): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -44,6 +44,8 @@ Library ------- +- Issue #25455: Fixed a crash in repr of ElementTree.Element with recursive tag. + - Issue #27294: Improved repr for Tkinter event objects. - Issue #20508: Improve exception message of IPv{4,6}Network.__getitem__. diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -1610,10 +1610,23 @@ static PyObject* element_repr(ElementObject* self) { - if (self->tag) - return PyUnicode_FromFormat("", self->tag, self); - else + int status; + + if (self->tag == NULL) return PyUnicode_FromFormat("", self); + + status = Py_ReprEnter((PyObject *)self); + if (status == 0) { + PyObject *res; + res = PyUnicode_FromFormat("", self->tag, self); + Py_ReprLeave((PyObject *)self); + return res; + } + if (status > 0) + PyErr_Format(PyExc_RuntimeError, + "reentrant call inside %s.__repr__", + Py_TYPE(self)->tp_name); + return NULL; } /*[clinic input] -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 02:49:46 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 12 Jun 2016 06:49:46 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI1NDU1?= =?utf-8?q?=3A_Fixed_a_crash_in_repr_of_ElementTree=2EElement_with_recursi?= =?utf-8?q?ve_tag=2E?= Message-ID: <20160612064946.11569.67026.A81E7222@psf.io> https://hg.python.org/cpython/rev/e44bd1259bda changeset: 101926:e44bd1259bda branch: 3.5 parent: 101924:34d24c51eab6 user: Serhiy Storchaka date: Sun Jun 12 09:43:55 2016 +0300 summary: Issue #25455: Fixed a crash in repr of ElementTree.Element with recursive tag. files: Lib/test/test_xml_etree.py | 8 +++++++- Misc/NEWS | 2 ++ Modules/_elementtree.c | 19 ++++++++++++++++--- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -18,7 +18,7 @@ from itertools import product from test import support -from test.support import TESTFN, findfile, import_fresh_module, gc_collect +from test.support import TESTFN, findfile, import_fresh_module, gc_collect, swap_attr # pyET is the pure-Python implementation. # @@ -1860,6 +1860,12 @@ e.extend([ET.Element('bar')]) self.assertRaises(ValueError, e.remove, X('baz')) + def test_recursive_repr(self): + # Issue #25455 + e = ET.Element('foo') + with swap_attr(e, 'tag', e): + with self.assertRaises(RuntimeError): + repr(e) # Should not crash class MutatingElementPath(str): def __new__(cls, elem, *args): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -143,6 +143,8 @@ Library ------- +- Issue #25455: Fixed a crash in repr of ElementTree.Element with recursive tag. + - Issue #26556: Update expat to 2.1.1, fixes CVE-2015-1283. - Fix TLS stripping vulnerability in smptlib, CVE-2016-0772. Reported by Team diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -1582,10 +1582,23 @@ static PyObject* element_repr(ElementObject* self) { - if (self->tag) - return PyUnicode_FromFormat("", self->tag, self); - else + int status; + + if (self->tag == NULL) return PyUnicode_FromFormat("", self); + + status = Py_ReprEnter((PyObject *)self); + if (status == 0) { + PyObject *res; + res = PyUnicode_FromFormat("", self->tag, self); + Py_ReprLeave((PyObject *)self); + return res; + } + if (status > 0) + PyErr_Format(PyExc_RuntimeError, + "reentrant call inside %s.__repr__", + Py_TYPE(self)->tp_name); + return NULL; } /*[clinic input] -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 02:49:47 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 12 Jun 2016 06:49:47 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?q?=29=3A_Merge_heads?= Message-ID: <20160612064947.19950.65201.FA5F86E2@psf.io> https://hg.python.org/cpython/rev/1d5ce70da754 changeset: 101929:1d5ce70da754 parent: 101927:e3671a684ea0 parent: 101921:7ed6b4a077c4 user: Serhiy Storchaka date: Sun Jun 12 09:48:19 2016 +0300 summary: Merge heads files: Doc/library/re.rst | 6 +++--- Doc/whatsnew/2.0.rst | 2 +- Lib/lib2to3/tests/test_refactor.py | 5 +++-- Lib/test/test_coroutines.py | 2 +- Misc/NEWS | 6 +++--- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Doc/library/re.rst b/Doc/library/re.rst --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -321,7 +321,7 @@ The special sequences consist of ``'\'`` and a character from the list below. -If the ordinary character is not ASCII digit or ASCII letter, then the +If the ordinary character is not an ASCII digit or an ASCII letter, then the resulting RE will match the second character. For example, ``\$`` matches the character ``'$'``. @@ -444,7 +444,7 @@ The ``'\u'`` and ``'\U'`` escape sequences have been added. .. versionchanged:: 3.6 - Unknown escapes consisting of ``'\'`` and ASCII letter now are errors. + Unknown escapes consisting of ``'\'`` and an ASCII letter now are errors. .. seealso:: @@ -743,7 +743,7 @@ Unmatched groups are replaced with an empty string. .. versionchanged:: 3.6 - Unknown escapes consisting of ``'\'`` and ASCII letter now are errors. + Unknown escapes consisting of ``'\'`` and an ASCII letter now are errors. .. function:: subn(pattern, repl, string, count=0, flags=0) diff --git a/Doc/whatsnew/2.0.rst b/Doc/whatsnew/2.0.rst --- a/Doc/whatsnew/2.0.rst +++ b/Doc/whatsnew/2.0.rst @@ -506,7 +506,7 @@ you'd use the :func:`apply` built-in function: ``apply(f, args, kw)`` calls the function :func:`f` with the argument tuple *args* and the keyword arguments in the dictionary *kw*. :func:`apply` is the same in 2.0, but thanks to a patch -from Greg Ewing, ``f(*args, **kw)`` as a shorter and clearer way to achieve the +from Greg Ewing, ``f(*args, **kw)`` is a shorter and clearer way to achieve the same effect. This syntax is symmetrical with the syntax for defining functions:: diff --git a/Lib/lib2to3/tests/test_refactor.py b/Lib/lib2to3/tests/test_refactor.py --- a/Lib/lib2to3/tests/test_refactor.py +++ b/Lib/lib2to3/tests/test_refactor.py @@ -8,6 +8,7 @@ import os import codecs import io +import re import tempfile import shutil import unittest @@ -222,8 +223,8 @@ actually_write=False) # Testing that it logged this message when write=False was passed is # sufficient to see that it did not bail early after "No changes". - message_regex = r"Not writing changes to .*%s%s" % ( - os.sep, os.path.basename(test_file)) + message_regex = r"Not writing changes to .*%s" % \ + re.escape(os.sep + os.path.basename(test_file)) for message in debug_messages: if "Not writing changes" in message: self.assertRegex(message, message_regex) diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py --- a/Lib/test/test_coroutines.py +++ b/Lib/test/test_coroutines.py @@ -1423,7 +1423,7 @@ with warnings.catch_warnings(): warnings.simplefilter("error") - # Test that __aiter__ that returns an asyncronous iterator + # Test that __aiter__ that returns an asynchronous iterator # directly does not throw any warnings. run_async(main()) self.assertEqual(I, 111011) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -62,7 +62,7 @@ - Issue #27029: Removed deprecated support of universal newlines mode from ZipFile.open(). -- Issue #27030: Unknown escapes consisting of ``'\'`` and ASCII letter in +- Issue #27030: Unknown escapes consisting of ``'\'`` and an ASCII letter in regular expressions now are errors. The re.LOCALE flag now can be used only with bytes patterns. @@ -3046,8 +3046,8 @@ writer failed in BufferedRWPair.close(). - Issue #23622: Unknown escapes in regular expressions that consist of ``'\'`` - and ASCII letter now raise a deprecation warning and will be forbidden in - Python 3.6. + and an ASCII letter now raise a deprecation warning and will be forbidden + in Python 3.6. - Issue #23671: string.Template now allows specifying the "self" parameter as a keyword argument. string.Formatter now allows specifying the "self" and -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 02:49:47 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 12 Jun 2016 06:49:47 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Null_merge?= Message-ID: <20160612064947.27933.99672.EB5A913D@psf.io> https://hg.python.org/cpython/rev/be40dd774041 changeset: 101930:be40dd774041 parent: 101929:1d5ce70da754 parent: 101928:3190ef4147de user: Serhiy Storchaka date: Sun Jun 12 09:49:23 2016 +0300 summary: Null merge files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 02:49:47 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 12 Jun 2016 06:49:47 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNSk6?= =?utf-8?q?_Merge_heads?= Message-ID: <20160612064947.101725.55638.3CEC024B@psf.io> https://hg.python.org/cpython/rev/3190ef4147de changeset: 101928:3190ef4147de branch: 3.5 parent: 101926:e44bd1259bda parent: 101919:aea854d018f9 user: Serhiy Storchaka date: Sun Jun 12 09:47:57 2016 +0300 summary: Merge heads files: Doc/whatsnew/2.0.rst | 2 +- Lib/lib2to3/tests/test_refactor.py | 5 +++-- Lib/test/test_coroutines.py | 2 +- Misc/NEWS | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Doc/whatsnew/2.0.rst b/Doc/whatsnew/2.0.rst --- a/Doc/whatsnew/2.0.rst +++ b/Doc/whatsnew/2.0.rst @@ -506,7 +506,7 @@ you'd use the :func:`apply` built-in function: ``apply(f, args, kw)`` calls the function :func:`f` with the argument tuple *args* and the keyword arguments in the dictionary *kw*. :func:`apply` is the same in 2.0, but thanks to a patch -from Greg Ewing, ``f(*args, **kw)`` as a shorter and clearer way to achieve the +from Greg Ewing, ``f(*args, **kw)`` is a shorter and clearer way to achieve the same effect. This syntax is symmetrical with the syntax for defining functions:: diff --git a/Lib/lib2to3/tests/test_refactor.py b/Lib/lib2to3/tests/test_refactor.py --- a/Lib/lib2to3/tests/test_refactor.py +++ b/Lib/lib2to3/tests/test_refactor.py @@ -9,6 +9,7 @@ import codecs import operator import io +import re import tempfile import shutil import unittest @@ -226,8 +227,8 @@ actually_write=False) # Testing that it logged this message when write=False was passed is # sufficient to see that it did not bail early after "No changes". - message_regex = r"Not writing changes to .*%s%s" % ( - os.sep, os.path.basename(test_file)) + message_regex = r"Not writing changes to .*%s" % \ + re.escape(os.sep + os.path.basename(test_file)) for message in debug_messages: if "Not writing changes" in message: self.assertRegex(message, message_regex) diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py --- a/Lib/test/test_coroutines.py +++ b/Lib/test/test_coroutines.py @@ -1423,7 +1423,7 @@ with warnings.catch_warnings(): warnings.simplefilter("error") - # Test that __aiter__ that returns an asyncronous iterator + # Test that __aiter__ that returns an asynchronous iterator # directly does not throw any warnings. run_async(main()) self.assertEqual(I, 111011) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2221,8 +2221,8 @@ writer failed in BufferedRWPair.close(). - Issue #23622: Unknown escapes in regular expressions that consist of ``'\'`` - and ASCII letter now raise a deprecation warning and will be forbidden in - Python 3.6. + and an ASCII letter now raise a deprecation warning and will be forbidden + in Python 3.6. - Issue #23671: string.Template now allows specifying the "self" parameter as a keyword argument. string.Formatter now allows specifying the "self" and -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 02:49:46 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 12 Jun 2016 06:49:46 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327286=3A_Fixed_compiling_BUILD=5FMAP=5FUNPACK?= =?utf-8?q?=5FWITH=5FCALL_opcode=2E__Calling?= Message-ID: <20160612064946.27977.93324.ED4088C5@psf.io> https://hg.python.org/cpython/rev/194549801bd5 changeset: 101925:194549801bd5 parent: 101914:84d1e5a4b1c5 parent: 101924:34d24c51eab6 user: Serhiy Storchaka date: Sun Jun 12 09:35:13 2016 +0300 summary: Issue #27286: Fixed compiling BUILD_MAP_UNPACK_WITH_CALL opcode. Calling function with generalized unpacking (PEP 448) and conflicting keyword names could cause undefined behavior. files: Lib/importlib/_bootstrap_external.py | 1 + Lib/test/test_extcall.py | 4 + Lib/test/test_unpack_ex.py | 5 + Misc/NEWS | 4 + PC/launcher.c | 2 +- Python/compile.c | 2 +- Python/importlib_external.h | 206 +++++++------- 7 files changed, 119 insertions(+), 105 deletions(-) diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -223,6 +223,7 @@ # Python 3.5b1 3330 (PEP 448: Additional Unpacking Generalizations) # Python 3.5b2 3340 (fix dictionary display evaluation order #11205) # Python 3.5b2 3350 (add GET_YIELD_FROM_ITER opcode #24400) +# Python 3.5.2 3351 (fix BUILD_MAP_UNPACK_WITH_CALL opcode #27286) # Python 3.6a0 3360 (add FORMAT_VALUE opcode #25483 # Python 3.6a0 3361 (lineno delta of code.co_lnotab becomes signed) # Python 3.6a0 3370 (16 bit wordcode) diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py --- a/Lib/test/test_extcall.py +++ b/Lib/test/test_extcall.py @@ -57,6 +57,10 @@ Traceback (most recent call last): ... TypeError: f() got multiple values for keyword argument 'a' + >>> f(1, 2, a=3, **{'a': 4}, **{'a': 5}) + Traceback (most recent call last): + ... + TypeError: f() got multiple values for keyword argument 'a' >>> f(1, 2, 3, *[4, 5], **{'a':6, 'b':7}) (1, 2, 3, 4, 5) {'a': 6, 'b': 7} >>> f(1, 2, 3, x=4, y=5, *(6, 7), **{'a':8, 'b': 9}) diff --git a/Lib/test/test_unpack_ex.py b/Lib/test/test_unpack_ex.py --- a/Lib/test/test_unpack_ex.py +++ b/Lib/test/test_unpack_ex.py @@ -248,6 +248,11 @@ ... TypeError: f() got multiple values for keyword argument 'x' + >>> f(x=5, **{'x': 3}, **{'x': 2}) + Traceback (most recent call last): + ... + TypeError: f() got multiple values for keyword argument 'x' + >>> f(**{1: 3}, **{1: 5}) Traceback (most recent call last): ... diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,10 @@ Core and Builtins ----------------- +- Issue #27286: Fixed compiling BUILD_MAP_UNPACK_WITH_CALL opcode. Calling + function with generalized unpacking (PEP 448) and conflicting keyword names + could cause undefined behavior. + - Issue #27140: Added BUILD_CONST_KEY_MAP opcode. - Issue #27186: Add support for os.PathLike objects to open() (part of PEP 519). diff --git a/PC/launcher.c b/PC/launcher.c --- a/PC/launcher.c +++ b/PC/launcher.c @@ -1088,7 +1088,7 @@ { 3160, 3180, L"3.2" }, { 3190, 3230, L"3.3" }, { 3250, 3310, L"3.4" }, - { 3320, 3350, L"3.5" }, + { 3320, 3351, L"3.5" }, { 3360, 3371, L"3.6" }, { 0 } }; diff --git a/Python/compile.c b/Python/compile.c --- a/Python/compile.c +++ b/Python/compile.c @@ -3487,7 +3487,7 @@ code |= 2; if (nsubkwargs > 1) { /* Pack it all up */ - int function_pos = n + (code & 1) + nkw + 1; + int function_pos = n + (code & 1) + 2 * nkw + 1; ADDOP_I(c, BUILD_MAP_UNPACK_WITH_CALL, nsubkwargs | (function_pos << 8)); } } diff --git a/Python/importlib_external.h b/Python/importlib_external.h --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -339,7 +339,7 @@ 103,90,15,97,108,109,111,115,116,95,102,105,108,101,110,97, 109,101,114,4,0,0,0,114,4,0,0,0,114,5,0,0, 0,218,17,99,97,99,104,101,95,102,114,111,109,95,115,111, - 117,114,99,101,250,0,0,0,115,46,0,0,0,0,18,8, + 117,114,99,101,251,0,0,0,115,46,0,0,0,0,18,8, 1,6,1,6,1,8,1,4,1,8,1,12,1,12,1,16, 1,8,1,8,1,8,1,24,1,8,1,12,1,6,2,8, 1,8,1,8,1,8,1,14,1,14,1,114,79,0,0,0, @@ -412,7 +412,7 @@ 101,108,90,13,98,97,115,101,95,102,105,108,101,110,97,109, 101,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, 218,17,115,111,117,114,99,101,95,102,114,111,109,95,99,97, - 99,104,101,38,1,0,0,115,44,0,0,0,0,9,12,1, + 99,104,101,39,1,0,0,115,44,0,0,0,0,9,12,1, 8,1,12,1,12,1,8,1,6,1,10,1,10,1,8,1, 6,1,10,1,8,1,16,1,10,1,6,1,8,1,16,1, 8,1,6,1,8,1,14,1,114,85,0,0,0,99,1,0, @@ -447,7 +447,7 @@ 0,90,9,101,120,116,101,110,115,105,111,110,218,11,115,111, 117,114,99,101,95,112,97,116,104,114,4,0,0,0,114,4, 0,0,0,114,5,0,0,0,218,15,95,103,101,116,95,115, - 111,117,114,99,101,102,105,108,101,71,1,0,0,115,20,0, + 111,117,114,99,101,102,105,108,101,72,1,0,0,115,20,0, 0,0,0,7,12,1,4,1,16,1,26,1,4,1,2,1, 12,1,18,1,18,1,114,91,0,0,0,99,1,0,0,0, 0,0,0,0,1,0,0,0,11,0,0,0,67,0,0,0, @@ -461,7 +461,7 @@ 66,0,0,0,114,74,0,0,0,41,1,218,8,102,105,108, 101,110,97,109,101,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,11,95,103,101,116,95,99,97,99,104,101, - 100,90,1,0,0,115,16,0,0,0,0,1,14,1,2,1, + 100,91,1,0,0,115,16,0,0,0,0,1,14,1,2,1, 8,1,14,1,8,1,14,1,6,2,114,95,0,0,0,99, 1,0,0,0,0,0,0,0,2,0,0,0,11,0,0,0, 67,0,0,0,115,52,0,0,0,121,14,116,0,124,0,131, @@ -475,7 +475,7 @@ 114,39,0,0,0,114,41,0,0,0,114,40,0,0,0,41, 2,114,35,0,0,0,114,42,0,0,0,114,4,0,0,0, 114,4,0,0,0,114,5,0,0,0,218,10,95,99,97,108, - 99,95,109,111,100,101,102,1,0,0,115,12,0,0,0,0, + 99,95,109,111,100,101,103,1,0,0,115,12,0,0,0,0, 2,2,1,14,1,14,1,10,3,8,1,114,97,0,0,0, 99,1,0,0,0,0,0,0,0,3,0,0,0,11,0,0, 0,3,0,0,0,115,68,0,0,0,100,1,135,0,102,1, @@ -512,7 +512,7 @@ 0,0,0,218,4,97,114,103,115,90,6,107,119,97,114,103, 115,41,1,218,6,109,101,116,104,111,100,114,4,0,0,0, 114,5,0,0,0,218,19,95,99,104,101,99,107,95,110,97, - 109,101,95,119,114,97,112,112,101,114,122,1,0,0,115,12, + 109,101,95,119,114,97,112,112,101,114,123,1,0,0,115,12, 0,0,0,0,1,8,1,8,1,10,1,4,1,20,1,122, 40,95,99,104,101,99,107,95,110,97,109,101,46,60,108,111, 99,97,108,115,62,46,95,99,104,101,99,107,95,110,97,109, @@ -533,14 +533,14 @@ 105,99,116,95,95,218,6,117,112,100,97,116,101,41,3,90, 3,110,101,119,90,3,111,108,100,114,52,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,218,5,95, - 119,114,97,112,133,1,0,0,115,8,0,0,0,0,1,10, + 119,114,97,112,134,1,0,0,115,8,0,0,0,0,1,10, 1,10,1,22,1,122,26,95,99,104,101,99,107,95,110,97, 109,101,46,60,108,111,99,97,108,115,62,46,95,119,114,97, 112,41,3,218,10,95,98,111,111,116,115,116,114,97,112,114, 113,0,0,0,218,9,78,97,109,101,69,114,114,111,114,41, 3,114,102,0,0,0,114,103,0,0,0,114,113,0,0,0, 114,4,0,0,0,41,1,114,102,0,0,0,114,5,0,0, - 0,218,11,95,99,104,101,99,107,95,110,97,109,101,114,1, + 0,218,11,95,99,104,101,99,107,95,110,97,109,101,115,1, 0,0,115,14,0,0,0,0,8,14,7,2,1,10,1,14, 2,14,5,10,1,114,116,0,0,0,99,2,0,0,0,0, 0,0,0,5,0,0,0,4,0,0,0,67,0,0,0,115, @@ -568,7 +568,7 @@ 108,108,110,97,109,101,218,6,108,111,97,100,101,114,218,8, 112,111,114,116,105,111,110,115,218,3,109,115,103,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,218,17,95,102, - 105,110,100,95,109,111,100,117,108,101,95,115,104,105,109,142, + 105,110,100,95,109,111,100,117,108,101,95,115,104,105,109,143, 1,0,0,115,10,0,0,0,0,10,14,1,16,1,4,1, 22,1,114,123,0,0,0,99,4,0,0,0,0,0,0,0, 11,0,0,0,19,0,0,0,67,0,0,0,115,128,1,0, @@ -648,7 +648,7 @@ 109,101,218,11,115,111,117,114,99,101,95,115,105,122,101,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,25, 95,118,97,108,105,100,97,116,101,95,98,121,116,101,99,111, - 100,101,95,104,101,97,100,101,114,159,1,0,0,115,76,0, + 100,101,95,104,101,97,100,101,114,160,1,0,0,115,76,0, 0,0,0,11,4,1,8,1,10,3,4,1,8,1,8,1, 12,1,12,1,12,1,8,1,12,1,12,1,12,1,12,1, 10,1,12,1,10,1,12,1,10,1,12,1,8,1,10,1, @@ -678,7 +678,7 @@ 114,89,0,0,0,114,90,0,0,0,218,4,99,111,100,101, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218, 17,95,99,111,109,112,105,108,101,95,98,121,116,101,99,111, - 100,101,214,1,0,0,115,16,0,0,0,0,2,10,1,10, + 100,101,215,1,0,0,115,16,0,0,0,0,2,10,1,10, 1,12,1,8,1,12,1,6,2,12,1,114,141,0,0,0, 114,59,0,0,0,99,3,0,0,0,0,0,0,0,4,0, 0,0,3,0,0,0,67,0,0,0,115,56,0,0,0,116, @@ -696,7 +696,7 @@ 5,100,117,109,112,115,41,4,114,140,0,0,0,114,126,0, 0,0,114,134,0,0,0,114,53,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,218,17,95,99,111, - 100,101,95,116,111,95,98,121,116,101,99,111,100,101,226,1, + 100,101,95,116,111,95,98,121,116,101,99,111,100,101,227,1, 0,0,115,10,0,0,0,0,3,8,1,14,1,14,1,16, 1,114,144,0,0,0,99,1,0,0,0,0,0,0,0,5, 0,0,0,4,0,0,0,67,0,0,0,115,62,0,0,0, @@ -723,7 +723,7 @@ 97,100,108,105,110,101,218,8,101,110,99,111,100,105,110,103, 90,15,110,101,119,108,105,110,101,95,100,101,99,111,100,101, 114,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 218,13,100,101,99,111,100,101,95,115,111,117,114,99,101,236, + 218,13,100,101,99,111,100,101,95,115,111,117,114,99,101,237, 1,0,0,115,10,0,0,0,0,5,8,1,12,1,10,1, 12,1,114,149,0,0,0,114,120,0,0,0,218,26,115,117, 98,109,111,100,117,108,101,95,115,101,97,114,99,104,95,108, @@ -784,7 +784,7 @@ 7,100,105,114,110,97,109,101,114,4,0,0,0,114,4,0, 0,0,114,5,0,0,0,218,23,115,112,101,99,95,102,114, 111,109,95,102,105,108,101,95,108,111,99,97,116,105,111,110, - 253,1,0,0,115,60,0,0,0,0,12,8,4,4,1,10, + 254,1,0,0,115,60,0,0,0,0,12,8,4,4,1,10, 2,2,1,14,1,14,1,6,8,18,1,6,3,8,1,16, 1,14,1,10,1,6,1,6,2,4,3,8,2,10,1,2, 1,14,1,14,1,6,2,4,1,8,2,6,1,12,1,6, @@ -820,7 +820,7 @@ 89,95,76,79,67,65,76,95,77,65,67,72,73,78,69,41, 2,218,3,99,108,115,218,3,107,101,121,114,4,0,0,0, 114,4,0,0,0,114,5,0,0,0,218,14,95,111,112,101, - 110,95,114,101,103,105,115,116,114,121,75,2,0,0,115,8, + 110,95,114,101,103,105,115,116,114,121,76,2,0,0,115,8, 0,0,0,0,2,2,1,14,1,14,1,122,36,87,105,110, 100,111,119,115,82,101,103,105,115,116,114,121,70,105,110,100, 101,114,46,95,111,112,101,110,95,114,101,103,105,115,116,114, @@ -846,7 +846,7 @@ 107,101,121,114,165,0,0,0,90,4,104,107,101,121,218,8, 102,105,108,101,112,97,116,104,114,4,0,0,0,114,4,0, 0,0,114,5,0,0,0,218,16,95,115,101,97,114,99,104, - 95,114,101,103,105,115,116,114,121,82,2,0,0,115,22,0, + 95,114,101,103,105,115,116,114,121,83,2,0,0,115,22,0, 0,0,0,2,6,1,8,2,6,1,10,1,22,1,2,1, 12,1,26,1,14,1,6,1,122,38,87,105,110,100,111,119, 115,82,101,103,105,115,116,114,121,70,105,110,100,101,114,46, @@ -868,7 +868,7 @@ 114,35,0,0,0,218,6,116,97,114,103,101,116,114,171,0, 0,0,114,120,0,0,0,114,160,0,0,0,114,158,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 218,9,102,105,110,100,95,115,112,101,99,97,2,0,0,115, + 218,9,102,105,110,100,95,115,112,101,99,98,2,0,0,115, 26,0,0,0,0,2,10,1,8,1,4,1,2,1,12,1, 14,1,6,1,16,1,14,1,6,1,10,1,8,1,122,31, 87,105,110,100,111,119,115,82,101,103,105,115,116,114,121,70, @@ -887,7 +887,7 @@ 114,175,0,0,0,114,120,0,0,0,41,4,114,164,0,0, 0,114,119,0,0,0,114,35,0,0,0,114,158,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218, - 11,102,105,110,100,95,109,111,100,117,108,101,113,2,0,0, + 11,102,105,110,100,95,109,111,100,117,108,101,114,2,0,0, 115,8,0,0,0,0,7,12,1,8,1,8,2,122,33,87, 105,110,100,111,119,115,82,101,103,105,115,116,114,121,70,105, 110,100,101,114,46,102,105,110,100,95,109,111,100,117,108,101, @@ -896,7 +896,7 @@ 114,167,0,0,0,218,11,99,108,97,115,115,109,101,116,104, 111,100,114,166,0,0,0,114,172,0,0,0,114,175,0,0, 0,114,176,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,162,0,0,0,63, + 114,4,0,0,0,114,5,0,0,0,114,162,0,0,0,64, 2,0,0,115,20,0,0,0,8,2,4,3,4,3,4,2, 4,2,12,7,12,15,2,1,14,15,2,1,114,162,0,0, 0,99,0,0,0,0,0,0,0,0,0,0,0,0,2,0, @@ -931,7 +931,7 @@ 41,5,114,100,0,0,0,114,119,0,0,0,114,94,0,0, 0,90,13,102,105,108,101,110,97,109,101,95,98,97,115,101, 90,9,116,97,105,108,95,110,97,109,101,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,153,0,0,0,132, + 114,4,0,0,0,114,5,0,0,0,114,153,0,0,0,133, 2,0,0,115,8,0,0,0,0,3,18,1,16,1,14,1, 122,24,95,76,111,97,100,101,114,66,97,115,105,99,115,46, 105,115,95,112,97,99,107,97,103,101,99,2,0,0,0,0, @@ -942,7 +942,7 @@ 97,116,105,111,110,46,78,114,4,0,0,0,41,2,114,100, 0,0,0,114,158,0,0,0,114,4,0,0,0,114,4,0, 0,0,114,5,0,0,0,218,13,99,114,101,97,116,101,95, - 109,111,100,117,108,101,140,2,0,0,115,0,0,0,0,122, + 109,111,100,117,108,101,141,2,0,0,115,0,0,0,0,122, 27,95,76,111,97,100,101,114,66,97,115,105,99,115,46,99, 114,101,97,116,101,95,109,111,100,117,108,101,99,2,0,0, 0,0,0,0,0,3,0,0,0,4,0,0,0,67,0,0, @@ -962,7 +962,7 @@ 0,0,41,3,114,100,0,0,0,218,6,109,111,100,117,108, 101,114,140,0,0,0,114,4,0,0,0,114,4,0,0,0, 114,5,0,0,0,218,11,101,120,101,99,95,109,111,100,117, - 108,101,143,2,0,0,115,10,0,0,0,0,2,12,1,8, + 108,101,144,2,0,0,115,10,0,0,0,0,2,12,1,8, 1,6,1,10,1,122,25,95,76,111,97,100,101,114,66,97, 115,105,99,115,46,101,120,101,99,95,109,111,100,117,108,101, 99,2,0,0,0,0,0,0,0,2,0,0,0,3,0,0, @@ -973,14 +973,14 @@ 97,100,95,109,111,100,117,108,101,95,115,104,105,109,41,2, 114,100,0,0,0,114,119,0,0,0,114,4,0,0,0,114, 4,0,0,0,114,5,0,0,0,218,11,108,111,97,100,95, - 109,111,100,117,108,101,151,2,0,0,115,2,0,0,0,0, + 109,111,100,117,108,101,152,2,0,0,115,2,0,0,0,0, 2,122,25,95,76,111,97,100,101,114,66,97,115,105,99,115, 46,108,111,97,100,95,109,111,100,117,108,101,78,41,8,114, 105,0,0,0,114,104,0,0,0,114,106,0,0,0,114,107, 0,0,0,114,153,0,0,0,114,180,0,0,0,114,185,0, 0,0,114,187,0,0,0,114,4,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,114,178,0,0,0, - 127,2,0,0,115,10,0,0,0,8,3,4,2,8,8,8, + 128,2,0,0,115,10,0,0,0,8,3,4,2,8,8,8, 3,8,8,114,178,0,0,0,99,0,0,0,0,0,0,0, 0,0,0,0,0,4,0,0,0,64,0,0,0,115,74,0, 0,0,101,0,90,1,100,0,90,2,100,1,100,2,132,0, @@ -1005,7 +1005,7 @@ 32,32,32,32,78,41,1,218,7,73,79,69,114,114,111,114, 41,2,114,100,0,0,0,114,35,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,218,10,112,97,116, - 104,95,109,116,105,109,101,158,2,0,0,115,2,0,0,0, + 104,95,109,116,105,109,101,159,2,0,0,115,2,0,0,0, 0,6,122,23,83,111,117,114,99,101,76,111,97,100,101,114, 46,112,97,116,104,95,109,116,105,109,101,99,2,0,0,0, 0,0,0,0,2,0,0,0,3,0,0,0,67,0,0,0, @@ -1040,7 +1040,7 @@ 32,32,32,32,114,126,0,0,0,41,1,114,190,0,0,0, 41,2,114,100,0,0,0,114,35,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,218,10,112,97,116, - 104,95,115,116,97,116,115,166,2,0,0,115,2,0,0,0, + 104,95,115,116,97,116,115,167,2,0,0,115,2,0,0,0, 0,11,122,23,83,111,117,114,99,101,76,111,97,100,101,114, 46,112,97,116,104,95,115,116,97,116,115,99,4,0,0,0, 0,0,0,0,4,0,0,0,3,0,0,0,67,0,0,0, @@ -1064,7 +1064,7 @@ 0,90,10,99,97,99,104,101,95,112,97,116,104,114,53,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, 0,218,15,95,99,97,99,104,101,95,98,121,116,101,99,111, - 100,101,179,2,0,0,115,2,0,0,0,0,8,122,28,83, + 100,101,180,2,0,0,115,2,0,0,0,0,8,122,28,83, 111,117,114,99,101,76,111,97,100,101,114,46,95,99,97,99, 104,101,95,98,121,116,101,99,111,100,101,99,3,0,0,0, 0,0,0,0,3,0,0,0,1,0,0,0,67,0,0,0, @@ -1080,7 +1080,7 @@ 111,100,101,32,102,105,108,101,115,46,10,32,32,32,32,32, 32,32,32,78,114,4,0,0,0,41,3,114,100,0,0,0, 114,35,0,0,0,114,53,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,192,0,0,0,189,2, + 4,0,0,0,114,5,0,0,0,114,192,0,0,0,190,2, 0,0,115,0,0,0,0,122,21,83,111,117,114,99,101,76, 111,97,100,101,114,46,115,101,116,95,100,97,116,97,99,2, 0,0,0,0,0,0,0,5,0,0,0,16,0,0,0,67, @@ -1101,7 +1101,7 @@ 0,0,0,41,5,114,100,0,0,0,114,119,0,0,0,114, 35,0,0,0,114,147,0,0,0,218,3,101,120,99,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,218,10,103, - 101,116,95,115,111,117,114,99,101,196,2,0,0,115,14,0, + 101,116,95,115,111,117,114,99,101,197,2,0,0,115,14,0, 0,0,0,2,10,1,2,1,14,1,16,1,6,1,28,1, 122,23,83,111,117,114,99,101,76,111,97,100,101,114,46,103, 101,116,95,115,111,117,114,99,101,218,9,95,111,112,116,105, @@ -1123,7 +1123,7 @@ 101,41,4,114,100,0,0,0,114,53,0,0,0,114,35,0, 0,0,114,197,0,0,0,114,4,0,0,0,114,4,0,0, 0,114,5,0,0,0,218,14,115,111,117,114,99,101,95,116, - 111,95,99,111,100,101,206,2,0,0,115,4,0,0,0,0, + 111,95,99,111,100,101,207,2,0,0,115,4,0,0,0,0, 5,14,1,122,27,83,111,117,114,99,101,76,111,97,100,101, 114,46,115,111,117,114,99,101,95,116,111,95,99,111,100,101, 99,2,0,0,0,0,0,0,0,10,0,0,0,43,0,0, @@ -1180,7 +1180,7 @@ 10,98,121,116,101,115,95,100,97,116,97,114,147,0,0,0, 90,11,99,111,100,101,95,111,98,106,101,99,116,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,114,181,0,0, - 0,214,2,0,0,115,78,0,0,0,0,7,10,1,4,1, + 0,215,2,0,0,115,78,0,0,0,0,7,10,1,4,1, 2,1,12,1,14,1,10,2,2,1,14,1,14,1,6,2, 12,1,2,1,14,1,14,1,6,2,2,1,6,1,8,1, 12,1,18,1,6,2,8,1,6,1,10,1,4,1,8,1, @@ -1192,7 +1192,7 @@ 114,193,0,0,0,114,192,0,0,0,114,196,0,0,0,114, 200,0,0,0,114,181,0,0,0,114,4,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,188,0, - 0,0,156,2,0,0,115,14,0,0,0,8,2,8,8,8, + 0,0,157,2,0,0,115,14,0,0,0,8,2,8,8,8, 13,8,10,8,7,8,10,14,8,114,188,0,0,0,99,0, 0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0, 0,0,0,115,76,0,0,0,101,0,90,1,100,0,90,2, @@ -1218,7 +1218,7 @@ 100,101,114,46,78,41,2,114,98,0,0,0,114,35,0,0, 0,41,3,114,100,0,0,0,114,119,0,0,0,114,35,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,179,0,0,0,15,3,0,0,115,4,0,0,0,0, + 0,114,179,0,0,0,16,3,0,0,115,4,0,0,0,0, 3,6,1,122,19,70,105,108,101,76,111,97,100,101,114,46, 95,95,105,110,105,116,95,95,99,2,0,0,0,0,0,0, 0,2,0,0,0,2,0,0,0,67,0,0,0,115,24,0, @@ -1227,7 +1227,7 @@ 9,95,95,99,108,97,115,115,95,95,114,111,0,0,0,41, 2,114,100,0,0,0,218,5,111,116,104,101,114,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,218,6,95,95, - 101,113,95,95,21,3,0,0,115,4,0,0,0,0,1,12, + 101,113,95,95,22,3,0,0,115,4,0,0,0,0,1,12, 1,122,17,70,105,108,101,76,111,97,100,101,114,46,95,95, 101,113,95,95,99,1,0,0,0,0,0,0,0,1,0,0, 0,3,0,0,0,67,0,0,0,115,20,0,0,0,116,0, @@ -1235,7 +1235,7 @@ 83,0,41,1,78,41,3,218,4,104,97,115,104,114,98,0, 0,0,114,35,0,0,0,41,1,114,100,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,218,8,95, - 95,104,97,115,104,95,95,25,3,0,0,115,2,0,0,0, + 95,104,97,115,104,95,95,26,3,0,0,115,2,0,0,0, 0,1,122,19,70,105,108,101,76,111,97,100,101,114,46,95, 95,104,97,115,104,95,95,99,2,0,0,0,0,0,0,0, 2,0,0,0,3,0,0,0,3,0,0,0,115,16,0,0, @@ -1249,7 +1249,7 @@ 10,32,32,32,32,32,32,32,32,41,3,218,5,115,117,112, 101,114,114,204,0,0,0,114,187,0,0,0,41,2,114,100, 0,0,0,114,119,0,0,0,41,1,114,205,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,187,0,0,0,28,3, + 4,0,0,0,114,5,0,0,0,114,187,0,0,0,29,3, 0,0,115,2,0,0,0,0,10,122,22,70,105,108,101,76, 111,97,100,101,114,46,108,111,97,100,95,109,111,100,117,108, 101,99,2,0,0,0,0,0,0,0,2,0,0,0,1,0, @@ -1260,7 +1260,7 @@ 32,98,121,32,116,104,101,32,102,105,110,100,101,114,46,41, 1,114,35,0,0,0,41,2,114,100,0,0,0,114,119,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,151,0,0,0,40,3,0,0,115,2,0,0,0,0, + 0,114,151,0,0,0,41,3,0,0,115,2,0,0,0,0, 3,122,23,70,105,108,101,76,111,97,100,101,114,46,103,101, 116,95,102,105,108,101,110,97,109,101,99,2,0,0,0,0, 0,0,0,3,0,0,0,9,0,0,0,67,0,0,0,115, @@ -1272,7 +1272,7 @@ 1,114,78,41,3,114,49,0,0,0,114,50,0,0,0,90, 4,114,101,97,100,41,3,114,100,0,0,0,114,35,0,0, 0,114,54,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,5,0,0,0,114,194,0,0,0,45,3,0,0,115,4, + 114,5,0,0,0,114,194,0,0,0,46,3,0,0,115,4, 0,0,0,0,2,14,1,122,19,70,105,108,101,76,111,97, 100,101,114,46,103,101,116,95,100,97,116,97,41,11,114,105, 0,0,0,114,104,0,0,0,114,106,0,0,0,114,107,0, @@ -1280,7 +1280,7 @@ 0,114,116,0,0,0,114,187,0,0,0,114,151,0,0,0, 114,194,0,0,0,114,4,0,0,0,114,4,0,0,0,41, 1,114,205,0,0,0,114,5,0,0,0,114,204,0,0,0, - 10,3,0,0,115,14,0,0,0,8,3,4,2,8,6,8, + 11,3,0,0,115,14,0,0,0,8,3,4,2,8,6,8, 4,8,3,16,12,12,5,114,204,0,0,0,99,0,0,0, 0,0,0,0,0,0,0,0,0,4,0,0,0,64,0,0, 0,115,46,0,0,0,101,0,90,1,100,0,90,2,100,1, @@ -1301,7 +1301,7 @@ 0,0,0,218,8,115,116,95,109,116,105,109,101,90,7,115, 116,95,115,105,122,101,41,3,114,100,0,0,0,114,35,0, 0,0,114,202,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,5,0,0,0,114,191,0,0,0,55,3,0,0,115, + 0,114,5,0,0,0,114,191,0,0,0,56,3,0,0,115, 4,0,0,0,0,2,8,1,122,27,83,111,117,114,99,101, 70,105,108,101,76,111,97,100,101,114,46,112,97,116,104,95, 115,116,97,116,115,99,4,0,0,0,0,0,0,0,5,0, @@ -1311,7 +1311,7 @@ 111,100,101,41,2,114,97,0,0,0,114,192,0,0,0,41, 5,114,100,0,0,0,114,90,0,0,0,114,89,0,0,0, 114,53,0,0,0,114,42,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,193,0,0,0,60,3, + 4,0,0,0,114,5,0,0,0,114,193,0,0,0,61,3, 0,0,115,4,0,0,0,0,2,8,1,122,32,83,111,117, 114,99,101,70,105,108,101,76,111,97,100,101,114,46,95,99, 97,99,104,101,95,98,121,116,101,99,111,100,101,114,214,0, @@ -1346,7 +1346,7 @@ 0,0,0,114,214,0,0,0,218,6,112,97,114,101,110,116, 114,94,0,0,0,114,27,0,0,0,114,23,0,0,0,114, 195,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,192,0,0,0,65,3,0,0,115,42,0,0, + 0,0,0,114,192,0,0,0,66,3,0,0,115,42,0,0, 0,0,2,12,1,4,2,16,1,12,1,14,2,14,1,10, 1,2,1,14,1,14,2,6,1,16,3,6,1,8,1,20, 1,2,1,12,1,16,1,16,2,8,1,122,25,83,111,117, @@ -1355,7 +1355,7 @@ 0,0,0,114,106,0,0,0,114,107,0,0,0,114,191,0, 0,0,114,193,0,0,0,114,192,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,212,0,0,0,51,3,0,0,115,8,0,0,0,8,2, + 114,212,0,0,0,52,3,0,0,115,8,0,0,0,8,2, 4,2,8,5,8,5,114,212,0,0,0,99,0,0,0,0, 0,0,0,0,0,0,0,0,2,0,0,0,64,0,0,0, 115,32,0,0,0,101,0,90,1,100,0,90,2,100,1,90, @@ -1375,7 +1375,7 @@ 0,114,141,0,0,0,41,5,114,100,0,0,0,114,119,0, 0,0,114,35,0,0,0,114,53,0,0,0,114,203,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,181,0,0,0,100,3,0,0,115,8,0,0,0,0,1, + 114,181,0,0,0,101,3,0,0,115,8,0,0,0,0,1, 10,1,10,1,18,1,122,29,83,111,117,114,99,101,108,101, 115,115,70,105,108,101,76,111,97,100,101,114,46,103,101,116, 95,99,111,100,101,99,2,0,0,0,0,0,0,0,2,0, @@ -1385,13 +1385,13 @@ 111,32,115,111,117,114,99,101,32,99,111,100,101,46,78,114, 4,0,0,0,41,2,114,100,0,0,0,114,119,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 196,0,0,0,106,3,0,0,115,2,0,0,0,0,2,122, + 196,0,0,0,107,3,0,0,115,2,0,0,0,0,2,122, 31,83,111,117,114,99,101,108,101,115,115,70,105,108,101,76, 111,97,100,101,114,46,103,101,116,95,115,111,117,114,99,101, 78,41,6,114,105,0,0,0,114,104,0,0,0,114,106,0, 0,0,114,107,0,0,0,114,181,0,0,0,114,196,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,5,0,0,0,114,217,0,0,0,96,3,0,0,115,6, + 114,5,0,0,0,114,217,0,0,0,97,3,0,0,115,6, 0,0,0,8,2,4,2,8,6,114,217,0,0,0,99,0, 0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,64, 0,0,0,115,92,0,0,0,101,0,90,1,100,0,90,2, @@ -1413,7 +1413,7 @@ 100,0,83,0,41,1,78,41,2,114,98,0,0,0,114,35, 0,0,0,41,3,114,100,0,0,0,114,98,0,0,0,114, 35,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,179,0,0,0,123,3,0,0,115,4,0,0, + 0,0,0,114,179,0,0,0,124,3,0,0,115,4,0,0, 0,0,1,6,1,122,28,69,120,116,101,110,115,105,111,110, 70,105,108,101,76,111,97,100,101,114,46,95,95,105,110,105, 116,95,95,99,2,0,0,0,0,0,0,0,2,0,0,0, @@ -1422,7 +1422,7 @@ 1,107,2,83,0,41,1,78,41,2,114,205,0,0,0,114, 111,0,0,0,41,2,114,100,0,0,0,114,206,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 207,0,0,0,127,3,0,0,115,4,0,0,0,0,1,12, + 207,0,0,0,128,3,0,0,115,4,0,0,0,0,1,12, 1,122,26,69,120,116,101,110,115,105,111,110,70,105,108,101, 76,111,97,100,101,114,46,95,95,101,113,95,95,99,1,0, 0,0,0,0,0,0,1,0,0,0,3,0,0,0,67,0, @@ -1430,7 +1430,7 @@ 0,124,0,106,2,131,1,65,0,83,0,41,1,78,41,3, 114,208,0,0,0,114,98,0,0,0,114,35,0,0,0,41, 1,114,100,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,5,0,0,0,114,209,0,0,0,131,3,0,0,115,2, + 114,5,0,0,0,114,209,0,0,0,132,3,0,0,115,2, 0,0,0,0,1,122,28,69,120,116,101,110,115,105,111,110, 70,105,108,101,76,111,97,100,101,114,46,95,95,104,97,115, 104,95,95,99,2,0,0,0,0,0,0,0,3,0,0,0, @@ -1447,7 +1447,7 @@ 97,109,105,99,114,129,0,0,0,114,98,0,0,0,114,35, 0,0,0,41,3,114,100,0,0,0,114,158,0,0,0,114, 184,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,180,0,0,0,134,3,0,0,115,10,0,0, + 0,0,0,114,180,0,0,0,135,3,0,0,115,10,0,0, 0,0,2,4,1,10,1,6,1,12,1,122,33,69,120,116, 101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,114, 46,99,114,101,97,116,101,95,109,111,100,117,108,101,99,2, @@ -1464,7 +1464,7 @@ 95,100,121,110,97,109,105,99,114,129,0,0,0,114,98,0, 0,0,114,35,0,0,0,41,2,114,100,0,0,0,114,184, 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,114,185,0,0,0,142,3,0,0,115,6,0,0,0, + 0,0,114,185,0,0,0,143,3,0,0,115,6,0,0,0, 0,2,14,1,6,1,122,31,69,120,116,101,110,115,105,111, 110,70,105,108,101,76,111,97,100,101,114,46,101,120,101,99, 95,109,111,100,117,108,101,99,2,0,0,0,0,0,0,0, @@ -1482,7 +1482,7 @@ 41,2,114,22,0,0,0,218,6,115,117,102,102,105,120,41, 1,218,9,102,105,108,101,95,110,97,109,101,114,4,0,0, 0,114,5,0,0,0,250,9,60,103,101,110,101,120,112,114, - 62,151,3,0,0,115,2,0,0,0,4,1,122,49,69,120, + 62,152,3,0,0,115,2,0,0,0,4,1,122,49,69,120, 116,101,110,115,105,111,110,70,105,108,101,76,111,97,100,101, 114,46,105,115,95,112,97,99,107,97,103,101,46,60,108,111, 99,97,108,115,62,46,60,103,101,110,101,120,112,114,62,41, @@ -1490,7 +1490,7 @@ 218,18,69,88,84,69,78,83,73,79,78,95,83,85,70,70, 73,88,69,83,41,2,114,100,0,0,0,114,119,0,0,0, 114,4,0,0,0,41,1,114,220,0,0,0,114,5,0,0, - 0,114,153,0,0,0,148,3,0,0,115,6,0,0,0,0, + 0,114,153,0,0,0,149,3,0,0,115,6,0,0,0,0, 2,14,1,12,1,122,30,69,120,116,101,110,115,105,111,110, 70,105,108,101,76,111,97,100,101,114,46,105,115,95,112,97, 99,107,97,103,101,99,2,0,0,0,0,0,0,0,2,0, @@ -1501,7 +1501,7 @@ 32,99,114,101,97,116,101,32,97,32,99,111,100,101,32,111, 98,106,101,99,116,46,78,114,4,0,0,0,41,2,114,100, 0,0,0,114,119,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,114,181,0,0,0,154,3,0,0, + 0,0,114,5,0,0,0,114,181,0,0,0,155,3,0,0, 115,2,0,0,0,0,2,122,28,69,120,116,101,110,115,105, 111,110,70,105,108,101,76,111,97,100,101,114,46,103,101,116, 95,99,111,100,101,99,2,0,0,0,0,0,0,0,2,0, @@ -1512,7 +1512,7 @@ 115,111,117,114,99,101,32,99,111,100,101,46,78,114,4,0, 0,0,41,2,114,100,0,0,0,114,119,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,196,0, - 0,0,158,3,0,0,115,2,0,0,0,0,2,122,30,69, + 0,0,159,3,0,0,115,2,0,0,0,0,2,122,30,69, 120,116,101,110,115,105,111,110,70,105,108,101,76,111,97,100, 101,114,46,103,101,116,95,115,111,117,114,99,101,99,2,0, 0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,0, @@ -1523,7 +1523,7 @@ 116,104,101,32,102,105,110,100,101,114,46,41,1,114,35,0, 0,0,41,2,114,100,0,0,0,114,119,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,151,0, - 0,0,162,3,0,0,115,2,0,0,0,0,3,122,32,69, + 0,0,163,3,0,0,115,2,0,0,0,0,3,122,32,69, 120,116,101,110,115,105,111,110,70,105,108,101,76,111,97,100, 101,114,46,103,101,116,95,102,105,108,101,110,97,109,101,78, 41,14,114,105,0,0,0,114,104,0,0,0,114,106,0,0, @@ -1532,7 +1532,7 @@ 153,0,0,0,114,181,0,0,0,114,196,0,0,0,114,116, 0,0,0,114,151,0,0,0,114,4,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,114,218,0,0, - 0,115,3,0,0,115,20,0,0,0,8,6,4,2,8,4, + 0,116,3,0,0,115,20,0,0,0,8,6,4,2,8,4, 8,4,8,3,8,8,8,6,8,6,8,4,8,4,114,218, 0,0,0,99,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,64,0,0,0,115,96,0,0,0,101,0,90, @@ -1573,7 +1573,7 @@ 100,101,114,41,4,114,100,0,0,0,114,98,0,0,0,114, 35,0,0,0,218,11,112,97,116,104,95,102,105,110,100,101, 114,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,179,0,0,0,175,3,0,0,115,8,0,0,0,0,1, + 114,179,0,0,0,176,3,0,0,115,8,0,0,0,0,1, 6,1,6,1,14,1,122,23,95,78,97,109,101,115,112,97, 99,101,80,97,116,104,46,95,95,105,110,105,116,95,95,99, 1,0,0,0,0,0,0,0,4,0,0,0,3,0,0,0, @@ -1591,7 +1591,7 @@ 216,0,0,0,218,3,100,111,116,90,2,109,101,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,218,23,95,102, 105,110,100,95,112,97,114,101,110,116,95,112,97,116,104,95, - 110,97,109,101,115,181,3,0,0,115,8,0,0,0,0,2, + 110,97,109,101,115,182,3,0,0,115,8,0,0,0,0,2, 18,1,8,2,4,3,122,38,95,78,97,109,101,115,112,97, 99,101,80,97,116,104,46,95,102,105,110,100,95,112,97,114, 101,110,116,95,112,97,116,104,95,110,97,109,101,115,99,1, @@ -1604,7 +1604,7 @@ 95,109,111,100,117,108,101,95,110,97,109,101,90,14,112,97, 116,104,95,97,116,116,114,95,110,97,109,101,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,114,227,0,0,0, - 191,3,0,0,115,4,0,0,0,0,1,12,1,122,31,95, + 192,3,0,0,115,4,0,0,0,0,1,12,1,122,31,95, 78,97,109,101,115,112,97,99,101,80,97,116,104,46,95,103, 101,116,95,112,97,114,101,110,116,95,112,97,116,104,99,1, 0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,67, @@ -1619,7 +1619,7 @@ 114,226,0,0,0,41,3,114,100,0,0,0,90,11,112,97, 114,101,110,116,95,112,97,116,104,114,158,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,218,12,95, - 114,101,99,97,108,99,117,108,97,116,101,195,3,0,0,115, + 114,101,99,97,108,99,117,108,97,116,101,196,3,0,0,115, 16,0,0,0,0,2,12,1,10,1,14,3,18,1,6,1, 8,1,6,1,122,27,95,78,97,109,101,115,112,97,99,101, 80,97,116,104,46,95,114,101,99,97,108,99,117,108,97,116, @@ -1628,7 +1628,7 @@ 1,131,0,131,1,83,0,41,1,78,41,2,218,4,105,116, 101,114,114,234,0,0,0,41,1,114,100,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,218,8,95, - 95,105,116,101,114,95,95,208,3,0,0,115,2,0,0,0, + 95,105,116,101,114,95,95,209,3,0,0,115,2,0,0,0, 0,1,122,23,95,78,97,109,101,115,112,97,99,101,80,97, 116,104,46,95,95,105,116,101,114,95,95,99,3,0,0,0, 0,0,0,0,3,0,0,0,3,0,0,0,67,0,0,0, @@ -1636,7 +1636,7 @@ 0,83,0,41,1,78,41,1,114,226,0,0,0,41,3,114, 100,0,0,0,218,5,105,110,100,101,120,114,35,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218, - 11,95,95,115,101,116,105,116,101,109,95,95,211,3,0,0, + 11,95,95,115,101,116,105,116,101,109,95,95,212,3,0,0, 115,2,0,0,0,0,1,122,26,95,78,97,109,101,115,112, 97,99,101,80,97,116,104,46,95,95,115,101,116,105,116,101, 109,95,95,99,1,0,0,0,0,0,0,0,1,0,0,0, @@ -1644,7 +1644,7 @@ 0,106,1,131,0,131,1,83,0,41,1,78,41,2,114,31, 0,0,0,114,234,0,0,0,41,1,114,100,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,7, - 95,95,108,101,110,95,95,214,3,0,0,115,2,0,0,0, + 95,95,108,101,110,95,95,215,3,0,0,115,2,0,0,0, 0,1,122,22,95,78,97,109,101,115,112,97,99,101,80,97, 116,104,46,95,95,108,101,110,95,95,99,1,0,0,0,0, 0,0,0,1,0,0,0,2,0,0,0,67,0,0,0,115, @@ -1653,7 +1653,7 @@ 97,116,104,40,123,33,114,125,41,41,2,114,47,0,0,0, 114,226,0,0,0,41,1,114,100,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,218,8,95,95,114, - 101,112,114,95,95,217,3,0,0,115,2,0,0,0,0,1, + 101,112,114,95,95,218,3,0,0,115,2,0,0,0,0,1, 122,23,95,78,97,109,101,115,112,97,99,101,80,97,116,104, 46,95,95,114,101,112,114,95,95,99,2,0,0,0,0,0, 0,0,2,0,0,0,2,0,0,0,67,0,0,0,115,12, @@ -1661,7 +1661,7 @@ 1,78,41,1,114,234,0,0,0,41,2,114,100,0,0,0, 218,4,105,116,101,109,114,4,0,0,0,114,4,0,0,0, 114,5,0,0,0,218,12,95,95,99,111,110,116,97,105,110, - 115,95,95,220,3,0,0,115,2,0,0,0,0,1,122,27, + 115,95,95,221,3,0,0,115,2,0,0,0,0,1,122,27, 95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95, 95,99,111,110,116,97,105,110,115,95,95,99,2,0,0,0, 0,0,0,0,2,0,0,0,2,0,0,0,67,0,0,0, @@ -1669,7 +1669,7 @@ 0,100,0,83,0,41,1,78,41,2,114,226,0,0,0,114, 157,0,0,0,41,2,114,100,0,0,0,114,241,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 157,0,0,0,223,3,0,0,115,2,0,0,0,0,1,122, + 157,0,0,0,224,3,0,0,115,2,0,0,0,0,1,122, 21,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46, 97,112,112,101,110,100,78,41,14,114,105,0,0,0,114,104, 0,0,0,114,106,0,0,0,114,107,0,0,0,114,179,0, @@ -1677,7 +1677,7 @@ 0,114,236,0,0,0,114,238,0,0,0,114,239,0,0,0, 114,240,0,0,0,114,242,0,0,0,114,157,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,224,0,0,0,168,3,0,0,115,22,0,0, + 0,0,0,114,224,0,0,0,169,3,0,0,115,22,0,0, 0,8,5,4,2,8,6,8,10,8,4,8,13,8,3,8, 3,8,3,8,3,8,3,114,224,0,0,0,99,0,0,0, 0,0,0,0,0,0,0,0,0,3,0,0,0,64,0,0, @@ -1693,7 +1693,7 @@ 95,1,100,0,83,0,41,1,78,41,2,114,224,0,0,0, 114,226,0,0,0,41,4,114,100,0,0,0,114,98,0,0, 0,114,35,0,0,0,114,230,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,179,0,0,0,229, + 114,4,0,0,0,114,5,0,0,0,114,179,0,0,0,230, 3,0,0,115,2,0,0,0,0,1,122,25,95,78,97,109, 101,115,112,97,99,101,76,111,97,100,101,114,46,95,95,105, 110,105,116,95,95,99,2,0,0,0,0,0,0,0,2,0, @@ -1711,21 +1711,21 @@ 47,0,0,0,114,105,0,0,0,41,2,114,164,0,0,0, 114,184,0,0,0,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,11,109,111,100,117,108,101,95,114,101,112, - 114,232,3,0,0,115,2,0,0,0,0,7,122,28,95,78, + 114,233,3,0,0,115,2,0,0,0,0,7,122,28,95,78, 97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,109, 111,100,117,108,101,95,114,101,112,114,99,2,0,0,0,0, 0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,115, 4,0,0,0,100,1,83,0,41,2,78,84,114,4,0,0, 0,41,2,114,100,0,0,0,114,119,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,114,153,0,0, - 0,241,3,0,0,115,2,0,0,0,0,1,122,27,95,78, + 0,242,3,0,0,115,2,0,0,0,0,1,122,27,95,78, 97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,105, 115,95,112,97,99,107,97,103,101,99,2,0,0,0,0,0, 0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,4, 0,0,0,100,1,83,0,41,2,78,114,30,0,0,0,114, 4,0,0,0,41,2,114,100,0,0,0,114,119,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 196,0,0,0,244,3,0,0,115,2,0,0,0,0,1,122, + 196,0,0,0,245,3,0,0,115,2,0,0,0,0,1,122, 27,95,78,97,109,101,115,112,97,99,101,76,111,97,100,101, 114,46,103,101,116,95,115,111,117,114,99,101,99,2,0,0, 0,0,0,0,0,2,0,0,0,6,0,0,0,67,0,0, @@ -1734,7 +1734,7 @@ 122,8,60,115,116,114,105,110,103,62,114,183,0,0,0,114, 198,0,0,0,84,41,1,114,199,0,0,0,41,2,114,100, 0,0,0,114,119,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,114,181,0,0,0,247,3,0,0, + 0,0,114,5,0,0,0,114,181,0,0,0,248,3,0,0, 115,2,0,0,0,0,1,122,25,95,78,97,109,101,115,112, 97,99,101,76,111,97,100,101,114,46,103,101,116,95,99,111, 100,101,99,2,0,0,0,0,0,0,0,2,0,0,0,1, @@ -1744,14 +1744,14 @@ 100,117,108,101,32,99,114,101,97,116,105,111,110,46,78,114, 4,0,0,0,41,2,114,100,0,0,0,114,158,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 180,0,0,0,250,3,0,0,115,0,0,0,0,122,30,95, + 180,0,0,0,251,3,0,0,115,0,0,0,0,122,30,95, 78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,46, 99,114,101,97,116,101,95,109,111,100,117,108,101,99,2,0, 0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,0, 0,0,115,4,0,0,0,100,0,83,0,41,1,78,114,4, 0,0,0,41,2,114,100,0,0,0,114,184,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,185, - 0,0,0,253,3,0,0,115,2,0,0,0,0,1,122,28, + 0,0,0,254,3,0,0,115,2,0,0,0,0,1,122,28, 95,78,97,109,101,115,112,97,99,101,76,111,97,100,101,114, 46,101,120,101,99,95,109,111,100,117,108,101,99,2,0,0, 0,0,0,0,0,2,0,0,0,3,0,0,0,67,0,0, @@ -1769,7 +1769,7 @@ 114,114,0,0,0,114,129,0,0,0,114,226,0,0,0,114, 186,0,0,0,41,2,114,100,0,0,0,114,119,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 187,0,0,0,0,4,0,0,115,6,0,0,0,0,7,6, + 187,0,0,0,1,4,0,0,115,6,0,0,0,0,7,6, 1,8,1,122,28,95,78,97,109,101,115,112,97,99,101,76, 111,97,100,101,114,46,108,111,97,100,95,109,111,100,117,108, 101,78,41,12,114,105,0,0,0,114,104,0,0,0,114,106, @@ -1777,7 +1777,7 @@ 0,0,114,153,0,0,0,114,196,0,0,0,114,181,0,0, 0,114,180,0,0,0,114,185,0,0,0,114,187,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,243,0,0,0,228,3,0,0,115,16,0, + 5,0,0,0,114,243,0,0,0,229,3,0,0,115,16,0, 0,0,8,1,8,3,12,9,8,3,8,3,8,3,8,3, 8,3,114,243,0,0,0,99,0,0,0,0,0,0,0,0, 0,0,0,0,5,0,0,0,64,0,0,0,115,108,0,0, @@ -1811,7 +1811,7 @@ 218,6,118,97,108,117,101,115,114,108,0,0,0,114,246,0, 0,0,41,2,114,164,0,0,0,218,6,102,105,110,100,101, 114,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,246,0,0,0,18,4,0,0,115,6,0,0,0,0,4, + 114,246,0,0,0,19,4,0,0,115,6,0,0,0,0,4, 16,1,10,1,122,28,80,97,116,104,70,105,110,100,101,114, 46,105,110,118,97,108,105,100,97,116,101,95,99,97,99,104, 101,115,99,2,0,0,0,0,0,0,0,3,0,0,0,12, @@ -1835,7 +1835,7 @@ 0,0,0,114,99,0,0,0,41,3,114,164,0,0,0,114, 35,0,0,0,90,4,104,111,111,107,114,4,0,0,0,114, 4,0,0,0,114,5,0,0,0,218,11,95,112,97,116,104, - 95,104,111,111,107,115,26,4,0,0,115,16,0,0,0,0, + 95,104,111,111,107,115,27,4,0,0,115,16,0,0,0,0, 7,18,1,12,1,12,1,2,1,8,1,14,1,12,2,122, 22,80,97,116,104,70,105,110,100,101,114,46,95,112,97,116, 104,95,104,111,111,107,115,99,2,0,0,0,0,0,0,0, @@ -1866,7 +1866,7 @@ 0,114,251,0,0,0,41,3,114,164,0,0,0,114,35,0, 0,0,114,249,0,0,0,114,4,0,0,0,114,4,0,0, 0,114,5,0,0,0,218,20,95,112,97,116,104,95,105,109, - 112,111,114,116,101,114,95,99,97,99,104,101,43,4,0,0, + 112,111,114,116,101,114,95,99,97,99,104,101,44,4,0,0, 115,22,0,0,0,0,8,8,1,2,1,12,1,14,3,6, 1,2,1,14,1,14,1,10,1,16,1,122,31,80,97,116, 104,70,105,110,100,101,114,46,95,112,97,116,104,95,105,109, @@ -1884,7 +1884,7 @@ 0,114,249,0,0,0,114,120,0,0,0,114,121,0,0,0, 114,158,0,0,0,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,16,95,108,101,103,97,99,121,95,103,101, - 116,95,115,112,101,99,65,4,0,0,115,18,0,0,0,0, + 116,95,115,112,101,99,66,4,0,0,115,18,0,0,0,0, 4,10,1,16,2,10,1,4,1,8,1,12,1,12,1,6, 1,122,27,80,97,116,104,70,105,110,100,101,114,46,95,108, 101,103,97,99,121,95,103,101,116,95,115,112,101,99,78,99, @@ -1915,7 +1915,7 @@ 109,101,115,112,97,99,101,95,112,97,116,104,90,5,101,110, 116,114,121,114,249,0,0,0,114,158,0,0,0,114,121,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,218,9,95,103,101,116,95,115,112,101,99,80,4,0,0, + 0,218,9,95,103,101,116,95,115,112,101,99,81,4,0,0, 115,40,0,0,0,0,5,4,1,10,1,14,1,2,1,10, 1,8,1,10,1,14,2,12,1,8,1,2,1,10,1,4, 1,6,1,8,1,8,5,14,2,12,1,6,1,122,20,80, @@ -1941,7 +1941,7 @@ 0,0,0,114,119,0,0,0,114,35,0,0,0,114,174,0, 0,0,114,158,0,0,0,114,0,1,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,114,175,0,0,0, - 112,4,0,0,115,26,0,0,0,0,4,8,1,6,1,14, + 113,4,0,0,115,26,0,0,0,0,4,8,1,6,1,14, 1,8,1,6,1,10,1,6,1,4,3,6,1,16,1,6, 2,6,2,122,20,80,97,116,104,70,105,110,100,101,114,46, 102,105,110,100,95,115,112,101,99,99,3,0,0,0,0,0, @@ -1962,7 +1962,7 @@ 41,2,114,175,0,0,0,114,120,0,0,0,41,4,114,164, 0,0,0,114,119,0,0,0,114,35,0,0,0,114,158,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,176,0,0,0,134,4,0,0,115,8,0,0,0,0, + 0,114,176,0,0,0,135,4,0,0,115,8,0,0,0,0, 8,12,1,8,1,4,1,122,22,80,97,116,104,70,105,110, 100,101,114,46,102,105,110,100,95,109,111,100,117,108,101,41, 12,114,105,0,0,0,114,104,0,0,0,114,106,0,0,0, @@ -1970,7 +1970,7 @@ 251,0,0,0,114,253,0,0,0,114,254,0,0,0,114,1, 1,0,0,114,175,0,0,0,114,176,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,245,0,0,0,14,4,0,0,115,22,0,0,0,8, + 0,114,245,0,0,0,15,4,0,0,115,22,0,0,0,8, 2,4,2,12,8,12,17,12,22,12,15,2,1,12,31,2, 1,14,21,2,1,114,245,0,0,0,99,0,0,0,0,0, 0,0,0,0,0,0,0,3,0,0,0,64,0,0,0,115, @@ -2014,7 +2014,7 @@ 86,0,1,0,113,2,100,0,83,0,41,1,78,114,4,0, 0,0,41,2,114,22,0,0,0,114,219,0,0,0,41,1, 114,120,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 221,0,0,0,163,4,0,0,115,2,0,0,0,4,0,122, + 221,0,0,0,164,4,0,0,115,2,0,0,0,4,0,122, 38,70,105,108,101,70,105,110,100,101,114,46,95,95,105,110, 105,116,95,95,46,60,108,111,99,97,108,115,62,46,60,103, 101,110,101,120,112,114,62,114,58,0,0,0,114,29,0,0, @@ -2027,7 +2027,7 @@ 111,97,100,101,114,95,100,101,116,97,105,108,115,90,7,108, 111,97,100,101,114,115,114,160,0,0,0,114,4,0,0,0, 41,1,114,120,0,0,0,114,5,0,0,0,114,179,0,0, - 0,157,4,0,0,115,16,0,0,0,0,4,4,1,14,1, + 0,158,4,0,0,115,16,0,0,0,0,4,4,1,14,1, 28,1,6,2,10,1,6,1,8,1,122,19,70,105,108,101, 70,105,110,100,101,114,46,95,95,105,110,105,116,95,95,99, 1,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0, @@ -2037,7 +2037,7 @@ 109,116,105,109,101,46,114,29,0,0,0,78,114,87,0,0, 0,41,1,114,4,1,0,0,41,1,114,100,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,246, - 0,0,0,171,4,0,0,115,2,0,0,0,0,2,122,28, + 0,0,0,172,4,0,0,115,2,0,0,0,0,2,122,28, 70,105,108,101,70,105,110,100,101,114,46,105,110,118,97,108, 105,100,97,116,101,95,99,97,99,104,101,115,99,2,0,0, 0,0,0,0,0,3,0,0,0,2,0,0,0,67,0,0, @@ -2060,7 +2060,7 @@ 0,114,120,0,0,0,114,150,0,0,0,41,3,114,100,0, 0,0,114,119,0,0,0,114,158,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,114,117,0,0,0, - 177,4,0,0,115,8,0,0,0,0,7,10,1,8,1,8, + 178,4,0,0,115,8,0,0,0,0,7,10,1,8,1,8, 1,122,22,70,105,108,101,70,105,110,100,101,114,46,102,105, 110,100,95,108,111,97,100,101,114,99,6,0,0,0,0,0, 0,0,7,0,0,0,7,0,0,0,67,0,0,0,115,30, @@ -2070,7 +2070,7 @@ 114,161,0,0,0,41,7,114,100,0,0,0,114,159,0,0, 0,114,119,0,0,0,114,35,0,0,0,90,4,115,109,115, 108,114,174,0,0,0,114,120,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,1,1,0,0,189, + 114,4,0,0,0,114,5,0,0,0,114,1,1,0,0,190, 4,0,0,115,6,0,0,0,0,1,10,1,12,1,122,20, 70,105,108,101,70,105,110,100,101,114,46,95,103,101,116,95, 115,112,101,99,78,99,3,0,0,0,0,0,0,0,14,0, @@ -2124,7 +2124,7 @@ 116,104,114,219,0,0,0,114,159,0,0,0,90,13,105,110, 105,116,95,102,105,108,101,110,97,109,101,90,9,102,117,108, 108,95,112,97,116,104,114,158,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,175,0,0,0,194, + 114,4,0,0,0,114,5,0,0,0,114,175,0,0,0,195, 4,0,0,115,70,0,0,0,0,3,4,1,14,1,2,1, 24,1,14,1,10,1,10,1,8,1,6,2,6,1,6,1, 10,2,6,1,4,2,8,1,12,1,16,1,8,1,10,1, @@ -2156,7 +2156,7 @@ 0,146,2,113,4,83,0,114,4,0,0,0,41,1,114,88, 0,0,0,41,2,114,22,0,0,0,90,2,102,110,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,250,9,60, - 115,101,116,99,111,109,112,62,13,5,0,0,115,2,0,0, + 115,101,116,99,111,109,112,62,14,5,0,0,115,2,0,0, 0,6,0,122,41,70,105,108,101,70,105,110,100,101,114,46, 95,102,105,108,108,95,99,97,99,104,101,46,60,108,111,99, 97,108,115,62,46,60,115,101,116,99,111,109,112,62,78,41, @@ -2173,7 +2173,7 @@ 111,110,116,101,110,116,115,114,241,0,0,0,114,98,0,0, 0,114,231,0,0,0,114,219,0,0,0,90,8,110,101,119, 95,110,97,109,101,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,9,1,0,0,240,4,0,0,115,34,0, + 5,0,0,0,114,9,1,0,0,241,4,0,0,115,34,0, 0,0,0,2,6,1,2,1,22,1,20,3,10,3,12,1, 12,7,6,1,10,1,16,1,4,1,18,2,4,1,14,1, 6,1,12,1,122,22,70,105,108,101,70,105,110,100,101,114, @@ -2211,7 +2211,7 @@ 1,114,35,0,0,0,41,2,114,164,0,0,0,114,8,1, 0,0,114,4,0,0,0,114,5,0,0,0,218,24,112,97, 116,104,95,104,111,111,107,95,102,111,114,95,70,105,108,101, - 70,105,110,100,101,114,25,5,0,0,115,6,0,0,0,0, + 70,105,110,100,101,114,26,5,0,0,115,6,0,0,0,0, 2,8,1,14,1,122,54,70,105,108,101,70,105,110,100,101, 114,46,112,97,116,104,95,104,111,111,107,46,60,108,111,99, 97,108,115,62,46,112,97,116,104,95,104,111,111,107,95,102, @@ -2219,7 +2219,7 @@ 0,0,41,3,114,164,0,0,0,114,8,1,0,0,114,14, 1,0,0,114,4,0,0,0,41,2,114,164,0,0,0,114, 8,1,0,0,114,5,0,0,0,218,9,112,97,116,104,95, - 104,111,111,107,15,5,0,0,115,4,0,0,0,0,10,14, + 104,111,111,107,16,5,0,0,115,4,0,0,0,0,10,14, 6,122,20,70,105,108,101,70,105,110,100,101,114,46,112,97, 116,104,95,104,111,111,107,99,1,0,0,0,0,0,0,0, 1,0,0,0,2,0,0,0,67,0,0,0,115,12,0,0, @@ -2227,7 +2227,7 @@ 122,16,70,105,108,101,70,105,110,100,101,114,40,123,33,114, 125,41,41,2,114,47,0,0,0,114,35,0,0,0,41,1, 114,100,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,240,0,0,0,33,5,0,0,115,2,0, + 5,0,0,0,114,240,0,0,0,34,5,0,0,115,2,0, 0,0,0,1,122,19,70,105,108,101,70,105,110,100,101,114, 46,95,95,114,101,112,114,95,95,41,15,114,105,0,0,0, 114,104,0,0,0,114,106,0,0,0,114,107,0,0,0,114, @@ -2235,7 +2235,7 @@ 0,0,0,114,117,0,0,0,114,1,1,0,0,114,175,0, 0,0,114,9,1,0,0,114,177,0,0,0,114,15,1,0, 0,114,240,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,2,1,0,0,148, + 114,4,0,0,0,114,5,0,0,0,114,2,1,0,0,149, 4,0,0,115,20,0,0,0,8,7,4,2,8,14,8,4, 4,2,8,12,8,5,10,46,8,31,12,18,114,2,1,0, 0,99,4,0,0,0,0,0,0,0,6,0,0,0,11,0, @@ -2259,7 +2259,7 @@ 99,112,97,116,104,110,97,109,101,114,120,0,0,0,114,158, 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, 0,0,218,14,95,102,105,120,95,117,112,95,109,111,100,117, - 108,101,39,5,0,0,115,34,0,0,0,0,2,10,1,10, + 108,101,40,5,0,0,115,34,0,0,0,0,2,10,1,10, 1,4,1,4,1,8,1,8,1,12,2,10,1,4,1,16, 1,2,1,8,1,8,1,8,1,12,1,14,2,114,20,1, 0,0,99,0,0,0,0,0,0,0,0,3,0,0,0,3, @@ -2278,7 +2278,7 @@ 217,0,0,0,114,74,0,0,0,41,3,90,10,101,120,116, 101,110,115,105,111,110,115,90,6,115,111,117,114,99,101,90, 8,98,121,116,101,99,111,100,101,114,4,0,0,0,114,4, - 0,0,0,114,5,0,0,0,114,155,0,0,0,62,5,0, + 0,0,0,114,5,0,0,0,114,155,0,0,0,63,5,0, 0,115,8,0,0,0,0,5,12,1,8,1,8,1,114,155, 0,0,0,99,1,0,0,0,0,0,0,0,12,0,0,0, 12,0,0,0,67,0,0,0,115,188,1,0,0,124,0,97, @@ -2331,7 +2331,7 @@ 1,0,113,2,100,1,83,0,41,2,114,29,0,0,0,78, 41,1,114,31,0,0,0,41,2,114,22,0,0,0,114,77, 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,114,221,0,0,0,98,5,0,0,115,2,0,0,0, + 0,0,114,221,0,0,0,99,5,0,0,115,2,0,0,0, 4,0,122,25,95,115,101,116,117,112,46,60,108,111,99,97, 108,115,62,46,60,103,101,110,101,120,112,114,62,114,59,0, 0,0,122,30,105,109,112,111,114,116,108,105,98,32,114,101, @@ -2361,7 +2361,7 @@ 95,109,111,100,117,108,101,90,14,119,101,97,107,114,101,102, 95,109,111,100,117,108,101,90,13,119,105,110,114,101,103,95, 109,111,100,117,108,101,114,4,0,0,0,114,4,0,0,0, - 114,5,0,0,0,218,6,95,115,101,116,117,112,73,5,0, + 114,5,0,0,0,218,6,95,115,101,116,117,112,74,5,0, 0,115,82,0,0,0,0,8,4,1,6,1,6,3,10,1, 10,1,10,1,12,2,10,1,16,3,22,1,14,2,22,1, 8,1,10,1,10,1,4,2,2,1,10,1,6,1,14,1, @@ -2385,7 +2385,7 @@ 0,0,114,245,0,0,0,114,212,0,0,0,41,2,114,28, 1,0,0,90,17,115,117,112,112,111,114,116,101,100,95,108, 111,97,100,101,114,115,114,4,0,0,0,114,4,0,0,0, - 114,5,0,0,0,218,8,95,105,110,115,116,97,108,108,141, + 114,5,0,0,0,218,8,95,105,110,115,116,97,108,108,142, 5,0,0,115,16,0,0,0,0,2,8,1,6,1,20,1, 10,1,12,1,12,4,6,1,114,31,1,0,0,41,3,122, 3,119,105,110,114,1,0,0,0,114,2,0,0,0,41,56, @@ -2414,7 +2414,7 @@ 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218, 8,60,109,111,100,117,108,101,62,8,0,0,0,115,102,0, 0,0,4,17,4,3,8,12,8,5,8,5,8,6,8,12, - 8,10,8,9,8,5,8,7,10,22,10,117,16,1,12,2, + 8,10,8,9,8,5,8,7,10,22,10,118,16,1,12,2, 4,1,4,2,6,2,6,2,8,2,16,44,8,33,8,19, 8,12,8,12,8,28,8,17,14,55,14,12,12,10,8,14, 6,3,8,1,12,65,14,64,14,29,16,110,14,41,18,45, -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 02:49:46 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 12 Jun 2016 06:49:46 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3Mjg2?= =?utf-8?q?=3A_Fixed_compiling_BUILD=5FMAP=5FUNPACK=5FWITH=5FCALL_opcode?= =?utf-8?q?=2E__Calling?= Message-ID: <20160612064946.114300.19106.9259F2D7@psf.io> https://hg.python.org/cpython/rev/34d24c51eab6 changeset: 101924:34d24c51eab6 branch: 3.5 parent: 101913:d84268ed62ac user: Serhiy Storchaka date: Sun Jun 12 09:22:01 2016 +0300 summary: Issue #27286: Fixed compiling BUILD_MAP_UNPACK_WITH_CALL opcode. Calling function with generalized unpacking (PEP 448) and conflicting keyword names could cause undefined behavior. files: Lib/importlib/_bootstrap_external.py | 3 +- Lib/test/test_extcall.py | 4 + Lib/test/test_unpack_ex.py | 5 + Misc/NEWS | 4 + PC/launcher.c | 2 +- Python/compile.c | 2 +- Python/importlib_external.h | 208 +++++++------- 7 files changed, 121 insertions(+), 107 deletions(-) diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -223,6 +223,7 @@ # Python 3.5b1 3330 (PEP 448: Additional Unpacking Generalizations) # Python 3.5b2 3340 (fix dictionary display evaluation order #11205) # Python 3.5b2 3350 (add GET_YIELD_FROM_ITER opcode #24400) +# Python 3.5.2 3351 (fix BUILD_MAP_UNPACK_WITH_CALL opcode #27286) # # MAGIC must change whenever the bytecode emitted by the compiler may no # longer be understood by older implementations of the eval loop (usually @@ -231,7 +232,7 @@ # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3350).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3351).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py --- a/Lib/test/test_extcall.py +++ b/Lib/test/test_extcall.py @@ -57,6 +57,10 @@ Traceback (most recent call last): ... TypeError: f() got multiple values for keyword argument 'a' + >>> f(1, 2, a=3, **{'a': 4}, **{'a': 5}) + Traceback (most recent call last): + ... + TypeError: f() got multiple values for keyword argument 'a' >>> f(1, 2, 3, *[4, 5], **{'a':6, 'b':7}) (1, 2, 3, 4, 5) {'a': 6, 'b': 7} >>> f(1, 2, 3, x=4, y=5, *(6, 7), **{'a':8, 'b': 9}) diff --git a/Lib/test/test_unpack_ex.py b/Lib/test/test_unpack_ex.py --- a/Lib/test/test_unpack_ex.py +++ b/Lib/test/test_unpack_ex.py @@ -248,6 +248,11 @@ ... TypeError: f() got multiple values for keyword argument 'x' + >>> f(x=5, **{'x': 3}, **{'x': 2}) + Traceback (most recent call last): + ... + TypeError: f() got multiple values for keyword argument 'x' + >>> f(**{1: 3}, **{1: 5}) Traceback (most recent call last): ... diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,10 @@ Core and Builtins ----------------- +- Issue #27286: Fixed compiling BUILD_MAP_UNPACK_WITH_CALL opcode. Calling + function with generalized unpacking (PEP 448) and conflicting keyword names + could cause undefined behavior. + - Issue #27066: Fixed SystemError if a custom opener (for open()) returns a negative number without setting an exception. diff --git a/PC/launcher.c b/PC/launcher.c --- a/PC/launcher.c +++ b/PC/launcher.c @@ -1081,7 +1081,7 @@ { 3160, 3180, L"3.2" }, { 3190, 3230, L"3.3" }, { 3250, 3310, L"3.4" }, - { 3320, 3350, L"3.5" }, + { 3320, 3351, L"3.5" }, { 3360, 3361, L"3.6" }, { 0 } }; diff --git a/Python/compile.c b/Python/compile.c --- a/Python/compile.c +++ b/Python/compile.c @@ -3262,7 +3262,7 @@ code |= 2; if (nsubkwargs > 1) { /* Pack it all up */ - int function_pos = n + (code & 1) + nkw + 1; + int function_pos = n + (code & 1) + 2 * nkw + 1; ADDOP_I(c, BUILD_MAP_UNPACK_WITH_CALL, nsubkwargs | (function_pos << 8)); } } diff --git a/Python/importlib_external.h b/Python/importlib_external.h --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -259,7 +259,7 @@ 0,0,114,5,0,0,0,218,13,95,119,114,105,116,101,95, 97,116,111,109,105,99,99,0,0,0,115,26,0,0,0,0, 5,24,1,9,1,33,1,3,3,21,1,20,1,20,1,13, - 1,3,1,17,1,13,1,5,1,114,55,0,0,0,105,22, + 1,3,1,17,1,13,1,5,1,114,55,0,0,0,105,23, 13,0,0,233,2,0,0,0,114,13,0,0,0,115,2,0, 0,0,13,10,90,11,95,95,112,121,99,97,99,104,101,95, 95,122,4,111,112,116,45,122,3,46,112,121,122,4,46,112, @@ -369,7 +369,7 @@ 116,97,103,90,15,97,108,109,111,115,116,95,102,105,108,101, 110,97,109,101,114,4,0,0,0,114,4,0,0,0,114,5, 0,0,0,218,17,99,97,99,104,101,95,102,114,111,109,95, - 115,111,117,114,99,101,246,0,0,0,115,46,0,0,0,0, + 115,111,117,114,99,101,247,0,0,0,115,46,0,0,0,0, 18,12,1,9,1,7,1,12,1,6,1,12,1,18,1,18, 1,24,1,12,1,12,1,12,1,36,1,12,1,18,1,9, 2,12,1,12,1,12,1,12,1,21,1,21,1,114,79,0, @@ -448,7 +448,7 @@ 95,108,101,118,101,108,90,13,98,97,115,101,95,102,105,108, 101,110,97,109,101,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,17,115,111,117,114,99,101,95,102,114,111, - 109,95,99,97,99,104,101,34,1,0,0,115,44,0,0,0, + 109,95,99,97,99,104,101,35,1,0,0,115,44,0,0,0, 0,9,18,1,12,1,18,1,18,1,12,1,9,1,15,1, 15,1,12,1,9,1,15,1,12,1,22,1,15,1,9,1, 12,1,22,1,12,1,9,1,12,1,19,1,114,85,0,0, @@ -486,7 +486,7 @@ 115,105,111,110,218,11,115,111,117,114,99,101,95,112,97,116, 104,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, 218,15,95,103,101,116,95,115,111,117,114,99,101,102,105,108, - 101,67,1,0,0,115,20,0,0,0,0,7,18,1,4,1, + 101,68,1,0,0,115,20,0,0,0,0,7,18,1,4,1, 24,1,35,1,4,1,3,1,16,1,19,1,21,1,114,91, 0,0,0,99,1,0,0,0,0,0,0,0,1,0,0,0, 11,0,0,0,67,0,0,0,115,92,0,0,0,124,0,0, @@ -500,7 +500,7 @@ 84,0,0,0,114,79,0,0,0,114,66,0,0,0,114,74, 0,0,0,41,1,218,8,102,105,108,101,110,97,109,101,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,11, - 95,103,101,116,95,99,97,99,104,101,100,86,1,0,0,115, + 95,103,101,116,95,99,97,99,104,101,100,87,1,0,0,115, 16,0,0,0,0,1,21,1,3,1,14,1,13,1,8,1, 21,1,4,2,114,95,0,0,0,99,1,0,0,0,0,0, 0,0,2,0,0,0,11,0,0,0,67,0,0,0,115,60, @@ -515,7 +515,7 @@ 41,3,114,39,0,0,0,114,41,0,0,0,114,40,0,0, 0,41,2,114,35,0,0,0,114,42,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,218,10,95,99, - 97,108,99,95,109,111,100,101,98,1,0,0,115,12,0,0, + 97,108,99,95,109,111,100,101,99,1,0,0,115,12,0,0, 0,0,2,3,1,19,1,13,1,11,3,10,1,114,97,0, 0,0,218,9,118,101,114,98,111,115,105,116,121,114,29,0, 0,0,99,1,0,0,0,1,0,0,0,3,0,0,0,4, @@ -536,7 +536,7 @@ 218,6,115,116,100,101,114,114,41,3,114,75,0,0,0,114, 98,0,0,0,218,4,97,114,103,115,114,4,0,0,0,114, 4,0,0,0,114,5,0,0,0,218,16,95,118,101,114,98, - 111,115,101,95,109,101,115,115,97,103,101,110,1,0,0,115, + 111,115,101,95,109,101,115,115,97,103,101,111,1,0,0,115, 8,0,0,0,0,2,18,1,15,1,10,1,114,105,0,0, 0,99,1,0,0,0,0,0,0,0,3,0,0,0,11,0, 0,0,3,0,0,0,115,84,0,0,0,100,1,0,135,0, @@ -576,7 +576,7 @@ 0,0,90,6,107,119,97,114,103,115,41,1,218,6,109,101, 116,104,111,100,114,4,0,0,0,114,5,0,0,0,218,19, 95,99,104,101,99,107,95,110,97,109,101,95,119,114,97,112, - 112,101,114,126,1,0,0,115,12,0,0,0,0,1,12,1, + 112,101,114,127,1,0,0,115,12,0,0,0,0,1,12,1, 12,1,15,1,6,1,25,1,122,40,95,99,104,101,99,107, 95,110,97,109,101,46,60,108,111,99,97,108,115,62,46,95, 99,104,101,99,107,95,110,97,109,101,95,119,114,97,112,112, @@ -595,7 +595,7 @@ 116,97,116,116,114,218,8,95,95,100,105,99,116,95,95,218, 6,117,112,100,97,116,101,41,3,90,3,110,101,119,90,3, 111,108,100,114,52,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,218,5,95,119,114,97,112,137,1, + 0,0,114,5,0,0,0,218,5,95,119,114,97,112,138,1, 0,0,115,8,0,0,0,0,1,25,1,15,1,29,1,122, 26,95,99,104,101,99,107,95,110,97,109,101,46,60,108,111, 99,97,108,115,62,46,95,119,114,97,112,41,3,218,10,95, @@ -603,7 +603,7 @@ 78,97,109,101,69,114,114,111,114,41,3,114,109,0,0,0, 114,110,0,0,0,114,120,0,0,0,114,4,0,0,0,41, 1,114,109,0,0,0,114,5,0,0,0,218,11,95,99,104, - 101,99,107,95,110,97,109,101,118,1,0,0,115,14,0,0, + 101,99,107,95,110,97,109,101,119,1,0,0,115,14,0,0, 0,0,8,21,7,3,1,13,1,13,2,17,5,13,1,114, 123,0,0,0,99,2,0,0,0,0,0,0,0,5,0,0, 0,4,0,0,0,67,0,0,0,115,84,0,0,0,124,0, @@ -633,7 +633,7 @@ 218,8,112,111,114,116,105,111,110,115,218,3,109,115,103,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,17, 95,102,105,110,100,95,109,111,100,117,108,101,95,115,104,105, - 109,146,1,0,0,115,10,0,0,0,0,10,21,1,24,1, + 109,147,1,0,0,115,10,0,0,0,0,10,21,1,24,1, 6,1,29,1,114,130,0,0,0,99,4,0,0,0,0,0, 0,0,11,0,0,0,19,0,0,0,67,0,0,0,115,240, 1,0,0,105,0,0,125,4,0,124,2,0,100,1,0,107, @@ -718,7 +718,7 @@ 109,101,218,11,115,111,117,114,99,101,95,115,105,122,101,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,25, 95,118,97,108,105,100,97,116,101,95,98,121,116,101,99,111, - 100,101,95,104,101,97,100,101,114,163,1,0,0,115,76,0, + 100,101,95,104,101,97,100,101,114,164,1,0,0,115,76,0, 0,0,0,11,6,1,12,1,13,3,6,1,12,1,10,1, 16,1,16,1,16,1,12,1,18,1,13,1,18,1,18,1, 15,1,13,1,15,1,18,1,15,1,13,1,12,1,12,1, @@ -749,7 +749,7 @@ 114,106,0,0,0,114,89,0,0,0,114,90,0,0,0,218, 4,99,111,100,101,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,17,95,99,111,109,112,105,108,101,95,98, - 121,116,101,99,111,100,101,218,1,0,0,115,16,0,0,0, + 121,116,101,99,111,100,101,219,1,0,0,115,16,0,0,0, 0,2,15,1,15,1,13,1,12,1,16,1,4,2,18,1, 114,147,0,0,0,114,59,0,0,0,99,3,0,0,0,0, 0,0,0,4,0,0,0,3,0,0,0,67,0,0,0,115, @@ -769,7 +769,7 @@ 4,114,146,0,0,0,114,133,0,0,0,114,140,0,0,0, 114,53,0,0,0,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,17,95,99,111,100,101,95,116,111,95,98, - 121,116,101,99,111,100,101,230,1,0,0,115,10,0,0,0, + 121,116,101,99,111,100,101,231,1,0,0,115,10,0,0,0, 0,3,12,1,19,1,19,1,22,1,114,150,0,0,0,99, 1,0,0,0,0,0,0,0,5,0,0,0,4,0,0,0, 67,0,0,0,115,89,0,0,0,100,1,0,100,2,0,108, @@ -798,7 +798,7 @@ 100,105,110,103,90,15,110,101,119,108,105,110,101,95,100,101, 99,111,100,101,114,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,13,100,101,99,111,100,101,95,115,111,117, - 114,99,101,240,1,0,0,115,10,0,0,0,0,5,12,1, + 114,99,101,241,1,0,0,115,10,0,0,0,0,5,12,1, 18,1,15,1,18,1,114,155,0,0,0,114,127,0,0,0, 218,26,115,117,98,109,111,100,117,108,101,95,115,101,97,114, 99,104,95,108,111,99,97,116,105,111,110,115,99,2,0,0, @@ -863,7 +863,7 @@ 159,0,0,0,90,7,100,105,114,110,97,109,101,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,218,23,115,112, 101,99,95,102,114,111,109,95,102,105,108,101,95,108,111,99, - 97,116,105,111,110,1,2,0,0,115,60,0,0,0,0,12, + 97,116,105,111,110,2,2,0,0,115,60,0,0,0,0,12, 12,4,6,1,15,2,3,1,19,1,13,1,5,8,24,1, 9,3,12,1,22,1,21,1,15,1,9,1,5,2,4,3, 12,2,15,1,3,1,19,1,13,1,5,2,6,1,12,2, @@ -903,7 +903,7 @@ 79,67,65,76,95,77,65,67,72,73,78,69,41,2,218,3, 99,108,115,218,3,107,101,121,114,4,0,0,0,114,4,0, 0,0,114,5,0,0,0,218,14,95,111,112,101,110,95,114, - 101,103,105,115,116,114,121,79,2,0,0,115,8,0,0,0, + 101,103,105,115,116,114,121,80,2,0,0,115,8,0,0,0, 0,2,3,1,23,1,13,1,122,36,87,105,110,100,111,119, 115,82,101,103,105,115,116,114,121,70,105,110,100,101,114,46, 95,111,112,101,110,95,114,101,103,105,115,116,114,121,99,2, @@ -930,7 +930,7 @@ 171,0,0,0,90,4,104,107,101,121,218,8,102,105,108,101, 112,97,116,104,114,4,0,0,0,114,4,0,0,0,114,5, 0,0,0,218,16,95,115,101,97,114,99,104,95,114,101,103, - 105,115,116,114,121,86,2,0,0,115,22,0,0,0,0,2, + 105,115,116,114,121,87,2,0,0,115,22,0,0,0,0,2, 9,1,12,2,9,1,15,1,22,1,3,1,18,1,29,1, 13,1,9,1,122,38,87,105,110,100,111,119,115,82,101,103, 105,115,116,114,121,70,105,110,100,101,114,46,95,115,101,97, @@ -954,7 +954,7 @@ 114,35,0,0,0,218,6,116,97,114,103,101,116,114,177,0, 0,0,114,127,0,0,0,114,166,0,0,0,114,164,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 218,9,102,105,110,100,95,115,112,101,99,101,2,0,0,115, + 218,9,102,105,110,100,95,115,112,101,99,102,2,0,0,115, 26,0,0,0,0,2,15,1,12,1,4,1,3,1,14,1, 13,1,9,1,22,1,21,1,9,1,15,1,9,1,122,31, 87,105,110,100,111,119,115,82,101,103,105,115,116,114,121,70, @@ -974,7 +974,7 @@ 0,0,0,41,4,114,170,0,0,0,114,126,0,0,0,114, 35,0,0,0,114,164,0,0,0,114,4,0,0,0,114,4, 0,0,0,114,5,0,0,0,218,11,102,105,110,100,95,109, - 111,100,117,108,101,117,2,0,0,115,8,0,0,0,0,7, + 111,100,117,108,101,118,2,0,0,115,8,0,0,0,0,7, 18,1,12,1,7,2,122,33,87,105,110,100,111,119,115,82, 101,103,105,115,116,114,121,70,105,110,100,101,114,46,102,105, 110,100,95,109,111,100,117,108,101,41,12,114,112,0,0,0, @@ -983,7 +983,7 @@ 99,108,97,115,115,109,101,116,104,111,100,114,172,0,0,0, 114,178,0,0,0,114,181,0,0,0,114,182,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,168,0,0,0,67,2,0,0,115,20,0,0, + 0,0,0,114,168,0,0,0,68,2,0,0,115,20,0,0, 0,12,2,6,3,6,3,6,2,6,2,18,7,18,15,3, 1,21,15,3,1,114,168,0,0,0,99,0,0,0,0,0, 0,0,0,0,0,0,0,2,0,0,0,64,0,0,0,115, @@ -1021,7 +1021,7 @@ 0,0,0,114,94,0,0,0,90,13,102,105,108,101,110,97, 109,101,95,98,97,115,101,90,9,116,97,105,108,95,110,97, 109,101,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,159,0,0,0,136,2,0,0,115,8,0,0,0,0, + 0,114,159,0,0,0,137,2,0,0,115,8,0,0,0,0, 3,25,1,22,1,19,1,122,24,95,76,111,97,100,101,114, 66,97,115,105,99,115,46,105,115,95,112,97,99,107,97,103, 101,99,2,0,0,0,0,0,0,0,2,0,0,0,1,0, @@ -1031,7 +1031,7 @@ 117,108,101,32,99,114,101,97,116,105,111,110,46,78,114,4, 0,0,0,41,2,114,108,0,0,0,114,164,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,13, - 99,114,101,97,116,101,95,109,111,100,117,108,101,144,2,0, + 99,114,101,97,116,101,95,109,111,100,117,108,101,145,2,0, 0,115,0,0,0,0,122,27,95,76,111,97,100,101,114,66, 97,115,105,99,115,46,99,114,101,97,116,101,95,109,111,100, 117,108,101,99,2,0,0,0,0,0,0,0,3,0,0,0, @@ -1053,7 +1053,7 @@ 0,41,3,114,108,0,0,0,218,6,109,111,100,117,108,101, 114,146,0,0,0,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,11,101,120,101,99,95,109,111,100,117,108, - 101,147,2,0,0,115,10,0,0,0,0,2,18,1,12,1, + 101,148,2,0,0,115,10,0,0,0,0,2,18,1,12,1, 9,1,15,1,122,25,95,76,111,97,100,101,114,66,97,115, 105,99,115,46,101,120,101,99,95,109,111,100,117,108,101,99, 2,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0, @@ -1062,14 +1062,14 @@ 0,0,0,218,17,95,108,111,97,100,95,109,111,100,117,108, 101,95,115,104,105,109,41,2,114,108,0,0,0,114,126,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,218,11,108,111,97,100,95,109,111,100,117,108,101,155,2, + 0,218,11,108,111,97,100,95,109,111,100,117,108,101,156,2, 0,0,115,2,0,0,0,0,1,122,25,95,76,111,97,100, 101,114,66,97,115,105,99,115,46,108,111,97,100,95,109,111, 100,117,108,101,78,41,8,114,112,0,0,0,114,111,0,0, 0,114,113,0,0,0,114,114,0,0,0,114,159,0,0,0, 114,186,0,0,0,114,191,0,0,0,114,193,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,184,0,0,0,131,2,0,0,115,10,0,0, + 0,0,0,114,184,0,0,0,132,2,0,0,115,10,0,0, 0,12,3,6,2,12,8,12,3,12,8,114,184,0,0,0, 99,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0, 0,64,0,0,0,115,106,0,0,0,101,0,0,90,1,0, @@ -1097,7 +1097,7 @@ 1,218,7,73,79,69,114,114,111,114,41,2,114,108,0,0, 0,114,35,0,0,0,114,4,0,0,0,114,4,0,0,0, 114,5,0,0,0,218,10,112,97,116,104,95,109,116,105,109, - 101,161,2,0,0,115,2,0,0,0,0,6,122,23,83,111, + 101,162,2,0,0,115,2,0,0,0,0,6,122,23,83,111, 117,114,99,101,76,111,97,100,101,114,46,112,97,116,104,95, 109,116,105,109,101,99,2,0,0,0,0,0,0,0,2,0, 0,0,3,0,0,0,67,0,0,0,115,19,0,0,0,100, @@ -1132,7 +1132,7 @@ 32,32,32,114,133,0,0,0,41,1,114,196,0,0,0,41, 2,114,108,0,0,0,114,35,0,0,0,114,4,0,0,0, 114,4,0,0,0,114,5,0,0,0,218,10,112,97,116,104, - 95,115,116,97,116,115,169,2,0,0,115,2,0,0,0,0, + 95,115,116,97,116,115,170,2,0,0,115,2,0,0,0,0, 11,122,23,83,111,117,114,99,101,76,111,97,100,101,114,46, 112,97,116,104,95,115,116,97,116,115,99,4,0,0,0,0, 0,0,0,4,0,0,0,3,0,0,0,67,0,0,0,115, @@ -1156,7 +1156,7 @@ 90,0,0,0,90,10,99,97,99,104,101,95,112,97,116,104, 114,53,0,0,0,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,15,95,99,97,99,104,101,95,98,121,116, - 101,99,111,100,101,182,2,0,0,115,2,0,0,0,0,8, + 101,99,111,100,101,183,2,0,0,115,2,0,0,0,0,8, 122,28,83,111,117,114,99,101,76,111,97,100,101,114,46,95, 99,97,99,104,101,95,98,121,116,101,99,111,100,101,99,3, 0,0,0,0,0,0,0,3,0,0,0,1,0,0,0,67, @@ -1173,7 +1173,7 @@ 32,32,32,32,32,32,78,114,4,0,0,0,41,3,114,108, 0,0,0,114,35,0,0,0,114,53,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,114,198,0,0, - 0,192,2,0,0,115,0,0,0,0,122,21,83,111,117,114, + 0,193,2,0,0,115,0,0,0,0,122,21,83,111,117,114, 99,101,76,111,97,100,101,114,46,115,101,116,95,100,97,116, 97,99,2,0,0,0,0,0,0,0,5,0,0,0,16,0, 0,0,67,0,0,0,115,105,0,0,0,124,0,0,106,0, @@ -1195,7 +1195,7 @@ 0,0,114,126,0,0,0,114,35,0,0,0,114,153,0,0, 0,218,3,101,120,99,114,4,0,0,0,114,4,0,0,0, 114,5,0,0,0,218,10,103,101,116,95,115,111,117,114,99, - 101,199,2,0,0,115,14,0,0,0,0,2,15,1,3,1, + 101,200,2,0,0,115,14,0,0,0,0,2,15,1,3,1, 19,1,18,1,9,1,31,1,122,23,83,111,117,114,99,101, 76,111,97,100,101,114,46,103,101,116,95,115,111,117,114,99, 101,218,9,95,111,112,116,105,109,105,122,101,114,29,0,0, @@ -1217,7 +1217,7 @@ 101,41,4,114,108,0,0,0,114,53,0,0,0,114,35,0, 0,0,114,203,0,0,0,114,4,0,0,0,114,4,0,0, 0,114,5,0,0,0,218,14,115,111,117,114,99,101,95,116, - 111,95,99,111,100,101,209,2,0,0,115,4,0,0,0,0, + 111,95,99,111,100,101,210,2,0,0,115,4,0,0,0,0, 5,21,1,122,27,83,111,117,114,99,101,76,111,97,100,101, 114,46,115,111,117,114,99,101,95,116,111,95,99,111,100,101, 99,2,0,0,0,0,0,0,0,10,0,0,0,43,0,0, @@ -1278,7 +1278,7 @@ 98,121,116,101,115,95,100,97,116,97,114,153,0,0,0,90, 11,99,111,100,101,95,111,98,106,101,99,116,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,114,187,0,0,0, - 217,2,0,0,115,78,0,0,0,0,7,15,1,6,1,3, + 218,2,0,0,115,78,0,0,0,0,7,15,1,6,1,3, 1,16,1,13,1,11,2,3,1,19,1,13,1,5,2,16, 1,3,1,19,1,13,1,5,2,3,1,9,1,12,1,13, 1,19,1,5,2,9,1,7,1,15,1,6,1,7,1,15, @@ -1290,7 +1290,7 @@ 199,0,0,0,114,198,0,0,0,114,202,0,0,0,114,206, 0,0,0,114,187,0,0,0,114,4,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,114,194,0,0, - 0,159,2,0,0,115,14,0,0,0,12,2,12,8,12,13, + 0,160,2,0,0,115,14,0,0,0,12,2,12,8,12,13, 12,10,12,7,12,10,18,8,114,194,0,0,0,99,0,0, 0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0, 0,0,115,112,0,0,0,101,0,0,90,1,0,100,0,0, @@ -1318,7 +1318,7 @@ 32,32,32,32,32,32,102,105,110,100,101,114,46,78,41,2, 114,106,0,0,0,114,35,0,0,0,41,3,114,108,0,0, 0,114,126,0,0,0,114,35,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,185,0,0,0,18, + 114,4,0,0,0,114,5,0,0,0,114,185,0,0,0,19, 3,0,0,115,4,0,0,0,0,3,9,1,122,19,70,105, 108,101,76,111,97,100,101,114,46,95,95,105,110,105,116,95, 95,99,2,0,0,0,0,0,0,0,2,0,0,0,2,0, @@ -1328,7 +1328,7 @@ 41,2,218,9,95,95,99,108,97,115,115,95,95,114,118,0, 0,0,41,2,114,108,0,0,0,218,5,111,116,104,101,114, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218, - 6,95,95,101,113,95,95,24,3,0,0,115,4,0,0,0, + 6,95,95,101,113,95,95,25,3,0,0,115,4,0,0,0, 0,1,18,1,122,17,70,105,108,101,76,111,97,100,101,114, 46,95,95,101,113,95,95,99,1,0,0,0,0,0,0,0, 1,0,0,0,3,0,0,0,67,0,0,0,115,26,0,0, @@ -1337,7 +1337,7 @@ 218,4,104,97,115,104,114,106,0,0,0,114,35,0,0,0, 41,1,114,108,0,0,0,114,4,0,0,0,114,4,0,0, 0,114,5,0,0,0,218,8,95,95,104,97,115,104,95,95, - 28,3,0,0,115,2,0,0,0,0,1,122,19,70,105,108, + 29,3,0,0,115,2,0,0,0,0,1,122,19,70,105,108, 101,76,111,97,100,101,114,46,95,95,104,97,115,104,95,95, 99,2,0,0,0,0,0,0,0,2,0,0,0,3,0,0, 0,3,0,0,0,115,22,0,0,0,116,0,0,116,1,0, @@ -1351,7 +1351,7 @@ 32,32,32,32,32,32,32,32,41,3,218,5,115,117,112,101, 114,114,210,0,0,0,114,193,0,0,0,41,2,114,108,0, 0,0,114,126,0,0,0,41,1,114,211,0,0,0,114,4, - 0,0,0,114,5,0,0,0,114,193,0,0,0,31,3,0, + 0,0,0,114,5,0,0,0,114,193,0,0,0,32,3,0, 0,115,2,0,0,0,0,10,122,22,70,105,108,101,76,111, 97,100,101,114,46,108,111,97,100,95,109,111,100,117,108,101, 99,2,0,0,0,0,0,0,0,2,0,0,0,1,0,0, @@ -1362,7 +1362,7 @@ 32,98,121,32,116,104,101,32,102,105,110,100,101,114,46,41, 1,114,35,0,0,0,41,2,114,108,0,0,0,114,126,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,157,0,0,0,43,3,0,0,115,2,0,0,0,0, + 0,114,157,0,0,0,44,3,0,0,115,2,0,0,0,0, 3,122,23,70,105,108,101,76,111,97,100,101,114,46,103,101, 116,95,102,105,108,101,110,97,109,101,99,2,0,0,0,0, 0,0,0,3,0,0,0,9,0,0,0,67,0,0,0,115, @@ -1375,14 +1375,14 @@ 49,0,0,0,114,50,0,0,0,90,4,114,101,97,100,41, 3,114,108,0,0,0,114,35,0,0,0,114,54,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 200,0,0,0,48,3,0,0,115,4,0,0,0,0,2,21, + 200,0,0,0,49,3,0,0,115,4,0,0,0,0,2,21, 1,122,19,70,105,108,101,76,111,97,100,101,114,46,103,101, 116,95,100,97,116,97,41,11,114,112,0,0,0,114,111,0, 0,0,114,113,0,0,0,114,114,0,0,0,114,185,0,0, 0,114,213,0,0,0,114,215,0,0,0,114,123,0,0,0, 114,193,0,0,0,114,157,0,0,0,114,200,0,0,0,114, 4,0,0,0,114,4,0,0,0,41,1,114,211,0,0,0, - 114,5,0,0,0,114,210,0,0,0,13,3,0,0,115,14, + 114,5,0,0,0,114,210,0,0,0,14,3,0,0,115,14, 0,0,0,12,3,6,2,12,6,12,4,12,3,24,12,18, 5,114,210,0,0,0,99,0,0,0,0,0,0,0,0,0, 0,0,0,4,0,0,0,64,0,0,0,115,64,0,0,0, @@ -1405,7 +1405,7 @@ 3,114,39,0,0,0,218,8,115,116,95,109,116,105,109,101, 90,7,115,116,95,115,105,122,101,41,3,114,108,0,0,0, 114,35,0,0,0,114,208,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,197,0,0,0,58,3, + 4,0,0,0,114,5,0,0,0,114,197,0,0,0,59,3, 0,0,115,4,0,0,0,0,2,12,1,122,27,83,111,117, 114,99,101,70,105,108,101,76,111,97,100,101,114,46,112,97, 116,104,95,115,116,97,116,115,99,4,0,0,0,0,0,0, @@ -1416,7 +1416,7 @@ 114,97,0,0,0,114,198,0,0,0,41,5,114,108,0,0, 0,114,90,0,0,0,114,89,0,0,0,114,53,0,0,0, 114,42,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,199,0,0,0,63,3,0,0,115,4,0, + 5,0,0,0,114,199,0,0,0,64,3,0,0,115,4,0, 0,0,0,2,12,1,122,32,83,111,117,114,99,101,70,105, 108,101,76,111,97,100,101,114,46,95,99,97,99,104,101,95, 98,121,116,101,99,111,100,101,114,220,0,0,0,105,182,1, @@ -1454,7 +1454,7 @@ 53,0,0,0,114,220,0,0,0,218,6,112,97,114,101,110, 116,114,94,0,0,0,114,27,0,0,0,114,23,0,0,0, 114,201,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,198,0,0,0,68,3,0,0,115,38,0, + 5,0,0,0,114,198,0,0,0,69,3,0,0,115,38,0, 0,0,0,2,18,1,6,2,22,1,18,1,17,2,19,1, 15,1,3,1,17,1,13,2,7,1,18,3,16,1,27,1, 3,1,16,1,17,1,18,2,122,25,83,111,117,114,99,101, @@ -1463,7 +1463,7 @@ 114,113,0,0,0,114,114,0,0,0,114,197,0,0,0,114, 199,0,0,0,114,198,0,0,0,114,4,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,218,0, - 0,0,54,3,0,0,115,8,0,0,0,12,2,6,2,12, + 0,0,55,3,0,0,115,8,0,0,0,12,2,6,2,12, 5,12,5,114,218,0,0,0,99,0,0,0,0,0,0,0, 0,0,0,0,0,2,0,0,0,64,0,0,0,115,46,0, 0,0,101,0,0,90,1,0,100,0,0,90,2,0,100,1, @@ -1485,7 +1485,7 @@ 114,147,0,0,0,41,5,114,108,0,0,0,114,126,0,0, 0,114,35,0,0,0,114,53,0,0,0,114,209,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 187,0,0,0,101,3,0,0,115,8,0,0,0,0,1,15, + 187,0,0,0,102,3,0,0,115,8,0,0,0,0,1,15, 1,15,1,24,1,122,29,83,111,117,114,99,101,108,101,115, 115,70,105,108,101,76,111,97,100,101,114,46,103,101,116,95, 99,111,100,101,99,2,0,0,0,0,0,0,0,2,0,0, @@ -1495,13 +1495,13 @@ 32,115,111,117,114,99,101,32,99,111,100,101,46,78,114,4, 0,0,0,41,2,114,108,0,0,0,114,126,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,202, - 0,0,0,107,3,0,0,115,2,0,0,0,0,2,122,31, + 0,0,0,108,3,0,0,115,2,0,0,0,0,2,122,31, 83,111,117,114,99,101,108,101,115,115,70,105,108,101,76,111, 97,100,101,114,46,103,101,116,95,115,111,117,114,99,101,78, 41,6,114,112,0,0,0,114,111,0,0,0,114,113,0,0, 0,114,114,0,0,0,114,187,0,0,0,114,202,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,223,0,0,0,97,3,0,0,115,6,0, + 5,0,0,0,114,223,0,0,0,98,3,0,0,115,6,0, 0,0,12,2,6,2,12,6,114,223,0,0,0,99,0,0, 0,0,0,0,0,0,0,0,0,0,3,0,0,0,64,0, 0,0,115,136,0,0,0,101,0,0,90,1,0,100,0,0, @@ -1526,7 +1526,7 @@ 0,100,0,0,83,41,1,78,41,2,114,106,0,0,0,114, 35,0,0,0,41,3,114,108,0,0,0,114,106,0,0,0, 114,35,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,185,0,0,0,124,3,0,0,115,4,0, + 5,0,0,0,114,185,0,0,0,125,3,0,0,115,4,0, 0,0,0,1,9,1,122,28,69,120,116,101,110,115,105,111, 110,70,105,108,101,76,111,97,100,101,114,46,95,95,105,110, 105,116,95,95,99,2,0,0,0,0,0,0,0,2,0,0, @@ -1535,7 +1535,7 @@ 124,0,0,106,1,0,124,1,0,106,1,0,107,2,0,83, 41,1,78,41,2,114,211,0,0,0,114,118,0,0,0,41, 2,114,108,0,0,0,114,212,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,213,0,0,0,128, + 114,4,0,0,0,114,5,0,0,0,114,213,0,0,0,129, 3,0,0,115,4,0,0,0,0,1,18,1,122,26,69,120, 116,101,110,115,105,111,110,70,105,108,101,76,111,97,100,101, 114,46,95,95,101,113,95,95,99,1,0,0,0,0,0,0, @@ -1544,7 +1544,7 @@ 0,124,0,0,106,2,0,131,1,0,65,83,41,1,78,41, 3,114,214,0,0,0,114,106,0,0,0,114,35,0,0,0, 41,1,114,108,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,5,0,0,0,114,215,0,0,0,132,3,0,0,115, + 0,114,5,0,0,0,114,215,0,0,0,133,3,0,0,115, 2,0,0,0,0,1,122,28,69,120,116,101,110,115,105,111, 110,70,105,108,101,76,111,97,100,101,114,46,95,95,104,97, 115,104,95,95,99,2,0,0,0,0,0,0,0,3,0,0, @@ -1562,7 +1562,7 @@ 114,105,0,0,0,114,106,0,0,0,114,35,0,0,0,41, 3,114,108,0,0,0,114,164,0,0,0,114,190,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 186,0,0,0,135,3,0,0,115,10,0,0,0,0,2,6, + 186,0,0,0,136,3,0,0,115,10,0,0,0,0,2,6, 1,15,1,6,1,16,1,122,33,69,120,116,101,110,115,105, 111,110,70,105,108,101,76,111,97,100,101,114,46,99,114,101, 97,116,101,95,109,111,100,117,108,101,99,2,0,0,0,0, @@ -1579,7 +1579,7 @@ 12,101,120,101,99,95,100,121,110,97,109,105,99,114,105,0, 0,0,114,106,0,0,0,114,35,0,0,0,41,2,114,108, 0,0,0,114,190,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,114,191,0,0,0,143,3,0,0, + 0,0,114,5,0,0,0,114,191,0,0,0,144,3,0,0, 115,6,0,0,0,0,2,19,1,6,1,122,31,69,120,116, 101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,114, 46,101,120,101,99,95,109,111,100,117,108,101,99,2,0,0, @@ -1598,7 +1598,7 @@ 78,114,4,0,0,0,41,2,114,22,0,0,0,218,6,115, 117,102,102,105,120,41,1,218,9,102,105,108,101,95,110,97, 109,101,114,4,0,0,0,114,5,0,0,0,250,9,60,103, - 101,110,101,120,112,114,62,152,3,0,0,115,2,0,0,0, + 101,110,101,120,112,114,62,153,3,0,0,115,2,0,0,0, 6,1,122,49,69,120,116,101,110,115,105,111,110,70,105,108, 101,76,111,97,100,101,114,46,105,115,95,112,97,99,107,97, 103,101,46,60,108,111,99,97,108,115,62,46,60,103,101,110, @@ -1606,7 +1606,7 @@ 0,218,3,97,110,121,218,18,69,88,84,69,78,83,73,79, 78,95,83,85,70,70,73,88,69,83,41,2,114,108,0,0, 0,114,126,0,0,0,114,4,0,0,0,41,1,114,226,0, - 0,0,114,5,0,0,0,114,159,0,0,0,149,3,0,0, + 0,0,114,5,0,0,0,114,159,0,0,0,150,3,0,0, 115,6,0,0,0,0,2,19,1,18,1,122,30,69,120,116, 101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,114, 46,105,115,95,112,97,99,107,97,103,101,99,2,0,0,0, @@ -1618,7 +1618,7 @@ 99,111,100,101,32,111,98,106,101,99,116,46,78,114,4,0, 0,0,41,2,114,108,0,0,0,114,126,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,187,0, - 0,0,155,3,0,0,115,2,0,0,0,0,2,122,28,69, + 0,0,156,3,0,0,115,2,0,0,0,0,2,122,28,69, 120,116,101,110,115,105,111,110,70,105,108,101,76,111,97,100, 101,114,46,103,101,116,95,99,111,100,101,99,2,0,0,0, 0,0,0,0,2,0,0,0,1,0,0,0,67,0,0,0, @@ -1628,7 +1628,7 @@ 118,101,32,110,111,32,115,111,117,114,99,101,32,99,111,100, 101,46,78,114,4,0,0,0,41,2,114,108,0,0,0,114, 126,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,202,0,0,0,159,3,0,0,115,2,0,0, + 0,0,0,114,202,0,0,0,160,3,0,0,115,2,0,0, 0,0,2,122,30,69,120,116,101,110,115,105,111,110,70,105, 108,101,76,111,97,100,101,114,46,103,101,116,95,115,111,117, 114,99,101,99,2,0,0,0,0,0,0,0,2,0,0,0, @@ -1639,7 +1639,7 @@ 117,110,100,32,98,121,32,116,104,101,32,102,105,110,100,101, 114,46,41,1,114,35,0,0,0,41,2,114,108,0,0,0, 114,126,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,157,0,0,0,163,3,0,0,115,2,0, + 5,0,0,0,114,157,0,0,0,164,3,0,0,115,2,0, 0,0,0,3,122,32,69,120,116,101,110,115,105,111,110,70, 105,108,101,76,111,97,100,101,114,46,103,101,116,95,102,105, 108,101,110,97,109,101,78,41,14,114,112,0,0,0,114,111, @@ -1648,7 +1648,7 @@ 0,114,191,0,0,0,114,159,0,0,0,114,187,0,0,0, 114,202,0,0,0,114,123,0,0,0,114,157,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,224,0,0,0,116,3,0,0,115,20,0,0, + 0,0,0,114,224,0,0,0,117,3,0,0,115,20,0,0, 0,12,6,6,2,12,4,12,4,12,3,12,8,12,6,12, 6,12,4,12,4,114,224,0,0,0,99,0,0,0,0,0, 0,0,0,0,0,0,0,2,0,0,0,64,0,0,0,115, @@ -1692,7 +1692,7 @@ 95,112,97,116,104,95,102,105,110,100,101,114,41,4,114,108, 0,0,0,114,106,0,0,0,114,35,0,0,0,218,11,112, 97,116,104,95,102,105,110,100,101,114,114,4,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,185,0,0,0,176,3, + 4,0,0,0,114,5,0,0,0,114,185,0,0,0,177,3, 0,0,115,8,0,0,0,0,1,9,1,9,1,21,1,122, 23,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46, 95,95,105,110,105,116,95,95,99,1,0,0,0,0,0,0, @@ -1711,7 +1711,7 @@ 41,4,114,108,0,0,0,114,222,0,0,0,218,3,100,111, 116,90,2,109,101,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,23,95,102,105,110,100,95,112,97,114,101, - 110,116,95,112,97,116,104,95,110,97,109,101,115,182,3,0, + 110,116,95,112,97,116,104,95,110,97,109,101,115,183,3,0, 0,115,8,0,0,0,0,2,27,1,12,2,4,3,122,38, 95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95, 102,105,110,100,95,112,97,114,101,110,116,95,112,97,116,104, @@ -1725,7 +1725,7 @@ 110,116,95,109,111,100,117,108,101,95,110,97,109,101,90,14, 112,97,116,104,95,97,116,116,114,95,110,97,109,101,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,233,0, - 0,0,192,3,0,0,115,4,0,0,0,0,1,18,1,122, + 0,0,193,3,0,0,115,4,0,0,0,0,1,18,1,122, 31,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46, 95,103,101,116,95,112,97,114,101,110,116,95,112,97,116,104, 99,1,0,0,0,0,0,0,0,3,0,0,0,3,0,0, @@ -1743,7 +1743,7 @@ 108,0,0,0,90,11,112,97,114,101,110,116,95,112,97,116, 104,114,164,0,0,0,114,4,0,0,0,114,4,0,0,0, 114,5,0,0,0,218,12,95,114,101,99,97,108,99,117,108, - 97,116,101,196,3,0,0,115,16,0,0,0,0,2,18,1, + 97,116,101,197,3,0,0,115,16,0,0,0,0,2,18,1, 15,1,21,3,27,1,9,1,12,1,9,1,122,27,95,78, 97,109,101,115,112,97,99,101,80,97,116,104,46,95,114,101, 99,97,108,99,117,108,97,116,101,99,1,0,0,0,0,0, @@ -1752,14 +1752,14 @@ 1,0,83,41,1,78,41,2,218,4,105,116,101,114,114,240, 0,0,0,41,1,114,108,0,0,0,114,4,0,0,0,114, 4,0,0,0,114,5,0,0,0,218,8,95,95,105,116,101, - 114,95,95,209,3,0,0,115,2,0,0,0,0,1,122,23, + 114,95,95,210,3,0,0,115,2,0,0,0,0,1,122,23, 95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95, 95,105,116,101,114,95,95,99,1,0,0,0,0,0,0,0, 1,0,0,0,2,0,0,0,67,0,0,0,115,16,0,0, 0,116,0,0,124,0,0,106,1,0,131,0,0,131,1,0, 83,41,1,78,41,2,114,31,0,0,0,114,240,0,0,0, 41,1,114,108,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,5,0,0,0,218,7,95,95,108,101,110,95,95,212, + 0,114,5,0,0,0,218,7,95,95,108,101,110,95,95,213, 3,0,0,115,2,0,0,0,0,1,122,22,95,78,97,109, 101,115,112,97,99,101,80,97,116,104,46,95,95,108,101,110, 95,95,99,1,0,0,0,0,0,0,0,1,0,0,0,2, @@ -1769,7 +1769,7 @@ 123,33,114,125,41,41,2,114,47,0,0,0,114,232,0,0, 0,41,1,114,108,0,0,0,114,4,0,0,0,114,4,0, 0,0,114,5,0,0,0,218,8,95,95,114,101,112,114,95, - 95,215,3,0,0,115,2,0,0,0,0,1,122,23,95,78, + 95,216,3,0,0,115,2,0,0,0,0,1,122,23,95,78, 97,109,101,115,112,97,99,101,80,97,116,104,46,95,95,114, 101,112,114,95,95,99,2,0,0,0,0,0,0,0,2,0, 0,0,2,0,0,0,67,0,0,0,115,16,0,0,0,124, @@ -1777,7 +1777,7 @@ 1,78,41,1,114,240,0,0,0,41,2,114,108,0,0,0, 218,4,105,116,101,109,114,4,0,0,0,114,4,0,0,0, 114,5,0,0,0,218,12,95,95,99,111,110,116,97,105,110, - 115,95,95,218,3,0,0,115,2,0,0,0,0,1,122,27, + 115,95,95,219,3,0,0,115,2,0,0,0,0,1,122,27, 95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95, 95,99,111,110,116,97,105,110,115,95,95,99,2,0,0,0, 0,0,0,0,2,0,0,0,2,0,0,0,67,0,0,0, @@ -1785,7 +1785,7 @@ 0,131,1,0,1,100,0,0,83,41,1,78,41,2,114,232, 0,0,0,114,163,0,0,0,41,2,114,108,0,0,0,114, 245,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,163,0,0,0,221,3,0,0,115,2,0,0, + 0,0,0,114,163,0,0,0,222,3,0,0,115,2,0,0, 0,0,1,122,21,95,78,97,109,101,115,112,97,99,101,80, 97,116,104,46,97,112,112,101,110,100,78,41,13,114,112,0, 0,0,114,111,0,0,0,114,113,0,0,0,114,114,0,0, @@ -1793,7 +1793,7 @@ 114,240,0,0,0,114,242,0,0,0,114,243,0,0,0,114, 244,0,0,0,114,246,0,0,0,114,163,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,114,230,0,0,0,169,3,0,0,115,20,0,0,0, + 0,0,114,230,0,0,0,170,3,0,0,115,20,0,0,0, 12,5,6,2,12,6,12,10,12,4,12,13,12,3,12,3, 12,3,12,3,114,230,0,0,0,99,0,0,0,0,0,0, 0,0,0,0,0,0,3,0,0,0,64,0,0,0,115,118, @@ -1812,7 +1812,7 @@ 41,1,78,41,2,114,230,0,0,0,114,232,0,0,0,41, 4,114,108,0,0,0,114,106,0,0,0,114,35,0,0,0, 114,236,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,185,0,0,0,227,3,0,0,115,2,0, + 5,0,0,0,114,185,0,0,0,228,3,0,0,115,2,0, 0,0,0,1,122,25,95,78,97,109,101,115,112,97,99,101, 76,111,97,100,101,114,46,95,95,105,110,105,116,95,95,99, 2,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0, @@ -1829,14 +1829,14 @@ 110,97,109,101,115,112,97,99,101,41,62,41,2,114,47,0, 0,0,114,112,0,0,0,41,2,114,170,0,0,0,114,190, 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,218,11,109,111,100,117,108,101,95,114,101,112,114,230, + 0,0,218,11,109,111,100,117,108,101,95,114,101,112,114,231, 3,0,0,115,2,0,0,0,0,7,122,28,95,78,97,109, 101,115,112,97,99,101,76,111,97,100,101,114,46,109,111,100, 117,108,101,95,114,101,112,114,99,2,0,0,0,0,0,0, 0,2,0,0,0,1,0,0,0,67,0,0,0,115,4,0, 0,0,100,1,0,83,41,2,78,84,114,4,0,0,0,41, 2,114,108,0,0,0,114,126,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,159,0,0,0,239, + 114,4,0,0,0,114,5,0,0,0,114,159,0,0,0,240, 3,0,0,115,2,0,0,0,0,1,122,27,95,78,97,109, 101,115,112,97,99,101,76,111,97,100,101,114,46,105,115,95, 112,97,99,107,97,103,101,99,2,0,0,0,0,0,0,0, @@ -1844,7 +1844,7 @@ 0,100,1,0,83,41,2,78,114,30,0,0,0,114,4,0, 0,0,41,2,114,108,0,0,0,114,126,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,202,0, - 0,0,242,3,0,0,115,2,0,0,0,0,1,122,27,95, + 0,0,243,3,0,0,115,2,0,0,0,0,1,122,27,95, 78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,46, 103,101,116,95,115,111,117,114,99,101,99,2,0,0,0,0, 0,0,0,2,0,0,0,6,0,0,0,67,0,0,0,115, @@ -1853,7 +1853,7 @@ 0,0,122,8,60,115,116,114,105,110,103,62,114,189,0,0, 0,114,204,0,0,0,84,41,1,114,205,0,0,0,41,2, 114,108,0,0,0,114,126,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,187,0,0,0,245,3, + 4,0,0,0,114,5,0,0,0,114,187,0,0,0,246,3, 0,0,115,2,0,0,0,0,1,122,25,95,78,97,109,101, 115,112,97,99,101,76,111,97,100,101,114,46,103,101,116,95, 99,111,100,101,99,2,0,0,0,0,0,0,0,2,0,0, @@ -1863,14 +1863,14 @@ 109,111,100,117,108,101,32,99,114,101,97,116,105,111,110,46, 78,114,4,0,0,0,41,2,114,108,0,0,0,114,164,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,186,0,0,0,248,3,0,0,115,0,0,0,0,122, + 0,114,186,0,0,0,249,3,0,0,115,0,0,0,0,122, 30,95,78,97,109,101,115,112,97,99,101,76,111,97,100,101, 114,46,99,114,101,97,116,101,95,109,111,100,117,108,101,99, 2,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0, 67,0,0,0,115,4,0,0,0,100,0,0,83,41,1,78, 114,4,0,0,0,41,2,114,108,0,0,0,114,190,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,191,0,0,0,251,3,0,0,115,2,0,0,0,0,1, + 114,191,0,0,0,252,3,0,0,115,2,0,0,0,0,1, 122,28,95,78,97,109,101,115,112,97,99,101,76,111,97,100, 101,114,46,101,120,101,99,95,109,111,100,117,108,101,99,2, 0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,67, @@ -1888,7 +1888,7 @@ 104,32,123,33,114,125,41,4,114,105,0,0,0,114,232,0, 0,0,114,121,0,0,0,114,192,0,0,0,41,2,114,108, 0,0,0,114,126,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,114,193,0,0,0,254,3,0,0, + 0,0,114,5,0,0,0,114,193,0,0,0,255,3,0,0, 115,4,0,0,0,0,7,16,1,122,28,95,78,97,109,101, 115,112,97,99,101,76,111,97,100,101,114,46,108,111,97,100, 95,109,111,100,117,108,101,78,41,12,114,112,0,0,0,114, @@ -1896,7 +1896,7 @@ 0,0,0,114,248,0,0,0,114,159,0,0,0,114,202,0, 0,0,114,187,0,0,0,114,186,0,0,0,114,191,0,0, 0,114,193,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,247,0,0,0,226, + 114,4,0,0,0,114,5,0,0,0,114,247,0,0,0,227, 3,0,0,115,16,0,0,0,12,1,12,3,18,9,12,3, 12,3,12,3,12,3,12,3,114,247,0,0,0,99,0,0, 0,0,0,0,0,0,0,0,0,0,5,0,0,0,64,0, @@ -1934,7 +1934,7 @@ 114,95,99,97,99,104,101,218,6,118,97,108,117,101,115,114, 115,0,0,0,114,250,0,0,0,41,2,114,170,0,0,0, 218,6,102,105,110,100,101,114,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,114,250,0,0,0,15,4,0,0, + 0,0,114,5,0,0,0,114,250,0,0,0,16,4,0,0, 115,6,0,0,0,0,4,22,1,15,1,122,28,80,97,116, 104,70,105,110,100,101,114,46,105,110,118,97,108,105,100,97, 116,101,95,99,97,99,104,101,115,99,2,0,0,0,0,0, @@ -1960,7 +1960,7 @@ 107,0,0,0,41,3,114,170,0,0,0,114,35,0,0,0, 90,4,104,111,111,107,114,4,0,0,0,114,4,0,0,0, 114,5,0,0,0,218,11,95,112,97,116,104,95,104,111,111, - 107,115,23,4,0,0,115,16,0,0,0,0,7,25,1,16, + 107,115,24,4,0,0,115,16,0,0,0,0,7,25,1,16, 1,16,1,3,1,14,1,13,1,12,2,122,22,80,97,116, 104,70,105,110,100,101,114,46,95,112,97,116,104,95,104,111, 111,107,115,99,2,0,0,0,0,0,0,0,3,0,0,0, @@ -1992,7 +1992,7 @@ 0,0,114,255,0,0,0,41,3,114,170,0,0,0,114,35, 0,0,0,114,253,0,0,0,114,4,0,0,0,114,4,0, 0,0,114,5,0,0,0,218,20,95,112,97,116,104,95,105, - 109,112,111,114,116,101,114,95,99,97,99,104,101,40,4,0, + 109,112,111,114,116,101,114,95,99,97,99,104,101,41,4,0, 0,115,22,0,0,0,0,8,12,1,3,1,16,1,13,3, 9,1,3,1,17,1,13,1,15,1,18,1,122,31,80,97, 116,104,70,105,110,100,101,114,46,95,112,97,116,104,95,105, @@ -2012,7 +2012,7 @@ 0,0,114,126,0,0,0,114,253,0,0,0,114,127,0,0, 0,114,128,0,0,0,114,164,0,0,0,114,4,0,0,0, 114,4,0,0,0,114,5,0,0,0,218,16,95,108,101,103, - 97,99,121,95,103,101,116,95,115,112,101,99,62,4,0,0, + 97,99,121,95,103,101,116,95,115,112,101,99,63,4,0,0, 115,18,0,0,0,0,4,15,1,24,2,15,1,6,1,12, 1,16,1,18,1,9,1,122,27,80,97,116,104,70,105,110, 100,101,114,46,95,108,101,103,97,99,121,95,103,101,116,95, @@ -2048,7 +2048,7 @@ 101,115,112,97,99,101,95,112,97,116,104,90,5,101,110,116, 114,121,114,253,0,0,0,114,164,0,0,0,114,128,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 218,9,95,103,101,116,95,115,112,101,99,77,4,0,0,115, + 218,9,95,103,101,116,95,115,112,101,99,78,4,0,0,115, 40,0,0,0,0,5,6,1,13,1,21,1,3,1,15,1, 12,1,15,1,21,2,18,1,12,1,3,1,15,1,4,1, 9,1,12,1,12,5,17,2,18,1,9,1,122,20,80,97, @@ -2076,7 +2076,7 @@ 6,114,170,0,0,0,114,126,0,0,0,114,35,0,0,0, 114,180,0,0,0,114,164,0,0,0,114,4,1,0,0,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,181, - 0,0,0,109,4,0,0,115,26,0,0,0,0,4,12,1, + 0,0,0,110,4,0,0,115,26,0,0,0,0,4,12,1, 9,1,21,1,12,1,4,1,15,1,9,1,6,3,9,1, 24,1,4,2,7,2,122,20,80,97,116,104,70,105,110,100, 101,114,46,102,105,110,100,95,115,112,101,99,99,3,0,0, @@ -2098,7 +2098,7 @@ 114,181,0,0,0,114,127,0,0,0,41,4,114,170,0,0, 0,114,126,0,0,0,114,35,0,0,0,114,164,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 182,0,0,0,131,4,0,0,115,8,0,0,0,0,8,18, + 182,0,0,0,132,4,0,0,115,8,0,0,0,0,8,18, 1,12,1,4,1,122,22,80,97,116,104,70,105,110,100,101, 114,46,102,105,110,100,95,109,111,100,117,108,101,41,12,114, 112,0,0,0,114,111,0,0,0,114,113,0,0,0,114,114, @@ -2106,7 +2106,7 @@ 0,0,114,1,1,0,0,114,2,1,0,0,114,5,1,0, 0,114,181,0,0,0,114,182,0,0,0,114,4,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 249,0,0,0,11,4,0,0,115,22,0,0,0,12,2,6, + 249,0,0,0,12,4,0,0,115,22,0,0,0,12,2,6, 2,18,8,18,17,18,22,18,15,3,1,18,31,3,1,21, 21,3,1,114,249,0,0,0,99,0,0,0,0,0,0,0, 0,0,0,0,0,3,0,0,0,64,0,0,0,115,133,0, @@ -2155,7 +2155,7 @@ 0,86,1,113,3,0,100,0,0,83,41,1,78,114,4,0, 0,0,41,2,114,22,0,0,0,114,225,0,0,0,41,1, 114,127,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 227,0,0,0,160,4,0,0,115,2,0,0,0,6,0,122, + 227,0,0,0,161,4,0,0,115,2,0,0,0,6,0,122, 38,70,105,108,101,70,105,110,100,101,114,46,95,95,105,110, 105,116,95,95,46,60,108,111,99,97,108,115,62,46,60,103, 101,110,101,120,112,114,62,114,58,0,0,0,114,29,0,0, @@ -2168,7 +2168,7 @@ 111,97,100,101,114,95,100,101,116,97,105,108,115,90,7,108, 111,97,100,101,114,115,114,166,0,0,0,114,4,0,0,0, 41,1,114,127,0,0,0,114,5,0,0,0,114,185,0,0, - 0,154,4,0,0,115,16,0,0,0,0,4,6,1,19,1, + 0,155,4,0,0,115,16,0,0,0,0,4,6,1,19,1, 36,1,9,2,15,1,9,1,12,1,122,19,70,105,108,101, 70,105,110,100,101,114,46,95,95,105,110,105,116,95,95,99, 1,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0, @@ -2178,7 +2178,7 @@ 114,121,32,109,116,105,109,101,46,114,29,0,0,0,78,114, 87,0,0,0,41,1,114,8,1,0,0,41,1,114,108,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,250,0,0,0,168,4,0,0,115,2,0,0,0,0, + 0,114,250,0,0,0,169,4,0,0,115,2,0,0,0,0, 2,122,28,70,105,108,101,70,105,110,100,101,114,46,105,110, 118,97,108,105,100,97,116,101,95,99,97,99,104,101,115,99, 2,0,0,0,0,0,0,0,3,0,0,0,2,0,0,0, @@ -2202,7 +2202,7 @@ 114,181,0,0,0,114,127,0,0,0,114,156,0,0,0,41, 3,114,108,0,0,0,114,126,0,0,0,114,164,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 124,0,0,0,174,4,0,0,115,8,0,0,0,0,7,15, + 124,0,0,0,175,4,0,0,115,8,0,0,0,0,7,15, 1,12,1,10,1,122,22,70,105,108,101,70,105,110,100,101, 114,46,102,105,110,100,95,108,111,97,100,101,114,99,6,0, 0,0,0,0,0,0,7,0,0,0,7,0,0,0,67,0, @@ -2213,7 +2213,7 @@ 0,0,0,41,7,114,108,0,0,0,114,165,0,0,0,114, 126,0,0,0,114,35,0,0,0,90,4,115,109,115,108,114, 180,0,0,0,114,127,0,0,0,114,4,0,0,0,114,4, - 0,0,0,114,5,0,0,0,114,5,1,0,0,186,4,0, + 0,0,0,114,5,0,0,0,114,5,1,0,0,187,4,0, 0,115,6,0,0,0,0,1,15,1,18,1,122,20,70,105, 108,101,70,105,110,100,101,114,46,95,103,101,116,95,115,112, 101,99,78,99,3,0,0,0,0,0,0,0,14,0,0,0, @@ -2276,7 +2276,7 @@ 13,105,110,105,116,95,102,105,108,101,110,97,109,101,90,9, 102,117,108,108,95,112,97,116,104,114,164,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,181,0, - 0,0,191,4,0,0,115,68,0,0,0,0,3,6,1,19, + 0,0,192,4,0,0,115,68,0,0,0,0,3,6,1,19, 1,3,1,34,1,13,1,11,1,15,1,10,1,9,2,9, 1,9,1,15,2,9,1,6,2,12,1,18,1,22,1,10, 1,15,1,12,1,32,4,12,2,22,1,22,1,25,1,16, @@ -2312,7 +2312,7 @@ 0,0,146,2,0,113,6,0,83,114,4,0,0,0,41,1, 114,88,0,0,0,41,2,114,22,0,0,0,90,2,102,110, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,250, - 9,60,115,101,116,99,111,109,112,62,9,5,0,0,115,2, + 9,60,115,101,116,99,111,109,112,62,10,5,0,0,115,2, 0,0,0,9,0,122,41,70,105,108,101,70,105,110,100,101, 114,46,95,102,105,108,108,95,99,97,99,104,101,46,60,108, 111,99,97,108,115,62,46,60,115,101,116,99,111,109,112,62, @@ -2329,7 +2329,7 @@ 95,99,111,110,116,101,110,116,115,114,245,0,0,0,114,106, 0,0,0,114,237,0,0,0,114,225,0,0,0,90,8,110, 101,119,95,110,97,109,101,114,4,0,0,0,114,4,0,0, - 0,114,5,0,0,0,114,13,1,0,0,236,4,0,0,115, + 0,114,5,0,0,0,114,13,1,0,0,237,4,0,0,115, 34,0,0,0,0,2,9,1,3,1,31,1,22,3,11,3, 18,1,18,7,9,1,13,1,24,1,6,1,27,2,6,1, 17,1,9,1,18,1,122,22,70,105,108,101,70,105,110,100, @@ -2368,7 +2368,7 @@ 0,0,0,41,1,114,35,0,0,0,41,2,114,170,0,0, 0,114,12,1,0,0,114,4,0,0,0,114,5,0,0,0, 218,24,112,97,116,104,95,104,111,111,107,95,102,111,114,95, - 70,105,108,101,70,105,110,100,101,114,21,5,0,0,115,6, + 70,105,108,101,70,105,110,100,101,114,22,5,0,0,115,6, 0,0,0,0,2,12,1,18,1,122,54,70,105,108,101,70, 105,110,100,101,114,46,112,97,116,104,95,104,111,111,107,46, 60,108,111,99,97,108,115,62,46,112,97,116,104,95,104,111, @@ -2376,7 +2376,7 @@ 114,114,4,0,0,0,41,3,114,170,0,0,0,114,12,1, 0,0,114,18,1,0,0,114,4,0,0,0,41,2,114,170, 0,0,0,114,12,1,0,0,114,5,0,0,0,218,9,112, - 97,116,104,95,104,111,111,107,11,5,0,0,115,4,0,0, + 97,116,104,95,104,111,111,107,12,5,0,0,115,4,0,0, 0,0,10,21,6,122,20,70,105,108,101,70,105,110,100,101, 114,46,112,97,116,104,95,104,111,111,107,99,1,0,0,0, 0,0,0,0,1,0,0,0,2,0,0,0,67,0,0,0, @@ -2385,7 +2385,7 @@ 110,100,101,114,40,123,33,114,125,41,41,2,114,47,0,0, 0,114,35,0,0,0,41,1,114,108,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,114,244,0,0, - 0,29,5,0,0,115,2,0,0,0,0,1,122,19,70,105, + 0,30,5,0,0,115,2,0,0,0,0,1,122,19,70,105, 108,101,70,105,110,100,101,114,46,95,95,114,101,112,114,95, 95,41,15,114,112,0,0,0,114,111,0,0,0,114,113,0, 0,0,114,114,0,0,0,114,185,0,0,0,114,250,0,0, @@ -2393,7 +2393,7 @@ 114,5,1,0,0,114,181,0,0,0,114,13,1,0,0,114, 183,0,0,0,114,19,1,0,0,114,244,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,114,6,1,0,0,145,4,0,0,115,20,0,0,0, + 0,0,114,6,1,0,0,146,4,0,0,115,20,0,0,0, 12,7,6,2,12,14,12,4,6,2,12,12,12,5,15,45, 12,31,18,18,114,6,1,0,0,99,4,0,0,0,0,0, 0,0,6,0,0,0,11,0,0,0,67,0,0,0,115,195, @@ -2419,7 +2419,7 @@ 104,110,97,109,101,90,9,99,112,97,116,104,110,97,109,101, 114,127,0,0,0,114,164,0,0,0,114,4,0,0,0,114, 4,0,0,0,114,5,0,0,0,218,14,95,102,105,120,95, - 117,112,95,109,111,100,117,108,101,35,5,0,0,115,34,0, + 117,112,95,109,111,100,117,108,101,36,5,0,0,115,34,0, 0,0,0,2,15,1,15,1,6,1,6,1,12,1,12,1, 18,2,15,1,6,1,21,1,3,1,10,1,10,1,10,1, 14,1,13,2,114,24,1,0,0,99,0,0,0,0,0,0, @@ -2440,7 +2440,7 @@ 0,41,3,90,10,101,120,116,101,110,115,105,111,110,115,90, 6,115,111,117,114,99,101,90,8,98,121,116,101,99,111,100, 101,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,161,0,0,0,58,5,0,0,115,8,0,0,0,0,5, + 114,161,0,0,0,59,5,0,0,115,8,0,0,0,0,5, 18,1,12,1,12,1,114,161,0,0,0,99,1,0,0,0, 0,0,0,0,12,0,0,0,12,0,0,0,67,0,0,0, 115,70,2,0,0,124,0,0,97,0,0,116,0,0,106,1, @@ -2502,7 +2502,7 @@ 83,41,2,114,29,0,0,0,78,41,1,114,31,0,0,0, 41,2,114,22,0,0,0,114,77,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,114,227,0,0,0, - 94,5,0,0,115,2,0,0,0,6,0,122,25,95,115,101, + 95,5,0,0,115,2,0,0,0,6,0,122,25,95,115,101, 116,117,112,46,60,108,111,99,97,108,115,62,46,60,103,101, 110,101,120,112,114,62,114,59,0,0,0,122,30,105,109,112, 111,114,116,108,105,98,32,114,101,113,117,105,114,101,115,32, @@ -2532,7 +2532,7 @@ 90,14,119,101,97,107,114,101,102,95,109,111,100,117,108,101, 90,13,119,105,110,114,101,103,95,109,111,100,117,108,101,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,6, - 95,115,101,116,117,112,69,5,0,0,115,82,0,0,0,0, + 95,115,101,116,117,112,70,5,0,0,115,82,0,0,0,0, 8,6,1,9,1,9,3,13,1,13,1,15,1,18,2,13, 1,20,3,33,1,19,2,31,1,10,1,15,1,13,1,4, 2,3,1,15,1,5,1,13,1,12,2,12,1,16,1,16, @@ -2558,7 +2558,7 @@ 114,218,0,0,0,41,2,114,32,1,0,0,90,17,115,117, 112,112,111,114,116,101,100,95,108,111,97,100,101,114,115,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,8, - 95,105,110,115,116,97,108,108,137,5,0,0,115,16,0,0, + 95,105,110,115,116,97,108,108,138,5,0,0,115,16,0,0, 0,0,2,10,1,9,1,28,1,15,1,16,1,16,4,9, 1,114,35,1,0,0,41,3,122,3,119,105,110,114,1,0, 0,0,114,2,0,0,0,41,57,114,114,0,0,0,114,10, @@ -2587,7 +2587,7 @@ 0,0,0,114,4,0,0,0,114,5,0,0,0,218,8,60, 109,111,100,117,108,101,62,8,0,0,0,115,100,0,0,0, 6,17,6,3,12,12,12,5,12,5,12,6,12,12,12,10, - 12,9,12,5,12,7,15,22,15,113,22,1,18,2,6,1, + 12,9,12,5,12,7,15,22,15,114,22,1,18,2,6,1, 6,2,9,2,9,2,10,2,21,44,12,33,12,19,12,12, 12,12,18,8,12,28,12,17,21,55,21,12,18,10,12,14, 9,3,12,1,15,65,19,64,19,28,22,110,19,41,25,43, -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Sun Jun 12 04:53:16 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 12 Jun 2016 08:53:16 +0000 Subject: [Python-checkins] Daily reference leaks (84d1e5a4b1c5): sum=8 Message-ID: <20160612085305.114664.23964.609D35AB@psf.io> results for 84d1e5a4b1c5 on branch "default" -------------------------------------------- test_collections leaked [0, 0, 4] memory blocks, sum=4 test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflog3EPWTL', '--timeout', '7200'] From python-checkins at python.org Sun Jun 12 04:57:39 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 12 Jun 2016 08:57:39 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI1NDU1?= =?utf-8?q?=3A_Fixed_a_crash_in_repr_of_recursive_functools=2Epartial_obje?= =?utf-8?q?cts=2E?= Message-ID: <20160612085739.28042.20990.6C6D5610@psf.io> https://hg.python.org/cpython/rev/17e78918f608 changeset: 101932:17e78918f608 branch: 3.5 parent: 101928:3190ef4147de user: Serhiy Storchaka date: Sun Jun 12 11:44:06 2016 +0300 summary: Issue #25455: Fixed a crash in repr of recursive functools.partial objects. files: Lib/test/test_functools.py | 37 ++++++++++++++++++++++++ Misc/NEWS | 3 +- Modules/_functoolsmodule.c | 39 ++++++++++++++----------- 3 files changed, 61 insertions(+), 18 deletions(-) diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -217,6 +217,24 @@ ['{}({!r}, {}, {})'.format(name, capture, args_repr, kwargs_repr) for kwargs_repr in kwargs_reprs]) + def test_recursive_repr(self): + if self.partial is c_functools.partial: + name = 'functools.partial' + else: + name = self.partial.__name__ + + f = self.partial(capture) + f.__setstate__((f, (), {}, {})) + self.assertEqual(repr(f), '%s(%s(...))' % (name, name)) + + f = self.partial(capture) + f.__setstate__((capture, (f,), {}, {})) + self.assertEqual(repr(f), '%s(%r, %s(...))' % (name, capture, name)) + + f = self.partial(capture) + f.__setstate__((capture, (), {'a': f}, {})) + self.assertEqual(repr(f), '%s(%r, a=%s(...))' % (name, capture, name)) + def test_pickle(self): f = self.partial(signature, ['asdf'], bar=[True]) f.attr = [] @@ -297,6 +315,25 @@ self.assertEqual(r, ((1, 2), {})) self.assertIs(type(r[0]), tuple) + def test_recursive_pickle(self): + f = self.partial(capture) + f.__setstate__((f, (), {}, {})) + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + with self.assertRaises(RecursionError): + pickle.dumps(f, proto) + + f = self.partial(capture) + f.__setstate__((capture, (f,), {}, {})) + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + f_copy = pickle.loads(pickle.dumps(f, proto)) + self.assertIs(f_copy.args[0], f_copy) + + f = self.partial(capture) + f.__setstate__((capture, (), {'a': f}, {})) + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + f_copy = pickle.loads(pickle.dumps(f, proto)) + self.assertIs(f_copy.keywords['a'], f_copy) + # Issue 6083: Reference counting bug def test_setstate_refcount(self): class BadSequence: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -143,7 +143,8 @@ Library ------- -- Issue #25455: Fixed a crash in repr of ElementTree.Element with recursive tag. +- Issue #25455: Fixed crashes in repr of recursive ElementTree.Element and + functools.partial objects. - Issue #26556: Update expat to 2.1.1, fixes CVE-2015-1283. diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -203,40 +203,45 @@ static PyObject * partial_repr(partialobject *pto) { - PyObject *result; + PyObject *result = NULL; PyObject *arglist; - PyObject *tmp; Py_ssize_t i, n; PyObject *key, *value; + int status; + + status = Py_ReprEnter((PyObject *)pto); + if (status != 0) { + if (status < 0) + return NULL; + return PyUnicode_FromFormat("%s(...)", Py_TYPE(pto)->tp_name); + } arglist = PyUnicode_FromString(""); - if (arglist == NULL) { - return NULL; - } + if (arglist == NULL) + goto done; /* Pack positional arguments */ assert (PyTuple_Check(pto->args)); n = PyTuple_GET_SIZE(pto->args); for (i = 0; i < n; i++) { - tmp = PyUnicode_FromFormat("%U, %R", arglist, - PyTuple_GET_ITEM(pto->args, i)); - Py_DECREF(arglist); - if (tmp == NULL) - return NULL; - arglist = tmp; + Py_SETREF(arglist, PyUnicode_FromFormat("%U, %R", arglist, + PyTuple_GET_ITEM(pto->args, i))); + if (arglist == NULL) + goto done; } /* Pack keyword arguments */ assert (PyDict_Check(pto->kw)); for (i = 0; PyDict_Next(pto->kw, &i, &key, &value);) { - tmp = PyUnicode_FromFormat("%U, %U=%R", arglist, - key, value); - Py_DECREF(arglist); - if (tmp == NULL) - return NULL; - arglist = tmp; + Py_SETREF(arglist, PyUnicode_FromFormat("%U, %U=%R", arglist, + key, value)); + if (arglist == NULL) + goto done; } result = PyUnicode_FromFormat("%s(%R%U)", Py_TYPE(pto)->tp_name, pto->fn, arglist); Py_DECREF(arglist); + + done: + Py_ReprLeave((PyObject *)pto); return result; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 04:57:43 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 12 Jun 2016 08:57:43 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2325455=3A_Fixed_a_crash_in_repr_of_recursive_fun?= =?utf-8?q?ctools=2Epartial_objects=2E?= Message-ID: <20160612085739.81022.45039.C2B9CF9E@psf.io> https://hg.python.org/cpython/rev/86959c696ab7 changeset: 101933:86959c696ab7 parent: 101930:be40dd774041 parent: 101932:17e78918f608 user: Serhiy Storchaka date: Sun Jun 12 11:51:26 2016 +0300 summary: Issue #25455: Fixed a crash in repr of recursive functools.partial objects. files: Lib/test/test_functools.py | 37 ++++++++++++++++++++++++ Misc/NEWS | 3 +- Modules/_functoolsmodule.c | 39 ++++++++++++++----------- 3 files changed, 61 insertions(+), 18 deletions(-) diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -217,6 +217,24 @@ ['{}({!r}, {}, {})'.format(name, capture, args_repr, kwargs_repr) for kwargs_repr in kwargs_reprs]) + def test_recursive_repr(self): + if self.partial is c_functools.partial: + name = 'functools.partial' + else: + name = self.partial.__name__ + + f = self.partial(capture) + f.__setstate__((f, (), {}, {})) + self.assertEqual(repr(f), '%s(%s(...))' % (name, name)) + + f = self.partial(capture) + f.__setstate__((capture, (f,), {}, {})) + self.assertEqual(repr(f), '%s(%r, %s(...))' % (name, capture, name)) + + f = self.partial(capture) + f.__setstate__((capture, (), {'a': f}, {})) + self.assertEqual(repr(f), '%s(%r, a=%s(...))' % (name, capture, name)) + def test_pickle(self): f = self.partial(signature, ['asdf'], bar=[True]) f.attr = [] @@ -297,6 +315,25 @@ self.assertEqual(r, ((1, 2), {})) self.assertIs(type(r[0]), tuple) + def test_recursive_pickle(self): + f = self.partial(capture) + f.__setstate__((f, (), {}, {})) + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + with self.assertRaises(RecursionError): + pickle.dumps(f, proto) + + f = self.partial(capture) + f.__setstate__((capture, (f,), {}, {})) + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + f_copy = pickle.loads(pickle.dumps(f, proto)) + self.assertIs(f_copy.args[0], f_copy) + + f = self.partial(capture) + f.__setstate__((capture, (), {'a': f}, {})) + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + f_copy = pickle.loads(pickle.dumps(f, proto)) + self.assertIs(f_copy.keywords['a'], f_copy) + # Issue 6083: Reference counting bug def test_setstate_refcount(self): class BadSequence: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -44,7 +44,8 @@ Library ------- -- Issue #25455: Fixed a crash in repr of ElementTree.Element with recursive tag. +- Issue #25455: Fixed crashes in repr of recursive ElementTree.Element and + functools.partial objects. - Issue #27294: Improved repr for Tkinter event objects. diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -203,40 +203,45 @@ static PyObject * partial_repr(partialobject *pto) { - PyObject *result; + PyObject *result = NULL; PyObject *arglist; - PyObject *tmp; Py_ssize_t i, n; PyObject *key, *value; + int status; + + status = Py_ReprEnter((PyObject *)pto); + if (status != 0) { + if (status < 0) + return NULL; + return PyUnicode_FromFormat("%s(...)", Py_TYPE(pto)->tp_name); + } arglist = PyUnicode_FromString(""); - if (arglist == NULL) { - return NULL; - } + if (arglist == NULL) + goto done; /* Pack positional arguments */ assert (PyTuple_Check(pto->args)); n = PyTuple_GET_SIZE(pto->args); for (i = 0; i < n; i++) { - tmp = PyUnicode_FromFormat("%U, %R", arglist, - PyTuple_GET_ITEM(pto->args, i)); - Py_DECREF(arglist); - if (tmp == NULL) - return NULL; - arglist = tmp; + Py_SETREF(arglist, PyUnicode_FromFormat("%U, %R", arglist, + PyTuple_GET_ITEM(pto->args, i))); + if (arglist == NULL) + goto done; } /* Pack keyword arguments */ assert (PyDict_Check(pto->kw)); for (i = 0; PyDict_Next(pto->kw, &i, &key, &value);) { - tmp = PyUnicode_FromFormat("%U, %U=%R", arglist, - key, value); - Py_DECREF(arglist); - if (tmp == NULL) - return NULL; - arglist = tmp; + Py_SETREF(arglist, PyUnicode_FromFormat("%U, %U=%R", arglist, + key, value)); + if (arglist == NULL) + goto done; } result = PyUnicode_FromFormat("%s(%R%U)", Py_TYPE(pto)->tp_name, pto->fn, arglist); Py_DECREF(arglist); + + done: + Py_ReprLeave((PyObject *)pto); return result; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 04:57:43 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 12 Jun 2016 08:57:43 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI1NDU1?= =?utf-8?q?=3A_Fixed_a_crash_in_repr_of_cElementTree=2EElement_with_recurs?= =?utf-8?q?ive_tag=2E?= Message-ID: <20160612085738.114300.59557.E66D48B7@psf.io> https://hg.python.org/cpython/rev/c071da010053 changeset: 101931:c071da010053 branch: 2.7 parent: 101923:7dfee711da42 user: Serhiy Storchaka date: Sun Jun 12 10:06:32 2016 +0300 summary: Issue #25455: Fixed a crash in repr of cElementTree.Element with recursive tag. files: Misc/NEWS | 2 + Modules/_elementtree.c | 34 +++++++++++++++++++---------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,8 @@ Library ------- +- Issue #25455: Fixed a crash in repr of cElementTree.Element with recursive tag. + Documentation ------------- diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -1222,18 +1222,28 @@ static PyObject* element_repr(ElementObject* self) { - PyObject *repr, *tag; - - tag = PyObject_Repr(self->tag); - if (!tag) - return NULL; - - repr = PyString_FromFormat("", - PyString_AS_STRING(tag), self); - - Py_DECREF(tag); - - return repr; + int status; + + if (self->tag == NULL) + return PyUnicode_FromFormat("", self); + + status = Py_ReprEnter((PyObject *)self); + if (status == 0) { + PyObject *repr, *tag; + tag = PyObject_Repr(self->tag); + if (!tag) + return NULL; + + repr = PyString_FromFormat("", + PyString_AS_STRING(tag), self); + Py_DECREF(tag); + return repr; + } + if (status > 0) + PyErr_Format(PyExc_RuntimeError, + "reentrant call inside %s.__repr__", + Py_TYPE(self)->tp_name); + return NULL; } static PyObject* -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 05:19:27 2016 From: python-checkins at python.org (berker.peksag) Date: Sun, 12 Jun 2016 09:19:27 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MjIx?= =?utf-8?q?=3A_Delete_an_outdated_paragraph_about_pickle_support_of_Proces?= =?utf-8?q?s?= Message-ID: <20160612091926.28132.71081.D669703C@psf.io> https://hg.python.org/cpython/rev/97254031f0b7 changeset: 101934:97254031f0b7 branch: 3.5 parent: 101932:17e78918f608 user: Berker Peksag date: Sun Jun 12 12:19:13 2016 +0300 summary: Issue #27221: Delete an outdated paragraph about pickle support of Process Initial patch by Jelle Zijlstra. files: Doc/library/multiprocessing.rst | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-) diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -2723,12 +2723,7 @@ More picklability - Ensure that all arguments to :meth:`Process.__init__` are - picklable. This means, in particular, that bound or unbound - methods cannot be used directly as the ``target`` (unless you use - the *fork* start method) --- just define a function and use that - instead. - + Ensure that all arguments to :meth:`Process.__init__` are picklable. Also, if you subclass :class:`~multiprocessing.Process` then make sure that instances will be picklable when the :meth:`Process.start ` method is called. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 05:19:35 2016 From: python-checkins at python.org (berker.peksag) Date: Sun, 12 Jun 2016 09:19:35 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327221=3A_Merge_from_3=2E5?= Message-ID: <20160612091931.87602.85782.636E891F@psf.io> https://hg.python.org/cpython/rev/5b9d8b5b1139 changeset: 101935:5b9d8b5b1139 parent: 101933:86959c696ab7 parent: 101934:97254031f0b7 user: Berker Peksag date: Sun Jun 12 12:19:39 2016 +0300 summary: Issue #27221: Merge from 3.5 files: Doc/library/multiprocessing.rst | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-) diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -2729,12 +2729,7 @@ More picklability - Ensure that all arguments to :meth:`Process.__init__` are - picklable. This means, in particular, that bound or unbound - methods cannot be used directly as the ``target`` (unless you use - the *fork* start method) --- just define a function and use that - instead. - + Ensure that all arguments to :meth:`Process.__init__` are picklable. Also, if you subclass :class:`~multiprocessing.Process` then make sure that instances will be picklable when the :meth:`Process.start ` method is called. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 05:25:56 2016 From: python-checkins at python.org (berker.peksag) Date: Sun, 12 Jun 2016 09:25:56 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5?= Message-ID: <20160612092556.11495.32466.A43DDD1E@psf.io> https://hg.python.org/cpython/rev/e845965453a1 changeset: 101937:e845965453a1 parent: 101935:5b9d8b5b1139 parent: 101936:09b4850cee9f user: Berker Peksag date: Sun Jun 12 12:26:08 2016 +0300 summary: Merge from 3.5 files: Doc/library/multiprocessing.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -1016,7 +1016,7 @@ using :meth:`recv`. The object must be picklable. Very large pickles (approximately 32 MB+, - though it depends on the OS) may raise a ValueError exception. + though it depends on the OS) may raise a :exc:`ValueError` exception. .. method:: recv() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 05:25:56 2016 From: python-checkins at python.org (berker.peksag) Date: Sun, 12 Jun 2016 09:25:56 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Use_exc_role_f?= =?utf-8?q?or_ValueError_in_multiprocessing=2Erst?= Message-ID: <20160612092556.101555.1261.A96258DD@psf.io> https://hg.python.org/cpython/rev/09b4850cee9f changeset: 101936:09b4850cee9f branch: 3.5 parent: 101934:97254031f0b7 user: Berker Peksag date: Sun Jun 12 12:25:43 2016 +0300 summary: Use exc role for ValueError in multiprocessing.rst files: Doc/library/multiprocessing.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -1010,7 +1010,7 @@ using :meth:`recv`. The object must be picklable. Very large pickles (approximately 32 MB+, - though it depends on the OS) may raise a ValueError exception. + though it depends on the OS) may raise a :exc:`ValueError` exception. .. method:: recv() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 06:42:00 2016 From: python-checkins at python.org (berker.peksag) Date: Sun, 12 Jun 2016 10:42:00 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327188=3A_Merge_from_3=2E5?= Message-ID: <20160612104200.11495.51926.D6CE7858@psf.io> https://hg.python.org/cpython/rev/187b2bc0fe26 changeset: 101939:187b2bc0fe26 parent: 101937:e845965453a1 parent: 101938:a825aee0721f user: Berker Peksag date: Sun Jun 12 13:42:12 2016 +0300 summary: Issue #27188: Merge from 3.5 files: Doc/library/sqlite3.rst | 37 +++++++++++++------------- Lib/sqlite3/test/dbapi.py | 12 ++++++++ 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -309,25 +309,26 @@ call :meth:`commit`. If you just close your database connection without calling :meth:`commit` first, your changes will be lost! - .. method:: execute(sql, [parameters]) + .. method:: execute(sql[, parameters]) - This is a nonstandard shortcut that creates an intermediate cursor object by - calling the cursor method, then calls the cursor's :meth:`execute - ` method with the parameters given. + This is a nonstandard shortcut that creates a cursor object by calling + the :meth:`~Connection.cursor` method, calls the cursor's + :meth:`~Cursor.execute` method with the *parameters* given, and returns + the cursor. + .. method:: executemany(sql[, parameters]) - .. method:: executemany(sql, [parameters]) - - This is a nonstandard shortcut that creates an intermediate cursor object by - calling the cursor method, then calls the cursor's :meth:`executemany - ` method with the parameters given. + This is a nonstandard shortcut that creates a cursor object by + calling the :meth:`~Connection.cursor` method, calls the cursor's + :meth:`~Cursor.executemany` method with the *parameters* given, and + returns the cursor. .. method:: executescript(sql_script) - This is a nonstandard shortcut that creates an intermediate cursor object by - calling the cursor method, then calls the cursor's :meth:`executescript - ` method with the parameters given. - + This is a nonstandard shortcut that creates a cursor object by + calling the :meth:`~Connection.cursor` method, calls the cursor's + :meth:`~Cursor.executescript` method with the given *sql_script*, and + returns the cursor. .. method:: create_function(name, num_params, func) @@ -533,7 +534,7 @@ A :class:`Cursor` instance has the following attributes and methods. - .. method:: execute(sql, [parameters]) + .. method:: execute(sql[, parameters]) Executes an SQL statement. The SQL statement may be parameterized (i. e. placeholders instead of SQL literals). The :mod:`sqlite3` module supports two @@ -545,7 +546,7 @@ .. literalinclude:: ../includes/sqlite3/execute_1.py :meth:`execute` will only execute a single SQL statement. If you try to execute - more than one statement with it, it will raise a Warning. Use + more than one statement with it, it will raise an ``sqlite3.Warning``. Use :meth:`executescript` if you want to execute multiple SQL statements with one call. @@ -553,8 +554,8 @@ .. method:: executemany(sql, seq_of_parameters) Executes an SQL command against all parameter sequences or mappings found in - the sequence *sql*. The :mod:`sqlite3` module also allows using an - :term:`iterator` yielding parameters instead of a sequence. + the sequence *seq_of_parameters*. The :mod:`sqlite3` module also allows + using an :term:`iterator` yielding parameters instead of a sequence. .. literalinclude:: ../includes/sqlite3/executemany_1.py @@ -569,7 +570,7 @@ at once. It issues a ``COMMIT`` statement first, then executes the SQL script it gets as a parameter. - *sql_script* can be an instance of :class:`str` or :class:`bytes`. + *sql_script* can be an instance of :class:`str`. Example: diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py --- a/Lib/sqlite3/test/dbapi.py +++ b/Lib/sqlite3/test/dbapi.py @@ -250,6 +250,11 @@ row = self.cu.fetchone() self.assertEqual(row[0], "Hu\x00go") + def CheckExecuteNonIterable(self): + with self.assertRaises(ValueError) as cm: + self.cu.execute("insert into test(id) values (?)", 42) + self.assertEqual(str(cm.exception), 'parameters are of unsupported type') + def CheckExecuteWrongNoOfArgs1(self): # too many parameters try: @@ -725,6 +730,13 @@ raised = True self.assertEqual(raised, True, "should have raised an exception") + def CheckCursorExecutescriptAsBytes(self): + con = sqlite.connect(":memory:") + cur = con.cursor() + with self.assertRaises(ValueError) as cm: + cur.executescript(b"create table test(foo); insert into test(foo) values (5);") + self.assertEqual(str(cm.exception), 'script argument must be unicode.') + def CheckConnectionExecute(self): con = sqlite.connect(":memory:") result = con.execute("select 5").fetchone()[0] -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 06:42:00 2016 From: python-checkins at python.org (berker.peksag) Date: Sun, 12 Jun 2016 10:42:00 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MTg4?= =?utf-8?q?=3A_Fix_various_sqlite3_documentation_errors?= Message-ID: <20160612104200.81236.9422.EB80F16B@psf.io> https://hg.python.org/cpython/rev/a825aee0721f changeset: 101938:a825aee0721f branch: 3.5 parent: 101936:09b4850cee9f user: Berker Peksag date: Sun Jun 12 13:41:47 2016 +0300 summary: Issue #27188: Fix various sqlite3 documentation errors * Connection.execute* methods don't create intermediate cursor objects * Fix description of seq_of_parameters parameter * Clarify that Warning is sqlite3.Warning * sql_script parameter of Cursor.executescript() doesn't accept bytes * Add missing tests * Fix various markup errors Initial patch by Dave Sawyer. files: Doc/library/sqlite3.rst | 37 +++++++++++++------------- Lib/sqlite3/test/dbapi.py | 12 ++++++++ 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -309,25 +309,26 @@ call :meth:`commit`. If you just close your database connection without calling :meth:`commit` first, your changes will be lost! - .. method:: execute(sql, [parameters]) + .. method:: execute(sql[, parameters]) - This is a nonstandard shortcut that creates an intermediate cursor object by - calling the cursor method, then calls the cursor's :meth:`execute - ` method with the parameters given. + This is a nonstandard shortcut that creates a cursor object by calling + the :meth:`~Connection.cursor` method, calls the cursor's + :meth:`~Cursor.execute` method with the *parameters* given, and returns + the cursor. + .. method:: executemany(sql[, parameters]) - .. method:: executemany(sql, [parameters]) - - This is a nonstandard shortcut that creates an intermediate cursor object by - calling the cursor method, then calls the cursor's :meth:`executemany - ` method with the parameters given. + This is a nonstandard shortcut that creates a cursor object by + calling the :meth:`~Connection.cursor` method, calls the cursor's + :meth:`~Cursor.executemany` method with the *parameters* given, and + returns the cursor. .. method:: executescript(sql_script) - This is a nonstandard shortcut that creates an intermediate cursor object by - calling the cursor method, then calls the cursor's :meth:`executescript - ` method with the parameters given. - + This is a nonstandard shortcut that creates a cursor object by + calling the :meth:`~Connection.cursor` method, calls the cursor's + :meth:`~Cursor.executescript` method with the given *sql_script*, and + returns the cursor. .. method:: create_function(name, num_params, func) @@ -533,7 +534,7 @@ A :class:`Cursor` instance has the following attributes and methods. - .. method:: execute(sql, [parameters]) + .. method:: execute(sql[, parameters]) Executes an SQL statement. The SQL statement may be parameterized (i. e. placeholders instead of SQL literals). The :mod:`sqlite3` module supports two @@ -545,7 +546,7 @@ .. literalinclude:: ../includes/sqlite3/execute_1.py :meth:`execute` will only execute a single SQL statement. If you try to execute - more than one statement with it, it will raise a Warning. Use + more than one statement with it, it will raise an ``sqlite3.Warning``. Use :meth:`executescript` if you want to execute multiple SQL statements with one call. @@ -553,8 +554,8 @@ .. method:: executemany(sql, seq_of_parameters) Executes an SQL command against all parameter sequences or mappings found in - the sequence *sql*. The :mod:`sqlite3` module also allows using an - :term:`iterator` yielding parameters instead of a sequence. + the sequence *seq_of_parameters*. The :mod:`sqlite3` module also allows + using an :term:`iterator` yielding parameters instead of a sequence. .. literalinclude:: ../includes/sqlite3/executemany_1.py @@ -569,7 +570,7 @@ at once. It issues a ``COMMIT`` statement first, then executes the SQL script it gets as a parameter. - *sql_script* can be an instance of :class:`str` or :class:`bytes`. + *sql_script* can be an instance of :class:`str`. Example: diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py --- a/Lib/sqlite3/test/dbapi.py +++ b/Lib/sqlite3/test/dbapi.py @@ -250,6 +250,11 @@ row = self.cu.fetchone() self.assertEqual(row[0], "Hu\x00go") + def CheckExecuteNonIterable(self): + with self.assertRaises(ValueError) as cm: + self.cu.execute("insert into test(id) values (?)", 42) + self.assertEqual(str(cm.exception), 'parameters are of unsupported type') + def CheckExecuteWrongNoOfArgs1(self): # too many parameters try: @@ -725,6 +730,13 @@ raised = True self.assertEqual(raised, True, "should have raised an exception") + def CheckCursorExecutescriptAsBytes(self): + con = sqlite.connect(":memory:") + cur = con.cursor() + with self.assertRaises(ValueError) as cm: + cur.executescript(b"create table test(foo); insert into test(foo) values (5);") + self.assertEqual(str(cm.exception), 'script argument must be unicode.') + def CheckConnectionExecute(self): con = sqlite.connect(":memory:") result = con.execute("select 5").fetchone()[0] -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 07:10:14 2016 From: python-checkins at python.org (berker.peksag) Date: Sun, 12 Jun 2016 11:10:14 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MTkw?= =?utf-8?q?=3A_Raise_NotSupportedError_if_sqlite3_is_older_than_3=2E3=2E1?= Message-ID: <20160612111013.28015.15004.B699E3E2@psf.io> https://hg.python.org/cpython/rev/12bf71b9f1cd changeset: 101940:12bf71b9f1cd branch: 3.5 parent: 101938:a825aee0721f user: Berker Peksag date: Sun Jun 12 14:09:51 2016 +0300 summary: Issue #27190: Raise NotSupportedError if sqlite3 is older than 3.3.1 Patch by Dave Sawyer. files: Lib/sqlite3/test/dbapi.py | 6 ++++++ Misc/NEWS | 3 +++ Modules/_sqlite/connection.c | 4 ++++ 3 files changed, 13 insertions(+), 0 deletions(-) diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py --- a/Lib/sqlite3/test/dbapi.py +++ b/Lib/sqlite3/test/dbapi.py @@ -180,6 +180,12 @@ with self.assertRaises(sqlite.OperationalError): cx.execute('insert into test(id) values(1)') + def CheckSameThreadErrorOnOldVersion(self): + if sqlite.sqlite_version_info >= (3, 3, 1): + self.skipTest('test needs sqlite3 versions older than 3.3.1') + with self.assertRaises(sqlite.NotSupportedError) as cm: + sqlite.connect(':memory:', check_same_thread=False) + self.assertEqual(str(cm.exception), 'shared connections not available') class CursorTests(unittest.TestCase): def setUp(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #27190: Raise NotSupportedError if sqlite3 is older than 3.3.1. + Patch by Dave Sawyer. + - Issue #27286: Fixed compiling BUILD_MAP_UNPACK_WITH_CALL opcode. Calling function with generalized unpacking (PEP 448) and conflicting keyword names could cause undefined behavior. diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -164,6 +164,10 @@ #ifdef WITH_THREAD self->thread_ident = PyThread_get_thread_ident(); #endif + if (!check_same_thread && sqlite3_libversion_number() < 3003001) { + PyErr_SetString(pysqlite_NotSupportedError, "shared connections not available"); + return -1; + } self->check_same_thread = check_same_thread; self->function_pinboard = PyDict_New(); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 07:10:23 2016 From: python-checkins at python.org (berker.peksag) Date: Sun, 12 Jun 2016 11:10:23 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327190=3A_Merge_from_3=2E5?= Message-ID: <20160612111014.101804.80097.7A205086@psf.io> https://hg.python.org/cpython/rev/4502cff170c2 changeset: 101941:4502cff170c2 parent: 101939:187b2bc0fe26 parent: 101940:12bf71b9f1cd user: Berker Peksag date: Sun Jun 12 14:10:24 2016 +0300 summary: Issue #27190: Merge from 3.5 files: Lib/sqlite3/test/dbapi.py | 6 ++++++ Misc/NEWS | 3 +++ Modules/_sqlite/connection.c | 4 ++++ 3 files changed, 13 insertions(+), 0 deletions(-) diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py --- a/Lib/sqlite3/test/dbapi.py +++ b/Lib/sqlite3/test/dbapi.py @@ -180,6 +180,12 @@ with self.assertRaises(sqlite.OperationalError): cx.execute('insert into test(id) values(1)') + def CheckSameThreadErrorOnOldVersion(self): + if sqlite.sqlite_version_info >= (3, 3, 1): + self.skipTest('test needs sqlite3 versions older than 3.3.1') + with self.assertRaises(sqlite.NotSupportedError) as cm: + sqlite.connect(':memory:', check_same_thread=False) + self.assertEqual(str(cm.exception), 'shared connections not available') class CursorTests(unittest.TestCase): def setUp(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #27190: Raise NotSupportedError if sqlite3 is older than 3.3.1. + Patch by Dave Sawyer. + - Issue #27286: Fixed compiling BUILD_MAP_UNPACK_WITH_CALL opcode. Calling function with generalized unpacking (PEP 448) and conflicting keyword names could cause undefined behavior. diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -164,6 +164,10 @@ #ifdef WITH_THREAD self->thread_ident = PyThread_get_thread_ident(); #endif + if (!check_same_thread && sqlite3_libversion_number() < 3003001) { + PyErr_SetString(pysqlite_NotSupportedError, "shared connections not available"); + return -1; + } self->check_same_thread = check_same_thread; self->function_pinboard = PyDict_New(); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 08:01:00 2016 From: python-checkins at python.org (christian.heimes) Date: Sun, 12 Jun 2016 12:01:00 +0000 Subject: [Python-checkins] =?utf-8?q?devguide=3A_Add_myself_to_affiliation?= =?utf-8?q?s_list_and_remove_myself_from_some_experts_roles?= Message-ID: <20160612120059.25983.33272.B27AEE58@psf.io> https://hg.python.org/devguide/rev/b651af180fc5 changeset: 809:b651af180fc5 user: Christian Heimes date: Sun Jun 12 14:00:54 2016 +0200 summary: Add myself to affiliations list and remove myself from some experts roles files: experts.rst | 8 ++++---- motivations.rst | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/experts.rst b/experts.rst --- a/experts.rst +++ b/experts.rst @@ -262,8 +262,8 @@ xml.dom.minidom xml.dom.pulldom xml.etree effbot (inactive), eli.bendersky*, scoder -xml.parsers.expat christian.heimes -xml.sax christian.heimes +xml.parsers.expat +xml.sax xml.sax.handler xml.sax.saxutils xml.sax.xmlreader @@ -319,7 +319,7 @@ bytecode benjamin.peterson, pitrou, georg.brandl, yselivanov context managers ncoghlan coverity scan christian.heimes, brett.cannon, twouters -cryptography christian.heimes, gregory.p.smith, dstufft +cryptography gregory.p.smith, dstufft data formats mark.dickinson, georg.brandl database lemburg devguide ncoghlan, eric.araujo, ezio.melotti, willingc @@ -341,7 +341,7 @@ georg.brandl str.format eric.smith testing michael.foord, pitrou, ezio.melotti -test coverage giampaolo.rodola, christian.heimes +test coverage giampaolo.rodola threads pitrou time and dates lemburg, belopolsky unicode lemburg, ezio.melotti, haypo, benjamin.peterson, pitrou diff --git a/motivations.rst b/motivations.rst --- a/motivations.rst +++ b/motivations.rst @@ -118,6 +118,11 @@ utility development, he is also interested in helping to ensure its continued suitability for educational and data analysis use cases. +.. topic:: Christian Heimes (Germany) + + * Red Hat (Software Developer, Security Engineering / Identity Management) + * Python Software Foundation (Fellow) + .. topic:: R. David Murray (United States) * Personal site: `bitdance.com `_ -- Repository URL: https://hg.python.org/devguide From python-checkins at python.org Sun Jun 12 08:09:24 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 12 Jun 2016 12:09:24 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI1NDU1?= =?utf-8?q?=3A_Backported_tests_for_pickling_recursive_functools=2Epartial?= =?utf-8?q?_objects=2E?= Message-ID: <20160612120923.9983.42268.BB2CB821@psf.io> https://hg.python.org/cpython/rev/7859742826b2 changeset: 101942:7859742826b2 branch: 2.7 parent: 101931:c071da010053 user: Serhiy Storchaka date: Sun Jun 12 15:08:57 2016 +0300 summary: Issue #25455: Backported tests for pickling recursive functools.partial objects. files: Lib/test/test_functools.py | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -236,6 +236,25 @@ self.assertEqual(r, ((1, 2), {})) self.assertIs(type(r[0]), tuple) + def test_recursive_pickle(self): + f = self.thetype(capture) + f.__setstate__((f, (), {}, {})) + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + with self.assertRaises(RuntimeError): + pickle.dumps(f, proto) + + f = self.thetype(capture) + f.__setstate__((capture, (f,), {}, {})) + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + f_copy = pickle.loads(pickle.dumps(f, proto)) + self.assertIs(f_copy.args[0], f_copy) + + f = self.thetype(capture) + f.__setstate__((capture, (), {'a': f}, {})) + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + f_copy = pickle.loads(pickle.dumps(f, proto)) + self.assertIs(f_copy.keywords['a'], f_copy) + # Issue 6083: Reference counting bug def test_setstate_refcount(self): class BadSequence: @@ -270,6 +289,7 @@ test_setstate_errors = None test_setstate_subclasses = None test_setstate_refcount = None + test_recursive_pickle = None # the python version isn't deepcopyable test_deepcopy = None -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 08:53:31 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 12 Jun 2016 12:53:31 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI1NDU1?= =?utf-8?q?=3A_Clean_up_reference_loops_created_in_tests_for_recursive?= Message-ID: <20160612125331.99256.25151.0EF90749@psf.io> https://hg.python.org/cpython/rev/0323b33894f2 changeset: 101944:0323b33894f2 branch: 3.5 parent: 101940:12bf71b9f1cd user: Serhiy Storchaka date: Sun Jun 12 15:45:14 2016 +0300 summary: Issue #25455: Clean up reference loops created in tests for recursive functools.partial objects. files: Lib/test/test_functools.py | 48 +++++++++++++++++++------ 1 files changed, 36 insertions(+), 12 deletions(-) diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -225,15 +225,24 @@ f = self.partial(capture) f.__setstate__((f, (), {}, {})) - self.assertEqual(repr(f), '%s(%s(...))' % (name, name)) + try: + self.assertEqual(repr(f), '%s(%s(...))' % (name, name)) + finally: + f.__setstate__((capture, (), {}, {})) f = self.partial(capture) f.__setstate__((capture, (f,), {}, {})) - self.assertEqual(repr(f), '%s(%r, %s(...))' % (name, capture, name)) + try: + self.assertEqual(repr(f), '%s(%r, %s(...))' % (name, capture, name)) + finally: + f.__setstate__((capture, (), {}, {})) f = self.partial(capture) f.__setstate__((capture, (), {'a': f}, {})) - self.assertEqual(repr(f), '%s(%r, a=%s(...))' % (name, capture, name)) + try: + self.assertEqual(repr(f), '%s(%r, a=%s(...))' % (name, capture, name)) + finally: + f.__setstate__((capture, (), {}, {})) def test_pickle(self): f = self.partial(signature, ['asdf'], bar=[True]) @@ -318,21 +327,36 @@ def test_recursive_pickle(self): f = self.partial(capture) f.__setstate__((f, (), {}, {})) - for proto in range(pickle.HIGHEST_PROTOCOL + 1): - with self.assertRaises(RecursionError): - pickle.dumps(f, proto) + try: + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + with self.assertRaises(RecursionError): + pickle.dumps(f, proto) + finally: + f.__setstate__((capture, (), {}, {})) f = self.partial(capture) f.__setstate__((capture, (f,), {}, {})) - for proto in range(pickle.HIGHEST_PROTOCOL + 1): - f_copy = pickle.loads(pickle.dumps(f, proto)) - self.assertIs(f_copy.args[0], f_copy) + try: + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + f_copy = pickle.loads(pickle.dumps(f, proto)) + try: + self.assertIs(f_copy.args[0], f_copy) + finally: + f_copy.__setstate__((capture, (), {}, {})) + finally: + f.__setstate__((capture, (), {}, {})) f = self.partial(capture) f.__setstate__((capture, (), {'a': f}, {})) - for proto in range(pickle.HIGHEST_PROTOCOL + 1): - f_copy = pickle.loads(pickle.dumps(f, proto)) - self.assertIs(f_copy.keywords['a'], f_copy) + try: + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + f_copy = pickle.loads(pickle.dumps(f, proto)) + try: + self.assertIs(f_copy.keywords['a'], f_copy) + finally: + f_copy.__setstate__((capture, (), {}, {})) + finally: + f.__setstate__((capture, (), {}, {})) # Issue 6083: Reference counting bug def test_setstate_refcount(self): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 08:53:31 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 12 Jun 2016 12:53:31 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Rename_class_a?= =?utf-8?q?ttribute_=22thetype=22_to_=22partial=22_in_functools=2Epartial_?= =?utf-8?q?tests?= Message-ID: <20160612125331.20145.13993.767A2DA0@psf.io> https://hg.python.org/cpython/rev/f78be09fbf1a changeset: 101943:f78be09fbf1a branch: 2.7 user: Serhiy Storchaka date: Sun Jun 12 15:43:57 2016 +0300 summary: Rename class attribute "thetype" to "partial" in functools.partial tests for consistency with Python 3. files: Lib/test/test_functools.py | 68 +++++++++++++------------- 1 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -38,17 +38,17 @@ class TestPartial(unittest.TestCase): - thetype = functools.partial + partial = functools.partial def test_basic_examples(self): - p = self.thetype(capture, 1, 2, a=10, b=20) + p = self.partial(capture, 1, 2, a=10, b=20) self.assertEqual(p(3, 4, b=30, c=40), ((1, 2, 3, 4), dict(a=10, b=30, c=40))) - p = self.thetype(map, lambda x: x*10) + p = self.partial(map, lambda x: x*10) self.assertEqual(p([1,2,3,4]), [10, 20, 30, 40]) def test_attributes(self): - p = self.thetype(capture, 1, 2, a=10, b=20) + p = self.partial(capture, 1, 2, a=10, b=20) # attributes should be readable self.assertEqual(p.func, capture) self.assertEqual(p.args, (1, 2)) @@ -58,7 +58,7 @@ self.assertRaises(TypeError, setattr, p, 'args', (1, 2)) self.assertRaises(TypeError, setattr, p, 'keywords', dict(a=1, b=2)) - p = self.thetype(hex) + p = self.partial(hex) try: del p.__dict__ except TypeError: @@ -67,9 +67,9 @@ self.fail('partial object allowed __dict__ to be deleted') def test_argument_checking(self): - self.assertRaises(TypeError, self.thetype) # need at least a func arg + self.assertRaises(TypeError, self.partial) # need at least a func arg try: - self.thetype(2)() + self.partial(2)() except TypeError: pass else: @@ -80,7 +80,7 @@ def func(a=10, b=20): return a d = {'a':3} - p = self.thetype(func, a=5) + p = self.partial(func, a=5) self.assertEqual(p(**d), 3) self.assertEqual(d, {'a':3}) p(b=7) @@ -89,21 +89,21 @@ def test_arg_combinations(self): # exercise special code paths for zero args in either partial # object or the caller - p = self.thetype(capture) + p = self.partial(capture) self.assertEqual(p(), ((), {})) self.assertEqual(p(1,2), ((1,2), {})) - p = self.thetype(capture, 1, 2) + p = self.partial(capture, 1, 2) self.assertEqual(p(), ((1,2), {})) self.assertEqual(p(3,4), ((1,2,3,4), {})) def test_kw_combinations(self): # exercise special code paths for no keyword args in # either the partial object or the caller - p = self.thetype(capture) + p = self.partial(capture) self.assertEqual(p.keywords, {}) self.assertEqual(p(), ((), {})) self.assertEqual(p(a=1), ((), {'a':1})) - p = self.thetype(capture, a=1) + p = self.partial(capture, a=1) self.assertEqual(p.keywords, {'a':1}) self.assertEqual(p(), ((), {'a':1})) self.assertEqual(p(b=2), ((), {'a':1, 'b':2})) @@ -113,7 +113,7 @@ def test_positional(self): # make sure positional arguments are captured correctly for args in [(), (0,), (0,1), (0,1,2), (0,1,2,3)]: - p = self.thetype(capture, *args) + p = self.partial(capture, *args) expected = args + ('x',) got, empty = p('x') self.assertTrue(expected == got and empty == {}) @@ -121,14 +121,14 @@ def test_keyword(self): # make sure keyword arguments are captured correctly for a in ['a', 0, None, 3.5]: - p = self.thetype(capture, a=a) + p = self.partial(capture, a=a) expected = {'a':a,'x':None} empty, got = p(x=None) self.assertTrue(expected == got and empty == ()) def test_no_side_effects(self): # make sure there are no side effects that affect subsequent calls - p = self.thetype(capture, 0, a=1) + p = self.partial(capture, 0, a=1) args1, kw1 = p(1, b=2) self.assertTrue(args1 == (0,1) and kw1 == {'a':1,'b':2}) args2, kw2 = p() @@ -137,13 +137,13 @@ def test_error_propagation(self): def f(x, y): x // y - self.assertRaises(ZeroDivisionError, self.thetype(f, 1, 0)) - self.assertRaises(ZeroDivisionError, self.thetype(f, 1), 0) - self.assertRaises(ZeroDivisionError, self.thetype(f), 1, 0) - self.assertRaises(ZeroDivisionError, self.thetype(f, y=0), 1) + self.assertRaises(ZeroDivisionError, self.partial(f, 1, 0)) + self.assertRaises(ZeroDivisionError, self.partial(f, 1), 0) + self.assertRaises(ZeroDivisionError, self.partial(f), 1, 0) + self.assertRaises(ZeroDivisionError, self.partial(f, y=0), 1) def test_weakref(self): - f = self.thetype(int, base=16) + f = self.partial(int, base=16) p = proxy(f) self.assertEqual(f.func, p.func) f = None @@ -151,20 +151,20 @@ def test_with_bound_and_unbound_methods(self): data = map(str, range(10)) - join = self.thetype(str.join, '') + join = self.partial(str.join, '') self.assertEqual(join(data), '0123456789') - join = self.thetype(''.join) + join = self.partial(''.join) self.assertEqual(join(data), '0123456789') def test_pickle(self): - f = self.thetype(signature, ['asdf'], bar=[True]) + f = self.partial(signature, ['asdf'], bar=[True]) f.attr = [] for proto in range(pickle.HIGHEST_PROTOCOL + 1): f_copy = pickle.loads(pickle.dumps(f, proto)) self.assertEqual(signature(f_copy), signature(f)) def test_copy(self): - f = self.thetype(signature, ['asdf'], bar=[True]) + f = self.partial(signature, ['asdf'], bar=[True]) f.attr = [] f_copy = copy.copy(f) self.assertEqual(signature(f_copy), signature(f)) @@ -173,7 +173,7 @@ self.assertIs(f_copy.keywords, f.keywords) def test_deepcopy(self): - f = self.thetype(signature, ['asdf'], bar=[True]) + f = self.partial(signature, ['asdf'], bar=[True]) f.attr = [] f_copy = copy.deepcopy(f) self.assertEqual(signature(f_copy), signature(f)) @@ -184,7 +184,7 @@ self.assertIsNot(f_copy.keywords['bar'], f.keywords['bar']) def test_setstate(self): - f = self.thetype(signature) + f = self.partial(signature) f.__setstate__((capture, (1,), dict(a=10), dict(attr=[]))) self.assertEqual(signature(f), (capture, (1,), dict(a=10), dict(attr=[]))) @@ -207,7 +207,7 @@ self.assertEqual(f(), ((), {})) def test_setstate_errors(self): - f = self.thetype(signature) + f = self.partial(signature) self.assertRaises(TypeError, f.__setstate__, (capture, (), {})) self.assertRaises(TypeError, f.__setstate__, (capture, (), {}, {}, None)) self.assertRaises(TypeError, f.__setstate__, [capture, (), {}, None]) @@ -217,7 +217,7 @@ self.assertRaises(TypeError, f.__setstate__, (capture, (), [], None)) def test_setstate_subclasses(self): - f = self.thetype(signature) + f = self.partial(signature) f.__setstate__((capture, MyTuple((1,)), MyDict(a=10), None)) s = signature(f) self.assertEqual(s, (capture, (1,), dict(a=10), {})) @@ -237,19 +237,19 @@ self.assertIs(type(r[0]), tuple) def test_recursive_pickle(self): - f = self.thetype(capture) + f = self.partial(capture) f.__setstate__((f, (), {}, {})) for proto in range(pickle.HIGHEST_PROTOCOL + 1): with self.assertRaises(RuntimeError): pickle.dumps(f, proto) - f = self.thetype(capture) + f = self.partial(capture) f.__setstate__((capture, (f,), {}, {})) for proto in range(pickle.HIGHEST_PROTOCOL + 1): f_copy = pickle.loads(pickle.dumps(f, proto)) self.assertIs(f_copy.args[0], f_copy) - f = self.thetype(capture) + f = self.partial(capture) f.__setstate__((capture, (), {'a': f}, {})) for proto in range(pickle.HIGHEST_PROTOCOL + 1): f_copy = pickle.loads(pickle.dumps(f, proto)) @@ -269,7 +269,7 @@ return {} raise IndexError - f = self.thetype(object) + f = self.partial(object) self.assertRaises(TypeError, f.__setstate__, BadSequence()) class PartialSubclass(functools.partial): @@ -277,11 +277,11 @@ class TestPartialSubclass(TestPartial): - thetype = PartialSubclass + partial = PartialSubclass class TestPythonPartial(TestPartial): - thetype = PythonPartial + partial = PythonPartial # the python version isn't picklable test_pickle = None -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 08:53:32 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 12 Jun 2016 12:53:32 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2325455=3A_Clean_up_reference_loops_created_in_te?= =?utf-8?q?sts_for_recursive?= Message-ID: <20160612125331.11688.86072.62EFC802@psf.io> https://hg.python.org/cpython/rev/818a10534e44 changeset: 101946:818a10534e44 parent: 101941:4502cff170c2 parent: 101944:0323b33894f2 user: Serhiy Storchaka date: Sun Jun 12 15:53:09 2016 +0300 summary: Issue #25455: Clean up reference loops created in tests for recursive functools.partial objects. files: Lib/test/test_functools.py | 48 +++++++++++++++++++------ 1 files changed, 36 insertions(+), 12 deletions(-) diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -225,15 +225,24 @@ f = self.partial(capture) f.__setstate__((f, (), {}, {})) - self.assertEqual(repr(f), '%s(%s(...))' % (name, name)) + try: + self.assertEqual(repr(f), '%s(%s(...))' % (name, name)) + finally: + f.__setstate__((capture, (), {}, {})) f = self.partial(capture) f.__setstate__((capture, (f,), {}, {})) - self.assertEqual(repr(f), '%s(%r, %s(...))' % (name, capture, name)) + try: + self.assertEqual(repr(f), '%s(%r, %s(...))' % (name, capture, name)) + finally: + f.__setstate__((capture, (), {}, {})) f = self.partial(capture) f.__setstate__((capture, (), {'a': f}, {})) - self.assertEqual(repr(f), '%s(%r, a=%s(...))' % (name, capture, name)) + try: + self.assertEqual(repr(f), '%s(%r, a=%s(...))' % (name, capture, name)) + finally: + f.__setstate__((capture, (), {}, {})) def test_pickle(self): f = self.partial(signature, ['asdf'], bar=[True]) @@ -318,21 +327,36 @@ def test_recursive_pickle(self): f = self.partial(capture) f.__setstate__((f, (), {}, {})) - for proto in range(pickle.HIGHEST_PROTOCOL + 1): - with self.assertRaises(RecursionError): - pickle.dumps(f, proto) + try: + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + with self.assertRaises(RecursionError): + pickle.dumps(f, proto) + finally: + f.__setstate__((capture, (), {}, {})) f = self.partial(capture) f.__setstate__((capture, (f,), {}, {})) - for proto in range(pickle.HIGHEST_PROTOCOL + 1): - f_copy = pickle.loads(pickle.dumps(f, proto)) - self.assertIs(f_copy.args[0], f_copy) + try: + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + f_copy = pickle.loads(pickle.dumps(f, proto)) + try: + self.assertIs(f_copy.args[0], f_copy) + finally: + f_copy.__setstate__((capture, (), {}, {})) + finally: + f.__setstate__((capture, (), {}, {})) f = self.partial(capture) f.__setstate__((capture, (), {'a': f}, {})) - for proto in range(pickle.HIGHEST_PROTOCOL + 1): - f_copy = pickle.loads(pickle.dumps(f, proto)) - self.assertIs(f_copy.keywords['a'], f_copy) + try: + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + f_copy = pickle.loads(pickle.dumps(f, proto)) + try: + self.assertIs(f_copy.keywords['a'], f_copy) + finally: + f_copy.__setstate__((capture, (), {}, {})) + finally: + f.__setstate__((capture, (), {}, {})) # Issue 6083: Reference counting bug def test_setstate_refcount(self): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 08:53:31 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 12 Jun 2016 12:53:31 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI1NDU1?= =?utf-8?q?=3A_Clean_up_reference_loops_created_in_tests_for_recursive?= Message-ID: <20160612125331.26318.38721.FFA7A4D3@psf.io> https://hg.python.org/cpython/rev/688edc946ab9 changeset: 101945:688edc946ab9 branch: 2.7 parent: 101943:f78be09fbf1a user: Serhiy Storchaka date: Sun Jun 12 15:45:14 2016 +0300 summary: Issue #25455: Clean up reference loops created in tests for recursive functools.partial objects. files: Lib/test/test_functools.py | 33 ++++++++++++++++++------- 1 files changed, 24 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -239,21 +239,36 @@ def test_recursive_pickle(self): f = self.partial(capture) f.__setstate__((f, (), {}, {})) - for proto in range(pickle.HIGHEST_PROTOCOL + 1): - with self.assertRaises(RuntimeError): - pickle.dumps(f, proto) + try: + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + with self.assertRaises(RuntimeError): + pickle.dumps(f, proto) + finally: + f.__setstate__((capture, (), {}, {})) f = self.partial(capture) f.__setstate__((capture, (f,), {}, {})) - for proto in range(pickle.HIGHEST_PROTOCOL + 1): - f_copy = pickle.loads(pickle.dumps(f, proto)) - self.assertIs(f_copy.args[0], f_copy) + try: + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + f_copy = pickle.loads(pickle.dumps(f, proto)) + try: + self.assertIs(f_copy.args[0], f_copy) + finally: + f_copy.__setstate__((capture, (), {}, {})) + finally: + f.__setstate__((capture, (), {}, {})) f = self.partial(capture) f.__setstate__((capture, (), {'a': f}, {})) - for proto in range(pickle.HIGHEST_PROTOCOL + 1): - f_copy = pickle.loads(pickle.dumps(f, proto)) - self.assertIs(f_copy.keywords['a'], f_copy) + try: + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + f_copy = pickle.loads(pickle.dumps(f, proto)) + try: + self.assertIs(f_copy.keywords['a'], f_copy) + finally: + f_copy.__setstate__((capture, (), {}, {})) + finally: + f.__setstate__((capture, (), {}, {})) # Issue 6083: Reference counting bug def test_setstate_refcount(self): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 09:28:17 2016 From: python-checkins at python.org (berker.peksag) Date: Sun, 12 Jun 2016 13:28:17 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3Mjg5?= =?utf-8?q?=3A_Prevent_test=5Furllib2net_failures_due_to_EOFError_raised_b?= =?utf-8?q?y_ftplib?= Message-ID: <20160612132803.114361.37766.4AD933AE@psf.io> https://hg.python.org/cpython/rev/2e3a5770e5f6 changeset: 101947:2e3a5770e5f6 branch: 3.5 parent: 101944:0323b33894f2 user: Berker Peksag date: Sun Jun 12 16:27:48 2016 +0300 summary: Issue #27289: Prevent test_urllib2net failures due to EOFError raised by ftplib files: Lib/test/support/__init__.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -1349,7 +1349,8 @@ 500 <= err.code <= 599) or (isinstance(err, urllib.error.URLError) and (("ConnectionRefusedError" in err.reason) or - ("TimeoutError" in err.reason))) or + ("TimeoutError" in err.reason) or + ("EOFError" in err.reason))) or n in captured_errnos): if not verbose: sys.stderr.write(denied.args[0] + "\n") -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 09:28:17 2016 From: python-checkins at python.org (berker.peksag) Date: Sun, 12 Jun 2016 13:28:17 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327289=3A_Merge_from_3=2E5?= Message-ID: <20160612132803.114579.22007.60B44AF7@psf.io> https://hg.python.org/cpython/rev/fc0e8c7235f1 changeset: 101948:fc0e8c7235f1 parent: 101946:818a10534e44 parent: 101947:2e3a5770e5f6 user: Berker Peksag date: Sun Jun 12 16:28:16 2016 +0300 summary: Issue #27289: Merge from 3.5 files: Lib/test/support/__init__.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -1351,7 +1351,8 @@ 500 <= err.code <= 599) or (isinstance(err, urllib.error.URLError) and (("ConnectionRefusedError" in err.reason) or - ("TimeoutError" in err.reason))) or + ("TimeoutError" in err.reason) or + ("EOFError" in err.reason))) or n in captured_errnos): if not verbose: sys.stderr.write(denied.args[0] + "\n") -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 09:35:19 2016 From: python-checkins at python.org (berker.peksag) Date: Sun, 12 Jun 2016 13:35:19 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzE1NjU3?= =?utf-8?q?=3A_Delete_incorrect_statement_from_PyMethodDef_documentation?= Message-ID: <20160612133518.20067.73552.D23A9F26@psf.io> https://hg.python.org/cpython/rev/367b3f41710a changeset: 101949:367b3f41710a branch: 3.5 parent: 101947:2e3a5770e5f6 user: Berker Peksag date: Sun Jun 12 16:34:38 2016 +0300 summary: Issue #15657: Delete incorrect statement from PyMethodDef documentation files: Doc/c-api/structures.rst | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) 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 @@ -150,9 +150,8 @@ The :attr:`ml_flags` field is a bitfield which can include the following flags. The individual flags indicate either a calling convention or a binding convention. Of the calling convention flags, only :const:`METH_VARARGS` and -:const:`METH_KEYWORDS` can be combined (but note that :const:`METH_KEYWORDS` -alone is equivalent to ``METH_VARARGS | METH_KEYWORDS``). Any of the calling -convention flags can be combined with a binding flag. +:const:`METH_KEYWORDS` can be combined. Any of the calling convention flags +can be combined with a binding flag. .. data:: METH_VARARGS -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 09:35:19 2016 From: python-checkins at python.org (berker.peksag) Date: Sun, 12 Jun 2016 13:35:19 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2315657=3A_Null_merge_from_3=2E5?= Message-ID: <20160612133518.27813.2464.E7400342@psf.io> https://hg.python.org/cpython/rev/7fa4986d8218 changeset: 101950:7fa4986d8218 parent: 101948:fc0e8c7235f1 parent: 101949:367b3f41710a user: Berker Peksag date: Sun Jun 12 16:35:31 2016 +0300 summary: Issue #15657: Null merge from 3.5 files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 09:37:48 2016 From: python-checkins at python.org (berker.peksag) Date: Sun, 12 Jun 2016 13:37:48 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE1NjU3?= =?utf-8?q?=3A_Delete_incorrect_statement_from_PyMethodDef_documentation?= Message-ID: <20160612133744.114664.62124.6EB9E9F7@psf.io> https://hg.python.org/cpython/rev/f520ae3b537b changeset: 101951:f520ae3b537b branch: 2.7 parent: 101945:688edc946ab9 user: Berker Peksag date: Sun Jun 12 16:37:57 2016 +0300 summary: Issue #15657: Delete incorrect statement from PyMethodDef documentation files: Doc/c-api/structures.rst | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) 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 @@ -159,9 +159,8 @@ The :attr:`ml_flags` field is a bitfield which can include the following flags. The individual flags indicate either a calling convention or a binding convention. Of the calling convention flags, only :const:`METH_VARARGS` and -:const:`METH_KEYWORDS` can be combined (but note that :const:`METH_KEYWORDS` -alone is equivalent to ``METH_VARARGS | METH_KEYWORDS``). Any of the calling -convention flags can be combined with a binding flag. +:const:`METH_KEYWORDS` can be combined. Any of the calling convention flags +can be combined with a binding flag. .. data:: METH_VARARGS -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 10:37:38 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 12 Jun 2016 14:37:38 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Comment_fixes_extracted_fr?= =?utf-8?q?om_patch_by_Demur_Rumed=2E?= Message-ID: <20160612143715.114703.85125.66D64A70@psf.io> https://hg.python.org/cpython/rev/be5ad9a46233 changeset: 101952:be5ad9a46233 parent: 101950:7fa4986d8218 user: Serhiy Storchaka date: Sun Jun 12 17:02:10 2016 +0300 summary: Comment fixes extracted from patch by Demur Rumed. files: Lib/importlib/_bootstrap_external.py | 4 - Objects/abstract.c | 2 +- Python/importlib_external.h | 206 +++++++------- 3 files changed, 104 insertions(+), 108 deletions(-) diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -130,10 +130,6 @@ # a .pyc file in text mode the magic number will be wrong; also, the # Apple MPW compiler swaps their values, botching string constants. # -# The magic numbers must be spaced apart at least 2 values, as the -# -U interpeter flag will cause MAGIC+1 being used. They have been -# odd numbers for some time now. -# # There were a variety of old schemes for setting the magic number. # The current working scheme is to increment the previous value by # 10. diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2132,7 +2132,7 @@ "%s returned NULL without setting an error", where); #ifdef Py_DEBUG - /* Ensure that the bug is catched in debug mode */ + /* Ensure that the bug is caught in debug mode */ Py_FatalError("a function returned NULL without setting an error"); #endif return NULL; diff --git a/Python/importlib_external.h b/Python/importlib_external.h --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -339,7 +339,7 @@ 103,90,15,97,108,109,111,115,116,95,102,105,108,101,110,97, 109,101,114,4,0,0,0,114,4,0,0,0,114,5,0,0, 0,218,17,99,97,99,104,101,95,102,114,111,109,95,115,111, - 117,114,99,101,251,0,0,0,115,46,0,0,0,0,18,8, + 117,114,99,101,247,0,0,0,115,46,0,0,0,0,18,8, 1,6,1,6,1,8,1,4,1,8,1,12,1,12,1,16, 1,8,1,8,1,8,1,24,1,8,1,12,1,6,2,8, 1,8,1,8,1,8,1,14,1,14,1,114,79,0,0,0, @@ -412,7 +412,7 @@ 101,108,90,13,98,97,115,101,95,102,105,108,101,110,97,109, 101,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, 218,17,115,111,117,114,99,101,95,102,114,111,109,95,99,97, - 99,104,101,39,1,0,0,115,44,0,0,0,0,9,12,1, + 99,104,101,35,1,0,0,115,44,0,0,0,0,9,12,1, 8,1,12,1,12,1,8,1,6,1,10,1,10,1,8,1, 6,1,10,1,8,1,16,1,10,1,6,1,8,1,16,1, 8,1,6,1,8,1,14,1,114,85,0,0,0,99,1,0, @@ -447,7 +447,7 @@ 0,90,9,101,120,116,101,110,115,105,111,110,218,11,115,111, 117,114,99,101,95,112,97,116,104,114,4,0,0,0,114,4, 0,0,0,114,5,0,0,0,218,15,95,103,101,116,95,115, - 111,117,114,99,101,102,105,108,101,72,1,0,0,115,20,0, + 111,117,114,99,101,102,105,108,101,68,1,0,0,115,20,0, 0,0,0,7,12,1,4,1,16,1,26,1,4,1,2,1, 12,1,18,1,18,1,114,91,0,0,0,99,1,0,0,0, 0,0,0,0,1,0,0,0,11,0,0,0,67,0,0,0, @@ -461,7 +461,7 @@ 66,0,0,0,114,74,0,0,0,41,1,218,8,102,105,108, 101,110,97,109,101,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,11,95,103,101,116,95,99,97,99,104,101, - 100,91,1,0,0,115,16,0,0,0,0,1,14,1,2,1, + 100,87,1,0,0,115,16,0,0,0,0,1,14,1,2,1, 8,1,14,1,8,1,14,1,6,2,114,95,0,0,0,99, 1,0,0,0,0,0,0,0,2,0,0,0,11,0,0,0, 67,0,0,0,115,52,0,0,0,121,14,116,0,124,0,131, @@ -475,7 +475,7 @@ 114,39,0,0,0,114,41,0,0,0,114,40,0,0,0,41, 2,114,35,0,0,0,114,42,0,0,0,114,4,0,0,0, 114,4,0,0,0,114,5,0,0,0,218,10,95,99,97,108, - 99,95,109,111,100,101,103,1,0,0,115,12,0,0,0,0, + 99,95,109,111,100,101,99,1,0,0,115,12,0,0,0,0, 2,2,1,14,1,14,1,10,3,8,1,114,97,0,0,0, 99,1,0,0,0,0,0,0,0,3,0,0,0,11,0,0, 0,3,0,0,0,115,68,0,0,0,100,1,135,0,102,1, @@ -512,7 +512,7 @@ 0,0,0,218,4,97,114,103,115,90,6,107,119,97,114,103, 115,41,1,218,6,109,101,116,104,111,100,114,4,0,0,0, 114,5,0,0,0,218,19,95,99,104,101,99,107,95,110,97, - 109,101,95,119,114,97,112,112,101,114,123,1,0,0,115,12, + 109,101,95,119,114,97,112,112,101,114,119,1,0,0,115,12, 0,0,0,0,1,8,1,8,1,10,1,4,1,20,1,122, 40,95,99,104,101,99,107,95,110,97,109,101,46,60,108,111, 99,97,108,115,62,46,95,99,104,101,99,107,95,110,97,109, @@ -533,14 +533,14 @@ 105,99,116,95,95,218,6,117,112,100,97,116,101,41,3,90, 3,110,101,119,90,3,111,108,100,114,52,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,218,5,95, - 119,114,97,112,134,1,0,0,115,8,0,0,0,0,1,10, + 119,114,97,112,130,1,0,0,115,8,0,0,0,0,1,10, 1,10,1,22,1,122,26,95,99,104,101,99,107,95,110,97, 109,101,46,60,108,111,99,97,108,115,62,46,95,119,114,97, 112,41,3,218,10,95,98,111,111,116,115,116,114,97,112,114, 113,0,0,0,218,9,78,97,109,101,69,114,114,111,114,41, 3,114,102,0,0,0,114,103,0,0,0,114,113,0,0,0, 114,4,0,0,0,41,1,114,102,0,0,0,114,5,0,0, - 0,218,11,95,99,104,101,99,107,95,110,97,109,101,115,1, + 0,218,11,95,99,104,101,99,107,95,110,97,109,101,111,1, 0,0,115,14,0,0,0,0,8,14,7,2,1,10,1,14, 2,14,5,10,1,114,116,0,0,0,99,2,0,0,0,0, 0,0,0,5,0,0,0,4,0,0,0,67,0,0,0,115, @@ -568,7 +568,7 @@ 108,108,110,97,109,101,218,6,108,111,97,100,101,114,218,8, 112,111,114,116,105,111,110,115,218,3,109,115,103,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,218,17,95,102, - 105,110,100,95,109,111,100,117,108,101,95,115,104,105,109,143, + 105,110,100,95,109,111,100,117,108,101,95,115,104,105,109,139, 1,0,0,115,10,0,0,0,0,10,14,1,16,1,4,1, 22,1,114,123,0,0,0,99,4,0,0,0,0,0,0,0, 11,0,0,0,19,0,0,0,67,0,0,0,115,128,1,0, @@ -648,7 +648,7 @@ 109,101,218,11,115,111,117,114,99,101,95,115,105,122,101,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,25, 95,118,97,108,105,100,97,116,101,95,98,121,116,101,99,111, - 100,101,95,104,101,97,100,101,114,160,1,0,0,115,76,0, + 100,101,95,104,101,97,100,101,114,156,1,0,0,115,76,0, 0,0,0,11,4,1,8,1,10,3,4,1,8,1,8,1, 12,1,12,1,12,1,8,1,12,1,12,1,12,1,12,1, 10,1,12,1,10,1,12,1,10,1,12,1,8,1,10,1, @@ -678,7 +678,7 @@ 114,89,0,0,0,114,90,0,0,0,218,4,99,111,100,101, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218, 17,95,99,111,109,112,105,108,101,95,98,121,116,101,99,111, - 100,101,215,1,0,0,115,16,0,0,0,0,2,10,1,10, + 100,101,211,1,0,0,115,16,0,0,0,0,2,10,1,10, 1,12,1,8,1,12,1,6,2,12,1,114,141,0,0,0, 114,59,0,0,0,99,3,0,0,0,0,0,0,0,4,0, 0,0,3,0,0,0,67,0,0,0,115,56,0,0,0,116, @@ -696,7 +696,7 @@ 5,100,117,109,112,115,41,4,114,140,0,0,0,114,126,0, 0,0,114,134,0,0,0,114,53,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,218,17,95,99,111, - 100,101,95,116,111,95,98,121,116,101,99,111,100,101,227,1, + 100,101,95,116,111,95,98,121,116,101,99,111,100,101,223,1, 0,0,115,10,0,0,0,0,3,8,1,14,1,14,1,16, 1,114,144,0,0,0,99,1,0,0,0,0,0,0,0,5, 0,0,0,4,0,0,0,67,0,0,0,115,62,0,0,0, @@ -723,7 +723,7 @@ 97,100,108,105,110,101,218,8,101,110,99,111,100,105,110,103, 90,15,110,101,119,108,105,110,101,95,100,101,99,111,100,101, 114,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 218,13,100,101,99,111,100,101,95,115,111,117,114,99,101,237, + 218,13,100,101,99,111,100,101,95,115,111,117,114,99,101,233, 1,0,0,115,10,0,0,0,0,5,8,1,12,1,10,1, 12,1,114,149,0,0,0,114,120,0,0,0,218,26,115,117, 98,109,111,100,117,108,101,95,115,101,97,114,99,104,95,108, @@ -784,7 +784,7 @@ 7,100,105,114,110,97,109,101,114,4,0,0,0,114,4,0, 0,0,114,5,0,0,0,218,23,115,112,101,99,95,102,114, 111,109,95,102,105,108,101,95,108,111,99,97,116,105,111,110, - 254,1,0,0,115,60,0,0,0,0,12,8,4,4,1,10, + 250,1,0,0,115,60,0,0,0,0,12,8,4,4,1,10, 2,2,1,14,1,14,1,6,8,18,1,6,3,8,1,16, 1,14,1,10,1,6,1,6,2,4,3,8,2,10,1,2, 1,14,1,14,1,6,2,4,1,8,2,6,1,12,1,6, @@ -820,7 +820,7 @@ 89,95,76,79,67,65,76,95,77,65,67,72,73,78,69,41, 2,218,3,99,108,115,218,3,107,101,121,114,4,0,0,0, 114,4,0,0,0,114,5,0,0,0,218,14,95,111,112,101, - 110,95,114,101,103,105,115,116,114,121,76,2,0,0,115,8, + 110,95,114,101,103,105,115,116,114,121,72,2,0,0,115,8, 0,0,0,0,2,2,1,14,1,14,1,122,36,87,105,110, 100,111,119,115,82,101,103,105,115,116,114,121,70,105,110,100, 101,114,46,95,111,112,101,110,95,114,101,103,105,115,116,114, @@ -846,7 +846,7 @@ 107,101,121,114,165,0,0,0,90,4,104,107,101,121,218,8, 102,105,108,101,112,97,116,104,114,4,0,0,0,114,4,0, 0,0,114,5,0,0,0,218,16,95,115,101,97,114,99,104, - 95,114,101,103,105,115,116,114,121,83,2,0,0,115,22,0, + 95,114,101,103,105,115,116,114,121,79,2,0,0,115,22,0, 0,0,0,2,6,1,8,2,6,1,10,1,22,1,2,1, 12,1,26,1,14,1,6,1,122,38,87,105,110,100,111,119, 115,82,101,103,105,115,116,114,121,70,105,110,100,101,114,46, @@ -868,7 +868,7 @@ 114,35,0,0,0,218,6,116,97,114,103,101,116,114,171,0, 0,0,114,120,0,0,0,114,160,0,0,0,114,158,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 218,9,102,105,110,100,95,115,112,101,99,98,2,0,0,115, + 218,9,102,105,110,100,95,115,112,101,99,94,2,0,0,115, 26,0,0,0,0,2,10,1,8,1,4,1,2,1,12,1, 14,1,6,1,16,1,14,1,6,1,10,1,8,1,122,31, 87,105,110,100,111,119,115,82,101,103,105,115,116,114,121,70, @@ -887,7 +887,7 @@ 114,175,0,0,0,114,120,0,0,0,41,4,114,164,0,0, 0,114,119,0,0,0,114,35,0,0,0,114,158,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218, - 11,102,105,110,100,95,109,111,100,117,108,101,114,2,0,0, + 11,102,105,110,100,95,109,111,100,117,108,101,110,2,0,0, 115,8,0,0,0,0,7,12,1,8,1,8,2,122,33,87, 105,110,100,111,119,115,82,101,103,105,115,116,114,121,70,105, 110,100,101,114,46,102,105,110,100,95,109,111,100,117,108,101, @@ -896,7 +896,7 @@ 114,167,0,0,0,218,11,99,108,97,115,115,109,101,116,104, 111,100,114,166,0,0,0,114,172,0,0,0,114,175,0,0, 0,114,176,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,162,0,0,0,64, + 114,4,0,0,0,114,5,0,0,0,114,162,0,0,0,60, 2,0,0,115,20,0,0,0,8,2,4,3,4,3,4,2, 4,2,12,7,12,15,2,1,14,15,2,1,114,162,0,0, 0,99,0,0,0,0,0,0,0,0,0,0,0,0,2,0, @@ -931,7 +931,7 @@ 41,5,114,100,0,0,0,114,119,0,0,0,114,94,0,0, 0,90,13,102,105,108,101,110,97,109,101,95,98,97,115,101, 90,9,116,97,105,108,95,110,97,109,101,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,153,0,0,0,133, + 114,4,0,0,0,114,5,0,0,0,114,153,0,0,0,129, 2,0,0,115,8,0,0,0,0,3,18,1,16,1,14,1, 122,24,95,76,111,97,100,101,114,66,97,115,105,99,115,46, 105,115,95,112,97,99,107,97,103,101,99,2,0,0,0,0, @@ -942,7 +942,7 @@ 97,116,105,111,110,46,78,114,4,0,0,0,41,2,114,100, 0,0,0,114,158,0,0,0,114,4,0,0,0,114,4,0, 0,0,114,5,0,0,0,218,13,99,114,101,97,116,101,95, - 109,111,100,117,108,101,141,2,0,0,115,0,0,0,0,122, + 109,111,100,117,108,101,137,2,0,0,115,0,0,0,0,122, 27,95,76,111,97,100,101,114,66,97,115,105,99,115,46,99, 114,101,97,116,101,95,109,111,100,117,108,101,99,2,0,0, 0,0,0,0,0,3,0,0,0,4,0,0,0,67,0,0, @@ -962,7 +962,7 @@ 0,0,41,3,114,100,0,0,0,218,6,109,111,100,117,108, 101,114,140,0,0,0,114,4,0,0,0,114,4,0,0,0, 114,5,0,0,0,218,11,101,120,101,99,95,109,111,100,117, - 108,101,144,2,0,0,115,10,0,0,0,0,2,12,1,8, + 108,101,140,2,0,0,115,10,0,0,0,0,2,12,1,8, 1,6,1,10,1,122,25,95,76,111,97,100,101,114,66,97, 115,105,99,115,46,101,120,101,99,95,109,111,100,117,108,101, 99,2,0,0,0,0,0,0,0,2,0,0,0,3,0,0, @@ -973,14 +973,14 @@ 97,100,95,109,111,100,117,108,101,95,115,104,105,109,41,2, 114,100,0,0,0,114,119,0,0,0,114,4,0,0,0,114, 4,0,0,0,114,5,0,0,0,218,11,108,111,97,100,95, - 109,111,100,117,108,101,152,2,0,0,115,2,0,0,0,0, + 109,111,100,117,108,101,148,2,0,0,115,2,0,0,0,0, 2,122,25,95,76,111,97,100,101,114,66,97,115,105,99,115, 46,108,111,97,100,95,109,111,100,117,108,101,78,41,8,114, 105,0,0,0,114,104,0,0,0,114,106,0,0,0,114,107, 0,0,0,114,153,0,0,0,114,180,0,0,0,114,185,0, 0,0,114,187,0,0,0,114,4,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,114,178,0,0,0, - 128,2,0,0,115,10,0,0,0,8,3,4,2,8,8,8, + 124,2,0,0,115,10,0,0,0,8,3,4,2,8,8,8, 3,8,8,114,178,0,0,0,99,0,0,0,0,0,0,0, 0,0,0,0,0,4,0,0,0,64,0,0,0,115,74,0, 0,0,101,0,90,1,100,0,90,2,100,1,100,2,132,0, @@ -1005,7 +1005,7 @@ 32,32,32,32,78,41,1,218,7,73,79,69,114,114,111,114, 41,2,114,100,0,0,0,114,35,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,218,10,112,97,116, - 104,95,109,116,105,109,101,159,2,0,0,115,2,0,0,0, + 104,95,109,116,105,109,101,155,2,0,0,115,2,0,0,0, 0,6,122,23,83,111,117,114,99,101,76,111,97,100,101,114, 46,112,97,116,104,95,109,116,105,109,101,99,2,0,0,0, 0,0,0,0,2,0,0,0,3,0,0,0,67,0,0,0, @@ -1040,7 +1040,7 @@ 32,32,32,32,114,126,0,0,0,41,1,114,190,0,0,0, 41,2,114,100,0,0,0,114,35,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,218,10,112,97,116, - 104,95,115,116,97,116,115,167,2,0,0,115,2,0,0,0, + 104,95,115,116,97,116,115,163,2,0,0,115,2,0,0,0, 0,11,122,23,83,111,117,114,99,101,76,111,97,100,101,114, 46,112,97,116,104,95,115,116,97,116,115,99,4,0,0,0, 0,0,0,0,4,0,0,0,3,0,0,0,67,0,0,0, @@ -1064,7 +1064,7 @@ 0,90,10,99,97,99,104,101,95,112,97,116,104,114,53,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, 0,218,15,95,99,97,99,104,101,95,98,121,116,101,99,111, - 100,101,180,2,0,0,115,2,0,0,0,0,8,122,28,83, + 100,101,176,2,0,0,115,2,0,0,0,0,8,122,28,83, 111,117,114,99,101,76,111,97,100,101,114,46,95,99,97,99, 104,101,95,98,121,116,101,99,111,100,101,99,3,0,0,0, 0,0,0,0,3,0,0,0,1,0,0,0,67,0,0,0, @@ -1080,7 +1080,7 @@ 111,100,101,32,102,105,108,101,115,46,10,32,32,32,32,32, 32,32,32,78,114,4,0,0,0,41,3,114,100,0,0,0, 114,35,0,0,0,114,53,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,192,0,0,0,190,2, + 4,0,0,0,114,5,0,0,0,114,192,0,0,0,186,2, 0,0,115,0,0,0,0,122,21,83,111,117,114,99,101,76, 111,97,100,101,114,46,115,101,116,95,100,97,116,97,99,2, 0,0,0,0,0,0,0,5,0,0,0,16,0,0,0,67, @@ -1101,7 +1101,7 @@ 0,0,0,41,5,114,100,0,0,0,114,119,0,0,0,114, 35,0,0,0,114,147,0,0,0,218,3,101,120,99,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,218,10,103, - 101,116,95,115,111,117,114,99,101,197,2,0,0,115,14,0, + 101,116,95,115,111,117,114,99,101,193,2,0,0,115,14,0, 0,0,0,2,10,1,2,1,14,1,16,1,6,1,28,1, 122,23,83,111,117,114,99,101,76,111,97,100,101,114,46,103, 101,116,95,115,111,117,114,99,101,218,9,95,111,112,116,105, @@ -1123,7 +1123,7 @@ 101,41,4,114,100,0,0,0,114,53,0,0,0,114,35,0, 0,0,114,197,0,0,0,114,4,0,0,0,114,4,0,0, 0,114,5,0,0,0,218,14,115,111,117,114,99,101,95,116, - 111,95,99,111,100,101,207,2,0,0,115,4,0,0,0,0, + 111,95,99,111,100,101,203,2,0,0,115,4,0,0,0,0, 5,14,1,122,27,83,111,117,114,99,101,76,111,97,100,101, 114,46,115,111,117,114,99,101,95,116,111,95,99,111,100,101, 99,2,0,0,0,0,0,0,0,10,0,0,0,43,0,0, @@ -1180,7 +1180,7 @@ 10,98,121,116,101,115,95,100,97,116,97,114,147,0,0,0, 90,11,99,111,100,101,95,111,98,106,101,99,116,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,114,181,0,0, - 0,215,2,0,0,115,78,0,0,0,0,7,10,1,4,1, + 0,211,2,0,0,115,78,0,0,0,0,7,10,1,4,1, 2,1,12,1,14,1,10,2,2,1,14,1,14,1,6,2, 12,1,2,1,14,1,14,1,6,2,2,1,6,1,8,1, 12,1,18,1,6,2,8,1,6,1,10,1,4,1,8,1, @@ -1192,7 +1192,7 @@ 114,193,0,0,0,114,192,0,0,0,114,196,0,0,0,114, 200,0,0,0,114,181,0,0,0,114,4,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,188,0, - 0,0,157,2,0,0,115,14,0,0,0,8,2,8,8,8, + 0,0,153,2,0,0,115,14,0,0,0,8,2,8,8,8, 13,8,10,8,7,8,10,14,8,114,188,0,0,0,99,0, 0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0, 0,0,0,115,76,0,0,0,101,0,90,1,100,0,90,2, @@ -1218,7 +1218,7 @@ 100,101,114,46,78,41,2,114,98,0,0,0,114,35,0,0, 0,41,3,114,100,0,0,0,114,119,0,0,0,114,35,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,179,0,0,0,16,3,0,0,115,4,0,0,0,0, + 0,114,179,0,0,0,12,3,0,0,115,4,0,0,0,0, 3,6,1,122,19,70,105,108,101,76,111,97,100,101,114,46, 95,95,105,110,105,116,95,95,99,2,0,0,0,0,0,0, 0,2,0,0,0,2,0,0,0,67,0,0,0,115,24,0, @@ -1227,7 +1227,7 @@ 9,95,95,99,108,97,115,115,95,95,114,111,0,0,0,41, 2,114,100,0,0,0,218,5,111,116,104,101,114,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,218,6,95,95, - 101,113,95,95,22,3,0,0,115,4,0,0,0,0,1,12, + 101,113,95,95,18,3,0,0,115,4,0,0,0,0,1,12, 1,122,17,70,105,108,101,76,111,97,100,101,114,46,95,95, 101,113,95,95,99,1,0,0,0,0,0,0,0,1,0,0, 0,3,0,0,0,67,0,0,0,115,20,0,0,0,116,0, @@ -1235,7 +1235,7 @@ 83,0,41,1,78,41,3,218,4,104,97,115,104,114,98,0, 0,0,114,35,0,0,0,41,1,114,100,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,218,8,95, - 95,104,97,115,104,95,95,26,3,0,0,115,2,0,0,0, + 95,104,97,115,104,95,95,22,3,0,0,115,2,0,0,0, 0,1,122,19,70,105,108,101,76,111,97,100,101,114,46,95, 95,104,97,115,104,95,95,99,2,0,0,0,0,0,0,0, 2,0,0,0,3,0,0,0,3,0,0,0,115,16,0,0, @@ -1249,7 +1249,7 @@ 10,32,32,32,32,32,32,32,32,41,3,218,5,115,117,112, 101,114,114,204,0,0,0,114,187,0,0,0,41,2,114,100, 0,0,0,114,119,0,0,0,41,1,114,205,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,187,0,0,0,29,3, + 4,0,0,0,114,5,0,0,0,114,187,0,0,0,25,3, 0,0,115,2,0,0,0,0,10,122,22,70,105,108,101,76, 111,97,100,101,114,46,108,111,97,100,95,109,111,100,117,108, 101,99,2,0,0,0,0,0,0,0,2,0,0,0,1,0, @@ -1260,7 +1260,7 @@ 32,98,121,32,116,104,101,32,102,105,110,100,101,114,46,41, 1,114,35,0,0,0,41,2,114,100,0,0,0,114,119,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,151,0,0,0,41,3,0,0,115,2,0,0,0,0, + 0,114,151,0,0,0,37,3,0,0,115,2,0,0,0,0, 3,122,23,70,105,108,101,76,111,97,100,101,114,46,103,101, 116,95,102,105,108,101,110,97,109,101,99,2,0,0,0,0, 0,0,0,3,0,0,0,9,0,0,0,67,0,0,0,115, @@ -1272,7 +1272,7 @@ 1,114,78,41,3,114,49,0,0,0,114,50,0,0,0,90, 4,114,101,97,100,41,3,114,100,0,0,0,114,35,0,0, 0,114,54,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,5,0,0,0,114,194,0,0,0,46,3,0,0,115,4, + 114,5,0,0,0,114,194,0,0,0,42,3,0,0,115,4, 0,0,0,0,2,14,1,122,19,70,105,108,101,76,111,97, 100,101,114,46,103,101,116,95,100,97,116,97,41,11,114,105, 0,0,0,114,104,0,0,0,114,106,0,0,0,114,107,0, @@ -1280,7 +1280,7 @@ 0,114,116,0,0,0,114,187,0,0,0,114,151,0,0,0, 114,194,0,0,0,114,4,0,0,0,114,4,0,0,0,41, 1,114,205,0,0,0,114,5,0,0,0,114,204,0,0,0, - 11,3,0,0,115,14,0,0,0,8,3,4,2,8,6,8, + 7,3,0,0,115,14,0,0,0,8,3,4,2,8,6,8, 4,8,3,16,12,12,5,114,204,0,0,0,99,0,0,0, 0,0,0,0,0,0,0,0,0,4,0,0,0,64,0,0, 0,115,46,0,0,0,101,0,90,1,100,0,90,2,100,1, @@ -1301,7 +1301,7 @@ 0,0,0,218,8,115,116,95,109,116,105,109,101,90,7,115, 116,95,115,105,122,101,41,3,114,100,0,0,0,114,35,0, 0,0,114,202,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,5,0,0,0,114,191,0,0,0,56,3,0,0,115, + 0,114,5,0,0,0,114,191,0,0,0,52,3,0,0,115, 4,0,0,0,0,2,8,1,122,27,83,111,117,114,99,101, 70,105,108,101,76,111,97,100,101,114,46,112,97,116,104,95, 115,116,97,116,115,99,4,0,0,0,0,0,0,0,5,0, @@ -1311,7 +1311,7 @@ 111,100,101,41,2,114,97,0,0,0,114,192,0,0,0,41, 5,114,100,0,0,0,114,90,0,0,0,114,89,0,0,0, 114,53,0,0,0,114,42,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,193,0,0,0,61,3, + 4,0,0,0,114,5,0,0,0,114,193,0,0,0,57,3, 0,0,115,4,0,0,0,0,2,8,1,122,32,83,111,117, 114,99,101,70,105,108,101,76,111,97,100,101,114,46,95,99, 97,99,104,101,95,98,121,116,101,99,111,100,101,114,214,0, @@ -1346,7 +1346,7 @@ 0,0,0,114,214,0,0,0,218,6,112,97,114,101,110,116, 114,94,0,0,0,114,27,0,0,0,114,23,0,0,0,114, 195,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,192,0,0,0,66,3,0,0,115,42,0,0, + 0,0,0,114,192,0,0,0,62,3,0,0,115,42,0,0, 0,0,2,12,1,4,2,16,1,12,1,14,2,14,1,10, 1,2,1,14,1,14,2,6,1,16,3,6,1,8,1,20, 1,2,1,12,1,16,1,16,2,8,1,122,25,83,111,117, @@ -1355,7 +1355,7 @@ 0,0,0,114,106,0,0,0,114,107,0,0,0,114,191,0, 0,0,114,193,0,0,0,114,192,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,212,0,0,0,52,3,0,0,115,8,0,0,0,8,2, + 114,212,0,0,0,48,3,0,0,115,8,0,0,0,8,2, 4,2,8,5,8,5,114,212,0,0,0,99,0,0,0,0, 0,0,0,0,0,0,0,0,2,0,0,0,64,0,0,0, 115,32,0,0,0,101,0,90,1,100,0,90,2,100,1,90, @@ -1375,7 +1375,7 @@ 0,114,141,0,0,0,41,5,114,100,0,0,0,114,119,0, 0,0,114,35,0,0,0,114,53,0,0,0,114,203,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,181,0,0,0,101,3,0,0,115,8,0,0,0,0,1, + 114,181,0,0,0,97,3,0,0,115,8,0,0,0,0,1, 10,1,10,1,18,1,122,29,83,111,117,114,99,101,108,101, 115,115,70,105,108,101,76,111,97,100,101,114,46,103,101,116, 95,99,111,100,101,99,2,0,0,0,0,0,0,0,2,0, @@ -1385,13 +1385,13 @@ 111,32,115,111,117,114,99,101,32,99,111,100,101,46,78,114, 4,0,0,0,41,2,114,100,0,0,0,114,119,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 196,0,0,0,107,3,0,0,115,2,0,0,0,0,2,122, + 196,0,0,0,103,3,0,0,115,2,0,0,0,0,2,122, 31,83,111,117,114,99,101,108,101,115,115,70,105,108,101,76, 111,97,100,101,114,46,103,101,116,95,115,111,117,114,99,101, 78,41,6,114,105,0,0,0,114,104,0,0,0,114,106,0, 0,0,114,107,0,0,0,114,181,0,0,0,114,196,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,5,0,0,0,114,217,0,0,0,97,3,0,0,115,6, + 114,5,0,0,0,114,217,0,0,0,93,3,0,0,115,6, 0,0,0,8,2,4,2,8,6,114,217,0,0,0,99,0, 0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,64, 0,0,0,115,92,0,0,0,101,0,90,1,100,0,90,2, @@ -1413,7 +1413,7 @@ 100,0,83,0,41,1,78,41,2,114,98,0,0,0,114,35, 0,0,0,41,3,114,100,0,0,0,114,98,0,0,0,114, 35,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,179,0,0,0,124,3,0,0,115,4,0,0, + 0,0,0,114,179,0,0,0,120,3,0,0,115,4,0,0, 0,0,1,6,1,122,28,69,120,116,101,110,115,105,111,110, 70,105,108,101,76,111,97,100,101,114,46,95,95,105,110,105, 116,95,95,99,2,0,0,0,0,0,0,0,2,0,0,0, @@ -1422,7 +1422,7 @@ 1,107,2,83,0,41,1,78,41,2,114,205,0,0,0,114, 111,0,0,0,41,2,114,100,0,0,0,114,206,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 207,0,0,0,128,3,0,0,115,4,0,0,0,0,1,12, + 207,0,0,0,124,3,0,0,115,4,0,0,0,0,1,12, 1,122,26,69,120,116,101,110,115,105,111,110,70,105,108,101, 76,111,97,100,101,114,46,95,95,101,113,95,95,99,1,0, 0,0,0,0,0,0,1,0,0,0,3,0,0,0,67,0, @@ -1430,7 +1430,7 @@ 0,124,0,106,2,131,1,65,0,83,0,41,1,78,41,3, 114,208,0,0,0,114,98,0,0,0,114,35,0,0,0,41, 1,114,100,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,5,0,0,0,114,209,0,0,0,132,3,0,0,115,2, + 114,5,0,0,0,114,209,0,0,0,128,3,0,0,115,2, 0,0,0,0,1,122,28,69,120,116,101,110,115,105,111,110, 70,105,108,101,76,111,97,100,101,114,46,95,95,104,97,115, 104,95,95,99,2,0,0,0,0,0,0,0,3,0,0,0, @@ -1447,7 +1447,7 @@ 97,109,105,99,114,129,0,0,0,114,98,0,0,0,114,35, 0,0,0,41,3,114,100,0,0,0,114,158,0,0,0,114, 184,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,180,0,0,0,135,3,0,0,115,10,0,0, + 0,0,0,114,180,0,0,0,131,3,0,0,115,10,0,0, 0,0,2,4,1,10,1,6,1,12,1,122,33,69,120,116, 101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,114, 46,99,114,101,97,116,101,95,109,111,100,117,108,101,99,2, @@ -1464,7 +1464,7 @@ 95,100,121,110,97,109,105,99,114,129,0,0,0,114,98,0, 0,0,114,35,0,0,0,41,2,114,100,0,0,0,114,184, 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,114,185,0,0,0,143,3,0,0,115,6,0,0,0, + 0,0,114,185,0,0,0,139,3,0,0,115,6,0,0,0, 0,2,14,1,6,1,122,31,69,120,116,101,110,115,105,111, 110,70,105,108,101,76,111,97,100,101,114,46,101,120,101,99, 95,109,111,100,117,108,101,99,2,0,0,0,0,0,0,0, @@ -1482,7 +1482,7 @@ 41,2,114,22,0,0,0,218,6,115,117,102,102,105,120,41, 1,218,9,102,105,108,101,95,110,97,109,101,114,4,0,0, 0,114,5,0,0,0,250,9,60,103,101,110,101,120,112,114, - 62,152,3,0,0,115,2,0,0,0,4,1,122,49,69,120, + 62,148,3,0,0,115,2,0,0,0,4,1,122,49,69,120, 116,101,110,115,105,111,110,70,105,108,101,76,111,97,100,101, 114,46,105,115,95,112,97,99,107,97,103,101,46,60,108,111, 99,97,108,115,62,46,60,103,101,110,101,120,112,114,62,41, @@ -1490,7 +1490,7 @@ 218,18,69,88,84,69,78,83,73,79,78,95,83,85,70,70, 73,88,69,83,41,2,114,100,0,0,0,114,119,0,0,0, 114,4,0,0,0,41,1,114,220,0,0,0,114,5,0,0, - 0,114,153,0,0,0,149,3,0,0,115,6,0,0,0,0, + 0,114,153,0,0,0,145,3,0,0,115,6,0,0,0,0, 2,14,1,12,1,122,30,69,120,116,101,110,115,105,111,110, 70,105,108,101,76,111,97,100,101,114,46,105,115,95,112,97, 99,107,97,103,101,99,2,0,0,0,0,0,0,0,2,0, @@ -1501,7 +1501,7 @@ 32,99,114,101,97,116,101,32,97,32,99,111,100,101,32,111, 98,106,101,99,116,46,78,114,4,0,0,0,41,2,114,100, 0,0,0,114,119,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,114,181,0,0,0,155,3,0,0, + 0,0,114,5,0,0,0,114,181,0,0,0,151,3,0,0, 115,2,0,0,0,0,2,122,28,69,120,116,101,110,115,105, 111,110,70,105,108,101,76,111,97,100,101,114,46,103,101,116, 95,99,111,100,101,99,2,0,0,0,0,0,0,0,2,0, @@ -1512,7 +1512,7 @@ 115,111,117,114,99,101,32,99,111,100,101,46,78,114,4,0, 0,0,41,2,114,100,0,0,0,114,119,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,196,0, - 0,0,159,3,0,0,115,2,0,0,0,0,2,122,30,69, + 0,0,155,3,0,0,115,2,0,0,0,0,2,122,30,69, 120,116,101,110,115,105,111,110,70,105,108,101,76,111,97,100, 101,114,46,103,101,116,95,115,111,117,114,99,101,99,2,0, 0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,0, @@ -1523,7 +1523,7 @@ 116,104,101,32,102,105,110,100,101,114,46,41,1,114,35,0, 0,0,41,2,114,100,0,0,0,114,119,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,151,0, - 0,0,163,3,0,0,115,2,0,0,0,0,3,122,32,69, + 0,0,159,3,0,0,115,2,0,0,0,0,3,122,32,69, 120,116,101,110,115,105,111,110,70,105,108,101,76,111,97,100, 101,114,46,103,101,116,95,102,105,108,101,110,97,109,101,78, 41,14,114,105,0,0,0,114,104,0,0,0,114,106,0,0, @@ -1532,7 +1532,7 @@ 153,0,0,0,114,181,0,0,0,114,196,0,0,0,114,116, 0,0,0,114,151,0,0,0,114,4,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,114,218,0,0, - 0,116,3,0,0,115,20,0,0,0,8,6,4,2,8,4, + 0,112,3,0,0,115,20,0,0,0,8,6,4,2,8,4, 8,4,8,3,8,8,8,6,8,6,8,4,8,4,114,218, 0,0,0,99,0,0,0,0,0,0,0,0,0,0,0,0, 2,0,0,0,64,0,0,0,115,96,0,0,0,101,0,90, @@ -1573,7 +1573,7 @@ 100,101,114,41,4,114,100,0,0,0,114,98,0,0,0,114, 35,0,0,0,218,11,112,97,116,104,95,102,105,110,100,101, 114,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,179,0,0,0,176,3,0,0,115,8,0,0,0,0,1, + 114,179,0,0,0,172,3,0,0,115,8,0,0,0,0,1, 6,1,6,1,14,1,122,23,95,78,97,109,101,115,112,97, 99,101,80,97,116,104,46,95,95,105,110,105,116,95,95,99, 1,0,0,0,0,0,0,0,4,0,0,0,3,0,0,0, @@ -1591,7 +1591,7 @@ 216,0,0,0,218,3,100,111,116,90,2,109,101,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,218,23,95,102, 105,110,100,95,112,97,114,101,110,116,95,112,97,116,104,95, - 110,97,109,101,115,182,3,0,0,115,8,0,0,0,0,2, + 110,97,109,101,115,178,3,0,0,115,8,0,0,0,0,2, 18,1,8,2,4,3,122,38,95,78,97,109,101,115,112,97, 99,101,80,97,116,104,46,95,102,105,110,100,95,112,97,114, 101,110,116,95,112,97,116,104,95,110,97,109,101,115,99,1, @@ -1604,7 +1604,7 @@ 95,109,111,100,117,108,101,95,110,97,109,101,90,14,112,97, 116,104,95,97,116,116,114,95,110,97,109,101,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,114,227,0,0,0, - 192,3,0,0,115,4,0,0,0,0,1,12,1,122,31,95, + 188,3,0,0,115,4,0,0,0,0,1,12,1,122,31,95, 78,97,109,101,115,112,97,99,101,80,97,116,104,46,95,103, 101,116,95,112,97,114,101,110,116,95,112,97,116,104,99,1, 0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,67, @@ -1619,7 +1619,7 @@ 114,226,0,0,0,41,3,114,100,0,0,0,90,11,112,97, 114,101,110,116,95,112,97,116,104,114,158,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,218,12,95, - 114,101,99,97,108,99,117,108,97,116,101,196,3,0,0,115, + 114,101,99,97,108,99,117,108,97,116,101,192,3,0,0,115, 16,0,0,0,0,2,12,1,10,1,14,3,18,1,6,1, 8,1,6,1,122,27,95,78,97,109,101,115,112,97,99,101, 80,97,116,104,46,95,114,101,99,97,108,99,117,108,97,116, @@ -1628,7 +1628,7 @@ 1,131,0,131,1,83,0,41,1,78,41,2,218,4,105,116, 101,114,114,234,0,0,0,41,1,114,100,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,218,8,95, - 95,105,116,101,114,95,95,209,3,0,0,115,2,0,0,0, + 95,105,116,101,114,95,95,205,3,0,0,115,2,0,0,0, 0,1,122,23,95,78,97,109,101,115,112,97,99,101,80,97, 116,104,46,95,95,105,116,101,114,95,95,99,3,0,0,0, 0,0,0,0,3,0,0,0,3,0,0,0,67,0,0,0, @@ -1636,7 +1636,7 @@ 0,83,0,41,1,78,41,1,114,226,0,0,0,41,3,114, 100,0,0,0,218,5,105,110,100,101,120,114,35,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218, - 11,95,95,115,101,116,105,116,101,109,95,95,212,3,0,0, + 11,95,95,115,101,116,105,116,101,109,95,95,208,3,0,0, 115,2,0,0,0,0,1,122,26,95,78,97,109,101,115,112, 97,99,101,80,97,116,104,46,95,95,115,101,116,105,116,101, 109,95,95,99,1,0,0,0,0,0,0,0,1,0,0,0, @@ -1644,7 +1644,7 @@ 0,106,1,131,0,131,1,83,0,41,1,78,41,2,114,31, 0,0,0,114,234,0,0,0,41,1,114,100,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,7, - 95,95,108,101,110,95,95,215,3,0,0,115,2,0,0,0, + 95,95,108,101,110,95,95,211,3,0,0,115,2,0,0,0, 0,1,122,22,95,78,97,109,101,115,112,97,99,101,80,97, 116,104,46,95,95,108,101,110,95,95,99,1,0,0,0,0, 0,0,0,1,0,0,0,2,0,0,0,67,0,0,0,115, @@ -1653,7 +1653,7 @@ 97,116,104,40,123,33,114,125,41,41,2,114,47,0,0,0, 114,226,0,0,0,41,1,114,100,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,218,8,95,95,114, - 101,112,114,95,95,218,3,0,0,115,2,0,0,0,0,1, + 101,112,114,95,95,214,3,0,0,115,2,0,0,0,0,1, 122,23,95,78,97,109,101,115,112,97,99,101,80,97,116,104, 46,95,95,114,101,112,114,95,95,99,2,0,0,0,0,0, 0,0,2,0,0,0,2,0,0,0,67,0,0,0,115,12, @@ -1661,7 +1661,7 @@ 1,78,41,1,114,234,0,0,0,41,2,114,100,0,0,0, 218,4,105,116,101,109,114,4,0,0,0,114,4,0,0,0, 114,5,0,0,0,218,12,95,95,99,111,110,116,97,105,110, - 115,95,95,221,3,0,0,115,2,0,0,0,0,1,122,27, + 115,95,95,217,3,0,0,115,2,0,0,0,0,1,122,27, 95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95, 95,99,111,110,116,97,105,110,115,95,95,99,2,0,0,0, 0,0,0,0,2,0,0,0,2,0,0,0,67,0,0,0, @@ -1669,7 +1669,7 @@ 0,100,0,83,0,41,1,78,41,2,114,226,0,0,0,114, 157,0,0,0,41,2,114,100,0,0,0,114,241,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 157,0,0,0,224,3,0,0,115,2,0,0,0,0,1,122, + 157,0,0,0,220,3,0,0,115,2,0,0,0,0,1,122, 21,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46, 97,112,112,101,110,100,78,41,14,114,105,0,0,0,114,104, 0,0,0,114,106,0,0,0,114,107,0,0,0,114,179,0, @@ -1677,7 +1677,7 @@ 0,114,236,0,0,0,114,238,0,0,0,114,239,0,0,0, 114,240,0,0,0,114,242,0,0,0,114,157,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,224,0,0,0,169,3,0,0,115,22,0,0, + 0,0,0,114,224,0,0,0,165,3,0,0,115,22,0,0, 0,8,5,4,2,8,6,8,10,8,4,8,13,8,3,8, 3,8,3,8,3,8,3,114,224,0,0,0,99,0,0,0, 0,0,0,0,0,0,0,0,0,3,0,0,0,64,0,0, @@ -1693,7 +1693,7 @@ 95,1,100,0,83,0,41,1,78,41,2,114,224,0,0,0, 114,226,0,0,0,41,4,114,100,0,0,0,114,98,0,0, 0,114,35,0,0,0,114,230,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,179,0,0,0,230, + 114,4,0,0,0,114,5,0,0,0,114,179,0,0,0,226, 3,0,0,115,2,0,0,0,0,1,122,25,95,78,97,109, 101,115,112,97,99,101,76,111,97,100,101,114,46,95,95,105, 110,105,116,95,95,99,2,0,0,0,0,0,0,0,2,0, @@ -1711,21 +1711,21 @@ 47,0,0,0,114,105,0,0,0,41,2,114,164,0,0,0, 114,184,0,0,0,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,11,109,111,100,117,108,101,95,114,101,112, - 114,233,3,0,0,115,2,0,0,0,0,7,122,28,95,78, + 114,229,3,0,0,115,2,0,0,0,0,7,122,28,95,78, 97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,109, 111,100,117,108,101,95,114,101,112,114,99,2,0,0,0,0, 0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,115, 4,0,0,0,100,1,83,0,41,2,78,84,114,4,0,0, 0,41,2,114,100,0,0,0,114,119,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,114,153,0,0, - 0,242,3,0,0,115,2,0,0,0,0,1,122,27,95,78, + 0,238,3,0,0,115,2,0,0,0,0,1,122,27,95,78, 97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,105, 115,95,112,97,99,107,97,103,101,99,2,0,0,0,0,0, 0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,4, 0,0,0,100,1,83,0,41,2,78,114,30,0,0,0,114, 4,0,0,0,41,2,114,100,0,0,0,114,119,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 196,0,0,0,245,3,0,0,115,2,0,0,0,0,1,122, + 196,0,0,0,241,3,0,0,115,2,0,0,0,0,1,122, 27,95,78,97,109,101,115,112,97,99,101,76,111,97,100,101, 114,46,103,101,116,95,115,111,117,114,99,101,99,2,0,0, 0,0,0,0,0,2,0,0,0,6,0,0,0,67,0,0, @@ -1734,7 +1734,7 @@ 122,8,60,115,116,114,105,110,103,62,114,183,0,0,0,114, 198,0,0,0,84,41,1,114,199,0,0,0,41,2,114,100, 0,0,0,114,119,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,114,181,0,0,0,248,3,0,0, + 0,0,114,5,0,0,0,114,181,0,0,0,244,3,0,0, 115,2,0,0,0,0,1,122,25,95,78,97,109,101,115,112, 97,99,101,76,111,97,100,101,114,46,103,101,116,95,99,111, 100,101,99,2,0,0,0,0,0,0,0,2,0,0,0,1, @@ -1744,14 +1744,14 @@ 100,117,108,101,32,99,114,101,97,116,105,111,110,46,78,114, 4,0,0,0,41,2,114,100,0,0,0,114,158,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 180,0,0,0,251,3,0,0,115,0,0,0,0,122,30,95, + 180,0,0,0,247,3,0,0,115,0,0,0,0,122,30,95, 78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,46, 99,114,101,97,116,101,95,109,111,100,117,108,101,99,2,0, 0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,0, 0,0,115,4,0,0,0,100,0,83,0,41,1,78,114,4, 0,0,0,41,2,114,100,0,0,0,114,184,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,185, - 0,0,0,254,3,0,0,115,2,0,0,0,0,1,122,28, + 0,0,0,250,3,0,0,115,2,0,0,0,0,1,122,28, 95,78,97,109,101,115,112,97,99,101,76,111,97,100,101,114, 46,101,120,101,99,95,109,111,100,117,108,101,99,2,0,0, 0,0,0,0,0,2,0,0,0,3,0,0,0,67,0,0, @@ -1769,7 +1769,7 @@ 114,114,0,0,0,114,129,0,0,0,114,226,0,0,0,114, 186,0,0,0,41,2,114,100,0,0,0,114,119,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 187,0,0,0,1,4,0,0,115,6,0,0,0,0,7,6, + 187,0,0,0,253,3,0,0,115,6,0,0,0,0,7,6, 1,8,1,122,28,95,78,97,109,101,115,112,97,99,101,76, 111,97,100,101,114,46,108,111,97,100,95,109,111,100,117,108, 101,78,41,12,114,105,0,0,0,114,104,0,0,0,114,106, @@ -1777,7 +1777,7 @@ 0,0,114,153,0,0,0,114,196,0,0,0,114,181,0,0, 0,114,180,0,0,0,114,185,0,0,0,114,187,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,243,0,0,0,229,3,0,0,115,16,0, + 5,0,0,0,114,243,0,0,0,225,3,0,0,115,16,0, 0,0,8,1,8,3,12,9,8,3,8,3,8,3,8,3, 8,3,114,243,0,0,0,99,0,0,0,0,0,0,0,0, 0,0,0,0,5,0,0,0,64,0,0,0,115,108,0,0, @@ -1811,7 +1811,7 @@ 218,6,118,97,108,117,101,115,114,108,0,0,0,114,246,0, 0,0,41,2,114,164,0,0,0,218,6,102,105,110,100,101, 114,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,246,0,0,0,19,4,0,0,115,6,0,0,0,0,4, + 114,246,0,0,0,15,4,0,0,115,6,0,0,0,0,4, 16,1,10,1,122,28,80,97,116,104,70,105,110,100,101,114, 46,105,110,118,97,108,105,100,97,116,101,95,99,97,99,104, 101,115,99,2,0,0,0,0,0,0,0,3,0,0,0,12, @@ -1835,7 +1835,7 @@ 0,0,0,114,99,0,0,0,41,3,114,164,0,0,0,114, 35,0,0,0,90,4,104,111,111,107,114,4,0,0,0,114, 4,0,0,0,114,5,0,0,0,218,11,95,112,97,116,104, - 95,104,111,111,107,115,27,4,0,0,115,16,0,0,0,0, + 95,104,111,111,107,115,23,4,0,0,115,16,0,0,0,0, 7,18,1,12,1,12,1,2,1,8,1,14,1,12,2,122, 22,80,97,116,104,70,105,110,100,101,114,46,95,112,97,116, 104,95,104,111,111,107,115,99,2,0,0,0,0,0,0,0, @@ -1866,7 +1866,7 @@ 0,114,251,0,0,0,41,3,114,164,0,0,0,114,35,0, 0,0,114,249,0,0,0,114,4,0,0,0,114,4,0,0, 0,114,5,0,0,0,218,20,95,112,97,116,104,95,105,109, - 112,111,114,116,101,114,95,99,97,99,104,101,44,4,0,0, + 112,111,114,116,101,114,95,99,97,99,104,101,40,4,0,0, 115,22,0,0,0,0,8,8,1,2,1,12,1,14,3,6, 1,2,1,14,1,14,1,10,1,16,1,122,31,80,97,116, 104,70,105,110,100,101,114,46,95,112,97,116,104,95,105,109, @@ -1884,7 +1884,7 @@ 0,114,249,0,0,0,114,120,0,0,0,114,121,0,0,0, 114,158,0,0,0,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,16,95,108,101,103,97,99,121,95,103,101, - 116,95,115,112,101,99,66,4,0,0,115,18,0,0,0,0, + 116,95,115,112,101,99,62,4,0,0,115,18,0,0,0,0, 4,10,1,16,2,10,1,4,1,8,1,12,1,12,1,6, 1,122,27,80,97,116,104,70,105,110,100,101,114,46,95,108, 101,103,97,99,121,95,103,101,116,95,115,112,101,99,78,99, @@ -1915,7 +1915,7 @@ 109,101,115,112,97,99,101,95,112,97,116,104,90,5,101,110, 116,114,121,114,249,0,0,0,114,158,0,0,0,114,121,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,218,9,95,103,101,116,95,115,112,101,99,81,4,0,0, + 0,218,9,95,103,101,116,95,115,112,101,99,77,4,0,0, 115,40,0,0,0,0,5,4,1,10,1,14,1,2,1,10, 1,8,1,10,1,14,2,12,1,8,1,2,1,10,1,4, 1,6,1,8,1,8,5,14,2,12,1,6,1,122,20,80, @@ -1941,7 +1941,7 @@ 0,0,0,114,119,0,0,0,114,35,0,0,0,114,174,0, 0,0,114,158,0,0,0,114,0,1,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,114,175,0,0,0, - 113,4,0,0,115,26,0,0,0,0,4,8,1,6,1,14, + 109,4,0,0,115,26,0,0,0,0,4,8,1,6,1,14, 1,8,1,6,1,10,1,6,1,4,3,6,1,16,1,6, 2,6,2,122,20,80,97,116,104,70,105,110,100,101,114,46, 102,105,110,100,95,115,112,101,99,99,3,0,0,0,0,0, @@ -1962,7 +1962,7 @@ 41,2,114,175,0,0,0,114,120,0,0,0,41,4,114,164, 0,0,0,114,119,0,0,0,114,35,0,0,0,114,158,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,176,0,0,0,135,4,0,0,115,8,0,0,0,0, + 0,114,176,0,0,0,131,4,0,0,115,8,0,0,0,0, 8,12,1,8,1,4,1,122,22,80,97,116,104,70,105,110, 100,101,114,46,102,105,110,100,95,109,111,100,117,108,101,41, 12,114,105,0,0,0,114,104,0,0,0,114,106,0,0,0, @@ -1970,7 +1970,7 @@ 251,0,0,0,114,253,0,0,0,114,254,0,0,0,114,1, 1,0,0,114,175,0,0,0,114,176,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,245,0,0,0,15,4,0,0,115,22,0,0,0,8, + 0,114,245,0,0,0,11,4,0,0,115,22,0,0,0,8, 2,4,2,12,8,12,17,12,22,12,15,2,1,12,31,2, 1,14,21,2,1,114,245,0,0,0,99,0,0,0,0,0, 0,0,0,0,0,0,0,3,0,0,0,64,0,0,0,115, @@ -2014,7 +2014,7 @@ 86,0,1,0,113,2,100,0,83,0,41,1,78,114,4,0, 0,0,41,2,114,22,0,0,0,114,219,0,0,0,41,1, 114,120,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 221,0,0,0,164,4,0,0,115,2,0,0,0,4,0,122, + 221,0,0,0,160,4,0,0,115,2,0,0,0,4,0,122, 38,70,105,108,101,70,105,110,100,101,114,46,95,95,105,110, 105,116,95,95,46,60,108,111,99,97,108,115,62,46,60,103, 101,110,101,120,112,114,62,114,58,0,0,0,114,29,0,0, @@ -2027,7 +2027,7 @@ 111,97,100,101,114,95,100,101,116,97,105,108,115,90,7,108, 111,97,100,101,114,115,114,160,0,0,0,114,4,0,0,0, 41,1,114,120,0,0,0,114,5,0,0,0,114,179,0,0, - 0,158,4,0,0,115,16,0,0,0,0,4,4,1,14,1, + 0,154,4,0,0,115,16,0,0,0,0,4,4,1,14,1, 28,1,6,2,10,1,6,1,8,1,122,19,70,105,108,101, 70,105,110,100,101,114,46,95,95,105,110,105,116,95,95,99, 1,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0, @@ -2037,7 +2037,7 @@ 109,116,105,109,101,46,114,29,0,0,0,78,114,87,0,0, 0,41,1,114,4,1,0,0,41,1,114,100,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,246, - 0,0,0,172,4,0,0,115,2,0,0,0,0,2,122,28, + 0,0,0,168,4,0,0,115,2,0,0,0,0,2,122,28, 70,105,108,101,70,105,110,100,101,114,46,105,110,118,97,108, 105,100,97,116,101,95,99,97,99,104,101,115,99,2,0,0, 0,0,0,0,0,3,0,0,0,2,0,0,0,67,0,0, @@ -2060,7 +2060,7 @@ 0,114,120,0,0,0,114,150,0,0,0,41,3,114,100,0, 0,0,114,119,0,0,0,114,158,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,114,117,0,0,0, - 178,4,0,0,115,8,0,0,0,0,7,10,1,8,1,8, + 174,4,0,0,115,8,0,0,0,0,7,10,1,8,1,8, 1,122,22,70,105,108,101,70,105,110,100,101,114,46,102,105, 110,100,95,108,111,97,100,101,114,99,6,0,0,0,0,0, 0,0,7,0,0,0,7,0,0,0,67,0,0,0,115,30, @@ -2070,7 +2070,7 @@ 114,161,0,0,0,41,7,114,100,0,0,0,114,159,0,0, 0,114,119,0,0,0,114,35,0,0,0,90,4,115,109,115, 108,114,174,0,0,0,114,120,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,1,1,0,0,190, + 114,4,0,0,0,114,5,0,0,0,114,1,1,0,0,186, 4,0,0,115,6,0,0,0,0,1,10,1,12,1,122,20, 70,105,108,101,70,105,110,100,101,114,46,95,103,101,116,95, 115,112,101,99,78,99,3,0,0,0,0,0,0,0,14,0, @@ -2124,7 +2124,7 @@ 116,104,114,219,0,0,0,114,159,0,0,0,90,13,105,110, 105,116,95,102,105,108,101,110,97,109,101,90,9,102,117,108, 108,95,112,97,116,104,114,158,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,175,0,0,0,195, + 114,4,0,0,0,114,5,0,0,0,114,175,0,0,0,191, 4,0,0,115,70,0,0,0,0,3,4,1,14,1,2,1, 24,1,14,1,10,1,10,1,8,1,6,2,6,1,6,1, 10,2,6,1,4,2,8,1,12,1,16,1,8,1,10,1, @@ -2156,7 +2156,7 @@ 0,146,2,113,4,83,0,114,4,0,0,0,41,1,114,88, 0,0,0,41,2,114,22,0,0,0,90,2,102,110,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,250,9,60, - 115,101,116,99,111,109,112,62,14,5,0,0,115,2,0,0, + 115,101,116,99,111,109,112,62,10,5,0,0,115,2,0,0, 0,6,0,122,41,70,105,108,101,70,105,110,100,101,114,46, 95,102,105,108,108,95,99,97,99,104,101,46,60,108,111,99, 97,108,115,62,46,60,115,101,116,99,111,109,112,62,78,41, @@ -2173,7 +2173,7 @@ 111,110,116,101,110,116,115,114,241,0,0,0,114,98,0,0, 0,114,231,0,0,0,114,219,0,0,0,90,8,110,101,119, 95,110,97,109,101,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,9,1,0,0,241,4,0,0,115,34,0, + 5,0,0,0,114,9,1,0,0,237,4,0,0,115,34,0, 0,0,0,2,6,1,2,1,22,1,20,3,10,3,12,1, 12,7,6,1,10,1,16,1,4,1,18,2,4,1,14,1, 6,1,12,1,122,22,70,105,108,101,70,105,110,100,101,114, @@ -2211,7 +2211,7 @@ 1,114,35,0,0,0,41,2,114,164,0,0,0,114,8,1, 0,0,114,4,0,0,0,114,5,0,0,0,218,24,112,97, 116,104,95,104,111,111,107,95,102,111,114,95,70,105,108,101, - 70,105,110,100,101,114,26,5,0,0,115,6,0,0,0,0, + 70,105,110,100,101,114,22,5,0,0,115,6,0,0,0,0, 2,8,1,14,1,122,54,70,105,108,101,70,105,110,100,101, 114,46,112,97,116,104,95,104,111,111,107,46,60,108,111,99, 97,108,115,62,46,112,97,116,104,95,104,111,111,107,95,102, @@ -2219,7 +2219,7 @@ 0,0,41,3,114,164,0,0,0,114,8,1,0,0,114,14, 1,0,0,114,4,0,0,0,41,2,114,164,0,0,0,114, 8,1,0,0,114,5,0,0,0,218,9,112,97,116,104,95, - 104,111,111,107,16,5,0,0,115,4,0,0,0,0,10,14, + 104,111,111,107,12,5,0,0,115,4,0,0,0,0,10,14, 6,122,20,70,105,108,101,70,105,110,100,101,114,46,112,97, 116,104,95,104,111,111,107,99,1,0,0,0,0,0,0,0, 1,0,0,0,2,0,0,0,67,0,0,0,115,12,0,0, @@ -2227,7 +2227,7 @@ 122,16,70,105,108,101,70,105,110,100,101,114,40,123,33,114, 125,41,41,2,114,47,0,0,0,114,35,0,0,0,41,1, 114,100,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,240,0,0,0,34,5,0,0,115,2,0, + 5,0,0,0,114,240,0,0,0,30,5,0,0,115,2,0, 0,0,0,1,122,19,70,105,108,101,70,105,110,100,101,114, 46,95,95,114,101,112,114,95,95,41,15,114,105,0,0,0, 114,104,0,0,0,114,106,0,0,0,114,107,0,0,0,114, @@ -2235,7 +2235,7 @@ 0,0,0,114,117,0,0,0,114,1,1,0,0,114,175,0, 0,0,114,9,1,0,0,114,177,0,0,0,114,15,1,0, 0,114,240,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,2,1,0,0,149, + 114,4,0,0,0,114,5,0,0,0,114,2,1,0,0,145, 4,0,0,115,20,0,0,0,8,7,4,2,8,14,8,4, 4,2,8,12,8,5,10,46,8,31,12,18,114,2,1,0, 0,99,4,0,0,0,0,0,0,0,6,0,0,0,11,0, @@ -2259,7 +2259,7 @@ 99,112,97,116,104,110,97,109,101,114,120,0,0,0,114,158, 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, 0,0,218,14,95,102,105,120,95,117,112,95,109,111,100,117, - 108,101,40,5,0,0,115,34,0,0,0,0,2,10,1,10, + 108,101,36,5,0,0,115,34,0,0,0,0,2,10,1,10, 1,4,1,4,1,8,1,8,1,12,2,10,1,4,1,16, 1,2,1,8,1,8,1,8,1,12,1,14,2,114,20,1, 0,0,99,0,0,0,0,0,0,0,0,3,0,0,0,3, @@ -2278,7 +2278,7 @@ 217,0,0,0,114,74,0,0,0,41,3,90,10,101,120,116, 101,110,115,105,111,110,115,90,6,115,111,117,114,99,101,90, 8,98,121,116,101,99,111,100,101,114,4,0,0,0,114,4, - 0,0,0,114,5,0,0,0,114,155,0,0,0,63,5,0, + 0,0,0,114,5,0,0,0,114,155,0,0,0,59,5,0, 0,115,8,0,0,0,0,5,12,1,8,1,8,1,114,155, 0,0,0,99,1,0,0,0,0,0,0,0,12,0,0,0, 12,0,0,0,67,0,0,0,115,188,1,0,0,124,0,97, @@ -2331,7 +2331,7 @@ 1,0,113,2,100,1,83,0,41,2,114,29,0,0,0,78, 41,1,114,31,0,0,0,41,2,114,22,0,0,0,114,77, 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,114,221,0,0,0,99,5,0,0,115,2,0,0,0, + 0,0,114,221,0,0,0,95,5,0,0,115,2,0,0,0, 4,0,122,25,95,115,101,116,117,112,46,60,108,111,99,97, 108,115,62,46,60,103,101,110,101,120,112,114,62,114,59,0, 0,0,122,30,105,109,112,111,114,116,108,105,98,32,114,101, @@ -2361,7 +2361,7 @@ 95,109,111,100,117,108,101,90,14,119,101,97,107,114,101,102, 95,109,111,100,117,108,101,90,13,119,105,110,114,101,103,95, 109,111,100,117,108,101,114,4,0,0,0,114,4,0,0,0, - 114,5,0,0,0,218,6,95,115,101,116,117,112,74,5,0, + 114,5,0,0,0,218,6,95,115,101,116,117,112,70,5,0, 0,115,82,0,0,0,0,8,4,1,6,1,6,3,10,1, 10,1,10,1,12,2,10,1,16,3,22,1,14,2,22,1, 8,1,10,1,10,1,4,2,2,1,10,1,6,1,14,1, @@ -2385,7 +2385,7 @@ 0,0,114,245,0,0,0,114,212,0,0,0,41,2,114,28, 1,0,0,90,17,115,117,112,112,111,114,116,101,100,95,108, 111,97,100,101,114,115,114,4,0,0,0,114,4,0,0,0, - 114,5,0,0,0,218,8,95,105,110,115,116,97,108,108,142, + 114,5,0,0,0,218,8,95,105,110,115,116,97,108,108,138, 5,0,0,115,16,0,0,0,0,2,8,1,6,1,20,1, 10,1,12,1,12,4,6,1,114,31,1,0,0,41,3,122, 3,119,105,110,114,1,0,0,0,114,2,0,0,0,41,56, @@ -2414,7 +2414,7 @@ 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218, 8,60,109,111,100,117,108,101,62,8,0,0,0,115,102,0, 0,0,4,17,4,3,8,12,8,5,8,5,8,6,8,12, - 8,10,8,9,8,5,8,7,10,22,10,118,16,1,12,2, + 8,10,8,9,8,5,8,7,10,22,10,114,16,1,12,2, 4,1,4,2,6,2,6,2,8,2,16,44,8,33,8,19, 8,12,8,12,8,28,8,17,14,55,14,12,12,10,8,14, 6,3,8,1,12,65,14,64,14,29,16,110,14,41,18,45, -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 10:37:38 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 12 Jun 2016 14:37:38 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327095=3A_Simplifi?= =?utf-8?q?ed_MAKE=5FFUNCTION_and_removed_MAKE=5FCLOSURE_opcodes=2E?= Message-ID: <20160612143715.81388.5058.50653C89@psf.io> https://hg.python.org/cpython/rev/8a0fe3481c91 changeset: 101953:8a0fe3481c91 user: Serhiy Storchaka date: Sun Jun 12 17:36:24 2016 +0300 summary: Issue #27095: Simplified MAKE_FUNCTION and removed MAKE_CLOSURE opcodes. Patch by Demur Rumed. files: Doc/library/dis.rst | 21 +- Include/opcode.h | 1 - Lib/importlib/_bootstrap_external.py | 8 +- Lib/lib2to3/tests/data/py3_test_grammar.py | 2 +- Lib/opcode.py | 3 +- Lib/test/test_dis.py | 80 +- Lib/test/test_grammar.py | 2 +- Misc/NEWS | 3 + Python/ceval.c | 124 +- Python/compile.c | 255 +- Python/importlib.h | 3308 +++--- Python/importlib_external.h | 4449 +++++---- Python/opcode_targets.h | 2 +- 13 files changed, 4099 insertions(+), 4159 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -937,27 +937,16 @@ .. opcode:: MAKE_FUNCTION (argc) Pushes a new function object on the stack. From bottom to top, the consumed - stack must consist of + stack must consist of values if the argument carries a specified flag value - * ``argc & 0xFF`` default argument objects in positional order - * ``(argc >> 8) & 0xFF`` pairs of name and default argument, with the name - just below the object on the stack, for keyword-only parameters - * ``(argc >> 16) & 0x7FFF`` parameter annotation objects - * a tuple listing the parameter names for the annotations (only if there are - ony annotation objects) + * ``0x01`` a tuple of default argument objects in positional order + * ``0x02`` a dictionary of keyword-only parameters' default values + * ``0x04`` an annotation dictionary + * ``0x08`` a tuple containing cells for free variables, making a closure * the code associated with the function (at TOS1) * the :term:`qualified name` of the function (at TOS) -.. opcode:: MAKE_CLOSURE (argc) - - Creates a new function object, sets its *__closure__* slot, and pushes it on - the stack. TOS is the :term:`qualified name` of the function, TOS1 is the - code associated with the function, and TOS2 is the tuple containing cells for - the closure's free variables. *argc* is interpreted as in ``MAKE_FUNCTION``; - the annotations and defaults are also in the same order below TOS2. - - .. opcode:: BUILD_SLICE (argc) .. index:: builtin: slice diff --git a/Include/opcode.h b/Include/opcode.h --- a/Include/opcode.h +++ b/Include/opcode.h @@ -102,7 +102,6 @@ #define CALL_FUNCTION 131 #define MAKE_FUNCTION 132 #define BUILD_SLICE 133 -#define MAKE_CLOSURE 134 #define LOAD_CLOSURE 135 #define LOAD_DEREF 136 #define STORE_DEREF 137 diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -222,8 +222,10 @@ # Python 3.5.2 3351 (fix BUILD_MAP_UNPACK_WITH_CALL opcode #27286) # Python 3.6a0 3360 (add FORMAT_VALUE opcode #25483 # Python 3.6a0 3361 (lineno delta of code.co_lnotab becomes signed) -# Python 3.6a0 3370 (16 bit wordcode) -# Python 3.6a0 3371 (add BUILD_CONST_KEY_MAP opcode #27140) +# Python 3.6a1 3370 (16 bit wordcode) +# Python 3.6a1 3371 (add BUILD_CONST_KEY_MAP opcode #27140) +# Python 3.6a1 3372 (MAKE_FUNCTION simplification, remove MAKE_CLOSURE + #27095) # # MAGIC must change whenever the bytecode emitted by the compiler may no # longer be understood by older implementations of the eval loop (usually @@ -232,7 +234,7 @@ # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3371).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3372).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/lib2to3/tests/data/py3_test_grammar.py b/Lib/lib2to3/tests/data/py3_test_grammar.py --- a/Lib/lib2to3/tests/data/py3_test_grammar.py +++ b/Lib/lib2to3/tests/data/py3_test_grammar.py @@ -319,7 +319,7 @@ def f(x) -> list: pass self.assertEquals(f.__annotations__, {'return': list}) - # test MAKE_CLOSURE with a variety of oparg's + # test closures with a variety of oparg's closure = 1 def f(): return closure def f(x=1): return closure diff --git a/Lib/opcode.py b/Lib/opcode.py --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -173,9 +173,8 @@ def_op('RAISE_VARARGS', 130) # Number of raise arguments (1, 2, or 3) def_op('CALL_FUNCTION', 131) # #args + (#kwargs << 8) hasnargs.append(131) -def_op('MAKE_FUNCTION', 132) # Number of args with default values +def_op('MAKE_FUNCTION', 132) # Flags def_op('BUILD_SLICE', 133) # Number of items -def_op('MAKE_CLOSURE', 134) def_op('LOAD_CLOSURE', 135) hasfree.append(135) def_op('LOAD_DEREF', 136) diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py --- a/Lib/test/test_dis.py +++ b/Lib/test/test_dis.py @@ -649,50 +649,48 @@ Instruction = dis.Instruction expected_opinfo_outer = [ - Instruction(opname='LOAD_CONST', opcode=100, arg=1, argval=3, argrepr='3', offset=0, starts_line=2, is_jump_target=False), - Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=4, argrepr='4', offset=2, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_CLOSURE', opcode=135, arg=0, argval='a', argrepr='a', offset=4, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_CLOSURE', opcode=135, arg=1, argval='b', argrepr='b', offset=6, starts_line=None, is_jump_target=False), - Instruction(opname='BUILD_TUPLE', opcode=102, arg=2, argval=2, argrepr='', offset=8, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=code_object_f, argrepr=repr(code_object_f), offset=10, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='outer..f', argrepr="'outer..f'", offset=12, starts_line=None, is_jump_target=False), - Instruction(opname='MAKE_CLOSURE', opcode=134, arg=2, argval=2, argrepr='', offset=14, starts_line=None, is_jump_target=False), - Instruction(opname='STORE_FAST', opcode=125, arg=2, argval='f', argrepr='f', offset=16, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=0, argval='print', argrepr='print', offset=18, starts_line=7, is_jump_target=False), - Instruction(opname='LOAD_DEREF', opcode=136, arg=0, argval='a', argrepr='a', offset=20, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_DEREF', opcode=136, arg=1, argval='b', argrepr='b', offset=22, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval='', argrepr="''", offset=24, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval=1, argrepr='1', offset=26, starts_line=None, is_jump_target=False), - Instruction(opname='BUILD_LIST', opcode=103, arg=0, argval=0, argrepr='', offset=28, starts_line=None, is_jump_target=False), - Instruction(opname='BUILD_MAP', opcode=105, arg=0, argval=0, argrepr='', offset=30, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval='Hello world!', argrepr="'Hello world!'", offset=32, starts_line=None, is_jump_target=False), - Instruction(opname='CALL_FUNCTION', opcode=131, arg=7, argval=7, argrepr='7 positional, 0 keyword pair', offset=34, starts_line=None, is_jump_target=False), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=36, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_FAST', opcode=124, arg=2, argval='f', argrepr='f', offset=38, starts_line=8, is_jump_target=False), - Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=40, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_CONST', opcode=100, arg=8, argval=(3, 4), argrepr='(3, 4)', offset=0, starts_line=2, is_jump_target=False), + Instruction(opname='LOAD_CLOSURE', opcode=135, arg=0, argval='a', argrepr='a', offset=2, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_CLOSURE', opcode=135, arg=1, argval='b', argrepr='b', offset=4, starts_line=None, is_jump_target=False), + Instruction(opname='BUILD_TUPLE', opcode=102, arg=2, argval=2, argrepr='', offset=6, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=code_object_f, argrepr=repr(code_object_f), offset=8, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='outer..f', argrepr="'outer..f'", offset=10, starts_line=None, is_jump_target=False), + Instruction(opname='MAKE_FUNCTION', opcode=132, arg=9, argval=9, argrepr='', offset=12, starts_line=None, is_jump_target=False), + Instruction(opname='STORE_FAST', opcode=125, arg=2, argval='f', argrepr='f', offset=14, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=0, argval='print', argrepr='print', offset=16, starts_line=7, is_jump_target=False), + Instruction(opname='LOAD_DEREF', opcode=136, arg=0, argval='a', argrepr='a', offset=18, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_DEREF', opcode=136, arg=1, argval='b', argrepr='b', offset=20, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval='', argrepr="''", offset=22, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval=1, argrepr='1', offset=24, starts_line=None, is_jump_target=False), + Instruction(opname='BUILD_LIST', opcode=103, arg=0, argval=0, argrepr='', offset=26, starts_line=None, is_jump_target=False), + Instruction(opname='BUILD_MAP', opcode=105, arg=0, argval=0, argrepr='', offset=28, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval='Hello world!', argrepr="'Hello world!'", offset=30, starts_line=None, is_jump_target=False), + Instruction(opname='CALL_FUNCTION', opcode=131, arg=7, argval=7, argrepr='7 positional, 0 keyword pair', offset=32, starts_line=None, is_jump_target=False), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=34, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_FAST', opcode=124, arg=2, argval='f', argrepr='f', offset=36, starts_line=8, is_jump_target=False), + Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=38, starts_line=None, is_jump_target=False), ] expected_opinfo_f = [ - Instruction(opname='LOAD_CONST', opcode=100, arg=1, argval=5, argrepr='5', offset=0, starts_line=3, is_jump_target=False), - Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval=6, argrepr='6', offset=2, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_CLOSURE', opcode=135, arg=2, argval='a', argrepr='a', offset=4, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_CLOSURE', opcode=135, arg=3, argval='b', argrepr='b', offset=6, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_CLOSURE', opcode=135, arg=0, argval='c', argrepr='c', offset=8, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_CLOSURE', opcode=135, arg=1, argval='d', argrepr='d', offset=10, starts_line=None, is_jump_target=False), - Instruction(opname='BUILD_TUPLE', opcode=102, arg=4, argval=4, argrepr='', offset=12, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=code_object_inner, argrepr=repr(code_object_inner), offset=14, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='outer..f..inner', argrepr="'outer..f..inner'", offset=16, starts_line=None, is_jump_target=False), - Instruction(opname='MAKE_CLOSURE', opcode=134, arg=2, argval=2, argrepr='', offset=18, starts_line=None, is_jump_target=False), - Instruction(opname='STORE_FAST', opcode=125, arg=2, argval='inner', argrepr='inner', offset=20, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_GLOBAL', opcode=116, arg=0, argval='print', argrepr='print', offset=22, starts_line=5, is_jump_target=False), - Instruction(opname='LOAD_DEREF', opcode=136, arg=2, argval='a', argrepr='a', offset=24, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_DEREF', opcode=136, arg=3, argval='b', argrepr='b', offset=26, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_DEREF', opcode=136, arg=0, argval='c', argrepr='c', offset=28, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_DEREF', opcode=136, arg=1, argval='d', argrepr='d', offset=30, starts_line=None, is_jump_target=False), - Instruction(opname='CALL_FUNCTION', opcode=131, arg=4, argval=4, argrepr='4 positional, 0 keyword pair', offset=32, starts_line=None, is_jump_target=False), - Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=34, starts_line=None, is_jump_target=False), - Instruction(opname='LOAD_FAST', opcode=124, arg=2, argval='inner', argrepr='inner', offset=36, starts_line=6, is_jump_target=False), - Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=38, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=(5, 6), argrepr='(5, 6)', offset=0, starts_line=3, is_jump_target=False), + Instruction(opname='LOAD_CLOSURE', opcode=135, arg=2, argval='a', argrepr='a', offset=2, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_CLOSURE', opcode=135, arg=3, argval='b', argrepr='b', offset=4, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_CLOSURE', opcode=135, arg=0, argval='c', argrepr='c', offset=6, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_CLOSURE', opcode=135, arg=1, argval='d', argrepr='d', offset=8, starts_line=None, is_jump_target=False), + Instruction(opname='BUILD_TUPLE', opcode=102, arg=4, argval=4, argrepr='', offset=10, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=code_object_inner, argrepr=repr(code_object_inner), offset=12, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='outer..f..inner', argrepr="'outer..f..inner'", offset=14, starts_line=None, is_jump_target=False), + Instruction(opname='MAKE_FUNCTION', opcode=132, arg=9, argval=9, argrepr='', offset=16, starts_line=None, is_jump_target=False), + Instruction(opname='STORE_FAST', opcode=125, arg=2, argval='inner', argrepr='inner', offset=18, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_GLOBAL', opcode=116, arg=0, argval='print', argrepr='print', offset=20, starts_line=5, is_jump_target=False), + Instruction(opname='LOAD_DEREF', opcode=136, arg=2, argval='a', argrepr='a', offset=22, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_DEREF', opcode=136, arg=3, argval='b', argrepr='b', offset=24, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_DEREF', opcode=136, arg=0, argval='c', argrepr='c', offset=26, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_DEREF', opcode=136, arg=1, argval='d', argrepr='d', offset=28, starts_line=None, is_jump_target=False), + Instruction(opname='CALL_FUNCTION', opcode=131, arg=4, argval=4, argrepr='4 positional, 0 keyword pair', offset=30, starts_line=None, is_jump_target=False), + Instruction(opname='POP_TOP', opcode=1, arg=None, argval=None, argrepr='', offset=32, starts_line=None, is_jump_target=False), + Instruction(opname='LOAD_FAST', opcode=124, arg=2, argval='inner', argrepr='inner', offset=34, starts_line=6, is_jump_target=False), + Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=36, starts_line=None, is_jump_target=False), ] expected_opinfo_inner = [ 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 @@ -345,7 +345,7 @@ def f(x) -> list: pass self.assertEqual(f.__annotations__, {'return': list}) - # test MAKE_CLOSURE with a variety of oparg's + # test closures with a variety of opargs closure = 1 def f(): return closure def f(x=1): return closure diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #27095: Simplified MAKE_FUNCTION and removed MAKE_CLOSURE opcodes. + Patch by Demur Rumed. + - Issue #27190: Raise NotSupportedError if sqlite3 is older than 3.3.1. Patch by Dave Sawyer. diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3325,116 +3325,36 @@ DISPATCH(); } - TARGET(MAKE_CLOSURE) TARGET(MAKE_FUNCTION) { - int posdefaults = oparg & 0xff; - int kwdefaults = (oparg>>8) & 0xff; - int num_annotations = (oparg >> 16) & 0x7fff; - - PyObject *qualname = POP(); /* qualname */ - PyObject *code = POP(); /* code object */ - PyObject *func = PyFunction_NewWithQualName(code, f->f_globals, qualname); - Py_DECREF(code); + PyObject *qualname = POP(); + PyObject *codeobj = POP(); + PyFunctionObject *func = (PyFunctionObject *) + PyFunction_NewWithQualName(codeobj, f->f_globals, qualname); + + Py_DECREF(codeobj); Py_DECREF(qualname); - - if (func == NULL) + if (func == NULL) { goto error; - - if (opcode == MAKE_CLOSURE) { - PyObject *closure = POP(); - if (PyFunction_SetClosure(func, closure) != 0) { - /* Can't happen unless bytecode is corrupt. */ - Py_DECREF(func); - Py_DECREF(closure); - goto error; - } - Py_DECREF(closure); } - if (num_annotations > 0) { - Py_ssize_t name_ix; - PyObject *names = POP(); /* names of args with annotations */ - PyObject *anns = PyDict_New(); - if (anns == NULL) { - Py_DECREF(func); - Py_DECREF(names); - goto error; - } - name_ix = PyTuple_Size(names); - assert(num_annotations == name_ix+1); - while (name_ix > 0) { - PyObject *name, *value; - int err; - --name_ix; - name = PyTuple_GET_ITEM(names, name_ix); - value = POP(); - err = PyDict_SetItem(anns, name, value); - Py_DECREF(value); - if (err != 0) { - Py_DECREF(anns); - Py_DECREF(func); - Py_DECREF(names); - goto error; - } - } - Py_DECREF(names); - - if (PyFunction_SetAnnotations(func, anns) != 0) { - /* Can't happen unless - PyFunction_SetAnnotations changes. */ - Py_DECREF(anns); - Py_DECREF(func); - goto error; - } - Py_DECREF(anns); + if (oparg & 0x08) { + assert(PyTuple_CheckExact(TOP())); + func ->func_closure = POP(); } - - /* XXX Maybe this should be a separate opcode? */ - if (kwdefaults > 0) { - PyObject *defs = PyDict_New(); - if (defs == NULL) { - Py_DECREF(func); - goto error; - } - while (--kwdefaults >= 0) { - PyObject *v = POP(); /* default value */ - PyObject *key = POP(); /* kw only arg name */ - int err = PyDict_SetItem(defs, key, v); - Py_DECREF(v); - Py_DECREF(key); - if (err != 0) { - Py_DECREF(defs); - Py_DECREF(func); - goto error; - } - } - if (PyFunction_SetKwDefaults(func, defs) != 0) { - /* Can't happen unless - PyFunction_SetKwDefaults changes. */ - Py_DECREF(func); - Py_DECREF(defs); - goto error; - } - Py_DECREF(defs); + if (oparg & 0x04) { + assert(PyDict_CheckExact(TOP())); + func->func_annotations = POP(); } - if (posdefaults > 0) { - PyObject *defs = PyTuple_New(posdefaults); - if (defs == NULL) { - Py_DECREF(func); - goto error; - } - while (--posdefaults >= 0) - PyTuple_SET_ITEM(defs, posdefaults, POP()); - if (PyFunction_SetDefaults(func, defs) != 0) { - /* Can't happen unless - PyFunction_SetDefaults changes. */ - Py_DECREF(defs); - Py_DECREF(func); - goto error; - } - Py_DECREF(defs); + if (oparg & 0x02) { + assert(PyDict_CheckExact(TOP())); + func->func_kwdefaults = POP(); } - PUSH(func); + if (oparg & 0x01) { + assert(PyTuple_CheckExact(TOP())); + func->func_defaults = POP(); + } + + PUSH((PyObject *)func); DISPATCH(); } diff --git a/Python/compile.c b/Python/compile.c --- a/Python/compile.c +++ b/Python/compile.c @@ -1030,11 +1030,10 @@ return -NARGS(oparg)-1; case CALL_FUNCTION_VAR_KW: return -NARGS(oparg)-2; +#undef NARGS case MAKE_FUNCTION: - return -1 -NARGS(oparg) - ((oparg >> 16) & 0xffff); - case MAKE_CLOSURE: - return -2 - NARGS(oparg) - ((oparg >> 16) & 0xffff); -#undef NARGS + return -1 - ((oparg & 0x01) != 0) - ((oparg & 0x02) != 0) - + ((oparg & 0x04) != 0) - ((oparg & 0x08) != 0); case BUILD_SLICE: if (oparg == 3) return -2; @@ -1472,53 +1471,50 @@ } static int -compiler_make_closure(struct compiler *c, PyCodeObject *co, Py_ssize_t args, PyObject *qualname) +compiler_make_closure(struct compiler *c, PyCodeObject *co, Py_ssize_t flags, PyObject *qualname) { Py_ssize_t i, free = PyCode_GetNumFree(co); if (qualname == NULL) qualname = co->co_name; - if (free == 0) { - ADDOP_O(c, LOAD_CONST, (PyObject*)co, consts); - ADDOP_O(c, LOAD_CONST, qualname, consts); - ADDOP_I(c, MAKE_FUNCTION, args); - return 1; + if (free) { + for (i = 0; i < free; ++i) { + /* Bypass com_addop_varname because it will generate + LOAD_DEREF but LOAD_CLOSURE is needed. + */ + PyObject *name = PyTuple_GET_ITEM(co->co_freevars, i); + int arg, reftype; + + /* Special case: If a class contains a method with a + free variable that has the same name as a method, + the name will be considered free *and* local in the + class. It should be handled by the closure, as + well as by the normal name loookup logic. + */ + reftype = get_ref_type(c, name); + if (reftype == CELL) + arg = compiler_lookup_arg(c->u->u_cellvars, name); + else /* (reftype == FREE) */ + arg = compiler_lookup_arg(c->u->u_freevars, name); + if (arg == -1) { + fprintf(stderr, + "lookup %s in %s %d %d\n" + "freevars of %s: %s\n", + PyUnicode_AsUTF8(PyObject_Repr(name)), + PyUnicode_AsUTF8(c->u->u_name), + reftype, arg, + PyUnicode_AsUTF8(co->co_name), + PyUnicode_AsUTF8(PyObject_Repr(co->co_freevars))); + Py_FatalError("compiler_make_closure()"); + } + ADDOP_I(c, LOAD_CLOSURE, arg); + } + flags |= 0x08; + ADDOP_I(c, BUILD_TUPLE, free); } - for (i = 0; i < free; ++i) { - /* Bypass com_addop_varname because it will generate - LOAD_DEREF but LOAD_CLOSURE is needed. - */ - PyObject *name = PyTuple_GET_ITEM(co->co_freevars, i); - int arg, reftype; - - /* Special case: If a class contains a method with a - free variable that has the same name as a method, - the name will be considered free *and* local in the - class. It should be handled by the closure, as - well as by the normal name loookup logic. - */ - reftype = get_ref_type(c, name); - if (reftype == CELL) - arg = compiler_lookup_arg(c->u->u_cellvars, name); - else /* (reftype == FREE) */ - arg = compiler_lookup_arg(c->u->u_freevars, name); - if (arg == -1) { - fprintf(stderr, - "lookup %s in %s %d %d\n" - "freevars of %s: %s\n", - PyUnicode_AsUTF8(PyObject_Repr(name)), - PyUnicode_AsUTF8(c->u->u_name), - reftype, arg, - PyUnicode_AsUTF8(co->co_name), - PyUnicode_AsUTF8(PyObject_Repr(co->co_freevars))); - Py_FatalError("compiler_make_closure()"); - } - ADDOP_I(c, LOAD_CLOSURE, arg); - } - ADDOP_I(c, BUILD_TUPLE, free); ADDOP_O(c, LOAD_CONST, (PyObject*)co, consts); ADDOP_O(c, LOAD_CONST, qualname, consts); - ADDOP_I(c, MAKE_CLOSURE, args); + ADDOP_I(c, MAKE_FUNCTION, flags); return 1; } @@ -1536,27 +1532,59 @@ return 1; } -static int +static Py_ssize_t compiler_visit_kwonlydefaults(struct compiler *c, asdl_seq *kwonlyargs, asdl_seq *kw_defaults) { - int i, default_count = 0; + int i; + PyObject *keys = NULL; + for (i = 0; i < asdl_seq_LEN(kwonlyargs); i++) { arg_ty arg = asdl_seq_GET(kwonlyargs, i); expr_ty default_ = asdl_seq_GET(kw_defaults, i); if (default_) { PyObject *mangled = _Py_Mangle(c->u->u_private, arg->arg); - if (!mangled) - return -1; - ADDOP_O(c, LOAD_CONST, mangled, consts); - Py_DECREF(mangled); + if (!mangled) { + goto error; + } + if (keys == NULL) { + keys = PyList_New(1); + if (keys == NULL) { + Py_DECREF(mangled); + return -1; + } + PyList_SET_ITEM(keys, 0, mangled); + } + else { + int res = PyList_Append(keys, mangled); + Py_DECREF(mangled); + if (res == -1) { + goto error; + } + } if (!compiler_visit_expr(c, default_)) { - return -1; + goto error; } - default_count++; } } - return default_count; + if (keys != NULL) { + Py_ssize_t default_count = PyList_GET_SIZE(keys); + PyObject *keys_tuple = PyList_AsTuple(keys); + Py_DECREF(keys); + if (keys_tuple == NULL) { + return -1; + } + ADDOP_N(c, LOAD_CONST, keys_tuple, consts); + ADDOP_I(c, BUILD_CONST_KEY_MAP, default_count); + return default_count; + } + else { + return 0; + } + +error: + Py_XDECREF(keys); + return -1; } static int @@ -1595,15 +1623,14 @@ return 1; } -static int +static Py_ssize_t compiler_visit_annotations(struct compiler *c, arguments_ty args, expr_ty returns) { - /* Push arg annotations and a list of the argument names. Return the # - of items pushed. The expressions are evaluated out-of-order wrt the - source code. - - More than 2^16-1 annotations is a SyntaxError. Returns -1 on error. + /* Push arg annotation dict. Return # of items pushed. + The expressions are evaluated out-of-order wrt the source code. + + Returns -1 on error. */ static identifier return_str; PyObject *names; @@ -1635,38 +1662,47 @@ } len = PyList_GET_SIZE(names); - if (len > 65534) { - /* len must fit in 16 bits, and len is incremented below */ - PyErr_SetString(PyExc_SyntaxError, - "too many annotations"); - goto error; + if (len) { + PyObject *keytuple = PyList_AsTuple(names); + Py_DECREF(names); + if (keytuple == NULL) { + return -1; + } + ADDOP_N(c, LOAD_CONST, keytuple, consts); + ADDOP_I(c, BUILD_CONST_KEY_MAP, len); } - if (len) { - /* convert names to a tuple and place on stack */ - PyObject *elt; - Py_ssize_t i; - PyObject *s = PyTuple_New(len); - if (!s) - goto error; - for (i = 0; i < len; i++) { - elt = PyList_GET_ITEM(names, i); - Py_INCREF(elt); - PyTuple_SET_ITEM(s, i, elt); - } - ADDOP_O(c, LOAD_CONST, s, consts); - Py_DECREF(s); - len++; /* include the just-pushed tuple */ + else { + Py_DECREF(names); } - Py_DECREF(names); - - /* We just checked that len <= 65535, see above */ - return Py_SAFE_DOWNCAST(len, Py_ssize_t, int); + return len; error: Py_DECREF(names); return -1; } +static Py_ssize_t +compiler_default_arguments(struct compiler *c, arguments_ty args) +{ + Py_ssize_t funcflags = 0; + if (args->defaults && asdl_seq_LEN(args->defaults) > 0) { + VISIT_SEQ(c, expr, args->defaults); + ADDOP_I(c, BUILD_TUPLE, asdl_seq_LEN(args->defaults)); + funcflags |= 0x01; + } + if (args->kwonlyargs) { + Py_ssize_t res = compiler_visit_kwonlydefaults(c, args->kwonlyargs, + args->kw_defaults); + if (res < 0) { + return -1; + } + else if (res > 0) { + funcflags |= 0x02; + } + } + return funcflags; +} + static int compiler_function(struct compiler *c, stmt_ty s, int is_async) { @@ -1678,12 +1714,11 @@ asdl_seq* decos; asdl_seq *body; stmt_ty st; - Py_ssize_t i, n, arglength; - int docstring, kw_default_count = 0; + Py_ssize_t i, n, funcflags; + int docstring; int num_annotations; int scope_type; - if (is_async) { assert(s->kind == AsyncFunctionDef_kind); @@ -1708,24 +1743,23 @@ if (!compiler_decorators(c, decos)) return 0; - if (args->defaults) - VISIT_SEQ(c, expr, args->defaults); - if (args->kwonlyargs) { - int res = compiler_visit_kwonlydefaults(c, args->kwonlyargs, - args->kw_defaults); - if (res < 0) - return 0; - kw_default_count = res; + + funcflags = compiler_default_arguments(c, args); + if (funcflags == -1) { + return 0; } + num_annotations = compiler_visit_annotations(c, args, returns); - if (num_annotations < 0) + if (num_annotations < 0) { return 0; - assert((num_annotations & 0xFFFF) == num_annotations); - - if (!compiler_enter_scope(c, name, - scope_type, (void *)s, - s->lineno)) + } + else if (num_annotations > 0) { + funcflags |= 0x04; + } + + if (!compiler_enter_scope(c, name, scope_type, (void *)s, s->lineno)) { return 0; + } st = (stmt_ty)asdl_seq_GET(body, 0); docstring = compiler_isdocstring(st); @@ -1758,12 +1792,9 @@ return 0; } - arglength = asdl_seq_LEN(args->defaults); - arglength |= kw_default_count << 8; - arglength |= num_annotations << 16; if (is_async) co->co_flags |= CO_COROUTINE; - compiler_make_closure(c, co, arglength, qualname); + compiler_make_closure(c, co, funcflags, qualname); Py_DECREF(qualname); Py_DECREF(co); @@ -1923,8 +1954,7 @@ PyCodeObject *co; PyObject *qualname; static identifier name; - int kw_default_count = 0; - Py_ssize_t arglength; + Py_ssize_t funcflags; arguments_ty args = e->v.Lambda.args; assert(e->kind == Lambda_kind); @@ -1934,14 +1964,11 @@ return 0; } - if (args->defaults) - VISIT_SEQ(c, expr, args->defaults); - if (args->kwonlyargs) { - int res = compiler_visit_kwonlydefaults(c, args->kwonlyargs, - args->kw_defaults); - if (res < 0) return 0; - kw_default_count = res; + funcflags = compiler_default_arguments(c, args); + if (funcflags == -1) { + return 0; } + if (!compiler_enter_scope(c, name, COMPILER_SCOPE_LAMBDA, (void *)e, e->lineno)) return 0; @@ -1967,9 +1994,7 @@ if (co == NULL) return 0; - arglength = asdl_seq_LEN(args->defaults); - arglength |= kw_default_count << 8; - compiler_make_closure(c, co, arglength, qualname); + compiler_make_closure(c, co, funcflags, qualname); Py_DECREF(qualname); Py_DECREF(co); diff --git a/Python/importlib.h b/Python/importlib.h --- a/Python/importlib.h +++ b/Python/importlib.h [stripped] diff --git a/Python/importlib_external.h b/Python/importlib_external.h --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -1,904 +1,904 @@ /* Auto-generated by Programs/_freeze_importlib.c */ const unsigned char _Py_M__importlib_external[] = { - 99,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0, - 0,64,0,0,0,115,248,1,0,0,100,0,90,0,100,92, + 99,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0, + 0,64,0,0,0,115,236,1,0,0,100,0,90,0,100,91, 90,1,100,4,100,5,132,0,90,2,100,6,100,7,132,0, 90,3,100,8,100,9,132,0,90,4,100,10,100,11,132,0, 90,5,100,12,100,13,132,0,90,6,100,14,100,15,132,0, 90,7,100,16,100,17,132,0,90,8,100,18,100,19,132,0, - 90,9,100,20,100,21,132,0,90,10,100,22,100,23,100,24, + 90,9,100,20,100,21,132,0,90,10,100,92,100,23,100,24, 132,1,90,11,101,12,101,11,106,13,131,1,90,14,100,25, 106,15,100,26,100,27,131,2,100,28,23,0,90,16,101,17, 106,18,101,16,100,27,131,2,90,19,100,29,90,20,100,30, 90,21,100,31,103,1,90,22,100,32,103,1,90,23,101,23, - 4,0,90,24,90,25,100,33,100,34,100,33,100,35,100,36, - 144,1,132,1,90,26,100,37,100,38,132,0,90,27,100,39, + 4,0,90,24,90,25,100,93,100,33,100,34,156,1,100,35, + 100,36,132,3,90,26,100,37,100,38,132,0,90,27,100,39, 100,40,132,0,90,28,100,41,100,42,132,0,90,29,100,43, 100,44,132,0,90,30,100,45,100,46,132,0,90,31,100,47, - 100,48,132,0,90,32,100,33,100,33,100,33,100,49,100,50, - 132,3,90,33,100,33,100,33,100,33,100,51,100,52,132,3, - 90,34,100,53,100,53,100,54,100,55,132,2,90,35,100,56, - 100,57,132,0,90,36,101,37,131,0,90,38,100,33,100,58, - 100,33,100,59,101,38,100,60,100,61,144,2,132,1,90,39, - 71,0,100,62,100,63,132,0,100,63,131,2,90,40,71,0, - 100,64,100,65,132,0,100,65,131,2,90,41,71,0,100,66, - 100,67,132,0,100,67,101,41,131,3,90,42,71,0,100,68, - 100,69,132,0,100,69,131,2,90,43,71,0,100,70,100,71, - 132,0,100,71,101,43,101,42,131,4,90,44,71,0,100,72, - 100,73,132,0,100,73,101,43,101,41,131,4,90,45,103,0, - 90,46,71,0,100,74,100,75,132,0,100,75,101,43,101,41, - 131,4,90,47,71,0,100,76,100,77,132,0,100,77,131,2, - 90,48,71,0,100,78,100,79,132,0,100,79,131,2,90,49, - 71,0,100,80,100,81,132,0,100,81,131,2,90,50,71,0, - 100,82,100,83,132,0,100,83,131,2,90,51,100,33,100,84, - 100,85,132,1,90,52,100,86,100,87,132,0,90,53,100,88, - 100,89,132,0,90,54,100,90,100,91,132,0,90,55,100,33, - 83,0,41,93,97,94,1,0,0,67,111,114,101,32,105,109, - 112,108,101,109,101,110,116,97,116,105,111,110,32,111,102,32, - 112,97,116,104,45,98,97,115,101,100,32,105,109,112,111,114, - 116,46,10,10,84,104,105,115,32,109,111,100,117,108,101,32, - 105,115,32,78,79,84,32,109,101,97,110,116,32,116,111,32, - 98,101,32,100,105,114,101,99,116,108,121,32,105,109,112,111, - 114,116,101,100,33,32,73,116,32,104,97,115,32,98,101,101, - 110,32,100,101,115,105,103,110,101,100,32,115,117,99,104,10, - 116,104,97,116,32,105,116,32,99,97,110,32,98,101,32,98, - 111,111,116,115,116,114,97,112,112,101,100,32,105,110,116,111, - 32,80,121,116,104,111,110,32,97,115,32,116,104,101,32,105, - 109,112,108,101,109,101,110,116,97,116,105,111,110,32,111,102, - 32,105,109,112,111,114,116,46,32,65,115,10,115,117,99,104, - 32,105,116,32,114,101,113,117,105,114,101,115,32,116,104,101, - 32,105,110,106,101,99,116,105,111,110,32,111,102,32,115,112, - 101,99,105,102,105,99,32,109,111,100,117,108,101,115,32,97, - 110,100,32,97,116,116,114,105,98,117,116,101,115,32,105,110, - 32,111,114,100,101,114,32,116,111,10,119,111,114,107,46,32, - 79,110,101,32,115,104,111,117,108,100,32,117,115,101,32,105, - 109,112,111,114,116,108,105,98,32,97,115,32,116,104,101,32, - 112,117,98,108,105,99,45,102,97,99,105,110,103,32,118,101, - 114,115,105,111,110,32,111,102,32,116,104,105,115,32,109,111, - 100,117,108,101,46,10,10,218,3,119,105,110,218,6,99,121, - 103,119,105,110,218,6,100,97,114,119,105,110,99,0,0,0, + 100,48,132,0,90,32,100,94,100,49,100,50,132,1,90,33, + 100,95,100,51,100,52,132,1,90,34,100,96,100,54,100,55, + 132,1,90,35,100,56,100,57,132,0,90,36,101,37,131,0, + 90,38,100,97,100,33,101,38,100,58,156,2,100,59,100,60, + 132,3,90,39,71,0,100,61,100,62,132,0,100,62,131,2, + 90,40,71,0,100,63,100,64,132,0,100,64,131,2,90,41, + 71,0,100,65,100,66,132,0,100,66,101,41,131,3,90,42, + 71,0,100,67,100,68,132,0,100,68,131,2,90,43,71,0, + 100,69,100,70,132,0,100,70,101,43,101,42,131,4,90,44, + 71,0,100,71,100,72,132,0,100,72,101,43,101,41,131,4, + 90,45,103,0,90,46,71,0,100,73,100,74,132,0,100,74, + 101,43,101,41,131,4,90,47,71,0,100,75,100,76,132,0, + 100,76,131,2,90,48,71,0,100,77,100,78,132,0,100,78, + 131,2,90,49,71,0,100,79,100,80,132,0,100,80,131,2, + 90,50,71,0,100,81,100,82,132,0,100,82,131,2,90,51, + 100,98,100,83,100,84,132,1,90,52,100,85,100,86,132,0, + 90,53,100,87,100,88,132,0,90,54,100,89,100,90,132,0, + 90,55,100,33,83,0,41,99,97,94,1,0,0,67,111,114, + 101,32,105,109,112,108,101,109,101,110,116,97,116,105,111,110, + 32,111,102,32,112,97,116,104,45,98,97,115,101,100,32,105, + 109,112,111,114,116,46,10,10,84,104,105,115,32,109,111,100, + 117,108,101,32,105,115,32,78,79,84,32,109,101,97,110,116, + 32,116,111,32,98,101,32,100,105,114,101,99,116,108,121,32, + 105,109,112,111,114,116,101,100,33,32,73,116,32,104,97,115, + 32,98,101,101,110,32,100,101,115,105,103,110,101,100,32,115, + 117,99,104,10,116,104,97,116,32,105,116,32,99,97,110,32, + 98,101,32,98,111,111,116,115,116,114,97,112,112,101,100,32, + 105,110,116,111,32,80,121,116,104,111,110,32,97,115,32,116, + 104,101,32,105,109,112,108,101,109,101,110,116,97,116,105,111, + 110,32,111,102,32,105,109,112,111,114,116,46,32,65,115,10, + 115,117,99,104,32,105,116,32,114,101,113,117,105,114,101,115, + 32,116,104,101,32,105,110,106,101,99,116,105,111,110,32,111, + 102,32,115,112,101,99,105,102,105,99,32,109,111,100,117,108, + 101,115,32,97,110,100,32,97,116,116,114,105,98,117,116,101, + 115,32,105,110,32,111,114,100,101,114,32,116,111,10,119,111, + 114,107,46,32,79,110,101,32,115,104,111,117,108,100,32,117, + 115,101,32,105,109,112,111,114,116,108,105,98,32,97,115,32, + 116,104,101,32,112,117,98,108,105,99,45,102,97,99,105,110, + 103,32,118,101,114,115,105,111,110,32,111,102,32,116,104,105, + 115,32,109,111,100,117,108,101,46,10,10,218,3,119,105,110, + 218,6,99,121,103,119,105,110,218,6,100,97,114,119,105,110, + 99,0,0,0,0,0,0,0,0,1,0,0,0,2,0,0, + 0,67,0,0,0,115,34,0,0,0,116,0,106,1,106,2, + 116,3,131,1,114,22,100,1,100,2,132,0,125,0,110,8, + 100,3,100,2,132,0,125,0,124,0,83,0,41,4,78,99, + 0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, + 83,0,0,0,115,10,0,0,0,100,1,116,0,106,1,107, + 6,83,0,41,2,122,53,84,114,117,101,32,105,102,32,102, + 105,108,101,110,97,109,101,115,32,109,117,115,116,32,98,101, + 32,99,104,101,99,107,101,100,32,99,97,115,101,45,105,110, + 115,101,110,115,105,116,105,118,101,108,121,46,115,12,0,0, + 0,80,89,84,72,79,78,67,65,83,69,79,75,41,2,218, + 3,95,111,115,90,7,101,110,118,105,114,111,110,169,0,114, + 4,0,0,0,114,4,0,0,0,250,38,60,102,114,111,122, + 101,110,32,105,109,112,111,114,116,108,105,98,46,95,98,111, + 111,116,115,116,114,97,112,95,101,120,116,101,114,110,97,108, + 62,218,11,95,114,101,108,97,120,95,99,97,115,101,30,0, + 0,0,115,2,0,0,0,0,2,122,37,95,109,97,107,101, + 95,114,101,108,97,120,95,99,97,115,101,46,60,108,111,99, + 97,108,115,62,46,95,114,101,108,97,120,95,99,97,115,101, + 99,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0, + 0,83,0,0,0,115,4,0,0,0,100,1,83,0,41,2, + 122,53,84,114,117,101,32,105,102,32,102,105,108,101,110,97, + 109,101,115,32,109,117,115,116,32,98,101,32,99,104,101,99, + 107,101,100,32,99,97,115,101,45,105,110,115,101,110,115,105, + 116,105,118,101,108,121,46,70,114,4,0,0,0,114,4,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, + 0,114,6,0,0,0,34,0,0,0,115,2,0,0,0,0, + 2,41,4,218,3,115,121,115,218,8,112,108,97,116,102,111, + 114,109,218,10,115,116,97,114,116,115,119,105,116,104,218,27, + 95,67,65,83,69,95,73,78,83,69,78,83,73,84,73,86, + 69,95,80,76,65,84,70,79,82,77,83,41,1,114,6,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, + 0,218,16,95,109,97,107,101,95,114,101,108,97,120,95,99, + 97,115,101,28,0,0,0,115,8,0,0,0,0,1,12,1, + 10,4,8,3,114,11,0,0,0,99,1,0,0,0,0,0, + 0,0,1,0,0,0,3,0,0,0,67,0,0,0,115,20, + 0,0,0,116,0,124,0,131,1,100,1,64,0,106,1,100, + 2,100,3,131,2,83,0,41,4,122,42,67,111,110,118,101, + 114,116,32,97,32,51,50,45,98,105,116,32,105,110,116,101, + 103,101,114,32,116,111,32,108,105,116,116,108,101,45,101,110, + 100,105,97,110,46,108,3,0,0,0,255,127,255,127,3,0, + 233,4,0,0,0,218,6,108,105,116,116,108,101,41,2,218, + 3,105,110,116,218,8,116,111,95,98,121,116,101,115,41,1, + 218,1,120,114,4,0,0,0,114,4,0,0,0,114,5,0, + 0,0,218,7,95,119,95,108,111,110,103,40,0,0,0,115, + 2,0,0,0,0,2,114,17,0,0,0,99,1,0,0,0, + 0,0,0,0,1,0,0,0,3,0,0,0,67,0,0,0, + 115,12,0,0,0,116,0,106,1,124,0,100,1,131,2,83, + 0,41,2,122,47,67,111,110,118,101,114,116,32,52,32,98, + 121,116,101,115,32,105,110,32,108,105,116,116,108,101,45,101, + 110,100,105,97,110,32,116,111,32,97,110,32,105,110,116,101, + 103,101,114,46,114,13,0,0,0,41,2,114,14,0,0,0, + 218,10,102,114,111,109,95,98,121,116,101,115,41,1,90,9, + 105,110,116,95,98,121,116,101,115,114,4,0,0,0,114,4, + 0,0,0,114,5,0,0,0,218,7,95,114,95,108,111,110, + 103,45,0,0,0,115,2,0,0,0,0,2,114,19,0,0, + 0,99,0,0,0,0,0,0,0,0,1,0,0,0,3,0, + 0,0,71,0,0,0,115,20,0,0,0,116,0,106,1,100, + 1,100,2,132,0,124,0,68,0,131,1,131,1,83,0,41, + 3,122,31,82,101,112,108,97,99,101,109,101,110,116,32,102, + 111,114,32,111,115,46,112,97,116,104,46,106,111,105,110,40, + 41,46,99,1,0,0,0,0,0,0,0,2,0,0,0,4, + 0,0,0,83,0,0,0,115,26,0,0,0,103,0,124,0, + 93,18,125,1,124,1,114,4,124,1,106,0,116,1,131,1, + 145,2,113,4,83,0,114,4,0,0,0,41,2,218,6,114, + 115,116,114,105,112,218,15,112,97,116,104,95,115,101,112,97, + 114,97,116,111,114,115,41,2,218,2,46,48,218,4,112,97, + 114,116,114,4,0,0,0,114,4,0,0,0,114,5,0,0, + 0,250,10,60,108,105,115,116,99,111,109,112,62,52,0,0, + 0,115,2,0,0,0,6,1,122,30,95,112,97,116,104,95, + 106,111,105,110,46,60,108,111,99,97,108,115,62,46,60,108, + 105,115,116,99,111,109,112,62,41,2,218,8,112,97,116,104, + 95,115,101,112,218,4,106,111,105,110,41,1,218,10,112,97, + 116,104,95,112,97,114,116,115,114,4,0,0,0,114,4,0, + 0,0,114,5,0,0,0,218,10,95,112,97,116,104,95,106, + 111,105,110,50,0,0,0,115,4,0,0,0,0,2,10,1, + 114,28,0,0,0,99,1,0,0,0,0,0,0,0,5,0, + 0,0,5,0,0,0,67,0,0,0,115,98,0,0,0,116, + 0,116,1,131,1,100,1,107,2,114,36,124,0,106,2,116, + 3,131,1,92,3,125,1,125,2,125,3,124,1,124,3,102, + 2,83,0,120,52,116,4,124,0,131,1,68,0,93,40,125, + 4,124,4,116,1,107,6,114,46,124,0,106,5,124,4,100, + 2,100,1,144,1,131,1,92,2,125,1,125,3,124,1,124, + 3,102,2,83,0,113,46,87,0,100,3,124,0,102,2,83, + 0,41,4,122,32,82,101,112,108,97,99,101,109,101,110,116, + 32,102,111,114,32,111,115,46,112,97,116,104,46,115,112,108, + 105,116,40,41,46,233,1,0,0,0,90,8,109,97,120,115, + 112,108,105,116,218,0,41,6,218,3,108,101,110,114,21,0, + 0,0,218,10,114,112,97,114,116,105,116,105,111,110,114,25, + 0,0,0,218,8,114,101,118,101,114,115,101,100,218,6,114, + 115,112,108,105,116,41,5,218,4,112,97,116,104,90,5,102, + 114,111,110,116,218,1,95,218,4,116,97,105,108,114,16,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, + 0,218,11,95,112,97,116,104,95,115,112,108,105,116,56,0, + 0,0,115,16,0,0,0,0,2,12,1,16,1,8,1,14, + 1,8,1,20,1,12,1,114,38,0,0,0,99,1,0,0, 0,0,0,0,0,1,0,0,0,2,0,0,0,67,0,0, - 0,115,34,0,0,0,116,0,106,1,106,2,116,3,131,1, - 114,22,100,1,100,2,132,0,125,0,110,8,100,3,100,2, - 132,0,125,0,124,0,83,0,41,4,78,99,0,0,0,0, - 0,0,0,0,0,0,0,0,2,0,0,0,83,0,0,0, - 115,10,0,0,0,100,1,116,0,106,1,107,6,83,0,41, - 2,122,53,84,114,117,101,32,105,102,32,102,105,108,101,110, - 97,109,101,115,32,109,117,115,116,32,98,101,32,99,104,101, - 99,107,101,100,32,99,97,115,101,45,105,110,115,101,110,115, - 105,116,105,118,101,108,121,46,115,12,0,0,0,80,89,84, - 72,79,78,67,65,83,69,79,75,41,2,218,3,95,111,115, - 90,7,101,110,118,105,114,111,110,169,0,114,4,0,0,0, - 114,4,0,0,0,250,38,60,102,114,111,122,101,110,32,105, - 109,112,111,114,116,108,105,98,46,95,98,111,111,116,115,116, - 114,97,112,95,101,120,116,101,114,110,97,108,62,218,11,95, - 114,101,108,97,120,95,99,97,115,101,30,0,0,0,115,2, - 0,0,0,0,2,122,37,95,109,97,107,101,95,114,101,108, - 97,120,95,99,97,115,101,46,60,108,111,99,97,108,115,62, - 46,95,114,101,108,97,120,95,99,97,115,101,99,0,0,0, - 0,0,0,0,0,0,0,0,0,1,0,0,0,83,0,0, - 0,115,4,0,0,0,100,1,83,0,41,2,122,53,84,114, - 117,101,32,105,102,32,102,105,108,101,110,97,109,101,115,32, - 109,117,115,116,32,98,101,32,99,104,101,99,107,101,100,32, - 99,97,115,101,45,105,110,115,101,110,115,105,116,105,118,101, - 108,121,46,70,114,4,0,0,0,114,4,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,5,0,0,0,114,6,0, - 0,0,34,0,0,0,115,2,0,0,0,0,2,41,4,218, - 3,115,121,115,218,8,112,108,97,116,102,111,114,109,218,10, - 115,116,97,114,116,115,119,105,116,104,218,27,95,67,65,83, - 69,95,73,78,83,69,78,83,73,84,73,86,69,95,80,76, - 65,84,70,79,82,77,83,41,1,114,6,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,5,0,0,0,218,16,95, - 109,97,107,101,95,114,101,108,97,120,95,99,97,115,101,28, - 0,0,0,115,8,0,0,0,0,1,12,1,10,4,8,3, - 114,11,0,0,0,99,1,0,0,0,0,0,0,0,1,0, - 0,0,3,0,0,0,67,0,0,0,115,20,0,0,0,116, - 0,124,0,131,1,100,1,64,0,106,1,100,2,100,3,131, - 2,83,0,41,4,122,42,67,111,110,118,101,114,116,32,97, - 32,51,50,45,98,105,116,32,105,110,116,101,103,101,114,32, - 116,111,32,108,105,116,116,108,101,45,101,110,100,105,97,110, - 46,108,3,0,0,0,255,127,255,127,3,0,233,4,0,0, - 0,218,6,108,105,116,116,108,101,41,2,218,3,105,110,116, - 218,8,116,111,95,98,121,116,101,115,41,1,218,1,120,114, - 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,7, - 95,119,95,108,111,110,103,40,0,0,0,115,2,0,0,0, - 0,2,114,17,0,0,0,99,1,0,0,0,0,0,0,0, - 1,0,0,0,3,0,0,0,67,0,0,0,115,12,0,0, - 0,116,0,106,1,124,0,100,1,131,2,83,0,41,2,122, - 47,67,111,110,118,101,114,116,32,52,32,98,121,116,101,115, - 32,105,110,32,108,105,116,116,108,101,45,101,110,100,105,97, - 110,32,116,111,32,97,110,32,105,110,116,101,103,101,114,46, - 114,13,0,0,0,41,2,114,14,0,0,0,218,10,102,114, - 111,109,95,98,121,116,101,115,41,1,90,9,105,110,116,95, - 98,121,116,101,115,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,218,7,95,114,95,108,111,110,103,45,0,0, - 0,115,2,0,0,0,0,2,114,19,0,0,0,99,0,0, - 0,0,0,0,0,0,1,0,0,0,3,0,0,0,71,0, - 0,0,115,20,0,0,0,116,0,106,1,100,1,100,2,132, - 0,124,0,68,0,131,1,131,1,83,0,41,3,122,31,82, - 101,112,108,97,99,101,109,101,110,116,32,102,111,114,32,111, - 115,46,112,97,116,104,46,106,111,105,110,40,41,46,99,1, - 0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,83, - 0,0,0,115,26,0,0,0,103,0,124,0,93,18,125,1, - 124,1,114,4,124,1,106,0,116,1,131,1,145,2,113,4, - 83,0,114,4,0,0,0,41,2,218,6,114,115,116,114,105, - 112,218,15,112,97,116,104,95,115,101,112,97,114,97,116,111, - 114,115,41,2,218,2,46,48,218,4,112,97,114,116,114,4, - 0,0,0,114,4,0,0,0,114,5,0,0,0,250,10,60, - 108,105,115,116,99,111,109,112,62,52,0,0,0,115,2,0, - 0,0,6,1,122,30,95,112,97,116,104,95,106,111,105,110, - 46,60,108,111,99,97,108,115,62,46,60,108,105,115,116,99, - 111,109,112,62,41,2,218,8,112,97,116,104,95,115,101,112, - 218,4,106,111,105,110,41,1,218,10,112,97,116,104,95,112, - 97,114,116,115,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,218,10,95,112,97,116,104,95,106,111,105,110,50, - 0,0,0,115,4,0,0,0,0,2,10,1,114,28,0,0, - 0,99,1,0,0,0,0,0,0,0,5,0,0,0,5,0, - 0,0,67,0,0,0,115,98,0,0,0,116,0,116,1,131, - 1,100,1,107,2,114,36,124,0,106,2,116,3,131,1,92, - 3,125,1,125,2,125,3,124,1,124,3,102,2,83,0,120, - 52,116,4,124,0,131,1,68,0,93,40,125,4,124,4,116, - 1,107,6,114,46,124,0,106,5,124,4,100,2,100,1,144, - 1,131,1,92,2,125,1,125,3,124,1,124,3,102,2,83, - 0,113,46,87,0,100,3,124,0,102,2,83,0,41,4,122, - 32,82,101,112,108,97,99,101,109,101,110,116,32,102,111,114, - 32,111,115,46,112,97,116,104,46,115,112,108,105,116,40,41, - 46,233,1,0,0,0,90,8,109,97,120,115,112,108,105,116, - 218,0,41,6,218,3,108,101,110,114,21,0,0,0,218,10, - 114,112,97,114,116,105,116,105,111,110,114,25,0,0,0,218, - 8,114,101,118,101,114,115,101,100,218,6,114,115,112,108,105, - 116,41,5,218,4,112,97,116,104,90,5,102,114,111,110,116, - 218,1,95,218,4,116,97,105,108,114,16,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,5,0,0,0,218,11,95, - 112,97,116,104,95,115,112,108,105,116,56,0,0,0,115,16, - 0,0,0,0,2,12,1,16,1,8,1,14,1,8,1,20, - 1,12,1,114,38,0,0,0,99,1,0,0,0,0,0,0, - 0,1,0,0,0,2,0,0,0,67,0,0,0,115,10,0, - 0,0,116,0,106,1,124,0,131,1,83,0,41,1,122,126, - 83,116,97,116,32,116,104,101,32,112,97,116,104,46,10,10, - 32,32,32,32,77,97,100,101,32,97,32,115,101,112,97,114, - 97,116,101,32,102,117,110,99,116,105,111,110,32,116,111,32, - 109,97,107,101,32,105,116,32,101,97,115,105,101,114,32,116, - 111,32,111,118,101,114,114,105,100,101,32,105,110,32,101,120, - 112,101,114,105,109,101,110,116,115,10,32,32,32,32,40,101, - 46,103,46,32,99,97,99,104,101,32,115,116,97,116,32,114, - 101,115,117,108,116,115,41,46,10,10,32,32,32,32,41,2, - 114,3,0,0,0,90,4,115,116,97,116,41,1,114,35,0, - 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,218,10,95,112,97,116,104,95,115,116,97,116,68,0,0, - 0,115,2,0,0,0,0,7,114,39,0,0,0,99,2,0, - 0,0,0,0,0,0,3,0,0,0,11,0,0,0,67,0, - 0,0,115,48,0,0,0,121,12,116,0,124,0,131,1,125, - 2,87,0,110,20,4,0,116,1,107,10,114,32,1,0,1, - 0,1,0,100,1,83,0,88,0,124,2,106,2,100,2,64, - 0,124,1,107,2,83,0,41,3,122,49,84,101,115,116,32, - 119,104,101,116,104,101,114,32,116,104,101,32,112,97,116,104, - 32,105,115,32,116,104,101,32,115,112,101,99,105,102,105,101, - 100,32,109,111,100,101,32,116,121,112,101,46,70,105,0,240, - 0,0,41,3,114,39,0,0,0,218,7,79,83,69,114,114, - 111,114,218,7,115,116,95,109,111,100,101,41,3,114,35,0, - 0,0,218,4,109,111,100,101,90,9,115,116,97,116,95,105, - 110,102,111,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,218,18,95,112,97,116,104,95,105,115,95,109,111,100, - 101,95,116,121,112,101,78,0,0,0,115,10,0,0,0,0, - 2,2,1,12,1,14,1,6,1,114,43,0,0,0,99,1, - 0,0,0,0,0,0,0,1,0,0,0,3,0,0,0,67, - 0,0,0,115,10,0,0,0,116,0,124,0,100,1,131,2, - 83,0,41,2,122,31,82,101,112,108,97,99,101,109,101,110, - 116,32,102,111,114,32,111,115,46,112,97,116,104,46,105,115, - 102,105,108,101,46,105,0,128,0,0,41,1,114,43,0,0, - 0,41,1,114,35,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,218,12,95,112,97,116,104,95,105, - 115,102,105,108,101,87,0,0,0,115,2,0,0,0,0,2, - 114,44,0,0,0,99,1,0,0,0,0,0,0,0,1,0, - 0,0,3,0,0,0,67,0,0,0,115,22,0,0,0,124, - 0,115,12,116,0,106,1,131,0,125,0,116,2,124,0,100, - 1,131,2,83,0,41,2,122,30,82,101,112,108,97,99,101, - 109,101,110,116,32,102,111,114,32,111,115,46,112,97,116,104, - 46,105,115,100,105,114,46,105,0,64,0,0,41,3,114,3, - 0,0,0,218,6,103,101,116,99,119,100,114,43,0,0,0, - 41,1,114,35,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,5,0,0,0,218,11,95,112,97,116,104,95,105,115, - 100,105,114,92,0,0,0,115,6,0,0,0,0,2,4,1, - 8,1,114,46,0,0,0,105,182,1,0,0,99,3,0,0, - 0,0,0,0,0,6,0,0,0,17,0,0,0,67,0,0, - 0,115,162,0,0,0,100,1,106,0,124,0,116,1,124,0, - 131,1,131,2,125,3,116,2,106,3,124,3,116,2,106,4, - 116,2,106,5,66,0,116,2,106,6,66,0,124,2,100,2, - 64,0,131,3,125,4,121,50,116,7,106,8,124,4,100,3, - 131,2,143,16,125,5,124,5,106,9,124,1,131,1,1,0, - 87,0,100,4,81,0,82,0,88,0,116,2,106,10,124,3, - 124,0,131,2,1,0,87,0,110,58,4,0,116,11,107,10, - 114,156,1,0,1,0,1,0,121,14,116,2,106,12,124,3, - 131,1,1,0,87,0,110,20,4,0,116,11,107,10,114,148, - 1,0,1,0,1,0,89,0,110,2,88,0,130,0,89,0, - 110,2,88,0,100,4,83,0,41,5,122,162,66,101,115,116, - 45,101,102,102,111,114,116,32,102,117,110,99,116,105,111,110, - 32,116,111,32,119,114,105,116,101,32,100,97,116,97,32,116, - 111,32,97,32,112,97,116,104,32,97,116,111,109,105,99,97, - 108,108,121,46,10,32,32,32,32,66,101,32,112,114,101,112, - 97,114,101,100,32,116,111,32,104,97,110,100,108,101,32,97, - 32,70,105,108,101,69,120,105,115,116,115,69,114,114,111,114, - 32,105,102,32,99,111,110,99,117,114,114,101,110,116,32,119, - 114,105,116,105,110,103,32,111,102,32,116,104,101,10,32,32, - 32,32,116,101,109,112,111,114,97,114,121,32,102,105,108,101, - 32,105,115,32,97,116,116,101,109,112,116,101,100,46,122,5, - 123,125,46,123,125,105,182,1,0,0,90,2,119,98,78,41, - 13,218,6,102,111,114,109,97,116,218,2,105,100,114,3,0, - 0,0,90,4,111,112,101,110,90,6,79,95,69,88,67,76, - 90,7,79,95,67,82,69,65,84,90,8,79,95,87,82,79, - 78,76,89,218,3,95,105,111,218,6,70,105,108,101,73,79, - 218,5,119,114,105,116,101,218,7,114,101,112,108,97,99,101, - 114,40,0,0,0,90,6,117,110,108,105,110,107,41,6,114, - 35,0,0,0,218,4,100,97,116,97,114,42,0,0,0,90, - 8,112,97,116,104,95,116,109,112,90,2,102,100,218,4,102, - 105,108,101,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,218,13,95,119,114,105,116,101,95,97,116,111,109,105, - 99,99,0,0,0,115,26,0,0,0,0,5,16,1,6,1, - 26,1,2,3,14,1,20,1,16,1,14,1,2,1,14,1, - 14,1,6,1,114,55,0,0,0,105,43,13,0,0,233,2, - 0,0,0,114,13,0,0,0,115,2,0,0,0,13,10,90, - 11,95,95,112,121,99,97,99,104,101,95,95,122,4,111,112, - 116,45,122,3,46,112,121,122,4,46,112,121,99,78,218,12, - 111,112,116,105,109,105,122,97,116,105,111,110,99,2,0,0, - 0,1,0,0,0,11,0,0,0,6,0,0,0,67,0,0, - 0,115,234,0,0,0,124,1,100,1,107,9,114,52,116,0, - 106,1,100,2,116,2,131,2,1,0,124,2,100,1,107,9, - 114,40,100,3,125,3,116,3,124,3,131,1,130,1,124,1, - 114,48,100,4,110,2,100,5,125,2,116,4,124,0,131,1, - 92,2,125,4,125,5,124,5,106,5,100,6,131,1,92,3, - 125,6,125,7,125,8,116,6,106,7,106,8,125,9,124,9, - 100,1,107,8,114,104,116,9,100,7,131,1,130,1,100,4, - 106,10,124,6,114,116,124,6,110,2,124,8,124,7,124,9, - 103,3,131,1,125,10,124,2,100,1,107,8,114,162,116,6, - 106,11,106,12,100,8,107,2,114,154,100,4,125,2,110,8, - 116,6,106,11,106,12,125,2,116,13,124,2,131,1,125,2, - 124,2,100,4,107,3,114,214,124,2,106,14,131,0,115,200, - 116,15,100,9,106,16,124,2,131,1,131,1,130,1,100,10, - 106,16,124,10,116,17,124,2,131,3,125,10,116,18,124,4, - 116,19,124,10,116,20,100,8,25,0,23,0,131,3,83,0, - 41,11,97,254,2,0,0,71,105,118,101,110,32,116,104,101, - 32,112,97,116,104,32,116,111,32,97,32,46,112,121,32,102, - 105,108,101,44,32,114,101,116,117,114,110,32,116,104,101,32, - 112,97,116,104,32,116,111,32,105,116,115,32,46,112,121,99, - 32,102,105,108,101,46,10,10,32,32,32,32,84,104,101,32, - 46,112,121,32,102,105,108,101,32,100,111,101,115,32,110,111, - 116,32,110,101,101,100,32,116,111,32,101,120,105,115,116,59, - 32,116,104,105,115,32,115,105,109,112,108,121,32,114,101,116, - 117,114,110,115,32,116,104,101,32,112,97,116,104,32,116,111, - 32,116,104,101,10,32,32,32,32,46,112,121,99,32,102,105, - 108,101,32,99,97,108,99,117,108,97,116,101,100,32,97,115, - 32,105,102,32,116,104,101,32,46,112,121,32,102,105,108,101, - 32,119,101,114,101,32,105,109,112,111,114,116,101,100,46,10, - 10,32,32,32,32,84,104,101,32,39,111,112,116,105,109,105, - 122,97,116,105,111,110,39,32,112,97,114,97,109,101,116,101, - 114,32,99,111,110,116,114,111,108,115,32,116,104,101,32,112, - 114,101,115,117,109,101,100,32,111,112,116,105,109,105,122,97, - 116,105,111,110,32,108,101,118,101,108,32,111,102,10,32,32, - 32,32,116,104,101,32,98,121,116,101,99,111,100,101,32,102, - 105,108,101,46,32,73,102,32,39,111,112,116,105,109,105,122, - 97,116,105,111,110,39,32,105,115,32,110,111,116,32,78,111, - 110,101,44,32,116,104,101,32,115,116,114,105,110,103,32,114, - 101,112,114,101,115,101,110,116,97,116,105,111,110,10,32,32, - 32,32,111,102,32,116,104,101,32,97,114,103,117,109,101,110, - 116,32,105,115,32,116,97,107,101,110,32,97,110,100,32,118, - 101,114,105,102,105,101,100,32,116,111,32,98,101,32,97,108, - 112,104,97,110,117,109,101,114,105,99,32,40,101,108,115,101, - 32,86,97,108,117,101,69,114,114,111,114,10,32,32,32,32, - 105,115,32,114,97,105,115,101,100,41,46,10,10,32,32,32, - 32,84,104,101,32,100,101,98,117,103,95,111,118,101,114,114, - 105,100,101,32,112,97,114,97,109,101,116,101,114,32,105,115, - 32,100,101,112,114,101,99,97,116,101,100,46,32,73,102,32, - 100,101,98,117,103,95,111,118,101,114,114,105,100,101,32,105, - 115,32,110,111,116,32,78,111,110,101,44,10,32,32,32,32, - 97,32,84,114,117,101,32,118,97,108,117,101,32,105,115,32, - 116,104,101,32,115,97,109,101,32,97,115,32,115,101,116,116, - 105,110,103,32,39,111,112,116,105,109,105,122,97,116,105,111, - 110,39,32,116,111,32,116,104,101,32,101,109,112,116,121,32, - 115,116,114,105,110,103,10,32,32,32,32,119,104,105,108,101, - 32,97,32,70,97,108,115,101,32,118,97,108,117,101,32,105, - 115,32,101,113,117,105,118,97,108,101,110,116,32,116,111,32, - 115,101,116,116,105,110,103,32,39,111,112,116,105,109,105,122, - 97,116,105,111,110,39,32,116,111,32,39,49,39,46,10,10, - 32,32,32,32,73,102,32,115,121,115,46,105,109,112,108,101, - 109,101,110,116,97,116,105,111,110,46,99,97,99,104,101,95, - 116,97,103,32,105,115,32,78,111,110,101,32,116,104,101,110, - 32,78,111,116,73,109,112,108,101,109,101,110,116,101,100,69, - 114,114,111,114,32,105,115,32,114,97,105,115,101,100,46,10, - 10,32,32,32,32,78,122,70,116,104,101,32,100,101,98,117, - 103,95,111,118,101,114,114,105,100,101,32,112,97,114,97,109, - 101,116,101,114,32,105,115,32,100,101,112,114,101,99,97,116, - 101,100,59,32,117,115,101,32,39,111,112,116,105,109,105,122, - 97,116,105,111,110,39,32,105,110,115,116,101,97,100,122,50, - 100,101,98,117,103,95,111,118,101,114,114,105,100,101,32,111, - 114,32,111,112,116,105,109,105,122,97,116,105,111,110,32,109, - 117,115,116,32,98,101,32,115,101,116,32,116,111,32,78,111, - 110,101,114,30,0,0,0,114,29,0,0,0,218,1,46,122, - 36,115,121,115,46,105,109,112,108,101,109,101,110,116,97,116, - 105,111,110,46,99,97,99,104,101,95,116,97,103,32,105,115, - 32,78,111,110,101,233,0,0,0,0,122,24,123,33,114,125, - 32,105,115,32,110,111,116,32,97,108,112,104,97,110,117,109, - 101,114,105,99,122,7,123,125,46,123,125,123,125,41,21,218, - 9,95,119,97,114,110,105,110,103,115,218,4,119,97,114,110, - 218,18,68,101,112,114,101,99,97,116,105,111,110,87,97,114, - 110,105,110,103,218,9,84,121,112,101,69,114,114,111,114,114, - 38,0,0,0,114,32,0,0,0,114,7,0,0,0,218,14, - 105,109,112,108,101,109,101,110,116,97,116,105,111,110,218,9, - 99,97,99,104,101,95,116,97,103,218,19,78,111,116,73,109, - 112,108,101,109,101,110,116,101,100,69,114,114,111,114,114,26, - 0,0,0,218,5,102,108,97,103,115,218,8,111,112,116,105, - 109,105,122,101,218,3,115,116,114,218,7,105,115,97,108,110, - 117,109,218,10,86,97,108,117,101,69,114,114,111,114,114,47, - 0,0,0,218,4,95,79,80,84,114,28,0,0,0,218,8, - 95,80,89,67,65,67,72,69,218,17,66,89,84,69,67,79, - 68,69,95,83,85,70,70,73,88,69,83,41,11,114,35,0, - 0,0,90,14,100,101,98,117,103,95,111,118,101,114,114,105, - 100,101,114,57,0,0,0,218,7,109,101,115,115,97,103,101, - 218,4,104,101,97,100,114,37,0,0,0,90,4,98,97,115, - 101,218,3,115,101,112,218,4,114,101,115,116,90,3,116,97, - 103,90,15,97,108,109,111,115,116,95,102,105,108,101,110,97, - 109,101,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,218,17,99,97,99,104,101,95,102,114,111,109,95,115,111, - 117,114,99,101,247,0,0,0,115,46,0,0,0,0,18,8, - 1,6,1,6,1,8,1,4,1,8,1,12,1,12,1,16, - 1,8,1,8,1,8,1,24,1,8,1,12,1,6,2,8, - 1,8,1,8,1,8,1,14,1,14,1,114,79,0,0,0, - 99,1,0,0,0,0,0,0,0,8,0,0,0,5,0,0, - 0,67,0,0,0,115,220,0,0,0,116,0,106,1,106,2, - 100,1,107,8,114,20,116,3,100,2,131,1,130,1,116,4, - 124,0,131,1,92,2,125,1,125,2,116,4,124,1,131,1, - 92,2,125,1,125,3,124,3,116,5,107,3,114,68,116,6, - 100,3,106,7,116,5,124,0,131,2,131,1,130,1,124,2, - 106,8,100,4,131,1,125,4,124,4,100,11,107,7,114,102, - 116,6,100,7,106,7,124,2,131,1,131,1,130,1,110,86, - 124,4,100,6,107,2,114,188,124,2,106,9,100,4,100,5, - 131,2,100,12,25,0,125,5,124,5,106,10,116,11,131,1, - 115,150,116,6,100,8,106,7,116,11,131,1,131,1,130,1, - 124,5,116,12,116,11,131,1,100,1,133,2,25,0,125,6, - 124,6,106,13,131,0,115,188,116,6,100,9,106,7,124,5, - 131,1,131,1,130,1,124,2,106,14,100,4,131,1,100,10, - 25,0,125,7,116,15,124,1,124,7,116,16,100,10,25,0, - 23,0,131,2,83,0,41,13,97,110,1,0,0,71,105,118, + 0,115,10,0,0,0,116,0,106,1,124,0,131,1,83,0, + 41,1,122,126,83,116,97,116,32,116,104,101,32,112,97,116, + 104,46,10,10,32,32,32,32,77,97,100,101,32,97,32,115, + 101,112,97,114,97,116,101,32,102,117,110,99,116,105,111,110, + 32,116,111,32,109,97,107,101,32,105,116,32,101,97,115,105, + 101,114,32,116,111,32,111,118,101,114,114,105,100,101,32,105, + 110,32,101,120,112,101,114,105,109,101,110,116,115,10,32,32, + 32,32,40,101,46,103,46,32,99,97,99,104,101,32,115,116, + 97,116,32,114,101,115,117,108,116,115,41,46,10,10,32,32, + 32,32,41,2,114,3,0,0,0,90,4,115,116,97,116,41, + 1,114,35,0,0,0,114,4,0,0,0,114,4,0,0,0, + 114,5,0,0,0,218,10,95,112,97,116,104,95,115,116,97, + 116,68,0,0,0,115,2,0,0,0,0,7,114,39,0,0, + 0,99,2,0,0,0,0,0,0,0,3,0,0,0,11,0, + 0,0,67,0,0,0,115,48,0,0,0,121,12,116,0,124, + 0,131,1,125,2,87,0,110,20,4,0,116,1,107,10,114, + 32,1,0,1,0,1,0,100,1,83,0,88,0,124,2,106, + 2,100,2,64,0,124,1,107,2,83,0,41,3,122,49,84, + 101,115,116,32,119,104,101,116,104,101,114,32,116,104,101,32, + 112,97,116,104,32,105,115,32,116,104,101,32,115,112,101,99, + 105,102,105,101,100,32,109,111,100,101,32,116,121,112,101,46, + 70,105,0,240,0,0,41,3,114,39,0,0,0,218,7,79, + 83,69,114,114,111,114,218,7,115,116,95,109,111,100,101,41, + 3,114,35,0,0,0,218,4,109,111,100,101,90,9,115,116, + 97,116,95,105,110,102,111,114,4,0,0,0,114,4,0,0, + 0,114,5,0,0,0,218,18,95,112,97,116,104,95,105,115, + 95,109,111,100,101,95,116,121,112,101,78,0,0,0,115,10, + 0,0,0,0,2,2,1,12,1,14,1,6,1,114,43,0, + 0,0,99,1,0,0,0,0,0,0,0,1,0,0,0,3, + 0,0,0,67,0,0,0,115,10,0,0,0,116,0,124,0, + 100,1,131,2,83,0,41,2,122,31,82,101,112,108,97,99, + 101,109,101,110,116,32,102,111,114,32,111,115,46,112,97,116, + 104,46,105,115,102,105,108,101,46,105,0,128,0,0,41,1, + 114,43,0,0,0,41,1,114,35,0,0,0,114,4,0,0, + 0,114,4,0,0,0,114,5,0,0,0,218,12,95,112,97, + 116,104,95,105,115,102,105,108,101,87,0,0,0,115,2,0, + 0,0,0,2,114,44,0,0,0,99,1,0,0,0,0,0, + 0,0,1,0,0,0,3,0,0,0,67,0,0,0,115,22, + 0,0,0,124,0,115,12,116,0,106,1,131,0,125,0,116, + 2,124,0,100,1,131,2,83,0,41,2,122,30,82,101,112, + 108,97,99,101,109,101,110,116,32,102,111,114,32,111,115,46, + 112,97,116,104,46,105,115,100,105,114,46,105,0,64,0,0, + 41,3,114,3,0,0,0,218,6,103,101,116,99,119,100,114, + 43,0,0,0,41,1,114,35,0,0,0,114,4,0,0,0, + 114,4,0,0,0,114,5,0,0,0,218,11,95,112,97,116, + 104,95,105,115,100,105,114,92,0,0,0,115,6,0,0,0, + 0,2,4,1,8,1,114,46,0,0,0,233,182,1,0,0, + 99,3,0,0,0,0,0,0,0,6,0,0,0,17,0,0, + 0,67,0,0,0,115,162,0,0,0,100,1,106,0,124,0, + 116,1,124,0,131,1,131,2,125,3,116,2,106,3,124,3, + 116,2,106,4,116,2,106,5,66,0,116,2,106,6,66,0, + 124,2,100,2,64,0,131,3,125,4,121,50,116,7,106,8, + 124,4,100,3,131,2,143,16,125,5,124,5,106,9,124,1, + 131,1,1,0,87,0,100,4,81,0,82,0,88,0,116,2, + 106,10,124,3,124,0,131,2,1,0,87,0,110,58,4,0, + 116,11,107,10,114,156,1,0,1,0,1,0,121,14,116,2, + 106,12,124,3,131,1,1,0,87,0,110,20,4,0,116,11, + 107,10,114,148,1,0,1,0,1,0,89,0,110,2,88,0, + 130,0,89,0,110,2,88,0,100,4,83,0,41,5,122,162, + 66,101,115,116,45,101,102,102,111,114,116,32,102,117,110,99, + 116,105,111,110,32,116,111,32,119,114,105,116,101,32,100,97, + 116,97,32,116,111,32,97,32,112,97,116,104,32,97,116,111, + 109,105,99,97,108,108,121,46,10,32,32,32,32,66,101,32, + 112,114,101,112,97,114,101,100,32,116,111,32,104,97,110,100, + 108,101,32,97,32,70,105,108,101,69,120,105,115,116,115,69, + 114,114,111,114,32,105,102,32,99,111,110,99,117,114,114,101, + 110,116,32,119,114,105,116,105,110,103,32,111,102,32,116,104, + 101,10,32,32,32,32,116,101,109,112,111,114,97,114,121,32, + 102,105,108,101,32,105,115,32,97,116,116,101,109,112,116,101, + 100,46,122,5,123,125,46,123,125,105,182,1,0,0,90,2, + 119,98,78,41,13,218,6,102,111,114,109,97,116,218,2,105, + 100,114,3,0,0,0,90,4,111,112,101,110,90,6,79,95, + 69,88,67,76,90,7,79,95,67,82,69,65,84,90,8,79, + 95,87,82,79,78,76,89,218,3,95,105,111,218,6,70,105, + 108,101,73,79,218,5,119,114,105,116,101,218,7,114,101,112, + 108,97,99,101,114,40,0,0,0,90,6,117,110,108,105,110, + 107,41,6,114,35,0,0,0,218,4,100,97,116,97,114,42, + 0,0,0,90,8,112,97,116,104,95,116,109,112,90,2,102, + 100,218,4,102,105,108,101,114,4,0,0,0,114,4,0,0, + 0,114,5,0,0,0,218,13,95,119,114,105,116,101,95,97, + 116,111,109,105,99,99,0,0,0,115,26,0,0,0,0,5, + 16,1,6,1,26,1,2,3,14,1,20,1,16,1,14,1, + 2,1,14,1,14,1,6,1,114,56,0,0,0,105,44,13, + 0,0,233,2,0,0,0,114,13,0,0,0,115,2,0,0, + 0,13,10,90,11,95,95,112,121,99,97,99,104,101,95,95, + 122,4,111,112,116,45,122,3,46,112,121,122,4,46,112,121, + 99,78,41,1,218,12,111,112,116,105,109,105,122,97,116,105, + 111,110,99,2,0,0,0,1,0,0,0,11,0,0,0,6, + 0,0,0,67,0,0,0,115,234,0,0,0,124,1,100,1, + 107,9,114,52,116,0,106,1,100,2,116,2,131,2,1,0, + 124,2,100,1,107,9,114,40,100,3,125,3,116,3,124,3, + 131,1,130,1,124,1,114,48,100,4,110,2,100,5,125,2, + 116,4,124,0,131,1,92,2,125,4,125,5,124,5,106,5, + 100,6,131,1,92,3,125,6,125,7,125,8,116,6,106,7, + 106,8,125,9,124,9,100,1,107,8,114,104,116,9,100,7, + 131,1,130,1,100,4,106,10,124,6,114,116,124,6,110,2, + 124,8,124,7,124,9,103,3,131,1,125,10,124,2,100,1, + 107,8,114,162,116,6,106,11,106,12,100,8,107,2,114,154, + 100,4,125,2,110,8,116,6,106,11,106,12,125,2,116,13, + 124,2,131,1,125,2,124,2,100,4,107,3,114,214,124,2, + 106,14,131,0,115,200,116,15,100,9,106,16,124,2,131,1, + 131,1,130,1,100,10,106,16,124,10,116,17,124,2,131,3, + 125,10,116,18,124,4,116,19,124,10,116,20,100,8,25,0, + 23,0,131,3,83,0,41,11,97,254,2,0,0,71,105,118, 101,110,32,116,104,101,32,112,97,116,104,32,116,111,32,97, - 32,46,112,121,99,46,32,102,105,108,101,44,32,114,101,116, - 117,114,110,32,116,104,101,32,112,97,116,104,32,116,111,32, - 105,116,115,32,46,112,121,32,102,105,108,101,46,10,10,32, - 32,32,32,84,104,101,32,46,112,121,99,32,102,105,108,101, - 32,100,111,101,115,32,110,111,116,32,110,101,101,100,32,116, - 111,32,101,120,105,115,116,59,32,116,104,105,115,32,115,105, - 109,112,108,121,32,114,101,116,117,114,110,115,32,116,104,101, - 32,112,97,116,104,32,116,111,10,32,32,32,32,116,104,101, - 32,46,112,121,32,102,105,108,101,32,99,97,108,99,117,108, - 97,116,101,100,32,116,111,32,99,111,114,114,101,115,112,111, - 110,100,32,116,111,32,116,104,101,32,46,112,121,99,32,102, - 105,108,101,46,32,32,73,102,32,112,97,116,104,32,100,111, - 101,115,10,32,32,32,32,110,111,116,32,99,111,110,102,111, - 114,109,32,116,111,32,80,69,80,32,51,49,52,55,47,52, - 56,56,32,102,111,114,109,97,116,44,32,86,97,108,117,101, - 69,114,114,111,114,32,119,105,108,108,32,98,101,32,114,97, - 105,115,101,100,46,32,73,102,10,32,32,32,32,115,121,115, + 32,46,112,121,32,102,105,108,101,44,32,114,101,116,117,114, + 110,32,116,104,101,32,112,97,116,104,32,116,111,32,105,116, + 115,32,46,112,121,99,32,102,105,108,101,46,10,10,32,32, + 32,32,84,104,101,32,46,112,121,32,102,105,108,101,32,100, + 111,101,115,32,110,111,116,32,110,101,101,100,32,116,111,32, + 101,120,105,115,116,59,32,116,104,105,115,32,115,105,109,112, + 108,121,32,114,101,116,117,114,110,115,32,116,104,101,32,112, + 97,116,104,32,116,111,32,116,104,101,10,32,32,32,32,46, + 112,121,99,32,102,105,108,101,32,99,97,108,99,117,108,97, + 116,101,100,32,97,115,32,105,102,32,116,104,101,32,46,112, + 121,32,102,105,108,101,32,119,101,114,101,32,105,109,112,111, + 114,116,101,100,46,10,10,32,32,32,32,84,104,101,32,39, + 111,112,116,105,109,105,122,97,116,105,111,110,39,32,112,97, + 114,97,109,101,116,101,114,32,99,111,110,116,114,111,108,115, + 32,116,104,101,32,112,114,101,115,117,109,101,100,32,111,112, + 116,105,109,105,122,97,116,105,111,110,32,108,101,118,101,108, + 32,111,102,10,32,32,32,32,116,104,101,32,98,121,116,101, + 99,111,100,101,32,102,105,108,101,46,32,73,102,32,39,111, + 112,116,105,109,105,122,97,116,105,111,110,39,32,105,115,32, + 110,111,116,32,78,111,110,101,44,32,116,104,101,32,115,116, + 114,105,110,103,32,114,101,112,114,101,115,101,110,116,97,116, + 105,111,110,10,32,32,32,32,111,102,32,116,104,101,32,97, + 114,103,117,109,101,110,116,32,105,115,32,116,97,107,101,110, + 32,97,110,100,32,118,101,114,105,102,105,101,100,32,116,111, + 32,98,101,32,97,108,112,104,97,110,117,109,101,114,105,99, + 32,40,101,108,115,101,32,86,97,108,117,101,69,114,114,111, + 114,10,32,32,32,32,105,115,32,114,97,105,115,101,100,41, + 46,10,10,32,32,32,32,84,104,101,32,100,101,98,117,103, + 95,111,118,101,114,114,105,100,101,32,112,97,114,97,109,101, + 116,101,114,32,105,115,32,100,101,112,114,101,99,97,116,101, + 100,46,32,73,102,32,100,101,98,117,103,95,111,118,101,114, + 114,105,100,101,32,105,115,32,110,111,116,32,78,111,110,101, + 44,10,32,32,32,32,97,32,84,114,117,101,32,118,97,108, + 117,101,32,105,115,32,116,104,101,32,115,97,109,101,32,97, + 115,32,115,101,116,116,105,110,103,32,39,111,112,116,105,109, + 105,122,97,116,105,111,110,39,32,116,111,32,116,104,101,32, + 101,109,112,116,121,32,115,116,114,105,110,103,10,32,32,32, + 32,119,104,105,108,101,32,97,32,70,97,108,115,101,32,118, + 97,108,117,101,32,105,115,32,101,113,117,105,118,97,108,101, + 110,116,32,116,111,32,115,101,116,116,105,110,103,32,39,111, + 112,116,105,109,105,122,97,116,105,111,110,39,32,116,111,32, + 39,49,39,46,10,10,32,32,32,32,73,102,32,115,121,115, 46,105,109,112,108,101,109,101,110,116,97,116,105,111,110,46, 99,97,99,104,101,95,116,97,103,32,105,115,32,78,111,110, 101,32,116,104,101,110,32,78,111,116,73,109,112,108,101,109, 101,110,116,101,100,69,114,114,111,114,32,105,115,32,114,97, - 105,115,101,100,46,10,10,32,32,32,32,78,122,36,115,121, - 115,46,105,109,112,108,101,109,101,110,116,97,116,105,111,110, - 46,99,97,99,104,101,95,116,97,103,32,105,115,32,78,111, - 110,101,122,37,123,125,32,110,111,116,32,98,111,116,116,111, - 109,45,108,101,118,101,108,32,100,105,114,101,99,116,111,114, - 121,32,105,110,32,123,33,114,125,114,58,0,0,0,114,56, - 0,0,0,233,3,0,0,0,122,33,101,120,112,101,99,116, - 101,100,32,111,110,108,121,32,50,32,111,114,32,51,32,100, - 111,116,115,32,105,110,32,123,33,114,125,122,57,111,112,116, - 105,109,105,122,97,116,105,111,110,32,112,111,114,116,105,111, - 110,32,111,102,32,102,105,108,101,110,97,109,101,32,100,111, - 101,115,32,110,111,116,32,115,116,97,114,116,32,119,105,116, - 104,32,123,33,114,125,122,52,111,112,116,105,109,105,122,97, - 116,105,111,110,32,108,101,118,101,108,32,123,33,114,125,32, - 105,115,32,110,111,116,32,97,110,32,97,108,112,104,97,110, - 117,109,101,114,105,99,32,118,97,108,117,101,114,59,0,0, - 0,62,2,0,0,0,114,56,0,0,0,114,80,0,0,0, - 233,254,255,255,255,41,17,114,7,0,0,0,114,64,0,0, - 0,114,65,0,0,0,114,66,0,0,0,114,38,0,0,0, - 114,73,0,0,0,114,71,0,0,0,114,47,0,0,0,218, - 5,99,111,117,110,116,114,34,0,0,0,114,9,0,0,0, - 114,72,0,0,0,114,31,0,0,0,114,70,0,0,0,218, - 9,112,97,114,116,105,116,105,111,110,114,28,0,0,0,218, - 15,83,79,85,82,67,69,95,83,85,70,70,73,88,69,83, - 41,8,114,35,0,0,0,114,76,0,0,0,90,16,112,121, - 99,97,99,104,101,95,102,105,108,101,110,97,109,101,90,7, - 112,121,99,97,99,104,101,90,9,100,111,116,95,99,111,117, - 110,116,114,57,0,0,0,90,9,111,112,116,95,108,101,118, - 101,108,90,13,98,97,115,101,95,102,105,108,101,110,97,109, - 101,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 218,17,115,111,117,114,99,101,95,102,114,111,109,95,99,97, - 99,104,101,35,1,0,0,115,44,0,0,0,0,9,12,1, - 8,1,12,1,12,1,8,1,6,1,10,1,10,1,8,1, - 6,1,10,1,8,1,16,1,10,1,6,1,8,1,16,1, - 8,1,6,1,8,1,14,1,114,85,0,0,0,99,1,0, - 0,0,0,0,0,0,5,0,0,0,12,0,0,0,67,0, - 0,0,115,128,0,0,0,116,0,124,0,131,1,100,1,107, - 2,114,16,100,2,83,0,124,0,106,1,100,3,131,1,92, - 3,125,1,125,2,125,3,124,1,12,0,115,58,124,3,106, - 2,131,0,100,7,100,8,133,2,25,0,100,6,107,3,114, - 62,124,0,83,0,121,12,116,3,124,0,131,1,125,4,87, - 0,110,36,4,0,116,4,116,5,102,2,107,10,114,110,1, - 0,1,0,1,0,124,0,100,2,100,9,133,2,25,0,125, - 4,89,0,110,2,88,0,116,6,124,4,131,1,114,124,124, - 4,83,0,124,0,83,0,41,10,122,188,67,111,110,118,101, - 114,116,32,97,32,98,121,116,101,99,111,100,101,32,102,105, - 108,101,32,112,97,116,104,32,116,111,32,97,32,115,111,117, - 114,99,101,32,112,97,116,104,32,40,105,102,32,112,111,115, - 115,105,98,108,101,41,46,10,10,32,32,32,32,84,104,105, - 115,32,102,117,110,99,116,105,111,110,32,101,120,105,115,116, - 115,32,112,117,114,101,108,121,32,102,111,114,32,98,97,99, - 107,119,97,114,100,115,45,99,111,109,112,97,116,105,98,105, - 108,105,116,121,32,102,111,114,10,32,32,32,32,80,121,73, - 109,112,111,114,116,95,69,120,101,99,67,111,100,101,77,111, - 100,117,108,101,87,105,116,104,70,105,108,101,110,97,109,101, - 115,40,41,32,105,110,32,116,104,101,32,67,32,65,80,73, - 46,10,10,32,32,32,32,114,59,0,0,0,78,114,58,0, - 0,0,114,80,0,0,0,114,29,0,0,0,90,2,112,121, - 233,253,255,255,255,233,255,255,255,255,114,87,0,0,0,41, - 7,114,31,0,0,0,114,32,0,0,0,218,5,108,111,119, - 101,114,114,85,0,0,0,114,66,0,0,0,114,71,0,0, - 0,114,44,0,0,0,41,5,218,13,98,121,116,101,99,111, - 100,101,95,112,97,116,104,114,78,0,0,0,114,36,0,0, - 0,90,9,101,120,116,101,110,115,105,111,110,218,11,115,111, - 117,114,99,101,95,112,97,116,104,114,4,0,0,0,114,4, - 0,0,0,114,5,0,0,0,218,15,95,103,101,116,95,115, - 111,117,114,99,101,102,105,108,101,68,1,0,0,115,20,0, - 0,0,0,7,12,1,4,1,16,1,26,1,4,1,2,1, - 12,1,18,1,18,1,114,91,0,0,0,99,1,0,0,0, - 0,0,0,0,1,0,0,0,11,0,0,0,67,0,0,0, - 115,74,0,0,0,124,0,106,0,116,1,116,2,131,1,131, - 1,114,46,121,8,116,3,124,0,131,1,83,0,4,0,116, - 4,107,10,114,42,1,0,1,0,1,0,89,0,113,70,88, - 0,110,24,124,0,106,0,116,1,116,5,131,1,131,1,114, - 66,124,0,83,0,110,4,100,0,83,0,100,0,83,0,41, - 1,78,41,6,218,8,101,110,100,115,119,105,116,104,218,5, - 116,117,112,108,101,114,84,0,0,0,114,79,0,0,0,114, - 66,0,0,0,114,74,0,0,0,41,1,218,8,102,105,108, - 101,110,97,109,101,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,218,11,95,103,101,116,95,99,97,99,104,101, - 100,87,1,0,0,115,16,0,0,0,0,1,14,1,2,1, - 8,1,14,1,8,1,14,1,6,2,114,95,0,0,0,99, - 1,0,0,0,0,0,0,0,2,0,0,0,11,0,0,0, - 67,0,0,0,115,52,0,0,0,121,14,116,0,124,0,131, - 1,106,1,125,1,87,0,110,24,4,0,116,2,107,10,114, - 38,1,0,1,0,1,0,100,1,125,1,89,0,110,2,88, - 0,124,1,100,2,79,0,125,1,124,1,83,0,41,3,122, - 51,67,97,108,99,117,108,97,116,101,32,116,104,101,32,109, - 111,100,101,32,112,101,114,109,105,115,115,105,111,110,115,32, - 102,111,114,32,97,32,98,121,116,101,99,111,100,101,32,102, - 105,108,101,46,105,182,1,0,0,233,128,0,0,0,41,3, - 114,39,0,0,0,114,41,0,0,0,114,40,0,0,0,41, - 2,114,35,0,0,0,114,42,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,218,10,95,99,97,108, - 99,95,109,111,100,101,99,1,0,0,115,12,0,0,0,0, - 2,2,1,14,1,14,1,10,3,8,1,114,97,0,0,0, - 99,1,0,0,0,0,0,0,0,3,0,0,0,11,0,0, - 0,3,0,0,0,115,68,0,0,0,100,1,135,0,102,1, - 100,2,100,3,134,1,125,1,121,10,116,0,106,1,125,2, - 87,0,110,28,4,0,116,2,107,10,114,52,1,0,1,0, - 1,0,100,4,100,5,132,0,125,2,89,0,110,2,88,0, - 124,2,124,1,136,0,131,2,1,0,124,1,83,0,41,6, - 122,252,68,101,99,111,114,97,116,111,114,32,116,111,32,118, - 101,114,105,102,121,32,116,104,97,116,32,116,104,101,32,109, - 111,100,117,108,101,32,98,101,105,110,103,32,114,101,113,117, - 101,115,116,101,100,32,109,97,116,99,104,101,115,32,116,104, - 101,32,111,110,101,32,116,104,101,10,32,32,32,32,108,111, - 97,100,101,114,32,99,97,110,32,104,97,110,100,108,101,46, - 10,10,32,32,32,32,84,104,101,32,102,105,114,115,116,32, - 97,114,103,117,109,101,110,116,32,40,115,101,108,102,41,32, - 109,117,115,116,32,100,101,102,105,110,101,32,95,110,97,109, - 101,32,119,104,105,99,104,32,116,104,101,32,115,101,99,111, - 110,100,32,97,114,103,117,109,101,110,116,32,105,115,10,32, - 32,32,32,99,111,109,112,97,114,101,100,32,97,103,97,105, - 110,115,116,46,32,73,102,32,116,104,101,32,99,111,109,112, - 97,114,105,115,111,110,32,102,97,105,108,115,32,116,104,101, - 110,32,73,109,112,111,114,116,69,114,114,111,114,32,105,115, - 32,114,97,105,115,101,100,46,10,10,32,32,32,32,78,99, - 2,0,0,0,0,0,0,0,4,0,0,0,5,0,0,0, - 31,0,0,0,115,64,0,0,0,124,1,100,0,107,8,114, - 16,124,0,106,0,125,1,110,34,124,0,106,0,124,1,107, - 3,114,50,116,1,100,1,124,0,106,0,124,1,102,2,22, - 0,100,2,124,1,144,1,131,1,130,1,136,0,124,0,124, - 1,124,2,124,3,142,2,83,0,41,3,78,122,30,108,111, - 97,100,101,114,32,102,111,114,32,37,115,32,99,97,110,110, - 111,116,32,104,97,110,100,108,101,32,37,115,218,4,110,97, - 109,101,41,2,114,98,0,0,0,218,11,73,109,112,111,114, - 116,69,114,114,111,114,41,4,218,4,115,101,108,102,114,98, - 0,0,0,218,4,97,114,103,115,90,6,107,119,97,114,103, - 115,41,1,218,6,109,101,116,104,111,100,114,4,0,0,0, - 114,5,0,0,0,218,19,95,99,104,101,99,107,95,110,97, - 109,101,95,119,114,97,112,112,101,114,119,1,0,0,115,12, - 0,0,0,0,1,8,1,8,1,10,1,4,1,20,1,122, - 40,95,99,104,101,99,107,95,110,97,109,101,46,60,108,111, - 99,97,108,115,62,46,95,99,104,101,99,107,95,110,97,109, - 101,95,119,114,97,112,112,101,114,99,2,0,0,0,0,0, - 0,0,3,0,0,0,7,0,0,0,83,0,0,0,115,60, - 0,0,0,120,40,100,5,68,0,93,32,125,2,116,0,124, - 1,124,2,131,2,114,6,116,1,124,0,124,2,116,2,124, - 1,124,2,131,2,131,3,1,0,113,6,87,0,124,0,106, - 3,106,4,124,1,106,3,131,1,1,0,100,0,83,0,41, - 6,78,218,10,95,95,109,111,100,117,108,101,95,95,218,8, - 95,95,110,97,109,101,95,95,218,12,95,95,113,117,97,108, - 110,97,109,101,95,95,218,7,95,95,100,111,99,95,95,41, - 4,122,10,95,95,109,111,100,117,108,101,95,95,122,8,95, - 95,110,97,109,101,95,95,122,12,95,95,113,117,97,108,110, - 97,109,101,95,95,122,7,95,95,100,111,99,95,95,41,5, - 218,7,104,97,115,97,116,116,114,218,7,115,101,116,97,116, - 116,114,218,7,103,101,116,97,116,116,114,218,8,95,95,100, - 105,99,116,95,95,218,6,117,112,100,97,116,101,41,3,90, - 3,110,101,119,90,3,111,108,100,114,52,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,5,0,0,0,218,5,95, - 119,114,97,112,130,1,0,0,115,8,0,0,0,0,1,10, - 1,10,1,22,1,122,26,95,99,104,101,99,107,95,110,97, - 109,101,46,60,108,111,99,97,108,115,62,46,95,119,114,97, - 112,41,3,218,10,95,98,111,111,116,115,116,114,97,112,114, - 113,0,0,0,218,9,78,97,109,101,69,114,114,111,114,41, - 3,114,102,0,0,0,114,103,0,0,0,114,113,0,0,0, - 114,4,0,0,0,41,1,114,102,0,0,0,114,5,0,0, - 0,218,11,95,99,104,101,99,107,95,110,97,109,101,111,1, - 0,0,115,14,0,0,0,0,8,14,7,2,1,10,1,14, - 2,14,5,10,1,114,116,0,0,0,99,2,0,0,0,0, - 0,0,0,5,0,0,0,4,0,0,0,67,0,0,0,115, - 60,0,0,0,124,0,106,0,124,1,131,1,92,2,125,2, - 125,3,124,2,100,1,107,8,114,56,116,1,124,3,131,1, - 114,56,100,2,125,4,116,2,106,3,124,4,106,4,124,3, - 100,3,25,0,131,1,116,5,131,2,1,0,124,2,83,0, - 41,4,122,155,84,114,121,32,116,111,32,102,105,110,100,32, - 97,32,108,111,97,100,101,114,32,102,111,114,32,116,104,101, - 32,115,112,101,99,105,102,105,101,100,32,109,111,100,117,108, - 101,32,98,121,32,100,101,108,101,103,97,116,105,110,103,32, - 116,111,10,32,32,32,32,115,101,108,102,46,102,105,110,100, - 95,108,111,97,100,101,114,40,41,46,10,10,32,32,32,32, - 84,104,105,115,32,109,101,116,104,111,100,32,105,115,32,100, - 101,112,114,101,99,97,116,101,100,32,105,110,32,102,97,118, - 111,114,32,111,102,32,102,105,110,100,101,114,46,102,105,110, - 100,95,115,112,101,99,40,41,46,10,10,32,32,32,32,78, - 122,44,78,111,116,32,105,109,112,111,114,116,105,110,103,32, - 100,105,114,101,99,116,111,114,121,32,123,125,58,32,109,105, - 115,115,105,110,103,32,95,95,105,110,105,116,95,95,114,59, - 0,0,0,41,6,218,11,102,105,110,100,95,108,111,97,100, - 101,114,114,31,0,0,0,114,60,0,0,0,114,61,0,0, - 0,114,47,0,0,0,218,13,73,109,112,111,114,116,87,97, - 114,110,105,110,103,41,5,114,100,0,0,0,218,8,102,117, - 108,108,110,97,109,101,218,6,108,111,97,100,101,114,218,8, - 112,111,114,116,105,111,110,115,218,3,109,115,103,114,4,0, - 0,0,114,4,0,0,0,114,5,0,0,0,218,17,95,102, - 105,110,100,95,109,111,100,117,108,101,95,115,104,105,109,139, - 1,0,0,115,10,0,0,0,0,10,14,1,16,1,4,1, - 22,1,114,123,0,0,0,99,4,0,0,0,0,0,0,0, - 11,0,0,0,19,0,0,0,67,0,0,0,115,128,1,0, - 0,105,0,125,4,124,2,100,1,107,9,114,22,124,2,124, - 4,100,2,60,0,110,4,100,3,125,2,124,3,100,1,107, - 9,114,42,124,3,124,4,100,4,60,0,124,0,100,1,100, - 5,133,2,25,0,125,5,124,0,100,5,100,6,133,2,25, - 0,125,6,124,0,100,6,100,7,133,2,25,0,125,7,124, - 5,116,0,107,3,114,122,100,8,106,1,124,2,124,5,131, - 2,125,8,116,2,106,3,100,9,124,8,131,2,1,0,116, - 4,124,8,124,4,141,1,130,1,110,86,116,5,124,6,131, - 1,100,5,107,3,114,166,100,10,106,1,124,2,131,1,125, - 8,116,2,106,3,100,9,124,8,131,2,1,0,116,6,124, - 8,131,1,130,1,110,42,116,5,124,7,131,1,100,5,107, - 3,114,208,100,11,106,1,124,2,131,1,125,8,116,2,106, - 3,100,9,124,8,131,2,1,0,116,6,124,8,131,1,130, - 1,124,1,100,1,107,9,144,1,114,116,121,16,116,7,124, - 1,100,12,25,0,131,1,125,9,87,0,110,20,4,0,116, - 8,107,10,114,254,1,0,1,0,1,0,89,0,110,48,88, - 0,116,9,124,6,131,1,124,9,107,3,144,1,114,46,100, - 13,106,1,124,2,131,1,125,8,116,2,106,3,100,9,124, - 8,131,2,1,0,116,4,124,8,124,4,141,1,130,1,121, - 16,124,1,100,14,25,0,100,15,64,0,125,10,87,0,110, - 22,4,0,116,8,107,10,144,1,114,84,1,0,1,0,1, - 0,89,0,110,32,88,0,116,9,124,7,131,1,124,10,107, - 3,144,1,114,116,116,4,100,13,106,1,124,2,131,1,124, - 4,141,1,130,1,124,0,100,7,100,1,133,2,25,0,83, - 0,41,16,97,122,1,0,0,86,97,108,105,100,97,116,101, - 32,116,104,101,32,104,101,97,100,101,114,32,111,102,32,116, - 104,101,32,112,97,115,115,101,100,45,105,110,32,98,121,116, - 101,99,111,100,101,32,97,103,97,105,110,115,116,32,115,111, - 117,114,99,101,95,115,116,97,116,115,32,40,105,102,10,32, - 32,32,32,103,105,118,101,110,41,32,97,110,100,32,114,101, - 116,117,114,110,105,110,103,32,116,104,101,32,98,121,116,101, - 99,111,100,101,32,116,104,97,116,32,99,97,110,32,98,101, - 32,99,111,109,112,105,108,101,100,32,98,121,32,99,111,109, - 112,105,108,101,40,41,46,10,10,32,32,32,32,65,108,108, - 32,111,116,104,101,114,32,97,114,103,117,109,101,110,116,115, - 32,97,114,101,32,117,115,101,100,32,116,111,32,101,110,104, - 97,110,99,101,32,101,114,114,111,114,32,114,101,112,111,114, - 116,105,110,103,46,10,10,32,32,32,32,73,109,112,111,114, - 116,69,114,114,111,114,32,105,115,32,114,97,105,115,101,100, - 32,119,104,101,110,32,116,104,101,32,109,97,103,105,99,32, - 110,117,109,98,101,114,32,105,115,32,105,110,99,111,114,114, - 101,99,116,32,111,114,32,116,104,101,32,98,121,116,101,99, - 111,100,101,32,105,115,10,32,32,32,32,102,111,117,110,100, - 32,116,111,32,98,101,32,115,116,97,108,101,46,32,69,79, - 70,69,114,114,111,114,32,105,115,32,114,97,105,115,101,100, - 32,119,104,101,110,32,116,104,101,32,100,97,116,97,32,105, - 115,32,102,111,117,110,100,32,116,111,32,98,101,10,32,32, - 32,32,116,114,117,110,99,97,116,101,100,46,10,10,32,32, - 32,32,78,114,98,0,0,0,122,10,60,98,121,116,101,99, - 111,100,101,62,114,35,0,0,0,114,12,0,0,0,233,8, - 0,0,0,233,12,0,0,0,122,30,98,97,100,32,109,97, - 103,105,99,32,110,117,109,98,101,114,32,105,110,32,123,33, - 114,125,58,32,123,33,114,125,122,2,123,125,122,43,114,101, - 97,99,104,101,100,32,69,79,70,32,119,104,105,108,101,32, - 114,101,97,100,105,110,103,32,116,105,109,101,115,116,97,109, - 112,32,105,110,32,123,33,114,125,122,48,114,101,97,99,104, - 101,100,32,69,79,70,32,119,104,105,108,101,32,114,101,97, - 100,105,110,103,32,115,105,122,101,32,111,102,32,115,111,117, - 114,99,101,32,105,110,32,123,33,114,125,218,5,109,116,105, - 109,101,122,26,98,121,116,101,99,111,100,101,32,105,115,32, - 115,116,97,108,101,32,102,111,114,32,123,33,114,125,218,4, - 115,105,122,101,108,3,0,0,0,255,127,255,127,3,0,41, - 10,218,12,77,65,71,73,67,95,78,85,77,66,69,82,114, - 47,0,0,0,114,114,0,0,0,218,16,95,118,101,114,98, - 111,115,101,95,109,101,115,115,97,103,101,114,99,0,0,0, - 114,31,0,0,0,218,8,69,79,70,69,114,114,111,114,114, - 14,0,0,0,218,8,75,101,121,69,114,114,111,114,114,19, - 0,0,0,41,11,114,53,0,0,0,218,12,115,111,117,114, - 99,101,95,115,116,97,116,115,114,98,0,0,0,114,35,0, - 0,0,90,11,101,120,99,95,100,101,116,97,105,108,115,90, - 5,109,97,103,105,99,90,13,114,97,119,95,116,105,109,101, - 115,116,97,109,112,90,8,114,97,119,95,115,105,122,101,114, - 75,0,0,0,218,12,115,111,117,114,99,101,95,109,116,105, - 109,101,218,11,115,111,117,114,99,101,95,115,105,122,101,114, - 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,25, + 105,115,101,100,46,10,10,32,32,32,32,78,122,70,116,104, + 101,32,100,101,98,117,103,95,111,118,101,114,114,105,100,101, + 32,112,97,114,97,109,101,116,101,114,32,105,115,32,100,101, + 112,114,101,99,97,116,101,100,59,32,117,115,101,32,39,111, + 112,116,105,109,105,122,97,116,105,111,110,39,32,105,110,115, + 116,101,97,100,122,50,100,101,98,117,103,95,111,118,101,114, + 114,105,100,101,32,111,114,32,111,112,116,105,109,105,122,97, + 116,105,111,110,32,109,117,115,116,32,98,101,32,115,101,116, + 32,116,111,32,78,111,110,101,114,30,0,0,0,114,29,0, + 0,0,218,1,46,122,36,115,121,115,46,105,109,112,108,101, + 109,101,110,116,97,116,105,111,110,46,99,97,99,104,101,95, + 116,97,103,32,105,115,32,78,111,110,101,233,0,0,0,0, + 122,24,123,33,114,125,32,105,115,32,110,111,116,32,97,108, + 112,104,97,110,117,109,101,114,105,99,122,7,123,125,46,123, + 125,123,125,41,21,218,9,95,119,97,114,110,105,110,103,115, + 218,4,119,97,114,110,218,18,68,101,112,114,101,99,97,116, + 105,111,110,87,97,114,110,105,110,103,218,9,84,121,112,101, + 69,114,114,111,114,114,38,0,0,0,114,32,0,0,0,114, + 7,0,0,0,218,14,105,109,112,108,101,109,101,110,116,97, + 116,105,111,110,218,9,99,97,99,104,101,95,116,97,103,218, + 19,78,111,116,73,109,112,108,101,109,101,110,116,101,100,69, + 114,114,111,114,114,26,0,0,0,218,5,102,108,97,103,115, + 218,8,111,112,116,105,109,105,122,101,218,3,115,116,114,218, + 7,105,115,97,108,110,117,109,218,10,86,97,108,117,101,69, + 114,114,111,114,114,48,0,0,0,218,4,95,79,80,84,114, + 28,0,0,0,218,8,95,80,89,67,65,67,72,69,218,17, + 66,89,84,69,67,79,68,69,95,83,85,70,70,73,88,69, + 83,41,11,114,35,0,0,0,90,14,100,101,98,117,103,95, + 111,118,101,114,114,105,100,101,114,58,0,0,0,218,7,109, + 101,115,115,97,103,101,218,4,104,101,97,100,114,37,0,0, + 0,90,4,98,97,115,101,218,3,115,101,112,218,4,114,101, + 115,116,90,3,116,97,103,90,15,97,108,109,111,115,116,95, + 102,105,108,101,110,97,109,101,114,4,0,0,0,114,4,0, + 0,0,114,5,0,0,0,218,17,99,97,99,104,101,95,102, + 114,111,109,95,115,111,117,114,99,101,249,0,0,0,115,46, + 0,0,0,0,18,8,1,6,1,6,1,8,1,4,1,8, + 1,12,1,12,1,16,1,8,1,8,1,8,1,24,1,8, + 1,12,1,6,2,8,1,8,1,8,1,8,1,14,1,14, + 1,114,80,0,0,0,99,1,0,0,0,0,0,0,0,8, + 0,0,0,5,0,0,0,67,0,0,0,115,220,0,0,0, + 116,0,106,1,106,2,100,1,107,8,114,20,116,3,100,2, + 131,1,130,1,116,4,124,0,131,1,92,2,125,1,125,2, + 116,4,124,1,131,1,92,2,125,1,125,3,124,3,116,5, + 107,3,114,68,116,6,100,3,106,7,116,5,124,0,131,2, + 131,1,130,1,124,2,106,8,100,4,131,1,125,4,124,4, + 100,11,107,7,114,102,116,6,100,7,106,7,124,2,131,1, + 131,1,130,1,110,86,124,4,100,6,107,2,114,188,124,2, + 106,9,100,4,100,5,131,2,100,12,25,0,125,5,124,5, + 106,10,116,11,131,1,115,150,116,6,100,8,106,7,116,11, + 131,1,131,1,130,1,124,5,116,12,116,11,131,1,100,1, + 133,2,25,0,125,6,124,6,106,13,131,0,115,188,116,6, + 100,9,106,7,124,5,131,1,131,1,130,1,124,2,106,14, + 100,4,131,1,100,10,25,0,125,7,116,15,124,1,124,7, + 116,16,100,10,25,0,23,0,131,2,83,0,41,13,97,110, + 1,0,0,71,105,118,101,110,32,116,104,101,32,112,97,116, + 104,32,116,111,32,97,32,46,112,121,99,46,32,102,105,108, + 101,44,32,114,101,116,117,114,110,32,116,104,101,32,112,97, + 116,104,32,116,111,32,105,116,115,32,46,112,121,32,102,105, + 108,101,46,10,10,32,32,32,32,84,104,101,32,46,112,121, + 99,32,102,105,108,101,32,100,111,101,115,32,110,111,116,32, + 110,101,101,100,32,116,111,32,101,120,105,115,116,59,32,116, + 104,105,115,32,115,105,109,112,108,121,32,114,101,116,117,114, + 110,115,32,116,104,101,32,112,97,116,104,32,116,111,10,32, + 32,32,32,116,104,101,32,46,112,121,32,102,105,108,101,32, + 99,97,108,99,117,108,97,116,101,100,32,116,111,32,99,111, + 114,114,101,115,112,111,110,100,32,116,111,32,116,104,101,32, + 46,112,121,99,32,102,105,108,101,46,32,32,73,102,32,112, + 97,116,104,32,100,111,101,115,10,32,32,32,32,110,111,116, + 32,99,111,110,102,111,114,109,32,116,111,32,80,69,80,32, + 51,49,52,55,47,52,56,56,32,102,111,114,109,97,116,44, + 32,86,97,108,117,101,69,114,114,111,114,32,119,105,108,108, + 32,98,101,32,114,97,105,115,101,100,46,32,73,102,10,32, + 32,32,32,115,121,115,46,105,109,112,108,101,109,101,110,116, + 97,116,105,111,110,46,99,97,99,104,101,95,116,97,103,32, + 105,115,32,78,111,110,101,32,116,104,101,110,32,78,111,116, + 73,109,112,108,101,109,101,110,116,101,100,69,114,114,111,114, + 32,105,115,32,114,97,105,115,101,100,46,10,10,32,32,32, + 32,78,122,36,115,121,115,46,105,109,112,108,101,109,101,110, + 116,97,116,105,111,110,46,99,97,99,104,101,95,116,97,103, + 32,105,115,32,78,111,110,101,122,37,123,125,32,110,111,116, + 32,98,111,116,116,111,109,45,108,101,118,101,108,32,100,105, + 114,101,99,116,111,114,121,32,105,110,32,123,33,114,125,114, + 59,0,0,0,114,57,0,0,0,233,3,0,0,0,122,33, + 101,120,112,101,99,116,101,100,32,111,110,108,121,32,50,32, + 111,114,32,51,32,100,111,116,115,32,105,110,32,123,33,114, + 125,122,57,111,112,116,105,109,105,122,97,116,105,111,110,32, + 112,111,114,116,105,111,110,32,111,102,32,102,105,108,101,110, + 97,109,101,32,100,111,101,115,32,110,111,116,32,115,116,97, + 114,116,32,119,105,116,104,32,123,33,114,125,122,52,111,112, + 116,105,109,105,122,97,116,105,111,110,32,108,101,118,101,108, + 32,123,33,114,125,32,105,115,32,110,111,116,32,97,110,32, + 97,108,112,104,97,110,117,109,101,114,105,99,32,118,97,108, + 117,101,114,60,0,0,0,62,2,0,0,0,114,57,0,0, + 0,114,81,0,0,0,233,254,255,255,255,41,17,114,7,0, + 0,0,114,65,0,0,0,114,66,0,0,0,114,67,0,0, + 0,114,38,0,0,0,114,74,0,0,0,114,72,0,0,0, + 114,48,0,0,0,218,5,99,111,117,110,116,114,34,0,0, + 0,114,9,0,0,0,114,73,0,0,0,114,31,0,0,0, + 114,71,0,0,0,218,9,112,97,114,116,105,116,105,111,110, + 114,28,0,0,0,218,15,83,79,85,82,67,69,95,83,85, + 70,70,73,88,69,83,41,8,114,35,0,0,0,114,77,0, + 0,0,90,16,112,121,99,97,99,104,101,95,102,105,108,101, + 110,97,109,101,90,7,112,121,99,97,99,104,101,90,9,100, + 111,116,95,99,111,117,110,116,114,58,0,0,0,90,9,111, + 112,116,95,108,101,118,101,108,90,13,98,97,115,101,95,102, + 105,108,101,110,97,109,101,114,4,0,0,0,114,4,0,0, + 0,114,5,0,0,0,218,17,115,111,117,114,99,101,95,102, + 114,111,109,95,99,97,99,104,101,37,1,0,0,115,44,0, + 0,0,0,9,12,1,8,1,12,1,12,1,8,1,6,1, + 10,1,10,1,8,1,6,1,10,1,8,1,16,1,10,1, + 6,1,8,1,16,1,8,1,6,1,8,1,14,1,114,86, + 0,0,0,99,1,0,0,0,0,0,0,0,5,0,0,0, + 12,0,0,0,67,0,0,0,115,128,0,0,0,116,0,124, + 0,131,1,100,1,107,2,114,16,100,2,83,0,124,0,106, + 1,100,3,131,1,92,3,125,1,125,2,125,3,124,1,12, + 0,115,58,124,3,106,2,131,0,100,7,100,8,133,2,25, + 0,100,6,107,3,114,62,124,0,83,0,121,12,116,3,124, + 0,131,1,125,4,87,0,110,36,4,0,116,4,116,5,102, + 2,107,10,114,110,1,0,1,0,1,0,124,0,100,2,100, + 9,133,2,25,0,125,4,89,0,110,2,88,0,116,6,124, + 4,131,1,114,124,124,4,83,0,124,0,83,0,41,10,122, + 188,67,111,110,118,101,114,116,32,97,32,98,121,116,101,99, + 111,100,101,32,102,105,108,101,32,112,97,116,104,32,116,111, + 32,97,32,115,111,117,114,99,101,32,112,97,116,104,32,40, + 105,102,32,112,111,115,115,105,98,108,101,41,46,10,10,32, + 32,32,32,84,104,105,115,32,102,117,110,99,116,105,111,110, + 32,101,120,105,115,116,115,32,112,117,114,101,108,121,32,102, + 111,114,32,98,97,99,107,119,97,114,100,115,45,99,111,109, + 112,97,116,105,98,105,108,105,116,121,32,102,111,114,10,32, + 32,32,32,80,121,73,109,112,111,114,116,95,69,120,101,99, + 67,111,100,101,77,111,100,117,108,101,87,105,116,104,70,105, + 108,101,110,97,109,101,115,40,41,32,105,110,32,116,104,101, + 32,67,32,65,80,73,46,10,10,32,32,32,32,114,60,0, + 0,0,78,114,59,0,0,0,114,81,0,0,0,114,29,0, + 0,0,90,2,112,121,233,253,255,255,255,233,255,255,255,255, + 114,88,0,0,0,41,7,114,31,0,0,0,114,32,0,0, + 0,218,5,108,111,119,101,114,114,86,0,0,0,114,67,0, + 0,0,114,72,0,0,0,114,44,0,0,0,41,5,218,13, + 98,121,116,101,99,111,100,101,95,112,97,116,104,114,79,0, + 0,0,114,36,0,0,0,90,9,101,120,116,101,110,115,105, + 111,110,218,11,115,111,117,114,99,101,95,112,97,116,104,114, + 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,15, + 95,103,101,116,95,115,111,117,114,99,101,102,105,108,101,70, + 1,0,0,115,20,0,0,0,0,7,12,1,4,1,16,1, + 26,1,4,1,2,1,12,1,18,1,18,1,114,92,0,0, + 0,99,1,0,0,0,0,0,0,0,1,0,0,0,11,0, + 0,0,67,0,0,0,115,74,0,0,0,124,0,106,0,116, + 1,116,2,131,1,131,1,114,46,121,8,116,3,124,0,131, + 1,83,0,4,0,116,4,107,10,114,42,1,0,1,0,1, + 0,89,0,113,70,88,0,110,24,124,0,106,0,116,1,116, + 5,131,1,131,1,114,66,124,0,83,0,110,4,100,0,83, + 0,100,0,83,0,41,1,78,41,6,218,8,101,110,100,115, + 119,105,116,104,218,5,116,117,112,108,101,114,85,0,0,0, + 114,80,0,0,0,114,67,0,0,0,114,75,0,0,0,41, + 1,218,8,102,105,108,101,110,97,109,101,114,4,0,0,0, + 114,4,0,0,0,114,5,0,0,0,218,11,95,103,101,116, + 95,99,97,99,104,101,100,89,1,0,0,115,16,0,0,0, + 0,1,14,1,2,1,8,1,14,1,8,1,14,1,6,2, + 114,96,0,0,0,99,1,0,0,0,0,0,0,0,2,0, + 0,0,11,0,0,0,67,0,0,0,115,52,0,0,0,121, + 14,116,0,124,0,131,1,106,1,125,1,87,0,110,24,4, + 0,116,2,107,10,114,38,1,0,1,0,1,0,100,1,125, + 1,89,0,110,2,88,0,124,1,100,2,79,0,125,1,124, + 1,83,0,41,3,122,51,67,97,108,99,117,108,97,116,101, + 32,116,104,101,32,109,111,100,101,32,112,101,114,109,105,115, + 115,105,111,110,115,32,102,111,114,32,97,32,98,121,116,101, + 99,111,100,101,32,102,105,108,101,46,105,182,1,0,0,233, + 128,0,0,0,41,3,114,39,0,0,0,114,41,0,0,0, + 114,40,0,0,0,41,2,114,35,0,0,0,114,42,0,0, + 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, + 218,10,95,99,97,108,99,95,109,111,100,101,101,1,0,0, + 115,12,0,0,0,0,2,2,1,14,1,14,1,10,3,8, + 1,114,98,0,0,0,99,1,0,0,0,0,0,0,0,3, + 0,0,0,11,0,0,0,3,0,0,0,115,68,0,0,0, + 100,6,135,0,102,1,100,2,100,3,132,9,125,1,121,10, + 116,0,106,1,125,2,87,0,110,28,4,0,116,2,107,10, + 114,52,1,0,1,0,1,0,100,4,100,5,132,0,125,2, + 89,0,110,2,88,0,124,2,124,1,136,0,131,2,1,0, + 124,1,83,0,41,7,122,252,68,101,99,111,114,97,116,111, + 114,32,116,111,32,118,101,114,105,102,121,32,116,104,97,116, + 32,116,104,101,32,109,111,100,117,108,101,32,98,101,105,110, + 103,32,114,101,113,117,101,115,116,101,100,32,109,97,116,99, + 104,101,115,32,116,104,101,32,111,110,101,32,116,104,101,10, + 32,32,32,32,108,111,97,100,101,114,32,99,97,110,32,104, + 97,110,100,108,101,46,10,10,32,32,32,32,84,104,101,32, + 102,105,114,115,116,32,97,114,103,117,109,101,110,116,32,40, + 115,101,108,102,41,32,109,117,115,116,32,100,101,102,105,110, + 101,32,95,110,97,109,101,32,119,104,105,99,104,32,116,104, + 101,32,115,101,99,111,110,100,32,97,114,103,117,109,101,110, + 116,32,105,115,10,32,32,32,32,99,111,109,112,97,114,101, + 100,32,97,103,97,105,110,115,116,46,32,73,102,32,116,104, + 101,32,99,111,109,112,97,114,105,115,111,110,32,102,97,105, + 108,115,32,116,104,101,110,32,73,109,112,111,114,116,69,114, + 114,111,114,32,105,115,32,114,97,105,115,101,100,46,10,10, + 32,32,32,32,78,99,2,0,0,0,0,0,0,0,4,0, + 0,0,5,0,0,0,31,0,0,0,115,64,0,0,0,124, + 1,100,0,107,8,114,16,124,0,106,0,125,1,110,34,124, + 0,106,0,124,1,107,3,114,50,116,1,100,1,124,0,106, + 0,124,1,102,2,22,0,100,2,124,1,144,1,131,1,130, + 1,136,0,124,0,124,1,124,2,124,3,142,2,83,0,41, + 3,78,122,30,108,111,97,100,101,114,32,102,111,114,32,37, + 115,32,99,97,110,110,111,116,32,104,97,110,100,108,101,32, + 37,115,218,4,110,97,109,101,41,2,114,99,0,0,0,218, + 11,73,109,112,111,114,116,69,114,114,111,114,41,4,218,4, + 115,101,108,102,114,99,0,0,0,218,4,97,114,103,115,90, + 6,107,119,97,114,103,115,41,1,218,6,109,101,116,104,111, + 100,114,4,0,0,0,114,5,0,0,0,218,19,95,99,104, + 101,99,107,95,110,97,109,101,95,119,114,97,112,112,101,114, + 121,1,0,0,115,12,0,0,0,0,1,8,1,8,1,10, + 1,4,1,20,1,122,40,95,99,104,101,99,107,95,110,97, + 109,101,46,60,108,111,99,97,108,115,62,46,95,99,104,101, + 99,107,95,110,97,109,101,95,119,114,97,112,112,101,114,99, + 2,0,0,0,0,0,0,0,3,0,0,0,7,0,0,0, + 83,0,0,0,115,60,0,0,0,120,40,100,5,68,0,93, + 32,125,2,116,0,124,1,124,2,131,2,114,6,116,1,124, + 0,124,2,116,2,124,1,124,2,131,2,131,3,1,0,113, + 6,87,0,124,0,106,3,106,4,124,1,106,3,131,1,1, + 0,100,0,83,0,41,6,78,218,10,95,95,109,111,100,117, + 108,101,95,95,218,8,95,95,110,97,109,101,95,95,218,12, + 95,95,113,117,97,108,110,97,109,101,95,95,218,7,95,95, + 100,111,99,95,95,41,4,122,10,95,95,109,111,100,117,108, + 101,95,95,122,8,95,95,110,97,109,101,95,95,122,12,95, + 95,113,117,97,108,110,97,109,101,95,95,122,7,95,95,100, + 111,99,95,95,41,5,218,7,104,97,115,97,116,116,114,218, + 7,115,101,116,97,116,116,114,218,7,103,101,116,97,116,116, + 114,218,8,95,95,100,105,99,116,95,95,218,6,117,112,100, + 97,116,101,41,3,90,3,110,101,119,90,3,111,108,100,114, + 53,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, + 0,0,0,218,5,95,119,114,97,112,132,1,0,0,115,8, + 0,0,0,0,1,10,1,10,1,22,1,122,26,95,99,104, + 101,99,107,95,110,97,109,101,46,60,108,111,99,97,108,115, + 62,46,95,119,114,97,112,41,1,78,41,3,218,10,95,98, + 111,111,116,115,116,114,97,112,114,114,0,0,0,218,9,78, + 97,109,101,69,114,114,111,114,41,3,114,103,0,0,0,114, + 104,0,0,0,114,114,0,0,0,114,4,0,0,0,41,1, + 114,103,0,0,0,114,5,0,0,0,218,11,95,99,104,101, + 99,107,95,110,97,109,101,113,1,0,0,115,14,0,0,0, + 0,8,14,7,2,1,10,1,14,2,14,5,10,1,114,117, + 0,0,0,99,2,0,0,0,0,0,0,0,5,0,0,0, + 4,0,0,0,67,0,0,0,115,60,0,0,0,124,0,106, + 0,124,1,131,1,92,2,125,2,125,3,124,2,100,1,107, + 8,114,56,116,1,124,3,131,1,114,56,100,2,125,4,116, + 2,106,3,124,4,106,4,124,3,100,3,25,0,131,1,116, + 5,131,2,1,0,124,2,83,0,41,4,122,155,84,114,121, + 32,116,111,32,102,105,110,100,32,97,32,108,111,97,100,101, + 114,32,102,111,114,32,116,104,101,32,115,112,101,99,105,102, + 105,101,100,32,109,111,100,117,108,101,32,98,121,32,100,101, + 108,101,103,97,116,105,110,103,32,116,111,10,32,32,32,32, + 115,101,108,102,46,102,105,110,100,95,108,111,97,100,101,114, + 40,41,46,10,10,32,32,32,32,84,104,105,115,32,109,101, + 116,104,111,100,32,105,115,32,100,101,112,114,101,99,97,116, + 101,100,32,105,110,32,102,97,118,111,114,32,111,102,32,102, + 105,110,100,101,114,46,102,105,110,100,95,115,112,101,99,40, + 41,46,10,10,32,32,32,32,78,122,44,78,111,116,32,105, + 109,112,111,114,116,105,110,103,32,100,105,114,101,99,116,111, + 114,121,32,123,125,58,32,109,105,115,115,105,110,103,32,95, + 95,105,110,105,116,95,95,114,60,0,0,0,41,6,218,11, + 102,105,110,100,95,108,111,97,100,101,114,114,31,0,0,0, + 114,61,0,0,0,114,62,0,0,0,114,48,0,0,0,218, + 13,73,109,112,111,114,116,87,97,114,110,105,110,103,41,5, + 114,101,0,0,0,218,8,102,117,108,108,110,97,109,101,218, + 6,108,111,97,100,101,114,218,8,112,111,114,116,105,111,110, + 115,218,3,109,115,103,114,4,0,0,0,114,4,0,0,0, + 114,5,0,0,0,218,17,95,102,105,110,100,95,109,111,100, + 117,108,101,95,115,104,105,109,141,1,0,0,115,10,0,0, + 0,0,10,14,1,16,1,4,1,22,1,114,124,0,0,0, + 99,4,0,0,0,0,0,0,0,11,0,0,0,19,0,0, + 0,67,0,0,0,115,128,1,0,0,105,0,125,4,124,2, + 100,1,107,9,114,22,124,2,124,4,100,2,60,0,110,4, + 100,3,125,2,124,3,100,1,107,9,114,42,124,3,124,4, + 100,4,60,0,124,0,100,1,100,5,133,2,25,0,125,5, + 124,0,100,5,100,6,133,2,25,0,125,6,124,0,100,6, + 100,7,133,2,25,0,125,7,124,5,116,0,107,3,114,122, + 100,8,106,1,124,2,124,5,131,2,125,8,116,2,106,3, + 100,9,124,8,131,2,1,0,116,4,124,8,124,4,141,1, + 130,1,110,86,116,5,124,6,131,1,100,5,107,3,114,166, + 100,10,106,1,124,2,131,1,125,8,116,2,106,3,100,9, + 124,8,131,2,1,0,116,6,124,8,131,1,130,1,110,42, + 116,5,124,7,131,1,100,5,107,3,114,208,100,11,106,1, + 124,2,131,1,125,8,116,2,106,3,100,9,124,8,131,2, + 1,0,116,6,124,8,131,1,130,1,124,1,100,1,107,9, + 144,1,114,116,121,16,116,7,124,1,100,12,25,0,131,1, + 125,9,87,0,110,20,4,0,116,8,107,10,114,254,1,0, + 1,0,1,0,89,0,110,48,88,0,116,9,124,6,131,1, + 124,9,107,3,144,1,114,46,100,13,106,1,124,2,131,1, + 125,8,116,2,106,3,100,9,124,8,131,2,1,0,116,4, + 124,8,124,4,141,1,130,1,121,16,124,1,100,14,25,0, + 100,15,64,0,125,10,87,0,110,22,4,0,116,8,107,10, + 144,1,114,84,1,0,1,0,1,0,89,0,110,32,88,0, + 116,9,124,7,131,1,124,10,107,3,144,1,114,116,116,4, + 100,13,106,1,124,2,131,1,124,4,141,1,130,1,124,0, + 100,7,100,1,133,2,25,0,83,0,41,16,97,122,1,0, + 0,86,97,108,105,100,97,116,101,32,116,104,101,32,104,101, + 97,100,101,114,32,111,102,32,116,104,101,32,112,97,115,115, + 101,100,45,105,110,32,98,121,116,101,99,111,100,101,32,97, + 103,97,105,110,115,116,32,115,111,117,114,99,101,95,115,116, + 97,116,115,32,40,105,102,10,32,32,32,32,103,105,118,101, + 110,41,32,97,110,100,32,114,101,116,117,114,110,105,110,103, + 32,116,104,101,32,98,121,116,101,99,111,100,101,32,116,104, + 97,116,32,99,97,110,32,98,101,32,99,111,109,112,105,108, + 101,100,32,98,121,32,99,111,109,112,105,108,101,40,41,46, + 10,10,32,32,32,32,65,108,108,32,111,116,104,101,114,32, + 97,114,103,117,109,101,110,116,115,32,97,114,101,32,117,115, + 101,100,32,116,111,32,101,110,104,97,110,99,101,32,101,114, + 114,111,114,32,114,101,112,111,114,116,105,110,103,46,10,10, + 32,32,32,32,73,109,112,111,114,116,69,114,114,111,114,32, + 105,115,32,114,97,105,115,101,100,32,119,104,101,110,32,116, + 104,101,32,109,97,103,105,99,32,110,117,109,98,101,114,32, + 105,115,32,105,110,99,111,114,114,101,99,116,32,111,114,32, + 116,104,101,32,98,121,116,101,99,111,100,101,32,105,115,10, + 32,32,32,32,102,111,117,110,100,32,116,111,32,98,101,32, + 115,116,97,108,101,46,32,69,79,70,69,114,114,111,114,32, + 105,115,32,114,97,105,115,101,100,32,119,104,101,110,32,116, + 104,101,32,100,97,116,97,32,105,115,32,102,111,117,110,100, + 32,116,111,32,98,101,10,32,32,32,32,116,114,117,110,99, + 97,116,101,100,46,10,10,32,32,32,32,78,114,99,0,0, + 0,122,10,60,98,121,116,101,99,111,100,101,62,114,35,0, + 0,0,114,12,0,0,0,233,8,0,0,0,233,12,0,0, + 0,122,30,98,97,100,32,109,97,103,105,99,32,110,117,109, + 98,101,114,32,105,110,32,123,33,114,125,58,32,123,33,114, + 125,122,2,123,125,122,43,114,101,97,99,104,101,100,32,69, + 79,70,32,119,104,105,108,101,32,114,101,97,100,105,110,103, + 32,116,105,109,101,115,116,97,109,112,32,105,110,32,123,33, + 114,125,122,48,114,101,97,99,104,101,100,32,69,79,70,32, + 119,104,105,108,101,32,114,101,97,100,105,110,103,32,115,105, + 122,101,32,111,102,32,115,111,117,114,99,101,32,105,110,32, + 123,33,114,125,218,5,109,116,105,109,101,122,26,98,121,116, + 101,99,111,100,101,32,105,115,32,115,116,97,108,101,32,102, + 111,114,32,123,33,114,125,218,4,115,105,122,101,108,3,0, + 0,0,255,127,255,127,3,0,41,10,218,12,77,65,71,73, + 67,95,78,85,77,66,69,82,114,48,0,0,0,114,115,0, + 0,0,218,16,95,118,101,114,98,111,115,101,95,109,101,115, + 115,97,103,101,114,100,0,0,0,114,31,0,0,0,218,8, + 69,79,70,69,114,114,111,114,114,14,0,0,0,218,8,75, + 101,121,69,114,114,111,114,114,19,0,0,0,41,11,114,54, + 0,0,0,218,12,115,111,117,114,99,101,95,115,116,97,116, + 115,114,99,0,0,0,114,35,0,0,0,90,11,101,120,99, + 95,100,101,116,97,105,108,115,90,5,109,97,103,105,99,90, + 13,114,97,119,95,116,105,109,101,115,116,97,109,112,90,8, + 114,97,119,95,115,105,122,101,114,76,0,0,0,218,12,115, + 111,117,114,99,101,95,109,116,105,109,101,218,11,115,111,117, + 114,99,101,95,115,105,122,101,114,4,0,0,0,114,4,0, + 0,0,114,5,0,0,0,218,25,95,118,97,108,105,100,97, + 116,101,95,98,121,116,101,99,111,100,101,95,104,101,97,100, + 101,114,158,1,0,0,115,76,0,0,0,0,11,4,1,8, + 1,10,3,4,1,8,1,8,1,12,1,12,1,12,1,8, + 1,12,1,12,1,12,1,12,1,10,1,12,1,10,1,12, + 1,10,1,12,1,8,1,10,1,2,1,16,1,14,1,6, + 2,14,1,10,1,12,1,10,1,2,1,16,1,16,1,6, + 2,14,1,10,1,6,1,114,136,0,0,0,99,4,0,0, + 0,0,0,0,0,5,0,0,0,6,0,0,0,67,0,0, + 0,115,86,0,0,0,116,0,106,1,124,0,131,1,125,4, + 116,2,124,4,116,3,131,2,114,58,116,4,106,5,100,1, + 124,2,131,2,1,0,124,3,100,2,107,9,114,52,116,6, + 106,7,124,4,124,3,131,2,1,0,124,4,83,0,110,24, + 116,8,100,3,106,9,124,2,131,1,100,4,124,1,100,5, + 124,2,144,2,131,1,130,1,100,2,83,0,41,6,122,60, + 67,111,109,112,105,108,101,32,98,121,116,101,99,111,100,101, + 32,97,115,32,114,101,116,117,114,110,101,100,32,98,121,32, 95,118,97,108,105,100,97,116,101,95,98,121,116,101,99,111, - 100,101,95,104,101,97,100,101,114,156,1,0,0,115,76,0, - 0,0,0,11,4,1,8,1,10,3,4,1,8,1,8,1, - 12,1,12,1,12,1,8,1,12,1,12,1,12,1,12,1, - 10,1,12,1,10,1,12,1,10,1,12,1,8,1,10,1, - 2,1,16,1,14,1,6,2,14,1,10,1,12,1,10,1, - 2,1,16,1,16,1,6,2,14,1,10,1,6,1,114,135, - 0,0,0,99,4,0,0,0,0,0,0,0,5,0,0,0, - 6,0,0,0,67,0,0,0,115,86,0,0,0,116,0,106, - 1,124,0,131,1,125,4,116,2,124,4,116,3,131,2,114, - 58,116,4,106,5,100,1,124,2,131,2,1,0,124,3,100, - 2,107,9,114,52,116,6,106,7,124,4,124,3,131,2,1, - 0,124,4,83,0,110,24,116,8,100,3,106,9,124,2,131, - 1,100,4,124,1,100,5,124,2,144,2,131,1,130,1,100, - 2,83,0,41,6,122,60,67,111,109,112,105,108,101,32,98, - 121,116,101,99,111,100,101,32,97,115,32,114,101,116,117,114, - 110,101,100,32,98,121,32,95,118,97,108,105,100,97,116,101, - 95,98,121,116,101,99,111,100,101,95,104,101,97,100,101,114, - 40,41,46,122,21,99,111,100,101,32,111,98,106,101,99,116, - 32,102,114,111,109,32,123,33,114,125,78,122,23,78,111,110, - 45,99,111,100,101,32,111,98,106,101,99,116,32,105,110,32, - 123,33,114,125,114,98,0,0,0,114,35,0,0,0,41,10, - 218,7,109,97,114,115,104,97,108,90,5,108,111,97,100,115, - 218,10,105,115,105,110,115,116,97,110,99,101,218,10,95,99, - 111,100,101,95,116,121,112,101,114,114,0,0,0,114,129,0, - 0,0,218,4,95,105,109,112,90,16,95,102,105,120,95,99, - 111,95,102,105,108,101,110,97,109,101,114,99,0,0,0,114, - 47,0,0,0,41,5,114,53,0,0,0,114,98,0,0,0, - 114,89,0,0,0,114,90,0,0,0,218,4,99,111,100,101, - 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218, - 17,95,99,111,109,112,105,108,101,95,98,121,116,101,99,111, - 100,101,211,1,0,0,115,16,0,0,0,0,2,10,1,10, - 1,12,1,8,1,12,1,6,2,12,1,114,141,0,0,0, - 114,59,0,0,0,99,3,0,0,0,0,0,0,0,4,0, - 0,0,3,0,0,0,67,0,0,0,115,56,0,0,0,116, - 0,116,1,131,1,125,3,124,3,106,2,116,3,124,1,131, - 1,131,1,1,0,124,3,106,2,116,3,124,2,131,1,131, - 1,1,0,124,3,106,2,116,4,106,5,124,0,131,1,131, - 1,1,0,124,3,83,0,41,1,122,80,67,111,109,112,105, - 108,101,32,97,32,99,111,100,101,32,111,98,106,101,99,116, - 32,105,110,116,111,32,98,121,116,101,99,111,100,101,32,102, - 111,114,32,119,114,105,116,105,110,103,32,111,117,116,32,116, - 111,32,97,32,98,121,116,101,45,99,111,109,112,105,108,101, - 100,10,32,32,32,32,102,105,108,101,46,41,6,218,9,98, - 121,116,101,97,114,114,97,121,114,128,0,0,0,218,6,101, - 120,116,101,110,100,114,17,0,0,0,114,136,0,0,0,90, - 5,100,117,109,112,115,41,4,114,140,0,0,0,114,126,0, - 0,0,114,134,0,0,0,114,53,0,0,0,114,4,0,0, - 0,114,4,0,0,0,114,5,0,0,0,218,17,95,99,111, - 100,101,95,116,111,95,98,121,116,101,99,111,100,101,223,1, - 0,0,115,10,0,0,0,0,3,8,1,14,1,14,1,16, - 1,114,144,0,0,0,99,1,0,0,0,0,0,0,0,5, - 0,0,0,4,0,0,0,67,0,0,0,115,62,0,0,0, - 100,1,100,2,108,0,125,1,116,1,106,2,124,0,131,1, - 106,3,125,2,124,1,106,4,124,2,131,1,125,3,116,1, - 106,5,100,2,100,3,131,2,125,4,124,4,106,6,124,0, - 106,6,124,3,100,1,25,0,131,1,131,1,83,0,41,4, - 122,121,68,101,99,111,100,101,32,98,121,116,101,115,32,114, - 101,112,114,101,115,101,110,116,105,110,103,32,115,111,117,114, - 99,101,32,99,111,100,101,32,97,110,100,32,114,101,116,117, - 114,110,32,116,104,101,32,115,116,114,105,110,103,46,10,10, - 32,32,32,32,85,110,105,118,101,114,115,97,108,32,110,101, - 119,108,105,110,101,32,115,117,112,112,111,114,116,32,105,115, - 32,117,115,101,100,32,105,110,32,116,104,101,32,100,101,99, - 111,100,105,110,103,46,10,32,32,32,32,114,59,0,0,0, - 78,84,41,7,218,8,116,111,107,101,110,105,122,101,114,49, - 0,0,0,90,7,66,121,116,101,115,73,79,90,8,114,101, - 97,100,108,105,110,101,90,15,100,101,116,101,99,116,95,101, - 110,99,111,100,105,110,103,90,25,73,110,99,114,101,109,101, - 110,116,97,108,78,101,119,108,105,110,101,68,101,99,111,100, - 101,114,218,6,100,101,99,111,100,101,41,5,218,12,115,111, - 117,114,99,101,95,98,121,116,101,115,114,145,0,0,0,90, - 21,115,111,117,114,99,101,95,98,121,116,101,115,95,114,101, - 97,100,108,105,110,101,218,8,101,110,99,111,100,105,110,103, - 90,15,110,101,119,108,105,110,101,95,100,101,99,111,100,101, - 114,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 218,13,100,101,99,111,100,101,95,115,111,117,114,99,101,233, - 1,0,0,115,10,0,0,0,0,5,8,1,12,1,10,1, - 12,1,114,149,0,0,0,114,120,0,0,0,218,26,115,117, - 98,109,111,100,117,108,101,95,115,101,97,114,99,104,95,108, - 111,99,97,116,105,111,110,115,99,2,0,0,0,2,0,0, - 0,9,0,0,0,19,0,0,0,67,0,0,0,115,8,1, - 0,0,124,1,100,1,107,8,114,58,100,2,125,1,116,0, - 124,2,100,3,131,2,114,58,121,14,124,2,106,1,124,0, - 131,1,125,1,87,0,110,20,4,0,116,2,107,10,114,56, - 1,0,1,0,1,0,89,0,110,2,88,0,116,3,106,4, - 124,0,124,2,100,4,124,1,144,1,131,2,125,4,100,5, - 124,4,95,5,124,2,100,1,107,8,114,146,120,54,116,6, - 131,0,68,0,93,40,92,2,125,5,125,6,124,1,106,7, - 116,8,124,6,131,1,131,1,114,98,124,5,124,0,124,1, - 131,2,125,2,124,2,124,4,95,9,80,0,113,98,87,0, - 100,1,83,0,124,3,116,10,107,8,114,212,116,0,124,2, - 100,6,131,2,114,218,121,14,124,2,106,11,124,0,131,1, - 125,7,87,0,110,20,4,0,116,2,107,10,114,198,1,0, - 1,0,1,0,89,0,113,218,88,0,124,7,114,218,103,0, - 124,4,95,12,110,6,124,3,124,4,95,12,124,4,106,12, - 103,0,107,2,144,1,114,4,124,1,144,1,114,4,116,13, - 124,1,131,1,100,7,25,0,125,8,124,4,106,12,106,14, - 124,8,131,1,1,0,124,4,83,0,41,8,97,61,1,0, - 0,82,101,116,117,114,110,32,97,32,109,111,100,117,108,101, - 32,115,112,101,99,32,98,97,115,101,100,32,111,110,32,97, - 32,102,105,108,101,32,108,111,99,97,116,105,111,110,46,10, - 10,32,32,32,32,84,111,32,105,110,100,105,99,97,116,101, - 32,116,104,97,116,32,116,104,101,32,109,111,100,117,108,101, - 32,105,115,32,97,32,112,97,99,107,97,103,101,44,32,115, - 101,116,10,32,32,32,32,115,117,98,109,111,100,117,108,101, - 95,115,101,97,114,99,104,95,108,111,99,97,116,105,111,110, - 115,32,116,111,32,97,32,108,105,115,116,32,111,102,32,100, - 105,114,101,99,116,111,114,121,32,112,97,116,104,115,46,32, - 32,65,110,10,32,32,32,32,101,109,112,116,121,32,108,105, - 115,116,32,105,115,32,115,117,102,102,105,99,105,101,110,116, - 44,32,116,104,111,117,103,104,32,105,116,115,32,110,111,116, - 32,111,116,104,101,114,119,105,115,101,32,117,115,101,102,117, - 108,32,116,111,32,116,104,101,10,32,32,32,32,105,109,112, - 111,114,116,32,115,121,115,116,101,109,46,10,10,32,32,32, - 32,84,104,101,32,108,111,97,100,101,114,32,109,117,115,116, - 32,116,97,107,101,32,97,32,115,112,101,99,32,97,115,32, - 105,116,115,32,111,110,108,121,32,95,95,105,110,105,116,95, - 95,40,41,32,97,114,103,46,10,10,32,32,32,32,78,122, - 9,60,117,110,107,110,111,119,110,62,218,12,103,101,116,95, - 102,105,108,101,110,97,109,101,218,6,111,114,105,103,105,110, - 84,218,10,105,115,95,112,97,99,107,97,103,101,114,59,0, - 0,0,41,15,114,108,0,0,0,114,151,0,0,0,114,99, - 0,0,0,114,114,0,0,0,218,10,77,111,100,117,108,101, - 83,112,101,99,90,13,95,115,101,116,95,102,105,108,101,97, - 116,116,114,218,27,95,103,101,116,95,115,117,112,112,111,114, - 116,101,100,95,102,105,108,101,95,108,111,97,100,101,114,115, - 114,92,0,0,0,114,93,0,0,0,114,120,0,0,0,218, - 9,95,80,79,80,85,76,65,84,69,114,153,0,0,0,114, - 150,0,0,0,114,38,0,0,0,218,6,97,112,112,101,110, - 100,41,9,114,98,0,0,0,90,8,108,111,99,97,116,105, - 111,110,114,120,0,0,0,114,150,0,0,0,218,4,115,112, - 101,99,218,12,108,111,97,100,101,114,95,99,108,97,115,115, - 218,8,115,117,102,102,105,120,101,115,114,153,0,0,0,90, - 7,100,105,114,110,97,109,101,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,218,23,115,112,101,99,95,102,114, - 111,109,95,102,105,108,101,95,108,111,99,97,116,105,111,110, - 250,1,0,0,115,60,0,0,0,0,12,8,4,4,1,10, - 2,2,1,14,1,14,1,6,8,18,1,6,3,8,1,16, - 1,14,1,10,1,6,1,6,2,4,3,8,2,10,1,2, - 1,14,1,14,1,6,2,4,1,8,2,6,1,12,1,6, - 1,12,1,12,2,114,161,0,0,0,99,0,0,0,0,0, - 0,0,0,0,0,0,0,5,0,0,0,64,0,0,0,115, - 82,0,0,0,101,0,90,1,100,0,90,2,100,1,90,3, - 100,2,90,4,100,3,90,5,100,4,90,6,101,7,100,5, - 100,6,132,0,131,1,90,8,101,7,100,7,100,8,132,0, - 131,1,90,9,101,7,100,9,100,9,100,10,100,11,132,2, - 131,1,90,10,101,7,100,9,100,12,100,13,132,1,131,1, - 90,11,100,9,83,0,41,14,218,21,87,105,110,100,111,119, - 115,82,101,103,105,115,116,114,121,70,105,110,100,101,114,122, - 62,77,101,116,97,32,112,97,116,104,32,102,105,110,100,101, - 114,32,102,111,114,32,109,111,100,117,108,101,115,32,100,101, - 99,108,97,114,101,100,32,105,110,32,116,104,101,32,87,105, - 110,100,111,119,115,32,114,101,103,105,115,116,114,121,46,122, - 59,83,111,102,116,119,97,114,101,92,80,121,116,104,111,110, - 92,80,121,116,104,111,110,67,111,114,101,92,123,115,121,115, - 95,118,101,114,115,105,111,110,125,92,77,111,100,117,108,101, - 115,92,123,102,117,108,108,110,97,109,101,125,122,65,83,111, - 102,116,119,97,114,101,92,80,121,116,104,111,110,92,80,121, - 116,104,111,110,67,111,114,101,92,123,115,121,115,95,118,101, - 114,115,105,111,110,125,92,77,111,100,117,108,101,115,92,123, - 102,117,108,108,110,97,109,101,125,92,68,101,98,117,103,70, - 99,2,0,0,0,0,0,0,0,2,0,0,0,11,0,0, - 0,67,0,0,0,115,50,0,0,0,121,14,116,0,106,1, - 116,0,106,2,124,1,131,2,83,0,4,0,116,3,107,10, - 114,44,1,0,1,0,1,0,116,0,106,1,116,0,106,4, - 124,1,131,2,83,0,88,0,100,0,83,0,41,1,78,41, - 5,218,7,95,119,105,110,114,101,103,90,7,79,112,101,110, - 75,101,121,90,17,72,75,69,89,95,67,85,82,82,69,78, - 84,95,85,83,69,82,114,40,0,0,0,90,18,72,75,69, - 89,95,76,79,67,65,76,95,77,65,67,72,73,78,69,41, - 2,218,3,99,108,115,218,3,107,101,121,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,218,14,95,111,112,101, - 110,95,114,101,103,105,115,116,114,121,72,2,0,0,115,8, - 0,0,0,0,2,2,1,14,1,14,1,122,36,87,105,110, - 100,111,119,115,82,101,103,105,115,116,114,121,70,105,110,100, - 101,114,46,95,111,112,101,110,95,114,101,103,105,115,116,114, - 121,99,2,0,0,0,0,0,0,0,6,0,0,0,16,0, - 0,0,67,0,0,0,115,116,0,0,0,124,0,106,0,114, - 14,124,0,106,1,125,2,110,6,124,0,106,2,125,2,124, - 2,106,3,100,1,124,1,100,2,100,3,116,4,106,5,100, - 0,100,4,133,2,25,0,22,0,144,2,131,0,125,3,121, - 38,124,0,106,6,124,3,131,1,143,18,125,4,116,7,106, - 8,124,4,100,5,131,2,125,5,87,0,100,0,81,0,82, - 0,88,0,87,0,110,20,4,0,116,9,107,10,114,110,1, - 0,1,0,1,0,100,0,83,0,88,0,124,5,83,0,41, - 6,78,114,119,0,0,0,90,11,115,121,115,95,118,101,114, - 115,105,111,110,122,5,37,100,46,37,100,114,56,0,0,0, - 114,30,0,0,0,41,10,218,11,68,69,66,85,71,95,66, - 85,73,76,68,218,18,82,69,71,73,83,84,82,89,95,75, - 69,89,95,68,69,66,85,71,218,12,82,69,71,73,83,84, - 82,89,95,75,69,89,114,47,0,0,0,114,7,0,0,0, - 218,12,118,101,114,115,105,111,110,95,105,110,102,111,114,166, - 0,0,0,114,163,0,0,0,90,10,81,117,101,114,121,86, - 97,108,117,101,114,40,0,0,0,41,6,114,164,0,0,0, - 114,119,0,0,0,90,12,114,101,103,105,115,116,114,121,95, - 107,101,121,114,165,0,0,0,90,4,104,107,101,121,218,8, - 102,105,108,101,112,97,116,104,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,218,16,95,115,101,97,114,99,104, - 95,114,101,103,105,115,116,114,121,79,2,0,0,115,22,0, - 0,0,0,2,6,1,8,2,6,1,10,1,22,1,2,1, - 12,1,26,1,14,1,6,1,122,38,87,105,110,100,111,119, - 115,82,101,103,105,115,116,114,121,70,105,110,100,101,114,46, - 95,115,101,97,114,99,104,95,114,101,103,105,115,116,114,121, - 78,99,4,0,0,0,0,0,0,0,8,0,0,0,14,0, - 0,0,67,0,0,0,115,122,0,0,0,124,0,106,0,124, - 1,131,1,125,4,124,4,100,0,107,8,114,22,100,0,83, - 0,121,12,116,1,124,4,131,1,1,0,87,0,110,20,4, - 0,116,2,107,10,114,54,1,0,1,0,1,0,100,0,83, - 0,88,0,120,60,116,3,131,0,68,0,93,50,92,2,125, - 5,125,6,124,4,106,4,116,5,124,6,131,1,131,1,114, - 64,116,6,106,7,124,1,124,5,124,1,124,4,131,2,100, - 1,124,4,144,1,131,2,125,7,124,7,83,0,113,64,87, - 0,100,0,83,0,41,2,78,114,152,0,0,0,41,8,114, - 172,0,0,0,114,39,0,0,0,114,40,0,0,0,114,155, - 0,0,0,114,92,0,0,0,114,93,0,0,0,114,114,0, - 0,0,218,16,115,112,101,99,95,102,114,111,109,95,108,111, - 97,100,101,114,41,8,114,164,0,0,0,114,119,0,0,0, - 114,35,0,0,0,218,6,116,97,114,103,101,116,114,171,0, - 0,0,114,120,0,0,0,114,160,0,0,0,114,158,0,0, - 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 218,9,102,105,110,100,95,115,112,101,99,94,2,0,0,115, - 26,0,0,0,0,2,10,1,8,1,4,1,2,1,12,1, - 14,1,6,1,16,1,14,1,6,1,10,1,8,1,122,31, - 87,105,110,100,111,119,115,82,101,103,105,115,116,114,121,70, - 105,110,100,101,114,46,102,105,110,100,95,115,112,101,99,99, - 3,0,0,0,0,0,0,0,4,0,0,0,3,0,0,0, - 67,0,0,0,115,36,0,0,0,124,0,106,0,124,1,124, - 2,131,2,125,3,124,3,100,1,107,9,114,28,124,3,106, - 1,83,0,110,4,100,1,83,0,100,1,83,0,41,2,122, - 108,70,105,110,100,32,109,111,100,117,108,101,32,110,97,109, - 101,100,32,105,110,32,116,104,101,32,114,101,103,105,115,116, - 114,121,46,10,10,32,32,32,32,32,32,32,32,84,104,105, - 115,32,109,101,116,104,111,100,32,105,115,32,100,101,112,114, - 101,99,97,116,101,100,46,32,32,85,115,101,32,101,120,101, - 99,95,109,111,100,117,108,101,40,41,32,105,110,115,116,101, - 97,100,46,10,10,32,32,32,32,32,32,32,32,78,41,2, - 114,175,0,0,0,114,120,0,0,0,41,4,114,164,0,0, - 0,114,119,0,0,0,114,35,0,0,0,114,158,0,0,0, - 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218, - 11,102,105,110,100,95,109,111,100,117,108,101,110,2,0,0, - 115,8,0,0,0,0,7,12,1,8,1,8,2,122,33,87, - 105,110,100,111,119,115,82,101,103,105,115,116,114,121,70,105, - 110,100,101,114,46,102,105,110,100,95,109,111,100,117,108,101, - 41,12,114,105,0,0,0,114,104,0,0,0,114,106,0,0, - 0,114,107,0,0,0,114,169,0,0,0,114,168,0,0,0, - 114,167,0,0,0,218,11,99,108,97,115,115,109,101,116,104, - 111,100,114,166,0,0,0,114,172,0,0,0,114,175,0,0, - 0,114,176,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,162,0,0,0,60, + 100,101,95,104,101,97,100,101,114,40,41,46,122,21,99,111, + 100,101,32,111,98,106,101,99,116,32,102,114,111,109,32,123, + 33,114,125,78,122,23,78,111,110,45,99,111,100,101,32,111, + 98,106,101,99,116,32,105,110,32,123,33,114,125,114,99,0, + 0,0,114,35,0,0,0,41,10,218,7,109,97,114,115,104, + 97,108,90,5,108,111,97,100,115,218,10,105,115,105,110,115, + 116,97,110,99,101,218,10,95,99,111,100,101,95,116,121,112, + 101,114,115,0,0,0,114,130,0,0,0,218,4,95,105,109, + 112,90,16,95,102,105,120,95,99,111,95,102,105,108,101,110, + 97,109,101,114,100,0,0,0,114,48,0,0,0,41,5,114, + 54,0,0,0,114,99,0,0,0,114,90,0,0,0,114,91, + 0,0,0,218,4,99,111,100,101,114,4,0,0,0,114,4, + 0,0,0,114,5,0,0,0,218,17,95,99,111,109,112,105, + 108,101,95,98,121,116,101,99,111,100,101,213,1,0,0,115, + 16,0,0,0,0,2,10,1,10,1,12,1,8,1,12,1, + 6,2,12,1,114,142,0,0,0,114,60,0,0,0,99,3, + 0,0,0,0,0,0,0,4,0,0,0,3,0,0,0,67, + 0,0,0,115,56,0,0,0,116,0,116,1,131,1,125,3, + 124,3,106,2,116,3,124,1,131,1,131,1,1,0,124,3, + 106,2,116,3,124,2,131,1,131,1,1,0,124,3,106,2, + 116,4,106,5,124,0,131,1,131,1,1,0,124,3,83,0, + 41,1,122,80,67,111,109,112,105,108,101,32,97,32,99,111, + 100,101,32,111,98,106,101,99,116,32,105,110,116,111,32,98, + 121,116,101,99,111,100,101,32,102,111,114,32,119,114,105,116, + 105,110,103,32,111,117,116,32,116,111,32,97,32,98,121,116, + 101,45,99,111,109,112,105,108,101,100,10,32,32,32,32,102, + 105,108,101,46,41,6,218,9,98,121,116,101,97,114,114,97, + 121,114,129,0,0,0,218,6,101,120,116,101,110,100,114,17, + 0,0,0,114,137,0,0,0,90,5,100,117,109,112,115,41, + 4,114,141,0,0,0,114,127,0,0,0,114,135,0,0,0, + 114,54,0,0,0,114,4,0,0,0,114,4,0,0,0,114, + 5,0,0,0,218,17,95,99,111,100,101,95,116,111,95,98, + 121,116,101,99,111,100,101,225,1,0,0,115,10,0,0,0, + 0,3,8,1,14,1,14,1,16,1,114,145,0,0,0,99, + 1,0,0,0,0,0,0,0,5,0,0,0,4,0,0,0, + 67,0,0,0,115,62,0,0,0,100,1,100,2,108,0,125, + 1,116,1,106,2,124,0,131,1,106,3,125,2,124,1,106, + 4,124,2,131,1,125,3,116,1,106,5,100,2,100,3,131, + 2,125,4,124,4,106,6,124,0,106,6,124,3,100,1,25, + 0,131,1,131,1,83,0,41,4,122,121,68,101,99,111,100, + 101,32,98,121,116,101,115,32,114,101,112,114,101,115,101,110, + 116,105,110,103,32,115,111,117,114,99,101,32,99,111,100,101, + 32,97,110,100,32,114,101,116,117,114,110,32,116,104,101,32, + 115,116,114,105,110,103,46,10,10,32,32,32,32,85,110,105, + 118,101,114,115,97,108,32,110,101,119,108,105,110,101,32,115, + 117,112,112,111,114,116,32,105,115,32,117,115,101,100,32,105, + 110,32,116,104,101,32,100,101,99,111,100,105,110,103,46,10, + 32,32,32,32,114,60,0,0,0,78,84,41,7,218,8,116, + 111,107,101,110,105,122,101,114,50,0,0,0,90,7,66,121, + 116,101,115,73,79,90,8,114,101,97,100,108,105,110,101,90, + 15,100,101,116,101,99,116,95,101,110,99,111,100,105,110,103, + 90,25,73,110,99,114,101,109,101,110,116,97,108,78,101,119, + 108,105,110,101,68,101,99,111,100,101,114,218,6,100,101,99, + 111,100,101,41,5,218,12,115,111,117,114,99,101,95,98,121, + 116,101,115,114,146,0,0,0,90,21,115,111,117,114,99,101, + 95,98,121,116,101,115,95,114,101,97,100,108,105,110,101,218, + 8,101,110,99,111,100,105,110,103,90,15,110,101,119,108,105, + 110,101,95,100,101,99,111,100,101,114,114,4,0,0,0,114, + 4,0,0,0,114,5,0,0,0,218,13,100,101,99,111,100, + 101,95,115,111,117,114,99,101,235,1,0,0,115,10,0,0, + 0,0,5,8,1,12,1,10,1,12,1,114,150,0,0,0, + 41,2,114,121,0,0,0,218,26,115,117,98,109,111,100,117, + 108,101,95,115,101,97,114,99,104,95,108,111,99,97,116,105, + 111,110,115,99,2,0,0,0,2,0,0,0,9,0,0,0, + 19,0,0,0,67,0,0,0,115,8,1,0,0,124,1,100, + 1,107,8,114,58,100,2,125,1,116,0,124,2,100,3,131, + 2,114,58,121,14,124,2,106,1,124,0,131,1,125,1,87, + 0,110,20,4,0,116,2,107,10,114,56,1,0,1,0,1, + 0,89,0,110,2,88,0,116,3,106,4,124,0,124,2,100, + 4,124,1,144,1,131,2,125,4,100,5,124,4,95,5,124, + 2,100,1,107,8,114,146,120,54,116,6,131,0,68,0,93, + 40,92,2,125,5,125,6,124,1,106,7,116,8,124,6,131, + 1,131,1,114,98,124,5,124,0,124,1,131,2,125,2,124, + 2,124,4,95,9,80,0,113,98,87,0,100,1,83,0,124, + 3,116,10,107,8,114,212,116,0,124,2,100,6,131,2,114, + 218,121,14,124,2,106,11,124,0,131,1,125,7,87,0,110, + 20,4,0,116,2,107,10,114,198,1,0,1,0,1,0,89, + 0,113,218,88,0,124,7,114,218,103,0,124,4,95,12,110, + 6,124,3,124,4,95,12,124,4,106,12,103,0,107,2,144, + 1,114,4,124,1,144,1,114,4,116,13,124,1,131,1,100, + 7,25,0,125,8,124,4,106,12,106,14,124,8,131,1,1, + 0,124,4,83,0,41,8,97,61,1,0,0,82,101,116,117, + 114,110,32,97,32,109,111,100,117,108,101,32,115,112,101,99, + 32,98,97,115,101,100,32,111,110,32,97,32,102,105,108,101, + 32,108,111,99,97,116,105,111,110,46,10,10,32,32,32,32, + 84,111,32,105,110,100,105,99,97,116,101,32,116,104,97,116, + 32,116,104,101,32,109,111,100,117,108,101,32,105,115,32,97, + 32,112,97,99,107,97,103,101,44,32,115,101,116,10,32,32, + 32,32,115,117,98,109,111,100,117,108,101,95,115,101,97,114, + 99,104,95,108,111,99,97,116,105,111,110,115,32,116,111,32, + 97,32,108,105,115,116,32,111,102,32,100,105,114,101,99,116, + 111,114,121,32,112,97,116,104,115,46,32,32,65,110,10,32, + 32,32,32,101,109,112,116,121,32,108,105,115,116,32,105,115, + 32,115,117,102,102,105,99,105,101,110,116,44,32,116,104,111, + 117,103,104,32,105,116,115,32,110,111,116,32,111,116,104,101, + 114,119,105,115,101,32,117,115,101,102,117,108,32,116,111,32, + 116,104,101,10,32,32,32,32,105,109,112,111,114,116,32,115, + 121,115,116,101,109,46,10,10,32,32,32,32,84,104,101,32, + 108,111,97,100,101,114,32,109,117,115,116,32,116,97,107,101, + 32,97,32,115,112,101,99,32,97,115,32,105,116,115,32,111, + 110,108,121,32,95,95,105,110,105,116,95,95,40,41,32,97, + 114,103,46,10,10,32,32,32,32,78,122,9,60,117,110,107, + 110,111,119,110,62,218,12,103,101,116,95,102,105,108,101,110, + 97,109,101,218,6,111,114,105,103,105,110,84,218,10,105,115, + 95,112,97,99,107,97,103,101,114,60,0,0,0,41,15,114, + 109,0,0,0,114,152,0,0,0,114,100,0,0,0,114,115, + 0,0,0,218,10,77,111,100,117,108,101,83,112,101,99,90, + 13,95,115,101,116,95,102,105,108,101,97,116,116,114,218,27, + 95,103,101,116,95,115,117,112,112,111,114,116,101,100,95,102, + 105,108,101,95,108,111,97,100,101,114,115,114,93,0,0,0, + 114,94,0,0,0,114,121,0,0,0,218,9,95,80,79,80, + 85,76,65,84,69,114,154,0,0,0,114,151,0,0,0,114, + 38,0,0,0,218,6,97,112,112,101,110,100,41,9,114,99, + 0,0,0,90,8,108,111,99,97,116,105,111,110,114,121,0, + 0,0,114,151,0,0,0,218,4,115,112,101,99,218,12,108, + 111,97,100,101,114,95,99,108,97,115,115,218,8,115,117,102, + 102,105,120,101,115,114,154,0,0,0,90,7,100,105,114,110, + 97,109,101,114,4,0,0,0,114,4,0,0,0,114,5,0, + 0,0,218,23,115,112,101,99,95,102,114,111,109,95,102,105, + 108,101,95,108,111,99,97,116,105,111,110,252,1,0,0,115, + 60,0,0,0,0,12,8,4,4,1,10,2,2,1,14,1, + 14,1,6,8,18,1,6,3,8,1,16,1,14,1,10,1, + 6,1,6,2,4,3,8,2,10,1,2,1,14,1,14,1, + 6,2,4,1,8,2,6,1,12,1,6,1,12,1,12,2, + 114,162,0,0,0,99,0,0,0,0,0,0,0,0,0,0, + 0,0,4,0,0,0,64,0,0,0,115,80,0,0,0,101, + 0,90,1,100,0,90,2,100,1,90,3,100,2,90,4,100, + 3,90,5,100,4,90,6,101,7,100,5,100,6,132,0,131, + 1,90,8,101,7,100,7,100,8,132,0,131,1,90,9,101, + 7,100,14,100,10,100,11,132,1,131,1,90,10,101,7,100, + 15,100,12,100,13,132,1,131,1,90,11,100,9,83,0,41, + 16,218,21,87,105,110,100,111,119,115,82,101,103,105,115,116, + 114,121,70,105,110,100,101,114,122,62,77,101,116,97,32,112, + 97,116,104,32,102,105,110,100,101,114,32,102,111,114,32,109, + 111,100,117,108,101,115,32,100,101,99,108,97,114,101,100,32, + 105,110,32,116,104,101,32,87,105,110,100,111,119,115,32,114, + 101,103,105,115,116,114,121,46,122,59,83,111,102,116,119,97, + 114,101,92,80,121,116,104,111,110,92,80,121,116,104,111,110, + 67,111,114,101,92,123,115,121,115,95,118,101,114,115,105,111, + 110,125,92,77,111,100,117,108,101,115,92,123,102,117,108,108, + 110,97,109,101,125,122,65,83,111,102,116,119,97,114,101,92, + 80,121,116,104,111,110,92,80,121,116,104,111,110,67,111,114, + 101,92,123,115,121,115,95,118,101,114,115,105,111,110,125,92, + 77,111,100,117,108,101,115,92,123,102,117,108,108,110,97,109, + 101,125,92,68,101,98,117,103,70,99,2,0,0,0,0,0, + 0,0,2,0,0,0,11,0,0,0,67,0,0,0,115,50, + 0,0,0,121,14,116,0,106,1,116,0,106,2,124,1,131, + 2,83,0,4,0,116,3,107,10,114,44,1,0,1,0,1, + 0,116,0,106,1,116,0,106,4,124,1,131,2,83,0,88, + 0,100,0,83,0,41,1,78,41,5,218,7,95,119,105,110, + 114,101,103,90,7,79,112,101,110,75,101,121,90,17,72,75, + 69,89,95,67,85,82,82,69,78,84,95,85,83,69,82,114, + 40,0,0,0,90,18,72,75,69,89,95,76,79,67,65,76, + 95,77,65,67,72,73,78,69,41,2,218,3,99,108,115,218, + 3,107,101,121,114,4,0,0,0,114,4,0,0,0,114,5, + 0,0,0,218,14,95,111,112,101,110,95,114,101,103,105,115, + 116,114,121,74,2,0,0,115,8,0,0,0,0,2,2,1, + 14,1,14,1,122,36,87,105,110,100,111,119,115,82,101,103, + 105,115,116,114,121,70,105,110,100,101,114,46,95,111,112,101, + 110,95,114,101,103,105,115,116,114,121,99,2,0,0,0,0, + 0,0,0,6,0,0,0,16,0,0,0,67,0,0,0,115, + 116,0,0,0,124,0,106,0,114,14,124,0,106,1,125,2, + 110,6,124,0,106,2,125,2,124,2,106,3,100,1,124,1, + 100,2,100,3,116,4,106,5,100,0,100,4,133,2,25,0, + 22,0,144,2,131,0,125,3,121,38,124,0,106,6,124,3, + 131,1,143,18,125,4,116,7,106,8,124,4,100,5,131,2, + 125,5,87,0,100,0,81,0,82,0,88,0,87,0,110,20, + 4,0,116,9,107,10,114,110,1,0,1,0,1,0,100,0, + 83,0,88,0,124,5,83,0,41,6,78,114,120,0,0,0, + 90,11,115,121,115,95,118,101,114,115,105,111,110,122,5,37, + 100,46,37,100,114,57,0,0,0,114,30,0,0,0,41,10, + 218,11,68,69,66,85,71,95,66,85,73,76,68,218,18,82, + 69,71,73,83,84,82,89,95,75,69,89,95,68,69,66,85, + 71,218,12,82,69,71,73,83,84,82,89,95,75,69,89,114, + 48,0,0,0,114,7,0,0,0,218,12,118,101,114,115,105, + 111,110,95,105,110,102,111,114,167,0,0,0,114,164,0,0, + 0,90,10,81,117,101,114,121,86,97,108,117,101,114,40,0, + 0,0,41,6,114,165,0,0,0,114,120,0,0,0,90,12, + 114,101,103,105,115,116,114,121,95,107,101,121,114,166,0,0, + 0,90,4,104,107,101,121,218,8,102,105,108,101,112,97,116, + 104,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, + 218,16,95,115,101,97,114,99,104,95,114,101,103,105,115,116, + 114,121,81,2,0,0,115,22,0,0,0,0,2,6,1,8, + 2,6,1,10,1,22,1,2,1,12,1,26,1,14,1,6, + 1,122,38,87,105,110,100,111,119,115,82,101,103,105,115,116, + 114,121,70,105,110,100,101,114,46,95,115,101,97,114,99,104, + 95,114,101,103,105,115,116,114,121,78,99,4,0,0,0,0, + 0,0,0,8,0,0,0,14,0,0,0,67,0,0,0,115, + 122,0,0,0,124,0,106,0,124,1,131,1,125,4,124,4, + 100,0,107,8,114,22,100,0,83,0,121,12,116,1,124,4, + 131,1,1,0,87,0,110,20,4,0,116,2,107,10,114,54, + 1,0,1,0,1,0,100,0,83,0,88,0,120,60,116,3, + 131,0,68,0,93,50,92,2,125,5,125,6,124,4,106,4, + 116,5,124,6,131,1,131,1,114,64,116,6,106,7,124,1, + 124,5,124,1,124,4,131,2,100,1,124,4,144,1,131,2, + 125,7,124,7,83,0,113,64,87,0,100,0,83,0,41,2, + 78,114,153,0,0,0,41,8,114,173,0,0,0,114,39,0, + 0,0,114,40,0,0,0,114,156,0,0,0,114,93,0,0, + 0,114,94,0,0,0,114,115,0,0,0,218,16,115,112,101, + 99,95,102,114,111,109,95,108,111,97,100,101,114,41,8,114, + 165,0,0,0,114,120,0,0,0,114,35,0,0,0,218,6, + 116,97,114,103,101,116,114,172,0,0,0,114,121,0,0,0, + 114,161,0,0,0,114,159,0,0,0,114,4,0,0,0,114, + 4,0,0,0,114,5,0,0,0,218,9,102,105,110,100,95, + 115,112,101,99,96,2,0,0,115,26,0,0,0,0,2,10, + 1,8,1,4,1,2,1,12,1,14,1,6,1,16,1,14, + 1,6,1,10,1,8,1,122,31,87,105,110,100,111,119,115, + 82,101,103,105,115,116,114,121,70,105,110,100,101,114,46,102, + 105,110,100,95,115,112,101,99,99,3,0,0,0,0,0,0, + 0,4,0,0,0,3,0,0,0,67,0,0,0,115,36,0, + 0,0,124,0,106,0,124,1,124,2,131,2,125,3,124,3, + 100,1,107,9,114,28,124,3,106,1,83,0,110,4,100,1, + 83,0,100,1,83,0,41,2,122,108,70,105,110,100,32,109, + 111,100,117,108,101,32,110,97,109,101,100,32,105,110,32,116, + 104,101,32,114,101,103,105,115,116,114,121,46,10,10,32,32, + 32,32,32,32,32,32,84,104,105,115,32,109,101,116,104,111, + 100,32,105,115,32,100,101,112,114,101,99,97,116,101,100,46, + 32,32,85,115,101,32,101,120,101,99,95,109,111,100,117,108, + 101,40,41,32,105,110,115,116,101,97,100,46,10,10,32,32, + 32,32,32,32,32,32,78,41,2,114,176,0,0,0,114,121, + 0,0,0,41,4,114,165,0,0,0,114,120,0,0,0,114, + 35,0,0,0,114,159,0,0,0,114,4,0,0,0,114,4, + 0,0,0,114,5,0,0,0,218,11,102,105,110,100,95,109, + 111,100,117,108,101,112,2,0,0,115,8,0,0,0,0,7, + 12,1,8,1,8,2,122,33,87,105,110,100,111,119,115,82, + 101,103,105,115,116,114,121,70,105,110,100,101,114,46,102,105, + 110,100,95,109,111,100,117,108,101,41,2,78,78,41,1,78, + 41,12,114,106,0,0,0,114,105,0,0,0,114,107,0,0, + 0,114,108,0,0,0,114,170,0,0,0,114,169,0,0,0, + 114,168,0,0,0,218,11,99,108,97,115,115,109,101,116,104, + 111,100,114,167,0,0,0,114,173,0,0,0,114,176,0,0, + 0,114,177,0,0,0,114,4,0,0,0,114,4,0,0,0, + 114,4,0,0,0,114,5,0,0,0,114,163,0,0,0,62, 2,0,0,115,20,0,0,0,8,2,4,3,4,3,4,2, - 4,2,12,7,12,15,2,1,14,15,2,1,114,162,0,0, + 4,2,12,7,12,15,2,1,12,15,2,1,114,163,0,0, 0,99,0,0,0,0,0,0,0,0,0,0,0,0,2,0, 0,0,64,0,0,0,115,48,0,0,0,101,0,90,1,100, 0,90,2,100,1,90,3,100,2,100,3,132,0,90,4,100, @@ -925,13 +925,13 @@ 101,116,95,102,105,108,101,110,97,109,101,32,104,97,115,32, 97,32,102,105,108,101,110,97,109,101,32,111,102,32,39,95, 95,105,110,105,116,95,95,46,112,121,39,46,114,29,0,0, - 0,114,58,0,0,0,114,59,0,0,0,114,56,0,0,0, + 0,114,59,0,0,0,114,60,0,0,0,114,57,0,0,0, 218,8,95,95,105,110,105,116,95,95,41,4,114,38,0,0, - 0,114,151,0,0,0,114,34,0,0,0,114,32,0,0,0, - 41,5,114,100,0,0,0,114,119,0,0,0,114,94,0,0, + 0,114,152,0,0,0,114,34,0,0,0,114,32,0,0,0, + 41,5,114,101,0,0,0,114,120,0,0,0,114,95,0,0, 0,90,13,102,105,108,101,110,97,109,101,95,98,97,115,101, 90,9,116,97,105,108,95,110,97,109,101,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,153,0,0,0,129, + 114,4,0,0,0,114,5,0,0,0,114,154,0,0,0,131, 2,0,0,115,8,0,0,0,0,3,18,1,16,1,14,1, 122,24,95,76,111,97,100,101,114,66,97,115,105,99,115,46, 105,115,95,112,97,99,107,97,103,101,99,2,0,0,0,0, @@ -939,10 +939,10 @@ 4,0,0,0,100,1,83,0,41,2,122,42,85,115,101,32, 100,101,102,97,117,108,116,32,115,101,109,97,110,116,105,99, 115,32,102,111,114,32,109,111,100,117,108,101,32,99,114,101, - 97,116,105,111,110,46,78,114,4,0,0,0,41,2,114,100, - 0,0,0,114,158,0,0,0,114,4,0,0,0,114,4,0, + 97,116,105,111,110,46,78,114,4,0,0,0,41,2,114,101, + 0,0,0,114,159,0,0,0,114,4,0,0,0,114,4,0, 0,0,114,5,0,0,0,218,13,99,114,101,97,116,101,95, - 109,111,100,117,108,101,137,2,0,0,115,0,0,0,0,122, + 109,111,100,117,108,101,139,2,0,0,115,0,0,0,0,122, 27,95,76,111,97,100,101,114,66,97,115,105,99,115,46,99, 114,101,97,116,101,95,109,111,100,117,108,101,99,2,0,0, 0,0,0,0,0,3,0,0,0,4,0,0,0,67,0,0, @@ -955,38 +955,38 @@ 111,97,100,32,109,111,100,117,108,101,32,123,33,114,125,32, 119,104,101,110,32,103,101,116,95,99,111,100,101,40,41,32, 114,101,116,117,114,110,115,32,78,111,110,101,41,8,218,8, - 103,101,116,95,99,111,100,101,114,105,0,0,0,114,99,0, - 0,0,114,47,0,0,0,114,114,0,0,0,218,25,95,99, + 103,101,116,95,99,111,100,101,114,106,0,0,0,114,100,0, + 0,0,114,48,0,0,0,114,115,0,0,0,218,25,95,99, 97,108,108,95,119,105,116,104,95,102,114,97,109,101,115,95, - 114,101,109,111,118,101,100,218,4,101,120,101,99,114,111,0, - 0,0,41,3,114,100,0,0,0,218,6,109,111,100,117,108, - 101,114,140,0,0,0,114,4,0,0,0,114,4,0,0,0, + 114,101,109,111,118,101,100,218,4,101,120,101,99,114,112,0, + 0,0,41,3,114,101,0,0,0,218,6,109,111,100,117,108, + 101,114,141,0,0,0,114,4,0,0,0,114,4,0,0,0, 114,5,0,0,0,218,11,101,120,101,99,95,109,111,100,117, - 108,101,140,2,0,0,115,10,0,0,0,0,2,12,1,8, + 108,101,142,2,0,0,115,10,0,0,0,0,2,12,1,8, 1,6,1,10,1,122,25,95,76,111,97,100,101,114,66,97, 115,105,99,115,46,101,120,101,99,95,109,111,100,117,108,101, 99,2,0,0,0,0,0,0,0,2,0,0,0,3,0,0, 0,67,0,0,0,115,12,0,0,0,116,0,106,1,124,0, 124,1,131,2,83,0,41,1,122,26,84,104,105,115,32,109, 111,100,117,108,101,32,105,115,32,100,101,112,114,101,99,97, - 116,101,100,46,41,2,114,114,0,0,0,218,17,95,108,111, + 116,101,100,46,41,2,114,115,0,0,0,218,17,95,108,111, 97,100,95,109,111,100,117,108,101,95,115,104,105,109,41,2, - 114,100,0,0,0,114,119,0,0,0,114,4,0,0,0,114, + 114,101,0,0,0,114,120,0,0,0,114,4,0,0,0,114, 4,0,0,0,114,5,0,0,0,218,11,108,111,97,100,95, - 109,111,100,117,108,101,148,2,0,0,115,2,0,0,0,0, + 109,111,100,117,108,101,150,2,0,0,115,2,0,0,0,0, 2,122,25,95,76,111,97,100,101,114,66,97,115,105,99,115, 46,108,111,97,100,95,109,111,100,117,108,101,78,41,8,114, - 105,0,0,0,114,104,0,0,0,114,106,0,0,0,114,107, - 0,0,0,114,153,0,0,0,114,180,0,0,0,114,185,0, - 0,0,114,187,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,4,0,0,0,114,5,0,0,0,114,178,0,0,0, - 124,2,0,0,115,10,0,0,0,8,3,4,2,8,8,8, - 3,8,8,114,178,0,0,0,99,0,0,0,0,0,0,0, - 0,0,0,0,0,4,0,0,0,64,0,0,0,115,74,0, + 106,0,0,0,114,105,0,0,0,114,107,0,0,0,114,108, + 0,0,0,114,154,0,0,0,114,181,0,0,0,114,186,0, + 0,0,114,188,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,4,0,0,0,114,5,0,0,0,114,179,0,0,0, + 126,2,0,0,115,10,0,0,0,8,3,4,2,8,8,8, + 3,8,8,114,179,0,0,0,99,0,0,0,0,0,0,0, + 0,0,0,0,0,3,0,0,0,64,0,0,0,115,74,0, 0,0,101,0,90,1,100,0,90,2,100,1,100,2,132,0, 90,3,100,3,100,4,132,0,90,4,100,5,100,6,132,0, 90,5,100,7,100,8,132,0,90,6,100,9,100,10,132,0, - 90,7,100,11,100,18,100,13,100,14,144,1,132,0,90,8, + 90,7,100,18,100,12,156,1,100,13,100,14,132,2,90,8, 100,15,100,16,132,0,90,9,100,17,83,0,41,19,218,12, 83,111,117,114,99,101,76,111,97,100,101,114,99,2,0,0, 0,0,0,0,0,2,0,0,0,1,0,0,0,67,0,0, @@ -1003,9 +1003,9 @@ 116,104,101,32,112,97,116,104,32,99,97,110,110,111,116,32, 98,101,32,104,97,110,100,108,101,100,46,10,32,32,32,32, 32,32,32,32,78,41,1,218,7,73,79,69,114,114,111,114, - 41,2,114,100,0,0,0,114,35,0,0,0,114,4,0,0, + 41,2,114,101,0,0,0,114,35,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,218,10,112,97,116, - 104,95,109,116,105,109,101,155,2,0,0,115,2,0,0,0, + 104,95,109,116,105,109,101,157,2,0,0,115,2,0,0,0, 0,6,122,23,83,111,117,114,99,101,76,111,97,100,101,114, 46,112,97,116,104,95,109,116,105,109,101,99,2,0,0,0, 0,0,0,0,2,0,0,0,3,0,0,0,67,0,0,0, @@ -1037,10 +1037,10 @@ 101,115,32,73,79,69,114,114,111,114,32,119,104,101,110,32, 116,104,101,32,112,97,116,104,32,99,97,110,110,111,116,32, 98,101,32,104,97,110,100,108,101,100,46,10,32,32,32,32, - 32,32,32,32,114,126,0,0,0,41,1,114,190,0,0,0, - 41,2,114,100,0,0,0,114,35,0,0,0,114,4,0,0, + 32,32,32,32,114,127,0,0,0,41,1,114,191,0,0,0, + 41,2,114,101,0,0,0,114,35,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,218,10,112,97,116, - 104,95,115,116,97,116,115,163,2,0,0,115,2,0,0,0, + 104,95,115,116,97,116,115,165,2,0,0,115,2,0,0,0, 0,11,122,23,83,111,117,114,99,101,76,111,97,100,101,114, 46,112,97,116,104,95,115,116,97,116,115,99,4,0,0,0, 0,0,0,0,4,0,0,0,3,0,0,0,67,0,0,0, @@ -1060,11 +1060,11 @@ 111,32,99,111,114,114,101,99,116,108,121,32,116,114,97,110, 115,102,101,114,32,112,101,114,109,105,115,115,105,111,110,115, 10,32,32,32,32,32,32,32,32,41,1,218,8,115,101,116, - 95,100,97,116,97,41,4,114,100,0,0,0,114,90,0,0, - 0,90,10,99,97,99,104,101,95,112,97,116,104,114,53,0, + 95,100,97,116,97,41,4,114,101,0,0,0,114,91,0,0, + 0,90,10,99,97,99,104,101,95,112,97,116,104,114,54,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, 0,218,15,95,99,97,99,104,101,95,98,121,116,101,99,111, - 100,101,176,2,0,0,115,2,0,0,0,0,8,122,28,83, + 100,101,178,2,0,0,115,2,0,0,0,0,8,122,28,83, 111,117,114,99,101,76,111,97,100,101,114,46,95,99,97,99, 104,101,95,98,121,116,101,99,111,100,101,99,3,0,0,0, 0,0,0,0,3,0,0,0,1,0,0,0,67,0,0,0, @@ -1078,9 +1078,9 @@ 32,97,108,108,111,119,115,32,102,111,114,32,116,104,101,32, 119,114,105,116,105,110,103,32,111,102,32,98,121,116,101,99, 111,100,101,32,102,105,108,101,115,46,10,32,32,32,32,32, - 32,32,32,78,114,4,0,0,0,41,3,114,100,0,0,0, - 114,35,0,0,0,114,53,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,192,0,0,0,186,2, + 32,32,32,78,114,4,0,0,0,41,3,114,101,0,0,0, + 114,35,0,0,0,114,54,0,0,0,114,4,0,0,0,114, + 4,0,0,0,114,5,0,0,0,114,193,0,0,0,188,2, 0,0,115,0,0,0,0,122,21,83,111,117,114,99,101,76, 111,97,100,101,114,46,115,101,116,95,100,97,116,97,99,2, 0,0,0,0,0,0,0,5,0,0,0,16,0,0,0,67, @@ -1095,1329 +1095,1332 @@ 99,116,76,111,97,100,101,114,46,103,101,116,95,115,111,117, 114,99,101,46,122,39,115,111,117,114,99,101,32,110,111,116, 32,97,118,97,105,108,97,98,108,101,32,116,104,114,111,117, - 103,104,32,103,101,116,95,100,97,116,97,40,41,114,98,0, - 0,0,78,41,5,114,151,0,0,0,218,8,103,101,116,95, - 100,97,116,97,114,40,0,0,0,114,99,0,0,0,114,149, - 0,0,0,41,5,114,100,0,0,0,114,119,0,0,0,114, - 35,0,0,0,114,147,0,0,0,218,3,101,120,99,114,4, + 103,104,32,103,101,116,95,100,97,116,97,40,41,114,99,0, + 0,0,78,41,5,114,152,0,0,0,218,8,103,101,116,95, + 100,97,116,97,114,40,0,0,0,114,100,0,0,0,114,150, + 0,0,0,41,5,114,101,0,0,0,114,120,0,0,0,114, + 35,0,0,0,114,148,0,0,0,218,3,101,120,99,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,218,10,103, - 101,116,95,115,111,117,114,99,101,193,2,0,0,115,14,0, + 101,116,95,115,111,117,114,99,101,195,2,0,0,115,14,0, 0,0,0,2,10,1,2,1,14,1,16,1,6,1,28,1, 122,23,83,111,117,114,99,101,76,111,97,100,101,114,46,103, - 101,116,95,115,111,117,114,99,101,218,9,95,111,112,116,105, - 109,105,122,101,114,29,0,0,0,99,3,0,0,0,1,0, - 0,0,4,0,0,0,9,0,0,0,67,0,0,0,115,26, - 0,0,0,116,0,106,1,116,2,124,1,124,2,100,1,100, - 2,100,3,100,4,124,3,144,2,131,4,83,0,41,5,122, - 130,82,101,116,117,114,110,32,116,104,101,32,99,111,100,101, - 32,111,98,106,101,99,116,32,99,111,109,112,105,108,101,100, - 32,102,114,111,109,32,115,111,117,114,99,101,46,10,10,32, - 32,32,32,32,32,32,32,84,104,101,32,39,100,97,116,97, - 39,32,97,114,103,117,109,101,110,116,32,99,97,110,32,98, - 101,32,97,110,121,32,111,98,106,101,99,116,32,116,121,112, - 101,32,116,104,97,116,32,99,111,109,112,105,108,101,40,41, - 32,115,117,112,112,111,114,116,115,46,10,32,32,32,32,32, - 32,32,32,114,183,0,0,0,218,12,100,111,110,116,95,105, - 110,104,101,114,105,116,84,114,68,0,0,0,41,3,114,114, - 0,0,0,114,182,0,0,0,218,7,99,111,109,112,105,108, - 101,41,4,114,100,0,0,0,114,53,0,0,0,114,35,0, - 0,0,114,197,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,5,0,0,0,218,14,115,111,117,114,99,101,95,116, - 111,95,99,111,100,101,203,2,0,0,115,4,0,0,0,0, - 5,14,1,122,27,83,111,117,114,99,101,76,111,97,100,101, - 114,46,115,111,117,114,99,101,95,116,111,95,99,111,100,101, - 99,2,0,0,0,0,0,0,0,10,0,0,0,43,0,0, - 0,67,0,0,0,115,106,1,0,0,124,0,106,0,124,1, - 131,1,125,2,100,1,125,3,121,12,116,1,124,2,131,1, - 125,4,87,0,110,24,4,0,116,2,107,10,114,50,1,0, - 1,0,1,0,100,1,125,4,89,0,110,174,88,0,121,14, - 124,0,106,3,124,2,131,1,125,5,87,0,110,20,4,0, - 116,4,107,10,114,86,1,0,1,0,1,0,89,0,110,138, - 88,0,116,5,124,5,100,2,25,0,131,1,125,3,121,14, - 124,0,106,6,124,4,131,1,125,6,87,0,110,20,4,0, - 116,7,107,10,114,134,1,0,1,0,1,0,89,0,110,90, - 88,0,121,26,116,8,124,6,100,3,124,5,100,4,124,1, - 100,5,124,4,144,3,131,1,125,7,87,0,110,24,4,0, - 116,9,116,10,102,2,107,10,114,186,1,0,1,0,1,0, - 89,0,110,38,88,0,116,11,106,12,100,6,124,4,124,2, - 131,3,1,0,116,13,124,7,100,4,124,1,100,7,124,4, - 100,8,124,2,144,3,131,1,83,0,124,0,106,6,124,2, - 131,1,125,8,124,0,106,14,124,8,124,2,131,2,125,9, - 116,11,106,12,100,9,124,2,131,2,1,0,116,15,106,16, - 12,0,144,1,114,102,124,4,100,1,107,9,144,1,114,102, - 124,3,100,1,107,9,144,1,114,102,116,17,124,9,124,3, - 116,18,124,8,131,1,131,3,125,6,121,30,124,0,106,19, - 124,2,124,4,124,6,131,3,1,0,116,11,106,12,100,10, - 124,4,131,2,1,0,87,0,110,22,4,0,116,2,107,10, - 144,1,114,100,1,0,1,0,1,0,89,0,110,2,88,0, - 124,9,83,0,41,11,122,190,67,111,110,99,114,101,116,101, - 32,105,109,112,108,101,109,101,110,116,97,116,105,111,110,32, - 111,102,32,73,110,115,112,101,99,116,76,111,97,100,101,114, - 46,103,101,116,95,99,111,100,101,46,10,10,32,32,32,32, - 32,32,32,32,82,101,97,100,105,110,103,32,111,102,32,98, - 121,116,101,99,111,100,101,32,114,101,113,117,105,114,101,115, - 32,112,97,116,104,95,115,116,97,116,115,32,116,111,32,98, - 101,32,105,109,112,108,101,109,101,110,116,101,100,46,32,84, - 111,32,119,114,105,116,101,10,32,32,32,32,32,32,32,32, - 98,121,116,101,99,111,100,101,44,32,115,101,116,95,100,97, - 116,97,32,109,117,115,116,32,97,108,115,111,32,98,101,32, - 105,109,112,108,101,109,101,110,116,101,100,46,10,10,32,32, - 32,32,32,32,32,32,78,114,126,0,0,0,114,132,0,0, - 0,114,98,0,0,0,114,35,0,0,0,122,13,123,125,32, - 109,97,116,99,104,101,115,32,123,125,114,89,0,0,0,114, - 90,0,0,0,122,19,99,111,100,101,32,111,98,106,101,99, - 116,32,102,114,111,109,32,123,125,122,10,119,114,111,116,101, - 32,123,33,114,125,41,20,114,151,0,0,0,114,79,0,0, - 0,114,66,0,0,0,114,191,0,0,0,114,189,0,0,0, - 114,14,0,0,0,114,194,0,0,0,114,40,0,0,0,114, - 135,0,0,0,114,99,0,0,0,114,130,0,0,0,114,114, - 0,0,0,114,129,0,0,0,114,141,0,0,0,114,200,0, - 0,0,114,7,0,0,0,218,19,100,111,110,116,95,119,114, - 105,116,101,95,98,121,116,101,99,111,100,101,114,144,0,0, - 0,114,31,0,0,0,114,193,0,0,0,41,10,114,100,0, - 0,0,114,119,0,0,0,114,90,0,0,0,114,133,0,0, - 0,114,89,0,0,0,218,2,115,116,114,53,0,0,0,218, - 10,98,121,116,101,115,95,100,97,116,97,114,147,0,0,0, - 90,11,99,111,100,101,95,111,98,106,101,99,116,114,4,0, - 0,0,114,4,0,0,0,114,5,0,0,0,114,181,0,0, - 0,211,2,0,0,115,78,0,0,0,0,7,10,1,4,1, - 2,1,12,1,14,1,10,2,2,1,14,1,14,1,6,2, - 12,1,2,1,14,1,14,1,6,2,2,1,6,1,8,1, - 12,1,18,1,6,2,8,1,6,1,10,1,4,1,8,1, - 10,1,12,1,12,1,20,1,10,1,6,1,10,1,2,1, - 14,1,16,1,16,1,6,1,122,21,83,111,117,114,99,101, - 76,111,97,100,101,114,46,103,101,116,95,99,111,100,101,78, - 114,87,0,0,0,41,10,114,105,0,0,0,114,104,0,0, - 0,114,106,0,0,0,114,190,0,0,0,114,191,0,0,0, - 114,193,0,0,0,114,192,0,0,0,114,196,0,0,0,114, - 200,0,0,0,114,181,0,0,0,114,4,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,5,0,0,0,114,188,0, - 0,0,153,2,0,0,115,14,0,0,0,8,2,8,8,8, - 13,8,10,8,7,8,10,14,8,114,188,0,0,0,99,0, - 0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0, - 0,0,0,115,76,0,0,0,101,0,90,1,100,0,90,2, + 101,116,95,115,111,117,114,99,101,114,29,0,0,0,41,1, + 218,9,95,111,112,116,105,109,105,122,101,99,3,0,0,0, + 1,0,0,0,4,0,0,0,9,0,0,0,67,0,0,0, + 115,26,0,0,0,116,0,106,1,116,2,124,1,124,2,100, + 1,100,2,100,3,100,4,124,3,144,2,131,4,83,0,41, + 5,122,130,82,101,116,117,114,110,32,116,104,101,32,99,111, + 100,101,32,111,98,106,101,99,116,32,99,111,109,112,105,108, + 101,100,32,102,114,111,109,32,115,111,117,114,99,101,46,10, + 10,32,32,32,32,32,32,32,32,84,104,101,32,39,100,97, + 116,97,39,32,97,114,103,117,109,101,110,116,32,99,97,110, + 32,98,101,32,97,110,121,32,111,98,106,101,99,116,32,116, + 121,112,101,32,116,104,97,116,32,99,111,109,112,105,108,101, + 40,41,32,115,117,112,112,111,114,116,115,46,10,32,32,32, + 32,32,32,32,32,114,184,0,0,0,218,12,100,111,110,116, + 95,105,110,104,101,114,105,116,84,114,69,0,0,0,41,3, + 114,115,0,0,0,114,183,0,0,0,218,7,99,111,109,112, + 105,108,101,41,4,114,101,0,0,0,114,54,0,0,0,114, + 35,0,0,0,114,198,0,0,0,114,4,0,0,0,114,4, + 0,0,0,114,5,0,0,0,218,14,115,111,117,114,99,101, + 95,116,111,95,99,111,100,101,205,2,0,0,115,4,0,0, + 0,0,5,14,1,122,27,83,111,117,114,99,101,76,111,97, + 100,101,114,46,115,111,117,114,99,101,95,116,111,95,99,111, + 100,101,99,2,0,0,0,0,0,0,0,10,0,0,0,43, + 0,0,0,67,0,0,0,115,106,1,0,0,124,0,106,0, + 124,1,131,1,125,2,100,1,125,3,121,12,116,1,124,2, + 131,1,125,4,87,0,110,24,4,0,116,2,107,10,114,50, + 1,0,1,0,1,0,100,1,125,4,89,0,110,174,88,0, + 121,14,124,0,106,3,124,2,131,1,125,5,87,0,110,20, + 4,0,116,4,107,10,114,86,1,0,1,0,1,0,89,0, + 110,138,88,0,116,5,124,5,100,2,25,0,131,1,125,3, + 121,14,124,0,106,6,124,4,131,1,125,6,87,0,110,20, + 4,0,116,7,107,10,114,134,1,0,1,0,1,0,89,0, + 110,90,88,0,121,26,116,8,124,6,100,3,124,5,100,4, + 124,1,100,5,124,4,144,3,131,1,125,7,87,0,110,24, + 4,0,116,9,116,10,102,2,107,10,114,186,1,0,1,0, + 1,0,89,0,110,38,88,0,116,11,106,12,100,6,124,4, + 124,2,131,3,1,0,116,13,124,7,100,4,124,1,100,7, + 124,4,100,8,124,2,144,3,131,1,83,0,124,0,106,6, + 124,2,131,1,125,8,124,0,106,14,124,8,124,2,131,2, + 125,9,116,11,106,12,100,9,124,2,131,2,1,0,116,15, + 106,16,12,0,144,1,114,102,124,4,100,1,107,9,144,1, + 114,102,124,3,100,1,107,9,144,1,114,102,116,17,124,9, + 124,3,116,18,124,8,131,1,131,3,125,6,121,30,124,0, + 106,19,124,2,124,4,124,6,131,3,1,0,116,11,106,12, + 100,10,124,4,131,2,1,0,87,0,110,22,4,0,116,2, + 107,10,144,1,114,100,1,0,1,0,1,0,89,0,110,2, + 88,0,124,9,83,0,41,11,122,190,67,111,110,99,114,101, + 116,101,32,105,109,112,108,101,109,101,110,116,97,116,105,111, + 110,32,111,102,32,73,110,115,112,101,99,116,76,111,97,100, + 101,114,46,103,101,116,95,99,111,100,101,46,10,10,32,32, + 32,32,32,32,32,32,82,101,97,100,105,110,103,32,111,102, + 32,98,121,116,101,99,111,100,101,32,114,101,113,117,105,114, + 101,115,32,112,97,116,104,95,115,116,97,116,115,32,116,111, + 32,98,101,32,105,109,112,108,101,109,101,110,116,101,100,46, + 32,84,111,32,119,114,105,116,101,10,32,32,32,32,32,32, + 32,32,98,121,116,101,99,111,100,101,44,32,115,101,116,95, + 100,97,116,97,32,109,117,115,116,32,97,108,115,111,32,98, + 101,32,105,109,112,108,101,109,101,110,116,101,100,46,10,10, + 32,32,32,32,32,32,32,32,78,114,127,0,0,0,114,133, + 0,0,0,114,99,0,0,0,114,35,0,0,0,122,13,123, + 125,32,109,97,116,99,104,101,115,32,123,125,114,90,0,0, + 0,114,91,0,0,0,122,19,99,111,100,101,32,111,98,106, + 101,99,116,32,102,114,111,109,32,123,125,122,10,119,114,111, + 116,101,32,123,33,114,125,41,20,114,152,0,0,0,114,80, + 0,0,0,114,67,0,0,0,114,192,0,0,0,114,190,0, + 0,0,114,14,0,0,0,114,195,0,0,0,114,40,0,0, + 0,114,136,0,0,0,114,100,0,0,0,114,131,0,0,0, + 114,115,0,0,0,114,130,0,0,0,114,142,0,0,0,114, + 201,0,0,0,114,7,0,0,0,218,19,100,111,110,116,95, + 119,114,105,116,101,95,98,121,116,101,99,111,100,101,114,145, + 0,0,0,114,31,0,0,0,114,194,0,0,0,41,10,114, + 101,0,0,0,114,120,0,0,0,114,91,0,0,0,114,134, + 0,0,0,114,90,0,0,0,218,2,115,116,114,54,0,0, + 0,218,10,98,121,116,101,115,95,100,97,116,97,114,148,0, + 0,0,90,11,99,111,100,101,95,111,98,106,101,99,116,114, + 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,182, + 0,0,0,213,2,0,0,115,78,0,0,0,0,7,10,1, + 4,1,2,1,12,1,14,1,10,2,2,1,14,1,14,1, + 6,2,12,1,2,1,14,1,14,1,6,2,2,1,6,1, + 8,1,12,1,18,1,6,2,8,1,6,1,10,1,4,1, + 8,1,10,1,12,1,12,1,20,1,10,1,6,1,10,1, + 2,1,14,1,16,1,16,1,6,1,122,21,83,111,117,114, + 99,101,76,111,97,100,101,114,46,103,101,116,95,99,111,100, + 101,78,114,88,0,0,0,41,10,114,106,0,0,0,114,105, + 0,0,0,114,107,0,0,0,114,191,0,0,0,114,192,0, + 0,0,114,194,0,0,0,114,193,0,0,0,114,197,0,0, + 0,114,201,0,0,0,114,182,0,0,0,114,4,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, + 189,0,0,0,155,2,0,0,115,14,0,0,0,8,2,8, + 8,8,13,8,10,8,7,8,10,14,8,114,189,0,0,0, + 99,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0, + 0,0,0,0,0,115,76,0,0,0,101,0,90,1,100,0, + 90,2,100,1,90,3,100,2,100,3,132,0,90,4,100,4, + 100,5,132,0,90,5,100,6,100,7,132,0,90,6,101,7, + 135,0,102,1,100,8,100,9,132,8,131,1,90,8,101,7, + 100,10,100,11,132,0,131,1,90,9,100,12,100,13,132,0, + 90,10,135,0,83,0,41,14,218,10,70,105,108,101,76,111, + 97,100,101,114,122,103,66,97,115,101,32,102,105,108,101,32, + 108,111,97,100,101,114,32,99,108,97,115,115,32,119,104,105, + 99,104,32,105,109,112,108,101,109,101,110,116,115,32,116,104, + 101,32,108,111,97,100,101,114,32,112,114,111,116,111,99,111, + 108,32,109,101,116,104,111,100,115,32,116,104,97,116,10,32, + 32,32,32,114,101,113,117,105,114,101,32,102,105,108,101,32, + 115,121,115,116,101,109,32,117,115,97,103,101,46,99,3,0, + 0,0,0,0,0,0,3,0,0,0,2,0,0,0,67,0, + 0,0,115,16,0,0,0,124,1,124,0,95,0,124,2,124, + 0,95,1,100,1,83,0,41,2,122,75,67,97,99,104,101, + 32,116,104,101,32,109,111,100,117,108,101,32,110,97,109,101, + 32,97,110,100,32,116,104,101,32,112,97,116,104,32,116,111, + 32,116,104,101,32,102,105,108,101,32,102,111,117,110,100,32, + 98,121,32,116,104,101,10,32,32,32,32,32,32,32,32,102, + 105,110,100,101,114,46,78,41,2,114,99,0,0,0,114,35, + 0,0,0,41,3,114,101,0,0,0,114,120,0,0,0,114, + 35,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, + 0,0,0,114,180,0,0,0,14,3,0,0,115,4,0,0, + 0,0,3,6,1,122,19,70,105,108,101,76,111,97,100,101, + 114,46,95,95,105,110,105,116,95,95,99,2,0,0,0,0, + 0,0,0,2,0,0,0,2,0,0,0,67,0,0,0,115, + 24,0,0,0,124,0,106,0,124,1,106,0,107,2,111,22, + 124,0,106,1,124,1,106,1,107,2,83,0,41,1,78,41, + 2,218,9,95,95,99,108,97,115,115,95,95,114,112,0,0, + 0,41,2,114,101,0,0,0,218,5,111,116,104,101,114,114, + 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,6, + 95,95,101,113,95,95,20,3,0,0,115,4,0,0,0,0, + 1,12,1,122,17,70,105,108,101,76,111,97,100,101,114,46, + 95,95,101,113,95,95,99,1,0,0,0,0,0,0,0,1, + 0,0,0,3,0,0,0,67,0,0,0,115,20,0,0,0, + 116,0,124,0,106,1,131,1,116,0,124,0,106,2,131,1, + 65,0,83,0,41,1,78,41,3,218,4,104,97,115,104,114, + 99,0,0,0,114,35,0,0,0,41,1,114,101,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218, + 8,95,95,104,97,115,104,95,95,24,3,0,0,115,2,0, + 0,0,0,1,122,19,70,105,108,101,76,111,97,100,101,114, + 46,95,95,104,97,115,104,95,95,99,2,0,0,0,0,0, + 0,0,2,0,0,0,3,0,0,0,3,0,0,0,115,16, + 0,0,0,116,0,116,1,124,0,131,2,106,2,124,1,131, + 1,83,0,41,1,122,100,76,111,97,100,32,97,32,109,111, + 100,117,108,101,32,102,114,111,109,32,97,32,102,105,108,101, + 46,10,10,32,32,32,32,32,32,32,32,84,104,105,115,32, + 109,101,116,104,111,100,32,105,115,32,100,101,112,114,101,99, + 97,116,101,100,46,32,32,85,115,101,32,101,120,101,99,95, + 109,111,100,117,108,101,40,41,32,105,110,115,116,101,97,100, + 46,10,10,32,32,32,32,32,32,32,32,41,3,218,5,115, + 117,112,101,114,114,205,0,0,0,114,188,0,0,0,41,2, + 114,101,0,0,0,114,120,0,0,0,41,1,114,206,0,0, + 0,114,4,0,0,0,114,5,0,0,0,114,188,0,0,0, + 27,3,0,0,115,2,0,0,0,0,10,122,22,70,105,108, + 101,76,111,97,100,101,114,46,108,111,97,100,95,109,111,100, + 117,108,101,99,2,0,0,0,0,0,0,0,2,0,0,0, + 1,0,0,0,67,0,0,0,115,6,0,0,0,124,0,106, + 0,83,0,41,1,122,58,82,101,116,117,114,110,32,116,104, + 101,32,112,97,116,104,32,116,111,32,116,104,101,32,115,111, + 117,114,99,101,32,102,105,108,101,32,97,115,32,102,111,117, + 110,100,32,98,121,32,116,104,101,32,102,105,110,100,101,114, + 46,41,1,114,35,0,0,0,41,2,114,101,0,0,0,114, + 120,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, + 0,0,0,114,152,0,0,0,39,3,0,0,115,2,0,0, + 0,0,3,122,23,70,105,108,101,76,111,97,100,101,114,46, + 103,101,116,95,102,105,108,101,110,97,109,101,99,2,0,0, + 0,0,0,0,0,3,0,0,0,9,0,0,0,67,0,0, + 0,115,32,0,0,0,116,0,106,1,124,1,100,1,131,2, + 143,10,125,2,124,2,106,2,131,0,83,0,81,0,82,0, + 88,0,100,2,83,0,41,3,122,39,82,101,116,117,114,110, + 32,116,104,101,32,100,97,116,97,32,102,114,111,109,32,112, + 97,116,104,32,97,115,32,114,97,119,32,98,121,116,101,115, + 46,218,1,114,78,41,3,114,50,0,0,0,114,51,0,0, + 0,90,4,114,101,97,100,41,3,114,101,0,0,0,114,35, + 0,0,0,114,55,0,0,0,114,4,0,0,0,114,4,0, + 0,0,114,5,0,0,0,114,195,0,0,0,44,3,0,0, + 115,4,0,0,0,0,2,14,1,122,19,70,105,108,101,76, + 111,97,100,101,114,46,103,101,116,95,100,97,116,97,41,11, + 114,106,0,0,0,114,105,0,0,0,114,107,0,0,0,114, + 108,0,0,0,114,180,0,0,0,114,208,0,0,0,114,210, + 0,0,0,114,117,0,0,0,114,188,0,0,0,114,152,0, + 0,0,114,195,0,0,0,114,4,0,0,0,114,4,0,0, + 0,41,1,114,206,0,0,0,114,5,0,0,0,114,205,0, + 0,0,9,3,0,0,115,14,0,0,0,8,3,4,2,8, + 6,8,4,8,3,16,12,12,5,114,205,0,0,0,99,0, + 0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,64, + 0,0,0,115,46,0,0,0,101,0,90,1,100,0,90,2, 100,1,90,3,100,2,100,3,132,0,90,4,100,4,100,5, - 132,0,90,5,100,6,100,7,132,0,90,6,101,7,135,0, - 102,1,100,8,100,9,134,0,131,1,90,8,101,7,100,10, - 100,11,132,0,131,1,90,9,100,12,100,13,132,0,90,10, - 135,0,83,0,41,14,218,10,70,105,108,101,76,111,97,100, - 101,114,122,103,66,97,115,101,32,102,105,108,101,32,108,111, - 97,100,101,114,32,99,108,97,115,115,32,119,104,105,99,104, - 32,105,109,112,108,101,109,101,110,116,115,32,116,104,101,32, - 108,111,97,100,101,114,32,112,114,111,116,111,99,111,108,32, - 109,101,116,104,111,100,115,32,116,104,97,116,10,32,32,32, - 32,114,101,113,117,105,114,101,32,102,105,108,101,32,115,121, - 115,116,101,109,32,117,115,97,103,101,46,99,3,0,0,0, - 0,0,0,0,3,0,0,0,2,0,0,0,67,0,0,0, - 115,16,0,0,0,124,1,124,0,95,0,124,2,124,0,95, - 1,100,1,83,0,41,2,122,75,67,97,99,104,101,32,116, - 104,101,32,109,111,100,117,108,101,32,110,97,109,101,32,97, - 110,100,32,116,104,101,32,112,97,116,104,32,116,111,32,116, - 104,101,32,102,105,108,101,32,102,111,117,110,100,32,98,121, - 32,116,104,101,10,32,32,32,32,32,32,32,32,102,105,110, - 100,101,114,46,78,41,2,114,98,0,0,0,114,35,0,0, - 0,41,3,114,100,0,0,0,114,119,0,0,0,114,35,0, + 132,0,90,5,100,6,100,7,156,1,100,8,100,9,132,2, + 90,6,100,10,83,0,41,11,218,16,83,111,117,114,99,101, + 70,105,108,101,76,111,97,100,101,114,122,62,67,111,110,99, + 114,101,116,101,32,105,109,112,108,101,109,101,110,116,97,116, + 105,111,110,32,111,102,32,83,111,117,114,99,101,76,111,97, + 100,101,114,32,117,115,105,110,103,32,116,104,101,32,102,105, + 108,101,32,115,121,115,116,101,109,46,99,2,0,0,0,0, + 0,0,0,3,0,0,0,3,0,0,0,67,0,0,0,115, + 22,0,0,0,116,0,124,1,131,1,125,2,124,2,106,1, + 124,2,106,2,100,1,156,2,83,0,41,2,122,33,82,101, + 116,117,114,110,32,116,104,101,32,109,101,116,97,100,97,116, + 97,32,102,111,114,32,116,104,101,32,112,97,116,104,46,41, + 2,122,5,109,116,105,109,101,122,4,115,105,122,101,41,3, + 114,39,0,0,0,218,8,115,116,95,109,116,105,109,101,90, + 7,115,116,95,115,105,122,101,41,3,114,101,0,0,0,114, + 35,0,0,0,114,203,0,0,0,114,4,0,0,0,114,4, + 0,0,0,114,5,0,0,0,114,192,0,0,0,54,3,0, + 0,115,4,0,0,0,0,2,8,1,122,27,83,111,117,114, + 99,101,70,105,108,101,76,111,97,100,101,114,46,112,97,116, + 104,95,115,116,97,116,115,99,4,0,0,0,0,0,0,0, + 5,0,0,0,5,0,0,0,67,0,0,0,115,26,0,0, + 0,116,0,124,1,131,1,125,4,124,0,106,1,124,2,124, + 3,100,1,124,4,144,1,131,2,83,0,41,2,78,218,5, + 95,109,111,100,101,41,2,114,98,0,0,0,114,193,0,0, + 0,41,5,114,101,0,0,0,114,91,0,0,0,114,90,0, + 0,0,114,54,0,0,0,114,42,0,0,0,114,4,0,0, + 0,114,4,0,0,0,114,5,0,0,0,114,194,0,0,0, + 59,3,0,0,115,4,0,0,0,0,2,8,1,122,32,83, + 111,117,114,99,101,70,105,108,101,76,111,97,100,101,114,46, + 95,99,97,99,104,101,95,98,121,116,101,99,111,100,101,105, + 182,1,0,0,41,1,114,215,0,0,0,99,3,0,0,0, + 1,0,0,0,9,0,0,0,17,0,0,0,67,0,0,0, + 115,250,0,0,0,116,0,124,1,131,1,92,2,125,4,125, + 5,103,0,125,6,120,40,124,4,114,56,116,1,124,4,131, + 1,12,0,114,56,116,0,124,4,131,1,92,2,125,4,125, + 7,124,6,106,2,124,7,131,1,1,0,113,18,87,0,120, + 108,116,3,124,6,131,1,68,0,93,96,125,7,116,4,124, + 4,124,7,131,2,125,4,121,14,116,5,106,6,124,4,131, + 1,1,0,87,0,113,68,4,0,116,7,107,10,114,118,1, + 0,1,0,1,0,119,68,89,0,113,68,4,0,116,8,107, + 10,114,162,1,0,125,8,1,0,122,18,116,9,106,10,100, + 1,124,4,124,8,131,3,1,0,100,2,83,0,100,2,125, + 8,126,8,88,0,113,68,88,0,113,68,87,0,121,28,116, + 11,124,1,124,2,124,3,131,3,1,0,116,9,106,10,100, + 3,124,1,131,2,1,0,87,0,110,48,4,0,116,8,107, + 10,114,244,1,0,125,8,1,0,122,20,116,9,106,10,100, + 1,124,1,124,8,131,3,1,0,87,0,89,0,100,2,100, + 2,125,8,126,8,88,0,110,2,88,0,100,2,83,0,41, + 4,122,27,87,114,105,116,101,32,98,121,116,101,115,32,100, + 97,116,97,32,116,111,32,97,32,102,105,108,101,46,122,27, + 99,111,117,108,100,32,110,111,116,32,99,114,101,97,116,101, + 32,123,33,114,125,58,32,123,33,114,125,78,122,12,99,114, + 101,97,116,101,100,32,123,33,114,125,41,12,114,38,0,0, + 0,114,46,0,0,0,114,158,0,0,0,114,33,0,0,0, + 114,28,0,0,0,114,3,0,0,0,90,5,109,107,100,105, + 114,218,15,70,105,108,101,69,120,105,115,116,115,69,114,114, + 111,114,114,40,0,0,0,114,115,0,0,0,114,130,0,0, + 0,114,56,0,0,0,41,9,114,101,0,0,0,114,35,0, + 0,0,114,54,0,0,0,114,215,0,0,0,218,6,112,97, + 114,101,110,116,114,95,0,0,0,114,27,0,0,0,114,23, + 0,0,0,114,196,0,0,0,114,4,0,0,0,114,4,0, + 0,0,114,5,0,0,0,114,193,0,0,0,64,3,0,0, + 115,42,0,0,0,0,2,12,1,4,2,16,1,12,1,14, + 2,14,1,10,1,2,1,14,1,14,2,6,1,16,3,6, + 1,8,1,20,1,2,1,12,1,16,1,16,2,8,1,122, + 25,83,111,117,114,99,101,70,105,108,101,76,111,97,100,101, + 114,46,115,101,116,95,100,97,116,97,78,41,7,114,106,0, + 0,0,114,105,0,0,0,114,107,0,0,0,114,108,0,0, + 0,114,192,0,0,0,114,194,0,0,0,114,193,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,4,0,0,0,114, + 5,0,0,0,114,213,0,0,0,50,3,0,0,115,8,0, + 0,0,8,2,4,2,8,5,8,5,114,213,0,0,0,99, + 0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0, + 64,0,0,0,115,32,0,0,0,101,0,90,1,100,0,90, + 2,100,1,90,3,100,2,100,3,132,0,90,4,100,4,100, + 5,132,0,90,5,100,6,83,0,41,7,218,20,83,111,117, + 114,99,101,108,101,115,115,70,105,108,101,76,111,97,100,101, + 114,122,45,76,111,97,100,101,114,32,119,104,105,99,104,32, + 104,97,110,100,108,101,115,32,115,111,117,114,99,101,108,101, + 115,115,32,102,105,108,101,32,105,109,112,111,114,116,115,46, + 99,2,0,0,0,0,0,0,0,5,0,0,0,6,0,0, + 0,67,0,0,0,115,56,0,0,0,124,0,106,0,124,1, + 131,1,125,2,124,0,106,1,124,2,131,1,125,3,116,2, + 124,3,100,1,124,1,100,2,124,2,144,2,131,1,125,4, + 116,3,124,4,100,1,124,1,100,3,124,2,144,2,131,1, + 83,0,41,4,78,114,99,0,0,0,114,35,0,0,0,114, + 90,0,0,0,41,4,114,152,0,0,0,114,195,0,0,0, + 114,136,0,0,0,114,142,0,0,0,41,5,114,101,0,0, + 0,114,120,0,0,0,114,35,0,0,0,114,54,0,0,0, + 114,204,0,0,0,114,4,0,0,0,114,4,0,0,0,114, + 5,0,0,0,114,182,0,0,0,99,3,0,0,115,8,0, + 0,0,0,1,10,1,10,1,18,1,122,29,83,111,117,114, + 99,101,108,101,115,115,70,105,108,101,76,111,97,100,101,114, + 46,103,101,116,95,99,111,100,101,99,2,0,0,0,0,0, + 0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,4, + 0,0,0,100,1,83,0,41,2,122,39,82,101,116,117,114, + 110,32,78,111,110,101,32,97,115,32,116,104,101,114,101,32, + 105,115,32,110,111,32,115,111,117,114,99,101,32,99,111,100, + 101,46,78,114,4,0,0,0,41,2,114,101,0,0,0,114, + 120,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, + 0,0,0,114,197,0,0,0,105,3,0,0,115,2,0,0, + 0,0,2,122,31,83,111,117,114,99,101,108,101,115,115,70, + 105,108,101,76,111,97,100,101,114,46,103,101,116,95,115,111, + 117,114,99,101,78,41,6,114,106,0,0,0,114,105,0,0, + 0,114,107,0,0,0,114,108,0,0,0,114,182,0,0,0, + 114,197,0,0,0,114,4,0,0,0,114,4,0,0,0,114, + 4,0,0,0,114,5,0,0,0,114,218,0,0,0,95,3, + 0,0,115,6,0,0,0,8,2,4,2,8,6,114,218,0, + 0,0,99,0,0,0,0,0,0,0,0,0,0,0,0,3, + 0,0,0,64,0,0,0,115,92,0,0,0,101,0,90,1, + 100,0,90,2,100,1,90,3,100,2,100,3,132,0,90,4, + 100,4,100,5,132,0,90,5,100,6,100,7,132,0,90,6, + 100,8,100,9,132,0,90,7,100,10,100,11,132,0,90,8, + 100,12,100,13,132,0,90,9,100,14,100,15,132,0,90,10, + 100,16,100,17,132,0,90,11,101,12,100,18,100,19,132,0, + 131,1,90,13,100,20,83,0,41,21,218,19,69,120,116,101, + 110,115,105,111,110,70,105,108,101,76,111,97,100,101,114,122, + 93,76,111,97,100,101,114,32,102,111,114,32,101,120,116,101, + 110,115,105,111,110,32,109,111,100,117,108,101,115,46,10,10, + 32,32,32,32,84,104,101,32,99,111,110,115,116,114,117,99, + 116,111,114,32,105,115,32,100,101,115,105,103,110,101,100,32, + 116,111,32,119,111,114,107,32,119,105,116,104,32,70,105,108, + 101,70,105,110,100,101,114,46,10,10,32,32,32,32,99,3, + 0,0,0,0,0,0,0,3,0,0,0,2,0,0,0,67, + 0,0,0,115,16,0,0,0,124,1,124,0,95,0,124,2, + 124,0,95,1,100,0,83,0,41,1,78,41,2,114,99,0, + 0,0,114,35,0,0,0,41,3,114,101,0,0,0,114,99, + 0,0,0,114,35,0,0,0,114,4,0,0,0,114,4,0, + 0,0,114,5,0,0,0,114,180,0,0,0,122,3,0,0, + 115,4,0,0,0,0,1,6,1,122,28,69,120,116,101,110, + 115,105,111,110,70,105,108,101,76,111,97,100,101,114,46,95, + 95,105,110,105,116,95,95,99,2,0,0,0,0,0,0,0, + 2,0,0,0,2,0,0,0,67,0,0,0,115,24,0,0, + 0,124,0,106,0,124,1,106,0,107,2,111,22,124,0,106, + 1,124,1,106,1,107,2,83,0,41,1,78,41,2,114,206, + 0,0,0,114,112,0,0,0,41,2,114,101,0,0,0,114, + 207,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, + 0,0,0,114,208,0,0,0,126,3,0,0,115,4,0,0, + 0,0,1,12,1,122,26,69,120,116,101,110,115,105,111,110, + 70,105,108,101,76,111,97,100,101,114,46,95,95,101,113,95, + 95,99,1,0,0,0,0,0,0,0,1,0,0,0,3,0, + 0,0,67,0,0,0,115,20,0,0,0,116,0,124,0,106, + 1,131,1,116,0,124,0,106,2,131,1,65,0,83,0,41, + 1,78,41,3,114,209,0,0,0,114,99,0,0,0,114,35, + 0,0,0,41,1,114,101,0,0,0,114,4,0,0,0,114, + 4,0,0,0,114,5,0,0,0,114,210,0,0,0,130,3, + 0,0,115,2,0,0,0,0,1,122,28,69,120,116,101,110, + 115,105,111,110,70,105,108,101,76,111,97,100,101,114,46,95, + 95,104,97,115,104,95,95,99,2,0,0,0,0,0,0,0, + 3,0,0,0,4,0,0,0,67,0,0,0,115,36,0,0, + 0,116,0,106,1,116,2,106,3,124,1,131,2,125,2,116, + 0,106,4,100,1,124,1,106,5,124,0,106,6,131,3,1, + 0,124,2,83,0,41,2,122,38,67,114,101,97,116,101,32, + 97,110,32,117,110,105,116,105,97,108,105,122,101,100,32,101, + 120,116,101,110,115,105,111,110,32,109,111,100,117,108,101,122, + 38,101,120,116,101,110,115,105,111,110,32,109,111,100,117,108, + 101,32,123,33,114,125,32,108,111,97,100,101,100,32,102,114, + 111,109,32,123,33,114,125,41,7,114,115,0,0,0,114,183, + 0,0,0,114,140,0,0,0,90,14,99,114,101,97,116,101, + 95,100,121,110,97,109,105,99,114,130,0,0,0,114,99,0, + 0,0,114,35,0,0,0,41,3,114,101,0,0,0,114,159, + 0,0,0,114,185,0,0,0,114,4,0,0,0,114,4,0, + 0,0,114,5,0,0,0,114,181,0,0,0,133,3,0,0, + 115,10,0,0,0,0,2,4,1,10,1,6,1,12,1,122, + 33,69,120,116,101,110,115,105,111,110,70,105,108,101,76,111, + 97,100,101,114,46,99,114,101,97,116,101,95,109,111,100,117, + 108,101,99,2,0,0,0,0,0,0,0,2,0,0,0,4, + 0,0,0,67,0,0,0,115,36,0,0,0,116,0,106,1, + 116,2,106,3,124,1,131,2,1,0,116,0,106,4,100,1, + 124,0,106,5,124,0,106,6,131,3,1,0,100,2,83,0, + 41,3,122,30,73,110,105,116,105,97,108,105,122,101,32,97, + 110,32,101,120,116,101,110,115,105,111,110,32,109,111,100,117, + 108,101,122,40,101,120,116,101,110,115,105,111,110,32,109,111, + 100,117,108,101,32,123,33,114,125,32,101,120,101,99,117,116, + 101,100,32,102,114,111,109,32,123,33,114,125,78,41,7,114, + 115,0,0,0,114,183,0,0,0,114,140,0,0,0,90,12, + 101,120,101,99,95,100,121,110,97,109,105,99,114,130,0,0, + 0,114,99,0,0,0,114,35,0,0,0,41,2,114,101,0, + 0,0,114,185,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,5,0,0,0,114,186,0,0,0,141,3,0,0,115, + 6,0,0,0,0,2,14,1,6,1,122,31,69,120,116,101, + 110,115,105,111,110,70,105,108,101,76,111,97,100,101,114,46, + 101,120,101,99,95,109,111,100,117,108,101,99,2,0,0,0, + 0,0,0,0,2,0,0,0,4,0,0,0,3,0,0,0, + 115,36,0,0,0,116,0,124,0,106,1,131,1,100,1,25, + 0,137,0,116,2,135,0,102,1,100,2,100,3,132,8,116, + 3,68,0,131,1,131,1,83,0,41,4,122,49,82,101,116, + 117,114,110,32,84,114,117,101,32,105,102,32,116,104,101,32, + 101,120,116,101,110,115,105,111,110,32,109,111,100,117,108,101, + 32,105,115,32,97,32,112,97,99,107,97,103,101,46,114,29, + 0,0,0,99,1,0,0,0,0,0,0,0,2,0,0,0, + 4,0,0,0,51,0,0,0,115,26,0,0,0,124,0,93, + 18,125,1,136,0,100,0,124,1,23,0,107,2,86,0,1, + 0,113,2,100,1,83,0,41,2,114,180,0,0,0,78,114, + 4,0,0,0,41,2,114,22,0,0,0,218,6,115,117,102, + 102,105,120,41,1,218,9,102,105,108,101,95,110,97,109,101, + 114,4,0,0,0,114,5,0,0,0,250,9,60,103,101,110, + 101,120,112,114,62,150,3,0,0,115,2,0,0,0,4,1, + 122,49,69,120,116,101,110,115,105,111,110,70,105,108,101,76, + 111,97,100,101,114,46,105,115,95,112,97,99,107,97,103,101, + 46,60,108,111,99,97,108,115,62,46,60,103,101,110,101,120, + 112,114,62,41,4,114,38,0,0,0,114,35,0,0,0,218, + 3,97,110,121,218,18,69,88,84,69,78,83,73,79,78,95, + 83,85,70,70,73,88,69,83,41,2,114,101,0,0,0,114, + 120,0,0,0,114,4,0,0,0,41,1,114,221,0,0,0, + 114,5,0,0,0,114,154,0,0,0,147,3,0,0,115,6, + 0,0,0,0,2,14,1,12,1,122,30,69,120,116,101,110, + 115,105,111,110,70,105,108,101,76,111,97,100,101,114,46,105, + 115,95,112,97,99,107,97,103,101,99,2,0,0,0,0,0, + 0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,4, + 0,0,0,100,1,83,0,41,2,122,63,82,101,116,117,114, + 110,32,78,111,110,101,32,97,115,32,97,110,32,101,120,116, + 101,110,115,105,111,110,32,109,111,100,117,108,101,32,99,97, + 110,110,111,116,32,99,114,101,97,116,101,32,97,32,99,111, + 100,101,32,111,98,106,101,99,116,46,78,114,4,0,0,0, + 41,2,114,101,0,0,0,114,120,0,0,0,114,4,0,0, + 0,114,4,0,0,0,114,5,0,0,0,114,182,0,0,0, + 153,3,0,0,115,2,0,0,0,0,2,122,28,69,120,116, + 101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,114, + 46,103,101,116,95,99,111,100,101,99,2,0,0,0,0,0, + 0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,4, + 0,0,0,100,1,83,0,41,2,122,53,82,101,116,117,114, + 110,32,78,111,110,101,32,97,115,32,101,120,116,101,110,115, + 105,111,110,32,109,111,100,117,108,101,115,32,104,97,118,101, + 32,110,111,32,115,111,117,114,99,101,32,99,111,100,101,46, + 78,114,4,0,0,0,41,2,114,101,0,0,0,114,120,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,179,0,0,0,12,3,0,0,115,4,0,0,0,0, - 3,6,1,122,19,70,105,108,101,76,111,97,100,101,114,46, - 95,95,105,110,105,116,95,95,99,2,0,0,0,0,0,0, - 0,2,0,0,0,2,0,0,0,67,0,0,0,115,24,0, - 0,0,124,0,106,0,124,1,106,0,107,2,111,22,124,0, - 106,1,124,1,106,1,107,2,83,0,41,1,78,41,2,218, - 9,95,95,99,108,97,115,115,95,95,114,111,0,0,0,41, - 2,114,100,0,0,0,218,5,111,116,104,101,114,114,4,0, - 0,0,114,4,0,0,0,114,5,0,0,0,218,6,95,95, - 101,113,95,95,18,3,0,0,115,4,0,0,0,0,1,12, - 1,122,17,70,105,108,101,76,111,97,100,101,114,46,95,95, - 101,113,95,95,99,1,0,0,0,0,0,0,0,1,0,0, - 0,3,0,0,0,67,0,0,0,115,20,0,0,0,116,0, - 124,0,106,1,131,1,116,0,124,0,106,2,131,1,65,0, - 83,0,41,1,78,41,3,218,4,104,97,115,104,114,98,0, - 0,0,114,35,0,0,0,41,1,114,100,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,5,0,0,0,218,8,95, - 95,104,97,115,104,95,95,22,3,0,0,115,2,0,0,0, - 0,1,122,19,70,105,108,101,76,111,97,100,101,114,46,95, - 95,104,97,115,104,95,95,99,2,0,0,0,0,0,0,0, - 2,0,0,0,3,0,0,0,3,0,0,0,115,16,0,0, - 0,116,0,116,1,124,0,131,2,106,2,124,1,131,1,83, - 0,41,1,122,100,76,111,97,100,32,97,32,109,111,100,117, - 108,101,32,102,114,111,109,32,97,32,102,105,108,101,46,10, - 10,32,32,32,32,32,32,32,32,84,104,105,115,32,109,101, - 116,104,111,100,32,105,115,32,100,101,112,114,101,99,97,116, - 101,100,46,32,32,85,115,101,32,101,120,101,99,95,109,111, - 100,117,108,101,40,41,32,105,110,115,116,101,97,100,46,10, - 10,32,32,32,32,32,32,32,32,41,3,218,5,115,117,112, - 101,114,114,204,0,0,0,114,187,0,0,0,41,2,114,100, - 0,0,0,114,119,0,0,0,41,1,114,205,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,187,0,0,0,25,3, - 0,0,115,2,0,0,0,0,10,122,22,70,105,108,101,76, - 111,97,100,101,114,46,108,111,97,100,95,109,111,100,117,108, + 0,114,197,0,0,0,157,3,0,0,115,2,0,0,0,0, + 2,122,30,69,120,116,101,110,115,105,111,110,70,105,108,101, + 76,111,97,100,101,114,46,103,101,116,95,115,111,117,114,99, 101,99,2,0,0,0,0,0,0,0,2,0,0,0,1,0, 0,0,67,0,0,0,115,6,0,0,0,124,0,106,0,83, 0,41,1,122,58,82,101,116,117,114,110,32,116,104,101,32, 112,97,116,104,32,116,111,32,116,104,101,32,115,111,117,114, 99,101,32,102,105,108,101,32,97,115,32,102,111,117,110,100, 32,98,121,32,116,104,101,32,102,105,110,100,101,114,46,41, - 1,114,35,0,0,0,41,2,114,100,0,0,0,114,119,0, + 1,114,35,0,0,0,41,2,114,101,0,0,0,114,120,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,151,0,0,0,37,3,0,0,115,2,0,0,0,0, - 3,122,23,70,105,108,101,76,111,97,100,101,114,46,103,101, - 116,95,102,105,108,101,110,97,109,101,99,2,0,0,0,0, - 0,0,0,3,0,0,0,9,0,0,0,67,0,0,0,115, - 32,0,0,0,116,0,106,1,124,1,100,1,131,2,143,10, - 125,2,124,2,106,2,131,0,83,0,81,0,82,0,88,0, - 100,2,83,0,41,3,122,39,82,101,116,117,114,110,32,116, - 104,101,32,100,97,116,97,32,102,114,111,109,32,112,97,116, - 104,32,97,115,32,114,97,119,32,98,121,116,101,115,46,218, - 1,114,78,41,3,114,49,0,0,0,114,50,0,0,0,90, - 4,114,101,97,100,41,3,114,100,0,0,0,114,35,0,0, - 0,114,54,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,5,0,0,0,114,194,0,0,0,42,3,0,0,115,4, - 0,0,0,0,2,14,1,122,19,70,105,108,101,76,111,97, - 100,101,114,46,103,101,116,95,100,97,116,97,41,11,114,105, - 0,0,0,114,104,0,0,0,114,106,0,0,0,114,107,0, - 0,0,114,179,0,0,0,114,207,0,0,0,114,209,0,0, - 0,114,116,0,0,0,114,187,0,0,0,114,151,0,0,0, - 114,194,0,0,0,114,4,0,0,0,114,4,0,0,0,41, - 1,114,205,0,0,0,114,5,0,0,0,114,204,0,0,0, - 7,3,0,0,115,14,0,0,0,8,3,4,2,8,6,8, - 4,8,3,16,12,12,5,114,204,0,0,0,99,0,0,0, - 0,0,0,0,0,0,0,0,0,4,0,0,0,64,0,0, - 0,115,46,0,0,0,101,0,90,1,100,0,90,2,100,1, - 90,3,100,2,100,3,132,0,90,4,100,4,100,5,132,0, - 90,5,100,6,100,7,100,8,100,9,144,1,132,0,90,6, - 100,10,83,0,41,11,218,16,83,111,117,114,99,101,70,105, - 108,101,76,111,97,100,101,114,122,62,67,111,110,99,114,101, - 116,101,32,105,109,112,108,101,109,101,110,116,97,116,105,111, - 110,32,111,102,32,83,111,117,114,99,101,76,111,97,100,101, - 114,32,117,115,105,110,103,32,116,104,101,32,102,105,108,101, - 32,115,121,115,116,101,109,46,99,2,0,0,0,0,0,0, - 0,3,0,0,0,3,0,0,0,67,0,0,0,115,22,0, - 0,0,116,0,124,1,131,1,125,2,124,2,106,1,124,2, - 106,2,100,1,156,2,83,0,41,2,122,33,82,101,116,117, - 114,110,32,116,104,101,32,109,101,116,97,100,97,116,97,32, - 102,111,114,32,116,104,101,32,112,97,116,104,46,41,2,122, - 5,109,116,105,109,101,122,4,115,105,122,101,41,3,114,39, - 0,0,0,218,8,115,116,95,109,116,105,109,101,90,7,115, - 116,95,115,105,122,101,41,3,114,100,0,0,0,114,35,0, - 0,0,114,202,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,5,0,0,0,114,191,0,0,0,52,3,0,0,115, - 4,0,0,0,0,2,8,1,122,27,83,111,117,114,99,101, - 70,105,108,101,76,111,97,100,101,114,46,112,97,116,104,95, - 115,116,97,116,115,99,4,0,0,0,0,0,0,0,5,0, - 0,0,5,0,0,0,67,0,0,0,115,26,0,0,0,116, - 0,124,1,131,1,125,4,124,0,106,1,124,2,124,3,100, - 1,124,4,144,1,131,2,83,0,41,2,78,218,5,95,109, - 111,100,101,41,2,114,97,0,0,0,114,192,0,0,0,41, - 5,114,100,0,0,0,114,90,0,0,0,114,89,0,0,0, - 114,53,0,0,0,114,42,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,193,0,0,0,57,3, - 0,0,115,4,0,0,0,0,2,8,1,122,32,83,111,117, - 114,99,101,70,105,108,101,76,111,97,100,101,114,46,95,99, - 97,99,104,101,95,98,121,116,101,99,111,100,101,114,214,0, - 0,0,105,182,1,0,0,99,3,0,0,0,1,0,0,0, - 9,0,0,0,17,0,0,0,67,0,0,0,115,250,0,0, - 0,116,0,124,1,131,1,92,2,125,4,125,5,103,0,125, - 6,120,40,124,4,114,56,116,1,124,4,131,1,12,0,114, - 56,116,0,124,4,131,1,92,2,125,4,125,7,124,6,106, - 2,124,7,131,1,1,0,113,18,87,0,120,108,116,3,124, - 6,131,1,68,0,93,96,125,7,116,4,124,4,124,7,131, - 2,125,4,121,14,116,5,106,6,124,4,131,1,1,0,87, - 0,113,68,4,0,116,7,107,10,114,118,1,0,1,0,1, - 0,119,68,89,0,113,68,4,0,116,8,107,10,114,162,1, - 0,125,8,1,0,122,18,116,9,106,10,100,1,124,4,124, - 8,131,3,1,0,100,2,83,0,100,2,125,8,126,8,88, - 0,113,68,88,0,113,68,87,0,121,28,116,11,124,1,124, - 2,124,3,131,3,1,0,116,9,106,10,100,3,124,1,131, - 2,1,0,87,0,110,48,4,0,116,8,107,10,114,244,1, - 0,125,8,1,0,122,20,116,9,106,10,100,1,124,1,124, - 8,131,3,1,0,87,0,89,0,100,2,100,2,125,8,126, - 8,88,0,110,2,88,0,100,2,83,0,41,4,122,27,87, - 114,105,116,101,32,98,121,116,101,115,32,100,97,116,97,32, - 116,111,32,97,32,102,105,108,101,46,122,27,99,111,117,108, - 100,32,110,111,116,32,99,114,101,97,116,101,32,123,33,114, - 125,58,32,123,33,114,125,78,122,12,99,114,101,97,116,101, - 100,32,123,33,114,125,41,12,114,38,0,0,0,114,46,0, - 0,0,114,157,0,0,0,114,33,0,0,0,114,28,0,0, - 0,114,3,0,0,0,90,5,109,107,100,105,114,218,15,70, - 105,108,101,69,120,105,115,116,115,69,114,114,111,114,114,40, - 0,0,0,114,114,0,0,0,114,129,0,0,0,114,55,0, - 0,0,41,9,114,100,0,0,0,114,35,0,0,0,114,53, - 0,0,0,114,214,0,0,0,218,6,112,97,114,101,110,116, - 114,94,0,0,0,114,27,0,0,0,114,23,0,0,0,114, - 195,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,192,0,0,0,62,3,0,0,115,42,0,0, - 0,0,2,12,1,4,2,16,1,12,1,14,2,14,1,10, - 1,2,1,14,1,14,2,6,1,16,3,6,1,8,1,20, - 1,2,1,12,1,16,1,16,2,8,1,122,25,83,111,117, - 114,99,101,70,105,108,101,76,111,97,100,101,114,46,115,101, - 116,95,100,97,116,97,78,41,7,114,105,0,0,0,114,104, - 0,0,0,114,106,0,0,0,114,107,0,0,0,114,191,0, - 0,0,114,193,0,0,0,114,192,0,0,0,114,4,0,0, + 0,114,152,0,0,0,161,3,0,0,115,2,0,0,0,0, + 3,122,32,69,120,116,101,110,115,105,111,110,70,105,108,101, + 76,111,97,100,101,114,46,103,101,116,95,102,105,108,101,110, + 97,109,101,78,41,14,114,106,0,0,0,114,105,0,0,0, + 114,107,0,0,0,114,108,0,0,0,114,180,0,0,0,114, + 208,0,0,0,114,210,0,0,0,114,181,0,0,0,114,186, + 0,0,0,114,154,0,0,0,114,182,0,0,0,114,197,0, + 0,0,114,117,0,0,0,114,152,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,212,0,0,0,48,3,0,0,115,8,0,0,0,8,2, - 4,2,8,5,8,5,114,212,0,0,0,99,0,0,0,0, - 0,0,0,0,0,0,0,0,2,0,0,0,64,0,0,0, - 115,32,0,0,0,101,0,90,1,100,0,90,2,100,1,90, - 3,100,2,100,3,132,0,90,4,100,4,100,5,132,0,90, - 5,100,6,83,0,41,7,218,20,83,111,117,114,99,101,108, - 101,115,115,70,105,108,101,76,111,97,100,101,114,122,45,76, - 111,97,100,101,114,32,119,104,105,99,104,32,104,97,110,100, - 108,101,115,32,115,111,117,114,99,101,108,101,115,115,32,102, - 105,108,101,32,105,109,112,111,114,116,115,46,99,2,0,0, - 0,0,0,0,0,5,0,0,0,6,0,0,0,67,0,0, - 0,115,56,0,0,0,124,0,106,0,124,1,131,1,125,2, - 124,0,106,1,124,2,131,1,125,3,116,2,124,3,100,1, - 124,1,100,2,124,2,144,2,131,1,125,4,116,3,124,4, - 100,1,124,1,100,3,124,2,144,2,131,1,83,0,41,4, - 78,114,98,0,0,0,114,35,0,0,0,114,89,0,0,0, - 41,4,114,151,0,0,0,114,194,0,0,0,114,135,0,0, - 0,114,141,0,0,0,41,5,114,100,0,0,0,114,119,0, - 0,0,114,35,0,0,0,114,53,0,0,0,114,203,0,0, + 114,219,0,0,0,114,3,0,0,115,20,0,0,0,8,6, + 4,2,8,4,8,4,8,3,8,8,8,6,8,6,8,4, + 8,4,114,219,0,0,0,99,0,0,0,0,0,0,0,0, + 0,0,0,0,2,0,0,0,64,0,0,0,115,96,0,0, + 0,101,0,90,1,100,0,90,2,100,1,90,3,100,2,100, + 3,132,0,90,4,100,4,100,5,132,0,90,5,100,6,100, + 7,132,0,90,6,100,8,100,9,132,0,90,7,100,10,100, + 11,132,0,90,8,100,12,100,13,132,0,90,9,100,14,100, + 15,132,0,90,10,100,16,100,17,132,0,90,11,100,18,100, + 19,132,0,90,12,100,20,100,21,132,0,90,13,100,22,83, + 0,41,23,218,14,95,78,97,109,101,115,112,97,99,101,80, + 97,116,104,97,38,1,0,0,82,101,112,114,101,115,101,110, + 116,115,32,97,32,110,97,109,101,115,112,97,99,101,32,112, + 97,99,107,97,103,101,39,115,32,112,97,116,104,46,32,32, + 73,116,32,117,115,101,115,32,116,104,101,32,109,111,100,117, + 108,101,32,110,97,109,101,10,32,32,32,32,116,111,32,102, + 105,110,100,32,105,116,115,32,112,97,114,101,110,116,32,109, + 111,100,117,108,101,44,32,97,110,100,32,102,114,111,109,32, + 116,104,101,114,101,32,105,116,32,108,111,111,107,115,32,117, + 112,32,116,104,101,32,112,97,114,101,110,116,39,115,10,32, + 32,32,32,95,95,112,97,116,104,95,95,46,32,32,87,104, + 101,110,32,116,104,105,115,32,99,104,97,110,103,101,115,44, + 32,116,104,101,32,109,111,100,117,108,101,39,115,32,111,119, + 110,32,112,97,116,104,32,105,115,32,114,101,99,111,109,112, + 117,116,101,100,44,10,32,32,32,32,117,115,105,110,103,32, + 112,97,116,104,95,102,105,110,100,101,114,46,32,32,70,111, + 114,32,116,111,112,45,108,101,118,101,108,32,109,111,100,117, + 108,101,115,44,32,116,104,101,32,112,97,114,101,110,116,32, + 109,111,100,117,108,101,39,115,32,112,97,116,104,10,32,32, + 32,32,105,115,32,115,121,115,46,112,97,116,104,46,99,4, + 0,0,0,0,0,0,0,4,0,0,0,2,0,0,0,67, + 0,0,0,115,36,0,0,0,124,1,124,0,95,0,124,2, + 124,0,95,1,116,2,124,0,106,3,131,0,131,1,124,0, + 95,4,124,3,124,0,95,5,100,0,83,0,41,1,78,41, + 6,218,5,95,110,97,109,101,218,5,95,112,97,116,104,114, + 94,0,0,0,218,16,95,103,101,116,95,112,97,114,101,110, + 116,95,112,97,116,104,218,17,95,108,97,115,116,95,112,97, + 114,101,110,116,95,112,97,116,104,218,12,95,112,97,116,104, + 95,102,105,110,100,101,114,41,4,114,101,0,0,0,114,99, + 0,0,0,114,35,0,0,0,218,11,112,97,116,104,95,102, + 105,110,100,101,114,114,4,0,0,0,114,4,0,0,0,114, + 5,0,0,0,114,180,0,0,0,174,3,0,0,115,8,0, + 0,0,0,1,6,1,6,1,14,1,122,23,95,78,97,109, + 101,115,112,97,99,101,80,97,116,104,46,95,95,105,110,105, + 116,95,95,99,1,0,0,0,0,0,0,0,4,0,0,0, + 3,0,0,0,67,0,0,0,115,38,0,0,0,124,0,106, + 0,106,1,100,1,131,1,92,3,125,1,125,2,125,3,124, + 2,100,2,107,2,114,30,100,6,83,0,124,1,100,5,102, + 2,83,0,41,7,122,62,82,101,116,117,114,110,115,32,97, + 32,116,117,112,108,101,32,111,102,32,40,112,97,114,101,110, + 116,45,109,111,100,117,108,101,45,110,97,109,101,44,32,112, + 97,114,101,110,116,45,112,97,116,104,45,97,116,116,114,45, + 110,97,109,101,41,114,59,0,0,0,114,30,0,0,0,114, + 7,0,0,0,114,35,0,0,0,90,8,95,95,112,97,116, + 104,95,95,41,2,122,3,115,121,115,122,4,112,97,116,104, + 41,2,114,226,0,0,0,114,32,0,0,0,41,4,114,101, + 0,0,0,114,217,0,0,0,218,3,100,111,116,90,2,109, + 101,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, + 218,23,95,102,105,110,100,95,112,97,114,101,110,116,95,112, + 97,116,104,95,110,97,109,101,115,180,3,0,0,115,8,0, + 0,0,0,2,18,1,8,2,4,3,122,38,95,78,97,109, + 101,115,112,97,99,101,80,97,116,104,46,95,102,105,110,100, + 95,112,97,114,101,110,116,95,112,97,116,104,95,110,97,109, + 101,115,99,1,0,0,0,0,0,0,0,3,0,0,0,3, + 0,0,0,67,0,0,0,115,28,0,0,0,124,0,106,0, + 131,0,92,2,125,1,125,2,116,1,116,2,106,3,124,1, + 25,0,124,2,131,2,83,0,41,1,78,41,4,114,233,0, + 0,0,114,111,0,0,0,114,7,0,0,0,218,7,109,111, + 100,117,108,101,115,41,3,114,101,0,0,0,90,18,112,97, + 114,101,110,116,95,109,111,100,117,108,101,95,110,97,109,101, + 90,14,112,97,116,104,95,97,116,116,114,95,110,97,109,101, + 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, + 228,0,0,0,190,3,0,0,115,4,0,0,0,0,1,12, + 1,122,31,95,78,97,109,101,115,112,97,99,101,80,97,116, + 104,46,95,103,101,116,95,112,97,114,101,110,116,95,112,97, + 116,104,99,1,0,0,0,0,0,0,0,3,0,0,0,3, + 0,0,0,67,0,0,0,115,80,0,0,0,116,0,124,0, + 106,1,131,0,131,1,125,1,124,1,124,0,106,2,107,3, + 114,74,124,0,106,3,124,0,106,4,124,1,131,2,125,2, + 124,2,100,0,107,9,114,68,124,2,106,5,100,0,107,8, + 114,68,124,2,106,6,114,68,124,2,106,6,124,0,95,7, + 124,1,124,0,95,2,124,0,106,7,83,0,41,1,78,41, + 8,114,94,0,0,0,114,228,0,0,0,114,229,0,0,0, + 114,230,0,0,0,114,226,0,0,0,114,121,0,0,0,114, + 151,0,0,0,114,227,0,0,0,41,3,114,101,0,0,0, + 90,11,112,97,114,101,110,116,95,112,97,116,104,114,159,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, + 0,218,12,95,114,101,99,97,108,99,117,108,97,116,101,194, + 3,0,0,115,16,0,0,0,0,2,12,1,10,1,14,3, + 18,1,6,1,8,1,6,1,122,27,95,78,97,109,101,115, + 112,97,99,101,80,97,116,104,46,95,114,101,99,97,108,99, + 117,108,97,116,101,99,1,0,0,0,0,0,0,0,1,0, + 0,0,2,0,0,0,67,0,0,0,115,12,0,0,0,116, + 0,124,0,106,1,131,0,131,1,83,0,41,1,78,41,2, + 218,4,105,116,101,114,114,235,0,0,0,41,1,114,101,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, + 0,218,8,95,95,105,116,101,114,95,95,207,3,0,0,115, + 2,0,0,0,0,1,122,23,95,78,97,109,101,115,112,97, + 99,101,80,97,116,104,46,95,95,105,116,101,114,95,95,99, + 3,0,0,0,0,0,0,0,3,0,0,0,3,0,0,0, + 67,0,0,0,115,14,0,0,0,124,2,124,0,106,0,124, + 1,60,0,100,0,83,0,41,1,78,41,1,114,227,0,0, + 0,41,3,114,101,0,0,0,218,5,105,110,100,101,120,114, + 35,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, + 0,0,0,218,11,95,95,115,101,116,105,116,101,109,95,95, + 210,3,0,0,115,2,0,0,0,0,1,122,26,95,78,97, + 109,101,115,112,97,99,101,80,97,116,104,46,95,95,115,101, + 116,105,116,101,109,95,95,99,1,0,0,0,0,0,0,0, + 1,0,0,0,2,0,0,0,67,0,0,0,115,12,0,0, + 0,116,0,124,0,106,1,131,0,131,1,83,0,41,1,78, + 41,2,114,31,0,0,0,114,235,0,0,0,41,1,114,101, + 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, + 0,0,218,7,95,95,108,101,110,95,95,213,3,0,0,115, + 2,0,0,0,0,1,122,22,95,78,97,109,101,115,112,97, + 99,101,80,97,116,104,46,95,95,108,101,110,95,95,99,1, + 0,0,0,0,0,0,0,1,0,0,0,2,0,0,0,67, + 0,0,0,115,12,0,0,0,100,1,106,0,124,0,106,1, + 131,1,83,0,41,2,78,122,20,95,78,97,109,101,115,112, + 97,99,101,80,97,116,104,40,123,33,114,125,41,41,2,114, + 48,0,0,0,114,227,0,0,0,41,1,114,101,0,0,0, + 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218, + 8,95,95,114,101,112,114,95,95,216,3,0,0,115,2,0, + 0,0,0,1,122,23,95,78,97,109,101,115,112,97,99,101, + 80,97,116,104,46,95,95,114,101,112,114,95,95,99,2,0, + 0,0,0,0,0,0,2,0,0,0,2,0,0,0,67,0, + 0,0,115,12,0,0,0,124,1,124,0,106,0,131,0,107, + 6,83,0,41,1,78,41,1,114,235,0,0,0,41,2,114, + 101,0,0,0,218,4,105,116,101,109,114,4,0,0,0,114, + 4,0,0,0,114,5,0,0,0,218,12,95,95,99,111,110, + 116,97,105,110,115,95,95,219,3,0,0,115,2,0,0,0, + 0,1,122,27,95,78,97,109,101,115,112,97,99,101,80,97, + 116,104,46,95,95,99,111,110,116,97,105,110,115,95,95,99, + 2,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0, + 67,0,0,0,115,16,0,0,0,124,0,106,0,106,1,124, + 1,131,1,1,0,100,0,83,0,41,1,78,41,2,114,227, + 0,0,0,114,158,0,0,0,41,2,114,101,0,0,0,114, + 242,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, + 0,0,0,114,158,0,0,0,222,3,0,0,115,2,0,0, + 0,0,1,122,21,95,78,97,109,101,115,112,97,99,101,80, + 97,116,104,46,97,112,112,101,110,100,78,41,14,114,106,0, + 0,0,114,105,0,0,0,114,107,0,0,0,114,108,0,0, + 0,114,180,0,0,0,114,233,0,0,0,114,228,0,0,0, + 114,235,0,0,0,114,237,0,0,0,114,239,0,0,0,114, + 240,0,0,0,114,241,0,0,0,114,243,0,0,0,114,158, + 0,0,0,114,4,0,0,0,114,4,0,0,0,114,4,0, + 0,0,114,5,0,0,0,114,225,0,0,0,167,3,0,0, + 115,22,0,0,0,8,5,4,2,8,6,8,10,8,4,8, + 13,8,3,8,3,8,3,8,3,8,3,114,225,0,0,0, + 99,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0, + 0,64,0,0,0,115,80,0,0,0,101,0,90,1,100,0, + 90,2,100,1,100,2,132,0,90,3,101,4,100,3,100,4, + 132,0,131,1,90,5,100,5,100,6,132,0,90,6,100,7, + 100,8,132,0,90,7,100,9,100,10,132,0,90,8,100,11, + 100,12,132,0,90,9,100,13,100,14,132,0,90,10,100,15, + 100,16,132,0,90,11,100,17,83,0,41,18,218,16,95,78, + 97,109,101,115,112,97,99,101,76,111,97,100,101,114,99,4, + 0,0,0,0,0,0,0,4,0,0,0,4,0,0,0,67, + 0,0,0,115,18,0,0,0,116,0,124,1,124,2,124,3, + 131,3,124,0,95,1,100,0,83,0,41,1,78,41,2,114, + 225,0,0,0,114,227,0,0,0,41,4,114,101,0,0,0, + 114,99,0,0,0,114,35,0,0,0,114,231,0,0,0,114, + 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,180, + 0,0,0,228,3,0,0,115,2,0,0,0,0,1,122,25, + 95,78,97,109,101,115,112,97,99,101,76,111,97,100,101,114, + 46,95,95,105,110,105,116,95,95,99,2,0,0,0,0,0, + 0,0,2,0,0,0,2,0,0,0,67,0,0,0,115,12, + 0,0,0,100,1,106,0,124,1,106,1,131,1,83,0,41, + 2,122,115,82,101,116,117,114,110,32,114,101,112,114,32,102, + 111,114,32,116,104,101,32,109,111,100,117,108,101,46,10,10, + 32,32,32,32,32,32,32,32,84,104,101,32,109,101,116,104, + 111,100,32,105,115,32,100,101,112,114,101,99,97,116,101,100, + 46,32,32,84,104,101,32,105,109,112,111,114,116,32,109,97, + 99,104,105,110,101,114,121,32,100,111,101,115,32,116,104,101, + 32,106,111,98,32,105,116,115,101,108,102,46,10,10,32,32, + 32,32,32,32,32,32,122,25,60,109,111,100,117,108,101,32, + 123,33,114,125,32,40,110,97,109,101,115,112,97,99,101,41, + 62,41,2,114,48,0,0,0,114,106,0,0,0,41,2,114, + 165,0,0,0,114,185,0,0,0,114,4,0,0,0,114,4, + 0,0,0,114,5,0,0,0,218,11,109,111,100,117,108,101, + 95,114,101,112,114,231,3,0,0,115,2,0,0,0,0,7, + 122,28,95,78,97,109,101,115,112,97,99,101,76,111,97,100, + 101,114,46,109,111,100,117,108,101,95,114,101,112,114,99,2, + 0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,67, + 0,0,0,115,4,0,0,0,100,1,83,0,41,2,78,84, + 114,4,0,0,0,41,2,114,101,0,0,0,114,120,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,181,0,0,0,97,3,0,0,115,8,0,0,0,0,1, - 10,1,10,1,18,1,122,29,83,111,117,114,99,101,108,101, - 115,115,70,105,108,101,76,111,97,100,101,114,46,103,101,116, - 95,99,111,100,101,99,2,0,0,0,0,0,0,0,2,0, - 0,0,1,0,0,0,67,0,0,0,115,4,0,0,0,100, - 1,83,0,41,2,122,39,82,101,116,117,114,110,32,78,111, - 110,101,32,97,115,32,116,104,101,114,101,32,105,115,32,110, - 111,32,115,111,117,114,99,101,32,99,111,100,101,46,78,114, - 4,0,0,0,41,2,114,100,0,0,0,114,119,0,0,0, - 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 196,0,0,0,103,3,0,0,115,2,0,0,0,0,2,122, - 31,83,111,117,114,99,101,108,101,115,115,70,105,108,101,76, + 114,154,0,0,0,240,3,0,0,115,2,0,0,0,0,1, + 122,27,95,78,97,109,101,115,112,97,99,101,76,111,97,100, + 101,114,46,105,115,95,112,97,99,107,97,103,101,99,2,0, + 0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,0, + 0,0,115,4,0,0,0,100,1,83,0,41,2,78,114,30, + 0,0,0,114,4,0,0,0,41,2,114,101,0,0,0,114, + 120,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, + 0,0,0,114,197,0,0,0,243,3,0,0,115,2,0,0, + 0,0,1,122,27,95,78,97,109,101,115,112,97,99,101,76, 111,97,100,101,114,46,103,101,116,95,115,111,117,114,99,101, - 78,41,6,114,105,0,0,0,114,104,0,0,0,114,106,0, - 0,0,114,107,0,0,0,114,181,0,0,0,114,196,0,0, - 0,114,4,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,5,0,0,0,114,217,0,0,0,93,3,0,0,115,6, - 0,0,0,8,2,4,2,8,6,114,217,0,0,0,99,0, - 0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,64, - 0,0,0,115,92,0,0,0,101,0,90,1,100,0,90,2, - 100,1,90,3,100,2,100,3,132,0,90,4,100,4,100,5, - 132,0,90,5,100,6,100,7,132,0,90,6,100,8,100,9, - 132,0,90,7,100,10,100,11,132,0,90,8,100,12,100,13, - 132,0,90,9,100,14,100,15,132,0,90,10,100,16,100,17, - 132,0,90,11,101,12,100,18,100,19,132,0,131,1,90,13, - 100,20,83,0,41,21,218,19,69,120,116,101,110,115,105,111, - 110,70,105,108,101,76,111,97,100,101,114,122,93,76,111,97, - 100,101,114,32,102,111,114,32,101,120,116,101,110,115,105,111, - 110,32,109,111,100,117,108,101,115,46,10,10,32,32,32,32, - 84,104,101,32,99,111,110,115,116,114,117,99,116,111,114,32, - 105,115,32,100,101,115,105,103,110,101,100,32,116,111,32,119, - 111,114,107,32,119,105,116,104,32,70,105,108,101,70,105,110, - 100,101,114,46,10,10,32,32,32,32,99,3,0,0,0,0, - 0,0,0,3,0,0,0,2,0,0,0,67,0,0,0,115, - 16,0,0,0,124,1,124,0,95,0,124,2,124,0,95,1, - 100,0,83,0,41,1,78,41,2,114,98,0,0,0,114,35, - 0,0,0,41,3,114,100,0,0,0,114,98,0,0,0,114, - 35,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,179,0,0,0,120,3,0,0,115,4,0,0, - 0,0,1,6,1,122,28,69,120,116,101,110,115,105,111,110, - 70,105,108,101,76,111,97,100,101,114,46,95,95,105,110,105, - 116,95,95,99,2,0,0,0,0,0,0,0,2,0,0,0, - 2,0,0,0,67,0,0,0,115,24,0,0,0,124,0,106, - 0,124,1,106,0,107,2,111,22,124,0,106,1,124,1,106, - 1,107,2,83,0,41,1,78,41,2,114,205,0,0,0,114, - 111,0,0,0,41,2,114,100,0,0,0,114,206,0,0,0, - 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 207,0,0,0,124,3,0,0,115,4,0,0,0,0,1,12, - 1,122,26,69,120,116,101,110,115,105,111,110,70,105,108,101, - 76,111,97,100,101,114,46,95,95,101,113,95,95,99,1,0, - 0,0,0,0,0,0,1,0,0,0,3,0,0,0,67,0, - 0,0,115,20,0,0,0,116,0,124,0,106,1,131,1,116, - 0,124,0,106,2,131,1,65,0,83,0,41,1,78,41,3, - 114,208,0,0,0,114,98,0,0,0,114,35,0,0,0,41, - 1,114,100,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,5,0,0,0,114,209,0,0,0,128,3,0,0,115,2, - 0,0,0,0,1,122,28,69,120,116,101,110,115,105,111,110, - 70,105,108,101,76,111,97,100,101,114,46,95,95,104,97,115, - 104,95,95,99,2,0,0,0,0,0,0,0,3,0,0,0, - 4,0,0,0,67,0,0,0,115,36,0,0,0,116,0,106, - 1,116,2,106,3,124,1,131,2,125,2,116,0,106,4,100, - 1,124,1,106,5,124,0,106,6,131,3,1,0,124,2,83, - 0,41,2,122,38,67,114,101,97,116,101,32,97,110,32,117, - 110,105,116,105,97,108,105,122,101,100,32,101,120,116,101,110, - 115,105,111,110,32,109,111,100,117,108,101,122,38,101,120,116, - 101,110,115,105,111,110,32,109,111,100,117,108,101,32,123,33, - 114,125,32,108,111,97,100,101,100,32,102,114,111,109,32,123, - 33,114,125,41,7,114,114,0,0,0,114,182,0,0,0,114, - 139,0,0,0,90,14,99,114,101,97,116,101,95,100,121,110, - 97,109,105,99,114,129,0,0,0,114,98,0,0,0,114,35, - 0,0,0,41,3,114,100,0,0,0,114,158,0,0,0,114, - 184,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,180,0,0,0,131,3,0,0,115,10,0,0, - 0,0,2,4,1,10,1,6,1,12,1,122,33,69,120,116, - 101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,114, - 46,99,114,101,97,116,101,95,109,111,100,117,108,101,99,2, - 0,0,0,0,0,0,0,2,0,0,0,4,0,0,0,67, - 0,0,0,115,36,0,0,0,116,0,106,1,116,2,106,3, - 124,1,131,2,1,0,116,0,106,4,100,1,124,0,106,5, - 124,0,106,6,131,3,1,0,100,2,83,0,41,3,122,30, - 73,110,105,116,105,97,108,105,122,101,32,97,110,32,101,120, - 116,101,110,115,105,111,110,32,109,111,100,117,108,101,122,40, - 101,120,116,101,110,115,105,111,110,32,109,111,100,117,108,101, - 32,123,33,114,125,32,101,120,101,99,117,116,101,100,32,102, - 114,111,109,32,123,33,114,125,78,41,7,114,114,0,0,0, - 114,182,0,0,0,114,139,0,0,0,90,12,101,120,101,99, - 95,100,121,110,97,109,105,99,114,129,0,0,0,114,98,0, - 0,0,114,35,0,0,0,41,2,114,100,0,0,0,114,184, + 99,2,0,0,0,0,0,0,0,2,0,0,0,6,0,0, + 0,67,0,0,0,115,18,0,0,0,116,0,100,1,100,2, + 100,3,100,4,100,5,144,1,131,3,83,0,41,6,78,114, + 30,0,0,0,122,8,60,115,116,114,105,110,103,62,114,184, + 0,0,0,114,199,0,0,0,84,41,1,114,200,0,0,0, + 41,2,114,101,0,0,0,114,120,0,0,0,114,4,0,0, + 0,114,4,0,0,0,114,5,0,0,0,114,182,0,0,0, + 246,3,0,0,115,2,0,0,0,0,1,122,25,95,78,97, + 109,101,115,112,97,99,101,76,111,97,100,101,114,46,103,101, + 116,95,99,111,100,101,99,2,0,0,0,0,0,0,0,2, + 0,0,0,1,0,0,0,67,0,0,0,115,4,0,0,0, + 100,1,83,0,41,2,122,42,85,115,101,32,100,101,102,97, + 117,108,116,32,115,101,109,97,110,116,105,99,115,32,102,111, + 114,32,109,111,100,117,108,101,32,99,114,101,97,116,105,111, + 110,46,78,114,4,0,0,0,41,2,114,101,0,0,0,114, + 159,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, + 0,0,0,114,181,0,0,0,249,3,0,0,115,0,0,0, + 0,122,30,95,78,97,109,101,115,112,97,99,101,76,111,97, + 100,101,114,46,99,114,101,97,116,101,95,109,111,100,117,108, + 101,99,2,0,0,0,0,0,0,0,2,0,0,0,1,0, + 0,0,67,0,0,0,115,4,0,0,0,100,0,83,0,41, + 1,78,114,4,0,0,0,41,2,114,101,0,0,0,114,185, 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,114,185,0,0,0,139,3,0,0,115,6,0,0,0, - 0,2,14,1,6,1,122,31,69,120,116,101,110,115,105,111, - 110,70,105,108,101,76,111,97,100,101,114,46,101,120,101,99, - 95,109,111,100,117,108,101,99,2,0,0,0,0,0,0,0, - 2,0,0,0,4,0,0,0,3,0,0,0,115,36,0,0, - 0,116,0,124,0,106,1,131,1,100,1,25,0,137,0,116, - 2,135,0,102,1,100,2,100,3,134,0,116,3,68,0,131, - 1,131,1,83,0,41,4,122,49,82,101,116,117,114,110,32, - 84,114,117,101,32,105,102,32,116,104,101,32,101,120,116,101, - 110,115,105,111,110,32,109,111,100,117,108,101,32,105,115,32, - 97,32,112,97,99,107,97,103,101,46,114,29,0,0,0,99, - 1,0,0,0,0,0,0,0,2,0,0,0,4,0,0,0, - 51,0,0,0,115,26,0,0,0,124,0,93,18,125,1,136, - 0,100,0,124,1,23,0,107,2,86,0,1,0,113,2,100, - 1,83,0,41,2,114,179,0,0,0,78,114,4,0,0,0, - 41,2,114,22,0,0,0,218,6,115,117,102,102,105,120,41, - 1,218,9,102,105,108,101,95,110,97,109,101,114,4,0,0, - 0,114,5,0,0,0,250,9,60,103,101,110,101,120,112,114, - 62,148,3,0,0,115,2,0,0,0,4,1,122,49,69,120, - 116,101,110,115,105,111,110,70,105,108,101,76,111,97,100,101, - 114,46,105,115,95,112,97,99,107,97,103,101,46,60,108,111, - 99,97,108,115,62,46,60,103,101,110,101,120,112,114,62,41, - 4,114,38,0,0,0,114,35,0,0,0,218,3,97,110,121, - 218,18,69,88,84,69,78,83,73,79,78,95,83,85,70,70, - 73,88,69,83,41,2,114,100,0,0,0,114,119,0,0,0, - 114,4,0,0,0,41,1,114,220,0,0,0,114,5,0,0, - 0,114,153,0,0,0,145,3,0,0,115,6,0,0,0,0, - 2,14,1,12,1,122,30,69,120,116,101,110,115,105,111,110, - 70,105,108,101,76,111,97,100,101,114,46,105,115,95,112,97, - 99,107,97,103,101,99,2,0,0,0,0,0,0,0,2,0, - 0,0,1,0,0,0,67,0,0,0,115,4,0,0,0,100, - 1,83,0,41,2,122,63,82,101,116,117,114,110,32,78,111, - 110,101,32,97,115,32,97,110,32,101,120,116,101,110,115,105, - 111,110,32,109,111,100,117,108,101,32,99,97,110,110,111,116, - 32,99,114,101,97,116,101,32,97,32,99,111,100,101,32,111, - 98,106,101,99,116,46,78,114,4,0,0,0,41,2,114,100, - 0,0,0,114,119,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,114,181,0,0,0,151,3,0,0, - 115,2,0,0,0,0,2,122,28,69,120,116,101,110,115,105, - 111,110,70,105,108,101,76,111,97,100,101,114,46,103,101,116, - 95,99,111,100,101,99,2,0,0,0,0,0,0,0,2,0, - 0,0,1,0,0,0,67,0,0,0,115,4,0,0,0,100, - 1,83,0,41,2,122,53,82,101,116,117,114,110,32,78,111, - 110,101,32,97,115,32,101,120,116,101,110,115,105,111,110,32, - 109,111,100,117,108,101,115,32,104,97,118,101,32,110,111,32, - 115,111,117,114,99,101,32,99,111,100,101,46,78,114,4,0, - 0,0,41,2,114,100,0,0,0,114,119,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,5,0,0,0,114,196,0, - 0,0,155,3,0,0,115,2,0,0,0,0,2,122,30,69, - 120,116,101,110,115,105,111,110,70,105,108,101,76,111,97,100, - 101,114,46,103,101,116,95,115,111,117,114,99,101,99,2,0, - 0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,0, - 0,0,115,6,0,0,0,124,0,106,0,83,0,41,1,122, - 58,82,101,116,117,114,110,32,116,104,101,32,112,97,116,104, - 32,116,111,32,116,104,101,32,115,111,117,114,99,101,32,102, - 105,108,101,32,97,115,32,102,111,117,110,100,32,98,121,32, - 116,104,101,32,102,105,110,100,101,114,46,41,1,114,35,0, - 0,0,41,2,114,100,0,0,0,114,119,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,5,0,0,0,114,151,0, - 0,0,159,3,0,0,115,2,0,0,0,0,3,122,32,69, - 120,116,101,110,115,105,111,110,70,105,108,101,76,111,97,100, - 101,114,46,103,101,116,95,102,105,108,101,110,97,109,101,78, - 41,14,114,105,0,0,0,114,104,0,0,0,114,106,0,0, - 0,114,107,0,0,0,114,179,0,0,0,114,207,0,0,0, - 114,209,0,0,0,114,180,0,0,0,114,185,0,0,0,114, - 153,0,0,0,114,181,0,0,0,114,196,0,0,0,114,116, - 0,0,0,114,151,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,4,0,0,0,114,5,0,0,0,114,218,0,0, - 0,112,3,0,0,115,20,0,0,0,8,6,4,2,8,4, - 8,4,8,3,8,8,8,6,8,6,8,4,8,4,114,218, - 0,0,0,99,0,0,0,0,0,0,0,0,0,0,0,0, - 2,0,0,0,64,0,0,0,115,96,0,0,0,101,0,90, - 1,100,0,90,2,100,1,90,3,100,2,100,3,132,0,90, - 4,100,4,100,5,132,0,90,5,100,6,100,7,132,0,90, - 6,100,8,100,9,132,0,90,7,100,10,100,11,132,0,90, - 8,100,12,100,13,132,0,90,9,100,14,100,15,132,0,90, - 10,100,16,100,17,132,0,90,11,100,18,100,19,132,0,90, - 12,100,20,100,21,132,0,90,13,100,22,83,0,41,23,218, - 14,95,78,97,109,101,115,112,97,99,101,80,97,116,104,97, - 38,1,0,0,82,101,112,114,101,115,101,110,116,115,32,97, - 32,110,97,109,101,115,112,97,99,101,32,112,97,99,107,97, - 103,101,39,115,32,112,97,116,104,46,32,32,73,116,32,117, - 115,101,115,32,116,104,101,32,109,111,100,117,108,101,32,110, - 97,109,101,10,32,32,32,32,116,111,32,102,105,110,100,32, - 105,116,115,32,112,97,114,101,110,116,32,109,111,100,117,108, - 101,44,32,97,110,100,32,102,114,111,109,32,116,104,101,114, - 101,32,105,116,32,108,111,111,107,115,32,117,112,32,116,104, - 101,32,112,97,114,101,110,116,39,115,10,32,32,32,32,95, - 95,112,97,116,104,95,95,46,32,32,87,104,101,110,32,116, - 104,105,115,32,99,104,97,110,103,101,115,44,32,116,104,101, - 32,109,111,100,117,108,101,39,115,32,111,119,110,32,112,97, - 116,104,32,105,115,32,114,101,99,111,109,112,117,116,101,100, - 44,10,32,32,32,32,117,115,105,110,103,32,112,97,116,104, - 95,102,105,110,100,101,114,46,32,32,70,111,114,32,116,111, - 112,45,108,101,118,101,108,32,109,111,100,117,108,101,115,44, - 32,116,104,101,32,112,97,114,101,110,116,32,109,111,100,117, - 108,101,39,115,32,112,97,116,104,10,32,32,32,32,105,115, - 32,115,121,115,46,112,97,116,104,46,99,4,0,0,0,0, - 0,0,0,4,0,0,0,2,0,0,0,67,0,0,0,115, - 36,0,0,0,124,1,124,0,95,0,124,2,124,0,95,1, - 116,2,124,0,106,3,131,0,131,1,124,0,95,4,124,3, - 124,0,95,5,100,0,83,0,41,1,78,41,6,218,5,95, - 110,97,109,101,218,5,95,112,97,116,104,114,93,0,0,0, - 218,16,95,103,101,116,95,112,97,114,101,110,116,95,112,97, - 116,104,218,17,95,108,97,115,116,95,112,97,114,101,110,116, - 95,112,97,116,104,218,12,95,112,97,116,104,95,102,105,110, - 100,101,114,41,4,114,100,0,0,0,114,98,0,0,0,114, - 35,0,0,0,218,11,112,97,116,104,95,102,105,110,100,101, - 114,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,179,0,0,0,172,3,0,0,115,8,0,0,0,0,1, - 6,1,6,1,14,1,122,23,95,78,97,109,101,115,112,97, - 99,101,80,97,116,104,46,95,95,105,110,105,116,95,95,99, - 1,0,0,0,0,0,0,0,4,0,0,0,3,0,0,0, - 67,0,0,0,115,38,0,0,0,124,0,106,0,106,1,100, - 1,131,1,92,3,125,1,125,2,125,3,124,2,100,2,107, - 2,114,30,100,6,83,0,124,1,100,5,102,2,83,0,41, - 7,122,62,82,101,116,117,114,110,115,32,97,32,116,117,112, - 108,101,32,111,102,32,40,112,97,114,101,110,116,45,109,111, - 100,117,108,101,45,110,97,109,101,44,32,112,97,114,101,110, - 116,45,112,97,116,104,45,97,116,116,114,45,110,97,109,101, - 41,114,58,0,0,0,114,30,0,0,0,114,7,0,0,0, - 114,35,0,0,0,90,8,95,95,112,97,116,104,95,95,41, - 2,122,3,115,121,115,122,4,112,97,116,104,41,2,114,225, - 0,0,0,114,32,0,0,0,41,4,114,100,0,0,0,114, - 216,0,0,0,218,3,100,111,116,90,2,109,101,114,4,0, - 0,0,114,4,0,0,0,114,5,0,0,0,218,23,95,102, - 105,110,100,95,112,97,114,101,110,116,95,112,97,116,104,95, - 110,97,109,101,115,178,3,0,0,115,8,0,0,0,0,2, - 18,1,8,2,4,3,122,38,95,78,97,109,101,115,112,97, - 99,101,80,97,116,104,46,95,102,105,110,100,95,112,97,114, - 101,110,116,95,112,97,116,104,95,110,97,109,101,115,99,1, - 0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,67, - 0,0,0,115,28,0,0,0,124,0,106,0,131,0,92,2, - 125,1,125,2,116,1,116,2,106,3,124,1,25,0,124,2, - 131,2,83,0,41,1,78,41,4,114,232,0,0,0,114,110, - 0,0,0,114,7,0,0,0,218,7,109,111,100,117,108,101, - 115,41,3,114,100,0,0,0,90,18,112,97,114,101,110,116, - 95,109,111,100,117,108,101,95,110,97,109,101,90,14,112,97, - 116,104,95,97,116,116,114,95,110,97,109,101,114,4,0,0, - 0,114,4,0,0,0,114,5,0,0,0,114,227,0,0,0, - 188,3,0,0,115,4,0,0,0,0,1,12,1,122,31,95, - 78,97,109,101,115,112,97,99,101,80,97,116,104,46,95,103, - 101,116,95,112,97,114,101,110,116,95,112,97,116,104,99,1, - 0,0,0,0,0,0,0,3,0,0,0,3,0,0,0,67, - 0,0,0,115,80,0,0,0,116,0,124,0,106,1,131,0, - 131,1,125,1,124,1,124,0,106,2,107,3,114,74,124,0, - 106,3,124,0,106,4,124,1,131,2,125,2,124,2,100,0, - 107,9,114,68,124,2,106,5,100,0,107,8,114,68,124,2, - 106,6,114,68,124,2,106,6,124,0,95,7,124,1,124,0, - 95,2,124,0,106,7,83,0,41,1,78,41,8,114,93,0, - 0,0,114,227,0,0,0,114,228,0,0,0,114,229,0,0, - 0,114,225,0,0,0,114,120,0,0,0,114,150,0,0,0, - 114,226,0,0,0,41,3,114,100,0,0,0,90,11,112,97, - 114,101,110,116,95,112,97,116,104,114,158,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,5,0,0,0,218,12,95, - 114,101,99,97,108,99,117,108,97,116,101,192,3,0,0,115, - 16,0,0,0,0,2,12,1,10,1,14,3,18,1,6,1, - 8,1,6,1,122,27,95,78,97,109,101,115,112,97,99,101, - 80,97,116,104,46,95,114,101,99,97,108,99,117,108,97,116, - 101,99,1,0,0,0,0,0,0,0,1,0,0,0,2,0, - 0,0,67,0,0,0,115,12,0,0,0,116,0,124,0,106, - 1,131,0,131,1,83,0,41,1,78,41,2,218,4,105,116, - 101,114,114,234,0,0,0,41,1,114,100,0,0,0,114,4, - 0,0,0,114,4,0,0,0,114,5,0,0,0,218,8,95, - 95,105,116,101,114,95,95,205,3,0,0,115,2,0,0,0, - 0,1,122,23,95,78,97,109,101,115,112,97,99,101,80,97, - 116,104,46,95,95,105,116,101,114,95,95,99,3,0,0,0, - 0,0,0,0,3,0,0,0,3,0,0,0,67,0,0,0, - 115,14,0,0,0,124,2,124,0,106,0,124,1,60,0,100, - 0,83,0,41,1,78,41,1,114,226,0,0,0,41,3,114, - 100,0,0,0,218,5,105,110,100,101,120,114,35,0,0,0, - 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218, - 11,95,95,115,101,116,105,116,101,109,95,95,208,3,0,0, - 115,2,0,0,0,0,1,122,26,95,78,97,109,101,115,112, - 97,99,101,80,97,116,104,46,95,95,115,101,116,105,116,101, - 109,95,95,99,1,0,0,0,0,0,0,0,1,0,0,0, - 2,0,0,0,67,0,0,0,115,12,0,0,0,116,0,124, - 0,106,1,131,0,131,1,83,0,41,1,78,41,2,114,31, - 0,0,0,114,234,0,0,0,41,1,114,100,0,0,0,114, - 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,7, - 95,95,108,101,110,95,95,211,3,0,0,115,2,0,0,0, - 0,1,122,22,95,78,97,109,101,115,112,97,99,101,80,97, - 116,104,46,95,95,108,101,110,95,95,99,1,0,0,0,0, - 0,0,0,1,0,0,0,2,0,0,0,67,0,0,0,115, - 12,0,0,0,100,1,106,0,124,0,106,1,131,1,83,0, - 41,2,78,122,20,95,78,97,109,101,115,112,97,99,101,80, - 97,116,104,40,123,33,114,125,41,41,2,114,47,0,0,0, - 114,226,0,0,0,41,1,114,100,0,0,0,114,4,0,0, - 0,114,4,0,0,0,114,5,0,0,0,218,8,95,95,114, - 101,112,114,95,95,214,3,0,0,115,2,0,0,0,0,1, - 122,23,95,78,97,109,101,115,112,97,99,101,80,97,116,104, - 46,95,95,114,101,112,114,95,95,99,2,0,0,0,0,0, - 0,0,2,0,0,0,2,0,0,0,67,0,0,0,115,12, - 0,0,0,124,1,124,0,106,0,131,0,107,6,83,0,41, - 1,78,41,1,114,234,0,0,0,41,2,114,100,0,0,0, - 218,4,105,116,101,109,114,4,0,0,0,114,4,0,0,0, - 114,5,0,0,0,218,12,95,95,99,111,110,116,97,105,110, - 115,95,95,217,3,0,0,115,2,0,0,0,0,1,122,27, - 95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95, - 95,99,111,110,116,97,105,110,115,95,95,99,2,0,0,0, - 0,0,0,0,2,0,0,0,2,0,0,0,67,0,0,0, - 115,16,0,0,0,124,0,106,0,106,1,124,1,131,1,1, - 0,100,0,83,0,41,1,78,41,2,114,226,0,0,0,114, - 157,0,0,0,41,2,114,100,0,0,0,114,241,0,0,0, - 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 157,0,0,0,220,3,0,0,115,2,0,0,0,0,1,122, - 21,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46, - 97,112,112,101,110,100,78,41,14,114,105,0,0,0,114,104, - 0,0,0,114,106,0,0,0,114,107,0,0,0,114,179,0, - 0,0,114,232,0,0,0,114,227,0,0,0,114,234,0,0, - 0,114,236,0,0,0,114,238,0,0,0,114,239,0,0,0, - 114,240,0,0,0,114,242,0,0,0,114,157,0,0,0,114, - 4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,224,0,0,0,165,3,0,0,115,22,0,0, - 0,8,5,4,2,8,6,8,10,8,4,8,13,8,3,8, - 3,8,3,8,3,8,3,114,224,0,0,0,99,0,0,0, - 0,0,0,0,0,0,0,0,0,3,0,0,0,64,0,0, - 0,115,80,0,0,0,101,0,90,1,100,0,90,2,100,1, - 100,2,132,0,90,3,101,4,100,3,100,4,132,0,131,1, - 90,5,100,5,100,6,132,0,90,6,100,7,100,8,132,0, - 90,7,100,9,100,10,132,0,90,8,100,11,100,12,132,0, - 90,9,100,13,100,14,132,0,90,10,100,15,100,16,132,0, - 90,11,100,17,83,0,41,18,218,16,95,78,97,109,101,115, - 112,97,99,101,76,111,97,100,101,114,99,4,0,0,0,0, - 0,0,0,4,0,0,0,4,0,0,0,67,0,0,0,115, - 18,0,0,0,116,0,124,1,124,2,124,3,131,3,124,0, - 95,1,100,0,83,0,41,1,78,41,2,114,224,0,0,0, - 114,226,0,0,0,41,4,114,100,0,0,0,114,98,0,0, - 0,114,35,0,0,0,114,230,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,179,0,0,0,226, - 3,0,0,115,2,0,0,0,0,1,122,25,95,78,97,109, - 101,115,112,97,99,101,76,111,97,100,101,114,46,95,95,105, - 110,105,116,95,95,99,2,0,0,0,0,0,0,0,2,0, - 0,0,2,0,0,0,67,0,0,0,115,12,0,0,0,100, - 1,106,0,124,1,106,1,131,1,83,0,41,2,122,115,82, - 101,116,117,114,110,32,114,101,112,114,32,102,111,114,32,116, - 104,101,32,109,111,100,117,108,101,46,10,10,32,32,32,32, - 32,32,32,32,84,104,101,32,109,101,116,104,111,100,32,105, - 115,32,100,101,112,114,101,99,97,116,101,100,46,32,32,84, - 104,101,32,105,109,112,111,114,116,32,109,97,99,104,105,110, - 101,114,121,32,100,111,101,115,32,116,104,101,32,106,111,98, - 32,105,116,115,101,108,102,46,10,10,32,32,32,32,32,32, - 32,32,122,25,60,109,111,100,117,108,101,32,123,33,114,125, - 32,40,110,97,109,101,115,112,97,99,101,41,62,41,2,114, - 47,0,0,0,114,105,0,0,0,41,2,114,164,0,0,0, - 114,184,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,218,11,109,111,100,117,108,101,95,114,101,112, - 114,229,3,0,0,115,2,0,0,0,0,7,122,28,95,78, - 97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,109, - 111,100,117,108,101,95,114,101,112,114,99,2,0,0,0,0, - 0,0,0,2,0,0,0,1,0,0,0,67,0,0,0,115, - 4,0,0,0,100,1,83,0,41,2,78,84,114,4,0,0, - 0,41,2,114,100,0,0,0,114,119,0,0,0,114,4,0, - 0,0,114,4,0,0,0,114,5,0,0,0,114,153,0,0, - 0,238,3,0,0,115,2,0,0,0,0,1,122,27,95,78, - 97,109,101,115,112,97,99,101,76,111,97,100,101,114,46,105, - 115,95,112,97,99,107,97,103,101,99,2,0,0,0,0,0, - 0,0,2,0,0,0,1,0,0,0,67,0,0,0,115,4, - 0,0,0,100,1,83,0,41,2,78,114,30,0,0,0,114, - 4,0,0,0,41,2,114,100,0,0,0,114,119,0,0,0, - 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 196,0,0,0,241,3,0,0,115,2,0,0,0,0,1,122, - 27,95,78,97,109,101,115,112,97,99,101,76,111,97,100,101, - 114,46,103,101,116,95,115,111,117,114,99,101,99,2,0,0, - 0,0,0,0,0,2,0,0,0,6,0,0,0,67,0,0, - 0,115,18,0,0,0,116,0,100,1,100,2,100,3,100,4, - 100,5,144,1,131,3,83,0,41,6,78,114,30,0,0,0, - 122,8,60,115,116,114,105,110,103,62,114,183,0,0,0,114, - 198,0,0,0,84,41,1,114,199,0,0,0,41,2,114,100, - 0,0,0,114,119,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,114,181,0,0,0,244,3,0,0, - 115,2,0,0,0,0,1,122,25,95,78,97,109,101,115,112, - 97,99,101,76,111,97,100,101,114,46,103,101,116,95,99,111, - 100,101,99,2,0,0,0,0,0,0,0,2,0,0,0,1, - 0,0,0,67,0,0,0,115,4,0,0,0,100,1,83,0, - 41,2,122,42,85,115,101,32,100,101,102,97,117,108,116,32, - 115,101,109,97,110,116,105,99,115,32,102,111,114,32,109,111, - 100,117,108,101,32,99,114,101,97,116,105,111,110,46,78,114, - 4,0,0,0,41,2,114,100,0,0,0,114,158,0,0,0, - 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 180,0,0,0,247,3,0,0,115,0,0,0,0,122,30,95, - 78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,46, - 99,114,101,97,116,101,95,109,111,100,117,108,101,99,2,0, - 0,0,0,0,0,0,2,0,0,0,1,0,0,0,67,0, - 0,0,115,4,0,0,0,100,0,83,0,41,1,78,114,4, - 0,0,0,41,2,114,100,0,0,0,114,184,0,0,0,114, - 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,185, - 0,0,0,250,3,0,0,115,2,0,0,0,0,1,122,28, - 95,78,97,109,101,115,112,97,99,101,76,111,97,100,101,114, - 46,101,120,101,99,95,109,111,100,117,108,101,99,2,0,0, + 0,0,114,186,0,0,0,252,3,0,0,115,2,0,0,0, + 0,1,122,28,95,78,97,109,101,115,112,97,99,101,76,111, + 97,100,101,114,46,101,120,101,99,95,109,111,100,117,108,101, + 99,2,0,0,0,0,0,0,0,2,0,0,0,3,0,0, + 0,67,0,0,0,115,26,0,0,0,116,0,106,1,100,1, + 124,0,106,2,131,2,1,0,116,0,106,3,124,0,124,1, + 131,2,83,0,41,2,122,98,76,111,97,100,32,97,32,110, + 97,109,101,115,112,97,99,101,32,109,111,100,117,108,101,46, + 10,10,32,32,32,32,32,32,32,32,84,104,105,115,32,109, + 101,116,104,111,100,32,105,115,32,100,101,112,114,101,99,97, + 116,101,100,46,32,32,85,115,101,32,101,120,101,99,95,109, + 111,100,117,108,101,40,41,32,105,110,115,116,101,97,100,46, + 10,10,32,32,32,32,32,32,32,32,122,38,110,97,109,101, + 115,112,97,99,101,32,109,111,100,117,108,101,32,108,111,97, + 100,101,100,32,119,105,116,104,32,112,97,116,104,32,123,33, + 114,125,41,4,114,115,0,0,0,114,130,0,0,0,114,227, + 0,0,0,114,187,0,0,0,41,2,114,101,0,0,0,114, + 120,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, + 0,0,0,114,188,0,0,0,255,3,0,0,115,6,0,0, + 0,0,7,6,1,8,1,122,28,95,78,97,109,101,115,112, + 97,99,101,76,111,97,100,101,114,46,108,111,97,100,95,109, + 111,100,117,108,101,78,41,12,114,106,0,0,0,114,105,0, + 0,0,114,107,0,0,0,114,180,0,0,0,114,178,0,0, + 0,114,245,0,0,0,114,154,0,0,0,114,197,0,0,0, + 114,182,0,0,0,114,181,0,0,0,114,186,0,0,0,114, + 188,0,0,0,114,4,0,0,0,114,4,0,0,0,114,4, + 0,0,0,114,5,0,0,0,114,244,0,0,0,227,3,0, + 0,115,16,0,0,0,8,1,8,3,12,9,8,3,8,3, + 8,3,8,3,8,3,114,244,0,0,0,99,0,0,0,0, + 0,0,0,0,0,0,0,0,4,0,0,0,64,0,0,0, + 115,106,0,0,0,101,0,90,1,100,0,90,2,100,1,90, + 3,101,4,100,2,100,3,132,0,131,1,90,5,101,4,100, + 4,100,5,132,0,131,1,90,6,101,4,100,6,100,7,132, + 0,131,1,90,7,101,4,100,8,100,9,132,0,131,1,90, + 8,101,4,100,17,100,11,100,12,132,1,131,1,90,9,101, + 4,100,18,100,13,100,14,132,1,131,1,90,10,101,4,100, + 19,100,15,100,16,132,1,131,1,90,11,100,10,83,0,41, + 20,218,10,80,97,116,104,70,105,110,100,101,114,122,62,77, + 101,116,97,32,112,97,116,104,32,102,105,110,100,101,114,32, + 102,111,114,32,115,121,115,46,112,97,116,104,32,97,110,100, + 32,112,97,99,107,97,103,101,32,95,95,112,97,116,104,95, + 95,32,97,116,116,114,105,98,117,116,101,115,46,99,1,0, + 0,0,0,0,0,0,2,0,0,0,4,0,0,0,67,0, + 0,0,115,42,0,0,0,120,36,116,0,106,1,106,2,131, + 0,68,0,93,22,125,1,116,3,124,1,100,1,131,2,114, + 12,124,1,106,4,131,0,1,0,113,12,87,0,100,2,83, + 0,41,3,122,125,67,97,108,108,32,116,104,101,32,105,110, + 118,97,108,105,100,97,116,101,95,99,97,99,104,101,115,40, + 41,32,109,101,116,104,111,100,32,111,110,32,97,108,108,32, + 112,97,116,104,32,101,110,116,114,121,32,102,105,110,100,101, + 114,115,10,32,32,32,32,32,32,32,32,115,116,111,114,101, + 100,32,105,110,32,115,121,115,46,112,97,116,104,95,105,109, + 112,111,114,116,101,114,95,99,97,99,104,101,115,32,40,119, + 104,101,114,101,32,105,109,112,108,101,109,101,110,116,101,100, + 41,46,218,17,105,110,118,97,108,105,100,97,116,101,95,99, + 97,99,104,101,115,78,41,5,114,7,0,0,0,218,19,112, + 97,116,104,95,105,109,112,111,114,116,101,114,95,99,97,99, + 104,101,218,6,118,97,108,117,101,115,114,109,0,0,0,114, + 247,0,0,0,41,2,114,165,0,0,0,218,6,102,105,110, + 100,101,114,114,4,0,0,0,114,4,0,0,0,114,5,0, + 0,0,114,247,0,0,0,17,4,0,0,115,6,0,0,0, + 0,4,16,1,10,1,122,28,80,97,116,104,70,105,110,100, + 101,114,46,105,110,118,97,108,105,100,97,116,101,95,99,97, + 99,104,101,115,99,2,0,0,0,0,0,0,0,3,0,0, + 0,12,0,0,0,67,0,0,0,115,86,0,0,0,116,0, + 106,1,100,1,107,9,114,30,116,0,106,1,12,0,114,30, + 116,2,106,3,100,2,116,4,131,2,1,0,120,50,116,0, + 106,1,68,0,93,36,125,2,121,8,124,2,124,1,131,1, + 83,0,4,0,116,5,107,10,114,72,1,0,1,0,1,0, + 119,38,89,0,113,38,88,0,113,38,87,0,100,1,83,0, + 100,1,83,0,41,3,122,113,83,101,97,114,99,104,32,115, + 101,113,117,101,110,99,101,32,111,102,32,104,111,111,107,115, + 32,102,111,114,32,97,32,102,105,110,100,101,114,32,102,111, + 114,32,39,112,97,116,104,39,46,10,10,32,32,32,32,32, + 32,32,32,73,102,32,39,104,111,111,107,115,39,32,105,115, + 32,102,97,108,115,101,32,116,104,101,110,32,117,115,101,32, + 115,121,115,46,112,97,116,104,95,104,111,111,107,115,46,10, + 10,32,32,32,32,32,32,32,32,78,122,23,115,121,115,46, + 112,97,116,104,95,104,111,111,107,115,32,105,115,32,101,109, + 112,116,121,41,6,114,7,0,0,0,218,10,112,97,116,104, + 95,104,111,111,107,115,114,61,0,0,0,114,62,0,0,0, + 114,119,0,0,0,114,100,0,0,0,41,3,114,165,0,0, + 0,114,35,0,0,0,90,4,104,111,111,107,114,4,0,0, + 0,114,4,0,0,0,114,5,0,0,0,218,11,95,112,97, + 116,104,95,104,111,111,107,115,25,4,0,0,115,16,0,0, + 0,0,7,18,1,12,1,12,1,2,1,8,1,14,1,12, + 2,122,22,80,97,116,104,70,105,110,100,101,114,46,95,112, + 97,116,104,95,104,111,111,107,115,99,2,0,0,0,0,0, + 0,0,3,0,0,0,19,0,0,0,67,0,0,0,115,102, + 0,0,0,124,1,100,1,107,2,114,42,121,12,116,0,106, + 1,131,0,125,1,87,0,110,20,4,0,116,2,107,10,114, + 40,1,0,1,0,1,0,100,2,83,0,88,0,121,14,116, + 3,106,4,124,1,25,0,125,2,87,0,110,40,4,0,116, + 5,107,10,114,96,1,0,1,0,1,0,124,0,106,6,124, + 1,131,1,125,2,124,2,116,3,106,4,124,1,60,0,89, + 0,110,2,88,0,124,2,83,0,41,3,122,210,71,101,116, + 32,116,104,101,32,102,105,110,100,101,114,32,102,111,114,32, + 116,104,101,32,112,97,116,104,32,101,110,116,114,121,32,102, + 114,111,109,32,115,121,115,46,112,97,116,104,95,105,109,112, + 111,114,116,101,114,95,99,97,99,104,101,46,10,10,32,32, + 32,32,32,32,32,32,73,102,32,116,104,101,32,112,97,116, + 104,32,101,110,116,114,121,32,105,115,32,110,111,116,32,105, + 110,32,116,104,101,32,99,97,99,104,101,44,32,102,105,110, + 100,32,116,104,101,32,97,112,112,114,111,112,114,105,97,116, + 101,32,102,105,110,100,101,114,10,32,32,32,32,32,32,32, + 32,97,110,100,32,99,97,99,104,101,32,105,116,46,32,73, + 102,32,110,111,32,102,105,110,100,101,114,32,105,115,32,97, + 118,97,105,108,97,98,108,101,44,32,115,116,111,114,101,32, + 78,111,110,101,46,10,10,32,32,32,32,32,32,32,32,114, + 30,0,0,0,78,41,7,114,3,0,0,0,114,45,0,0, + 0,218,17,70,105,108,101,78,111,116,70,111,117,110,100,69, + 114,114,111,114,114,7,0,0,0,114,248,0,0,0,114,132, + 0,0,0,114,252,0,0,0,41,3,114,165,0,0,0,114, + 35,0,0,0,114,250,0,0,0,114,4,0,0,0,114,4, + 0,0,0,114,5,0,0,0,218,20,95,112,97,116,104,95, + 105,109,112,111,114,116,101,114,95,99,97,99,104,101,42,4, + 0,0,115,22,0,0,0,0,8,8,1,2,1,12,1,14, + 3,6,1,2,1,14,1,14,1,10,1,16,1,122,31,80, + 97,116,104,70,105,110,100,101,114,46,95,112,97,116,104,95, + 105,109,112,111,114,116,101,114,95,99,97,99,104,101,99,3, + 0,0,0,0,0,0,0,6,0,0,0,3,0,0,0,67, + 0,0,0,115,82,0,0,0,116,0,124,2,100,1,131,2, + 114,26,124,2,106,1,124,1,131,1,92,2,125,3,125,4, + 110,14,124,2,106,2,124,1,131,1,125,3,103,0,125,4, + 124,3,100,0,107,9,114,60,116,3,106,4,124,1,124,3, + 131,2,83,0,116,3,106,5,124,1,100,0,131,2,125,5, + 124,4,124,5,95,6,124,5,83,0,41,2,78,114,118,0, + 0,0,41,7,114,109,0,0,0,114,118,0,0,0,114,177, + 0,0,0,114,115,0,0,0,114,174,0,0,0,114,155,0, + 0,0,114,151,0,0,0,41,6,114,165,0,0,0,114,120, + 0,0,0,114,250,0,0,0,114,121,0,0,0,114,122,0, + 0,0,114,159,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,5,0,0,0,218,16,95,108,101,103,97,99,121,95, + 103,101,116,95,115,112,101,99,64,4,0,0,115,18,0,0, + 0,0,4,10,1,16,2,10,1,4,1,8,1,12,1,12, + 1,6,1,122,27,80,97,116,104,70,105,110,100,101,114,46, + 95,108,101,103,97,99,121,95,103,101,116,95,115,112,101,99, + 78,99,4,0,0,0,0,0,0,0,9,0,0,0,5,0, + 0,0,67,0,0,0,115,170,0,0,0,103,0,125,4,120, + 160,124,2,68,0,93,130,125,5,116,0,124,5,116,1,116, + 2,102,2,131,2,115,30,113,10,124,0,106,3,124,5,131, + 1,125,6,124,6,100,1,107,9,114,10,116,4,124,6,100, + 2,131,2,114,72,124,6,106,5,124,1,124,3,131,2,125, + 7,110,12,124,0,106,6,124,1,124,6,131,2,125,7,124, + 7,100,1,107,8,114,94,113,10,124,7,106,7,100,1,107, + 9,114,108,124,7,83,0,124,7,106,8,125,8,124,8,100, + 1,107,8,114,130,116,9,100,3,131,1,130,1,124,4,106, + 10,124,8,131,1,1,0,113,10,87,0,116,11,106,12,124, + 1,100,1,131,2,125,7,124,4,124,7,95,8,124,7,83, + 0,100,1,83,0,41,4,122,63,70,105,110,100,32,116,104, + 101,32,108,111,97,100,101,114,32,111,114,32,110,97,109,101, + 115,112,97,99,101,95,112,97,116,104,32,102,111,114,32,116, + 104,105,115,32,109,111,100,117,108,101,47,112,97,99,107,97, + 103,101,32,110,97,109,101,46,78,114,176,0,0,0,122,19, + 115,112,101,99,32,109,105,115,115,105,110,103,32,108,111,97, + 100,101,114,41,13,114,138,0,0,0,114,70,0,0,0,218, + 5,98,121,116,101,115,114,254,0,0,0,114,109,0,0,0, + 114,176,0,0,0,114,255,0,0,0,114,121,0,0,0,114, + 151,0,0,0,114,100,0,0,0,114,144,0,0,0,114,115, + 0,0,0,114,155,0,0,0,41,9,114,165,0,0,0,114, + 120,0,0,0,114,35,0,0,0,114,175,0,0,0,218,14, + 110,97,109,101,115,112,97,99,101,95,112,97,116,104,90,5, + 101,110,116,114,121,114,250,0,0,0,114,159,0,0,0,114, + 122,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, + 0,0,0,218,9,95,103,101,116,95,115,112,101,99,79,4, + 0,0,115,40,0,0,0,0,5,4,1,10,1,14,1,2, + 1,10,1,8,1,10,1,14,2,12,1,8,1,2,1,10, + 1,4,1,6,1,8,1,8,5,14,2,12,1,6,1,122, + 20,80,97,116,104,70,105,110,100,101,114,46,95,103,101,116, + 95,115,112,101,99,99,4,0,0,0,0,0,0,0,6,0, + 0,0,4,0,0,0,67,0,0,0,115,104,0,0,0,124, + 2,100,1,107,8,114,14,116,0,106,1,125,2,124,0,106, + 2,124,1,124,2,124,3,131,3,125,4,124,4,100,1,107, + 8,114,42,100,1,83,0,110,58,124,4,106,3,100,1,107, + 8,114,96,124,4,106,4,125,5,124,5,114,90,100,2,124, + 4,95,5,116,6,124,1,124,5,124,0,106,2,131,3,124, + 4,95,4,124,4,83,0,113,100,100,1,83,0,110,4,124, + 4,83,0,100,1,83,0,41,3,122,98,102,105,110,100,32, + 116,104,101,32,109,111,100,117,108,101,32,111,110,32,115,121, + 115,46,112,97,116,104,32,111,114,32,39,112,97,116,104,39, + 32,98,97,115,101,100,32,111,110,32,115,121,115,46,112,97, + 116,104,95,104,111,111,107,115,32,97,110,100,10,32,32,32, + 32,32,32,32,32,115,121,115,46,112,97,116,104,95,105,109, + 112,111,114,116,101,114,95,99,97,99,104,101,46,78,90,9, + 110,97,109,101,115,112,97,99,101,41,7,114,7,0,0,0, + 114,35,0,0,0,114,2,1,0,0,114,121,0,0,0,114, + 151,0,0,0,114,153,0,0,0,114,225,0,0,0,41,6, + 114,165,0,0,0,114,120,0,0,0,114,35,0,0,0,114, + 175,0,0,0,114,159,0,0,0,114,1,1,0,0,114,4, + 0,0,0,114,4,0,0,0,114,5,0,0,0,114,176,0, + 0,0,111,4,0,0,115,26,0,0,0,0,4,8,1,6, + 1,14,1,8,1,6,1,10,1,6,1,4,3,6,1,16, + 1,6,2,6,2,122,20,80,97,116,104,70,105,110,100,101, + 114,46,102,105,110,100,95,115,112,101,99,99,3,0,0,0, + 0,0,0,0,4,0,0,0,3,0,0,0,67,0,0,0, + 115,30,0,0,0,124,0,106,0,124,1,124,2,131,2,125, + 3,124,3,100,1,107,8,114,24,100,1,83,0,124,3,106, + 1,83,0,41,2,122,170,102,105,110,100,32,116,104,101,32, + 109,111,100,117,108,101,32,111,110,32,115,121,115,46,112,97, + 116,104,32,111,114,32,39,112,97,116,104,39,32,98,97,115, + 101,100,32,111,110,32,115,121,115,46,112,97,116,104,95,104, + 111,111,107,115,32,97,110,100,10,32,32,32,32,32,32,32, + 32,115,121,115,46,112,97,116,104,95,105,109,112,111,114,116, + 101,114,95,99,97,99,104,101,46,10,10,32,32,32,32,32, + 32,32,32,84,104,105,115,32,109,101,116,104,111,100,32,105, + 115,32,100,101,112,114,101,99,97,116,101,100,46,32,32,85, + 115,101,32,102,105,110,100,95,115,112,101,99,40,41,32,105, + 110,115,116,101,97,100,46,10,10,32,32,32,32,32,32,32, + 32,78,41,2,114,176,0,0,0,114,121,0,0,0,41,4, + 114,165,0,0,0,114,120,0,0,0,114,35,0,0,0,114, + 159,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, + 0,0,0,114,177,0,0,0,133,4,0,0,115,8,0,0, + 0,0,8,12,1,8,1,4,1,122,22,80,97,116,104,70, + 105,110,100,101,114,46,102,105,110,100,95,109,111,100,117,108, + 101,41,1,78,41,2,78,78,41,1,78,41,12,114,106,0, + 0,0,114,105,0,0,0,114,107,0,0,0,114,108,0,0, + 0,114,178,0,0,0,114,247,0,0,0,114,252,0,0,0, + 114,254,0,0,0,114,255,0,0,0,114,2,1,0,0,114, + 176,0,0,0,114,177,0,0,0,114,4,0,0,0,114,4, + 0,0,0,114,4,0,0,0,114,5,0,0,0,114,246,0, + 0,0,13,4,0,0,115,22,0,0,0,8,2,4,2,12, + 8,12,17,12,22,12,15,2,1,12,31,2,1,12,21,2, + 1,114,246,0,0,0,99,0,0,0,0,0,0,0,0,0, + 0,0,0,3,0,0,0,64,0,0,0,115,90,0,0,0, + 101,0,90,1,100,0,90,2,100,1,90,3,100,2,100,3, + 132,0,90,4,100,4,100,5,132,0,90,5,101,6,90,7, + 100,6,100,7,132,0,90,8,100,8,100,9,132,0,90,9, + 100,19,100,11,100,12,132,1,90,10,100,13,100,14,132,0, + 90,11,101,12,100,15,100,16,132,0,131,1,90,13,100,17, + 100,18,132,0,90,14,100,10,83,0,41,20,218,10,70,105, + 108,101,70,105,110,100,101,114,122,172,70,105,108,101,45,98, + 97,115,101,100,32,102,105,110,100,101,114,46,10,10,32,32, + 32,32,73,110,116,101,114,97,99,116,105,111,110,115,32,119, + 105,116,104,32,116,104,101,32,102,105,108,101,32,115,121,115, + 116,101,109,32,97,114,101,32,99,97,99,104,101,100,32,102, + 111,114,32,112,101,114,102,111,114,109,97,110,99,101,44,32, + 98,101,105,110,103,10,32,32,32,32,114,101,102,114,101,115, + 104,101,100,32,119,104,101,110,32,116,104,101,32,100,105,114, + 101,99,116,111,114,121,32,116,104,101,32,102,105,110,100,101, + 114,32,105,115,32,104,97,110,100,108,105,110,103,32,104,97, + 115,32,98,101,101,110,32,109,111,100,105,102,105,101,100,46, + 10,10,32,32,32,32,99,2,0,0,0,0,0,0,0,5, + 0,0,0,5,0,0,0,7,0,0,0,115,88,0,0,0, + 103,0,125,3,120,40,124,2,68,0,93,32,92,2,137,0, + 125,4,124,3,106,0,135,0,102,1,100,1,100,2,132,8, + 124,4,68,0,131,1,131,1,1,0,113,10,87,0,124,3, + 124,0,95,1,124,1,112,58,100,3,124,0,95,2,100,6, + 124,0,95,3,116,4,131,0,124,0,95,5,116,4,131,0, + 124,0,95,6,100,5,83,0,41,7,122,154,73,110,105,116, + 105,97,108,105,122,101,32,119,105,116,104,32,116,104,101,32, + 112,97,116,104,32,116,111,32,115,101,97,114,99,104,32,111, + 110,32,97,110,100,32,97,32,118,97,114,105,97,98,108,101, + 32,110,117,109,98,101,114,32,111,102,10,32,32,32,32,32, + 32,32,32,50,45,116,117,112,108,101,115,32,99,111,110,116, + 97,105,110,105,110,103,32,116,104,101,32,108,111,97,100,101, + 114,32,97,110,100,32,116,104,101,32,102,105,108,101,32,115, + 117,102,102,105,120,101,115,32,116,104,101,32,108,111,97,100, + 101,114,10,32,32,32,32,32,32,32,32,114,101,99,111,103, + 110,105,122,101,115,46,99,1,0,0,0,0,0,0,0,2, + 0,0,0,3,0,0,0,51,0,0,0,115,22,0,0,0, + 124,0,93,14,125,1,124,1,136,0,102,2,86,0,1,0, + 113,2,100,0,83,0,41,1,78,114,4,0,0,0,41,2, + 114,22,0,0,0,114,220,0,0,0,41,1,114,121,0,0, + 0,114,4,0,0,0,114,5,0,0,0,114,222,0,0,0, + 162,4,0,0,115,2,0,0,0,4,0,122,38,70,105,108, + 101,70,105,110,100,101,114,46,95,95,105,110,105,116,95,95, + 46,60,108,111,99,97,108,115,62,46,60,103,101,110,101,120, + 112,114,62,114,59,0,0,0,114,29,0,0,0,78,114,88, + 0,0,0,41,7,114,144,0,0,0,218,8,95,108,111,97, + 100,101,114,115,114,35,0,0,0,218,11,95,112,97,116,104, + 95,109,116,105,109,101,218,3,115,101,116,218,11,95,112,97, + 116,104,95,99,97,99,104,101,218,19,95,114,101,108,97,120, + 101,100,95,112,97,116,104,95,99,97,99,104,101,41,5,114, + 101,0,0,0,114,35,0,0,0,218,14,108,111,97,100,101, + 114,95,100,101,116,97,105,108,115,90,7,108,111,97,100,101, + 114,115,114,161,0,0,0,114,4,0,0,0,41,1,114,121, + 0,0,0,114,5,0,0,0,114,180,0,0,0,156,4,0, + 0,115,16,0,0,0,0,4,4,1,14,1,28,1,6,2, + 10,1,6,1,8,1,122,19,70,105,108,101,70,105,110,100, + 101,114,46,95,95,105,110,105,116,95,95,99,1,0,0,0, + 0,0,0,0,1,0,0,0,2,0,0,0,67,0,0,0, + 115,10,0,0,0,100,3,124,0,95,0,100,2,83,0,41, + 4,122,31,73,110,118,97,108,105,100,97,116,101,32,116,104, + 101,32,100,105,114,101,99,116,111,114,121,32,109,116,105,109, + 101,46,114,29,0,0,0,78,114,88,0,0,0,41,1,114, + 5,1,0,0,41,1,114,101,0,0,0,114,4,0,0,0, + 114,4,0,0,0,114,5,0,0,0,114,247,0,0,0,170, + 4,0,0,115,2,0,0,0,0,2,122,28,70,105,108,101, + 70,105,110,100,101,114,46,105,110,118,97,108,105,100,97,116, + 101,95,99,97,99,104,101,115,99,2,0,0,0,0,0,0, + 0,3,0,0,0,2,0,0,0,67,0,0,0,115,42,0, + 0,0,124,0,106,0,124,1,131,1,125,2,124,2,100,1, + 107,8,114,26,100,1,103,0,102,2,83,0,124,2,106,1, + 124,2,106,2,112,38,103,0,102,2,83,0,41,2,122,197, + 84,114,121,32,116,111,32,102,105,110,100,32,97,32,108,111, + 97,100,101,114,32,102,111,114,32,116,104,101,32,115,112,101, + 99,105,102,105,101,100,32,109,111,100,117,108,101,44,32,111, + 114,32,116,104,101,32,110,97,109,101,115,112,97,99,101,10, + 32,32,32,32,32,32,32,32,112,97,99,107,97,103,101,32, + 112,111,114,116,105,111,110,115,46,32,82,101,116,117,114,110, + 115,32,40,108,111,97,100,101,114,44,32,108,105,115,116,45, + 111,102,45,112,111,114,116,105,111,110,115,41,46,10,10,32, + 32,32,32,32,32,32,32,84,104,105,115,32,109,101,116,104, + 111,100,32,105,115,32,100,101,112,114,101,99,97,116,101,100, + 46,32,32,85,115,101,32,102,105,110,100,95,115,112,101,99, + 40,41,32,105,110,115,116,101,97,100,46,10,10,32,32,32, + 32,32,32,32,32,78,41,3,114,176,0,0,0,114,121,0, + 0,0,114,151,0,0,0,41,3,114,101,0,0,0,114,120, + 0,0,0,114,159,0,0,0,114,4,0,0,0,114,4,0, + 0,0,114,5,0,0,0,114,118,0,0,0,176,4,0,0, + 115,8,0,0,0,0,7,10,1,8,1,8,1,122,22,70, + 105,108,101,70,105,110,100,101,114,46,102,105,110,100,95,108, + 111,97,100,101,114,99,6,0,0,0,0,0,0,0,7,0, + 0,0,7,0,0,0,67,0,0,0,115,30,0,0,0,124, + 1,124,2,124,3,131,2,125,6,116,0,124,2,124,3,100, + 1,124,6,100,2,124,4,144,2,131,2,83,0,41,3,78, + 114,121,0,0,0,114,151,0,0,0,41,1,114,162,0,0, + 0,41,7,114,101,0,0,0,114,160,0,0,0,114,120,0, + 0,0,114,35,0,0,0,90,4,115,109,115,108,114,175,0, + 0,0,114,121,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,5,0,0,0,114,2,1,0,0,188,4,0,0,115, + 6,0,0,0,0,1,10,1,12,1,122,20,70,105,108,101, + 70,105,110,100,101,114,46,95,103,101,116,95,115,112,101,99, + 78,99,3,0,0,0,0,0,0,0,14,0,0,0,15,0, + 0,0,67,0,0,0,115,100,1,0,0,100,1,125,3,124, + 1,106,0,100,2,131,1,100,3,25,0,125,4,121,24,116, + 1,124,0,106,2,112,34,116,3,106,4,131,0,131,1,106, + 5,125,5,87,0,110,24,4,0,116,6,107,10,114,66,1, + 0,1,0,1,0,100,10,125,5,89,0,110,2,88,0,124, + 5,124,0,106,7,107,3,114,92,124,0,106,8,131,0,1, + 0,124,5,124,0,95,7,116,9,131,0,114,114,124,0,106, + 10,125,6,124,4,106,11,131,0,125,7,110,10,124,0,106, + 12,125,6,124,4,125,7,124,7,124,6,107,6,114,218,116, + 13,124,0,106,2,124,4,131,2,125,8,120,72,124,0,106, + 14,68,0,93,54,92,2,125,9,125,10,100,5,124,9,23, + 0,125,11,116,13,124,8,124,11,131,2,125,12,116,15,124, + 12,131,1,114,152,124,0,106,16,124,10,124,1,124,12,124, + 8,103,1,124,2,131,5,83,0,113,152,87,0,116,17,124, + 8,131,1,125,3,120,90,124,0,106,14,68,0,93,80,92, + 2,125,9,125,10,116,13,124,0,106,2,124,4,124,9,23, + 0,131,2,125,12,116,18,106,19,100,6,124,12,100,7,100, + 3,144,1,131,2,1,0,124,7,124,9,23,0,124,6,107, + 6,114,226,116,15,124,12,131,1,114,226,124,0,106,16,124, + 10,124,1,124,12,100,8,124,2,131,5,83,0,113,226,87, + 0,124,3,144,1,114,96,116,18,106,19,100,9,124,8,131, + 2,1,0,116,18,106,20,124,1,100,8,131,2,125,13,124, + 8,103,1,124,13,95,21,124,13,83,0,100,8,83,0,41, + 11,122,102,84,114,121,32,116,111,32,102,105,110,100,32,97, + 32,115,112,101,99,32,102,111,114,32,116,104,101,32,115,112, + 101,99,105,102,105,101,100,32,109,111,100,117,108,101,46,32, + 32,82,101,116,117,114,110,115,32,116,104,101,10,32,32,32, + 32,32,32,32,32,109,97,116,99,104,105,110,103,32,115,112, + 101,99,44,32,111,114,32,78,111,110,101,32,105,102,32,110, + 111,116,32,102,111,117,110,100,46,70,114,59,0,0,0,114, + 57,0,0,0,114,29,0,0,0,114,180,0,0,0,122,9, + 116,114,121,105,110,103,32,123,125,90,9,118,101,114,98,111, + 115,105,116,121,78,122,25,112,111,115,115,105,98,108,101,32, + 110,97,109,101,115,112,97,99,101,32,102,111,114,32,123,125, + 114,88,0,0,0,41,22,114,32,0,0,0,114,39,0,0, + 0,114,35,0,0,0,114,3,0,0,0,114,45,0,0,0, + 114,214,0,0,0,114,40,0,0,0,114,5,1,0,0,218, + 11,95,102,105,108,108,95,99,97,99,104,101,114,6,0,0, + 0,114,8,1,0,0,114,89,0,0,0,114,7,1,0,0, + 114,28,0,0,0,114,4,1,0,0,114,44,0,0,0,114, + 2,1,0,0,114,46,0,0,0,114,115,0,0,0,114,130, + 0,0,0,114,155,0,0,0,114,151,0,0,0,41,14,114, + 101,0,0,0,114,120,0,0,0,114,175,0,0,0,90,12, + 105,115,95,110,97,109,101,115,112,97,99,101,90,11,116,97, + 105,108,95,109,111,100,117,108,101,114,127,0,0,0,90,5, + 99,97,99,104,101,90,12,99,97,99,104,101,95,109,111,100, + 117,108,101,90,9,98,97,115,101,95,112,97,116,104,114,220, + 0,0,0,114,160,0,0,0,90,13,105,110,105,116,95,102, + 105,108,101,110,97,109,101,90,9,102,117,108,108,95,112,97, + 116,104,114,159,0,0,0,114,4,0,0,0,114,4,0,0, + 0,114,5,0,0,0,114,176,0,0,0,193,4,0,0,115, + 70,0,0,0,0,3,4,1,14,1,2,1,24,1,14,1, + 10,1,10,1,8,1,6,2,6,1,6,1,10,2,6,1, + 4,2,8,1,12,1,16,1,8,1,10,1,8,1,24,4, + 8,2,16,1,16,1,18,1,12,1,8,1,10,1,12,1, + 6,1,12,1,12,1,8,1,4,1,122,20,70,105,108,101, + 70,105,110,100,101,114,46,102,105,110,100,95,115,112,101,99, + 99,1,0,0,0,0,0,0,0,9,0,0,0,13,0,0, + 0,67,0,0,0,115,194,0,0,0,124,0,106,0,125,1, + 121,22,116,1,106,2,124,1,112,22,116,1,106,3,131,0, + 131,1,125,2,87,0,110,30,4,0,116,4,116,5,116,6, + 102,3,107,10,114,58,1,0,1,0,1,0,103,0,125,2, + 89,0,110,2,88,0,116,7,106,8,106,9,100,1,131,1, + 115,84,116,10,124,2,131,1,124,0,95,11,110,78,116,10, + 131,0,125,3,120,64,124,2,68,0,93,56,125,4,124,4, + 106,12,100,2,131,1,92,3,125,5,125,6,125,7,124,6, + 114,138,100,3,106,13,124,5,124,7,106,14,131,0,131,2, + 125,8,110,4,124,5,125,8,124,3,106,15,124,8,131,1, + 1,0,113,96,87,0,124,3,124,0,95,11,116,7,106,8, + 106,9,116,16,131,1,114,190,100,4,100,5,132,0,124,2, + 68,0,131,1,124,0,95,17,100,6,83,0,41,7,122,68, + 70,105,108,108,32,116,104,101,32,99,97,99,104,101,32,111, + 102,32,112,111,116,101,110,116,105,97,108,32,109,111,100,117, + 108,101,115,32,97,110,100,32,112,97,99,107,97,103,101,115, + 32,102,111,114,32,116,104,105,115,32,100,105,114,101,99,116, + 111,114,121,46,114,0,0,0,0,114,59,0,0,0,122,5, + 123,125,46,123,125,99,1,0,0,0,0,0,0,0,2,0, + 0,0,3,0,0,0,83,0,0,0,115,20,0,0,0,104, + 0,124,0,93,12,125,1,124,1,106,0,131,0,146,2,113, + 4,83,0,114,4,0,0,0,41,1,114,89,0,0,0,41, + 2,114,22,0,0,0,90,2,102,110,114,4,0,0,0,114, + 4,0,0,0,114,5,0,0,0,250,9,60,115,101,116,99, + 111,109,112,62,12,5,0,0,115,2,0,0,0,6,0,122, + 41,70,105,108,101,70,105,110,100,101,114,46,95,102,105,108, + 108,95,99,97,99,104,101,46,60,108,111,99,97,108,115,62, + 46,60,115,101,116,99,111,109,112,62,78,41,18,114,35,0, + 0,0,114,3,0,0,0,90,7,108,105,115,116,100,105,114, + 114,45,0,0,0,114,253,0,0,0,218,15,80,101,114,109, + 105,115,115,105,111,110,69,114,114,111,114,218,18,78,111,116, + 65,68,105,114,101,99,116,111,114,121,69,114,114,111,114,114, + 7,0,0,0,114,8,0,0,0,114,9,0,0,0,114,6, + 1,0,0,114,7,1,0,0,114,84,0,0,0,114,48,0, + 0,0,114,89,0,0,0,218,3,97,100,100,114,10,0,0, + 0,114,8,1,0,0,41,9,114,101,0,0,0,114,35,0, + 0,0,90,8,99,111,110,116,101,110,116,115,90,21,108,111, + 119,101,114,95,115,117,102,102,105,120,95,99,111,110,116,101, + 110,116,115,114,242,0,0,0,114,99,0,0,0,114,232,0, + 0,0,114,220,0,0,0,90,8,110,101,119,95,110,97,109, + 101,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, + 114,10,1,0,0,239,4,0,0,115,34,0,0,0,0,2, + 6,1,2,1,22,1,20,3,10,3,12,1,12,7,6,1, + 10,1,16,1,4,1,18,2,4,1,14,1,6,1,12,1, + 122,22,70,105,108,101,70,105,110,100,101,114,46,95,102,105, + 108,108,95,99,97,99,104,101,99,1,0,0,0,0,0,0, + 0,3,0,0,0,3,0,0,0,7,0,0,0,115,18,0, + 0,0,135,0,135,1,102,2,100,1,100,2,132,8,125,2, + 124,2,83,0,41,3,97,20,1,0,0,65,32,99,108,97, + 115,115,32,109,101,116,104,111,100,32,119,104,105,99,104,32, + 114,101,116,117,114,110,115,32,97,32,99,108,111,115,117,114, + 101,32,116,111,32,117,115,101,32,111,110,32,115,121,115,46, + 112,97,116,104,95,104,111,111,107,10,32,32,32,32,32,32, + 32,32,119,104,105,99,104,32,119,105,108,108,32,114,101,116, + 117,114,110,32,97,110,32,105,110,115,116,97,110,99,101,32, + 117,115,105,110,103,32,116,104,101,32,115,112,101,99,105,102, + 105,101,100,32,108,111,97,100,101,114,115,32,97,110,100,32, + 116,104,101,32,112,97,116,104,10,32,32,32,32,32,32,32, + 32,99,97,108,108,101,100,32,111,110,32,116,104,101,32,99, + 108,111,115,117,114,101,46,10,10,32,32,32,32,32,32,32, + 32,73,102,32,116,104,101,32,112,97,116,104,32,99,97,108, + 108,101,100,32,111,110,32,116,104,101,32,99,108,111,115,117, + 114,101,32,105,115,32,110,111,116,32,97,32,100,105,114,101, + 99,116,111,114,121,44,32,73,109,112,111,114,116,69,114,114, + 111,114,32,105,115,10,32,32,32,32,32,32,32,32,114,97, + 105,115,101,100,46,10,10,32,32,32,32,32,32,32,32,99, + 1,0,0,0,0,0,0,0,1,0,0,0,4,0,0,0, + 19,0,0,0,115,32,0,0,0,116,0,124,0,131,1,115, + 22,116,1,100,1,100,2,124,0,144,1,131,1,130,1,136, + 0,124,0,136,1,140,1,83,0,41,3,122,45,80,97,116, + 104,32,104,111,111,107,32,102,111,114,32,105,109,112,111,114, + 116,108,105,98,46,109,97,99,104,105,110,101,114,121,46,70, + 105,108,101,70,105,110,100,101,114,46,122,30,111,110,108,121, + 32,100,105,114,101,99,116,111,114,105,101,115,32,97,114,101, + 32,115,117,112,112,111,114,116,101,100,114,35,0,0,0,41, + 2,114,46,0,0,0,114,100,0,0,0,41,1,114,35,0, + 0,0,41,2,114,165,0,0,0,114,9,1,0,0,114,4, + 0,0,0,114,5,0,0,0,218,24,112,97,116,104,95,104, + 111,111,107,95,102,111,114,95,70,105,108,101,70,105,110,100, + 101,114,24,5,0,0,115,6,0,0,0,0,2,8,1,14, + 1,122,54,70,105,108,101,70,105,110,100,101,114,46,112,97, + 116,104,95,104,111,111,107,46,60,108,111,99,97,108,115,62, + 46,112,97,116,104,95,104,111,111,107,95,102,111,114,95,70, + 105,108,101,70,105,110,100,101,114,114,4,0,0,0,41,3, + 114,165,0,0,0,114,9,1,0,0,114,15,1,0,0,114, + 4,0,0,0,41,2,114,165,0,0,0,114,9,1,0,0, + 114,5,0,0,0,218,9,112,97,116,104,95,104,111,111,107, + 14,5,0,0,115,4,0,0,0,0,10,14,6,122,20,70, + 105,108,101,70,105,110,100,101,114,46,112,97,116,104,95,104, + 111,111,107,99,1,0,0,0,0,0,0,0,1,0,0,0, + 2,0,0,0,67,0,0,0,115,12,0,0,0,100,1,106, + 0,124,0,106,1,131,1,83,0,41,2,78,122,16,70,105, + 108,101,70,105,110,100,101,114,40,123,33,114,125,41,41,2, + 114,48,0,0,0,114,35,0,0,0,41,1,114,101,0,0, + 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, + 114,241,0,0,0,32,5,0,0,115,2,0,0,0,0,1, + 122,19,70,105,108,101,70,105,110,100,101,114,46,95,95,114, + 101,112,114,95,95,41,1,78,41,15,114,106,0,0,0,114, + 105,0,0,0,114,107,0,0,0,114,108,0,0,0,114,180, + 0,0,0,114,247,0,0,0,114,124,0,0,0,114,177,0, + 0,0,114,118,0,0,0,114,2,1,0,0,114,176,0,0, + 0,114,10,1,0,0,114,178,0,0,0,114,16,1,0,0, + 114,241,0,0,0,114,4,0,0,0,114,4,0,0,0,114, + 4,0,0,0,114,5,0,0,0,114,3,1,0,0,147,4, + 0,0,115,20,0,0,0,8,7,4,2,8,14,8,4,4, + 2,8,12,8,5,10,46,8,31,12,18,114,3,1,0,0, + 99,4,0,0,0,0,0,0,0,6,0,0,0,11,0,0, + 0,67,0,0,0,115,148,0,0,0,124,0,106,0,100,1, + 131,1,125,4,124,0,106,0,100,2,131,1,125,5,124,4, + 115,66,124,5,114,36,124,5,106,1,125,4,110,30,124,2, + 124,3,107,2,114,56,116,2,124,1,124,2,131,2,125,4, + 110,10,116,3,124,1,124,2,131,2,125,4,124,5,115,86, + 116,4,124,1,124,2,100,3,124,4,144,1,131,2,125,5, + 121,36,124,5,124,0,100,2,60,0,124,4,124,0,100,1, + 60,0,124,2,124,0,100,4,60,0,124,3,124,0,100,5, + 60,0,87,0,110,20,4,0,116,5,107,10,114,142,1,0, + 1,0,1,0,89,0,110,2,88,0,100,0,83,0,41,6, + 78,218,10,95,95,108,111,97,100,101,114,95,95,218,8,95, + 95,115,112,101,99,95,95,114,121,0,0,0,90,8,95,95, + 102,105,108,101,95,95,90,10,95,95,99,97,99,104,101,100, + 95,95,41,6,218,3,103,101,116,114,121,0,0,0,114,218, + 0,0,0,114,213,0,0,0,114,162,0,0,0,218,9,69, + 120,99,101,112,116,105,111,110,41,6,90,2,110,115,114,99, + 0,0,0,90,8,112,97,116,104,110,97,109,101,90,9,99, + 112,97,116,104,110,97,109,101,114,121,0,0,0,114,159,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, + 0,218,14,95,102,105,120,95,117,112,95,109,111,100,117,108, + 101,38,5,0,0,115,34,0,0,0,0,2,10,1,10,1, + 4,1,4,1,8,1,8,1,12,2,10,1,4,1,16,1, + 2,1,8,1,8,1,8,1,12,1,14,2,114,21,1,0, + 0,99,0,0,0,0,0,0,0,0,3,0,0,0,3,0, + 0,0,67,0,0,0,115,38,0,0,0,116,0,116,1,106, + 2,131,0,102,2,125,0,116,3,116,4,102,2,125,1,116, + 5,116,6,102,2,125,2,124,0,124,1,124,2,103,3,83, + 0,41,1,122,95,82,101,116,117,114,110,115,32,97,32,108, + 105,115,116,32,111,102,32,102,105,108,101,45,98,97,115,101, + 100,32,109,111,100,117,108,101,32,108,111,97,100,101,114,115, + 46,10,10,32,32,32,32,69,97,99,104,32,105,116,101,109, + 32,105,115,32,97,32,116,117,112,108,101,32,40,108,111,97, + 100,101,114,44,32,115,117,102,102,105,120,101,115,41,46,10, + 32,32,32,32,41,7,114,219,0,0,0,114,140,0,0,0, + 218,18,101,120,116,101,110,115,105,111,110,95,115,117,102,102, + 105,120,101,115,114,213,0,0,0,114,85,0,0,0,114,218, + 0,0,0,114,75,0,0,0,41,3,90,10,101,120,116,101, + 110,115,105,111,110,115,90,6,115,111,117,114,99,101,90,8, + 98,121,116,101,99,111,100,101,114,4,0,0,0,114,4,0, + 0,0,114,5,0,0,0,114,156,0,0,0,61,5,0,0, + 115,8,0,0,0,0,5,12,1,8,1,8,1,114,156,0, + 0,0,99,1,0,0,0,0,0,0,0,12,0,0,0,12, + 0,0,0,67,0,0,0,115,188,1,0,0,124,0,97,0, + 116,0,106,1,97,1,116,0,106,2,97,2,116,1,106,3, + 116,4,25,0,125,1,120,56,100,26,68,0,93,48,125,2, + 124,2,116,1,106,3,107,7,114,58,116,0,106,5,124,2, + 131,1,125,3,110,10,116,1,106,3,124,2,25,0,125,3, + 116,6,124,1,124,2,124,3,131,3,1,0,113,32,87,0, + 100,5,100,6,103,1,102,2,100,7,100,8,100,6,103,2, + 102,2,102,2,125,4,120,118,124,4,68,0,93,102,92,2, + 125,5,125,6,116,7,100,9,100,10,132,0,124,6,68,0, + 131,1,131,1,115,142,116,8,130,1,124,6,100,11,25,0, + 125,7,124,5,116,1,106,3,107,6,114,174,116,1,106,3, + 124,5,25,0,125,8,80,0,113,112,121,16,116,0,106,5, + 124,5,131,1,125,8,80,0,87,0,113,112,4,0,116,9, + 107,10,114,212,1,0,1,0,1,0,119,112,89,0,113,112, + 88,0,113,112,87,0,116,9,100,12,131,1,130,1,116,6, + 124,1,100,13,124,8,131,3,1,0,116,6,124,1,100,14, + 124,7,131,3,1,0,116,6,124,1,100,15,100,16,106,10, + 124,6,131,1,131,3,1,0,121,14,116,0,106,5,100,17, + 131,1,125,9,87,0,110,26,4,0,116,9,107,10,144,1, + 114,52,1,0,1,0,1,0,100,18,125,9,89,0,110,2, + 88,0,116,6,124,1,100,17,124,9,131,3,1,0,116,0, + 106,5,100,19,131,1,125,10,116,6,124,1,100,19,124,10, + 131,3,1,0,124,5,100,7,107,2,144,1,114,120,116,0, + 106,5,100,20,131,1,125,11,116,6,124,1,100,21,124,11, + 131,3,1,0,116,6,124,1,100,22,116,11,131,0,131,3, + 1,0,116,12,106,13,116,2,106,14,131,0,131,1,1,0, + 124,5,100,7,107,2,144,1,114,184,116,15,106,16,100,23, + 131,1,1,0,100,24,116,12,107,6,144,1,114,184,100,25, + 116,17,95,18,100,18,83,0,41,27,122,205,83,101,116,117, + 112,32,116,104,101,32,112,97,116,104,45,98,97,115,101,100, + 32,105,109,112,111,114,116,101,114,115,32,102,111,114,32,105, + 109,112,111,114,116,108,105,98,32,98,121,32,105,109,112,111, + 114,116,105,110,103,32,110,101,101,100,101,100,10,32,32,32, + 32,98,117,105,108,116,45,105,110,32,109,111,100,117,108,101, + 115,32,97,110,100,32,105,110,106,101,99,116,105,110,103,32, + 116,104,101,109,32,105,110,116,111,32,116,104,101,32,103,108, + 111,98,97,108,32,110,97,109,101,115,112,97,99,101,46,10, + 10,32,32,32,32,79,116,104,101,114,32,99,111,109,112,111, + 110,101,110,116,115,32,97,114,101,32,101,120,116,114,97,99, + 116,101,100,32,102,114,111,109,32,116,104,101,32,99,111,114, + 101,32,98,111,111,116,115,116,114,97,112,32,109,111,100,117, + 108,101,46,10,10,32,32,32,32,114,50,0,0,0,114,61, + 0,0,0,218,8,98,117,105,108,116,105,110,115,114,137,0, + 0,0,90,5,112,111,115,105,120,250,1,47,218,2,110,116, + 250,1,92,99,1,0,0,0,0,0,0,0,2,0,0,0, + 3,0,0,0,115,0,0,0,115,26,0,0,0,124,0,93, + 18,125,1,116,0,124,1,131,1,100,0,107,2,86,0,1, + 0,113,2,100,1,83,0,41,2,114,29,0,0,0,78,41, + 1,114,31,0,0,0,41,2,114,22,0,0,0,114,78,0, + 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, + 0,114,222,0,0,0,97,5,0,0,115,2,0,0,0,4, + 0,122,25,95,115,101,116,117,112,46,60,108,111,99,97,108, + 115,62,46,60,103,101,110,101,120,112,114,62,114,60,0,0, + 0,122,30,105,109,112,111,114,116,108,105,98,32,114,101,113, + 117,105,114,101,115,32,112,111,115,105,120,32,111,114,32,110, + 116,114,3,0,0,0,114,25,0,0,0,114,21,0,0,0, + 114,30,0,0,0,90,7,95,116,104,114,101,97,100,78,90, + 8,95,119,101,97,107,114,101,102,90,6,119,105,110,114,101, + 103,114,164,0,0,0,114,6,0,0,0,122,4,46,112,121, + 119,122,6,95,100,46,112,121,100,84,41,4,122,3,95,105, + 111,122,9,95,119,97,114,110,105,110,103,115,122,8,98,117, + 105,108,116,105,110,115,122,7,109,97,114,115,104,97,108,41, + 19,114,115,0,0,0,114,7,0,0,0,114,140,0,0,0, + 114,234,0,0,0,114,106,0,0,0,90,18,95,98,117,105, + 108,116,105,110,95,102,114,111,109,95,110,97,109,101,114,110, + 0,0,0,218,3,97,108,108,218,14,65,115,115,101,114,116, + 105,111,110,69,114,114,111,114,114,100,0,0,0,114,26,0, + 0,0,114,11,0,0,0,114,224,0,0,0,114,144,0,0, + 0,114,22,1,0,0,114,85,0,0,0,114,158,0,0,0, + 114,163,0,0,0,114,168,0,0,0,41,12,218,17,95,98, + 111,111,116,115,116,114,97,112,95,109,111,100,117,108,101,90, + 11,115,101,108,102,95,109,111,100,117,108,101,90,12,98,117, + 105,108,116,105,110,95,110,97,109,101,90,14,98,117,105,108, + 116,105,110,95,109,111,100,117,108,101,90,10,111,115,95,100, + 101,116,97,105,108,115,90,10,98,117,105,108,116,105,110,95, + 111,115,114,21,0,0,0,114,25,0,0,0,90,9,111,115, + 95,109,111,100,117,108,101,90,13,116,104,114,101,97,100,95, + 109,111,100,117,108,101,90,14,119,101,97,107,114,101,102,95, + 109,111,100,117,108,101,90,13,119,105,110,114,101,103,95,109, + 111,100,117,108,101,114,4,0,0,0,114,4,0,0,0,114, + 5,0,0,0,218,6,95,115,101,116,117,112,72,5,0,0, + 115,82,0,0,0,0,8,4,1,6,1,6,3,10,1,10, + 1,10,1,12,2,10,1,16,3,22,1,14,2,22,1,8, + 1,10,1,10,1,4,2,2,1,10,1,6,1,14,1,12, + 2,8,1,12,1,12,1,18,3,2,1,14,1,16,2,10, + 1,12,3,10,1,12,3,10,1,10,1,12,3,14,1,14, + 1,10,1,10,1,10,1,114,30,1,0,0,99,1,0,0, 0,0,0,0,0,2,0,0,0,3,0,0,0,67,0,0, - 0,115,26,0,0,0,116,0,106,1,100,1,124,0,106,2, - 131,2,1,0,116,0,106,3,124,0,124,1,131,2,83,0, - 41,2,122,98,76,111,97,100,32,97,32,110,97,109,101,115, - 112,97,99,101,32,109,111,100,117,108,101,46,10,10,32,32, - 32,32,32,32,32,32,84,104,105,115,32,109,101,116,104,111, - 100,32,105,115,32,100,101,112,114,101,99,97,116,101,100,46, - 32,32,85,115,101,32,101,120,101,99,95,109,111,100,117,108, - 101,40,41,32,105,110,115,116,101,97,100,46,10,10,32,32, - 32,32,32,32,32,32,122,38,110,97,109,101,115,112,97,99, - 101,32,109,111,100,117,108,101,32,108,111,97,100,101,100,32, - 119,105,116,104,32,112,97,116,104,32,123,33,114,125,41,4, - 114,114,0,0,0,114,129,0,0,0,114,226,0,0,0,114, - 186,0,0,0,41,2,114,100,0,0,0,114,119,0,0,0, - 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 187,0,0,0,253,3,0,0,115,6,0,0,0,0,7,6, - 1,8,1,122,28,95,78,97,109,101,115,112,97,99,101,76, - 111,97,100,101,114,46,108,111,97,100,95,109,111,100,117,108, - 101,78,41,12,114,105,0,0,0,114,104,0,0,0,114,106, - 0,0,0,114,179,0,0,0,114,177,0,0,0,114,244,0, - 0,0,114,153,0,0,0,114,196,0,0,0,114,181,0,0, - 0,114,180,0,0,0,114,185,0,0,0,114,187,0,0,0, + 0,115,84,0,0,0,116,0,124,0,131,1,1,0,116,1, + 131,0,125,1,116,2,106,3,106,4,116,5,106,6,124,1, + 140,0,103,1,131,1,1,0,116,7,106,8,100,1,107,2, + 114,56,116,2,106,9,106,10,116,11,131,1,1,0,116,2, + 106,9,106,10,116,12,131,1,1,0,116,5,124,0,95,5, + 116,13,124,0,95,13,100,2,83,0,41,3,122,41,73,110, + 115,116,97,108,108,32,116,104,101,32,112,97,116,104,45,98, + 97,115,101,100,32,105,109,112,111,114,116,32,99,111,109,112, + 111,110,101,110,116,115,46,114,25,1,0,0,78,41,14,114, + 30,1,0,0,114,156,0,0,0,114,7,0,0,0,114,251, + 0,0,0,114,144,0,0,0,114,3,1,0,0,114,16,1, + 0,0,114,3,0,0,0,114,106,0,0,0,218,9,109,101, + 116,97,95,112,97,116,104,114,158,0,0,0,114,163,0,0, + 0,114,246,0,0,0,114,213,0,0,0,41,2,114,29,1, + 0,0,90,17,115,117,112,112,111,114,116,101,100,95,108,111, + 97,100,101,114,115,114,4,0,0,0,114,4,0,0,0,114, + 5,0,0,0,218,8,95,105,110,115,116,97,108,108,140,5, + 0,0,115,16,0,0,0,0,2,8,1,6,1,20,1,10, + 1,12,1,12,4,6,1,114,32,1,0,0,41,3,122,3, + 119,105,110,114,1,0,0,0,114,2,0,0,0,41,1,114, + 47,0,0,0,41,1,78,41,3,78,78,78,41,3,78,78, + 78,41,2,114,60,0,0,0,114,60,0,0,0,41,1,78, + 41,1,78,41,56,114,108,0,0,0,114,10,0,0,0,114, + 11,0,0,0,114,17,0,0,0,114,19,0,0,0,114,28, + 0,0,0,114,38,0,0,0,114,39,0,0,0,114,43,0, + 0,0,114,44,0,0,0,114,46,0,0,0,114,56,0,0, + 0,218,4,116,121,112,101,218,8,95,95,99,111,100,101,95, + 95,114,139,0,0,0,114,15,0,0,0,114,129,0,0,0, + 114,14,0,0,0,114,18,0,0,0,90,17,95,82,65,87, + 95,77,65,71,73,67,95,78,85,77,66,69,82,114,74,0, + 0,0,114,73,0,0,0,114,85,0,0,0,114,75,0,0, + 0,90,23,68,69,66,85,71,95,66,89,84,69,67,79,68, + 69,95,83,85,70,70,73,88,69,83,90,27,79,80,84,73, + 77,73,90,69,68,95,66,89,84,69,67,79,68,69,95,83, + 85,70,70,73,88,69,83,114,80,0,0,0,114,86,0,0, + 0,114,92,0,0,0,114,96,0,0,0,114,98,0,0,0, + 114,117,0,0,0,114,124,0,0,0,114,136,0,0,0,114, + 142,0,0,0,114,145,0,0,0,114,150,0,0,0,218,6, + 111,98,106,101,99,116,114,157,0,0,0,114,162,0,0,0, + 114,163,0,0,0,114,179,0,0,0,114,189,0,0,0,114, + 205,0,0,0,114,213,0,0,0,114,218,0,0,0,114,224, + 0,0,0,114,219,0,0,0,114,225,0,0,0,114,244,0, + 0,0,114,246,0,0,0,114,3,1,0,0,114,21,1,0, + 0,114,156,0,0,0,114,30,1,0,0,114,32,1,0,0, 114,4,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,243,0,0,0,225,3,0,0,115,16,0, - 0,0,8,1,8,3,12,9,8,3,8,3,8,3,8,3, - 8,3,114,243,0,0,0,99,0,0,0,0,0,0,0,0, - 0,0,0,0,5,0,0,0,64,0,0,0,115,108,0,0, - 0,101,0,90,1,100,0,90,2,100,1,90,3,101,4,100, - 2,100,3,132,0,131,1,90,5,101,4,100,4,100,5,132, - 0,131,1,90,6,101,4,100,6,100,7,132,0,131,1,90, - 7,101,4,100,8,100,9,132,0,131,1,90,8,101,4,100, - 10,100,11,100,12,132,1,131,1,90,9,101,4,100,10,100, - 10,100,13,100,14,132,2,131,1,90,10,101,4,100,10,100, - 15,100,16,132,1,131,1,90,11,100,10,83,0,41,17,218, - 10,80,97,116,104,70,105,110,100,101,114,122,62,77,101,116, - 97,32,112,97,116,104,32,102,105,110,100,101,114,32,102,111, - 114,32,115,121,115,46,112,97,116,104,32,97,110,100,32,112, - 97,99,107,97,103,101,32,95,95,112,97,116,104,95,95,32, - 97,116,116,114,105,98,117,116,101,115,46,99,1,0,0,0, - 0,0,0,0,2,0,0,0,4,0,0,0,67,0,0,0, - 115,42,0,0,0,120,36,116,0,106,1,106,2,131,0,68, - 0,93,22,125,1,116,3,124,1,100,1,131,2,114,12,124, - 1,106,4,131,0,1,0,113,12,87,0,100,2,83,0,41, - 3,122,125,67,97,108,108,32,116,104,101,32,105,110,118,97, - 108,105,100,97,116,101,95,99,97,99,104,101,115,40,41,32, - 109,101,116,104,111,100,32,111,110,32,97,108,108,32,112,97, - 116,104,32,101,110,116,114,121,32,102,105,110,100,101,114,115, - 10,32,32,32,32,32,32,32,32,115,116,111,114,101,100,32, - 105,110,32,115,121,115,46,112,97,116,104,95,105,109,112,111, - 114,116,101,114,95,99,97,99,104,101,115,32,40,119,104,101, - 114,101,32,105,109,112,108,101,109,101,110,116,101,100,41,46, - 218,17,105,110,118,97,108,105,100,97,116,101,95,99,97,99, - 104,101,115,78,41,5,114,7,0,0,0,218,19,112,97,116, - 104,95,105,109,112,111,114,116,101,114,95,99,97,99,104,101, - 218,6,118,97,108,117,101,115,114,108,0,0,0,114,246,0, - 0,0,41,2,114,164,0,0,0,218,6,102,105,110,100,101, - 114,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,246,0,0,0,15,4,0,0,115,6,0,0,0,0,4, - 16,1,10,1,122,28,80,97,116,104,70,105,110,100,101,114, - 46,105,110,118,97,108,105,100,97,116,101,95,99,97,99,104, - 101,115,99,2,0,0,0,0,0,0,0,3,0,0,0,12, - 0,0,0,67,0,0,0,115,86,0,0,0,116,0,106,1, - 100,1,107,9,114,30,116,0,106,1,12,0,114,30,116,2, - 106,3,100,2,116,4,131,2,1,0,120,50,116,0,106,1, - 68,0,93,36,125,2,121,8,124,2,124,1,131,1,83,0, - 4,0,116,5,107,10,114,72,1,0,1,0,1,0,119,38, - 89,0,113,38,88,0,113,38,87,0,100,1,83,0,100,1, - 83,0,41,3,122,113,83,101,97,114,99,104,32,115,101,113, - 117,101,110,99,101,32,111,102,32,104,111,111,107,115,32,102, - 111,114,32,97,32,102,105,110,100,101,114,32,102,111,114,32, - 39,112,97,116,104,39,46,10,10,32,32,32,32,32,32,32, - 32,73,102,32,39,104,111,111,107,115,39,32,105,115,32,102, - 97,108,115,101,32,116,104,101,110,32,117,115,101,32,115,121, - 115,46,112,97,116,104,95,104,111,111,107,115,46,10,10,32, - 32,32,32,32,32,32,32,78,122,23,115,121,115,46,112,97, - 116,104,95,104,111,111,107,115,32,105,115,32,101,109,112,116, - 121,41,6,114,7,0,0,0,218,10,112,97,116,104,95,104, - 111,111,107,115,114,60,0,0,0,114,61,0,0,0,114,118, - 0,0,0,114,99,0,0,0,41,3,114,164,0,0,0,114, - 35,0,0,0,90,4,104,111,111,107,114,4,0,0,0,114, - 4,0,0,0,114,5,0,0,0,218,11,95,112,97,116,104, - 95,104,111,111,107,115,23,4,0,0,115,16,0,0,0,0, - 7,18,1,12,1,12,1,2,1,8,1,14,1,12,2,122, - 22,80,97,116,104,70,105,110,100,101,114,46,95,112,97,116, - 104,95,104,111,111,107,115,99,2,0,0,0,0,0,0,0, - 3,0,0,0,19,0,0,0,67,0,0,0,115,102,0,0, - 0,124,1,100,1,107,2,114,42,121,12,116,0,106,1,131, - 0,125,1,87,0,110,20,4,0,116,2,107,10,114,40,1, - 0,1,0,1,0,100,2,83,0,88,0,121,14,116,3,106, - 4,124,1,25,0,125,2,87,0,110,40,4,0,116,5,107, - 10,114,96,1,0,1,0,1,0,124,0,106,6,124,1,131, - 1,125,2,124,2,116,3,106,4,124,1,60,0,89,0,110, - 2,88,0,124,2,83,0,41,3,122,210,71,101,116,32,116, - 104,101,32,102,105,110,100,101,114,32,102,111,114,32,116,104, - 101,32,112,97,116,104,32,101,110,116,114,121,32,102,114,111, - 109,32,115,121,115,46,112,97,116,104,95,105,109,112,111,114, - 116,101,114,95,99,97,99,104,101,46,10,10,32,32,32,32, - 32,32,32,32,73,102,32,116,104,101,32,112,97,116,104,32, - 101,110,116,114,121,32,105,115,32,110,111,116,32,105,110,32, - 116,104,101,32,99,97,99,104,101,44,32,102,105,110,100,32, - 116,104,101,32,97,112,112,114,111,112,114,105,97,116,101,32, - 102,105,110,100,101,114,10,32,32,32,32,32,32,32,32,97, - 110,100,32,99,97,99,104,101,32,105,116,46,32,73,102,32, - 110,111,32,102,105,110,100,101,114,32,105,115,32,97,118,97, - 105,108,97,98,108,101,44,32,115,116,111,114,101,32,78,111, - 110,101,46,10,10,32,32,32,32,32,32,32,32,114,30,0, - 0,0,78,41,7,114,3,0,0,0,114,45,0,0,0,218, - 17,70,105,108,101,78,111,116,70,111,117,110,100,69,114,114, - 111,114,114,7,0,0,0,114,247,0,0,0,114,131,0,0, - 0,114,251,0,0,0,41,3,114,164,0,0,0,114,35,0, - 0,0,114,249,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,5,0,0,0,218,20,95,112,97,116,104,95,105,109, - 112,111,114,116,101,114,95,99,97,99,104,101,40,4,0,0, - 115,22,0,0,0,0,8,8,1,2,1,12,1,14,3,6, - 1,2,1,14,1,14,1,10,1,16,1,122,31,80,97,116, - 104,70,105,110,100,101,114,46,95,112,97,116,104,95,105,109, - 112,111,114,116,101,114,95,99,97,99,104,101,99,3,0,0, - 0,0,0,0,0,6,0,0,0,3,0,0,0,67,0,0, - 0,115,82,0,0,0,116,0,124,2,100,1,131,2,114,26, - 124,2,106,1,124,1,131,1,92,2,125,3,125,4,110,14, - 124,2,106,2,124,1,131,1,125,3,103,0,125,4,124,3, - 100,0,107,9,114,60,116,3,106,4,124,1,124,3,131,2, - 83,0,116,3,106,5,124,1,100,0,131,2,125,5,124,4, - 124,5,95,6,124,5,83,0,41,2,78,114,117,0,0,0, - 41,7,114,108,0,0,0,114,117,0,0,0,114,176,0,0, - 0,114,114,0,0,0,114,173,0,0,0,114,154,0,0,0, - 114,150,0,0,0,41,6,114,164,0,0,0,114,119,0,0, - 0,114,249,0,0,0,114,120,0,0,0,114,121,0,0,0, - 114,158,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,218,16,95,108,101,103,97,99,121,95,103,101, - 116,95,115,112,101,99,62,4,0,0,115,18,0,0,0,0, - 4,10,1,16,2,10,1,4,1,8,1,12,1,12,1,6, - 1,122,27,80,97,116,104,70,105,110,100,101,114,46,95,108, - 101,103,97,99,121,95,103,101,116,95,115,112,101,99,78,99, - 4,0,0,0,0,0,0,0,9,0,0,0,5,0,0,0, - 67,0,0,0,115,170,0,0,0,103,0,125,4,120,160,124, - 2,68,0,93,130,125,5,116,0,124,5,116,1,116,2,102, - 2,131,2,115,30,113,10,124,0,106,3,124,5,131,1,125, - 6,124,6,100,1,107,9,114,10,116,4,124,6,100,2,131, - 2,114,72,124,6,106,5,124,1,124,3,131,2,125,7,110, - 12,124,0,106,6,124,1,124,6,131,2,125,7,124,7,100, - 1,107,8,114,94,113,10,124,7,106,7,100,1,107,9,114, - 108,124,7,83,0,124,7,106,8,125,8,124,8,100,1,107, - 8,114,130,116,9,100,3,131,1,130,1,124,4,106,10,124, - 8,131,1,1,0,113,10,87,0,116,11,106,12,124,1,100, - 1,131,2,125,7,124,4,124,7,95,8,124,7,83,0,100, - 1,83,0,41,4,122,63,70,105,110,100,32,116,104,101,32, - 108,111,97,100,101,114,32,111,114,32,110,97,109,101,115,112, - 97,99,101,95,112,97,116,104,32,102,111,114,32,116,104,105, - 115,32,109,111,100,117,108,101,47,112,97,99,107,97,103,101, - 32,110,97,109,101,46,78,114,175,0,0,0,122,19,115,112, - 101,99,32,109,105,115,115,105,110,103,32,108,111,97,100,101, - 114,41,13,114,137,0,0,0,114,69,0,0,0,218,5,98, - 121,116,101,115,114,253,0,0,0,114,108,0,0,0,114,175, - 0,0,0,114,254,0,0,0,114,120,0,0,0,114,150,0, - 0,0,114,99,0,0,0,114,143,0,0,0,114,114,0,0, - 0,114,154,0,0,0,41,9,114,164,0,0,0,114,119,0, - 0,0,114,35,0,0,0,114,174,0,0,0,218,14,110,97, - 109,101,115,112,97,99,101,95,112,97,116,104,90,5,101,110, - 116,114,121,114,249,0,0,0,114,158,0,0,0,114,121,0, - 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,218,9,95,103,101,116,95,115,112,101,99,77,4,0,0, - 115,40,0,0,0,0,5,4,1,10,1,14,1,2,1,10, - 1,8,1,10,1,14,2,12,1,8,1,2,1,10,1,4, - 1,6,1,8,1,8,5,14,2,12,1,6,1,122,20,80, - 97,116,104,70,105,110,100,101,114,46,95,103,101,116,95,115, - 112,101,99,99,4,0,0,0,0,0,0,0,6,0,0,0, - 4,0,0,0,67,0,0,0,115,104,0,0,0,124,2,100, - 1,107,8,114,14,116,0,106,1,125,2,124,0,106,2,124, - 1,124,2,124,3,131,3,125,4,124,4,100,1,107,8,114, - 42,100,1,83,0,110,58,124,4,106,3,100,1,107,8,114, - 96,124,4,106,4,125,5,124,5,114,90,100,2,124,4,95, - 5,116,6,124,1,124,5,124,0,106,2,131,3,124,4,95, - 4,124,4,83,0,113,100,100,1,83,0,110,4,124,4,83, - 0,100,1,83,0,41,3,122,98,102,105,110,100,32,116,104, - 101,32,109,111,100,117,108,101,32,111,110,32,115,121,115,46, - 112,97,116,104,32,111,114,32,39,112,97,116,104,39,32,98, - 97,115,101,100,32,111,110,32,115,121,115,46,112,97,116,104, - 95,104,111,111,107,115,32,97,110,100,10,32,32,32,32,32, - 32,32,32,115,121,115,46,112,97,116,104,95,105,109,112,111, - 114,116,101,114,95,99,97,99,104,101,46,78,90,9,110,97, - 109,101,115,112,97,99,101,41,7,114,7,0,0,0,114,35, - 0,0,0,114,1,1,0,0,114,120,0,0,0,114,150,0, - 0,0,114,152,0,0,0,114,224,0,0,0,41,6,114,164, - 0,0,0,114,119,0,0,0,114,35,0,0,0,114,174,0, - 0,0,114,158,0,0,0,114,0,1,0,0,114,4,0,0, - 0,114,4,0,0,0,114,5,0,0,0,114,175,0,0,0, - 109,4,0,0,115,26,0,0,0,0,4,8,1,6,1,14, - 1,8,1,6,1,10,1,6,1,4,3,6,1,16,1,6, - 2,6,2,122,20,80,97,116,104,70,105,110,100,101,114,46, - 102,105,110,100,95,115,112,101,99,99,3,0,0,0,0,0, - 0,0,4,0,0,0,3,0,0,0,67,0,0,0,115,30, - 0,0,0,124,0,106,0,124,1,124,2,131,2,125,3,124, - 3,100,1,107,8,114,24,100,1,83,0,124,3,106,1,83, - 0,41,2,122,170,102,105,110,100,32,116,104,101,32,109,111, - 100,117,108,101,32,111,110,32,115,121,115,46,112,97,116,104, - 32,111,114,32,39,112,97,116,104,39,32,98,97,115,101,100, - 32,111,110,32,115,121,115,46,112,97,116,104,95,104,111,111, - 107,115,32,97,110,100,10,32,32,32,32,32,32,32,32,115, - 121,115,46,112,97,116,104,95,105,109,112,111,114,116,101,114, - 95,99,97,99,104,101,46,10,10,32,32,32,32,32,32,32, - 32,84,104,105,115,32,109,101,116,104,111,100,32,105,115,32, - 100,101,112,114,101,99,97,116,101,100,46,32,32,85,115,101, - 32,102,105,110,100,95,115,112,101,99,40,41,32,105,110,115, - 116,101,97,100,46,10,10,32,32,32,32,32,32,32,32,78, - 41,2,114,175,0,0,0,114,120,0,0,0,41,4,114,164, - 0,0,0,114,119,0,0,0,114,35,0,0,0,114,158,0, - 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,176,0,0,0,131,4,0,0,115,8,0,0,0,0, - 8,12,1,8,1,4,1,122,22,80,97,116,104,70,105,110, - 100,101,114,46,102,105,110,100,95,109,111,100,117,108,101,41, - 12,114,105,0,0,0,114,104,0,0,0,114,106,0,0,0, - 114,107,0,0,0,114,177,0,0,0,114,246,0,0,0,114, - 251,0,0,0,114,253,0,0,0,114,254,0,0,0,114,1, - 1,0,0,114,175,0,0,0,114,176,0,0,0,114,4,0, - 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,245,0,0,0,11,4,0,0,115,22,0,0,0,8, - 2,4,2,12,8,12,17,12,22,12,15,2,1,12,31,2, - 1,14,21,2,1,114,245,0,0,0,99,0,0,0,0,0, - 0,0,0,0,0,0,0,3,0,0,0,64,0,0,0,115, - 90,0,0,0,101,0,90,1,100,0,90,2,100,1,90,3, - 100,2,100,3,132,0,90,4,100,4,100,5,132,0,90,5, - 101,6,90,7,100,6,100,7,132,0,90,8,100,8,100,9, - 132,0,90,9,100,10,100,11,100,12,132,1,90,10,100,13, - 100,14,132,0,90,11,101,12,100,15,100,16,132,0,131,1, - 90,13,100,17,100,18,132,0,90,14,100,10,83,0,41,19, - 218,10,70,105,108,101,70,105,110,100,101,114,122,172,70,105, - 108,101,45,98,97,115,101,100,32,102,105,110,100,101,114,46, - 10,10,32,32,32,32,73,110,116,101,114,97,99,116,105,111, - 110,115,32,119,105,116,104,32,116,104,101,32,102,105,108,101, - 32,115,121,115,116,101,109,32,97,114,101,32,99,97,99,104, - 101,100,32,102,111,114,32,112,101,114,102,111,114,109,97,110, - 99,101,44,32,98,101,105,110,103,10,32,32,32,32,114,101, - 102,114,101,115,104,101,100,32,119,104,101,110,32,116,104,101, - 32,100,105,114,101,99,116,111,114,121,32,116,104,101,32,102, - 105,110,100,101,114,32,105,115,32,104,97,110,100,108,105,110, - 103,32,104,97,115,32,98,101,101,110,32,109,111,100,105,102, - 105,101,100,46,10,10,32,32,32,32,99,2,0,0,0,0, - 0,0,0,5,0,0,0,5,0,0,0,7,0,0,0,115, - 88,0,0,0,103,0,125,3,120,40,124,2,68,0,93,32, - 92,2,137,0,125,4,124,3,106,0,135,0,102,1,100,1, - 100,2,134,0,124,4,68,0,131,1,131,1,1,0,113,10, - 87,0,124,3,124,0,95,1,124,1,112,58,100,3,124,0, - 95,2,100,6,124,0,95,3,116,4,131,0,124,0,95,5, - 116,4,131,0,124,0,95,6,100,5,83,0,41,7,122,154, - 73,110,105,116,105,97,108,105,122,101,32,119,105,116,104,32, - 116,104,101,32,112,97,116,104,32,116,111,32,115,101,97,114, - 99,104,32,111,110,32,97,110,100,32,97,32,118,97,114,105, - 97,98,108,101,32,110,117,109,98,101,114,32,111,102,10,32, - 32,32,32,32,32,32,32,50,45,116,117,112,108,101,115,32, - 99,111,110,116,97,105,110,105,110,103,32,116,104,101,32,108, - 111,97,100,101,114,32,97,110,100,32,116,104,101,32,102,105, - 108,101,32,115,117,102,102,105,120,101,115,32,116,104,101,32, - 108,111,97,100,101,114,10,32,32,32,32,32,32,32,32,114, - 101,99,111,103,110,105,122,101,115,46,99,1,0,0,0,0, - 0,0,0,2,0,0,0,3,0,0,0,51,0,0,0,115, - 22,0,0,0,124,0,93,14,125,1,124,1,136,0,102,2, - 86,0,1,0,113,2,100,0,83,0,41,1,78,114,4,0, - 0,0,41,2,114,22,0,0,0,114,219,0,0,0,41,1, - 114,120,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 221,0,0,0,160,4,0,0,115,2,0,0,0,4,0,122, - 38,70,105,108,101,70,105,110,100,101,114,46,95,95,105,110, - 105,116,95,95,46,60,108,111,99,97,108,115,62,46,60,103, - 101,110,101,120,112,114,62,114,58,0,0,0,114,29,0,0, - 0,78,114,87,0,0,0,41,7,114,143,0,0,0,218,8, - 95,108,111,97,100,101,114,115,114,35,0,0,0,218,11,95, - 112,97,116,104,95,109,116,105,109,101,218,3,115,101,116,218, - 11,95,112,97,116,104,95,99,97,99,104,101,218,19,95,114, - 101,108,97,120,101,100,95,112,97,116,104,95,99,97,99,104, - 101,41,5,114,100,0,0,0,114,35,0,0,0,218,14,108, - 111,97,100,101,114,95,100,101,116,97,105,108,115,90,7,108, - 111,97,100,101,114,115,114,160,0,0,0,114,4,0,0,0, - 41,1,114,120,0,0,0,114,5,0,0,0,114,179,0,0, - 0,154,4,0,0,115,16,0,0,0,0,4,4,1,14,1, - 28,1,6,2,10,1,6,1,8,1,122,19,70,105,108,101, - 70,105,110,100,101,114,46,95,95,105,110,105,116,95,95,99, - 1,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0, - 67,0,0,0,115,10,0,0,0,100,3,124,0,95,0,100, - 2,83,0,41,4,122,31,73,110,118,97,108,105,100,97,116, - 101,32,116,104,101,32,100,105,114,101,99,116,111,114,121,32, - 109,116,105,109,101,46,114,29,0,0,0,78,114,87,0,0, - 0,41,1,114,4,1,0,0,41,1,114,100,0,0,0,114, - 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,246, - 0,0,0,168,4,0,0,115,2,0,0,0,0,2,122,28, - 70,105,108,101,70,105,110,100,101,114,46,105,110,118,97,108, - 105,100,97,116,101,95,99,97,99,104,101,115,99,2,0,0, - 0,0,0,0,0,3,0,0,0,2,0,0,0,67,0,0, - 0,115,42,0,0,0,124,0,106,0,124,1,131,1,125,2, - 124,2,100,1,107,8,114,26,100,1,103,0,102,2,83,0, - 124,2,106,1,124,2,106,2,112,38,103,0,102,2,83,0, - 41,2,122,197,84,114,121,32,116,111,32,102,105,110,100,32, - 97,32,108,111,97,100,101,114,32,102,111,114,32,116,104,101, - 32,115,112,101,99,105,102,105,101,100,32,109,111,100,117,108, - 101,44,32,111,114,32,116,104,101,32,110,97,109,101,115,112, - 97,99,101,10,32,32,32,32,32,32,32,32,112,97,99,107, - 97,103,101,32,112,111,114,116,105,111,110,115,46,32,82,101, - 116,117,114,110,115,32,40,108,111,97,100,101,114,44,32,108, - 105,115,116,45,111,102,45,112,111,114,116,105,111,110,115,41, - 46,10,10,32,32,32,32,32,32,32,32,84,104,105,115,32, - 109,101,116,104,111,100,32,105,115,32,100,101,112,114,101,99, - 97,116,101,100,46,32,32,85,115,101,32,102,105,110,100,95, - 115,112,101,99,40,41,32,105,110,115,116,101,97,100,46,10, - 10,32,32,32,32,32,32,32,32,78,41,3,114,175,0,0, - 0,114,120,0,0,0,114,150,0,0,0,41,3,114,100,0, - 0,0,114,119,0,0,0,114,158,0,0,0,114,4,0,0, - 0,114,4,0,0,0,114,5,0,0,0,114,117,0,0,0, - 174,4,0,0,115,8,0,0,0,0,7,10,1,8,1,8, - 1,122,22,70,105,108,101,70,105,110,100,101,114,46,102,105, - 110,100,95,108,111,97,100,101,114,99,6,0,0,0,0,0, - 0,0,7,0,0,0,7,0,0,0,67,0,0,0,115,30, - 0,0,0,124,1,124,2,124,3,131,2,125,6,116,0,124, - 2,124,3,100,1,124,6,100,2,124,4,144,2,131,2,83, - 0,41,3,78,114,120,0,0,0,114,150,0,0,0,41,1, - 114,161,0,0,0,41,7,114,100,0,0,0,114,159,0,0, - 0,114,119,0,0,0,114,35,0,0,0,90,4,115,109,115, - 108,114,174,0,0,0,114,120,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,1,1,0,0,186, - 4,0,0,115,6,0,0,0,0,1,10,1,12,1,122,20, - 70,105,108,101,70,105,110,100,101,114,46,95,103,101,116,95, - 115,112,101,99,78,99,3,0,0,0,0,0,0,0,14,0, - 0,0,15,0,0,0,67,0,0,0,115,100,1,0,0,100, - 1,125,3,124,1,106,0,100,2,131,1,100,3,25,0,125, - 4,121,24,116,1,124,0,106,2,112,34,116,3,106,4,131, - 0,131,1,106,5,125,5,87,0,110,24,4,0,116,6,107, - 10,114,66,1,0,1,0,1,0,100,10,125,5,89,0,110, - 2,88,0,124,5,124,0,106,7,107,3,114,92,124,0,106, - 8,131,0,1,0,124,5,124,0,95,7,116,9,131,0,114, - 114,124,0,106,10,125,6,124,4,106,11,131,0,125,7,110, - 10,124,0,106,12,125,6,124,4,125,7,124,7,124,6,107, - 6,114,218,116,13,124,0,106,2,124,4,131,2,125,8,120, - 72,124,0,106,14,68,0,93,54,92,2,125,9,125,10,100, - 5,124,9,23,0,125,11,116,13,124,8,124,11,131,2,125, - 12,116,15,124,12,131,1,114,152,124,0,106,16,124,10,124, - 1,124,12,124,8,103,1,124,2,131,5,83,0,113,152,87, - 0,116,17,124,8,131,1,125,3,120,90,124,0,106,14,68, - 0,93,80,92,2,125,9,125,10,116,13,124,0,106,2,124, - 4,124,9,23,0,131,2,125,12,116,18,106,19,100,6,124, - 12,100,7,100,3,144,1,131,2,1,0,124,7,124,9,23, - 0,124,6,107,6,114,226,116,15,124,12,131,1,114,226,124, - 0,106,16,124,10,124,1,124,12,100,8,124,2,131,5,83, - 0,113,226,87,0,124,3,144,1,114,96,116,18,106,19,100, - 9,124,8,131,2,1,0,116,18,106,20,124,1,100,8,131, - 2,125,13,124,8,103,1,124,13,95,21,124,13,83,0,100, - 8,83,0,41,11,122,102,84,114,121,32,116,111,32,102,105, - 110,100,32,97,32,115,112,101,99,32,102,111,114,32,116,104, - 101,32,115,112,101,99,105,102,105,101,100,32,109,111,100,117, - 108,101,46,32,32,82,101,116,117,114,110,115,32,116,104,101, - 10,32,32,32,32,32,32,32,32,109,97,116,99,104,105,110, - 103,32,115,112,101,99,44,32,111,114,32,78,111,110,101,32, - 105,102,32,110,111,116,32,102,111,117,110,100,46,70,114,58, - 0,0,0,114,56,0,0,0,114,29,0,0,0,114,179,0, - 0,0,122,9,116,114,121,105,110,103,32,123,125,90,9,118, - 101,114,98,111,115,105,116,121,78,122,25,112,111,115,115,105, - 98,108,101,32,110,97,109,101,115,112,97,99,101,32,102,111, - 114,32,123,125,114,87,0,0,0,41,22,114,32,0,0,0, - 114,39,0,0,0,114,35,0,0,0,114,3,0,0,0,114, - 45,0,0,0,114,213,0,0,0,114,40,0,0,0,114,4, - 1,0,0,218,11,95,102,105,108,108,95,99,97,99,104,101, - 114,6,0,0,0,114,7,1,0,0,114,88,0,0,0,114, - 6,1,0,0,114,28,0,0,0,114,3,1,0,0,114,44, - 0,0,0,114,1,1,0,0,114,46,0,0,0,114,114,0, - 0,0,114,129,0,0,0,114,154,0,0,0,114,150,0,0, - 0,41,14,114,100,0,0,0,114,119,0,0,0,114,174,0, - 0,0,90,12,105,115,95,110,97,109,101,115,112,97,99,101, - 90,11,116,97,105,108,95,109,111,100,117,108,101,114,126,0, - 0,0,90,5,99,97,99,104,101,90,12,99,97,99,104,101, - 95,109,111,100,117,108,101,90,9,98,97,115,101,95,112,97, - 116,104,114,219,0,0,0,114,159,0,0,0,90,13,105,110, - 105,116,95,102,105,108,101,110,97,109,101,90,9,102,117,108, - 108,95,112,97,116,104,114,158,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,175,0,0,0,191, - 4,0,0,115,70,0,0,0,0,3,4,1,14,1,2,1, - 24,1,14,1,10,1,10,1,8,1,6,2,6,1,6,1, - 10,2,6,1,4,2,8,1,12,1,16,1,8,1,10,1, - 8,1,24,4,8,2,16,1,16,1,18,1,12,1,8,1, - 10,1,12,1,6,1,12,1,12,1,8,1,4,1,122,20, - 70,105,108,101,70,105,110,100,101,114,46,102,105,110,100,95, - 115,112,101,99,99,1,0,0,0,0,0,0,0,9,0,0, - 0,13,0,0,0,67,0,0,0,115,194,0,0,0,124,0, - 106,0,125,1,121,22,116,1,106,2,124,1,112,22,116,1, - 106,3,131,0,131,1,125,2,87,0,110,30,4,0,116,4, - 116,5,116,6,102,3,107,10,114,58,1,0,1,0,1,0, - 103,0,125,2,89,0,110,2,88,0,116,7,106,8,106,9, - 100,1,131,1,115,84,116,10,124,2,131,1,124,0,95,11, - 110,78,116,10,131,0,125,3,120,64,124,2,68,0,93,56, - 125,4,124,4,106,12,100,2,131,1,92,3,125,5,125,6, - 125,7,124,6,114,138,100,3,106,13,124,5,124,7,106,14, - 131,0,131,2,125,8,110,4,124,5,125,8,124,3,106,15, - 124,8,131,1,1,0,113,96,87,0,124,3,124,0,95,11, - 116,7,106,8,106,9,116,16,131,1,114,190,100,4,100,5, - 132,0,124,2,68,0,131,1,124,0,95,17,100,6,83,0, - 41,7,122,68,70,105,108,108,32,116,104,101,32,99,97,99, - 104,101,32,111,102,32,112,111,116,101,110,116,105,97,108,32, - 109,111,100,117,108,101,115,32,97,110,100,32,112,97,99,107, - 97,103,101,115,32,102,111,114,32,116,104,105,115,32,100,105, - 114,101,99,116,111,114,121,46,114,0,0,0,0,114,58,0, - 0,0,122,5,123,125,46,123,125,99,1,0,0,0,0,0, - 0,0,2,0,0,0,3,0,0,0,83,0,0,0,115,20, - 0,0,0,104,0,124,0,93,12,125,1,124,1,106,0,131, - 0,146,2,113,4,83,0,114,4,0,0,0,41,1,114,88, - 0,0,0,41,2,114,22,0,0,0,90,2,102,110,114,4, - 0,0,0,114,4,0,0,0,114,5,0,0,0,250,9,60, - 115,101,116,99,111,109,112,62,10,5,0,0,115,2,0,0, - 0,6,0,122,41,70,105,108,101,70,105,110,100,101,114,46, - 95,102,105,108,108,95,99,97,99,104,101,46,60,108,111,99, - 97,108,115,62,46,60,115,101,116,99,111,109,112,62,78,41, - 18,114,35,0,0,0,114,3,0,0,0,90,7,108,105,115, - 116,100,105,114,114,45,0,0,0,114,252,0,0,0,218,15, - 80,101,114,109,105,115,115,105,111,110,69,114,114,111,114,218, - 18,78,111,116,65,68,105,114,101,99,116,111,114,121,69,114, - 114,111,114,114,7,0,0,0,114,8,0,0,0,114,9,0, - 0,0,114,5,1,0,0,114,6,1,0,0,114,83,0,0, - 0,114,47,0,0,0,114,88,0,0,0,218,3,97,100,100, - 114,10,0,0,0,114,7,1,0,0,41,9,114,100,0,0, - 0,114,35,0,0,0,90,8,99,111,110,116,101,110,116,115, - 90,21,108,111,119,101,114,95,115,117,102,102,105,120,95,99, - 111,110,116,101,110,116,115,114,241,0,0,0,114,98,0,0, - 0,114,231,0,0,0,114,219,0,0,0,90,8,110,101,119, - 95,110,97,109,101,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,9,1,0,0,237,4,0,0,115,34,0, - 0,0,0,2,6,1,2,1,22,1,20,3,10,3,12,1, - 12,7,6,1,10,1,16,1,4,1,18,2,4,1,14,1, - 6,1,12,1,122,22,70,105,108,101,70,105,110,100,101,114, - 46,95,102,105,108,108,95,99,97,99,104,101,99,1,0,0, - 0,0,0,0,0,3,0,0,0,3,0,0,0,7,0,0, - 0,115,18,0,0,0,135,0,135,1,102,2,100,1,100,2, - 134,0,125,2,124,2,83,0,41,3,97,20,1,0,0,65, - 32,99,108,97,115,115,32,109,101,116,104,111,100,32,119,104, - 105,99,104,32,114,101,116,117,114,110,115,32,97,32,99,108, - 111,115,117,114,101,32,116,111,32,117,115,101,32,111,110,32, - 115,121,115,46,112,97,116,104,95,104,111,111,107,10,32,32, - 32,32,32,32,32,32,119,104,105,99,104,32,119,105,108,108, - 32,114,101,116,117,114,110,32,97,110,32,105,110,115,116,97, - 110,99,101,32,117,115,105,110,103,32,116,104,101,32,115,112, - 101,99,105,102,105,101,100,32,108,111,97,100,101,114,115,32, - 97,110,100,32,116,104,101,32,112,97,116,104,10,32,32,32, - 32,32,32,32,32,99,97,108,108,101,100,32,111,110,32,116, - 104,101,32,99,108,111,115,117,114,101,46,10,10,32,32,32, - 32,32,32,32,32,73,102,32,116,104,101,32,112,97,116,104, - 32,99,97,108,108,101,100,32,111,110,32,116,104,101,32,99, - 108,111,115,117,114,101,32,105,115,32,110,111,116,32,97,32, - 100,105,114,101,99,116,111,114,121,44,32,73,109,112,111,114, - 116,69,114,114,111,114,32,105,115,10,32,32,32,32,32,32, - 32,32,114,97,105,115,101,100,46,10,10,32,32,32,32,32, - 32,32,32,99,1,0,0,0,0,0,0,0,1,0,0,0, - 4,0,0,0,19,0,0,0,115,32,0,0,0,116,0,124, - 0,131,1,115,22,116,1,100,1,100,2,124,0,144,1,131, - 1,130,1,136,0,124,0,136,1,140,1,83,0,41,3,122, - 45,80,97,116,104,32,104,111,111,107,32,102,111,114,32,105, - 109,112,111,114,116,108,105,98,46,109,97,99,104,105,110,101, - 114,121,46,70,105,108,101,70,105,110,100,101,114,46,122,30, - 111,110,108,121,32,100,105,114,101,99,116,111,114,105,101,115, - 32,97,114,101,32,115,117,112,112,111,114,116,101,100,114,35, - 0,0,0,41,2,114,46,0,0,0,114,99,0,0,0,41, - 1,114,35,0,0,0,41,2,114,164,0,0,0,114,8,1, - 0,0,114,4,0,0,0,114,5,0,0,0,218,24,112,97, - 116,104,95,104,111,111,107,95,102,111,114,95,70,105,108,101, - 70,105,110,100,101,114,22,5,0,0,115,6,0,0,0,0, - 2,8,1,14,1,122,54,70,105,108,101,70,105,110,100,101, - 114,46,112,97,116,104,95,104,111,111,107,46,60,108,111,99, - 97,108,115,62,46,112,97,116,104,95,104,111,111,107,95,102, - 111,114,95,70,105,108,101,70,105,110,100,101,114,114,4,0, - 0,0,41,3,114,164,0,0,0,114,8,1,0,0,114,14, - 1,0,0,114,4,0,0,0,41,2,114,164,0,0,0,114, - 8,1,0,0,114,5,0,0,0,218,9,112,97,116,104,95, - 104,111,111,107,12,5,0,0,115,4,0,0,0,0,10,14, - 6,122,20,70,105,108,101,70,105,110,100,101,114,46,112,97, - 116,104,95,104,111,111,107,99,1,0,0,0,0,0,0,0, - 1,0,0,0,2,0,0,0,67,0,0,0,115,12,0,0, - 0,100,1,106,0,124,0,106,1,131,1,83,0,41,2,78, - 122,16,70,105,108,101,70,105,110,100,101,114,40,123,33,114, - 125,41,41,2,114,47,0,0,0,114,35,0,0,0,41,1, - 114,100,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,240,0,0,0,30,5,0,0,115,2,0, - 0,0,0,1,122,19,70,105,108,101,70,105,110,100,101,114, - 46,95,95,114,101,112,114,95,95,41,15,114,105,0,0,0, - 114,104,0,0,0,114,106,0,0,0,114,107,0,0,0,114, - 179,0,0,0,114,246,0,0,0,114,123,0,0,0,114,176, - 0,0,0,114,117,0,0,0,114,1,1,0,0,114,175,0, - 0,0,114,9,1,0,0,114,177,0,0,0,114,15,1,0, - 0,114,240,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,2,1,0,0,145, - 4,0,0,115,20,0,0,0,8,7,4,2,8,14,8,4, - 4,2,8,12,8,5,10,46,8,31,12,18,114,2,1,0, - 0,99,4,0,0,0,0,0,0,0,6,0,0,0,11,0, - 0,0,67,0,0,0,115,148,0,0,0,124,0,106,0,100, - 1,131,1,125,4,124,0,106,0,100,2,131,1,125,5,124, - 4,115,66,124,5,114,36,124,5,106,1,125,4,110,30,124, - 2,124,3,107,2,114,56,116,2,124,1,124,2,131,2,125, - 4,110,10,116,3,124,1,124,2,131,2,125,4,124,5,115, - 86,116,4,124,1,124,2,100,3,124,4,144,1,131,2,125, - 5,121,36,124,5,124,0,100,2,60,0,124,4,124,0,100, - 1,60,0,124,2,124,0,100,4,60,0,124,3,124,0,100, - 5,60,0,87,0,110,20,4,0,116,5,107,10,114,142,1, - 0,1,0,1,0,89,0,110,2,88,0,100,0,83,0,41, - 6,78,218,10,95,95,108,111,97,100,101,114,95,95,218,8, - 95,95,115,112,101,99,95,95,114,120,0,0,0,90,8,95, - 95,102,105,108,101,95,95,90,10,95,95,99,97,99,104,101, - 100,95,95,41,6,218,3,103,101,116,114,120,0,0,0,114, - 217,0,0,0,114,212,0,0,0,114,161,0,0,0,218,9, - 69,120,99,101,112,116,105,111,110,41,6,90,2,110,115,114, - 98,0,0,0,90,8,112,97,116,104,110,97,109,101,90,9, - 99,112,97,116,104,110,97,109,101,114,120,0,0,0,114,158, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,218,14,95,102,105,120,95,117,112,95,109,111,100,117, - 108,101,36,5,0,0,115,34,0,0,0,0,2,10,1,10, - 1,4,1,4,1,8,1,8,1,12,2,10,1,4,1,16, - 1,2,1,8,1,8,1,8,1,12,1,14,2,114,20,1, - 0,0,99,0,0,0,0,0,0,0,0,3,0,0,0,3, - 0,0,0,67,0,0,0,115,38,0,0,0,116,0,116,1, - 106,2,131,0,102,2,125,0,116,3,116,4,102,2,125,1, - 116,5,116,6,102,2,125,2,124,0,124,1,124,2,103,3, - 83,0,41,1,122,95,82,101,116,117,114,110,115,32,97,32, - 108,105,115,116,32,111,102,32,102,105,108,101,45,98,97,115, - 101,100,32,109,111,100,117,108,101,32,108,111,97,100,101,114, - 115,46,10,10,32,32,32,32,69,97,99,104,32,105,116,101, - 109,32,105,115,32,97,32,116,117,112,108,101,32,40,108,111, - 97,100,101,114,44,32,115,117,102,102,105,120,101,115,41,46, - 10,32,32,32,32,41,7,114,218,0,0,0,114,139,0,0, - 0,218,18,101,120,116,101,110,115,105,111,110,95,115,117,102, - 102,105,120,101,115,114,212,0,0,0,114,84,0,0,0,114, - 217,0,0,0,114,74,0,0,0,41,3,90,10,101,120,116, - 101,110,115,105,111,110,115,90,6,115,111,117,114,99,101,90, - 8,98,121,116,101,99,111,100,101,114,4,0,0,0,114,4, - 0,0,0,114,5,0,0,0,114,155,0,0,0,59,5,0, - 0,115,8,0,0,0,0,5,12,1,8,1,8,1,114,155, - 0,0,0,99,1,0,0,0,0,0,0,0,12,0,0,0, - 12,0,0,0,67,0,0,0,115,188,1,0,0,124,0,97, - 0,116,0,106,1,97,1,116,0,106,2,97,2,116,1,106, - 3,116,4,25,0,125,1,120,56,100,26,68,0,93,48,125, - 2,124,2,116,1,106,3,107,7,114,58,116,0,106,5,124, - 2,131,1,125,3,110,10,116,1,106,3,124,2,25,0,125, - 3,116,6,124,1,124,2,124,3,131,3,1,0,113,32,87, - 0,100,5,100,6,103,1,102,2,100,7,100,8,100,6,103, - 2,102,2,102,2,125,4,120,118,124,4,68,0,93,102,92, - 2,125,5,125,6,116,7,100,9,100,10,132,0,124,6,68, - 0,131,1,131,1,115,142,116,8,130,1,124,6,100,11,25, - 0,125,7,124,5,116,1,106,3,107,6,114,174,116,1,106, - 3,124,5,25,0,125,8,80,0,113,112,121,16,116,0,106, - 5,124,5,131,1,125,8,80,0,87,0,113,112,4,0,116, - 9,107,10,114,212,1,0,1,0,1,0,119,112,89,0,113, - 112,88,0,113,112,87,0,116,9,100,12,131,1,130,1,116, - 6,124,1,100,13,124,8,131,3,1,0,116,6,124,1,100, - 14,124,7,131,3,1,0,116,6,124,1,100,15,100,16,106, - 10,124,6,131,1,131,3,1,0,121,14,116,0,106,5,100, - 17,131,1,125,9,87,0,110,26,4,0,116,9,107,10,144, - 1,114,52,1,0,1,0,1,0,100,18,125,9,89,0,110, - 2,88,0,116,6,124,1,100,17,124,9,131,3,1,0,116, - 0,106,5,100,19,131,1,125,10,116,6,124,1,100,19,124, - 10,131,3,1,0,124,5,100,7,107,2,144,1,114,120,116, - 0,106,5,100,20,131,1,125,11,116,6,124,1,100,21,124, - 11,131,3,1,0,116,6,124,1,100,22,116,11,131,0,131, - 3,1,0,116,12,106,13,116,2,106,14,131,0,131,1,1, - 0,124,5,100,7,107,2,144,1,114,184,116,15,106,16,100, - 23,131,1,1,0,100,24,116,12,107,6,144,1,114,184,100, - 25,116,17,95,18,100,18,83,0,41,27,122,205,83,101,116, - 117,112,32,116,104,101,32,112,97,116,104,45,98,97,115,101, - 100,32,105,109,112,111,114,116,101,114,115,32,102,111,114,32, - 105,109,112,111,114,116,108,105,98,32,98,121,32,105,109,112, - 111,114,116,105,110,103,32,110,101,101,100,101,100,10,32,32, - 32,32,98,117,105,108,116,45,105,110,32,109,111,100,117,108, - 101,115,32,97,110,100,32,105,110,106,101,99,116,105,110,103, - 32,116,104,101,109,32,105,110,116,111,32,116,104,101,32,103, - 108,111,98,97,108,32,110,97,109,101,115,112,97,99,101,46, - 10,10,32,32,32,32,79,116,104,101,114,32,99,111,109,112, - 111,110,101,110,116,115,32,97,114,101,32,101,120,116,114,97, - 99,116,101,100,32,102,114,111,109,32,116,104,101,32,99,111, - 114,101,32,98,111,111,116,115,116,114,97,112,32,109,111,100, - 117,108,101,46,10,10,32,32,32,32,114,49,0,0,0,114, - 60,0,0,0,218,8,98,117,105,108,116,105,110,115,114,136, - 0,0,0,90,5,112,111,115,105,120,250,1,47,218,2,110, - 116,250,1,92,99,1,0,0,0,0,0,0,0,2,0,0, - 0,3,0,0,0,115,0,0,0,115,26,0,0,0,124,0, - 93,18,125,1,116,0,124,1,131,1,100,0,107,2,86,0, - 1,0,113,2,100,1,83,0,41,2,114,29,0,0,0,78, - 41,1,114,31,0,0,0,41,2,114,22,0,0,0,114,77, - 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,114,221,0,0,0,95,5,0,0,115,2,0,0,0, - 4,0,122,25,95,115,101,116,117,112,46,60,108,111,99,97, - 108,115,62,46,60,103,101,110,101,120,112,114,62,114,59,0, - 0,0,122,30,105,109,112,111,114,116,108,105,98,32,114,101, - 113,117,105,114,101,115,32,112,111,115,105,120,32,111,114,32, - 110,116,114,3,0,0,0,114,25,0,0,0,114,21,0,0, - 0,114,30,0,0,0,90,7,95,116,104,114,101,97,100,78, - 90,8,95,119,101,97,107,114,101,102,90,6,119,105,110,114, - 101,103,114,163,0,0,0,114,6,0,0,0,122,4,46,112, - 121,119,122,6,95,100,46,112,121,100,84,41,4,122,3,95, - 105,111,122,9,95,119,97,114,110,105,110,103,115,122,8,98, - 117,105,108,116,105,110,115,122,7,109,97,114,115,104,97,108, - 41,19,114,114,0,0,0,114,7,0,0,0,114,139,0,0, - 0,114,233,0,0,0,114,105,0,0,0,90,18,95,98,117, - 105,108,116,105,110,95,102,114,111,109,95,110,97,109,101,114, - 109,0,0,0,218,3,97,108,108,218,14,65,115,115,101,114, - 116,105,111,110,69,114,114,111,114,114,99,0,0,0,114,26, - 0,0,0,114,11,0,0,0,114,223,0,0,0,114,143,0, - 0,0,114,21,1,0,0,114,84,0,0,0,114,157,0,0, - 0,114,162,0,0,0,114,167,0,0,0,41,12,218,17,95, - 98,111,111,116,115,116,114,97,112,95,109,111,100,117,108,101, - 90,11,115,101,108,102,95,109,111,100,117,108,101,90,12,98, - 117,105,108,116,105,110,95,110,97,109,101,90,14,98,117,105, - 108,116,105,110,95,109,111,100,117,108,101,90,10,111,115,95, - 100,101,116,97,105,108,115,90,10,98,117,105,108,116,105,110, - 95,111,115,114,21,0,0,0,114,25,0,0,0,90,9,111, - 115,95,109,111,100,117,108,101,90,13,116,104,114,101,97,100, - 95,109,111,100,117,108,101,90,14,119,101,97,107,114,101,102, - 95,109,111,100,117,108,101,90,13,119,105,110,114,101,103,95, - 109,111,100,117,108,101,114,4,0,0,0,114,4,0,0,0, - 114,5,0,0,0,218,6,95,115,101,116,117,112,70,5,0, - 0,115,82,0,0,0,0,8,4,1,6,1,6,3,10,1, - 10,1,10,1,12,2,10,1,16,3,22,1,14,2,22,1, - 8,1,10,1,10,1,4,2,2,1,10,1,6,1,14,1, - 12,2,8,1,12,1,12,1,18,3,2,1,14,1,16,2, - 10,1,12,3,10,1,12,3,10,1,10,1,12,3,14,1, - 14,1,10,1,10,1,10,1,114,29,1,0,0,99,1,0, - 0,0,0,0,0,0,2,0,0,0,3,0,0,0,67,0, - 0,0,115,84,0,0,0,116,0,124,0,131,1,1,0,116, - 1,131,0,125,1,116,2,106,3,106,4,116,5,106,6,124, - 1,140,0,103,1,131,1,1,0,116,7,106,8,100,1,107, - 2,114,56,116,2,106,9,106,10,116,11,131,1,1,0,116, - 2,106,9,106,10,116,12,131,1,1,0,116,5,124,0,95, - 5,116,13,124,0,95,13,100,2,83,0,41,3,122,41,73, - 110,115,116,97,108,108,32,116,104,101,32,112,97,116,104,45, - 98,97,115,101,100,32,105,109,112,111,114,116,32,99,111,109, - 112,111,110,101,110,116,115,46,114,24,1,0,0,78,41,14, - 114,29,1,0,0,114,155,0,0,0,114,7,0,0,0,114, - 250,0,0,0,114,143,0,0,0,114,2,1,0,0,114,15, - 1,0,0,114,3,0,0,0,114,105,0,0,0,218,9,109, - 101,116,97,95,112,97,116,104,114,157,0,0,0,114,162,0, - 0,0,114,245,0,0,0,114,212,0,0,0,41,2,114,28, - 1,0,0,90,17,115,117,112,112,111,114,116,101,100,95,108, - 111,97,100,101,114,115,114,4,0,0,0,114,4,0,0,0, - 114,5,0,0,0,218,8,95,105,110,115,116,97,108,108,138, - 5,0,0,115,16,0,0,0,0,2,8,1,6,1,20,1, - 10,1,12,1,12,4,6,1,114,31,1,0,0,41,3,122, - 3,119,105,110,114,1,0,0,0,114,2,0,0,0,41,56, - 114,107,0,0,0,114,10,0,0,0,114,11,0,0,0,114, - 17,0,0,0,114,19,0,0,0,114,28,0,0,0,114,38, - 0,0,0,114,39,0,0,0,114,43,0,0,0,114,44,0, - 0,0,114,46,0,0,0,114,55,0,0,0,218,4,116,121, - 112,101,218,8,95,95,99,111,100,101,95,95,114,138,0,0, - 0,114,15,0,0,0,114,128,0,0,0,114,14,0,0,0, - 114,18,0,0,0,90,17,95,82,65,87,95,77,65,71,73, - 67,95,78,85,77,66,69,82,114,73,0,0,0,114,72,0, - 0,0,114,84,0,0,0,114,74,0,0,0,90,23,68,69, - 66,85,71,95,66,89,84,69,67,79,68,69,95,83,85,70, - 70,73,88,69,83,90,27,79,80,84,73,77,73,90,69,68, - 95,66,89,84,69,67,79,68,69,95,83,85,70,70,73,88, - 69,83,114,79,0,0,0,114,85,0,0,0,114,91,0,0, - 0,114,95,0,0,0,114,97,0,0,0,114,116,0,0,0, - 114,123,0,0,0,114,135,0,0,0,114,141,0,0,0,114, - 144,0,0,0,114,149,0,0,0,218,6,111,98,106,101,99, - 116,114,156,0,0,0,114,161,0,0,0,114,162,0,0,0, - 114,178,0,0,0,114,188,0,0,0,114,204,0,0,0,114, - 212,0,0,0,114,217,0,0,0,114,223,0,0,0,114,218, - 0,0,0,114,224,0,0,0,114,243,0,0,0,114,245,0, - 0,0,114,2,1,0,0,114,20,1,0,0,114,155,0,0, - 0,114,29,1,0,0,114,31,1,0,0,114,4,0,0,0, - 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218, - 8,60,109,111,100,117,108,101,62,8,0,0,0,115,102,0, - 0,0,4,17,4,3,8,12,8,5,8,5,8,6,8,12, - 8,10,8,9,8,5,8,7,10,22,10,114,16,1,12,2, - 4,1,4,2,6,2,6,2,8,2,16,44,8,33,8,19, - 8,12,8,12,8,28,8,17,14,55,14,12,12,10,8,14, - 6,3,8,1,12,65,14,64,14,29,16,110,14,41,18,45, - 18,16,4,3,18,53,14,60,14,42,14,127,0,7,14,127, - 0,20,10,23,8,11,8,68, + 5,0,0,0,218,8,60,109,111,100,117,108,101,62,8,0, + 0,0,115,102,0,0,0,4,17,4,3,8,12,8,5,8, + 5,8,6,8,12,8,10,8,9,8,5,8,7,10,22,10, + 116,16,1,12,2,4,1,4,2,6,2,6,2,8,2,16, + 44,8,33,8,19,8,12,8,12,8,28,8,17,10,55,10, + 12,10,10,8,14,6,3,4,1,14,65,14,64,14,29,16, + 110,14,41,18,45,18,16,4,3,18,53,14,60,14,42,14, + 127,0,7,14,127,0,20,10,23,8,11,8,68, }; diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -133,7 +133,7 @@ &&TARGET_CALL_FUNCTION, &&TARGET_MAKE_FUNCTION, &&TARGET_BUILD_SLICE, - &&TARGET_MAKE_CLOSURE, + &&_unknown_opcode, &&TARGET_LOAD_CLOSURE, &&TARGET_LOAD_DEREF, &&TARGET_STORE_DEREF, -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 12:18:05 2016 From: python-checkins at python.org (berker.peksag) Date: Sun, 12 Jun 2016 16:18:05 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5?= Message-ID: <20160612161805.11339.82102.AC094D83@psf.io> https://hg.python.org/cpython/rev/7d648e17989f changeset: 101955:7d648e17989f parent: 101953:8a0fe3481c91 parent: 101954:f2fa78d4d46b user: Berker Peksag date: Sun Jun 12 19:18:17 2016 +0300 summary: Merge from 3.5 files: Modules/_sqlite/module.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/_sqlite/module.h b/Modules/_sqlite/module.h --- a/Modules/_sqlite/module.h +++ b/Modules/_sqlite/module.h @@ -42,7 +42,7 @@ extern PyObject* time_time; extern PyObject* time_sleep; -/* A dictionary, mapping colum types (INTEGER, VARCHAR, etc.) to converter +/* A dictionary, mapping column types (INTEGER, VARCHAR, etc.) to converter * functions, that convert the SQL value to the appropriate Python value. * The key is uppercase. */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 12:18:05 2016 From: python-checkins at python.org (berker.peksag) Date: Sun, 12 Jun 2016 16:18:05 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Fix_typo_in_?= =?utf-8?q?=5Fsqlite/module=2Eh?= Message-ID: <20160612161805.20067.48679.2C4E1EFB@psf.io> https://hg.python.org/cpython/rev/f2fa78d4d46b changeset: 101954:f2fa78d4d46b branch: 3.5 parent: 101949:367b3f41710a user: Berker Peksag date: Sun Jun 12 19:17:49 2016 +0300 summary: Fix typo in _sqlite/module.h files: Modules/_sqlite/module.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/_sqlite/module.h b/Modules/_sqlite/module.h --- a/Modules/_sqlite/module.h +++ b/Modules/_sqlite/module.h @@ -42,7 +42,7 @@ extern PyObject* time_time; extern PyObject* time_sleep; -/* A dictionary, mapping colum types (INTEGER, VARCHAR, etc.) to converter +/* A dictionary, mapping column types (INTEGER, VARCHAR, etc.) to converter * functions, that convert the SQL value to the appropriate Python value. * The key is uppercase. */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 14:11:24 2016 From: python-checkins at python.org (brett.cannon) Date: Sun, 12 Jun 2016 18:11:24 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327186=3A_skip_byt?= =?utf-8?q?es_path_test_for_os=2Escandir=28=29_on_Windows?= Message-ID: <20160612181124.19990.66470.850B8ED2@psf.io> https://hg.python.org/cpython/rev/6a35aa1995ab changeset: 101956:6a35aa1995ab user: Brett Cannon date: Sun Jun 12 11:11:20 2016 -0700 summary: Issue #27186: skip bytes path test for os.scandir() on Windows files: Lib/test/test_os.py | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) 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 @@ -2953,6 +2953,7 @@ entry = self.create_file_entry() self.assertEqual(os.fspath(entry), os.path.join(self.path, 'file.txt')) + @unittest.skipIf(sys.platform == "nt", "test requires bytes path support") def test_fspath_protocol_bytes(self): bytes_filename = os.fsencode('bytesfile.txt') bytes_entry = self.create_file_entry(name=bytes_filename) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 15:35:06 2016 From: python-checkins at python.org (berker.peksag) Date: Sun, 12 Jun 2016 19:35:06 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5?= Message-ID: <20160612193505.9983.54238.5CBBFF56@psf.io> https://hg.python.org/cpython/rev/2fc155f9cda5 changeset: 101958:2fc155f9cda5 parent: 101956:6a35aa1995ab parent: 101957:4d21f005c02b user: Berker Peksag date: Sun Jun 12 22:35:10 2016 +0300 summary: Merge from 3.5 files: Lib/sqlite3/test/dbapi.py | 172 ++--------------- Lib/sqlite3/test/hooks.py | 28 +- Lib/sqlite3/test/regression.py | 22 +- Lib/sqlite3/test/transactions.py | 21 +- Lib/sqlite3/test/types.py | 14 +- Lib/sqlite3/test/userfunctions.py | 62 +---- 6 files changed, 62 insertions(+), 257 deletions(-) diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py --- a/Lib/sqlite3/test/dbapi.py +++ b/Lib/sqlite3/test/dbapi.py @@ -122,11 +122,8 @@ def CheckFailedOpen(self): YOU_CANNOT_OPEN_THIS = "/foo/bar/bla/23534/mydb.db" - try: + with self.assertRaises(sqlite.OperationalError): con = sqlite.connect(YOU_CANNOT_OPEN_THIS) - except sqlite.OperationalError: - return - self.fail("should have raised an OperationalError") def CheckClose(self): self.cx.close() @@ -202,22 +199,12 @@ self.cu.execute("delete from test") def CheckExecuteIllegalSql(self): - try: + with self.assertRaises(sqlite.OperationalError): self.cu.execute("select asdf") - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - return - except: - self.fail("raised wrong exception") def CheckExecuteTooMuchSql(self): - try: + with self.assertRaises(sqlite.Warning): self.cu.execute("select 5+4; select 4+5") - self.fail("should have raised a Warning") - except sqlite.Warning: - return - except: - self.fail("raised wrong exception") def CheckExecuteTooMuchSql2(self): self.cu.execute("select 5+4; -- foo bar") @@ -232,13 +219,8 @@ """) def CheckExecuteWrongSqlArg(self): - try: + with self.assertRaises(ValueError): self.cu.execute(42) - self.fail("should have raised a ValueError") - except ValueError: - return - except: - self.fail("raised wrong exception.") def CheckExecuteArgInt(self): self.cu.execute("insert into test(id) values (?)", (42,)) @@ -263,27 +245,18 @@ def CheckExecuteWrongNoOfArgs1(self): # too many parameters - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("insert into test(id) values (?)", (17, "Egon")) - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckExecuteWrongNoOfArgs2(self): # too little parameters - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("insert into test(id) values (?)") - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckExecuteWrongNoOfArgs3(self): # no parameters, parameters are needed - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("insert into test(id) values (?)") - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckExecuteParamList(self): self.cu.execute("insert into test(name) values ('foo')") @@ -322,27 +295,18 @@ def CheckExecuteDictMappingTooLittleArgs(self): self.cu.execute("insert into test(name) values ('foo')") - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("select name from test where name=:name and id=:id", {"name": "foo"}) - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckExecuteDictMappingNoArgs(self): self.cu.execute("insert into test(name) values ('foo')") - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("select name from test where name=:name") - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckExecuteDictMappingUnnamed(self): self.cu.execute("insert into test(name) values ('foo')") - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("select name from test where name=?", {"name": "foo"}) - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckClose(self): self.cu.close() @@ -403,32 +367,16 @@ self.cu.executemany("insert into test(income) values (?)", mygen()) def CheckExecuteManyWrongSqlArg(self): - try: + with self.assertRaises(ValueError): self.cu.executemany(42, [(3,)]) - self.fail("should have raised a ValueError") - except ValueError: - return - except: - self.fail("raised wrong exception.") def CheckExecuteManySelect(self): - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.executemany("select ?", [(3,)]) - self.fail("should have raised a ProgrammingError") - except sqlite.ProgrammingError: - return - except: - self.fail("raised wrong exception.") def CheckExecuteManyNotIterable(self): - try: + with self.assertRaises(TypeError): self.cu.executemany("insert into test(income) values (?)", 42) - self.fail("should have raised a TypeError") - except TypeError: - return - except Exception as e: - print("raised", e.__class__) - self.fail("raised wrong exception.") def CheckFetchIter(self): # Optional DB-API extension. @@ -505,22 +453,15 @@ self.assertEqual(self.cu.connection, self.cx) def CheckWrongCursorCallable(self): - try: + with self.assertRaises(TypeError): def f(): pass cur = self.cx.cursor(f) - self.fail("should have raised a TypeError") - except TypeError: - return - self.fail("should have raised a ValueError") def CheckCursorWrongClass(self): class Foo: pass foo = Foo() - try: + with self.assertRaises(TypeError): cur = sqlite.Cursor(foo) - self.fail("should have raised a ValueError") - except TypeError: - pass @unittest.skipUnless(threading, 'This test requires threading.') class ThreadTests(unittest.TestCase): @@ -719,22 +660,14 @@ def CheckScriptSyntaxError(self): con = sqlite.connect(":memory:") cur = con.cursor() - raised = False - try: + with self.assertRaises(sqlite.OperationalError): cur.executescript("create table test(x); asdf; create table test2(x)") - except sqlite.OperationalError: - raised = True - self.assertEqual(raised, True, "should have raised an exception") def CheckScriptErrorNormal(self): con = sqlite.connect(":memory:") cur = con.cursor() - raised = False - try: + with self.assertRaises(sqlite.OperationalError): cur.executescript("create table test(sadfsadfdsa); select foo from hurz;") - except sqlite.OperationalError: - raised = True - self.assertEqual(raised, True, "should have raised an exception") def CheckCursorExecutescriptAsBytes(self): con = sqlite.connect(":memory:") @@ -772,59 +705,34 @@ def CheckClosedConCursor(self): con = sqlite.connect(":memory:") con.close() - try: + with self.assertRaises(sqlite.ProgrammingError): cur = con.cursor() - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedConCommit(self): con = sqlite.connect(":memory:") con.close() - try: + with self.assertRaises(sqlite.ProgrammingError): con.commit() - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedConRollback(self): con = sqlite.connect(":memory:") con.close() - try: + with self.assertRaises(sqlite.ProgrammingError): con.rollback() - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedCurExecute(self): con = sqlite.connect(":memory:") cur = con.cursor() con.close() - try: + with self.assertRaises(sqlite.ProgrammingError): cur.execute("select 4") - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedCreateFunction(self): con = sqlite.connect(":memory:") con.close() def f(x): return 17 - try: + with self.assertRaises(sqlite.ProgrammingError): con.create_function("foo", 1, f) - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedCreateAggregate(self): con = sqlite.connect(":memory:") @@ -836,49 +744,29 @@ pass def finalize(self): return 17 - try: + with self.assertRaises(sqlite.ProgrammingError): con.create_aggregate("foo", 1, Agg) - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedSetAuthorizer(self): con = sqlite.connect(":memory:") con.close() def authorizer(*args): return sqlite.DENY - try: + with self.assertRaises(sqlite.ProgrammingError): con.set_authorizer(authorizer) - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedSetProgressCallback(self): con = sqlite.connect(":memory:") con.close() def progress(): pass - try: + with self.assertRaises(sqlite.ProgrammingError): con.set_progress_handler(progress, 100) - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedCall(self): con = sqlite.connect(":memory:") con.close() - try: + with self.assertRaises(sqlite.ProgrammingError): con() - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") class ClosedCurTests(unittest.TestCase): def setUp(self): @@ -900,15 +788,9 @@ else: params = [] - try: + with self.assertRaises(sqlite.ProgrammingError): method = getattr(cur, method_name) - method(*params) - self.fail("Should have raised a ProgrammingError: method " + method_name) - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError: " + method_name) def suite(): module_suite = unittest.makeSuite(ModuleTests, "Check") diff --git a/Lib/sqlite3/test/hooks.py b/Lib/sqlite3/test/hooks.py --- a/Lib/sqlite3/test/hooks.py +++ b/Lib/sqlite3/test/hooks.py @@ -33,19 +33,14 @@ def CheckCreateCollationNotCallable(self): con = sqlite.connect(":memory:") - try: + with self.assertRaises(TypeError) as cm: con.create_collation("X", 42) - self.fail("should have raised a TypeError") - except TypeError as e: - self.assertEqual(e.args[0], "parameter must be callable") + self.assertEqual(str(cm.exception), 'parameter must be callable') def CheckCreateCollationNotAscii(self): con = sqlite.connect(":memory:") - try: + with self.assertRaises(sqlite.ProgrammingError): con.create_collation("coll?", lambda x, y: (x > y) - (x < y)) - self.fail("should have raised a ProgrammingError") - except sqlite.ProgrammingError as e: - pass @unittest.skipIf(sqlite.sqlite_version_info < (3, 2, 1), 'old SQLite versions crash on this test') @@ -70,11 +65,9 @@ self.fail("the expected order was not returned") con.create_collation("mycoll", None) - try: + with self.assertRaises(sqlite.OperationalError) as cm: result = con.execute(sql).fetchall() - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0].lower(), "no such collation sequence: mycoll") + self.assertEqual(str(cm.exception), 'no such collation sequence: mycoll') def CheckCollationReturnsLargeInteger(self): def mycoll(x, y): @@ -106,8 +99,8 @@ result = con.execute(""" select x from (select 'a' as x union select 'b' as x) order by x collate mycoll """).fetchall() - if result[0][0] != 'b' or result[1][0] != 'a': - self.fail("wrong collation function is used") + self.assertEqual(result[0][0], 'b') + self.assertEqual(result[1][0], 'a') def CheckDeregisterCollation(self): """ @@ -117,12 +110,9 @@ con = sqlite.connect(":memory:") con.create_collation("mycoll", lambda x, y: (x > y) - (x < y)) con.create_collation("mycoll", None) - try: + with self.assertRaises(sqlite.OperationalError) as cm: con.execute("select 'a' as x union select 'b' as x order by x collate mycoll") - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - if not e.args[0].startswith("no such collation sequence"): - self.fail("wrong OperationalError raised") + self.assertEqual(str(cm.exception), 'no such collation sequence: mycoll') class ProgressTests(unittest.TestCase): def CheckProgressHandlerUsed(self): diff --git a/Lib/sqlite3/test/regression.py b/Lib/sqlite3/test/regression.py --- a/Lib/sqlite3/test/regression.py +++ b/Lib/sqlite3/test/regression.py @@ -170,14 +170,8 @@ con = sqlite.connect(":memory:") cur = Cursor(con) - try: + with self.assertRaises(sqlite.ProgrammingError): cur.execute("select 4+5").fetchall() - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("should have raised ProgrammingError") - def CheckStrSubclass(self): """ @@ -196,13 +190,8 @@ pass con = Connection(":memory:") - try: + with self.assertRaises(sqlite.ProgrammingError): cur = con.cursor() - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("should have raised ProgrammingError") def CheckCursorRegistration(self): """ @@ -223,13 +212,8 @@ cur.executemany("insert into foo(x) values (?)", [(3,), (4,), (5,)]) cur.execute("select x from foo") con.rollback() - try: + with self.assertRaises(sqlite.InterfaceError): cur.fetchall() - self.fail("should have raised InterfaceError") - except sqlite.InterfaceError: - pass - except: - self.fail("should have raised InterfaceError") def CheckAutoCommit(self): """ diff --git a/Lib/sqlite3/test/transactions.py b/Lib/sqlite3/test/transactions.py --- a/Lib/sqlite3/test/transactions.py +++ b/Lib/sqlite3/test/transactions.py @@ -118,13 +118,8 @@ return self.cur1.execute("create table test(i)") self.cur1.execute("insert into test(i) values (5)") - try: + with self.assertRaises(sqlite.OperationalError): self.cur2.execute("insert into test(i) values (5)") - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - pass - except: - self.fail("should have raised an OperationalError") def CheckLocking(self): """ @@ -137,13 +132,8 @@ return self.cur1.execute("create table test(i)") self.cur1.execute("insert into test(i) values (5)") - try: + with self.assertRaises(sqlite.OperationalError): self.cur2.execute("insert into test(i) values (5)") - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - pass - except: - self.fail("should have raised an OperationalError") # NO self.con2.rollback() HERE!!! self.con1.commit() @@ -159,13 +149,8 @@ cur.execute("select 1 union select 2 union select 3") con.rollback() - try: + with self.assertRaises(sqlite.InterfaceError): cur.fetchall() - self.fail("InterfaceError should have been raised") - except sqlite.InterfaceError as e: - pass - except: - self.fail("InterfaceError should have been raised") class SpecialCommandTests(unittest.TestCase): def setUp(self): diff --git a/Lib/sqlite3/test/types.py b/Lib/sqlite3/test/types.py --- a/Lib/sqlite3/test/types.py +++ b/Lib/sqlite3/test/types.py @@ -185,24 +185,14 @@ def CheckUnsupportedSeq(self): class Bar: pass val = Bar() - try: + with self.assertRaises(sqlite.InterfaceError): self.cur.execute("insert into test(f) values (?)", (val,)) - self.fail("should have raised an InterfaceError") - except sqlite.InterfaceError: - pass - except: - self.fail("should have raised an InterfaceError") def CheckUnsupportedDict(self): class Bar: pass val = Bar() - try: + with self.assertRaises(sqlite.InterfaceError): self.cur.execute("insert into test(f) values (:val)", {"val": val}) - self.fail("should have raised an InterfaceError") - except sqlite.InterfaceError: - pass - except: - self.fail("should have raised an InterfaceError") def CheckBlob(self): # default diff --git a/Lib/sqlite3/test/userfunctions.py b/Lib/sqlite3/test/userfunctions.py --- a/Lib/sqlite3/test/userfunctions.py +++ b/Lib/sqlite3/test/userfunctions.py @@ -162,11 +162,8 @@ self.con.close() def CheckFuncErrorOnCreate(self): - try: + with self.assertRaises(sqlite.OperationalError): self.con.create_function("bla", -100, lambda x: 2*x) - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - pass def CheckFuncRefCount(self): def getfunc(): @@ -231,12 +228,10 @@ def CheckFuncException(self): cur = self.con.cursor() - try: + with self.assertRaises(sqlite.OperationalError) as cm: cur.execute("select raiseexception()") cur.fetchone() - self.fail("should have raised OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0], 'user-defined function raised exception') + self.assertEqual(str(cm.exception), 'user-defined function raised exception') def CheckParamString(self): cur = self.con.cursor() @@ -312,55 +307,42 @@ pass def CheckAggrErrorOnCreate(self): - try: + with self.assertRaises(sqlite.OperationalError): self.con.create_function("bla", -100, AggrSum) - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - pass def CheckAggrNoStep(self): cur = self.con.cursor() - try: + with self.assertRaises(AttributeError) as cm: cur.execute("select nostep(t) from test") - self.fail("should have raised an AttributeError") - except AttributeError as e: - self.assertEqual(e.args[0], "'AggrNoStep' object has no attribute 'step'") + self.assertEqual(str(cm.exception), "'AggrNoStep' object has no attribute 'step'") def CheckAggrNoFinalize(self): cur = self.con.cursor() - try: + with self.assertRaises(sqlite.OperationalError) as cm: cur.execute("select nofinalize(t) from test") val = cur.fetchone()[0] - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0], "user-defined aggregate's 'finalize' method raised error") + self.assertEqual(str(cm.exception), "user-defined aggregate's 'finalize' method raised error") def CheckAggrExceptionInInit(self): cur = self.con.cursor() - try: + with self.assertRaises(sqlite.OperationalError) as cm: cur.execute("select excInit(t) from test") val = cur.fetchone()[0] - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0], "user-defined aggregate's '__init__' method raised error") + self.assertEqual(str(cm.exception), "user-defined aggregate's '__init__' method raised error") def CheckAggrExceptionInStep(self): cur = self.con.cursor() - try: + with self.assertRaises(sqlite.OperationalError) as cm: cur.execute("select excStep(t) from test") val = cur.fetchone()[0] - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0], "user-defined aggregate's 'step' method raised error") + self.assertEqual(str(cm.exception), "user-defined aggregate's 'step' method raised error") def CheckAggrExceptionInFinalize(self): cur = self.con.cursor() - try: + with self.assertRaises(sqlite.OperationalError) as cm: cur.execute("select excFinalize(t) from test") val = cur.fetchone()[0] - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0], "user-defined aggregate's 'finalize' method raised error") + self.assertEqual(str(cm.exception), "user-defined aggregate's 'finalize' method raised error") def CheckAggrCheckParamStr(self): cur = self.con.cursor() @@ -433,22 +415,14 @@ pass def test_table_access(self): - try: + with self.assertRaises(sqlite.DatabaseError) as cm: self.con.execute("select * from t2") - except sqlite.DatabaseError as e: - if not e.args[0].endswith("prohibited"): - self.fail("wrong exception text: %s" % e.args[0]) - return - self.fail("should have raised an exception due to missing privileges") + self.assertIn('prohibited', str(cm.exception)) def test_column_access(self): - try: + with self.assertRaises(sqlite.DatabaseError) as cm: self.con.execute("select c2 from t1") - except sqlite.DatabaseError as e: - if not e.args[0].endswith("prohibited"): - self.fail("wrong exception text: %s" % e.args[0]) - return - self.fail("should have raised an exception due to missing privileges") + self.assertIn('prohibited', str(cm.exception)) class AuthorizerRaiseExceptionTests(AuthorizerTests): @staticmethod -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 15:35:07 2016 From: python-checkins at python.org (berker.peksag) Date: Sun, 12 Jun 2016 19:35:07 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Modernize_sqli?= =?utf-8?q?te3_tests?= Message-ID: <20160612193505.114609.49064.5B4E3F3B@psf.io> https://hg.python.org/cpython/rev/4d21f005c02b changeset: 101957:4d21f005c02b branch: 3.5 parent: 101954:f2fa78d4d46b user: Berker Peksag date: Sun Jun 12 22:34:49 2016 +0300 summary: Modernize sqlite3 tests Update current tests that use old pattern with assertRaises to make them more maintainable. files: Lib/sqlite3/test/dbapi.py | 172 ++--------------- Lib/sqlite3/test/hooks.py | 28 +- Lib/sqlite3/test/regression.py | 22 +- Lib/sqlite3/test/transactions.py | 21 +- Lib/sqlite3/test/types.py | 14 +- Lib/sqlite3/test/userfunctions.py | 62 +---- 6 files changed, 62 insertions(+), 257 deletions(-) diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py --- a/Lib/sqlite3/test/dbapi.py +++ b/Lib/sqlite3/test/dbapi.py @@ -122,11 +122,8 @@ def CheckFailedOpen(self): YOU_CANNOT_OPEN_THIS = "/foo/bar/bla/23534/mydb.db" - try: + with self.assertRaises(sqlite.OperationalError): con = sqlite.connect(YOU_CANNOT_OPEN_THIS) - except sqlite.OperationalError: - return - self.fail("should have raised an OperationalError") def CheckClose(self): self.cx.close() @@ -202,22 +199,12 @@ self.cu.execute("delete from test") def CheckExecuteIllegalSql(self): - try: + with self.assertRaises(sqlite.OperationalError): self.cu.execute("select asdf") - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - return - except: - self.fail("raised wrong exception") def CheckExecuteTooMuchSql(self): - try: + with self.assertRaises(sqlite.Warning): self.cu.execute("select 5+4; select 4+5") - self.fail("should have raised a Warning") - except sqlite.Warning: - return - except: - self.fail("raised wrong exception") def CheckExecuteTooMuchSql2(self): self.cu.execute("select 5+4; -- foo bar") @@ -232,13 +219,8 @@ """) def CheckExecuteWrongSqlArg(self): - try: + with self.assertRaises(ValueError): self.cu.execute(42) - self.fail("should have raised a ValueError") - except ValueError: - return - except: - self.fail("raised wrong exception.") def CheckExecuteArgInt(self): self.cu.execute("insert into test(id) values (?)", (42,)) @@ -263,27 +245,18 @@ def CheckExecuteWrongNoOfArgs1(self): # too many parameters - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("insert into test(id) values (?)", (17, "Egon")) - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckExecuteWrongNoOfArgs2(self): # too little parameters - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("insert into test(id) values (?)") - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckExecuteWrongNoOfArgs3(self): # no parameters, parameters are needed - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("insert into test(id) values (?)") - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckExecuteParamList(self): self.cu.execute("insert into test(name) values ('foo')") @@ -322,27 +295,18 @@ def CheckExecuteDictMappingTooLittleArgs(self): self.cu.execute("insert into test(name) values ('foo')") - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("select name from test where name=:name and id=:id", {"name": "foo"}) - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckExecuteDictMappingNoArgs(self): self.cu.execute("insert into test(name) values ('foo')") - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("select name from test where name=:name") - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckExecuteDictMappingUnnamed(self): self.cu.execute("insert into test(name) values ('foo')") - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("select name from test where name=?", {"name": "foo"}) - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckClose(self): self.cu.close() @@ -403,32 +367,16 @@ self.cu.executemany("insert into test(income) values (?)", mygen()) def CheckExecuteManyWrongSqlArg(self): - try: + with self.assertRaises(ValueError): self.cu.executemany(42, [(3,)]) - self.fail("should have raised a ValueError") - except ValueError: - return - except: - self.fail("raised wrong exception.") def CheckExecuteManySelect(self): - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.executemany("select ?", [(3,)]) - self.fail("should have raised a ProgrammingError") - except sqlite.ProgrammingError: - return - except: - self.fail("raised wrong exception.") def CheckExecuteManyNotIterable(self): - try: + with self.assertRaises(TypeError): self.cu.executemany("insert into test(income) values (?)", 42) - self.fail("should have raised a TypeError") - except TypeError: - return - except Exception as e: - print("raised", e.__class__) - self.fail("raised wrong exception.") def CheckFetchIter(self): # Optional DB-API extension. @@ -505,22 +453,15 @@ self.assertEqual(self.cu.connection, self.cx) def CheckWrongCursorCallable(self): - try: + with self.assertRaises(TypeError): def f(): pass cur = self.cx.cursor(f) - self.fail("should have raised a TypeError") - except TypeError: - return - self.fail("should have raised a ValueError") def CheckCursorWrongClass(self): class Foo: pass foo = Foo() - try: + with self.assertRaises(TypeError): cur = sqlite.Cursor(foo) - self.fail("should have raised a ValueError") - except TypeError: - pass @unittest.skipUnless(threading, 'This test requires threading.') class ThreadTests(unittest.TestCase): @@ -719,22 +660,14 @@ def CheckScriptSyntaxError(self): con = sqlite.connect(":memory:") cur = con.cursor() - raised = False - try: + with self.assertRaises(sqlite.OperationalError): cur.executescript("create table test(x); asdf; create table test2(x)") - except sqlite.OperationalError: - raised = True - self.assertEqual(raised, True, "should have raised an exception") def CheckScriptErrorNormal(self): con = sqlite.connect(":memory:") cur = con.cursor() - raised = False - try: + with self.assertRaises(sqlite.OperationalError): cur.executescript("create table test(sadfsadfdsa); select foo from hurz;") - except sqlite.OperationalError: - raised = True - self.assertEqual(raised, True, "should have raised an exception") def CheckCursorExecutescriptAsBytes(self): con = sqlite.connect(":memory:") @@ -772,59 +705,34 @@ def CheckClosedConCursor(self): con = sqlite.connect(":memory:") con.close() - try: + with self.assertRaises(sqlite.ProgrammingError): cur = con.cursor() - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedConCommit(self): con = sqlite.connect(":memory:") con.close() - try: + with self.assertRaises(sqlite.ProgrammingError): con.commit() - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedConRollback(self): con = sqlite.connect(":memory:") con.close() - try: + with self.assertRaises(sqlite.ProgrammingError): con.rollback() - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedCurExecute(self): con = sqlite.connect(":memory:") cur = con.cursor() con.close() - try: + with self.assertRaises(sqlite.ProgrammingError): cur.execute("select 4") - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedCreateFunction(self): con = sqlite.connect(":memory:") con.close() def f(x): return 17 - try: + with self.assertRaises(sqlite.ProgrammingError): con.create_function("foo", 1, f) - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedCreateAggregate(self): con = sqlite.connect(":memory:") @@ -836,49 +744,29 @@ pass def finalize(self): return 17 - try: + with self.assertRaises(sqlite.ProgrammingError): con.create_aggregate("foo", 1, Agg) - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedSetAuthorizer(self): con = sqlite.connect(":memory:") con.close() def authorizer(*args): return sqlite.DENY - try: + with self.assertRaises(sqlite.ProgrammingError): con.set_authorizer(authorizer) - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedSetProgressCallback(self): con = sqlite.connect(":memory:") con.close() def progress(): pass - try: + with self.assertRaises(sqlite.ProgrammingError): con.set_progress_handler(progress, 100) - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedCall(self): con = sqlite.connect(":memory:") con.close() - try: + with self.assertRaises(sqlite.ProgrammingError): con() - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") class ClosedCurTests(unittest.TestCase): def setUp(self): @@ -900,15 +788,9 @@ else: params = [] - try: + with self.assertRaises(sqlite.ProgrammingError): method = getattr(cur, method_name) - method(*params) - self.fail("Should have raised a ProgrammingError: method " + method_name) - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError: " + method_name) def suite(): module_suite = unittest.makeSuite(ModuleTests, "Check") diff --git a/Lib/sqlite3/test/hooks.py b/Lib/sqlite3/test/hooks.py --- a/Lib/sqlite3/test/hooks.py +++ b/Lib/sqlite3/test/hooks.py @@ -33,19 +33,14 @@ def CheckCreateCollationNotCallable(self): con = sqlite.connect(":memory:") - try: + with self.assertRaises(TypeError) as cm: con.create_collation("X", 42) - self.fail("should have raised a TypeError") - except TypeError as e: - self.assertEqual(e.args[0], "parameter must be callable") + self.assertEqual(str(cm.exception), 'parameter must be callable') def CheckCreateCollationNotAscii(self): con = sqlite.connect(":memory:") - try: + with self.assertRaises(sqlite.ProgrammingError): con.create_collation("coll?", lambda x, y: (x > y) - (x < y)) - self.fail("should have raised a ProgrammingError") - except sqlite.ProgrammingError as e: - pass @unittest.skipIf(sqlite.sqlite_version_info < (3, 2, 1), 'old SQLite versions crash on this test') @@ -70,11 +65,9 @@ self.fail("the expected order was not returned") con.create_collation("mycoll", None) - try: + with self.assertRaises(sqlite.OperationalError) as cm: result = con.execute(sql).fetchall() - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0].lower(), "no such collation sequence: mycoll") + self.assertEqual(str(cm.exception), 'no such collation sequence: mycoll') def CheckCollationReturnsLargeInteger(self): def mycoll(x, y): @@ -106,8 +99,8 @@ result = con.execute(""" select x from (select 'a' as x union select 'b' as x) order by x collate mycoll """).fetchall() - if result[0][0] != 'b' or result[1][0] != 'a': - self.fail("wrong collation function is used") + self.assertEqual(result[0][0], 'b') + self.assertEqual(result[1][0], 'a') def CheckDeregisterCollation(self): """ @@ -117,12 +110,9 @@ con = sqlite.connect(":memory:") con.create_collation("mycoll", lambda x, y: (x > y) - (x < y)) con.create_collation("mycoll", None) - try: + with self.assertRaises(sqlite.OperationalError) as cm: con.execute("select 'a' as x union select 'b' as x order by x collate mycoll") - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - if not e.args[0].startswith("no such collation sequence"): - self.fail("wrong OperationalError raised") + self.assertEqual(str(cm.exception), 'no such collation sequence: mycoll') class ProgressTests(unittest.TestCase): def CheckProgressHandlerUsed(self): diff --git a/Lib/sqlite3/test/regression.py b/Lib/sqlite3/test/regression.py --- a/Lib/sqlite3/test/regression.py +++ b/Lib/sqlite3/test/regression.py @@ -170,14 +170,8 @@ con = sqlite.connect(":memory:") cur = Cursor(con) - try: + with self.assertRaises(sqlite.ProgrammingError): cur.execute("select 4+5").fetchall() - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("should have raised ProgrammingError") - def CheckStrSubclass(self): """ @@ -196,13 +190,8 @@ pass con = Connection(":memory:") - try: + with self.assertRaises(sqlite.ProgrammingError): cur = con.cursor() - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("should have raised ProgrammingError") def CheckCursorRegistration(self): """ @@ -223,13 +212,8 @@ cur.executemany("insert into foo(x) values (?)", [(3,), (4,), (5,)]) cur.execute("select x from foo") con.rollback() - try: + with self.assertRaises(sqlite.InterfaceError): cur.fetchall() - self.fail("should have raised InterfaceError") - except sqlite.InterfaceError: - pass - except: - self.fail("should have raised InterfaceError") def CheckAutoCommit(self): """ diff --git a/Lib/sqlite3/test/transactions.py b/Lib/sqlite3/test/transactions.py --- a/Lib/sqlite3/test/transactions.py +++ b/Lib/sqlite3/test/transactions.py @@ -118,13 +118,8 @@ return self.cur1.execute("create table test(i)") self.cur1.execute("insert into test(i) values (5)") - try: + with self.assertRaises(sqlite.OperationalError): self.cur2.execute("insert into test(i) values (5)") - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - pass - except: - self.fail("should have raised an OperationalError") def CheckLocking(self): """ @@ -137,13 +132,8 @@ return self.cur1.execute("create table test(i)") self.cur1.execute("insert into test(i) values (5)") - try: + with self.assertRaises(sqlite.OperationalError): self.cur2.execute("insert into test(i) values (5)") - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - pass - except: - self.fail("should have raised an OperationalError") # NO self.con2.rollback() HERE!!! self.con1.commit() @@ -159,13 +149,8 @@ cur.execute("select 1 union select 2 union select 3") con.rollback() - try: + with self.assertRaises(sqlite.InterfaceError): cur.fetchall() - self.fail("InterfaceError should have been raised") - except sqlite.InterfaceError as e: - pass - except: - self.fail("InterfaceError should have been raised") class SpecialCommandTests(unittest.TestCase): def setUp(self): diff --git a/Lib/sqlite3/test/types.py b/Lib/sqlite3/test/types.py --- a/Lib/sqlite3/test/types.py +++ b/Lib/sqlite3/test/types.py @@ -185,24 +185,14 @@ def CheckUnsupportedSeq(self): class Bar: pass val = Bar() - try: + with self.assertRaises(sqlite.InterfaceError): self.cur.execute("insert into test(f) values (?)", (val,)) - self.fail("should have raised an InterfaceError") - except sqlite.InterfaceError: - pass - except: - self.fail("should have raised an InterfaceError") def CheckUnsupportedDict(self): class Bar: pass val = Bar() - try: + with self.assertRaises(sqlite.InterfaceError): self.cur.execute("insert into test(f) values (:val)", {"val": val}) - self.fail("should have raised an InterfaceError") - except sqlite.InterfaceError: - pass - except: - self.fail("should have raised an InterfaceError") def CheckBlob(self): # default diff --git a/Lib/sqlite3/test/userfunctions.py b/Lib/sqlite3/test/userfunctions.py --- a/Lib/sqlite3/test/userfunctions.py +++ b/Lib/sqlite3/test/userfunctions.py @@ -162,11 +162,8 @@ self.con.close() def CheckFuncErrorOnCreate(self): - try: + with self.assertRaises(sqlite.OperationalError): self.con.create_function("bla", -100, lambda x: 2*x) - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - pass def CheckFuncRefCount(self): def getfunc(): @@ -231,12 +228,10 @@ def CheckFuncException(self): cur = self.con.cursor() - try: + with self.assertRaises(sqlite.OperationalError) as cm: cur.execute("select raiseexception()") cur.fetchone() - self.fail("should have raised OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0], 'user-defined function raised exception') + self.assertEqual(str(cm.exception), 'user-defined function raised exception') def CheckParamString(self): cur = self.con.cursor() @@ -312,55 +307,42 @@ pass def CheckAggrErrorOnCreate(self): - try: + with self.assertRaises(sqlite.OperationalError): self.con.create_function("bla", -100, AggrSum) - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - pass def CheckAggrNoStep(self): cur = self.con.cursor() - try: + with self.assertRaises(AttributeError) as cm: cur.execute("select nostep(t) from test") - self.fail("should have raised an AttributeError") - except AttributeError as e: - self.assertEqual(e.args[0], "'AggrNoStep' object has no attribute 'step'") + self.assertEqual(str(cm.exception), "'AggrNoStep' object has no attribute 'step'") def CheckAggrNoFinalize(self): cur = self.con.cursor() - try: + with self.assertRaises(sqlite.OperationalError) as cm: cur.execute("select nofinalize(t) from test") val = cur.fetchone()[0] - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0], "user-defined aggregate's 'finalize' method raised error") + self.assertEqual(str(cm.exception), "user-defined aggregate's 'finalize' method raised error") def CheckAggrExceptionInInit(self): cur = self.con.cursor() - try: + with self.assertRaises(sqlite.OperationalError) as cm: cur.execute("select excInit(t) from test") val = cur.fetchone()[0] - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0], "user-defined aggregate's '__init__' method raised error") + self.assertEqual(str(cm.exception), "user-defined aggregate's '__init__' method raised error") def CheckAggrExceptionInStep(self): cur = self.con.cursor() - try: + with self.assertRaises(sqlite.OperationalError) as cm: cur.execute("select excStep(t) from test") val = cur.fetchone()[0] - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0], "user-defined aggregate's 'step' method raised error") + self.assertEqual(str(cm.exception), "user-defined aggregate's 'step' method raised error") def CheckAggrExceptionInFinalize(self): cur = self.con.cursor() - try: + with self.assertRaises(sqlite.OperationalError) as cm: cur.execute("select excFinalize(t) from test") val = cur.fetchone()[0] - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0], "user-defined aggregate's 'finalize' method raised error") + self.assertEqual(str(cm.exception), "user-defined aggregate's 'finalize' method raised error") def CheckAggrCheckParamStr(self): cur = self.con.cursor() @@ -433,22 +415,14 @@ pass def test_table_access(self): - try: + with self.assertRaises(sqlite.DatabaseError) as cm: self.con.execute("select * from t2") - except sqlite.DatabaseError as e: - if not e.args[0].endswith("prohibited"): - self.fail("wrong exception text: %s" % e.args[0]) - return - self.fail("should have raised an exception due to missing privileges") + self.assertIn('prohibited', str(cm.exception)) def test_column_access(self): - try: + with self.assertRaises(sqlite.DatabaseError) as cm: self.con.execute("select c2 from t1") - except sqlite.DatabaseError as e: - if not e.args[0].endswith("prohibited"): - self.fail("wrong exception text: %s" % e.args[0]) - return - self.fail("should have raised an exception due to missing privileges") + self.assertIn('prohibited', str(cm.exception)) class AuthorizerRaiseExceptionTests(AuthorizerTests): @staticmethod -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 15:49:42 2016 From: python-checkins at python.org (terry.reedy) Date: Sun, 12 Jun 2016 19:49:42 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327239=3A_Continue?= =?utf-8?q?_refactoring_idlelib=2Emacosx_and_adding_macosx_tests=2E?= Message-ID: <20160612194937.99396.40775.160B0480@psf.io> https://hg.python.org/cpython/rev/d8a2b6efdd4a changeset: 101959:d8a2b6efdd4a user: Terry Jan Reedy date: Sun Jun 12 15:49:20 2016 -0400 summary: Issue #27239: Continue refactoring idlelib.macosx and adding macosx tests. files: Lib/idlelib/idle_test/htest.py | 2 - Lib/idlelib/idle_test/test_macosx.py | 42 +++++++++++++-- Lib/idlelib/macosx.py | 25 ++++++-- 3 files changed, 53 insertions(+), 16 deletions(-) diff --git a/Lib/idlelib/idle_test/htest.py b/Lib/idlelib/idle_test/htest.py --- a/Lib/idlelib/idle_test/htest.py +++ b/Lib/idlelib/idle_test/htest.py @@ -66,7 +66,6 @@ ''' from importlib import import_module -from idlelib.macosx import _init_tk_type import tkinter as tk from tkinter.ttk import Scrollbar @@ -338,7 +337,6 @@ root = tk.Tk() root.title('IDLE htest') root.resizable(0, 0) - _init_tk_type(root) # a scrollable Label like constant width text widget. frameLabel = tk.Frame(root, padx=10) diff --git a/Lib/idlelib/idle_test/test_macosx.py b/Lib/idlelib/idle_test/test_macosx.py --- a/Lib/idlelib/idle_test/test_macosx.py +++ b/Lib/idlelib/idle_test/test_macosx.py @@ -1,4 +1,6 @@ -'''Test idlelib.macosx.py +'''Test idlelib.macosx.py. + +Coverage: 71% on Windows. ''' from idlelib import macosx from test.support import requires @@ -6,8 +8,8 @@ import tkinter as tk import unittest import unittest.mock as mock +from idlelib.filelist import FileList -MAC = sys.platform == 'darwin' mactypes = {'carbon', 'cocoa', 'xquartz'} nontypes = {'other'} alltypes = mactypes | nontypes @@ -20,21 +22,23 @@ def setUpClass(cls): requires('gui') cls.root = tk.Tk() + cls.orig_platform = macosx.platform @classmethod def tearDownClass(cls): cls.root.update_idletasks() cls.root.destroy() del cls.root + macosx.platform = cls.orig_platform def test_init_sets_tktype(self): "Test that _init_tk_type sets _tk_type according to platform." - for root in (None, self.root): - with self.subTest(root=root): + for platform, types in ('darwin', alltypes), ('other', nontypes): + with self.subTest(platform=platform): + macosx.platform = platform macosx._tk_type == None - macosx._init_tk_type(root) - self.assertIn(macosx._tk_type, - mactypes if MAC else nontypes) + macosx._init_tk_type() + self.assertIn(macosx._tk_type, types) class IsTypeTkTest(unittest.TestCase): @@ -65,5 +69,29 @@ (func()) +class SetupTest(unittest.TestCase): + "Test setupApp." + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = tk.Tk() + + @classmethod + def tearDownClass(cls): + cls.root.update_idletasks() + cls.root.destroy() + del cls.root + + def test_setupapp(self): + "Call setupApp with each possible graphics type." + root = self.root + flist = FileList(root) + for tktype in alltypes: + with self.subTest(tktype=tktype): + macosx._tk_type = tktype + macosx.setupApp(root, flist) + + if __name__ == '__main__': unittest.main(verbosity=2) diff --git a/Lib/idlelib/macosx.py b/Lib/idlelib/macosx.py --- a/Lib/idlelib/macosx.py +++ b/Lib/idlelib/macosx.py @@ -1,20 +1,24 @@ """ A number of functions that enhance IDLE on Mac OSX. """ -import sys +from sys import platform # Used in _init_tk_type, changed by test. import tkinter import warnings + +## Define functions that query the Mac graphics type. +## _tk_type and its initializer are private to this section. + _tk_type = None -def _init_tk_type(idleroot=None): +def _init_tk_type(): """ Initializes OS X Tk variant values for isAquaTk(), isCarbonTk(), isCocoaTk(), and isXQuartz(). """ global _tk_type - if sys.platform == 'darwin': - root = idleroot or tkinter.Tk() + if platform == 'darwin': + root = tkinter.Tk() ws = root.tk.call('tk', 'windowingsystem') if 'x11' in ws: _tk_type = "xquartz" @@ -24,8 +28,7 @@ _tk_type = "cocoa" else: _tk_type = "carbon" - if not idleroot: - root.destroy + root.destroy() else: _tk_type = "other" @@ -62,6 +65,7 @@ _init_tk_type() return _tk_type == "xquartz" + def tkVersionWarning(root): """ Returns a string warning message if the Tk version in use appears to @@ -82,6 +86,9 @@ else: return False + +## Fix the menu and related functions. + def addOpenEventSupport(root, flist): """ This ensures that the application will respond to open AppleEvents, which @@ -233,9 +240,13 @@ isAquaTk(), isCarbonTk(), isCocoaTk(), isXQuartz() functions which are initialized here as well. """ - _init_tk_type(root) if isAquaTk(): hideTkConsole(root) overrideRootMenu(root, flist) addOpenEventSupport(root, flist) fixb2context(root) + + +if __name__ == '__main__': + from unittest import main + main('idlelib.idle_test.test_macosx', verbosity=2) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 16:21:28 2016 From: python-checkins at python.org (brett.cannon) Date: Sun, 12 Jun 2016 20:21:28 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327186=3A_add_Incl?= =?utf-8?q?ude/osmodule=2Eh_to_the_proper_build_rules?= Message-ID: <20160612202127.11607.29221.3B92F570@psf.io> https://hg.python.org/cpython/rev/1ccd6196115a changeset: 101960:1ccd6196115a user: Brett Cannon date: Sun Jun 12 13:21:22 2016 -0700 summary: Issue #27186: add Include/osmodule.h to the proper build rules files: Makefile.pre.in | 1 + PCbuild/pythoncore.vcxproj | 3 ++- PCbuild/pythoncore.vcxproj.filters | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -943,6 +943,7 @@ $(srcdir)/Include/objimpl.h \ $(OPCODE_H) \ $(srcdir)/Include/osdefs.h \ + $(srcdir)/Include/osmodule.h \ $(srcdir)/Include/patchlevel.h \ $(srcdir)/Include/pgen.h \ $(srcdir)/Include/pgenheaders.h \ diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -124,6 +124,7 @@ + @@ -417,4 +418,4 @@ - \ No newline at end of file + diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters --- a/PCbuild/pythoncore.vcxproj.filters +++ b/PCbuild/pythoncore.vcxproj.filters @@ -177,6 +177,9 @@ Include + + Include + Include @@ -983,4 +986,4 @@ Resource Files - \ No newline at end of file + -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 16:23:20 2016 From: python-checkins at python.org (brett.cannon) Date: Sun, 12 Jun 2016 20:23:20 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Ignore_the_VS_Code_config_?= =?utf-8?q?directory?= Message-ID: <20160612202319.28057.21898.4A5D48EE@psf.io> https://hg.python.org/cpython/rev/0b18f7d262cc changeset: 101961:0b18f7d262cc user: Brett Cannon date: Sun Jun 12 13:23:15 2016 -0700 summary: Ignore the VS Code config directory files: .gitignore | 1 + .hgignore | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) diff --git a/.gitignore b/.gitignore --- a/.gitignore +++ b/.gitignore @@ -93,3 +93,4 @@ Tools/msi/obj Tools/ssl/amd64 Tools/ssl/win32 +.vscode/ diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -2,6 +2,7 @@ .purify .svn/ ^.idea/ +^.vscode/ .DS_Store Makefile$ Makefile.pre$ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 23:30:04 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 13 Jun 2016 03:30:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Updated_header?= =?utf-8?q?_for_README_for_3=2E5=2E2rc1=2E?= Message-ID: <20160613033004.11395.25549.2BFDFF47@psf.io> https://hg.python.org/cpython/rev/68feec6488b2 changeset: 101964:68feec6488b2 branch: 3.5 tag: v3.5.2rc1 user: Larry Hastings date: Sat Jun 11 20:55:08 2016 -0700 summary: Updated header for README for 3.5.2rc1. files: README | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README b/README --- a/README +++ b/README @@ -1,5 +1,5 @@ -This is Python version 3.5.2 -============================ +This is Python version 3.5.2 release candidate 1 +================================================ Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Python Software Foundation. All rights reserved. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 23:30:04 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 13 Jun 2016 03:30:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Added_tag_v3?= =?utf-8?q?=2E5=2E2rc1_for_changeset_68feec6488b2?= Message-ID: <20160613033004.26001.83073.A158CA2B@psf.io> https://hg.python.org/cpython/rev/ffb4a456a70d changeset: 101965:ffb4a456a70d branch: 3.5 user: Larry Hastings date: Sat Jun 11 20:55:23 2016 -0700 summary: Added tag v3.5.2rc1 for changeset 68feec6488b2 files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -161,3 +161,4 @@ 374f501f4567b7595f2ad7798aa09afa2456bb28 v3.5.0 948ef16a69513ba1ff15c9d7d0b012b949df4c80 v3.5.1rc1 37a07cee5969e6d3672583187a73cf636ff28e1b v3.5.1 +68feec6488b26327a85a634605dd28eca4daa5f1 v3.5.2rc1 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 23:30:05 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 13 Jun 2016 03:30:05 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Post-release_f?= =?utf-8?q?ixups_for_Python_3=2E5=2E2rc1=2E?= Message-ID: <20160613033004.87602.14647.26E59DD4@psf.io> https://hg.python.org/cpython/rev/3428e51f47aa changeset: 101966:3428e51f47aa branch: 3.5 user: Larry Hastings date: Sun Jun 12 20:22:18 2016 -0700 summary: Post-release fixups for Python 3.5.2rc1. files: Include/patchlevel.h | 2 +- Misc/NEWS | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -23,7 +23,7 @@ #define PY_RELEASE_SERIAL 1 /* Version as a string */ -#define PY_VERSION "3.5.2rc1" +#define PY_VERSION "3.5.2rc1+" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,10 +2,22 @@ Python News +++++++++++ +What's New in Python 3.5.2 final? +================================= + +Release date: 2016-06-26 + +Core and Builtins +----------------- + +Library +------- + + What's New in Python 3.5.2 release candidate 1? =============================================== -Release date: 2016/06/12 +Release date: 2016-06-12 Core and Builtins ----------------- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 23:30:05 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 13 Jun 2016 03:30:05 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Release_bump_f?= =?utf-8?b?b3IgMy41LjJyYzEu?= Message-ID: <20160613033004.114484.84006.329E9151@psf.io> https://hg.python.org/cpython/rev/f7c300c37a1b changeset: 101963:f7c300c37a1b branch: 3.5 user: Larry Hastings date: Sat Jun 11 20:51:22 2016 -0700 summary: Release bump for 3.5.2rc1. files: Include/patchlevel.h | 8 ++++---- Misc/NEWS | 2 +- README | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -18,12 +18,12 @@ /*--start constants--*/ #define PY_MAJOR_VERSION 3 #define PY_MINOR_VERSION 5 -#define PY_MICRO_VERSION 1 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL -#define PY_RELEASE_SERIAL 0 +#define PY_MICRO_VERSION 2 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA +#define PY_RELEASE_SERIAL 1 /* Version as a string */ -#define PY_VERSION "3.5.1+" +#define PY_VERSION "3.5.2rc1" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -5,7 +5,7 @@ What's New in Python 3.5.2 release candidate 1? =============================================== -Release date: tba +Release date: 2016/06/12 Core and Builtins ----------------- diff --git a/README b/README --- a/README +++ b/README @@ -1,4 +1,4 @@ -This is Python version 3.5.1 +This is Python version 3.5.2 ============================ Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 23:30:05 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 13 Jun 2016 03:30:05 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNSk6?= =?utf-8?q?_Merge_3=2E5=2E2rc1_with_current_3=2E5_branch=2E?= Message-ID: <20160613033005.101632.96052.2468E02E@psf.io> https://hg.python.org/cpython/rev/adc6fed9fe5d changeset: 101967:adc6fed9fe5d branch: 3.5 parent: 101966:3428e51f47aa parent: 101957:4d21f005c02b user: Larry Hastings date: Sun Jun 12 20:26:28 2016 -0700 summary: Merge 3.5.2rc1 with current 3.5 branch. files: Doc/c-api/structures.rst | 5 +- Doc/library/multiprocessing.rst | 9 +- Doc/library/sqlite3.rst | 37 +- Doc/whatsnew/2.0.rst | 2 +- Lib/importlib/_bootstrap_external.py | 3 +- Lib/lib2to3/tests/test_refactor.py | 5 +- Lib/pydoc.py | 5 +- Lib/sqlite3/test/dbapi.py | 190 +++---------- Lib/sqlite3/test/hooks.py | 28 +- Lib/sqlite3/test/regression.py | 22 +- Lib/sqlite3/test/transactions.py | 21 +- Lib/sqlite3/test/types.py | 14 +- Lib/sqlite3/test/userfunctions.py | 62 +--- Lib/test/support/__init__.py | 3 +- Lib/test/test_coroutines.py | 2 +- Lib/test/test_extcall.py | 4 + Lib/test/test_functools.py | 61 ++++ Lib/test/test_pydoc.py | 2 +- Lib/test/test_unpack_ex.py | 5 + Lib/test/test_xml_etree.py | 8 +- Misc/NEWS | 30 ++- Modules/_elementtree.c | 19 +- Modules/_functoolsmodule.c | 39 +- Modules/_sqlite/connection.c | 4 + Modules/_sqlite/module.h | 2 +- PC/launcher.c | 2 +- Python/compile.c | 2 +- Python/importlib_external.h | 208 +++++++------- 28 files changed, 370 insertions(+), 424 deletions(-) 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 @@ -150,9 +150,8 @@ The :attr:`ml_flags` field is a bitfield which can include the following flags. The individual flags indicate either a calling convention or a binding convention. Of the calling convention flags, only :const:`METH_VARARGS` and -:const:`METH_KEYWORDS` can be combined (but note that :const:`METH_KEYWORDS` -alone is equivalent to ``METH_VARARGS | METH_KEYWORDS``). Any of the calling -convention flags can be combined with a binding flag. +:const:`METH_KEYWORDS` can be combined. Any of the calling convention flags +can be combined with a binding flag. .. data:: METH_VARARGS diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -1010,7 +1010,7 @@ using :meth:`recv`. The object must be picklable. Very large pickles (approximately 32 MB+, - though it depends on the OS) may raise a ValueError exception. + though it depends on the OS) may raise a :exc:`ValueError` exception. .. method:: recv() @@ -2723,12 +2723,7 @@ More picklability - Ensure that all arguments to :meth:`Process.__init__` are - picklable. This means, in particular, that bound or unbound - methods cannot be used directly as the ``target`` (unless you use - the *fork* start method) --- just define a function and use that - instead. - + Ensure that all arguments to :meth:`Process.__init__` are picklable. Also, if you subclass :class:`~multiprocessing.Process` then make sure that instances will be picklable when the :meth:`Process.start ` method is called. diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -309,25 +309,26 @@ call :meth:`commit`. If you just close your database connection without calling :meth:`commit` first, your changes will be lost! - .. method:: execute(sql, [parameters]) + .. method:: execute(sql[, parameters]) - This is a nonstandard shortcut that creates an intermediate cursor object by - calling the cursor method, then calls the cursor's :meth:`execute - ` method with the parameters given. + This is a nonstandard shortcut that creates a cursor object by calling + the :meth:`~Connection.cursor` method, calls the cursor's + :meth:`~Cursor.execute` method with the *parameters* given, and returns + the cursor. + .. method:: executemany(sql[, parameters]) - .. method:: executemany(sql, [parameters]) - - This is a nonstandard shortcut that creates an intermediate cursor object by - calling the cursor method, then calls the cursor's :meth:`executemany - ` method with the parameters given. + This is a nonstandard shortcut that creates a cursor object by + calling the :meth:`~Connection.cursor` method, calls the cursor's + :meth:`~Cursor.executemany` method with the *parameters* given, and + returns the cursor. .. method:: executescript(sql_script) - This is a nonstandard shortcut that creates an intermediate cursor object by - calling the cursor method, then calls the cursor's :meth:`executescript - ` method with the parameters given. - + This is a nonstandard shortcut that creates a cursor object by + calling the :meth:`~Connection.cursor` method, calls the cursor's + :meth:`~Cursor.executescript` method with the given *sql_script*, and + returns the cursor. .. method:: create_function(name, num_params, func) @@ -533,7 +534,7 @@ A :class:`Cursor` instance has the following attributes and methods. - .. method:: execute(sql, [parameters]) + .. method:: execute(sql[, parameters]) Executes an SQL statement. The SQL statement may be parameterized (i. e. placeholders instead of SQL literals). The :mod:`sqlite3` module supports two @@ -545,7 +546,7 @@ .. literalinclude:: ../includes/sqlite3/execute_1.py :meth:`execute` will only execute a single SQL statement. If you try to execute - more than one statement with it, it will raise a Warning. Use + more than one statement with it, it will raise an ``sqlite3.Warning``. Use :meth:`executescript` if you want to execute multiple SQL statements with one call. @@ -553,8 +554,8 @@ .. method:: executemany(sql, seq_of_parameters) Executes an SQL command against all parameter sequences or mappings found in - the sequence *sql*. The :mod:`sqlite3` module also allows using an - :term:`iterator` yielding parameters instead of a sequence. + the sequence *seq_of_parameters*. The :mod:`sqlite3` module also allows + using an :term:`iterator` yielding parameters instead of a sequence. .. literalinclude:: ../includes/sqlite3/executemany_1.py @@ -569,7 +570,7 @@ at once. It issues a ``COMMIT`` statement first, then executes the SQL script it gets as a parameter. - *sql_script* can be an instance of :class:`str` or :class:`bytes`. + *sql_script* can be an instance of :class:`str`. Example: diff --git a/Doc/whatsnew/2.0.rst b/Doc/whatsnew/2.0.rst --- a/Doc/whatsnew/2.0.rst +++ b/Doc/whatsnew/2.0.rst @@ -506,7 +506,7 @@ you'd use the :func:`apply` built-in function: ``apply(f, args, kw)`` calls the function :func:`f` with the argument tuple *args* and the keyword arguments in the dictionary *kw*. :func:`apply` is the same in 2.0, but thanks to a patch -from Greg Ewing, ``f(*args, **kw)`` as a shorter and clearer way to achieve the +from Greg Ewing, ``f(*args, **kw)`` is a shorter and clearer way to achieve the same effect. This syntax is symmetrical with the syntax for defining functions:: diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -223,6 +223,7 @@ # Python 3.5b1 3330 (PEP 448: Additional Unpacking Generalizations) # Python 3.5b2 3340 (fix dictionary display evaluation order #11205) # Python 3.5b2 3350 (add GET_YIELD_FROM_ITER opcode #24400) +# Python 3.5.2 3351 (fix BUILD_MAP_UNPACK_WITH_CALL opcode #27286) # # MAGIC must change whenever the bytecode emitted by the compiler may no # longer be understood by older implementations of the eval loop (usually @@ -231,7 +232,7 @@ # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3350).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3351).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/lib2to3/tests/test_refactor.py b/Lib/lib2to3/tests/test_refactor.py --- a/Lib/lib2to3/tests/test_refactor.py +++ b/Lib/lib2to3/tests/test_refactor.py @@ -9,6 +9,7 @@ import codecs import operator import io +import re import tempfile import shutil import unittest @@ -226,8 +227,8 @@ actually_write=False) # Testing that it logged this message when write=False was passed is # sufficient to see that it did not bail early after "No changes". - message_regex = r"Not writing changes to .*%s%s" % ( - os.sep, os.path.basename(test_file)) + message_regex = r"Not writing changes to .*%s" % \ + re.escape(os.sep + os.path.basename(test_file)) for message in debug_messages: if "Not writing changes" in message: self.assertRegex(message, message_regex) diff --git a/Lib/pydoc.py b/Lib/pydoc.py --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -28,7 +28,7 @@ Module docs for core modules are assumed to be in - http://docs.python.org/X.Y/library/ + https://docs.python.org/X.Y/library/ This can be overridden by setting the PYTHONDOCS environment variable to a different URL or to a local directory containing the Library @@ -395,6 +395,7 @@ docloc = os.environ.get("PYTHONDOCS", self.PYTHONDOCS) + basedir = os.path.normcase(basedir) if (isinstance(object, type(os)) and (object.__name__ in ('errno', 'exceptions', 'gc', 'imp', 'marshal', 'posix', 'signal', 'sys', @@ -402,7 +403,7 @@ (file.startswith(basedir) and not file.startswith(os.path.join(basedir, 'site-packages')))) and object.__name__ not in ('xml.etree', 'test.pydoc_mod')): - if docloc.startswith("http://"): + if docloc.startswith(("http://", "https://")): docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__.lower()) else: docloc = os.path.join(docloc, object.__name__.lower() + ".html") diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py --- a/Lib/sqlite3/test/dbapi.py +++ b/Lib/sqlite3/test/dbapi.py @@ -122,11 +122,8 @@ def CheckFailedOpen(self): YOU_CANNOT_OPEN_THIS = "/foo/bar/bla/23534/mydb.db" - try: + with self.assertRaises(sqlite.OperationalError): con = sqlite.connect(YOU_CANNOT_OPEN_THIS) - except sqlite.OperationalError: - return - self.fail("should have raised an OperationalError") def CheckClose(self): self.cx.close() @@ -180,6 +177,12 @@ with self.assertRaises(sqlite.OperationalError): cx.execute('insert into test(id) values(1)') + def CheckSameThreadErrorOnOldVersion(self): + if sqlite.sqlite_version_info >= (3, 3, 1): + self.skipTest('test needs sqlite3 versions older than 3.3.1') + with self.assertRaises(sqlite.NotSupportedError) as cm: + sqlite.connect(':memory:', check_same_thread=False) + self.assertEqual(str(cm.exception), 'shared connections not available') class CursorTests(unittest.TestCase): def setUp(self): @@ -196,22 +199,12 @@ self.cu.execute("delete from test") def CheckExecuteIllegalSql(self): - try: + with self.assertRaises(sqlite.OperationalError): self.cu.execute("select asdf") - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - return - except: - self.fail("raised wrong exception") def CheckExecuteTooMuchSql(self): - try: + with self.assertRaises(sqlite.Warning): self.cu.execute("select 5+4; select 4+5") - self.fail("should have raised a Warning") - except sqlite.Warning: - return - except: - self.fail("raised wrong exception") def CheckExecuteTooMuchSql2(self): self.cu.execute("select 5+4; -- foo bar") @@ -226,13 +219,8 @@ """) def CheckExecuteWrongSqlArg(self): - try: + with self.assertRaises(ValueError): self.cu.execute(42) - self.fail("should have raised a ValueError") - except ValueError: - return - except: - self.fail("raised wrong exception.") def CheckExecuteArgInt(self): self.cu.execute("insert into test(id) values (?)", (42,)) @@ -250,29 +238,25 @@ row = self.cu.fetchone() self.assertEqual(row[0], "Hu\x00go") + def CheckExecuteNonIterable(self): + with self.assertRaises(ValueError) as cm: + self.cu.execute("insert into test(id) values (?)", 42) + self.assertEqual(str(cm.exception), 'parameters are of unsupported type') + def CheckExecuteWrongNoOfArgs1(self): # too many parameters - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("insert into test(id) values (?)", (17, "Egon")) - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckExecuteWrongNoOfArgs2(self): # too little parameters - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("insert into test(id) values (?)") - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckExecuteWrongNoOfArgs3(self): # no parameters, parameters are needed - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("insert into test(id) values (?)") - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckExecuteParamList(self): self.cu.execute("insert into test(name) values ('foo')") @@ -311,27 +295,18 @@ def CheckExecuteDictMappingTooLittleArgs(self): self.cu.execute("insert into test(name) values ('foo')") - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("select name from test where name=:name and id=:id", {"name": "foo"}) - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckExecuteDictMappingNoArgs(self): self.cu.execute("insert into test(name) values ('foo')") - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("select name from test where name=:name") - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckExecuteDictMappingUnnamed(self): self.cu.execute("insert into test(name) values ('foo')") - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("select name from test where name=?", {"name": "foo"}) - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckClose(self): self.cu.close() @@ -392,32 +367,16 @@ self.cu.executemany("insert into test(income) values (?)", mygen()) def CheckExecuteManyWrongSqlArg(self): - try: + with self.assertRaises(ValueError): self.cu.executemany(42, [(3,)]) - self.fail("should have raised a ValueError") - except ValueError: - return - except: - self.fail("raised wrong exception.") def CheckExecuteManySelect(self): - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.executemany("select ?", [(3,)]) - self.fail("should have raised a ProgrammingError") - except sqlite.ProgrammingError: - return - except: - self.fail("raised wrong exception.") def CheckExecuteManyNotIterable(self): - try: + with self.assertRaises(TypeError): self.cu.executemany("insert into test(income) values (?)", 42) - self.fail("should have raised a TypeError") - except TypeError: - return - except Exception as e: - print("raised", e.__class__) - self.fail("raised wrong exception.") def CheckFetchIter(self): # Optional DB-API extension. @@ -494,22 +453,15 @@ self.assertEqual(self.cu.connection, self.cx) def CheckWrongCursorCallable(self): - try: + with self.assertRaises(TypeError): def f(): pass cur = self.cx.cursor(f) - self.fail("should have raised a TypeError") - except TypeError: - return - self.fail("should have raised a ValueError") def CheckCursorWrongClass(self): class Foo: pass foo = Foo() - try: + with self.assertRaises(TypeError): cur = sqlite.Cursor(foo) - self.fail("should have raised a ValueError") - except TypeError: - pass @unittest.skipUnless(threading, 'This test requires threading.') class ThreadTests(unittest.TestCase): @@ -708,22 +660,21 @@ def CheckScriptSyntaxError(self): con = sqlite.connect(":memory:") cur = con.cursor() - raised = False - try: + with self.assertRaises(sqlite.OperationalError): cur.executescript("create table test(x); asdf; create table test2(x)") - except sqlite.OperationalError: - raised = True - self.assertEqual(raised, True, "should have raised an exception") def CheckScriptErrorNormal(self): con = sqlite.connect(":memory:") cur = con.cursor() - raised = False - try: + with self.assertRaises(sqlite.OperationalError): cur.executescript("create table test(sadfsadfdsa); select foo from hurz;") - except sqlite.OperationalError: - raised = True - self.assertEqual(raised, True, "should have raised an exception") + + def CheckCursorExecutescriptAsBytes(self): + con = sqlite.connect(":memory:") + cur = con.cursor() + with self.assertRaises(ValueError) as cm: + cur.executescript(b"create table test(foo); insert into test(foo) values (5);") + self.assertEqual(str(cm.exception), 'script argument must be unicode.') def CheckConnectionExecute(self): con = sqlite.connect(":memory:") @@ -754,59 +705,34 @@ def CheckClosedConCursor(self): con = sqlite.connect(":memory:") con.close() - try: + with self.assertRaises(sqlite.ProgrammingError): cur = con.cursor() - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedConCommit(self): con = sqlite.connect(":memory:") con.close() - try: + with self.assertRaises(sqlite.ProgrammingError): con.commit() - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedConRollback(self): con = sqlite.connect(":memory:") con.close() - try: + with self.assertRaises(sqlite.ProgrammingError): con.rollback() - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedCurExecute(self): con = sqlite.connect(":memory:") cur = con.cursor() con.close() - try: + with self.assertRaises(sqlite.ProgrammingError): cur.execute("select 4") - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedCreateFunction(self): con = sqlite.connect(":memory:") con.close() def f(x): return 17 - try: + with self.assertRaises(sqlite.ProgrammingError): con.create_function("foo", 1, f) - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedCreateAggregate(self): con = sqlite.connect(":memory:") @@ -818,49 +744,29 @@ pass def finalize(self): return 17 - try: + with self.assertRaises(sqlite.ProgrammingError): con.create_aggregate("foo", 1, Agg) - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedSetAuthorizer(self): con = sqlite.connect(":memory:") con.close() def authorizer(*args): return sqlite.DENY - try: + with self.assertRaises(sqlite.ProgrammingError): con.set_authorizer(authorizer) - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedSetProgressCallback(self): con = sqlite.connect(":memory:") con.close() def progress(): pass - try: + with self.assertRaises(sqlite.ProgrammingError): con.set_progress_handler(progress, 100) - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedCall(self): con = sqlite.connect(":memory:") con.close() - try: + with self.assertRaises(sqlite.ProgrammingError): con() - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") class ClosedCurTests(unittest.TestCase): def setUp(self): @@ -882,15 +788,9 @@ else: params = [] - try: + with self.assertRaises(sqlite.ProgrammingError): method = getattr(cur, method_name) - method(*params) - self.fail("Should have raised a ProgrammingError: method " + method_name) - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError: " + method_name) def suite(): module_suite = unittest.makeSuite(ModuleTests, "Check") diff --git a/Lib/sqlite3/test/hooks.py b/Lib/sqlite3/test/hooks.py --- a/Lib/sqlite3/test/hooks.py +++ b/Lib/sqlite3/test/hooks.py @@ -33,19 +33,14 @@ def CheckCreateCollationNotCallable(self): con = sqlite.connect(":memory:") - try: + with self.assertRaises(TypeError) as cm: con.create_collation("X", 42) - self.fail("should have raised a TypeError") - except TypeError as e: - self.assertEqual(e.args[0], "parameter must be callable") + self.assertEqual(str(cm.exception), 'parameter must be callable') def CheckCreateCollationNotAscii(self): con = sqlite.connect(":memory:") - try: + with self.assertRaises(sqlite.ProgrammingError): con.create_collation("coll?", lambda x, y: (x > y) - (x < y)) - self.fail("should have raised a ProgrammingError") - except sqlite.ProgrammingError as e: - pass @unittest.skipIf(sqlite.sqlite_version_info < (3, 2, 1), 'old SQLite versions crash on this test') @@ -70,11 +65,9 @@ self.fail("the expected order was not returned") con.create_collation("mycoll", None) - try: + with self.assertRaises(sqlite.OperationalError) as cm: result = con.execute(sql).fetchall() - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0].lower(), "no such collation sequence: mycoll") + self.assertEqual(str(cm.exception), 'no such collation sequence: mycoll') def CheckCollationReturnsLargeInteger(self): def mycoll(x, y): @@ -106,8 +99,8 @@ result = con.execute(""" select x from (select 'a' as x union select 'b' as x) order by x collate mycoll """).fetchall() - if result[0][0] != 'b' or result[1][0] != 'a': - self.fail("wrong collation function is used") + self.assertEqual(result[0][0], 'b') + self.assertEqual(result[1][0], 'a') def CheckDeregisterCollation(self): """ @@ -117,12 +110,9 @@ con = sqlite.connect(":memory:") con.create_collation("mycoll", lambda x, y: (x > y) - (x < y)) con.create_collation("mycoll", None) - try: + with self.assertRaises(sqlite.OperationalError) as cm: con.execute("select 'a' as x union select 'b' as x order by x collate mycoll") - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - if not e.args[0].startswith("no such collation sequence"): - self.fail("wrong OperationalError raised") + self.assertEqual(str(cm.exception), 'no such collation sequence: mycoll') class ProgressTests(unittest.TestCase): def CheckProgressHandlerUsed(self): diff --git a/Lib/sqlite3/test/regression.py b/Lib/sqlite3/test/regression.py --- a/Lib/sqlite3/test/regression.py +++ b/Lib/sqlite3/test/regression.py @@ -170,14 +170,8 @@ con = sqlite.connect(":memory:") cur = Cursor(con) - try: + with self.assertRaises(sqlite.ProgrammingError): cur.execute("select 4+5").fetchall() - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("should have raised ProgrammingError") - def CheckStrSubclass(self): """ @@ -196,13 +190,8 @@ pass con = Connection(":memory:") - try: + with self.assertRaises(sqlite.ProgrammingError): cur = con.cursor() - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("should have raised ProgrammingError") def CheckCursorRegistration(self): """ @@ -223,13 +212,8 @@ cur.executemany("insert into foo(x) values (?)", [(3,), (4,), (5,)]) cur.execute("select x from foo") con.rollback() - try: + with self.assertRaises(sqlite.InterfaceError): cur.fetchall() - self.fail("should have raised InterfaceError") - except sqlite.InterfaceError: - pass - except: - self.fail("should have raised InterfaceError") def CheckAutoCommit(self): """ diff --git a/Lib/sqlite3/test/transactions.py b/Lib/sqlite3/test/transactions.py --- a/Lib/sqlite3/test/transactions.py +++ b/Lib/sqlite3/test/transactions.py @@ -118,13 +118,8 @@ return self.cur1.execute("create table test(i)") self.cur1.execute("insert into test(i) values (5)") - try: + with self.assertRaises(sqlite.OperationalError): self.cur2.execute("insert into test(i) values (5)") - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - pass - except: - self.fail("should have raised an OperationalError") def CheckLocking(self): """ @@ -137,13 +132,8 @@ return self.cur1.execute("create table test(i)") self.cur1.execute("insert into test(i) values (5)") - try: + with self.assertRaises(sqlite.OperationalError): self.cur2.execute("insert into test(i) values (5)") - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - pass - except: - self.fail("should have raised an OperationalError") # NO self.con2.rollback() HERE!!! self.con1.commit() @@ -159,13 +149,8 @@ cur.execute("select 1 union select 2 union select 3") con.rollback() - try: + with self.assertRaises(sqlite.InterfaceError): cur.fetchall() - self.fail("InterfaceError should have been raised") - except sqlite.InterfaceError as e: - pass - except: - self.fail("InterfaceError should have been raised") class SpecialCommandTests(unittest.TestCase): def setUp(self): diff --git a/Lib/sqlite3/test/types.py b/Lib/sqlite3/test/types.py --- a/Lib/sqlite3/test/types.py +++ b/Lib/sqlite3/test/types.py @@ -185,24 +185,14 @@ def CheckUnsupportedSeq(self): class Bar: pass val = Bar() - try: + with self.assertRaises(sqlite.InterfaceError): self.cur.execute("insert into test(f) values (?)", (val,)) - self.fail("should have raised an InterfaceError") - except sqlite.InterfaceError: - pass - except: - self.fail("should have raised an InterfaceError") def CheckUnsupportedDict(self): class Bar: pass val = Bar() - try: + with self.assertRaises(sqlite.InterfaceError): self.cur.execute("insert into test(f) values (:val)", {"val": val}) - self.fail("should have raised an InterfaceError") - except sqlite.InterfaceError: - pass - except: - self.fail("should have raised an InterfaceError") def CheckBlob(self): # default diff --git a/Lib/sqlite3/test/userfunctions.py b/Lib/sqlite3/test/userfunctions.py --- a/Lib/sqlite3/test/userfunctions.py +++ b/Lib/sqlite3/test/userfunctions.py @@ -162,11 +162,8 @@ self.con.close() def CheckFuncErrorOnCreate(self): - try: + with self.assertRaises(sqlite.OperationalError): self.con.create_function("bla", -100, lambda x: 2*x) - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - pass def CheckFuncRefCount(self): def getfunc(): @@ -231,12 +228,10 @@ def CheckFuncException(self): cur = self.con.cursor() - try: + with self.assertRaises(sqlite.OperationalError) as cm: cur.execute("select raiseexception()") cur.fetchone() - self.fail("should have raised OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0], 'user-defined function raised exception') + self.assertEqual(str(cm.exception), 'user-defined function raised exception') def CheckParamString(self): cur = self.con.cursor() @@ -312,55 +307,42 @@ pass def CheckAggrErrorOnCreate(self): - try: + with self.assertRaises(sqlite.OperationalError): self.con.create_function("bla", -100, AggrSum) - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - pass def CheckAggrNoStep(self): cur = self.con.cursor() - try: + with self.assertRaises(AttributeError) as cm: cur.execute("select nostep(t) from test") - self.fail("should have raised an AttributeError") - except AttributeError as e: - self.assertEqual(e.args[0], "'AggrNoStep' object has no attribute 'step'") + self.assertEqual(str(cm.exception), "'AggrNoStep' object has no attribute 'step'") def CheckAggrNoFinalize(self): cur = self.con.cursor() - try: + with self.assertRaises(sqlite.OperationalError) as cm: cur.execute("select nofinalize(t) from test") val = cur.fetchone()[0] - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0], "user-defined aggregate's 'finalize' method raised error") + self.assertEqual(str(cm.exception), "user-defined aggregate's 'finalize' method raised error") def CheckAggrExceptionInInit(self): cur = self.con.cursor() - try: + with self.assertRaises(sqlite.OperationalError) as cm: cur.execute("select excInit(t) from test") val = cur.fetchone()[0] - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0], "user-defined aggregate's '__init__' method raised error") + self.assertEqual(str(cm.exception), "user-defined aggregate's '__init__' method raised error") def CheckAggrExceptionInStep(self): cur = self.con.cursor() - try: + with self.assertRaises(sqlite.OperationalError) as cm: cur.execute("select excStep(t) from test") val = cur.fetchone()[0] - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0], "user-defined aggregate's 'step' method raised error") + self.assertEqual(str(cm.exception), "user-defined aggregate's 'step' method raised error") def CheckAggrExceptionInFinalize(self): cur = self.con.cursor() - try: + with self.assertRaises(sqlite.OperationalError) as cm: cur.execute("select excFinalize(t) from test") val = cur.fetchone()[0] - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0], "user-defined aggregate's 'finalize' method raised error") + self.assertEqual(str(cm.exception), "user-defined aggregate's 'finalize' method raised error") def CheckAggrCheckParamStr(self): cur = self.con.cursor() @@ -433,22 +415,14 @@ pass def test_table_access(self): - try: + with self.assertRaises(sqlite.DatabaseError) as cm: self.con.execute("select * from t2") - except sqlite.DatabaseError as e: - if not e.args[0].endswith("prohibited"): - self.fail("wrong exception text: %s" % e.args[0]) - return - self.fail("should have raised an exception due to missing privileges") + self.assertIn('prohibited', str(cm.exception)) def test_column_access(self): - try: + with self.assertRaises(sqlite.DatabaseError) as cm: self.con.execute("select c2 from t1") - except sqlite.DatabaseError as e: - if not e.args[0].endswith("prohibited"): - self.fail("wrong exception text: %s" % e.args[0]) - return - self.fail("should have raised an exception due to missing privileges") + self.assertIn('prohibited', str(cm.exception)) class AuthorizerRaiseExceptionTests(AuthorizerTests): @staticmethod diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -1349,7 +1349,8 @@ 500 <= err.code <= 599) or (isinstance(err, urllib.error.URLError) and (("ConnectionRefusedError" in err.reason) or - ("TimeoutError" in err.reason))) or + ("TimeoutError" in err.reason) or + ("EOFError" in err.reason))) or n in captured_errnos): if not verbose: sys.stderr.write(denied.args[0] + "\n") diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py --- a/Lib/test/test_coroutines.py +++ b/Lib/test/test_coroutines.py @@ -1423,7 +1423,7 @@ with warnings.catch_warnings(): warnings.simplefilter("error") - # Test that __aiter__ that returns an asyncronous iterator + # Test that __aiter__ that returns an asynchronous iterator # directly does not throw any warnings. run_async(main()) self.assertEqual(I, 111011) diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py --- a/Lib/test/test_extcall.py +++ b/Lib/test/test_extcall.py @@ -57,6 +57,10 @@ Traceback (most recent call last): ... TypeError: f() got multiple values for keyword argument 'a' + >>> f(1, 2, a=3, **{'a': 4}, **{'a': 5}) + Traceback (most recent call last): + ... + TypeError: f() got multiple values for keyword argument 'a' >>> f(1, 2, 3, *[4, 5], **{'a':6, 'b':7}) (1, 2, 3, 4, 5) {'a': 6, 'b': 7} >>> f(1, 2, 3, x=4, y=5, *(6, 7), **{'a':8, 'b': 9}) diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -217,6 +217,33 @@ ['{}({!r}, {}, {})'.format(name, capture, args_repr, kwargs_repr) for kwargs_repr in kwargs_reprs]) + def test_recursive_repr(self): + if self.partial is c_functools.partial: + name = 'functools.partial' + else: + name = self.partial.__name__ + + f = self.partial(capture) + f.__setstate__((f, (), {}, {})) + try: + self.assertEqual(repr(f), '%s(%s(...))' % (name, name)) + finally: + f.__setstate__((capture, (), {}, {})) + + f = self.partial(capture) + f.__setstate__((capture, (f,), {}, {})) + try: + self.assertEqual(repr(f), '%s(%r, %s(...))' % (name, capture, name)) + finally: + f.__setstate__((capture, (), {}, {})) + + f = self.partial(capture) + f.__setstate__((capture, (), {'a': f}, {})) + try: + self.assertEqual(repr(f), '%s(%r, a=%s(...))' % (name, capture, name)) + finally: + f.__setstate__((capture, (), {}, {})) + def test_pickle(self): f = self.partial(signature, ['asdf'], bar=[True]) f.attr = [] @@ -297,6 +324,40 @@ self.assertEqual(r, ((1, 2), {})) self.assertIs(type(r[0]), tuple) + def test_recursive_pickle(self): + f = self.partial(capture) + f.__setstate__((f, (), {}, {})) + try: + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + with self.assertRaises(RecursionError): + pickle.dumps(f, proto) + finally: + f.__setstate__((capture, (), {}, {})) + + f = self.partial(capture) + f.__setstate__((capture, (f,), {}, {})) + try: + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + f_copy = pickle.loads(pickle.dumps(f, proto)) + try: + self.assertIs(f_copy.args[0], f_copy) + finally: + f_copy.__setstate__((capture, (), {}, {})) + finally: + f.__setstate__((capture, (), {}, {})) + + f = self.partial(capture) + f.__setstate__((capture, (), {'a': f}, {})) + try: + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + f_copy = pickle.loads(pickle.dumps(f, proto)) + try: + self.assertIs(f_copy.keywords['a'], f_copy) + finally: + f_copy.__setstate__((capture, (), {}, {})) + finally: + f.__setstate__((capture, (), {}, {})) + # Issue 6083: Reference counting bug def test_setstate_refcount(self): class BadSequence: diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -356,7 +356,7 @@ def get_pydoc_link(module): "Returns a documentation web link of a module" dirname = os.path.dirname - basedir = os.path.join(dirname(dirname(__file__))) + basedir = dirname(dirname(__file__)) doc = pydoc.TextDoc() loc = doc.getdocloc(module, basedir=basedir) return loc diff --git a/Lib/test/test_unpack_ex.py b/Lib/test/test_unpack_ex.py --- a/Lib/test/test_unpack_ex.py +++ b/Lib/test/test_unpack_ex.py @@ -248,6 +248,11 @@ ... TypeError: f() got multiple values for keyword argument 'x' + >>> f(x=5, **{'x': 3}, **{'x': 2}) + Traceback (most recent call last): + ... + TypeError: f() got multiple values for keyword argument 'x' + >>> f(**{1: 3}, **{1: 5}) Traceback (most recent call last): ... diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -18,7 +18,7 @@ from itertools import product from test import support -from test.support import TESTFN, findfile, import_fresh_module, gc_collect +from test.support import TESTFN, findfile, import_fresh_module, gc_collect, swap_attr # pyET is the pure-Python implementation. # @@ -1860,6 +1860,12 @@ e.extend([ET.Element('bar')]) self.assertRaises(ValueError, e.remove, X('baz')) + def test_recursive_repr(self): + # Issue #25455 + e = ET.Element('foo') + with swap_attr(e, 'tag', e): + with self.assertRaises(RuntimeError): + repr(e) # Should not crash class MutatingElementPath(str): def __new__(cls, elem, *args): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,6 +2,18 @@ Python News +++++++++++ +What's New in Python 3.5.3 release candidate 1? +=============================================== + +Release date: TBA + +Core and Builtins +----------------- + +Library +------- + + What's New in Python 3.5.2 final? ================================= @@ -22,6 +34,13 @@ Core and Builtins ----------------- +- Issue #27190: Raise NotSupportedError if sqlite3 is older than 3.3.1. + Patch by Dave Sawyer. + +- Issue #27286: Fixed compiling BUILD_MAP_UNPACK_WITH_CALL opcode. Calling + function with generalized unpacking (PEP 448) and conflicting keyword names + could cause undefined behavior. + - Issue #27066: Fixed SystemError if a custom opener (for open()) returns a negative number without setting an exception. @@ -151,6 +170,9 @@ Library ------- +- Issue #25455: Fixed crashes in repr of recursive ElementTree.Element and + functools.partial objects. + - Issue #26556: Update expat to 2.1.1, fixes CVE-2015-1283. - Fix TLS stripping vulnerability in smptlib, CVE-2016-0772. Reported by Team @@ -603,6 +625,10 @@ Documentation ------------- +- Issue #16484: Change the default PYTHONDOCS URL to "https:", and fix the + resulting links to use lowercase. Patch by Sean Rodman, test by Kaushik + Nadikuditi. + - Issue #24136: Document the new PEP 448 unpacking syntax of 3.5. - Issue #26736: Used HTTPS for external links in the documentation if possible. @@ -2223,8 +2249,8 @@ writer failed in BufferedRWPair.close(). - Issue #23622: Unknown escapes in regular expressions that consist of ``'\'`` - and ASCII letter now raise a deprecation warning and will be forbidden in - Python 3.6. + and an ASCII letter now raise a deprecation warning and will be forbidden + in Python 3.6. - Issue #23671: string.Template now allows specifying the "self" parameter as a keyword argument. string.Formatter now allows specifying the "self" and diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -1582,10 +1582,23 @@ static PyObject* element_repr(ElementObject* self) { - if (self->tag) - return PyUnicode_FromFormat("", self->tag, self); - else + int status; + + if (self->tag == NULL) return PyUnicode_FromFormat("", self); + + status = Py_ReprEnter((PyObject *)self); + if (status == 0) { + PyObject *res; + res = PyUnicode_FromFormat("", self->tag, self); + Py_ReprLeave((PyObject *)self); + return res; + } + if (status > 0) + PyErr_Format(PyExc_RuntimeError, + "reentrant call inside %s.__repr__", + Py_TYPE(self)->tp_name); + return NULL; } /*[clinic input] diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -203,40 +203,45 @@ static PyObject * partial_repr(partialobject *pto) { - PyObject *result; + PyObject *result = NULL; PyObject *arglist; - PyObject *tmp; Py_ssize_t i, n; PyObject *key, *value; + int status; + + status = Py_ReprEnter((PyObject *)pto); + if (status != 0) { + if (status < 0) + return NULL; + return PyUnicode_FromFormat("%s(...)", Py_TYPE(pto)->tp_name); + } arglist = PyUnicode_FromString(""); - if (arglist == NULL) { - return NULL; - } + if (arglist == NULL) + goto done; /* Pack positional arguments */ assert (PyTuple_Check(pto->args)); n = PyTuple_GET_SIZE(pto->args); for (i = 0; i < n; i++) { - tmp = PyUnicode_FromFormat("%U, %R", arglist, - PyTuple_GET_ITEM(pto->args, i)); - Py_DECREF(arglist); - if (tmp == NULL) - return NULL; - arglist = tmp; + Py_SETREF(arglist, PyUnicode_FromFormat("%U, %R", arglist, + PyTuple_GET_ITEM(pto->args, i))); + if (arglist == NULL) + goto done; } /* Pack keyword arguments */ assert (PyDict_Check(pto->kw)); for (i = 0; PyDict_Next(pto->kw, &i, &key, &value);) { - tmp = PyUnicode_FromFormat("%U, %U=%R", arglist, - key, value); - Py_DECREF(arglist); - if (tmp == NULL) - return NULL; - arglist = tmp; + Py_SETREF(arglist, PyUnicode_FromFormat("%U, %U=%R", arglist, + key, value)); + if (arglist == NULL) + goto done; } result = PyUnicode_FromFormat("%s(%R%U)", Py_TYPE(pto)->tp_name, pto->fn, arglist); Py_DECREF(arglist); + + done: + Py_ReprLeave((PyObject *)pto); return result; } diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -164,6 +164,10 @@ #ifdef WITH_THREAD self->thread_ident = PyThread_get_thread_ident(); #endif + if (!check_same_thread && sqlite3_libversion_number() < 3003001) { + PyErr_SetString(pysqlite_NotSupportedError, "shared connections not available"); + return -1; + } self->check_same_thread = check_same_thread; self->function_pinboard = PyDict_New(); diff --git a/Modules/_sqlite/module.h b/Modules/_sqlite/module.h --- a/Modules/_sqlite/module.h +++ b/Modules/_sqlite/module.h @@ -42,7 +42,7 @@ extern PyObject* time_time; extern PyObject* time_sleep; -/* A dictionary, mapping colum types (INTEGER, VARCHAR, etc.) to converter +/* A dictionary, mapping column types (INTEGER, VARCHAR, etc.) to converter * functions, that convert the SQL value to the appropriate Python value. * The key is uppercase. */ diff --git a/PC/launcher.c b/PC/launcher.c --- a/PC/launcher.c +++ b/PC/launcher.c @@ -1081,7 +1081,7 @@ { 3160, 3180, L"3.2" }, { 3190, 3230, L"3.3" }, { 3250, 3310, L"3.4" }, - { 3320, 3350, L"3.5" }, + { 3320, 3351, L"3.5" }, { 3360, 3361, L"3.6" }, { 0 } }; diff --git a/Python/compile.c b/Python/compile.c --- a/Python/compile.c +++ b/Python/compile.c @@ -3262,7 +3262,7 @@ code |= 2; if (nsubkwargs > 1) { /* Pack it all up */ - int function_pos = n + (code & 1) + nkw + 1; + int function_pos = n + (code & 1) + 2 * nkw + 1; ADDOP_I(c, BUILD_MAP_UNPACK_WITH_CALL, nsubkwargs | (function_pos << 8)); } } diff --git a/Python/importlib_external.h b/Python/importlib_external.h --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -259,7 +259,7 @@ 0,0,114,5,0,0,0,218,13,95,119,114,105,116,101,95, 97,116,111,109,105,99,99,0,0,0,115,26,0,0,0,0, 5,24,1,9,1,33,1,3,3,21,1,20,1,20,1,13, - 1,3,1,17,1,13,1,5,1,114,55,0,0,0,105,22, + 1,3,1,17,1,13,1,5,1,114,55,0,0,0,105,23, 13,0,0,233,2,0,0,0,114,13,0,0,0,115,2,0, 0,0,13,10,90,11,95,95,112,121,99,97,99,104,101,95, 95,122,4,111,112,116,45,122,3,46,112,121,122,4,46,112, @@ -369,7 +369,7 @@ 116,97,103,90,15,97,108,109,111,115,116,95,102,105,108,101, 110,97,109,101,114,4,0,0,0,114,4,0,0,0,114,5, 0,0,0,218,17,99,97,99,104,101,95,102,114,111,109,95, - 115,111,117,114,99,101,246,0,0,0,115,46,0,0,0,0, + 115,111,117,114,99,101,247,0,0,0,115,46,0,0,0,0, 18,12,1,9,1,7,1,12,1,6,1,12,1,18,1,18, 1,24,1,12,1,12,1,12,1,36,1,12,1,18,1,9, 2,12,1,12,1,12,1,12,1,21,1,21,1,114,79,0, @@ -448,7 +448,7 @@ 95,108,101,118,101,108,90,13,98,97,115,101,95,102,105,108, 101,110,97,109,101,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,17,115,111,117,114,99,101,95,102,114,111, - 109,95,99,97,99,104,101,34,1,0,0,115,44,0,0,0, + 109,95,99,97,99,104,101,35,1,0,0,115,44,0,0,0, 0,9,18,1,12,1,18,1,18,1,12,1,9,1,15,1, 15,1,12,1,9,1,15,1,12,1,22,1,15,1,9,1, 12,1,22,1,12,1,9,1,12,1,19,1,114,85,0,0, @@ -486,7 +486,7 @@ 115,105,111,110,218,11,115,111,117,114,99,101,95,112,97,116, 104,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, 218,15,95,103,101,116,95,115,111,117,114,99,101,102,105,108, - 101,67,1,0,0,115,20,0,0,0,0,7,18,1,4,1, + 101,68,1,0,0,115,20,0,0,0,0,7,18,1,4,1, 24,1,35,1,4,1,3,1,16,1,19,1,21,1,114,91, 0,0,0,99,1,0,0,0,0,0,0,0,1,0,0,0, 11,0,0,0,67,0,0,0,115,92,0,0,0,124,0,0, @@ -500,7 +500,7 @@ 84,0,0,0,114,79,0,0,0,114,66,0,0,0,114,74, 0,0,0,41,1,218,8,102,105,108,101,110,97,109,101,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,11, - 95,103,101,116,95,99,97,99,104,101,100,86,1,0,0,115, + 95,103,101,116,95,99,97,99,104,101,100,87,1,0,0,115, 16,0,0,0,0,1,21,1,3,1,14,1,13,1,8,1, 21,1,4,2,114,95,0,0,0,99,1,0,0,0,0,0, 0,0,2,0,0,0,11,0,0,0,67,0,0,0,115,60, @@ -515,7 +515,7 @@ 41,3,114,39,0,0,0,114,41,0,0,0,114,40,0,0, 0,41,2,114,35,0,0,0,114,42,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,218,10,95,99, - 97,108,99,95,109,111,100,101,98,1,0,0,115,12,0,0, + 97,108,99,95,109,111,100,101,99,1,0,0,115,12,0,0, 0,0,2,3,1,19,1,13,1,11,3,10,1,114,97,0, 0,0,218,9,118,101,114,98,111,115,105,116,121,114,29,0, 0,0,99,1,0,0,0,1,0,0,0,3,0,0,0,4, @@ -536,7 +536,7 @@ 218,6,115,116,100,101,114,114,41,3,114,75,0,0,0,114, 98,0,0,0,218,4,97,114,103,115,114,4,0,0,0,114, 4,0,0,0,114,5,0,0,0,218,16,95,118,101,114,98, - 111,115,101,95,109,101,115,115,97,103,101,110,1,0,0,115, + 111,115,101,95,109,101,115,115,97,103,101,111,1,0,0,115, 8,0,0,0,0,2,18,1,15,1,10,1,114,105,0,0, 0,99,1,0,0,0,0,0,0,0,3,0,0,0,11,0, 0,0,3,0,0,0,115,84,0,0,0,100,1,0,135,0, @@ -576,7 +576,7 @@ 0,0,90,6,107,119,97,114,103,115,41,1,218,6,109,101, 116,104,111,100,114,4,0,0,0,114,5,0,0,0,218,19, 95,99,104,101,99,107,95,110,97,109,101,95,119,114,97,112, - 112,101,114,126,1,0,0,115,12,0,0,0,0,1,12,1, + 112,101,114,127,1,0,0,115,12,0,0,0,0,1,12,1, 12,1,15,1,6,1,25,1,122,40,95,99,104,101,99,107, 95,110,97,109,101,46,60,108,111,99,97,108,115,62,46,95, 99,104,101,99,107,95,110,97,109,101,95,119,114,97,112,112, @@ -595,7 +595,7 @@ 116,97,116,116,114,218,8,95,95,100,105,99,116,95,95,218, 6,117,112,100,97,116,101,41,3,90,3,110,101,119,90,3, 111,108,100,114,52,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,218,5,95,119,114,97,112,137,1, + 0,0,114,5,0,0,0,218,5,95,119,114,97,112,138,1, 0,0,115,8,0,0,0,0,1,25,1,15,1,29,1,122, 26,95,99,104,101,99,107,95,110,97,109,101,46,60,108,111, 99,97,108,115,62,46,95,119,114,97,112,41,3,218,10,95, @@ -603,7 +603,7 @@ 78,97,109,101,69,114,114,111,114,41,3,114,109,0,0,0, 114,110,0,0,0,114,120,0,0,0,114,4,0,0,0,41, 1,114,109,0,0,0,114,5,0,0,0,218,11,95,99,104, - 101,99,107,95,110,97,109,101,118,1,0,0,115,14,0,0, + 101,99,107,95,110,97,109,101,119,1,0,0,115,14,0,0, 0,0,8,21,7,3,1,13,1,13,2,17,5,13,1,114, 123,0,0,0,99,2,0,0,0,0,0,0,0,5,0,0, 0,4,0,0,0,67,0,0,0,115,84,0,0,0,124,0, @@ -633,7 +633,7 @@ 218,8,112,111,114,116,105,111,110,115,218,3,109,115,103,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,17, 95,102,105,110,100,95,109,111,100,117,108,101,95,115,104,105, - 109,146,1,0,0,115,10,0,0,0,0,10,21,1,24,1, + 109,147,1,0,0,115,10,0,0,0,0,10,21,1,24,1, 6,1,29,1,114,130,0,0,0,99,4,0,0,0,0,0, 0,0,11,0,0,0,19,0,0,0,67,0,0,0,115,240, 1,0,0,105,0,0,125,4,0,124,2,0,100,1,0,107, @@ -718,7 +718,7 @@ 109,101,218,11,115,111,117,114,99,101,95,115,105,122,101,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,25, 95,118,97,108,105,100,97,116,101,95,98,121,116,101,99,111, - 100,101,95,104,101,97,100,101,114,163,1,0,0,115,76,0, + 100,101,95,104,101,97,100,101,114,164,1,0,0,115,76,0, 0,0,0,11,6,1,12,1,13,3,6,1,12,1,10,1, 16,1,16,1,16,1,12,1,18,1,13,1,18,1,18,1, 15,1,13,1,15,1,18,1,15,1,13,1,12,1,12,1, @@ -749,7 +749,7 @@ 114,106,0,0,0,114,89,0,0,0,114,90,0,0,0,218, 4,99,111,100,101,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,17,95,99,111,109,112,105,108,101,95,98, - 121,116,101,99,111,100,101,218,1,0,0,115,16,0,0,0, + 121,116,101,99,111,100,101,219,1,0,0,115,16,0,0,0, 0,2,15,1,15,1,13,1,12,1,16,1,4,2,18,1, 114,147,0,0,0,114,59,0,0,0,99,3,0,0,0,0, 0,0,0,4,0,0,0,3,0,0,0,67,0,0,0,115, @@ -769,7 +769,7 @@ 4,114,146,0,0,0,114,133,0,0,0,114,140,0,0,0, 114,53,0,0,0,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,17,95,99,111,100,101,95,116,111,95,98, - 121,116,101,99,111,100,101,230,1,0,0,115,10,0,0,0, + 121,116,101,99,111,100,101,231,1,0,0,115,10,0,0,0, 0,3,12,1,19,1,19,1,22,1,114,150,0,0,0,99, 1,0,0,0,0,0,0,0,5,0,0,0,4,0,0,0, 67,0,0,0,115,89,0,0,0,100,1,0,100,2,0,108, @@ -798,7 +798,7 @@ 100,105,110,103,90,15,110,101,119,108,105,110,101,95,100,101, 99,111,100,101,114,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,13,100,101,99,111,100,101,95,115,111,117, - 114,99,101,240,1,0,0,115,10,0,0,0,0,5,12,1, + 114,99,101,241,1,0,0,115,10,0,0,0,0,5,12,1, 18,1,15,1,18,1,114,155,0,0,0,114,127,0,0,0, 218,26,115,117,98,109,111,100,117,108,101,95,115,101,97,114, 99,104,95,108,111,99,97,116,105,111,110,115,99,2,0,0, @@ -863,7 +863,7 @@ 159,0,0,0,90,7,100,105,114,110,97,109,101,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,218,23,115,112, 101,99,95,102,114,111,109,95,102,105,108,101,95,108,111,99, - 97,116,105,111,110,1,2,0,0,115,60,0,0,0,0,12, + 97,116,105,111,110,2,2,0,0,115,60,0,0,0,0,12, 12,4,6,1,15,2,3,1,19,1,13,1,5,8,24,1, 9,3,12,1,22,1,21,1,15,1,9,1,5,2,4,3, 12,2,15,1,3,1,19,1,13,1,5,2,6,1,12,2, @@ -903,7 +903,7 @@ 79,67,65,76,95,77,65,67,72,73,78,69,41,2,218,3, 99,108,115,218,3,107,101,121,114,4,0,0,0,114,4,0, 0,0,114,5,0,0,0,218,14,95,111,112,101,110,95,114, - 101,103,105,115,116,114,121,79,2,0,0,115,8,0,0,0, + 101,103,105,115,116,114,121,80,2,0,0,115,8,0,0,0, 0,2,3,1,23,1,13,1,122,36,87,105,110,100,111,119, 115,82,101,103,105,115,116,114,121,70,105,110,100,101,114,46, 95,111,112,101,110,95,114,101,103,105,115,116,114,121,99,2, @@ -930,7 +930,7 @@ 171,0,0,0,90,4,104,107,101,121,218,8,102,105,108,101, 112,97,116,104,114,4,0,0,0,114,4,0,0,0,114,5, 0,0,0,218,16,95,115,101,97,114,99,104,95,114,101,103, - 105,115,116,114,121,86,2,0,0,115,22,0,0,0,0,2, + 105,115,116,114,121,87,2,0,0,115,22,0,0,0,0,2, 9,1,12,2,9,1,15,1,22,1,3,1,18,1,29,1, 13,1,9,1,122,38,87,105,110,100,111,119,115,82,101,103, 105,115,116,114,121,70,105,110,100,101,114,46,95,115,101,97, @@ -954,7 +954,7 @@ 114,35,0,0,0,218,6,116,97,114,103,101,116,114,177,0, 0,0,114,127,0,0,0,114,166,0,0,0,114,164,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 218,9,102,105,110,100,95,115,112,101,99,101,2,0,0,115, + 218,9,102,105,110,100,95,115,112,101,99,102,2,0,0,115, 26,0,0,0,0,2,15,1,12,1,4,1,3,1,14,1, 13,1,9,1,22,1,21,1,9,1,15,1,9,1,122,31, 87,105,110,100,111,119,115,82,101,103,105,115,116,114,121,70, @@ -974,7 +974,7 @@ 0,0,0,41,4,114,170,0,0,0,114,126,0,0,0,114, 35,0,0,0,114,164,0,0,0,114,4,0,0,0,114,4, 0,0,0,114,5,0,0,0,218,11,102,105,110,100,95,109, - 111,100,117,108,101,117,2,0,0,115,8,0,0,0,0,7, + 111,100,117,108,101,118,2,0,0,115,8,0,0,0,0,7, 18,1,12,1,7,2,122,33,87,105,110,100,111,119,115,82, 101,103,105,115,116,114,121,70,105,110,100,101,114,46,102,105, 110,100,95,109,111,100,117,108,101,41,12,114,112,0,0,0, @@ -983,7 +983,7 @@ 99,108,97,115,115,109,101,116,104,111,100,114,172,0,0,0, 114,178,0,0,0,114,181,0,0,0,114,182,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,168,0,0,0,67,2,0,0,115,20,0,0, + 0,0,0,114,168,0,0,0,68,2,0,0,115,20,0,0, 0,12,2,6,3,6,3,6,2,6,2,18,7,18,15,3, 1,21,15,3,1,114,168,0,0,0,99,0,0,0,0,0, 0,0,0,0,0,0,0,2,0,0,0,64,0,0,0,115, @@ -1021,7 +1021,7 @@ 0,0,0,114,94,0,0,0,90,13,102,105,108,101,110,97, 109,101,95,98,97,115,101,90,9,116,97,105,108,95,110,97, 109,101,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,159,0,0,0,136,2,0,0,115,8,0,0,0,0, + 0,114,159,0,0,0,137,2,0,0,115,8,0,0,0,0, 3,25,1,22,1,19,1,122,24,95,76,111,97,100,101,114, 66,97,115,105,99,115,46,105,115,95,112,97,99,107,97,103, 101,99,2,0,0,0,0,0,0,0,2,0,0,0,1,0, @@ -1031,7 +1031,7 @@ 117,108,101,32,99,114,101,97,116,105,111,110,46,78,114,4, 0,0,0,41,2,114,108,0,0,0,114,164,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,13, - 99,114,101,97,116,101,95,109,111,100,117,108,101,144,2,0, + 99,114,101,97,116,101,95,109,111,100,117,108,101,145,2,0, 0,115,0,0,0,0,122,27,95,76,111,97,100,101,114,66, 97,115,105,99,115,46,99,114,101,97,116,101,95,109,111,100, 117,108,101,99,2,0,0,0,0,0,0,0,3,0,0,0, @@ -1053,7 +1053,7 @@ 0,41,3,114,108,0,0,0,218,6,109,111,100,117,108,101, 114,146,0,0,0,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,11,101,120,101,99,95,109,111,100,117,108, - 101,147,2,0,0,115,10,0,0,0,0,2,18,1,12,1, + 101,148,2,0,0,115,10,0,0,0,0,2,18,1,12,1, 9,1,15,1,122,25,95,76,111,97,100,101,114,66,97,115, 105,99,115,46,101,120,101,99,95,109,111,100,117,108,101,99, 2,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0, @@ -1062,14 +1062,14 @@ 0,0,0,218,17,95,108,111,97,100,95,109,111,100,117,108, 101,95,115,104,105,109,41,2,114,108,0,0,0,114,126,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,218,11,108,111,97,100,95,109,111,100,117,108,101,155,2, + 0,218,11,108,111,97,100,95,109,111,100,117,108,101,156,2, 0,0,115,2,0,0,0,0,1,122,25,95,76,111,97,100, 101,114,66,97,115,105,99,115,46,108,111,97,100,95,109,111, 100,117,108,101,78,41,8,114,112,0,0,0,114,111,0,0, 0,114,113,0,0,0,114,114,0,0,0,114,159,0,0,0, 114,186,0,0,0,114,191,0,0,0,114,193,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,184,0,0,0,131,2,0,0,115,10,0,0, + 0,0,0,114,184,0,0,0,132,2,0,0,115,10,0,0, 0,12,3,6,2,12,8,12,3,12,8,114,184,0,0,0, 99,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0, 0,64,0,0,0,115,106,0,0,0,101,0,0,90,1,0, @@ -1097,7 +1097,7 @@ 1,218,7,73,79,69,114,114,111,114,41,2,114,108,0,0, 0,114,35,0,0,0,114,4,0,0,0,114,4,0,0,0, 114,5,0,0,0,218,10,112,97,116,104,95,109,116,105,109, - 101,161,2,0,0,115,2,0,0,0,0,6,122,23,83,111, + 101,162,2,0,0,115,2,0,0,0,0,6,122,23,83,111, 117,114,99,101,76,111,97,100,101,114,46,112,97,116,104,95, 109,116,105,109,101,99,2,0,0,0,0,0,0,0,2,0, 0,0,3,0,0,0,67,0,0,0,115,19,0,0,0,100, @@ -1132,7 +1132,7 @@ 32,32,32,114,133,0,0,0,41,1,114,196,0,0,0,41, 2,114,108,0,0,0,114,35,0,0,0,114,4,0,0,0, 114,4,0,0,0,114,5,0,0,0,218,10,112,97,116,104, - 95,115,116,97,116,115,169,2,0,0,115,2,0,0,0,0, + 95,115,116,97,116,115,170,2,0,0,115,2,0,0,0,0, 11,122,23,83,111,117,114,99,101,76,111,97,100,101,114,46, 112,97,116,104,95,115,116,97,116,115,99,4,0,0,0,0, 0,0,0,4,0,0,0,3,0,0,0,67,0,0,0,115, @@ -1156,7 +1156,7 @@ 90,0,0,0,90,10,99,97,99,104,101,95,112,97,116,104, 114,53,0,0,0,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,15,95,99,97,99,104,101,95,98,121,116, - 101,99,111,100,101,182,2,0,0,115,2,0,0,0,0,8, + 101,99,111,100,101,183,2,0,0,115,2,0,0,0,0,8, 122,28,83,111,117,114,99,101,76,111,97,100,101,114,46,95, 99,97,99,104,101,95,98,121,116,101,99,111,100,101,99,3, 0,0,0,0,0,0,0,3,0,0,0,1,0,0,0,67, @@ -1173,7 +1173,7 @@ 32,32,32,32,32,32,78,114,4,0,0,0,41,3,114,108, 0,0,0,114,35,0,0,0,114,53,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,114,198,0,0, - 0,192,2,0,0,115,0,0,0,0,122,21,83,111,117,114, + 0,193,2,0,0,115,0,0,0,0,122,21,83,111,117,114, 99,101,76,111,97,100,101,114,46,115,101,116,95,100,97,116, 97,99,2,0,0,0,0,0,0,0,5,0,0,0,16,0, 0,0,67,0,0,0,115,105,0,0,0,124,0,0,106,0, @@ -1195,7 +1195,7 @@ 0,0,114,126,0,0,0,114,35,0,0,0,114,153,0,0, 0,218,3,101,120,99,114,4,0,0,0,114,4,0,0,0, 114,5,0,0,0,218,10,103,101,116,95,115,111,117,114,99, - 101,199,2,0,0,115,14,0,0,0,0,2,15,1,3,1, + 101,200,2,0,0,115,14,0,0,0,0,2,15,1,3,1, 19,1,18,1,9,1,31,1,122,23,83,111,117,114,99,101, 76,111,97,100,101,114,46,103,101,116,95,115,111,117,114,99, 101,218,9,95,111,112,116,105,109,105,122,101,114,29,0,0, @@ -1217,7 +1217,7 @@ 101,41,4,114,108,0,0,0,114,53,0,0,0,114,35,0, 0,0,114,203,0,0,0,114,4,0,0,0,114,4,0,0, 0,114,5,0,0,0,218,14,115,111,117,114,99,101,95,116, - 111,95,99,111,100,101,209,2,0,0,115,4,0,0,0,0, + 111,95,99,111,100,101,210,2,0,0,115,4,0,0,0,0, 5,21,1,122,27,83,111,117,114,99,101,76,111,97,100,101, 114,46,115,111,117,114,99,101,95,116,111,95,99,111,100,101, 99,2,0,0,0,0,0,0,0,10,0,0,0,43,0,0, @@ -1278,7 +1278,7 @@ 98,121,116,101,115,95,100,97,116,97,114,153,0,0,0,90, 11,99,111,100,101,95,111,98,106,101,99,116,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,114,187,0,0,0, - 217,2,0,0,115,78,0,0,0,0,7,15,1,6,1,3, + 218,2,0,0,115,78,0,0,0,0,7,15,1,6,1,3, 1,16,1,13,1,11,2,3,1,19,1,13,1,5,2,16, 1,3,1,19,1,13,1,5,2,3,1,9,1,12,1,13, 1,19,1,5,2,9,1,7,1,15,1,6,1,7,1,15, @@ -1290,7 +1290,7 @@ 199,0,0,0,114,198,0,0,0,114,202,0,0,0,114,206, 0,0,0,114,187,0,0,0,114,4,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,114,194,0,0, - 0,159,2,0,0,115,14,0,0,0,12,2,12,8,12,13, + 0,160,2,0,0,115,14,0,0,0,12,2,12,8,12,13, 12,10,12,7,12,10,18,8,114,194,0,0,0,99,0,0, 0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0, 0,0,115,112,0,0,0,101,0,0,90,1,0,100,0,0, @@ -1318,7 +1318,7 @@ 32,32,32,32,32,32,102,105,110,100,101,114,46,78,41,2, 114,106,0,0,0,114,35,0,0,0,41,3,114,108,0,0, 0,114,126,0,0,0,114,35,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,185,0,0,0,18, + 114,4,0,0,0,114,5,0,0,0,114,185,0,0,0,19, 3,0,0,115,4,0,0,0,0,3,9,1,122,19,70,105, 108,101,76,111,97,100,101,114,46,95,95,105,110,105,116,95, 95,99,2,0,0,0,0,0,0,0,2,0,0,0,2,0, @@ -1328,7 +1328,7 @@ 41,2,218,9,95,95,99,108,97,115,115,95,95,114,118,0, 0,0,41,2,114,108,0,0,0,218,5,111,116,104,101,114, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218, - 6,95,95,101,113,95,95,24,3,0,0,115,4,0,0,0, + 6,95,95,101,113,95,95,25,3,0,0,115,4,0,0,0, 0,1,18,1,122,17,70,105,108,101,76,111,97,100,101,114, 46,95,95,101,113,95,95,99,1,0,0,0,0,0,0,0, 1,0,0,0,3,0,0,0,67,0,0,0,115,26,0,0, @@ -1337,7 +1337,7 @@ 218,4,104,97,115,104,114,106,0,0,0,114,35,0,0,0, 41,1,114,108,0,0,0,114,4,0,0,0,114,4,0,0, 0,114,5,0,0,0,218,8,95,95,104,97,115,104,95,95, - 28,3,0,0,115,2,0,0,0,0,1,122,19,70,105,108, + 29,3,0,0,115,2,0,0,0,0,1,122,19,70,105,108, 101,76,111,97,100,101,114,46,95,95,104,97,115,104,95,95, 99,2,0,0,0,0,0,0,0,2,0,0,0,3,0,0, 0,3,0,0,0,115,22,0,0,0,116,0,0,116,1,0, @@ -1351,7 +1351,7 @@ 32,32,32,32,32,32,32,32,41,3,218,5,115,117,112,101, 114,114,210,0,0,0,114,193,0,0,0,41,2,114,108,0, 0,0,114,126,0,0,0,41,1,114,211,0,0,0,114,4, - 0,0,0,114,5,0,0,0,114,193,0,0,0,31,3,0, + 0,0,0,114,5,0,0,0,114,193,0,0,0,32,3,0, 0,115,2,0,0,0,0,10,122,22,70,105,108,101,76,111, 97,100,101,114,46,108,111,97,100,95,109,111,100,117,108,101, 99,2,0,0,0,0,0,0,0,2,0,0,0,1,0,0, @@ -1362,7 +1362,7 @@ 32,98,121,32,116,104,101,32,102,105,110,100,101,114,46,41, 1,114,35,0,0,0,41,2,114,108,0,0,0,114,126,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,157,0,0,0,43,3,0,0,115,2,0,0,0,0, + 0,114,157,0,0,0,44,3,0,0,115,2,0,0,0,0, 3,122,23,70,105,108,101,76,111,97,100,101,114,46,103,101, 116,95,102,105,108,101,110,97,109,101,99,2,0,0,0,0, 0,0,0,3,0,0,0,9,0,0,0,67,0,0,0,115, @@ -1375,14 +1375,14 @@ 49,0,0,0,114,50,0,0,0,90,4,114,101,97,100,41, 3,114,108,0,0,0,114,35,0,0,0,114,54,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 200,0,0,0,48,3,0,0,115,4,0,0,0,0,2,21, + 200,0,0,0,49,3,0,0,115,4,0,0,0,0,2,21, 1,122,19,70,105,108,101,76,111,97,100,101,114,46,103,101, 116,95,100,97,116,97,41,11,114,112,0,0,0,114,111,0, 0,0,114,113,0,0,0,114,114,0,0,0,114,185,0,0, 0,114,213,0,0,0,114,215,0,0,0,114,123,0,0,0, 114,193,0,0,0,114,157,0,0,0,114,200,0,0,0,114, 4,0,0,0,114,4,0,0,0,41,1,114,211,0,0,0, - 114,5,0,0,0,114,210,0,0,0,13,3,0,0,115,14, + 114,5,0,0,0,114,210,0,0,0,14,3,0,0,115,14, 0,0,0,12,3,6,2,12,6,12,4,12,3,24,12,18, 5,114,210,0,0,0,99,0,0,0,0,0,0,0,0,0, 0,0,0,4,0,0,0,64,0,0,0,115,64,0,0,0, @@ -1405,7 +1405,7 @@ 3,114,39,0,0,0,218,8,115,116,95,109,116,105,109,101, 90,7,115,116,95,115,105,122,101,41,3,114,108,0,0,0, 114,35,0,0,0,114,208,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,197,0,0,0,58,3, + 4,0,0,0,114,5,0,0,0,114,197,0,0,0,59,3, 0,0,115,4,0,0,0,0,2,12,1,122,27,83,111,117, 114,99,101,70,105,108,101,76,111,97,100,101,114,46,112,97, 116,104,95,115,116,97,116,115,99,4,0,0,0,0,0,0, @@ -1416,7 +1416,7 @@ 114,97,0,0,0,114,198,0,0,0,41,5,114,108,0,0, 0,114,90,0,0,0,114,89,0,0,0,114,53,0,0,0, 114,42,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,199,0,0,0,63,3,0,0,115,4,0, + 5,0,0,0,114,199,0,0,0,64,3,0,0,115,4,0, 0,0,0,2,12,1,122,32,83,111,117,114,99,101,70,105, 108,101,76,111,97,100,101,114,46,95,99,97,99,104,101,95, 98,121,116,101,99,111,100,101,114,220,0,0,0,105,182,1, @@ -1454,7 +1454,7 @@ 53,0,0,0,114,220,0,0,0,218,6,112,97,114,101,110, 116,114,94,0,0,0,114,27,0,0,0,114,23,0,0,0, 114,201,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,198,0,0,0,68,3,0,0,115,38,0, + 5,0,0,0,114,198,0,0,0,69,3,0,0,115,38,0, 0,0,0,2,18,1,6,2,22,1,18,1,17,2,19,1, 15,1,3,1,17,1,13,2,7,1,18,3,16,1,27,1, 3,1,16,1,17,1,18,2,122,25,83,111,117,114,99,101, @@ -1463,7 +1463,7 @@ 114,113,0,0,0,114,114,0,0,0,114,197,0,0,0,114, 199,0,0,0,114,198,0,0,0,114,4,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,218,0, - 0,0,54,3,0,0,115,8,0,0,0,12,2,6,2,12, + 0,0,55,3,0,0,115,8,0,0,0,12,2,6,2,12, 5,12,5,114,218,0,0,0,99,0,0,0,0,0,0,0, 0,0,0,0,0,2,0,0,0,64,0,0,0,115,46,0, 0,0,101,0,0,90,1,0,100,0,0,90,2,0,100,1, @@ -1485,7 +1485,7 @@ 114,147,0,0,0,41,5,114,108,0,0,0,114,126,0,0, 0,114,35,0,0,0,114,53,0,0,0,114,209,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 187,0,0,0,101,3,0,0,115,8,0,0,0,0,1,15, + 187,0,0,0,102,3,0,0,115,8,0,0,0,0,1,15, 1,15,1,24,1,122,29,83,111,117,114,99,101,108,101,115, 115,70,105,108,101,76,111,97,100,101,114,46,103,101,116,95, 99,111,100,101,99,2,0,0,0,0,0,0,0,2,0,0, @@ -1495,13 +1495,13 @@ 32,115,111,117,114,99,101,32,99,111,100,101,46,78,114,4, 0,0,0,41,2,114,108,0,0,0,114,126,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,202, - 0,0,0,107,3,0,0,115,2,0,0,0,0,2,122,31, + 0,0,0,108,3,0,0,115,2,0,0,0,0,2,122,31, 83,111,117,114,99,101,108,101,115,115,70,105,108,101,76,111, 97,100,101,114,46,103,101,116,95,115,111,117,114,99,101,78, 41,6,114,112,0,0,0,114,111,0,0,0,114,113,0,0, 0,114,114,0,0,0,114,187,0,0,0,114,202,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,223,0,0,0,97,3,0,0,115,6,0, + 5,0,0,0,114,223,0,0,0,98,3,0,0,115,6,0, 0,0,12,2,6,2,12,6,114,223,0,0,0,99,0,0, 0,0,0,0,0,0,0,0,0,0,3,0,0,0,64,0, 0,0,115,136,0,0,0,101,0,0,90,1,0,100,0,0, @@ -1526,7 +1526,7 @@ 0,100,0,0,83,41,1,78,41,2,114,106,0,0,0,114, 35,0,0,0,41,3,114,108,0,0,0,114,106,0,0,0, 114,35,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,185,0,0,0,124,3,0,0,115,4,0, + 5,0,0,0,114,185,0,0,0,125,3,0,0,115,4,0, 0,0,0,1,9,1,122,28,69,120,116,101,110,115,105,111, 110,70,105,108,101,76,111,97,100,101,114,46,95,95,105,110, 105,116,95,95,99,2,0,0,0,0,0,0,0,2,0,0, @@ -1535,7 +1535,7 @@ 124,0,0,106,1,0,124,1,0,106,1,0,107,2,0,83, 41,1,78,41,2,114,211,0,0,0,114,118,0,0,0,41, 2,114,108,0,0,0,114,212,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,213,0,0,0,128, + 114,4,0,0,0,114,5,0,0,0,114,213,0,0,0,129, 3,0,0,115,4,0,0,0,0,1,18,1,122,26,69,120, 116,101,110,115,105,111,110,70,105,108,101,76,111,97,100,101, 114,46,95,95,101,113,95,95,99,1,0,0,0,0,0,0, @@ -1544,7 +1544,7 @@ 0,124,0,0,106,2,0,131,1,0,65,83,41,1,78,41, 3,114,214,0,0,0,114,106,0,0,0,114,35,0,0,0, 41,1,114,108,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,5,0,0,0,114,215,0,0,0,132,3,0,0,115, + 0,114,5,0,0,0,114,215,0,0,0,133,3,0,0,115, 2,0,0,0,0,1,122,28,69,120,116,101,110,115,105,111, 110,70,105,108,101,76,111,97,100,101,114,46,95,95,104,97, 115,104,95,95,99,2,0,0,0,0,0,0,0,3,0,0, @@ -1562,7 +1562,7 @@ 114,105,0,0,0,114,106,0,0,0,114,35,0,0,0,41, 3,114,108,0,0,0,114,164,0,0,0,114,190,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 186,0,0,0,135,3,0,0,115,10,0,0,0,0,2,6, + 186,0,0,0,136,3,0,0,115,10,0,0,0,0,2,6, 1,15,1,6,1,16,1,122,33,69,120,116,101,110,115,105, 111,110,70,105,108,101,76,111,97,100,101,114,46,99,114,101, 97,116,101,95,109,111,100,117,108,101,99,2,0,0,0,0, @@ -1579,7 +1579,7 @@ 12,101,120,101,99,95,100,121,110,97,109,105,99,114,105,0, 0,0,114,106,0,0,0,114,35,0,0,0,41,2,114,108, 0,0,0,114,190,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,114,191,0,0,0,143,3,0,0, + 0,0,114,5,0,0,0,114,191,0,0,0,144,3,0,0, 115,6,0,0,0,0,2,19,1,6,1,122,31,69,120,116, 101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,114, 46,101,120,101,99,95,109,111,100,117,108,101,99,2,0,0, @@ -1598,7 +1598,7 @@ 78,114,4,0,0,0,41,2,114,22,0,0,0,218,6,115, 117,102,102,105,120,41,1,218,9,102,105,108,101,95,110,97, 109,101,114,4,0,0,0,114,5,0,0,0,250,9,60,103, - 101,110,101,120,112,114,62,152,3,0,0,115,2,0,0,0, + 101,110,101,120,112,114,62,153,3,0,0,115,2,0,0,0, 6,1,122,49,69,120,116,101,110,115,105,111,110,70,105,108, 101,76,111,97,100,101,114,46,105,115,95,112,97,99,107,97, 103,101,46,60,108,111,99,97,108,115,62,46,60,103,101,110, @@ -1606,7 +1606,7 @@ 0,218,3,97,110,121,218,18,69,88,84,69,78,83,73,79, 78,95,83,85,70,70,73,88,69,83,41,2,114,108,0,0, 0,114,126,0,0,0,114,4,0,0,0,41,1,114,226,0, - 0,0,114,5,0,0,0,114,159,0,0,0,149,3,0,0, + 0,0,114,5,0,0,0,114,159,0,0,0,150,3,0,0, 115,6,0,0,0,0,2,19,1,18,1,122,30,69,120,116, 101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,114, 46,105,115,95,112,97,99,107,97,103,101,99,2,0,0,0, @@ -1618,7 +1618,7 @@ 99,111,100,101,32,111,98,106,101,99,116,46,78,114,4,0, 0,0,41,2,114,108,0,0,0,114,126,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,187,0, - 0,0,155,3,0,0,115,2,0,0,0,0,2,122,28,69, + 0,0,156,3,0,0,115,2,0,0,0,0,2,122,28,69, 120,116,101,110,115,105,111,110,70,105,108,101,76,111,97,100, 101,114,46,103,101,116,95,99,111,100,101,99,2,0,0,0, 0,0,0,0,2,0,0,0,1,0,0,0,67,0,0,0, @@ -1628,7 +1628,7 @@ 118,101,32,110,111,32,115,111,117,114,99,101,32,99,111,100, 101,46,78,114,4,0,0,0,41,2,114,108,0,0,0,114, 126,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,202,0,0,0,159,3,0,0,115,2,0,0, + 0,0,0,114,202,0,0,0,160,3,0,0,115,2,0,0, 0,0,2,122,30,69,120,116,101,110,115,105,111,110,70,105, 108,101,76,111,97,100,101,114,46,103,101,116,95,115,111,117, 114,99,101,99,2,0,0,0,0,0,0,0,2,0,0,0, @@ -1639,7 +1639,7 @@ 117,110,100,32,98,121,32,116,104,101,32,102,105,110,100,101, 114,46,41,1,114,35,0,0,0,41,2,114,108,0,0,0, 114,126,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,157,0,0,0,163,3,0,0,115,2,0, + 5,0,0,0,114,157,0,0,0,164,3,0,0,115,2,0, 0,0,0,3,122,32,69,120,116,101,110,115,105,111,110,70, 105,108,101,76,111,97,100,101,114,46,103,101,116,95,102,105, 108,101,110,97,109,101,78,41,14,114,112,0,0,0,114,111, @@ -1648,7 +1648,7 @@ 0,114,191,0,0,0,114,159,0,0,0,114,187,0,0,0, 114,202,0,0,0,114,123,0,0,0,114,157,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,224,0,0,0,116,3,0,0,115,20,0,0, + 0,0,0,114,224,0,0,0,117,3,0,0,115,20,0,0, 0,12,6,6,2,12,4,12,4,12,3,12,8,12,6,12, 6,12,4,12,4,114,224,0,0,0,99,0,0,0,0,0, 0,0,0,0,0,0,0,2,0,0,0,64,0,0,0,115, @@ -1692,7 +1692,7 @@ 95,112,97,116,104,95,102,105,110,100,101,114,41,4,114,108, 0,0,0,114,106,0,0,0,114,35,0,0,0,218,11,112, 97,116,104,95,102,105,110,100,101,114,114,4,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,185,0,0,0,176,3, + 4,0,0,0,114,5,0,0,0,114,185,0,0,0,177,3, 0,0,115,8,0,0,0,0,1,9,1,9,1,21,1,122, 23,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46, 95,95,105,110,105,116,95,95,99,1,0,0,0,0,0,0, @@ -1711,7 +1711,7 @@ 41,4,114,108,0,0,0,114,222,0,0,0,218,3,100,111, 116,90,2,109,101,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,23,95,102,105,110,100,95,112,97,114,101, - 110,116,95,112,97,116,104,95,110,97,109,101,115,182,3,0, + 110,116,95,112,97,116,104,95,110,97,109,101,115,183,3,0, 0,115,8,0,0,0,0,2,27,1,12,2,4,3,122,38, 95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95, 102,105,110,100,95,112,97,114,101,110,116,95,112,97,116,104, @@ -1725,7 +1725,7 @@ 110,116,95,109,111,100,117,108,101,95,110,97,109,101,90,14, 112,97,116,104,95,97,116,116,114,95,110,97,109,101,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,233,0, - 0,0,192,3,0,0,115,4,0,0,0,0,1,18,1,122, + 0,0,193,3,0,0,115,4,0,0,0,0,1,18,1,122, 31,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46, 95,103,101,116,95,112,97,114,101,110,116,95,112,97,116,104, 99,1,0,0,0,0,0,0,0,3,0,0,0,3,0,0, @@ -1743,7 +1743,7 @@ 108,0,0,0,90,11,112,97,114,101,110,116,95,112,97,116, 104,114,164,0,0,0,114,4,0,0,0,114,4,0,0,0, 114,5,0,0,0,218,12,95,114,101,99,97,108,99,117,108, - 97,116,101,196,3,0,0,115,16,0,0,0,0,2,18,1, + 97,116,101,197,3,0,0,115,16,0,0,0,0,2,18,1, 15,1,21,3,27,1,9,1,12,1,9,1,122,27,95,78, 97,109,101,115,112,97,99,101,80,97,116,104,46,95,114,101, 99,97,108,99,117,108,97,116,101,99,1,0,0,0,0,0, @@ -1752,14 +1752,14 @@ 1,0,83,41,1,78,41,2,218,4,105,116,101,114,114,240, 0,0,0,41,1,114,108,0,0,0,114,4,0,0,0,114, 4,0,0,0,114,5,0,0,0,218,8,95,95,105,116,101, - 114,95,95,209,3,0,0,115,2,0,0,0,0,1,122,23, + 114,95,95,210,3,0,0,115,2,0,0,0,0,1,122,23, 95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95, 95,105,116,101,114,95,95,99,1,0,0,0,0,0,0,0, 1,0,0,0,2,0,0,0,67,0,0,0,115,16,0,0, 0,116,0,0,124,0,0,106,1,0,131,0,0,131,1,0, 83,41,1,78,41,2,114,31,0,0,0,114,240,0,0,0, 41,1,114,108,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,5,0,0,0,218,7,95,95,108,101,110,95,95,212, + 0,114,5,0,0,0,218,7,95,95,108,101,110,95,95,213, 3,0,0,115,2,0,0,0,0,1,122,22,95,78,97,109, 101,115,112,97,99,101,80,97,116,104,46,95,95,108,101,110, 95,95,99,1,0,0,0,0,0,0,0,1,0,0,0,2, @@ -1769,7 +1769,7 @@ 123,33,114,125,41,41,2,114,47,0,0,0,114,232,0,0, 0,41,1,114,108,0,0,0,114,4,0,0,0,114,4,0, 0,0,114,5,0,0,0,218,8,95,95,114,101,112,114,95, - 95,215,3,0,0,115,2,0,0,0,0,1,122,23,95,78, + 95,216,3,0,0,115,2,0,0,0,0,1,122,23,95,78, 97,109,101,115,112,97,99,101,80,97,116,104,46,95,95,114, 101,112,114,95,95,99,2,0,0,0,0,0,0,0,2,0, 0,0,2,0,0,0,67,0,0,0,115,16,0,0,0,124, @@ -1777,7 +1777,7 @@ 1,78,41,1,114,240,0,0,0,41,2,114,108,0,0,0, 218,4,105,116,101,109,114,4,0,0,0,114,4,0,0,0, 114,5,0,0,0,218,12,95,95,99,111,110,116,97,105,110, - 115,95,95,218,3,0,0,115,2,0,0,0,0,1,122,27, + 115,95,95,219,3,0,0,115,2,0,0,0,0,1,122,27, 95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95, 95,99,111,110,116,97,105,110,115,95,95,99,2,0,0,0, 0,0,0,0,2,0,0,0,2,0,0,0,67,0,0,0, @@ -1785,7 +1785,7 @@ 0,131,1,0,1,100,0,0,83,41,1,78,41,2,114,232, 0,0,0,114,163,0,0,0,41,2,114,108,0,0,0,114, 245,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,163,0,0,0,221,3,0,0,115,2,0,0, + 0,0,0,114,163,0,0,0,222,3,0,0,115,2,0,0, 0,0,1,122,21,95,78,97,109,101,115,112,97,99,101,80, 97,116,104,46,97,112,112,101,110,100,78,41,13,114,112,0, 0,0,114,111,0,0,0,114,113,0,0,0,114,114,0,0, @@ -1793,7 +1793,7 @@ 114,240,0,0,0,114,242,0,0,0,114,243,0,0,0,114, 244,0,0,0,114,246,0,0,0,114,163,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,114,230,0,0,0,169,3,0,0,115,20,0,0,0, + 0,0,114,230,0,0,0,170,3,0,0,115,20,0,0,0, 12,5,6,2,12,6,12,10,12,4,12,13,12,3,12,3, 12,3,12,3,114,230,0,0,0,99,0,0,0,0,0,0, 0,0,0,0,0,0,3,0,0,0,64,0,0,0,115,118, @@ -1812,7 +1812,7 @@ 41,1,78,41,2,114,230,0,0,0,114,232,0,0,0,41, 4,114,108,0,0,0,114,106,0,0,0,114,35,0,0,0, 114,236,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,185,0,0,0,227,3,0,0,115,2,0, + 5,0,0,0,114,185,0,0,0,228,3,0,0,115,2,0, 0,0,0,1,122,25,95,78,97,109,101,115,112,97,99,101, 76,111,97,100,101,114,46,95,95,105,110,105,116,95,95,99, 2,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0, @@ -1829,14 +1829,14 @@ 110,97,109,101,115,112,97,99,101,41,62,41,2,114,47,0, 0,0,114,112,0,0,0,41,2,114,170,0,0,0,114,190, 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,218,11,109,111,100,117,108,101,95,114,101,112,114,230, + 0,0,218,11,109,111,100,117,108,101,95,114,101,112,114,231, 3,0,0,115,2,0,0,0,0,7,122,28,95,78,97,109, 101,115,112,97,99,101,76,111,97,100,101,114,46,109,111,100, 117,108,101,95,114,101,112,114,99,2,0,0,0,0,0,0, 0,2,0,0,0,1,0,0,0,67,0,0,0,115,4,0, 0,0,100,1,0,83,41,2,78,84,114,4,0,0,0,41, 2,114,108,0,0,0,114,126,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,159,0,0,0,239, + 114,4,0,0,0,114,5,0,0,0,114,159,0,0,0,240, 3,0,0,115,2,0,0,0,0,1,122,27,95,78,97,109, 101,115,112,97,99,101,76,111,97,100,101,114,46,105,115,95, 112,97,99,107,97,103,101,99,2,0,0,0,0,0,0,0, @@ -1844,7 +1844,7 @@ 0,100,1,0,83,41,2,78,114,30,0,0,0,114,4,0, 0,0,41,2,114,108,0,0,0,114,126,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,202,0, - 0,0,242,3,0,0,115,2,0,0,0,0,1,122,27,95, + 0,0,243,3,0,0,115,2,0,0,0,0,1,122,27,95, 78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,46, 103,101,116,95,115,111,117,114,99,101,99,2,0,0,0,0, 0,0,0,2,0,0,0,6,0,0,0,67,0,0,0,115, @@ -1853,7 +1853,7 @@ 0,0,122,8,60,115,116,114,105,110,103,62,114,189,0,0, 0,114,204,0,0,0,84,41,1,114,205,0,0,0,41,2, 114,108,0,0,0,114,126,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,187,0,0,0,245,3, + 4,0,0,0,114,5,0,0,0,114,187,0,0,0,246,3, 0,0,115,2,0,0,0,0,1,122,25,95,78,97,109,101, 115,112,97,99,101,76,111,97,100,101,114,46,103,101,116,95, 99,111,100,101,99,2,0,0,0,0,0,0,0,2,0,0, @@ -1863,14 +1863,14 @@ 109,111,100,117,108,101,32,99,114,101,97,116,105,111,110,46, 78,114,4,0,0,0,41,2,114,108,0,0,0,114,164,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,186,0,0,0,248,3,0,0,115,0,0,0,0,122, + 0,114,186,0,0,0,249,3,0,0,115,0,0,0,0,122, 30,95,78,97,109,101,115,112,97,99,101,76,111,97,100,101, 114,46,99,114,101,97,116,101,95,109,111,100,117,108,101,99, 2,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0, 67,0,0,0,115,4,0,0,0,100,0,0,83,41,1,78, 114,4,0,0,0,41,2,114,108,0,0,0,114,190,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,191,0,0,0,251,3,0,0,115,2,0,0,0,0,1, + 114,191,0,0,0,252,3,0,0,115,2,0,0,0,0,1, 122,28,95,78,97,109,101,115,112,97,99,101,76,111,97,100, 101,114,46,101,120,101,99,95,109,111,100,117,108,101,99,2, 0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,67, @@ -1888,7 +1888,7 @@ 104,32,123,33,114,125,41,4,114,105,0,0,0,114,232,0, 0,0,114,121,0,0,0,114,192,0,0,0,41,2,114,108, 0,0,0,114,126,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,114,193,0,0,0,254,3,0,0, + 0,0,114,5,0,0,0,114,193,0,0,0,255,3,0,0, 115,4,0,0,0,0,7,16,1,122,28,95,78,97,109,101, 115,112,97,99,101,76,111,97,100,101,114,46,108,111,97,100, 95,109,111,100,117,108,101,78,41,12,114,112,0,0,0,114, @@ -1896,7 +1896,7 @@ 0,0,0,114,248,0,0,0,114,159,0,0,0,114,202,0, 0,0,114,187,0,0,0,114,186,0,0,0,114,191,0,0, 0,114,193,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,247,0,0,0,226, + 114,4,0,0,0,114,5,0,0,0,114,247,0,0,0,227, 3,0,0,115,16,0,0,0,12,1,12,3,18,9,12,3, 12,3,12,3,12,3,12,3,114,247,0,0,0,99,0,0, 0,0,0,0,0,0,0,0,0,0,5,0,0,0,64,0, @@ -1934,7 +1934,7 @@ 114,95,99,97,99,104,101,218,6,118,97,108,117,101,115,114, 115,0,0,0,114,250,0,0,0,41,2,114,170,0,0,0, 218,6,102,105,110,100,101,114,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,114,250,0,0,0,15,4,0,0, + 0,0,114,5,0,0,0,114,250,0,0,0,16,4,0,0, 115,6,0,0,0,0,4,22,1,15,1,122,28,80,97,116, 104,70,105,110,100,101,114,46,105,110,118,97,108,105,100,97, 116,101,95,99,97,99,104,101,115,99,2,0,0,0,0,0, @@ -1960,7 +1960,7 @@ 107,0,0,0,41,3,114,170,0,0,0,114,35,0,0,0, 90,4,104,111,111,107,114,4,0,0,0,114,4,0,0,0, 114,5,0,0,0,218,11,95,112,97,116,104,95,104,111,111, - 107,115,23,4,0,0,115,16,0,0,0,0,7,25,1,16, + 107,115,24,4,0,0,115,16,0,0,0,0,7,25,1,16, 1,16,1,3,1,14,1,13,1,12,2,122,22,80,97,116, 104,70,105,110,100,101,114,46,95,112,97,116,104,95,104,111, 111,107,115,99,2,0,0,0,0,0,0,0,3,0,0,0, @@ -1992,7 +1992,7 @@ 0,0,114,255,0,0,0,41,3,114,170,0,0,0,114,35, 0,0,0,114,253,0,0,0,114,4,0,0,0,114,4,0, 0,0,114,5,0,0,0,218,20,95,112,97,116,104,95,105, - 109,112,111,114,116,101,114,95,99,97,99,104,101,40,4,0, + 109,112,111,114,116,101,114,95,99,97,99,104,101,41,4,0, 0,115,22,0,0,0,0,8,12,1,3,1,16,1,13,3, 9,1,3,1,17,1,13,1,15,1,18,1,122,31,80,97, 116,104,70,105,110,100,101,114,46,95,112,97,116,104,95,105, @@ -2012,7 +2012,7 @@ 0,0,114,126,0,0,0,114,253,0,0,0,114,127,0,0, 0,114,128,0,0,0,114,164,0,0,0,114,4,0,0,0, 114,4,0,0,0,114,5,0,0,0,218,16,95,108,101,103, - 97,99,121,95,103,101,116,95,115,112,101,99,62,4,0,0, + 97,99,121,95,103,101,116,95,115,112,101,99,63,4,0,0, 115,18,0,0,0,0,4,15,1,24,2,15,1,6,1,12, 1,16,1,18,1,9,1,122,27,80,97,116,104,70,105,110, 100,101,114,46,95,108,101,103,97,99,121,95,103,101,116,95, @@ -2048,7 +2048,7 @@ 101,115,112,97,99,101,95,112,97,116,104,90,5,101,110,116, 114,121,114,253,0,0,0,114,164,0,0,0,114,128,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 218,9,95,103,101,116,95,115,112,101,99,77,4,0,0,115, + 218,9,95,103,101,116,95,115,112,101,99,78,4,0,0,115, 40,0,0,0,0,5,6,1,13,1,21,1,3,1,15,1, 12,1,15,1,21,2,18,1,12,1,3,1,15,1,4,1, 9,1,12,1,12,5,17,2,18,1,9,1,122,20,80,97, @@ -2076,7 +2076,7 @@ 6,114,170,0,0,0,114,126,0,0,0,114,35,0,0,0, 114,180,0,0,0,114,164,0,0,0,114,4,1,0,0,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,181, - 0,0,0,109,4,0,0,115,26,0,0,0,0,4,12,1, + 0,0,0,110,4,0,0,115,26,0,0,0,0,4,12,1, 9,1,21,1,12,1,4,1,15,1,9,1,6,3,9,1, 24,1,4,2,7,2,122,20,80,97,116,104,70,105,110,100, 101,114,46,102,105,110,100,95,115,112,101,99,99,3,0,0, @@ -2098,7 +2098,7 @@ 114,181,0,0,0,114,127,0,0,0,41,4,114,170,0,0, 0,114,126,0,0,0,114,35,0,0,0,114,164,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 182,0,0,0,131,4,0,0,115,8,0,0,0,0,8,18, + 182,0,0,0,132,4,0,0,115,8,0,0,0,0,8,18, 1,12,1,4,1,122,22,80,97,116,104,70,105,110,100,101, 114,46,102,105,110,100,95,109,111,100,117,108,101,41,12,114, 112,0,0,0,114,111,0,0,0,114,113,0,0,0,114,114, @@ -2106,7 +2106,7 @@ 0,0,114,1,1,0,0,114,2,1,0,0,114,5,1,0, 0,114,181,0,0,0,114,182,0,0,0,114,4,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 249,0,0,0,11,4,0,0,115,22,0,0,0,12,2,6, + 249,0,0,0,12,4,0,0,115,22,0,0,0,12,2,6, 2,18,8,18,17,18,22,18,15,3,1,18,31,3,1,21, 21,3,1,114,249,0,0,0,99,0,0,0,0,0,0,0, 0,0,0,0,0,3,0,0,0,64,0,0,0,115,133,0, @@ -2155,7 +2155,7 @@ 0,86,1,113,3,0,100,0,0,83,41,1,78,114,4,0, 0,0,41,2,114,22,0,0,0,114,225,0,0,0,41,1, 114,127,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 227,0,0,0,160,4,0,0,115,2,0,0,0,6,0,122, + 227,0,0,0,161,4,0,0,115,2,0,0,0,6,0,122, 38,70,105,108,101,70,105,110,100,101,114,46,95,95,105,110, 105,116,95,95,46,60,108,111,99,97,108,115,62,46,60,103, 101,110,101,120,112,114,62,114,58,0,0,0,114,29,0,0, @@ -2168,7 +2168,7 @@ 111,97,100,101,114,95,100,101,116,97,105,108,115,90,7,108, 111,97,100,101,114,115,114,166,0,0,0,114,4,0,0,0, 41,1,114,127,0,0,0,114,5,0,0,0,114,185,0,0, - 0,154,4,0,0,115,16,0,0,0,0,4,6,1,19,1, + 0,155,4,0,0,115,16,0,0,0,0,4,6,1,19,1, 36,1,9,2,15,1,9,1,12,1,122,19,70,105,108,101, 70,105,110,100,101,114,46,95,95,105,110,105,116,95,95,99, 1,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0, @@ -2178,7 +2178,7 @@ 114,121,32,109,116,105,109,101,46,114,29,0,0,0,78,114, 87,0,0,0,41,1,114,8,1,0,0,41,1,114,108,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,250,0,0,0,168,4,0,0,115,2,0,0,0,0, + 0,114,250,0,0,0,169,4,0,0,115,2,0,0,0,0, 2,122,28,70,105,108,101,70,105,110,100,101,114,46,105,110, 118,97,108,105,100,97,116,101,95,99,97,99,104,101,115,99, 2,0,0,0,0,0,0,0,3,0,0,0,2,0,0,0, @@ -2202,7 +2202,7 @@ 114,181,0,0,0,114,127,0,0,0,114,156,0,0,0,41, 3,114,108,0,0,0,114,126,0,0,0,114,164,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 124,0,0,0,174,4,0,0,115,8,0,0,0,0,7,15, + 124,0,0,0,175,4,0,0,115,8,0,0,0,0,7,15, 1,12,1,10,1,122,22,70,105,108,101,70,105,110,100,101, 114,46,102,105,110,100,95,108,111,97,100,101,114,99,6,0, 0,0,0,0,0,0,7,0,0,0,7,0,0,0,67,0, @@ -2213,7 +2213,7 @@ 0,0,0,41,7,114,108,0,0,0,114,165,0,0,0,114, 126,0,0,0,114,35,0,0,0,90,4,115,109,115,108,114, 180,0,0,0,114,127,0,0,0,114,4,0,0,0,114,4, - 0,0,0,114,5,0,0,0,114,5,1,0,0,186,4,0, + 0,0,0,114,5,0,0,0,114,5,1,0,0,187,4,0, 0,115,6,0,0,0,0,1,15,1,18,1,122,20,70,105, 108,101,70,105,110,100,101,114,46,95,103,101,116,95,115,112, 101,99,78,99,3,0,0,0,0,0,0,0,14,0,0,0, @@ -2276,7 +2276,7 @@ 13,105,110,105,116,95,102,105,108,101,110,97,109,101,90,9, 102,117,108,108,95,112,97,116,104,114,164,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,181,0, - 0,0,191,4,0,0,115,68,0,0,0,0,3,6,1,19, + 0,0,192,4,0,0,115,68,0,0,0,0,3,6,1,19, 1,3,1,34,1,13,1,11,1,15,1,10,1,9,2,9, 1,9,1,15,2,9,1,6,2,12,1,18,1,22,1,10, 1,15,1,12,1,32,4,12,2,22,1,22,1,25,1,16, @@ -2312,7 +2312,7 @@ 0,0,146,2,0,113,6,0,83,114,4,0,0,0,41,1, 114,88,0,0,0,41,2,114,22,0,0,0,90,2,102,110, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,250, - 9,60,115,101,116,99,111,109,112,62,9,5,0,0,115,2, + 9,60,115,101,116,99,111,109,112,62,10,5,0,0,115,2, 0,0,0,9,0,122,41,70,105,108,101,70,105,110,100,101, 114,46,95,102,105,108,108,95,99,97,99,104,101,46,60,108, 111,99,97,108,115,62,46,60,115,101,116,99,111,109,112,62, @@ -2329,7 +2329,7 @@ 95,99,111,110,116,101,110,116,115,114,245,0,0,0,114,106, 0,0,0,114,237,0,0,0,114,225,0,0,0,90,8,110, 101,119,95,110,97,109,101,114,4,0,0,0,114,4,0,0, - 0,114,5,0,0,0,114,13,1,0,0,236,4,0,0,115, + 0,114,5,0,0,0,114,13,1,0,0,237,4,0,0,115, 34,0,0,0,0,2,9,1,3,1,31,1,22,3,11,3, 18,1,18,7,9,1,13,1,24,1,6,1,27,2,6,1, 17,1,9,1,18,1,122,22,70,105,108,101,70,105,110,100, @@ -2368,7 +2368,7 @@ 0,0,0,41,1,114,35,0,0,0,41,2,114,170,0,0, 0,114,12,1,0,0,114,4,0,0,0,114,5,0,0,0, 218,24,112,97,116,104,95,104,111,111,107,95,102,111,114,95, - 70,105,108,101,70,105,110,100,101,114,21,5,0,0,115,6, + 70,105,108,101,70,105,110,100,101,114,22,5,0,0,115,6, 0,0,0,0,2,12,1,18,1,122,54,70,105,108,101,70, 105,110,100,101,114,46,112,97,116,104,95,104,111,111,107,46, 60,108,111,99,97,108,115,62,46,112,97,116,104,95,104,111, @@ -2376,7 +2376,7 @@ 114,114,4,0,0,0,41,3,114,170,0,0,0,114,12,1, 0,0,114,18,1,0,0,114,4,0,0,0,41,2,114,170, 0,0,0,114,12,1,0,0,114,5,0,0,0,218,9,112, - 97,116,104,95,104,111,111,107,11,5,0,0,115,4,0,0, + 97,116,104,95,104,111,111,107,12,5,0,0,115,4,0,0, 0,0,10,21,6,122,20,70,105,108,101,70,105,110,100,101, 114,46,112,97,116,104,95,104,111,111,107,99,1,0,0,0, 0,0,0,0,1,0,0,0,2,0,0,0,67,0,0,0, @@ -2385,7 +2385,7 @@ 110,100,101,114,40,123,33,114,125,41,41,2,114,47,0,0, 0,114,35,0,0,0,41,1,114,108,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,114,244,0,0, - 0,29,5,0,0,115,2,0,0,0,0,1,122,19,70,105, + 0,30,5,0,0,115,2,0,0,0,0,1,122,19,70,105, 108,101,70,105,110,100,101,114,46,95,95,114,101,112,114,95, 95,41,15,114,112,0,0,0,114,111,0,0,0,114,113,0, 0,0,114,114,0,0,0,114,185,0,0,0,114,250,0,0, @@ -2393,7 +2393,7 @@ 114,5,1,0,0,114,181,0,0,0,114,13,1,0,0,114, 183,0,0,0,114,19,1,0,0,114,244,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,114,6,1,0,0,145,4,0,0,115,20,0,0,0, + 0,0,114,6,1,0,0,146,4,0,0,115,20,0,0,0, 12,7,6,2,12,14,12,4,6,2,12,12,12,5,15,45, 12,31,18,18,114,6,1,0,0,99,4,0,0,0,0,0, 0,0,6,0,0,0,11,0,0,0,67,0,0,0,115,195, @@ -2419,7 +2419,7 @@ 104,110,97,109,101,90,9,99,112,97,116,104,110,97,109,101, 114,127,0,0,0,114,164,0,0,0,114,4,0,0,0,114, 4,0,0,0,114,5,0,0,0,218,14,95,102,105,120,95, - 117,112,95,109,111,100,117,108,101,35,5,0,0,115,34,0, + 117,112,95,109,111,100,117,108,101,36,5,0,0,115,34,0, 0,0,0,2,15,1,15,1,6,1,6,1,12,1,12,1, 18,2,15,1,6,1,21,1,3,1,10,1,10,1,10,1, 14,1,13,2,114,24,1,0,0,99,0,0,0,0,0,0, @@ -2440,7 +2440,7 @@ 0,41,3,90,10,101,120,116,101,110,115,105,111,110,115,90, 6,115,111,117,114,99,101,90,8,98,121,116,101,99,111,100, 101,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,161,0,0,0,58,5,0,0,115,8,0,0,0,0,5, + 114,161,0,0,0,59,5,0,0,115,8,0,0,0,0,5, 18,1,12,1,12,1,114,161,0,0,0,99,1,0,0,0, 0,0,0,0,12,0,0,0,12,0,0,0,67,0,0,0, 115,70,2,0,0,124,0,0,97,0,0,116,0,0,106,1, @@ -2502,7 +2502,7 @@ 83,41,2,114,29,0,0,0,78,41,1,114,31,0,0,0, 41,2,114,22,0,0,0,114,77,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,114,227,0,0,0, - 94,5,0,0,115,2,0,0,0,6,0,122,25,95,115,101, + 95,5,0,0,115,2,0,0,0,6,0,122,25,95,115,101, 116,117,112,46,60,108,111,99,97,108,115,62,46,60,103,101, 110,101,120,112,114,62,114,59,0,0,0,122,30,105,109,112, 111,114,116,108,105,98,32,114,101,113,117,105,114,101,115,32, @@ -2532,7 +2532,7 @@ 90,14,119,101,97,107,114,101,102,95,109,111,100,117,108,101, 90,13,119,105,110,114,101,103,95,109,111,100,117,108,101,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,6, - 95,115,101,116,117,112,69,5,0,0,115,82,0,0,0,0, + 95,115,101,116,117,112,70,5,0,0,115,82,0,0,0,0, 8,6,1,9,1,9,3,13,1,13,1,15,1,18,2,13, 1,20,3,33,1,19,2,31,1,10,1,15,1,13,1,4, 2,3,1,15,1,5,1,13,1,12,2,12,1,16,1,16, @@ -2558,7 +2558,7 @@ 114,218,0,0,0,41,2,114,32,1,0,0,90,17,115,117, 112,112,111,114,116,101,100,95,108,111,97,100,101,114,115,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,8, - 95,105,110,115,116,97,108,108,137,5,0,0,115,16,0,0, + 95,105,110,115,116,97,108,108,138,5,0,0,115,16,0,0, 0,0,2,10,1,9,1,28,1,15,1,16,1,16,4,9, 1,114,35,1,0,0,41,3,122,3,119,105,110,114,1,0, 0,0,114,2,0,0,0,41,57,114,114,0,0,0,114,10, @@ -2587,7 +2587,7 @@ 0,0,0,114,4,0,0,0,114,5,0,0,0,218,8,60, 109,111,100,117,108,101,62,8,0,0,0,115,100,0,0,0, 6,17,6,3,12,12,12,5,12,5,12,6,12,12,12,10, - 12,9,12,5,12,7,15,22,15,113,22,1,18,2,6,1, + 12,9,12,5,12,7,15,22,15,114,22,1,18,2,6,1, 6,2,9,2,9,2,10,2,21,44,12,33,12,19,12,12, 12,12,18,8,12,28,12,17,21,55,21,12,18,10,12,14, 9,3,12,1,15,65,19,64,19,28,22,110,19,41,25,43, -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 23:30:04 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 13 Jun 2016 03:30:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Regenerated_py?= =?utf-8?q?doc_topics_for_3=2E5=2E2rc1=2E?= Message-ID: <20160613033003.26046.48759.69E8E7CE@psf.io> https://hg.python.org/cpython/rev/4fc624e90291 changeset: 101962:4fc624e90291 branch: 3.5 parent: 101909:a7e04b4e51b2 user: Larry Hastings date: Sat Jun 11 20:40:26 2016 -0700 summary: Regenerated pydoc topics for 3.5.2rc1. files: Lib/pydoc_data/topics.py | 40 ++++++++++++++-------------- 1 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Sat Dec 5 17:02:49 2015 -topics = {'assert': u'\nThe "assert" statement\n**********************\n\nAssert statements are a convenient way to insert debugging assertions\ninto a program:\n\n assert_stmt ::= "assert" expression ["," expression]\n\nThe simple form, "assert expression", is equivalent to\n\n if __debug__:\n if not expression: raise AssertionError\n\nThe extended form, "assert expression1, expression2", is equivalent to\n\n if __debug__:\n if not expression1: raise AssertionError(expression2)\n\nThese equivalences assume that "__debug__" and "AssertionError" refer\nto the built-in variables with those names. In the current\nimplementation, the built-in variable "__debug__" is "True" under\nnormal circumstances, "False" when optimization is requested (command\nline option -O). The current code generator emits no code for an\nassert statement when optimization is requested at compile time. Note\nthat it is unnecessary to include the source code for the expression\nthat failed in the error message; it will be displayed as part of the\nstack trace.\n\nAssignments to "__debug__" are illegal. The value for the built-in\nvariable is determined when the interpreter starts.\n', - 'assignment': u'\nAssignment statements\n*********************\n\nAssignment statements are used to (re)bind names to values and to\nmodify attributes or items of mutable objects:\n\n assignment_stmt ::= (target_list "=")+ (expression_list | yield_expression)\n target_list ::= target ("," target)* [","]\n target ::= identifier\n | "(" target_list ")"\n | "[" target_list "]"\n | attributeref\n | subscription\n | slicing\n | "*" target\n\n(See section *Primaries* for the syntax definitions for\n*attributeref*, *subscription*, and *slicing*.)\n\nAn assignment statement evaluates the expression list (remember that\nthis can be a single expression or a comma-separated list, the latter\nyielding a tuple) and assigns the single resulting object to each of\nthe target lists, from left to right.\n\nAssignment is defined recursively depending on the form of the target\n(list). When a target is part of a mutable object (an attribute\nreference, subscription or slicing), the mutable object must\nultimately perform the assignment and decide about its validity, and\nmay raise an exception if the assignment is unacceptable. The rules\nobserved by various types and the exceptions raised are given with the\ndefinition of the object types (see section *The standard type\nhierarchy*).\n\nAssignment of an object to a target list, optionally enclosed in\nparentheses or square brackets, is recursively defined as follows.\n\n* If the target list is a single target: The object is assigned to\n that target.\n\n* If the target list is a comma-separated list of targets: The\n object must be an iterable with the same number of items as there\n are targets in the target list, and the items are assigned, from\n left to right, to the corresponding targets.\n\n * If the target list contains one target prefixed with an\n asterisk, called a "starred" target: The object must be a sequence\n with at least as many items as there are targets in the target\n list, minus one. The first items of the sequence are assigned,\n from left to right, to the targets before the starred target. The\n final items of the sequence are assigned to the targets after the\n starred target. A list of the remaining items in the sequence is\n then assigned to the starred target (the list can be empty).\n\n * Else: The object must be a sequence with the same number of\n items as there are targets in the target list, and the items are\n assigned, from left to right, to the corresponding targets.\n\nAssignment of an object to a single target is recursively defined as\nfollows.\n\n* If the target is an identifier (name):\n\n * If the name does not occur in a "global" or "nonlocal" statement\n in the current code block: the name is bound to the object in the\n current local namespace.\n\n * Otherwise: the name is bound to the object in the global\n namespace or the outer namespace determined by "nonlocal",\n respectively.\n\n The name is rebound if it was already bound. This may cause the\n reference count for the object previously bound to the name to reach\n zero, causing the object to be deallocated and its destructor (if it\n has one) to be called.\n\n* If the target is a target list enclosed in parentheses or in\n square brackets: The object must be an iterable with the same number\n of items as there are targets in the target list, and its items are\n assigned, from left to right, to the corresponding targets.\n\n* If the target is an attribute reference: The primary expression in\n the reference is evaluated. It should yield an object with\n assignable attributes; if this is not the case, "TypeError" is\n raised. That object is then asked to assign the assigned object to\n the given attribute; if it cannot perform the assignment, it raises\n an exception (usually but not necessarily "AttributeError").\n\n Note: If the object is a class instance and the attribute reference\n occurs on both sides of the assignment operator, the RHS expression,\n "a.x" can access either an instance attribute or (if no instance\n attribute exists) a class attribute. The LHS target "a.x" is always\n set as an instance attribute, creating it if necessary. Thus, the\n two occurrences of "a.x" do not necessarily refer to the same\n attribute: if the RHS expression refers to a class attribute, the\n LHS creates a new instance attribute as the target of the\n assignment:\n\n class Cls:\n x = 3 # class variable\n inst = Cls()\n inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x as 3\n\n This description does not necessarily apply to descriptor\n attributes, such as properties created with "property()".\n\n* If the target is a subscription: The primary expression in the\n reference is evaluated. It should yield either a mutable sequence\n object (such as a list) or a mapping object (such as a dictionary).\n Next, the subscript expression is evaluated.\n\n If the primary is a mutable sequence object (such as a list), the\n subscript must yield an integer. If it is negative, the sequence\'s\n length is added to it. The resulting value must be a nonnegative\n integer less than the sequence\'s length, and the sequence is asked\n to assign the assigned object to its item with that index. If the\n index is out of range, "IndexError" is raised (assignment to a\n subscripted sequence cannot add new items to a list).\n\n If the primary is a mapping object (such as a dictionary), the\n subscript must have a type compatible with the mapping\'s key type,\n and the mapping is then asked to create a key/datum pair which maps\n the subscript to the assigned object. This can either replace an\n existing key/value pair with the same key value, or insert a new\n key/value pair (if no key with the same value existed).\n\n For user-defined objects, the "__setitem__()" method is called with\n appropriate arguments.\n\n* If the target is a slicing: The primary expression in the\n reference is evaluated. It should yield a mutable sequence object\n (such as a list). The assigned object should be a sequence object\n of the same type. Next, the lower and upper bound expressions are\n evaluated, insofar they are present; defaults are zero and the\n sequence\'s length. The bounds should evaluate to integers. If\n either bound is negative, the sequence\'s length is added to it. The\n resulting bounds are clipped to lie between zero and the sequence\'s\n length, inclusive. Finally, the sequence object is asked to replace\n the slice with the items of the assigned sequence. The length of\n the slice may be different from the length of the assigned sequence,\n thus changing the length of the target sequence, if the target\n sequence allows it.\n\n**CPython implementation detail:** In the current implementation, the\nsyntax for targets is taken to be the same as for expressions, and\ninvalid syntax is rejected during the code generation phase, causing\nless detailed error messages.\n\nAlthough the definition of assignment implies that overlaps between\nthe left-hand side and the right-hand side are \'simultanenous\' (for\nexample "a, b = b, a" swaps two variables), overlaps *within* the\ncollection of assigned-to variables occur left-to-right, sometimes\nresulting in confusion. For instance, the following program prints\n"[0, 2]":\n\n x = [0, 1]\n i = 0\n i, x[i] = 1, 2 # i is updated, then x[i] is updated\n print(x)\n\nSee also: **PEP 3132** - Extended Iterable Unpacking\n\n The specification for the "*target" feature.\n\n\nAugmented assignment statements\n===============================\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n augtarget ::= identifier | attributeref | subscription | slicing\n augop ::= "+=" | "-=" | "*=" | "@=" | "/=" | "//=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section *Primaries* for the syntax definitions of the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like "x += 1" can be rewritten as\n"x = x + 1" to achieve a similar, but not exactly equal effect. In the\naugmented version, "x" is only evaluated once. Also, when possible,\nthe actual operation is performed *in-place*, meaning that rather than\ncreating a new object and assigning that to the target, the old object\nis modified instead.\n\nUnlike normal assignments, augmented assignments evaluate the left-\nhand side *before* evaluating the right-hand side. For example, "a[i]\n+= f(x)" first looks-up "a[i]", then it evaluates "f(x)" and performs\nthe addition, and lastly, it writes the result back to "a[i]".\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same *caveat about\nclass and instance attributes* applies as for regular assignments.\n', +# Autogenerated by Sphinx on Sat Jun 11 20:39:59 2016 +topics = {'assert': u'\nThe "assert" statement\n**********************\n\nAssert statements are a convenient way to insert debugging assertions\ninto a program:\n\n assert_stmt ::= "assert" expression ["," expression]\n\nThe simple form, "assert expression", is equivalent to\n\n if __debug__:\n if not expression: raise AssertionError\n\nThe extended form, "assert expression1, expression2", is equivalent to\n\n if __debug__:\n if not expression1: raise AssertionError(expression2)\n\nThese equivalences assume that "__debug__" and "AssertionError" refer\nto the built-in variables with those names. In the current\nimplementation, the built-in variable "__debug__" is "True" under\nnormal circumstances, "False" when optimization is requested (command\nline option -O). The current code generator emits no code for an\nassert statement when optimization is requested at compile time. Note\nthat it is unnecessary to include the source code for the expression\nthat failed in the error message; it will be displayed as part of the\nstack trace.\n\nAssignments to "__debug__" are illegal. The value for the built-in\nvariable is determined when the interpreter starts.\n', + 'assignment': u'\nAssignment statements\n*********************\n\nAssignment statements are used to (re)bind names to values and to\nmodify attributes or items of mutable objects:\n\n assignment_stmt ::= (target_list "=")+ (starred_expression | yield_expression)\n target_list ::= target ("," target)* [","]\n target ::= identifier\n | "(" target_list ")"\n | "[" [target_list] "]"\n | attributeref\n | subscription\n | slicing\n | "*" target\n\n(See section *Primaries* for the syntax definitions for\n*attributeref*, *subscription*, and *slicing*.)\n\nAn assignment statement evaluates the expression list (remember that\nthis can be a single expression or a comma-separated list, the latter\nyielding a tuple) and assigns the single resulting object to each of\nthe target lists, from left to right.\n\nAssignment is defined recursively depending on the form of the target\n(list). When a target is part of a mutable object (an attribute\nreference, subscription or slicing), the mutable object must\nultimately perform the assignment and decide about its validity, and\nmay raise an exception if the assignment is unacceptable. The rules\nobserved by various types and the exceptions raised are given with the\ndefinition of the object types (see section *The standard type\nhierarchy*).\n\nAssignment of an object to a target list, optionally enclosed in\nparentheses or square brackets, is recursively defined as follows.\n\n* If the target list is empty: The object must also be an empty\n iterable.\n\n* If the target list is a single target in parentheses: The object\n is assigned to that target.\n\n* If the target list is a comma-separated list of targets, or a\n single target in square brackets: The object must be an iterable\n with the same number of items as there are targets in the target\n list, and the items are assigned, from left to right, to the\n corresponding targets.\n\n * If the target list contains one target prefixed with an\n asterisk, called a "starred" target: The object must be an\n iterable with at least as many items as there are targets in the\n target list, minus one. The first items of the iterable are\n assigned, from left to right, to the targets before the starred\n target. The final items of the iterable are assigned to the\n targets after the starred target. A list of the remaining items\n in the iterable is then assigned to the starred target (the list\n can be empty).\n\n * Else: The object must be an iterable with the same number of\n items as there are targets in the target list, and the items are\n assigned, from left to right, to the corresponding targets.\n\nAssignment of an object to a single target is recursively defined as\nfollows.\n\n* If the target is an identifier (name):\n\n * If the name does not occur in a "global" or "nonlocal" statement\n in the current code block: the name is bound to the object in the\n current local namespace.\n\n * Otherwise: the name is bound to the object in the global\n namespace or the outer namespace determined by "nonlocal",\n respectively.\n\n The name is rebound if it was already bound. This may cause the\n reference count for the object previously bound to the name to reach\n zero, causing the object to be deallocated and its destructor (if it\n has one) to be called.\n\n* If the target is an attribute reference: The primary expression in\n the reference is evaluated. It should yield an object with\n assignable attributes; if this is not the case, "TypeError" is\n raised. That object is then asked to assign the assigned object to\n the given attribute; if it cannot perform the assignment, it raises\n an exception (usually but not necessarily "AttributeError").\n\n Note: If the object is a class instance and the attribute reference\n occurs on both sides of the assignment operator, the RHS expression,\n "a.x" can access either an instance attribute or (if no instance\n attribute exists) a class attribute. The LHS target "a.x" is always\n set as an instance attribute, creating it if necessary. Thus, the\n two occurrences of "a.x" do not necessarily refer to the same\n attribute: if the RHS expression refers to a class attribute, the\n LHS creates a new instance attribute as the target of the\n assignment:\n\n class Cls:\n x = 3 # class variable\n inst = Cls()\n inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x as 3\n\n This description does not necessarily apply to descriptor\n attributes, such as properties created with "property()".\n\n* If the target is a subscription: The primary expression in the\n reference is evaluated. It should yield either a mutable sequence\n object (such as a list) or a mapping object (such as a dictionary).\n Next, the subscript expression is evaluated.\n\n If the primary is a mutable sequence object (such as a list), the\n subscript must yield an integer. If it is negative, the sequence\'s\n length is added to it. The resulting value must be a nonnegative\n integer less than the sequence\'s length, and the sequence is asked\n to assign the assigned object to its item with that index. If the\n index is out of range, "IndexError" is raised (assignment to a\n subscripted sequence cannot add new items to a list).\n\n If the primary is a mapping object (such as a dictionary), the\n subscript must have a type compatible with the mapping\'s key type,\n and the mapping is then asked to create a key/datum pair which maps\n the subscript to the assigned object. This can either replace an\n existing key/value pair with the same key value, or insert a new\n key/value pair (if no key with the same value existed).\n\n For user-defined objects, the "__setitem__()" method is called with\n appropriate arguments.\n\n* If the target is a slicing: The primary expression in the\n reference is evaluated. It should yield a mutable sequence object\n (such as a list). The assigned object should be a sequence object\n of the same type. Next, the lower and upper bound expressions are\n evaluated, insofar they are present; defaults are zero and the\n sequence\'s length. The bounds should evaluate to integers. If\n either bound is negative, the sequence\'s length is added to it. The\n resulting bounds are clipped to lie between zero and the sequence\'s\n length, inclusive. Finally, the sequence object is asked to replace\n the slice with the items of the assigned sequence. The length of\n the slice may be different from the length of the assigned sequence,\n thus changing the length of the target sequence, if the target\n sequence allows it.\n\n**CPython implementation detail:** In the current implementation, the\nsyntax for targets is taken to be the same as for expressions, and\ninvalid syntax is rejected during the code generation phase, causing\nless detailed error messages.\n\nAlthough the definition of assignment implies that overlaps between\nthe left-hand side and the right-hand side are \'simultaneous\' (for\nexample "a, b = b, a" swaps two variables), overlaps *within* the\ncollection of assigned-to variables occur left-to-right, sometimes\nresulting in confusion. For instance, the following program prints\n"[0, 2]":\n\n x = [0, 1]\n i = 0\n i, x[i] = 1, 2 # i is updated, then x[i] is updated\n print(x)\n\nSee also: **PEP 3132** - Extended Iterable Unpacking\n\n The specification for the "*target" feature.\n\n\nAugmented assignment statements\n===============================\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n augtarget ::= identifier | attributeref | subscription | slicing\n augop ::= "+=" | "-=" | "*=" | "@=" | "/=" | "//=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section *Primaries* for the syntax definitions of the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like "x += 1" can be rewritten as\n"x = x + 1" to achieve a similar, but not exactly equal effect. In the\naugmented version, "x" is only evaluated once. Also, when possible,\nthe actual operation is performed *in-place*, meaning that rather than\ncreating a new object and assigning that to the target, the old object\nis modified instead.\n\nUnlike normal assignments, augmented assignments evaluate the left-\nhand side *before* evaluating the right-hand side. For example, "a[i]\n+= f(x)" first looks-up "a[i]", then it evaluates "f(x)" and performs\nthe addition, and lastly, it writes the result back to "a[i]".\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same *caveat about\nclass and instance attributes* applies as for regular assignments.\n', 'atom-identifiers': u'\nIdentifiers (Names)\n*******************\n\nAn identifier occurring as an atom is a name. See section\n*Identifiers and keywords* for lexical definition and section *Naming\nand binding* for documentation of naming and binding.\n\nWhen the name is bound to an object, evaluation of the atom yields\nthat object. When a name is not bound, an attempt to evaluate it\nraises a "NameError" exception.\n\n**Private name mangling:** When an identifier that textually occurs in\na class definition begins with two or more underscore characters and\ndoes not end in two or more underscores, it is considered a *private\nname* of that class. Private names are transformed to a longer form\nbefore code is generated for them. The transformation inserts the\nclass name, with leading underscores removed and a single underscore\ninserted, in front of the name. For example, the identifier "__spam"\noccurring in a class named "Ham" will be transformed to "_Ham__spam".\nThis transformation is independent of the syntactical context in which\nthe identifier is used. If the transformed name is extremely long\n(longer than 255 characters), implementation defined truncation may\nhappen. If the class name consists only of underscores, no\ntransformation is done.\n', 'atom-literals': u"\nLiterals\n********\n\nPython supports string and bytes literals and various numeric\nliterals:\n\n literal ::= stringliteral | bytesliteral\n | integer | floatnumber | imagnumber\n\nEvaluation of a literal yields an object of the given type (string,\nbytes, integer, floating point number, complex number) with the given\nvalue. The value may be approximated in the case of floating point\nand imaginary (complex) literals. See section *Literals* for details.\n\nAll literals correspond to immutable data types, and hence the\nobject's identity is less important than its value. Multiple\nevaluations of literals with the same value (either the same\noccurrence in the program text or a different occurrence) may obtain\nthe same object or a different object with the same value.\n", 'attribute-access': u'\nCustomizing attribute access\n****************************\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of "x.name") for\nclass instances.\n\nobject.__getattr__(self, name)\n\n Called when an attribute lookup has not found the attribute in the\n usual places (i.e. it is not an instance attribute nor is it found\n in the class tree for "self"). "name" is the attribute name. This\n method should return the (computed) attribute value or raise an\n "AttributeError" exception.\n\n Note that if the attribute is found through the normal mechanism,\n "__getattr__()" is not called. (This is an intentional asymmetry\n between "__getattr__()" and "__setattr__()".) This is done both for\n efficiency reasons and because otherwise "__getattr__()" would have\n no way to access other attributes of the instance. Note that at\n least for instance variables, you can fake total control by not\n inserting any values in the instance attribute dictionary (but\n instead inserting them in another object). See the\n "__getattribute__()" method below for a way to actually get total\n control over attribute access.\n\nobject.__getattribute__(self, name)\n\n Called unconditionally to implement attribute accesses for\n instances of the class. If the class also defines "__getattr__()",\n the latter will not be called unless "__getattribute__()" either\n calls it explicitly or raises an "AttributeError". This method\n should return the (computed) attribute value or raise an\n "AttributeError" exception. In order to avoid infinite recursion in\n this method, its implementation should always call the base class\n method with the same name to access any attributes it needs, for\n example, "object.__getattribute__(self, name)".\n\n Note: This method may still be bypassed when looking up special\n methods as the result of implicit invocation via language syntax\n or built-in functions. See *Special method lookup*.\n\nobject.__setattr__(self, name, value)\n\n Called when an attribute assignment is attempted. This is called\n instead of the normal mechanism (i.e. store the value in the\n instance dictionary). *name* is the attribute name, *value* is the\n value to be assigned to it.\n\n If "__setattr__()" wants to assign to an instance attribute, it\n should call the base class method with the same name, for example,\n "object.__setattr__(self, name, value)".\n\nobject.__delattr__(self, name)\n\n Like "__setattr__()" but for attribute deletion instead of\n assignment. This should only be implemented if "del obj.name" is\n meaningful for the object.\n\nobject.__dir__(self)\n\n Called when "dir()" is called on the object. A sequence must be\n returned. "dir()" converts the returned sequence to a list and\n sorts it.\n\n\nImplementing Descriptors\n========================\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in an\n*owner* class (the descriptor must be in either the owner\'s class\ndictionary or in the class dictionary for one of its parents). In the\nexamples below, "the attribute" refers to the attribute whose name is\nthe key of the property in the owner class\' "__dict__".\n\nobject.__get__(self, instance, owner)\n\n Called to get the attribute of the owner class (class attribute\n access) or of an instance of that class (instance attribute\n access). *owner* is always the owner class, while *instance* is the\n instance that the attribute was accessed through, or "None" when\n the attribute is accessed through the *owner*. This method should\n return the (computed) attribute value or raise an "AttributeError"\n exception.\n\nobject.__set__(self, instance, value)\n\n Called to set the attribute on an instance *instance* of the owner\n class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n Called to delete the attribute on an instance *instance* of the\n owner class.\n\nThe attribute "__objclass__" is interpreted by the "inspect" module as\nspecifying the class where this object was defined (setting this\nappropriately can assist in runtime introspection of dynamic class\nattributes). For callables, it may indicate that an instance of the\ngiven type (or a subclass) is expected or required as the first\npositional argument (for example, CPython sets this attribute for\nunbound methods that are implemented in C).\n\n\nInvoking Descriptors\n====================\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol: "__get__()", "__set__()", and\n"__delete__()". If any of those methods are defined for an object, it\nis said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, "a.x" has a\nlookup chain starting with "a.__dict__[\'x\']", then\n"type(a).__dict__[\'x\']", and continuing through the base classes of\n"type(a)" excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead. Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called.\n\nThe starting point for descriptor invocation is a binding, "a.x". How\nthe arguments are assembled depends on "a":\n\nDirect Call\n The simplest and least common call is when user code directly\n invokes a descriptor method: "x.__get__(a)".\n\nInstance Binding\n If binding to an object instance, "a.x" is transformed into the\n call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n\nClass Binding\n If binding to a class, "A.x" is transformed into the call:\n "A.__dict__[\'x\'].__get__(None, A)".\n\nSuper Binding\n If "a" is an instance of "super", then the binding "super(B,\n obj).m()" searches "obj.__class__.__mro__" for the base class "A"\n immediately preceding "B" and then invokes the descriptor with the\n call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined. A descriptor can define\nany combination of "__get__()", "__set__()" and "__delete__()". If it\ndoes not define "__get__()", then accessing the attribute will return\nthe descriptor object itself unless there is a value in the object\'s\ninstance dictionary. If the descriptor defines "__set__()" and/or\n"__delete__()", it is a data descriptor; if it defines neither, it is\na non-data descriptor. Normally, data descriptors define both\n"__get__()" and "__set__()", while non-data descriptors have just the\n"__get__()" method. Data descriptors with "__set__()" and "__get__()"\ndefined always override a redefinition in an instance dictionary. In\ncontrast, non-data descriptors can be overridden by instances.\n\nPython methods (including "staticmethod()" and "classmethod()") are\nimplemented as non-data descriptors. Accordingly, instances can\nredefine and override methods. This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe "property()" function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n=========\n\nBy default, instances of classes have a dictionary for attribute\nstorage. This wastes space for objects having very few instance\nvariables. The space consumption can become acute when creating large\nnumbers of instances.\n\nThe default can be overridden by defining *__slots__* in a class\ndefinition. The *__slots__* declaration takes a sequence of instance\nvariables and reserves just enough space in each instance to hold a\nvalue for each variable. Space is saved because *__dict__* is not\ncreated for each instance.\n\nobject.__slots__\n\n This class variable can be assigned a string, iterable, or sequence\n of strings with variable names used by instances. *__slots__*\n reserves space for the declared variables and prevents the\n automatic creation of *__dict__* and *__weakref__* for each\n instance.\n\n\nNotes on using *__slots__*\n--------------------------\n\n* When inheriting from a class without *__slots__*, the *__dict__*\n attribute of that class will always be accessible, so a *__slots__*\n definition in the subclass is meaningless.\n\n* Without a *__dict__* variable, instances cannot be assigned new\n variables not listed in the *__slots__* definition. Attempts to\n assign to an unlisted variable name raises "AttributeError". If\n dynamic assignment of new variables is desired, then add\n "\'__dict__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n* Without a *__weakref__* variable for each instance, classes\n defining *__slots__* do not support weak references to its\n instances. If weak reference support is needed, then add\n "\'__weakref__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n* *__slots__* are implemented at the class level by creating\n descriptors (*Implementing Descriptors*) for each variable name. As\n a result, class attributes cannot be used to set default values for\n instance variables defined by *__slots__*; otherwise, the class\n attribute would overwrite the descriptor assignment.\n\n* The action of a *__slots__* declaration is limited to the class\n where it is defined. As a result, subclasses will have a *__dict__*\n unless they also define *__slots__* (which must only contain names\n of any *additional* slots).\n\n* If a class defines a slot also defined in a base class, the\n instance variable defined by the base class slot is inaccessible\n (except by retrieving its descriptor directly from the base class).\n This renders the meaning of the program undefined. In the future, a\n check may be added to prevent this.\n\n* Nonempty *__slots__* does not work for classes derived from\n "variable-length" built-in types such as "int", "bytes" and "tuple".\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings\n may also be used; however, in the future, special meaning may be\n assigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n *__slots__*.\n', @@ -16,36 +16,36 @@ 'booleans': u'\nBoolean operations\n******************\n\n or_test ::= and_test | or_test "or" and_test\n and_test ::= not_test | and_test "and" not_test\n not_test ::= comparison | "not" not_test\n\nIn the context of Boolean operations, and also when expressions are\nused by control flow statements, the following values are interpreted\nas false: "False", "None", numeric zero of all types, and empty\nstrings and containers (including strings, tuples, lists,\ndictionaries, sets and frozensets). All other values are interpreted\nas true. User-defined objects can customize their truth value by\nproviding a "__bool__()" method.\n\nThe operator "not" yields "True" if its argument is false, "False"\notherwise.\n\nThe expression "x and y" first evaluates *x*; if *x* is false, its\nvalue is returned; otherwise, *y* is evaluated and the resulting value\nis returned.\n\nThe expression "x or y" first evaluates *x*; if *x* is true, its value\nis returned; otherwise, *y* is evaluated and the resulting value is\nreturned.\n\n(Note that neither "and" nor "or" restrict the value and type they\nreturn to "False" and "True", but rather return the last evaluated\nargument. This is sometimes useful, e.g., if "s" is a string that\nshould be replaced by a default value if it is empty, the expression\n"s or \'foo\'" yields the desired value. Because "not" has to create a\nnew value, it returns a boolean value regardless of the type of its\nargument (for example, "not \'foo\'" produces "False" rather than "\'\'".)\n', 'break': u'\nThe "break" statement\n*********************\n\n break_stmt ::= "break"\n\n"break" may only occur syntactically nested in a "for" or "while"\nloop, but not nested in a function or class definition within that\nloop.\n\nIt terminates the nearest enclosing loop, skipping the optional "else"\nclause if the loop has one.\n\nIf a "for" loop is terminated by "break", the loop control target\nkeeps its current value.\n\nWhen "break" passes control out of a "try" statement with a "finally"\nclause, that "finally" clause is executed before really leaving the\nloop.\n', 'callable-types': u'\nEmulating callable objects\n**************************\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, "x(arg1, arg2, ...)" is a shorthand for\n "x.__call__(arg1, arg2, ...)".\n', - 'calls': u'\nCalls\n*****\n\nA call calls a callable object (e.g., a *function*) with a possibly\nempty series of *arguments*:\n\n call ::= primary "(" [argument_list [","] | comprehension] ")"\n argument_list ::= positional_arguments ["," keyword_arguments]\n ["," "*" expression] ["," keyword_arguments]\n ["," "**" expression]\n | keyword_arguments ["," "*" expression]\n ["," keyword_arguments] ["," "**" expression]\n | "*" expression ["," keyword_arguments] ["," "**" expression]\n | "**" expression\n positional_arguments ::= expression ("," expression)*\n keyword_arguments ::= keyword_item ("," keyword_item)*\n keyword_item ::= identifier "=" expression\n\nAn optional trailing comma may be present after the positional and\nkeyword arguments but does not affect the semantics.\n\nThe primary must evaluate to a callable object (user-defined\nfunctions, built-in functions, methods of built-in objects, class\nobjects, methods of class instances, and all objects having a\n"__call__()" method are callable). All argument expressions are\nevaluated before the call is attempted. Please refer to section\n*Function definitions* for the syntax of formal *parameter* lists.\n\nIf keyword arguments are present, they are first converted to\npositional arguments, as follows. First, a list of unfilled slots is\ncreated for the formal parameters. If there are N positional\narguments, they are placed in the first N slots. Next, for each\nkeyword argument, the identifier is used to determine the\ncorresponding slot (if the identifier is the same as the first formal\nparameter name, the first slot is used, and so on). If the slot is\nalready filled, a "TypeError" exception is raised. Otherwise, the\nvalue of the argument is placed in the slot, filling it (even if the\nexpression is "None", it fills the slot). When all arguments have\nbeen processed, the slots that are still unfilled are filled with the\ncorresponding default value from the function definition. (Default\nvalues are calculated, once, when the function is defined; thus, a\nmutable object such as a list or dictionary used as default value will\nbe shared by all calls that don\'t specify an argument value for the\ncorresponding slot; this should usually be avoided.) If there are any\nunfilled slots for which no default value is specified, a "TypeError"\nexception is raised. Otherwise, the list of filled slots is used as\nthe argument list for the call.\n\n**CPython implementation detail:** An implementation may provide\nbuilt-in functions whose positional parameters do not have names, even\nif they are \'named\' for the purpose of documentation, and which\ntherefore cannot be supplied by keyword. In CPython, this is the case\nfor functions implemented in C that use "PyArg_ParseTuple()" to parse\ntheir arguments.\n\nIf there are more positional arguments than there are formal parameter\nslots, a "TypeError" exception is raised, unless a formal parameter\nusing the syntax "*identifier" is present; in this case, that formal\nparameter receives a tuple containing the excess positional arguments\n(or an empty tuple if there were no excess positional arguments).\n\nIf any keyword argument does not correspond to a formal parameter\nname, a "TypeError" exception is raised, unless a formal parameter\nusing the syntax "**identifier" is present; in this case, that formal\nparameter receives a dictionary containing the excess keyword\narguments (using the keywords as keys and the argument values as\ncorresponding values), or a (new) empty dictionary if there were no\nexcess keyword arguments.\n\nIf the syntax "*expression" appears in the function call, "expression"\nmust evaluate to an iterable. Elements from this iterable are treated\nas if they were additional positional arguments; if there are\npositional arguments *x1*, ..., *xN*, and "expression" evaluates to a\nsequence *y1*, ..., *yM*, this is equivalent to a call with M+N\npositional arguments *x1*, ..., *xN*, *y1*, ..., *yM*.\n\nA consequence of this is that although the "*expression" syntax may\nappear *after* some keyword arguments, it is processed *before* the\nkeyword arguments (and the "**expression" argument, if any -- see\nbelow). So:\n\n >>> def f(a, b):\n ... print(a, b)\n ...\n >>> f(b=1, *(2,))\n 2 1\n >>> f(a=1, *(2,))\n Traceback (most recent call last):\n File "", line 1, in ?\n TypeError: f() got multiple values for keyword argument \'a\'\n >>> f(1, *(2,))\n 1 2\n\nIt is unusual for both keyword arguments and the "*expression" syntax\nto be used in the same call, so in practice this confusion does not\narise.\n\nIf the syntax "**expression" appears in the function call,\n"expression" must evaluate to a mapping, the contents of which are\ntreated as additional keyword arguments. In the case of a keyword\nappearing in both "expression" and as an explicit keyword argument, a\n"TypeError" exception is raised.\n\nFormal parameters using the syntax "*identifier" or "**identifier"\ncannot be used as positional argument slots or as keyword argument\nnames.\n\nA call always returns some value, possibly "None", unless it raises an\nexception. How this value is computed depends on the type of the\ncallable object.\n\nIf it is---\n\na user-defined function:\n The code block for the function is executed, passing it the\n argument list. The first thing the code block will do is bind the\n formal parameters to the arguments; this is described in section\n *Function definitions*. When the code block executes a "return"\n statement, this specifies the return value of the function call.\n\na built-in function or method:\n The result is up to the interpreter; see *Built-in Functions* for\n the descriptions of built-in functions and methods.\n\na class object:\n A new instance of that class is returned.\n\na class instance method:\n The corresponding user-defined function is called, with an argument\n list that is one longer than the argument list of the call: the\n instance becomes the first argument.\n\na class instance:\n The class must define a "__call__()" method; the effect is then the\n same as if that method was called.\n', - 'class': u'\nClass definitions\n*****************\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= [decorators] "class" classname [inheritance] ":" suite\n inheritance ::= "(" [parameter_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. The inheritance list\nusually gives a list of base classes (see *Customizing class creation*\nfor more advanced uses), so each item in the list should evaluate to a\nclass object which allows subclassing. Classes without an inheritance\nlist inherit, by default, from the base class "object"; hence,\n\n class Foo:\n pass\n\nis equivalent to\n\n class Foo(object):\n pass\n\nThe class\'s suite is then executed in a new execution frame (see\n*Naming and binding*), using a newly created local namespace and the\noriginal global namespace. (Usually, the suite contains mostly\nfunction definitions.) When the class\'s suite finishes execution, its\nexecution frame is discarded but its local namespace is saved. [4] A\nclass object is then created using the inheritance list for the base\nclasses and the saved local namespace for the attribute dictionary.\nThe class name is bound to this class object in the original local\nnamespace.\n\nClass creation can be customized heavily using *metaclasses*.\n\nClasses can also be decorated: just like when decorating functions,\n\n @f1(arg)\n @f2\n class Foo: pass\n\nis equivalent to\n\n class Foo: pass\n Foo = f1(arg)(f2(Foo))\n\nThe evaluation rules for the decorator expressions are the same as for\nfunction decorators. The result must be a class object, which is then\nbound to the class name.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass attributes; they are shared by instances. Instance attributes\ncan be set in a method with "self.name = value". Both class and\ninstance attributes are accessible through the notation ""self.name"",\nand an instance attribute hides a class attribute with the same name\nwhen accessed in this way. Class attributes can be used as defaults\nfor instance attributes, but using mutable values there can lead to\nunexpected results. *Descriptors* can be used to create instance\nvariables with different implementation details.\n\nSee also: **PEP 3115** - Metaclasses in Python 3 **PEP 3129** -\n Class Decorators\n', + 'calls': u'\nCalls\n*****\n\nA call calls a callable object (e.g., a *function*) with a possibly\nempty series of *arguments*:\n\n call ::= primary "(" [argument_list [","] | comprehension] ")"\n argument_list ::= positional_arguments ["," starred_and_keywords]\n ["," keywords_arguments]\n | starred_and_keywords ["," keywords_arguments]\n | keywords_arguments\n positional_arguments ::= ["*"] expression ("," ["*"] expression)*\n starred_and_keywords ::= ("*" expression | keyword_item)\n ("," "*" expression | "," keyword_item)*\n keywords_arguments ::= (keyword_item | "**" expression)\n ("," keyword_item | "**" expression)*\n keyword_item ::= identifier "=" expression\n\nAn optional trailing comma may be present after the positional and\nkeyword arguments but does not affect the semantics.\n\nThe primary must evaluate to a callable object (user-defined\nfunctions, built-in functions, methods of built-in objects, class\nobjects, methods of class instances, and all objects having a\n"__call__()" method are callable). All argument expressions are\nevaluated before the call is attempted. Please refer to section\n*Function definitions* for the syntax of formal *parameter* lists.\n\nIf keyword arguments are present, they are first converted to\npositional arguments, as follows. First, a list of unfilled slots is\ncreated for the formal parameters. If there are N positional\narguments, they are placed in the first N slots. Next, for each\nkeyword argument, the identifier is used to determine the\ncorresponding slot (if the identifier is the same as the first formal\nparameter name, the first slot is used, and so on). If the slot is\nalready filled, a "TypeError" exception is raised. Otherwise, the\nvalue of the argument is placed in the slot, filling it (even if the\nexpression is "None", it fills the slot). When all arguments have\nbeen processed, the slots that are still unfilled are filled with the\ncorresponding default value from the function definition. (Default\nvalues are calculated, once, when the function is defined; thus, a\nmutable object such as a list or dictionary used as default value will\nbe shared by all calls that don\'t specify an argument value for the\ncorresponding slot; this should usually be avoided.) If there are any\nunfilled slots for which no default value is specified, a "TypeError"\nexception is raised. Otherwise, the list of filled slots is used as\nthe argument list for the call.\n\n**CPython implementation detail:** An implementation may provide\nbuilt-in functions whose positional parameters do not have names, even\nif they are \'named\' for the purpose of documentation, and which\ntherefore cannot be supplied by keyword. In CPython, this is the case\nfor functions implemented in C that use "PyArg_ParseTuple()" to parse\ntheir arguments.\n\nIf there are more positional arguments than there are formal parameter\nslots, a "TypeError" exception is raised, unless a formal parameter\nusing the syntax "*identifier" is present; in this case, that formal\nparameter receives a tuple containing the excess positional arguments\n(or an empty tuple if there were no excess positional arguments).\n\nIf any keyword argument does not correspond to a formal parameter\nname, a "TypeError" exception is raised, unless a formal parameter\nusing the syntax "**identifier" is present; in this case, that formal\nparameter receives a dictionary containing the excess keyword\narguments (using the keywords as keys and the argument values as\ncorresponding values), or a (new) empty dictionary if there were no\nexcess keyword arguments.\n\nIf the syntax "*expression" appears in the function call, "expression"\nmust evaluate to an *iterable*. Elements from these iterables are\ntreated as if they were additional positional arguments. For the call\n"f(x1, x2, *y, x3, x4)", if *y* evaluates to a sequence *y1*, ...,\n*yM*, this is equivalent to a call with M+4 positional arguments *x1*,\n*x2*, *y1*, ..., *yM*, *x3*, *x4*.\n\nA consequence of this is that although the "*expression" syntax may\nappear *after* explicit keyword arguments, it is processed *before*\nthe keyword arguments (and any "**expression" arguments -- see below).\nSo:\n\n >>> def f(a, b):\n ... print(a, b)\n ...\n >>> f(b=1, *(2,))\n 2 1\n >>> f(a=1, *(2,))\n Traceback (most recent call last):\n File "", line 1, in ?\n TypeError: f() got multiple values for keyword argument \'a\'\n >>> f(1, *(2,))\n 1 2\n\nIt is unusual for both keyword arguments and the "*expression" syntax\nto be used in the same call, so in practice this confusion does not\narise.\n\nIf the syntax "**expression" appears in the function call,\n"expression" must evaluate to a *mapping*, the contents of which are\ntreated as additional keyword arguments. If a keyword is already\npresent (as an explicit keyword argument, or from another unpacking),\na "TypeError" exception is raised.\n\nFormal parameters using the syntax "*identifier" or "**identifier"\ncannot be used as positional argument slots or as keyword argument\nnames.\n\nChanged in version 3.5: Function calls accept any number of "*" and\n"**" unpackings, positional arguments may follow iterable unpackings\n("*"), and keyword arguments may follow dictionary unpackings ("**").\nOriginally proposed by **PEP 448**.\n\nA call always returns some value, possibly "None", unless it raises an\nexception. How this value is computed depends on the type of the\ncallable object.\n\nIf it is---\n\na user-defined function:\n The code block for the function is executed, passing it the\n argument list. The first thing the code block will do is bind the\n formal parameters to the arguments; this is described in section\n *Function definitions*. When the code block executes a "return"\n statement, this specifies the return value of the function call.\n\na built-in function or method:\n The result is up to the interpreter; see *Built-in Functions* for\n the descriptions of built-in functions and methods.\n\na class object:\n A new instance of that class is returned.\n\na class instance method:\n The corresponding user-defined function is called, with an argument\n list that is one longer than the argument list of the call: the\n instance becomes the first argument.\n\na class instance:\n The class must define a "__call__()" method; the effect is then the\n same as if that method was called.\n', + 'class': u'\nClass definitions\n*****************\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= [decorators] "class" classname [inheritance] ":" suite\n inheritance ::= "(" [argument_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. The inheritance list\nusually gives a list of base classes (see *Customizing class creation*\nfor more advanced uses), so each item in the list should evaluate to a\nclass object which allows subclassing. Classes without an inheritance\nlist inherit, by default, from the base class "object"; hence,\n\n class Foo:\n pass\n\nis equivalent to\n\n class Foo(object):\n pass\n\nThe class\'s suite is then executed in a new execution frame (see\n*Naming and binding*), using a newly created local namespace and the\noriginal global namespace. (Usually, the suite contains mostly\nfunction definitions.) When the class\'s suite finishes execution, its\nexecution frame is discarded but its local namespace is saved. [4] A\nclass object is then created using the inheritance list for the base\nclasses and the saved local namespace for the attribute dictionary.\nThe class name is bound to this class object in the original local\nnamespace.\n\nClass creation can be customized heavily using *metaclasses*.\n\nClasses can also be decorated: just like when decorating functions,\n\n @f1(arg)\n @f2\n class Foo: pass\n\nis equivalent to\n\n class Foo: pass\n Foo = f1(arg)(f2(Foo))\n\nThe evaluation rules for the decorator expressions are the same as for\nfunction decorators. The result must be a class object, which is then\nbound to the class name.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass attributes; they are shared by instances. Instance attributes\ncan be set in a method with "self.name = value". Both class and\ninstance attributes are accessible through the notation ""self.name"",\nand an instance attribute hides a class attribute with the same name\nwhen accessed in this way. Class attributes can be used as defaults\nfor instance attributes, but using mutable values there can lead to\nunexpected results. *Descriptors* can be used to create instance\nvariables with different implementation details.\n\nSee also: **PEP 3115** - Metaclasses in Python 3 **PEP 3129** -\n Class Decorators\n', 'comparisons': u'\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation. Also unlike C, expressions like "a < b < c" have the\ninterpretation that is conventional in mathematics:\n\n comparison ::= or_expr ( comp_operator or_expr )*\n comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "!="\n | "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: "True" or "False".\n\nComparisons can be chained arbitrarily, e.g., "x < y <= z" is\nequivalent to "x < y and y <= z", except that "y" is evaluated only\nonce (but in both cases "z" is not evaluated at all when "x < y" is\nfound to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then "a op1 b op2 c ... y\nopN z" is equivalent to "a op1 b and b op2 c and ... y opN z", except\nthat each expression is evaluated at most once.\n\nNote that "a op1 b op2 c" doesn\'t imply any kind of comparison between\n*a* and *c*, so that, e.g., "x < y > z" is perfectly legal (though\nperhaps not pretty).\n\n\nValue comparisons\n=================\n\nThe operators "<", ">", "==", ">=", "<=", and "!=" compare the values\nof two objects. The objects do not need to have the same type.\n\nChapter *Objects, values and types* states that objects have a value\n(in addition to type and identity). The value of an object is a\nrather abstract notion in Python: For example, there is no canonical\naccess method for an object\'s value. Also, there is no requirement\nthat the value of an object should be constructed in a particular way,\ne.g. comprised of all its data attributes. Comparison operators\nimplement a particular notion of what the value of an object is. One\ncan think of them as defining the value of an object indirectly, by\nmeans of their comparison implementation.\n\nBecause all types are (direct or indirect) subtypes of "object", they\ninherit the default comparison behavior from "object". Types can\ncustomize their comparison behavior by implementing *rich comparison\nmethods* like "__lt__()", described in *Basic customization*.\n\nThe default behavior for equality comparison ("==" and "!=") is based\non the identity of the objects. Hence, equality comparison of\ninstances with the same identity results in equality, and equality\ncomparison of instances with different identities results in\ninequality. A motivation for this default behavior is the desire that\nall objects should be reflexive (i.e. "x is y" implies "x == y").\n\nA default order comparison ("<", ">", "<=", and ">=") is not provided;\nan attempt raises "TypeError". A motivation for this default behavior\nis the lack of a similar invariant as for equality.\n\nThe behavior of the default equality comparison, that instances with\ndifferent identities are always unequal, may be in contrast to what\ntypes will need that have a sensible definition of object value and\nvalue-based equality. Such types will need to customize their\ncomparison behavior, and in fact, a number of built-in types have done\nthat.\n\nThe following list describes the comparison behavior of the most\nimportant built-in types.\n\n* Numbers of built-in numeric types (*Numeric Types --- int, float,\n complex*) and of the standard library types "fractions.Fraction" and\n "decimal.Decimal" can be compared within and across their types,\n with the restriction that complex numbers do not support order\n comparison. Within the limits of the types involved, they compare\n mathematically (algorithmically) correct without loss of precision.\n\n The not-a-number values "float(\'NaN\')" and "Decimal(\'NaN\')" are\n special. They are identical to themselves ("x is x" is true) but\n are not equal to themselves ("x == x" is false). Additionally,\n comparing any number to a not-a-number value will return "False".\n For example, both "3 < float(\'NaN\')" and "float(\'NaN\') < 3" will\n return "False".\n\n* Binary sequences (instances of "bytes" or "bytearray") can be\n compared within and across their types. They compare\n lexicographically using the numeric values of their elements.\n\n* Strings (instances of "str") compare lexicographically using the\n numerical Unicode code points (the result of the built-in function\n "ord()") of their characters. [3]\n\n Strings and binary sequences cannot be directly compared.\n\n* Sequences (instances of "tuple", "list", or "range") can be\n compared only within each of their types, with the restriction that\n ranges do not support order comparison. Equality comparison across\n these types results in unequality, and ordering comparison across\n these types raises "TypeError".\n\n Sequences compare lexicographically using comparison of\n corresponding elements, whereby reflexivity of the elements is\n enforced.\n\n In enforcing reflexivity of elements, the comparison of collections\n assumes that for a collection element "x", "x == x" is always true.\n Based on that assumption, element identity is compared first, and\n element comparison is performed only for distinct elements. This\n approach yields the same result as a strict element comparison\n would, if the compared elements are reflexive. For non-reflexive\n elements, the result is different than for strict element\n comparison, and may be surprising: The non-reflexive not-a-number\n values for example result in the following comparison behavior when\n used in a list:\n\n >>> nan = float(\'NaN\')\n >>> nan is nan\n True\n >>> nan == nan\n False <-- the defined non-reflexive behavior of NaN\n >>> [nan] == [nan]\n True <-- list enforces reflexivity and tests identity first\n\n Lexicographical comparison between built-in collections works as\n follows:\n\n * For two collections to compare equal, they must be of the same\n type, have the same length, and each pair of corresponding\n elements must compare equal (for example, "[1,2] == (1,2)" is\n false because the type is not the same).\n\n * Collections that support order comparison are ordered the same\n as their first unequal elements (for example, "[1,2,x] <= [1,2,y]"\n has the same value as "x <= y"). If a corresponding element does\n not exist, the shorter collection is ordered first (for example,\n "[1,2] < [1,2,3]" is true).\n\n* Mappings (instances of "dict") compare equal if and only if they\n have equal *(key, value)* pairs. Equality comparison of the keys and\n elements enforces reflexivity.\n\n Order comparisons ("<", ">", "<=", and ">=") raise "TypeError".\n\n* Sets (instances of "set" or "frozenset") can be compared within\n and across their types.\n\n They define order comparison operators to mean subset and superset\n tests. Those relations do not define total orderings (for example,\n the two sets "{1,2}" and "{2,3}" are not equal, nor subsets of one\n another, nor supersets of one another). Accordingly, sets are not\n appropriate arguments for functions which depend on total ordering\n (for example, "min()", "max()", and "sorted()" produce undefined\n results given a list of sets as inputs).\n\n Comparison of sets enforces reflexivity of its elements.\n\n* Most other built-in types have no comparison methods implemented,\n so they inherit the default comparison behavior.\n\nUser-defined classes that customize their comparison behavior should\nfollow some consistency rules, if possible:\n\n* Equality comparison should be reflexive. In other words, identical\n objects should compare equal:\n\n "x is y" implies "x == y"\n\n* Comparison should be symmetric. In other words, the following\n expressions should have the same result:\n\n "x == y" and "y == x"\n\n "x != y" and "y != x"\n\n "x < y" and "y > x"\n\n "x <= y" and "y >= x"\n\n* Comparison should be transitive. The following (non-exhaustive)\n examples illustrate that:\n\n "x > y and y > z" implies "x > z"\n\n "x < y and y <= z" implies "x < z"\n\n* Inverse comparison should result in the boolean negation. In other\n words, the following expressions should have the same result:\n\n "x == y" and "not x != y"\n\n "x < y" and "not x >= y" (for total ordering)\n\n "x > y" and "not x <= y" (for total ordering)\n\n The last two expressions apply to totally ordered collections (e.g.\n to sequences, but not to sets or mappings). See also the\n "total_ordering()" decorator.\n\nPython does not enforce these consistency rules. In fact, the\nnot-a-number values are an example for not following these rules.\n\n\nMembership test operations\n==========================\n\nThe operators "in" and "not in" test for membership. "x in s"\nevaluates to true if *x* is a member of *s*, and false otherwise. "x\nnot in s" returns the negation of "x in s". All built-in sequences\nand set types support this as well as dictionary, for which "in" tests\nwhether the dictionary has a given key. For container types such as\nlist, tuple, set, frozenset, dict, or collections.deque, the\nexpression "x in y" is equivalent to "any(x is e or x == e for e in\ny)".\n\nFor the string and bytes types, "x in y" is true if and only if *x* is\na substring of *y*. An equivalent test is "y.find(x) != -1". Empty\nstrings are always considered to be a substring of any other string,\nso """ in "abc"" will return "True".\n\nFor user-defined classes which define the "__contains__()" method, "x\nin y" is true if and only if "y.__contains__(x)" is true.\n\nFor user-defined classes which do not define "__contains__()" but do\ndefine "__iter__()", "x in y" is true if some value "z" with "x == z"\nis produced while iterating over "y". If an exception is raised\nduring the iteration, it is as if "in" raised that exception.\n\nLastly, the old-style iteration protocol is tried: if a class defines\n"__getitem__()", "x in y" is true if and only if there is a non-\nnegative integer index *i* such that "x == y[i]", and all lower\ninteger indices do not raise "IndexError" exception. (If any other\nexception is raised, it is as if "in" raised that exception).\n\nThe operator "not in" is defined to have the inverse true value of\n"in".\n\n\nIdentity comparisons\n====================\n\nThe operators "is" and "is not" test for object identity: "x is y" is\ntrue if and only if *x* and *y* are the same object. "x is not y"\nyields the inverse truth value. [4]\n', - 'compound': u'\nCompound statements\n*******************\n\nCompound statements contain (groups of) other statements; they affect\nor control the execution of those other statements in some way. In\ngeneral, compound statements span multiple lines, although in simple\nincarnations a whole compound statement may be contained in one line.\n\nThe "if", "while" and "for" statements implement traditional control\nflow constructs. "try" specifies exception handlers and/or cleanup\ncode for a group of statements, while the "with" statement allows the\nexecution of initialization and finalization code around a block of\ncode. Function and class definitions are also syntactically compound\nstatements.\n\nA compound statement consists of one or more \'clauses.\' A clause\nconsists of a header and a \'suite.\' The clause headers of a\nparticular compound statement are all at the same indentation level.\nEach clause header begins with a uniquely identifying keyword and ends\nwith a colon. A suite is a group of statements controlled by a\nclause. A suite can be one or more semicolon-separated simple\nstatements on the same line as the header, following the header\'s\ncolon, or it can be one or more indented statements on subsequent\nlines. Only the latter form of a suite can contain nested compound\nstatements; the following is illegal, mostly because it wouldn\'t be\nclear to which "if" clause a following "else" clause would belong:\n\n if test1: if test2: print(x)\n\nAlso note that the semicolon binds tighter than the colon in this\ncontext, so that in the following example, either all or none of the\n"print()" calls are executed:\n\n if x < y < z: print(x); print(y); print(z)\n\nSummarizing:\n\n compound_stmt ::= if_stmt\n | while_stmt\n | for_stmt\n | try_stmt\n | with_stmt\n | funcdef\n | classdef\n | async_with_stmt\n | async_for_stmt\n | async_funcdef\n suite ::= stmt_list NEWLINE | NEWLINE INDENT statement+ DEDENT\n statement ::= stmt_list NEWLINE | compound_stmt\n stmt_list ::= simple_stmt (";" simple_stmt)* [";"]\n\nNote that statements always end in a "NEWLINE" possibly followed by a\n"DEDENT". Also note that optional continuation clauses always begin\nwith a keyword that cannot start a statement, thus there are no\nambiguities (the \'dangling "else"\' problem is solved in Python by\nrequiring nested "if" statements to be indented).\n\nThe formatting of the grammar rules in the following sections places\neach clause on a separate line for clarity.\n\n\nThe "if" statement\n==================\n\nThe "if" statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n\n\nThe "while" statement\n=====================\n\nThe "while" statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the "else" clause, if present, is executed\nand the loop terminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and goes back\nto testing the expression.\n\n\nThe "for" statement\n===================\n\nThe "for" statement is used to iterate over the elements of a sequence\n(such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n"expression_list". The suite is then executed once for each item\nprovided by the iterator, in the order returned by the iterator. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments (see *Assignment statements*), and then the suite is\nexecuted. When the items are exhausted (which is immediately when the\nsequence is empty or an iterator raises a "StopIteration" exception),\nthe suite in the "else" clause, if present, is executed, and the loop\nterminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and continues\nwith the next item, or with the "else" clause if there is no next\nitem.\n\nThe for-loop makes assignments to the variables(s) in the target list.\nThis overwrites all previous assignments to those variables including\nthose made in the suite of the for-loop:\n\n for i in range(10):\n print(i)\n i = 5 # this will not affect the for-loop\n # because i will be overwritten with the next\n # index in the range\n\nNames in the target list are not deleted when the loop is finished,\nbut if the sequence is empty, they will not have been assigned to at\nall by the loop. Hint: the built-in function "range()" returns an\niterator of integers suitable to emulate the effect of Pascal\'s "for i\n:= a to b do"; e.g., "list(range(3))" returns the list "[0, 1, 2]".\n\nNote: There is a subtlety when the sequence is being modified by the\n loop (this can only occur for mutable sequences, i.e. lists). An\n internal counter is used to keep track of which item is used next,\n and this is incremented on each iteration. When this counter has\n reached the length of the sequence the loop terminates. This means\n that if the suite deletes the current (or a previous) item from the\n sequence, the next item will be skipped (since it gets the index of\n the current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n\n\nThe "try" statement\n===================\n\nThe "try" statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression ["as" identifier]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nThe "except" clause(s) specify one or more exception handlers. When no\nexception occurs in the "try" clause, no exception handler is\nexecuted. When an exception occurs in the "try" suite, a search for an\nexception handler is started. This search inspects the except clauses\nin turn until one is found that matches the exception. An expression-\nless except clause, if present, must be last; it matches any\nexception. For an except clause with an expression, that expression\nis evaluated, and the clause matches the exception if the resulting\nobject is "compatible" with the exception. An object is compatible\nwith an exception if it is the class or a base class of the exception\nobject or a tuple containing an item compatible with the exception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire "try" statement raised\nthe exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified after the "as" keyword in that except clause, if\npresent, and the except clause\'s suite is executed. All except\nclauses must have an executable block. When the end of this block is\nreached, execution continues normally after the entire try statement.\n(This means that if two nested handlers exist for the same exception,\nand the exception occurs in the try clause of the inner handler, the\nouter handler will not handle the exception.)\n\nWhen an exception has been assigned using "as target", it is cleared\nat the end of the except clause. This is as if\n\n except E as N:\n foo\n\nwas translated to\n\n except E as N:\n try:\n foo\n finally:\n del N\n\nThis means the exception must be assigned to a different name to be\nable to refer to it after the except clause. Exceptions are cleared\nbecause with the traceback attached to them, they form a reference\ncycle with the stack frame, keeping all locals in that frame alive\nuntil the next garbage collection occurs.\n\nBefore an except clause\'s suite is executed, details about the\nexception are stored in the "sys" module and can be accessed via\n"sys.exc_info()". "sys.exc_info()" returns a 3-tuple consisting of the\nexception class, the exception instance and a traceback object (see\nsection *The standard type hierarchy*) identifying the point in the\nprogram where the exception occurred. "sys.exc_info()" values are\nrestored to their previous values (before the call) when returning\nfrom a function that handled an exception.\n\nThe optional "else" clause is executed if and when control flows off\nthe end of the "try" clause. [2] Exceptions in the "else" clause are\nnot handled by the preceding "except" clauses.\n\nIf "finally" is present, it specifies a \'cleanup\' handler. The "try"\nclause is executed, including any "except" and "else" clauses. If an\nexception occurs in any of the clauses and is not handled, the\nexception is temporarily saved. The "finally" clause is executed. If\nthere is a saved exception it is re-raised at the end of the "finally"\nclause. If the "finally" clause raises another exception, the saved\nexception is set as the context of the new exception. If the "finally"\nclause executes a "return" or "break" statement, the saved exception\nis discarded:\n\n >>> def f():\n ... try:\n ... 1/0\n ... finally:\n ... return 42\n ...\n >>> f()\n 42\n\nThe exception information is not available to the program during\nexecution of the "finally" clause.\n\nWhen a "return", "break" or "continue" statement is executed in the\n"try" suite of a "try"..."finally" statement, the "finally" clause is\nalso executed \'on the way out.\' A "continue" statement is illegal in\nthe "finally" clause. (The reason is a problem with the current\nimplementation --- this restriction may be lifted in the future).\n\nThe return value of a function is determined by the last "return"\nstatement executed. Since the "finally" clause always executes, a\n"return" statement executed in the "finally" clause will always be the\nlast one executed:\n\n >>> def foo():\n ... try:\n ... return \'try\'\n ... finally:\n ... return \'finally\'\n ...\n >>> foo()\n \'finally\'\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information on using the "raise" statement to\ngenerate exceptions may be found in section *The raise statement*.\n\n\nThe "with" statement\n====================\n\nThe "with" statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section *With Statement\nContext Managers*). This allows common "try"..."except"..."finally"\nusage patterns to be encapsulated for convenient reuse.\n\n with_stmt ::= "with" with_item ("," with_item)* ":" suite\n with_item ::= expression ["as" target]\n\nThe execution of the "with" statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the "with_item")\n is evaluated to obtain a context manager.\n\n2. The context manager\'s "__exit__()" is loaded for later use.\n\n3. The context manager\'s "__enter__()" method is invoked.\n\n4. If a target was included in the "with" statement, the return\n value from "__enter__()" is assigned to it.\n\n Note: The "with" statement guarantees that if the "__enter__()"\n method returns without an error, then "__exit__()" will always be\n called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s "__exit__()" method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to "__exit__()". Otherwise, three\n "None" arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the "__exit__()" method was false, the exception is reraised.\n If the return value was true, the exception is suppressed, and\n execution continues with the statement following the "with"\n statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from "__exit__()" is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple "with" statements were nested:\n\n with A() as a, B() as b:\n suite\n\nis equivalent to\n\n with A() as a:\n with B() as b:\n suite\n\nChanged in version 3.1: Support for multiple context expressions.\n\nSee also: **PEP 0343** - The "with" statement\n\n The specification, background, and examples for the Python "with"\n statement.\n\n\nFunction definitions\n====================\n\nA function definition defines a user-defined function object (see\nsection *The standard type hierarchy*):\n\n funcdef ::= [decorators] "def" funcname "(" [parameter_list] ")" ["->" expression] ":" suite\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [parameter_list [","]] ")"] NEWLINE\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n | "*" [parameter] ("," defparameter)* ["," "**" parameter]\n | "**" parameter\n | defparameter [","] )\n parameter ::= identifier [":" expression]\n defparameter ::= parameter ["=" expression]\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more *parameters* have the form *parameter* "="\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding *argument* may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters up until the ""*"" must also have a default value --- this\nis a syntactic restriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated from left to right when the\nfunction definition is executed.** This means that the expression is\nevaluated once, when the function is defined, and that the same "pre-\ncomputed" value is used for each call. This is especially important\nto understand when a default parameter is a mutable object, such as a\nlist or a dictionary: if the function modifies the object (e.g. by\nappending an item to a list), the default value is in effect modified.\nThis is generally not what was intended. A way around this is to use\n"None" as the default, and explicitly test for it in the body of the\nfunction, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section\n*Calls*. A function call always assigns values to all parameters\nmentioned in the parameter list, either from position arguments, from\nkeyword arguments, or from default values. If the form\n""*identifier"" is present, it is initialized to a tuple receiving any\nexcess positional parameters, defaulting to the empty tuple. If the\nform ""**identifier"" is present, it is initialized to a new\ndictionary receiving any excess keyword arguments, defaulting to a new\nempty dictionary. Parameters after ""*"" or ""*identifier"" are\nkeyword-only parameters and may only be passed used keyword arguments.\n\nParameters may have annotations of the form "": expression"" following\nthe parameter name. Any parameter may have an annotation even those\nof the form "*identifier" or "**identifier". Functions may have\n"return" annotation of the form ""-> expression"" after the parameter\nlist. These annotations can be any valid Python expression and are\nevaluated when the function definition is executed. Annotations may\nbe evaluated in a different order than they appear in the source code.\nThe presence of annotations does not change the semantics of a\nfunction. The annotation values are available as values of a\ndictionary keyed by the parameters\' names in the "__annotations__"\nattribute of the function object.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda\nexpressions, described in section *Lambdas*. Note that the lambda\nexpression is merely a shorthand for a simplified function definition;\na function defined in a ""def"" statement can be passed around or\nassigned to another name just like a function defined by a lambda\nexpression. The ""def"" form is actually more powerful since it\nallows the execution of multiple statements and annotations.\n\n**Programmer\'s note:** Functions are first-class objects. A ""def""\nstatement executed inside a function definition defines a local\nfunction that can be returned or passed around. Free variables used\nin the nested function can access the local variables of the function\ncontaining the def. See section *Naming and binding* for details.\n\nSee also: **PEP 3107** - Function Annotations\n\n The original specification for function annotations.\n\n\nClass definitions\n=================\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= [decorators] "class" classname [inheritance] ":" suite\n inheritance ::= "(" [parameter_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. The inheritance list\nusually gives a list of base classes (see *Customizing class creation*\nfor more advanced uses), so each item in the list should evaluate to a\nclass object which allows subclassing. Classes without an inheritance\nlist inherit, by default, from the base class "object"; hence,\n\n class Foo:\n pass\n\nis equivalent to\n\n class Foo(object):\n pass\n\nThe class\'s suite is then executed in a new execution frame (see\n*Naming and binding*), using a newly created local namespace and the\noriginal global namespace. (Usually, the suite contains mostly\nfunction definitions.) When the class\'s suite finishes execution, its\nexecution frame is discarded but its local namespace is saved. [4] A\nclass object is then created using the inheritance list for the base\nclasses and the saved local namespace for the attribute dictionary.\nThe class name is bound to this class object in the original local\nnamespace.\n\nClass creation can be customized heavily using *metaclasses*.\n\nClasses can also be decorated: just like when decorating functions,\n\n @f1(arg)\n @f2\n class Foo: pass\n\nis equivalent to\n\n class Foo: pass\n Foo = f1(arg)(f2(Foo))\n\nThe evaluation rules for the decorator expressions are the same as for\nfunction decorators. The result must be a class object, which is then\nbound to the class name.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass attributes; they are shared by instances. Instance attributes\ncan be set in a method with "self.name = value". Both class and\ninstance attributes are accessible through the notation ""self.name"",\nand an instance attribute hides a class attribute with the same name\nwhen accessed in this way. Class attributes can be used as defaults\nfor instance attributes, but using mutable values there can lead to\nunexpected results. *Descriptors* can be used to create instance\nvariables with different implementation details.\n\nSee also: **PEP 3115** - Metaclasses in Python 3 **PEP 3129** -\n Class Decorators\n\n\nCoroutines\n==========\n\nNew in version 3.5.\n\n\nCoroutine function definition\n-----------------------------\n\n async_funcdef ::= [decorators] "async" "def" funcname "(" [parameter_list] ")" ["->" expression] ":" suite\n\nExecution of Python coroutines can be suspended and resumed at many\npoints (see *coroutine*). In the body of a coroutine, any "await" and\n"async" identifiers become reserved keywords; "await" expressions,\n"async for" and "async with" can only be used in coroutine bodies.\n\nFunctions defined with "async def" syntax are always coroutine\nfunctions, even if they do not contain "await" or "async" keywords.\n\nIt is a "SyntaxError" to use "yield" expressions in "async def"\ncoroutines.\n\nAn example of a coroutine function:\n\n async def func(param1, param2):\n do_stuff()\n await some_coroutine()\n\n\nThe "async for" statement\n-------------------------\n\n async_for_stmt ::= "async" for_stmt\n\nAn *asynchronous iterable* is able to call asynchronous code in its\n*iter* implementation, and *asynchronous iterator* can call\nasynchronous code in its *next* method.\n\nThe "async for" statement allows convenient iteration over\nasynchronous iterators.\n\nThe following code:\n\n async for TARGET in ITER:\n BLOCK\n else:\n BLOCK2\n\nIs semantically equivalent to:\n\n iter = (ITER)\n iter = await type(iter).__aiter__(iter)\n running = True\n while running:\n try:\n TARGET = await type(iter).__anext__(iter)\n except StopAsyncIteration:\n running = False\n else:\n BLOCK\n else:\n BLOCK2\n\nSee also "__aiter__()" and "__anext__()" for details.\n\nIt is a "SyntaxError" to use "async for" statement outside of an\n"async def" function.\n\n\nThe "async with" statement\n--------------------------\n\n async_with_stmt ::= "async" with_stmt\n\nAn *asynchronous context manager* is a *context manager* that is able\nto suspend execution in its *enter* and *exit* methods.\n\nThe following code:\n\n async with EXPR as VAR:\n BLOCK\n\nIs semantically equivalent to:\n\n mgr = (EXPR)\n aexit = type(mgr).__aexit__\n aenter = type(mgr).__aenter__(mgr)\n exc = True\n\n VAR = await aenter\n try:\n BLOCK\n except:\n if not await aexit(mgr, *sys.exc_info()):\n raise\n else:\n await aexit(mgr, None, None, None)\n\nSee also "__aenter__()" and "__aexit__()" for details.\n\nIt is a "SyntaxError" to use "async with" statement outside of an\n"async def" function.\n\nSee also: **PEP 492** - Coroutines with async and await syntax\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack unless\n there is a "finally" clause which happens to raise another\n exception. That new exception causes the old one to be lost.\n\n[2] Currently, control "flows off the end" except in the case of\n an exception or the execution of a "return", "continue", or\n "break" statement.\n\n[3] A string literal appearing as the first statement in the\n function body is transformed into the function\'s "__doc__"\n attribute and therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s "__doc__" item and\n therefore the class\'s *docstring*.\n', - 'context-managers': u'\nWith Statement Context Managers\n*******************************\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a "with" statement. The context manager\nhandles the entry into, and the exit from, the desired runtime context\nfor the execution of the block of code. Context managers are normally\ninvoked using the "with" statement (described in section *The with\nstatement*), but can also be used by directly invoking their methods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see *Context Manager Types*.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The "with"\n statement will bind this method\'s return value to the target(s)\n specified in the "as" clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be "None".\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that "__exit__()" methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also: **PEP 0343** - The "with" statement\n\n The specification, background, and examples for the Python "with"\n statement.\n', + 'compound': u'\nCompound statements\n*******************\n\nCompound statements contain (groups of) other statements; they affect\nor control the execution of those other statements in some way. In\ngeneral, compound statements span multiple lines, although in simple\nincarnations a whole compound statement may be contained in one line.\n\nThe "if", "while" and "for" statements implement traditional control\nflow constructs. "try" specifies exception handlers and/or cleanup\ncode for a group of statements, while the "with" statement allows the\nexecution of initialization and finalization code around a block of\ncode. Function and class definitions are also syntactically compound\nstatements.\n\nA compound statement consists of one or more \'clauses.\' A clause\nconsists of a header and a \'suite.\' The clause headers of a\nparticular compound statement are all at the same indentation level.\nEach clause header begins with a uniquely identifying keyword and ends\nwith a colon. A suite is a group of statements controlled by a\nclause. A suite can be one or more semicolon-separated simple\nstatements on the same line as the header, following the header\'s\ncolon, or it can be one or more indented statements on subsequent\nlines. Only the latter form of a suite can contain nested compound\nstatements; the following is illegal, mostly because it wouldn\'t be\nclear to which "if" clause a following "else" clause would belong:\n\n if test1: if test2: print(x)\n\nAlso note that the semicolon binds tighter than the colon in this\ncontext, so that in the following example, either all or none of the\n"print()" calls are executed:\n\n if x < y < z: print(x); print(y); print(z)\n\nSummarizing:\n\n compound_stmt ::= if_stmt\n | while_stmt\n | for_stmt\n | try_stmt\n | with_stmt\n | funcdef\n | classdef\n | async_with_stmt\n | async_for_stmt\n | async_funcdef\n suite ::= stmt_list NEWLINE | NEWLINE INDENT statement+ DEDENT\n statement ::= stmt_list NEWLINE | compound_stmt\n stmt_list ::= simple_stmt (";" simple_stmt)* [";"]\n\nNote that statements always end in a "NEWLINE" possibly followed by a\n"DEDENT". Also note that optional continuation clauses always begin\nwith a keyword that cannot start a statement, thus there are no\nambiguities (the \'dangling "else"\' problem is solved in Python by\nrequiring nested "if" statements to be indented).\n\nThe formatting of the grammar rules in the following sections places\neach clause on a separate line for clarity.\n\n\nThe "if" statement\n==================\n\nThe "if" statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n\n\nThe "while" statement\n=====================\n\nThe "while" statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the "else" clause, if present, is executed\nand the loop terminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and goes back\nto testing the expression.\n\n\nThe "for" statement\n===================\n\nThe "for" statement is used to iterate over the elements of a sequence\n(such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n"expression_list". The suite is then executed once for each item\nprovided by the iterator, in the order returned by the iterator. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments (see *Assignment statements*), and then the suite is\nexecuted. When the items are exhausted (which is immediately when the\nsequence is empty or an iterator raises a "StopIteration" exception),\nthe suite in the "else" clause, if present, is executed, and the loop\nterminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and continues\nwith the next item, or with the "else" clause if there is no next\nitem.\n\nThe for-loop makes assignments to the variables(s) in the target list.\nThis overwrites all previous assignments to those variables including\nthose made in the suite of the for-loop:\n\n for i in range(10):\n print(i)\n i = 5 # this will not affect the for-loop\n # because i will be overwritten with the next\n # index in the range\n\nNames in the target list are not deleted when the loop is finished,\nbut if the sequence is empty, they will not have been assigned to at\nall by the loop. Hint: the built-in function "range()" returns an\niterator of integers suitable to emulate the effect of Pascal\'s "for i\n:= a to b do"; e.g., "list(range(3))" returns the list "[0, 1, 2]".\n\nNote: There is a subtlety when the sequence is being modified by the\n loop (this can only occur for mutable sequences, i.e. lists). An\n internal counter is used to keep track of which item is used next,\n and this is incremented on each iteration. When this counter has\n reached the length of the sequence the loop terminates. This means\n that if the suite deletes the current (or a previous) item from the\n sequence, the next item will be skipped (since it gets the index of\n the current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n\n\nThe "try" statement\n===================\n\nThe "try" statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression ["as" identifier]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nThe "except" clause(s) specify one or more exception handlers. When no\nexception occurs in the "try" clause, no exception handler is\nexecuted. When an exception occurs in the "try" suite, a search for an\nexception handler is started. This search inspects the except clauses\nin turn until one is found that matches the exception. An expression-\nless except clause, if present, must be last; it matches any\nexception. For an except clause with an expression, that expression\nis evaluated, and the clause matches the exception if the resulting\nobject is "compatible" with the exception. An object is compatible\nwith an exception if it is the class or a base class of the exception\nobject or a tuple containing an item compatible with the exception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire "try" statement raised\nthe exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified after the "as" keyword in that except clause, if\npresent, and the except clause\'s suite is executed. All except\nclauses must have an executable block. When the end of this block is\nreached, execution continues normally after the entire try statement.\n(This means that if two nested handlers exist for the same exception,\nand the exception occurs in the try clause of the inner handler, the\nouter handler will not handle the exception.)\n\nWhen an exception has been assigned using "as target", it is cleared\nat the end of the except clause. This is as if\n\n except E as N:\n foo\n\nwas translated to\n\n except E as N:\n try:\n foo\n finally:\n del N\n\nThis means the exception must be assigned to a different name to be\nable to refer to it after the except clause. Exceptions are cleared\nbecause with the traceback attached to them, they form a reference\ncycle with the stack frame, keeping all locals in that frame alive\nuntil the next garbage collection occurs.\n\nBefore an except clause\'s suite is executed, details about the\nexception are stored in the "sys" module and can be accessed via\n"sys.exc_info()". "sys.exc_info()" returns a 3-tuple consisting of the\nexception class, the exception instance and a traceback object (see\nsection *The standard type hierarchy*) identifying the point in the\nprogram where the exception occurred. "sys.exc_info()" values are\nrestored to their previous values (before the call) when returning\nfrom a function that handled an exception.\n\nThe optional "else" clause is executed if and when control flows off\nthe end of the "try" clause. [2] Exceptions in the "else" clause are\nnot handled by the preceding "except" clauses.\n\nIf "finally" is present, it specifies a \'cleanup\' handler. The "try"\nclause is executed, including any "except" and "else" clauses. If an\nexception occurs in any of the clauses and is not handled, the\nexception is temporarily saved. The "finally" clause is executed. If\nthere is a saved exception it is re-raised at the end of the "finally"\nclause. If the "finally" clause raises another exception, the saved\nexception is set as the context of the new exception. If the "finally"\nclause executes a "return" or "break" statement, the saved exception\nis discarded:\n\n >>> def f():\n ... try:\n ... 1/0\n ... finally:\n ... return 42\n ...\n >>> f()\n 42\n\nThe exception information is not available to the program during\nexecution of the "finally" clause.\n\nWhen a "return", "break" or "continue" statement is executed in the\n"try" suite of a "try"..."finally" statement, the "finally" clause is\nalso executed \'on the way out.\' A "continue" statement is illegal in\nthe "finally" clause. (The reason is a problem with the current\nimplementation --- this restriction may be lifted in the future).\n\nThe return value of a function is determined by the last "return"\nstatement executed. Since the "finally" clause always executes, a\n"return" statement executed in the "finally" clause will always be the\nlast one executed:\n\n >>> def foo():\n ... try:\n ... return \'try\'\n ... finally:\n ... return \'finally\'\n ...\n >>> foo()\n \'finally\'\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information on using the "raise" statement to\ngenerate exceptions may be found in section *The raise statement*.\n\n\nThe "with" statement\n====================\n\nThe "with" statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section *With Statement\nContext Managers*). This allows common "try"..."except"..."finally"\nusage patterns to be encapsulated for convenient reuse.\n\n with_stmt ::= "with" with_item ("," with_item)* ":" suite\n with_item ::= expression ["as" target]\n\nThe execution of the "with" statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the "with_item")\n is evaluated to obtain a context manager.\n\n2. The context manager\'s "__exit__()" is loaded for later use.\n\n3. The context manager\'s "__enter__()" method is invoked.\n\n4. If a target was included in the "with" statement, the return\n value from "__enter__()" is assigned to it.\n\n Note: The "with" statement guarantees that if the "__enter__()"\n method returns without an error, then "__exit__()" will always be\n called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s "__exit__()" method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to "__exit__()". Otherwise, three\n "None" arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the "__exit__()" method was false, the exception is reraised.\n If the return value was true, the exception is suppressed, and\n execution continues with the statement following the "with"\n statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from "__exit__()" is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple "with" statements were nested:\n\n with A() as a, B() as b:\n suite\n\nis equivalent to\n\n with A() as a:\n with B() as b:\n suite\n\nChanged in version 3.1: Support for multiple context expressions.\n\nSee also: **PEP 343** - The "with" statement\n\n The specification, background, and examples for the Python "with"\n statement.\n\n\nFunction definitions\n====================\n\nA function definition defines a user-defined function object (see\nsection *The standard type hierarchy*):\n\n funcdef ::= [decorators] "def" funcname "(" [parameter_list] ")" ["->" expression] ":" suite\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n | "*" [parameter] ("," defparameter)* ["," "**" parameter]\n | "**" parameter\n | defparameter [","] )\n parameter ::= identifier [":" expression]\n defparameter ::= parameter ["=" expression]\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more *parameters* have the form *parameter* "="\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding *argument* may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters up until the ""*"" must also have a default value --- this\nis a syntactic restriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated from left to right when the\nfunction definition is executed.** This means that the expression is\nevaluated once, when the function is defined, and that the same "pre-\ncomputed" value is used for each call. This is especially important\nto understand when a default parameter is a mutable object, such as a\nlist or a dictionary: if the function modifies the object (e.g. by\nappending an item to a list), the default value is in effect modified.\nThis is generally not what was intended. A way around this is to use\n"None" as the default, and explicitly test for it in the body of the\nfunction, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section\n*Calls*. A function call always assigns values to all parameters\nmentioned in the parameter list, either from position arguments, from\nkeyword arguments, or from default values. If the form\n""*identifier"" is present, it is initialized to a tuple receiving any\nexcess positional parameters, defaulting to the empty tuple. If the\nform ""**identifier"" is present, it is initialized to a new\ndictionary receiving any excess keyword arguments, defaulting to a new\nempty dictionary. Parameters after ""*"" or ""*identifier"" are\nkeyword-only parameters and may only be passed used keyword arguments.\n\nParameters may have annotations of the form "": expression"" following\nthe parameter name. Any parameter may have an annotation even those\nof the form "*identifier" or "**identifier". Functions may have\n"return" annotation of the form ""-> expression"" after the parameter\nlist. These annotations can be any valid Python expression and are\nevaluated when the function definition is executed. Annotations may\nbe evaluated in a different order than they appear in the source code.\nThe presence of annotations does not change the semantics of a\nfunction. The annotation values are available as values of a\ndictionary keyed by the parameters\' names in the "__annotations__"\nattribute of the function object.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda\nexpressions, described in section *Lambdas*. Note that the lambda\nexpression is merely a shorthand for a simplified function definition;\na function defined in a ""def"" statement can be passed around or\nassigned to another name just like a function defined by a lambda\nexpression. The ""def"" form is actually more powerful since it\nallows the execution of multiple statements and annotations.\n\n**Programmer\'s note:** Functions are first-class objects. A ""def""\nstatement executed inside a function definition defines a local\nfunction that can be returned or passed around. Free variables used\nin the nested function can access the local variables of the function\ncontaining the def. See section *Naming and binding* for details.\n\nSee also: **PEP 3107** - Function Annotations\n\n The original specification for function annotations.\n\n\nClass definitions\n=================\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= [decorators] "class" classname [inheritance] ":" suite\n inheritance ::= "(" [argument_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. The inheritance list\nusually gives a list of base classes (see *Customizing class creation*\nfor more advanced uses), so each item in the list should evaluate to a\nclass object which allows subclassing. Classes without an inheritance\nlist inherit, by default, from the base class "object"; hence,\n\n class Foo:\n pass\n\nis equivalent to\n\n class Foo(object):\n pass\n\nThe class\'s suite is then executed in a new execution frame (see\n*Naming and binding*), using a newly created local namespace and the\noriginal global namespace. (Usually, the suite contains mostly\nfunction definitions.) When the class\'s suite finishes execution, its\nexecution frame is discarded but its local namespace is saved. [4] A\nclass object is then created using the inheritance list for the base\nclasses and the saved local namespace for the attribute dictionary.\nThe class name is bound to this class object in the original local\nnamespace.\n\nClass creation can be customized heavily using *metaclasses*.\n\nClasses can also be decorated: just like when decorating functions,\n\n @f1(arg)\n @f2\n class Foo: pass\n\nis equivalent to\n\n class Foo: pass\n Foo = f1(arg)(f2(Foo))\n\nThe evaluation rules for the decorator expressions are the same as for\nfunction decorators. The result must be a class object, which is then\nbound to the class name.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass attributes; they are shared by instances. Instance attributes\ncan be set in a method with "self.name = value". Both class and\ninstance attributes are accessible through the notation ""self.name"",\nand an instance attribute hides a class attribute with the same name\nwhen accessed in this way. Class attributes can be used as defaults\nfor instance attributes, but using mutable values there can lead to\nunexpected results. *Descriptors* can be used to create instance\nvariables with different implementation details.\n\nSee also: **PEP 3115** - Metaclasses in Python 3 **PEP 3129** -\n Class Decorators\n\n\nCoroutines\n==========\n\nNew in version 3.5.\n\n\nCoroutine function definition\n-----------------------------\n\n async_funcdef ::= [decorators] "async" "def" funcname "(" [parameter_list] ")" ["->" expression] ":" suite\n\nExecution of Python coroutines can be suspended and resumed at many\npoints (see *coroutine*). In the body of a coroutine, any "await" and\n"async" identifiers become reserved keywords; "await" expressions,\n"async for" and "async with" can only be used in coroutine bodies.\n\nFunctions defined with "async def" syntax are always coroutine\nfunctions, even if they do not contain "await" or "async" keywords.\n\nIt is a "SyntaxError" to use "yield" expressions in "async def"\ncoroutines.\n\nAn example of a coroutine function:\n\n async def func(param1, param2):\n do_stuff()\n await some_coroutine()\n\n\nThe "async for" statement\n-------------------------\n\n async_for_stmt ::= "async" for_stmt\n\nAn *asynchronous iterable* is able to call asynchronous code in its\n*iter* implementation, and *asynchronous iterator* can call\nasynchronous code in its *next* method.\n\nThe "async for" statement allows convenient iteration over\nasynchronous iterators.\n\nThe following code:\n\n async for TARGET in ITER:\n BLOCK\n else:\n BLOCK2\n\nIs semantically equivalent to:\n\n iter = (ITER)\n iter = type(iter).__aiter__(iter)\n running = True\n while running:\n try:\n TARGET = await type(iter).__anext__(iter)\n except StopAsyncIteration:\n running = False\n else:\n BLOCK\n else:\n BLOCK2\n\nSee also "__aiter__()" and "__anext__()" for details.\n\nIt is a "SyntaxError" to use "async for" statement outside of an\n"async def" function.\n\n\nThe "async with" statement\n--------------------------\n\n async_with_stmt ::= "async" with_stmt\n\nAn *asynchronous context manager* is a *context manager* that is able\nto suspend execution in its *enter* and *exit* methods.\n\nThe following code:\n\n async with EXPR as VAR:\n BLOCK\n\nIs semantically equivalent to:\n\n mgr = (EXPR)\n aexit = type(mgr).__aexit__\n aenter = type(mgr).__aenter__(mgr)\n exc = True\n\n VAR = await aenter\n try:\n BLOCK\n except:\n if not await aexit(mgr, *sys.exc_info()):\n raise\n else:\n await aexit(mgr, None, None, None)\n\nSee also "__aenter__()" and "__aexit__()" for details.\n\nIt is a "SyntaxError" to use "async with" statement outside of an\n"async def" function.\n\nSee also: **PEP 492** - Coroutines with async and await syntax\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack unless\n there is a "finally" clause which happens to raise another\n exception. That new exception causes the old one to be lost.\n\n[2] Currently, control "flows off the end" except in the case of\n an exception or the execution of a "return", "continue", or\n "break" statement.\n\n[3] A string literal appearing as the first statement in the\n function body is transformed into the function\'s "__doc__"\n attribute and therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s "__doc__" item and\n therefore the class\'s *docstring*.\n', + 'context-managers': u'\nWith Statement Context Managers\n*******************************\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a "with" statement. The context manager\nhandles the entry into, and the exit from, the desired runtime context\nfor the execution of the block of code. Context managers are normally\ninvoked using the "with" statement (described in section *The with\nstatement*), but can also be used by directly invoking their methods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see *Context Manager Types*.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The "with"\n statement will bind this method\'s return value to the target(s)\n specified in the "as" clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be "None".\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that "__exit__()" methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also: **PEP 343** - The "with" statement\n\n The specification, background, and examples for the Python "with"\n statement.\n', 'continue': u'\nThe "continue" statement\n************************\n\n continue_stmt ::= "continue"\n\n"continue" may only occur syntactically nested in a "for" or "while"\nloop, but not nested in a function or class definition or "finally"\nclause within that loop. It continues with the next cycle of the\nnearest enclosing loop.\n\nWhen "continue" passes control out of a "try" statement with a\n"finally" clause, that "finally" clause is executed before really\nstarting the next loop cycle.\n', 'conversions': u'\nArithmetic conversions\n**********************\n\nWhen a description of an arithmetic operator below uses the phrase\n"the numeric arguments are converted to a common type," this means\nthat the operator implementation for built-in types works as follows:\n\n* If either argument is a complex number, the other is converted to\n complex;\n\n* otherwise, if either argument is a floating point number, the\n other is converted to floating point;\n\n* otherwise, both must be integers and no conversion is necessary.\n\nSome additional rules apply for certain operators (e.g., a string as a\nleft argument to the \'%\' operator). Extensions must define their own\nconversion behavior.\n', 'customization': u'\nBasic customization\n*******************\n\nobject.__new__(cls[, ...])\n\n Called to create a new instance of class *cls*. "__new__()" is a\n static method (special-cased so you need not declare it as such)\n that takes the class of which an instance was requested as its\n first argument. The remaining arguments are those passed to the\n object constructor expression (the call to the class). The return\n value of "__new__()" should be the new object instance (usually an\n instance of *cls*).\n\n Typical implementations create a new instance of the class by\n invoking the superclass\'s "__new__()" method using\n "super(currentclass, cls).__new__(cls[, ...])" with appropriate\n arguments and then modifying the newly-created instance as\n necessary before returning it.\n\n If "__new__()" returns an instance of *cls*, then the new\n instance\'s "__init__()" method will be invoked like\n "__init__(self[, ...])", where *self* is the new instance and the\n remaining arguments are the same as were passed to "__new__()".\n\n If "__new__()" does not return an instance of *cls*, then the new\n instance\'s "__init__()" method will not be invoked.\n\n "__new__()" is intended mainly to allow subclasses of immutable\n types (like int, str, or tuple) to customize instance creation. It\n is also commonly overridden in custom metaclasses in order to\n customize class creation.\n\nobject.__init__(self[, ...])\n\n Called after the instance has been created (by "__new__()"), but\n before it is returned to the caller. The arguments are those\n passed to the class constructor expression. If a base class has an\n "__init__()" method, the derived class\'s "__init__()" method, if\n any, must explicitly call it to ensure proper initialization of the\n base class part of the instance; for example:\n "BaseClass.__init__(self, [args...])".\n\n Because "__new__()" and "__init__()" work together in constructing\n objects ("__new__()" to create it, and "__init__()" to customise\n it), no non-"None" value may be returned by "__init__()"; doing so\n will cause a "TypeError" to be raised at runtime.\n\nobject.__del__(self)\n\n Called when the instance is about to be destroyed. This is also\n called a destructor. If a base class has a "__del__()" method, the\n derived class\'s "__del__()" method, if any, must explicitly call it\n to ensure proper deletion of the base class part of the instance.\n Note that it is possible (though not recommended!) for the\n "__del__()" method to postpone destruction of the instance by\n creating a new reference to it. It may then be called at a later\n time when this new reference is deleted. It is not guaranteed that\n "__del__()" methods are called for objects that still exist when\n the interpreter exits.\n\n Note: "del x" doesn\'t directly call "x.__del__()" --- the former\n decrements the reference count for "x" by one, and the latter is\n only called when "x"\'s reference count reaches zero. Some common\n situations that may prevent the reference count of an object from\n going to zero include: circular references between objects (e.g.,\n a doubly-linked list or a tree data structure with parent and\n child pointers); a reference to the object on the stack frame of\n a function that caught an exception (the traceback stored in\n "sys.exc_info()[2]" keeps the stack frame alive); or a reference\n to the object on the stack frame that raised an unhandled\n exception in interactive mode (the traceback stored in\n "sys.last_traceback" keeps the stack frame alive). The first\n situation can only be remedied by explicitly breaking the cycles;\n the second can be resolved by freeing the reference to the\n traceback object when it is no longer useful, and the third can\n be resolved by storing "None" in "sys.last_traceback". Circular\n references which are garbage are detected and cleaned up when the\n cyclic garbage collector is enabled (it\'s on by default). Refer\n to the documentation for the "gc" module for more information\n about this topic.\n\n Warning: Due to the precarious circumstances under which\n "__del__()" methods are invoked, exceptions that occur during\n their execution are ignored, and a warning is printed to\n "sys.stderr" instead. Also, when "__del__()" is invoked in\n response to a module being deleted (e.g., when execution of the\n program is done), other globals referenced by the "__del__()"\n method may already have been deleted or in the process of being\n torn down (e.g. the import machinery shutting down). For this\n reason, "__del__()" methods should do the absolute minimum needed\n to maintain external invariants. Starting with version 1.5,\n Python guarantees that globals whose name begins with a single\n underscore are deleted from their module before other globals are\n deleted; if no other references to such globals exist, this may\n help in assuring that imported modules are still available at the\n time when the "__del__()" method is called.\n\nobject.__repr__(self)\n\n Called by the "repr()" built-in function to compute the "official"\n string representation of an object. If at all possible, this\n should look like a valid Python expression that could be used to\n recreate an object with the same value (given an appropriate\n environment). If this is not possible, a string of the form\n "<...some useful description...>" should be returned. The return\n value must be a string object. If a class defines "__repr__()" but\n not "__str__()", then "__repr__()" is also used when an "informal"\n string representation of instances of that class is required.\n\n This is typically used for debugging, so it is important that the\n representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n Called by "str(object)" and the built-in functions "format()" and\n "print()" to compute the "informal" or nicely printable string\n representation of an object. The return value must be a *string*\n object.\n\n This method differs from "object.__repr__()" in that there is no\n expectation that "__str__()" return a valid Python expression: a\n more convenient or concise representation can be used.\n\n The default implementation defined by the built-in type "object"\n calls "object.__repr__()".\n\nobject.__bytes__(self)\n\n Called by "bytes()" to compute a byte-string representation of an\n object. This should return a "bytes" object.\n\nobject.__format__(self, format_spec)\n\n Called by the "format()" built-in function (and by extension, the\n "str.format()" method of class "str") to produce a "formatted"\n string representation of an object. The "format_spec" argument is a\n string that contains a description of the formatting options\n desired. The interpretation of the "format_spec" argument is up to\n the type implementing "__format__()", however most classes will\n either delegate formatting to one of the built-in types, or use a\n similar formatting option syntax.\n\n See *Format Specification Mini-Language* for a description of the\n standard formatting syntax.\n\n The return value must be a string object.\n\n Changed in version 3.4: The __format__ method of "object" itself\n raises a "TypeError" if passed any non-empty string.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n These are the so-called "rich comparison" methods. The\n correspondence between operator symbols and method names is as\n follows: "xy" calls\n "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n\n A rich comparison method may return the singleton "NotImplemented"\n if it does not implement the operation for a given pair of\n arguments. By convention, "False" and "True" are returned for a\n successful comparison. However, these methods can return any value,\n so if the comparison operator is used in a Boolean context (e.g.,\n in the condition of an "if" statement), Python will call "bool()"\n on the value to determine if the result is true or false.\n\n By default, "__ne__()" delegates to "__eq__()" and inverts the\n result unless it is "NotImplemented". There are no other implied\n relationships among the comparison operators, for example, the\n truth of "(x.__hash__".\n\n If a class that does not override "__eq__()" wishes to suppress\n hash support, it should include "__hash__ = None" in the class\n definition. A class which defines its own "__hash__()" that\n explicitly raises a "TypeError" would be incorrectly identified as\n hashable by an "isinstance(obj, collections.Hashable)" call.\n\n Note: By default, the "__hash__()" values of str, bytes and\n datetime objects are "salted" with an unpredictable random value.\n Although they remain constant within an individual Python\n process, they are not predictable between repeated invocations of\n Python.This is intended to provide protection against a denial-\n of-service caused by carefully-chosen inputs that exploit the\n worst case performance of a dict insertion, O(n^2) complexity.\n See http://www.ocert.org/advisories/ocert-2011-003.html for\n details.Changing hash values affects the iteration order of\n dicts, sets and other mappings. Python has never made guarantees\n about this ordering (and it typically varies between 32-bit and\n 64-bit builds).See also "PYTHONHASHSEED".\n\n Changed in version 3.3: Hash randomization is enabled by default.\n\nobject.__bool__(self)\n\n Called to implement truth value testing and the built-in operation\n "bool()"; should return "False" or "True". When this method is not\n defined, "__len__()" is called, if it is defined, and the object is\n considered true if its result is nonzero. If a class defines\n neither "__len__()" nor "__bool__()", all its instances are\n considered true.\n', 'debugger': u'\n"pdb" --- The Python Debugger\n*****************************\n\n**Source code:** Lib/pdb.py\n\n======================================================================\n\nThe module "pdb" defines an interactive source code debugger for\nPython programs. It supports setting (conditional) breakpoints and\nsingle stepping at the source line level, inspection of stack frames,\nsource code listing, and evaluation of arbitrary Python code in the\ncontext of any stack frame. It also supports post-mortem debugging\nand can be called under program control.\n\nThe debugger is extensible -- it is actually defined as the class\n"Pdb". This is currently undocumented but easily understood by reading\nthe source. The extension interface uses the modules "bdb" and "cmd".\n\nThe debugger\'s prompt is "(Pdb)". Typical usage to run a program under\ncontrol of the debugger is:\n\n >>> import pdb\n >>> import mymodule\n >>> pdb.run(\'mymodule.test()\')\n > (0)?()\n (Pdb) continue\n > (1)?()\n (Pdb) continue\n NameError: \'spam\'\n > (1)?()\n (Pdb)\n\nChanged in version 3.3: Tab-completion via the "readline" module is\navailable for commands and command arguments, e.g. the current global\nand local names are offered as arguments of the "p" command.\n\n"pdb.py" can also be invoked as a script to debug other scripts. For\nexample:\n\n python3 -m pdb myscript.py\n\nWhen invoked as a script, pdb will automatically enter post-mortem\ndebugging if the program being debugged exits abnormally. After post-\nmortem debugging (or after normal exit of the program), pdb will\nrestart the program. Automatic restarting preserves pdb\'s state (such\nas breakpoints) and in most cases is more useful than quitting the\ndebugger upon program\'s exit.\n\nNew in version 3.2: "pdb.py" now accepts a "-c" option that executes\ncommands as if given in a ".pdbrc" file, see *Debugger Commands*.\n\nThe typical usage to break into the debugger from a running program is\nto insert\n\n import pdb; pdb.set_trace()\n\nat the location you want to break into the debugger. You can then\nstep through the code following this statement, and continue running\nwithout the debugger using the "continue" command.\n\nThe typical usage to inspect a crashed program is:\n\n >>> import pdb\n >>> import mymodule\n >>> mymodule.test()\n Traceback (most recent call last):\n File "", line 1, in ?\n File "./mymodule.py", line 4, in test\n test2()\n File "./mymodule.py", line 3, in test2\n print(spam)\n NameError: spam\n >>> pdb.pm()\n > ./mymodule.py(3)test2()\n -> print(spam)\n (Pdb)\n\nThe module defines the following functions; each enters the debugger\nin a slightly different way:\n\npdb.run(statement, globals=None, locals=None)\n\n Execute the *statement* (given as a string or a code object) under\n debugger control. The debugger prompt appears before any code is\n executed; you can set breakpoints and type "continue", or you can\n step through the statement using "step" or "next" (all these\n commands are explained below). The optional *globals* and *locals*\n arguments specify the environment in which the code is executed; by\n default the dictionary of the module "__main__" is used. (See the\n explanation of the built-in "exec()" or "eval()" functions.)\n\npdb.runeval(expression, globals=None, locals=None)\n\n Evaluate the *expression* (given as a string or a code object)\n under debugger control. When "runeval()" returns, it returns the\n value of the expression. Otherwise this function is similar to\n "run()".\n\npdb.runcall(function, *args, **kwds)\n\n Call the *function* (a function or method object, not a string)\n with the given arguments. When "runcall()" returns, it returns\n whatever the function call returned. The debugger prompt appears\n as soon as the function is entered.\n\npdb.set_trace()\n\n Enter the debugger at the calling stack frame. This is useful to\n hard-code a breakpoint at a given point in a program, even if the\n code is not otherwise being debugged (e.g. when an assertion\n fails).\n\npdb.post_mortem(traceback=None)\n\n Enter post-mortem debugging of the given *traceback* object. If no\n *traceback* is given, it uses the one of the exception that is\n currently being handled (an exception must be being handled if the\n default is to be used).\n\npdb.pm()\n\n Enter post-mortem debugging of the traceback found in\n "sys.last_traceback".\n\nThe "run*" functions and "set_trace()" are aliases for instantiating\nthe "Pdb" class and calling the method of the same name. If you want\nto access further features, you have to do this yourself:\n\nclass class pdb.Pdb(completekey=\'tab\', stdin=None, stdout=None, skip=None, nosigint=False)\n\n "Pdb" is the debugger class.\n\n The *completekey*, *stdin* and *stdout* arguments are passed to the\n underlying "cmd.Cmd" class; see the description there.\n\n The *skip* argument, if given, must be an iterable of glob-style\n module name patterns. The debugger will not step into frames that\n originate in a module that matches one of these patterns. [1]\n\n By default, Pdb sets a handler for the SIGINT signal (which is sent\n when the user presses "Ctrl-C" on the console) when you give a\n "continue" command. This allows you to break into the debugger\n again by pressing "Ctrl-C". If you want Pdb not to touch the\n SIGINT handler, set *nosigint* tot true.\n\n Example call to enable tracing with *skip*:\n\n import pdb; pdb.Pdb(skip=[\'django.*\']).set_trace()\n\n New in version 3.1: The *skip* argument.\n\n New in version 3.2: The *nosigint* argument. Previously, a SIGINT\n handler was never set by Pdb.\n\n run(statement, globals=None, locals=None)\n runeval(expression, globals=None, locals=None)\n runcall(function, *args, **kwds)\n set_trace()\n\n See the documentation for the functions explained above.\n\n\nDebugger Commands\n=================\n\nThe commands recognized by the debugger are listed below. Most\ncommands can be abbreviated to one or two letters as indicated; e.g.\n"h(elp)" means that either "h" or "help" can be used to enter the help\ncommand (but not "he" or "hel", nor "H" or "Help" or "HELP").\nArguments to commands must be separated by whitespace (spaces or\ntabs). Optional arguments are enclosed in square brackets ("[]") in\nthe command syntax; the square brackets must not be typed.\nAlternatives in the command syntax are separated by a vertical bar\n("|").\n\nEntering a blank line repeats the last command entered. Exception: if\nthe last command was a "list" command, the next 11 lines are listed.\n\nCommands that the debugger doesn\'t recognize are assumed to be Python\nstatements and are executed in the context of the program being\ndebugged. Python statements can also be prefixed with an exclamation\npoint ("!"). This is a powerful way to inspect the program being\ndebugged; it is even possible to change a variable or call a function.\nWhen an exception occurs in such a statement, the exception name is\nprinted but the debugger\'s state is not changed.\n\nThe debugger supports *aliases*. Aliases can have parameters which\nallows one a certain level of adaptability to the context under\nexamination.\n\nMultiple commands may be entered on a single line, separated by ";;".\n(A single ";" is not used as it is the separator for multiple commands\nin a line that is passed to the Python parser.) No intelligence is\napplied to separating the commands; the input is split at the first\n";;" pair, even if it is in the middle of a quoted string.\n\nIf a file ".pdbrc" exists in the user\'s home directory or in the\ncurrent directory, it is read in and executed as if it had been typed\nat the debugger prompt. This is particularly useful for aliases. If\nboth files exist, the one in the home directory is read first and\naliases defined there can be overridden by the local file.\n\nChanged in version 3.2: ".pdbrc" can now contain commands that\ncontinue debugging, such as "continue" or "next". Previously, these\ncommands had no effect.\n\nh(elp) [command]\n\n Without argument, print the list of available commands. With a\n *command* as argument, print help about that command. "help pdb"\n displays the full documentation (the docstring of the "pdb"\n module). Since the *command* argument must be an identifier, "help\n exec" must be entered to get help on the "!" command.\n\nw(here)\n\n Print a stack trace, with the most recent frame at the bottom. An\n arrow indicates the current frame, which determines the context of\n most commands.\n\nd(own) [count]\n\n Move the current frame *count* (default one) levels down in the\n stack trace (to a newer frame).\n\nu(p) [count]\n\n Move the current frame *count* (default one) levels up in the stack\n trace (to an older frame).\n\nb(reak) [([filename:]lineno | function) [, condition]]\n\n With a *lineno* argument, set a break there in the current file.\n With a *function* argument, set a break at the first executable\n statement within that function. The line number may be prefixed\n with a filename and a colon, to specify a breakpoint in another\n file (probably one that hasn\'t been loaded yet). The file is\n searched on "sys.path". Note that each breakpoint is assigned a\n number to which all the other breakpoint commands refer.\n\n If a second argument is present, it is an expression which must\n evaluate to true before the breakpoint is honored.\n\n Without argument, list all breaks, including for each breakpoint,\n the number of times that breakpoint has been hit, the current\n ignore count, and the associated condition if any.\n\ntbreak [([filename:]lineno | function) [, condition]]\n\n Temporary breakpoint, which is removed automatically when it is\n first hit. The arguments are the same as for "break".\n\ncl(ear) [filename:lineno | bpnumber [bpnumber ...]]\n\n With a *filename:lineno* argument, clear all the breakpoints at\n this line. With a space separated list of breakpoint numbers, clear\n those breakpoints. Without argument, clear all breaks (but first\n ask confirmation).\n\ndisable [bpnumber [bpnumber ...]]\n\n Disable the breakpoints given as a space separated list of\n breakpoint numbers. Disabling a breakpoint means it cannot cause\n the program to stop execution, but unlike clearing a breakpoint, it\n remains in the list of breakpoints and can be (re-)enabled.\n\nenable [bpnumber [bpnumber ...]]\n\n Enable the breakpoints specified.\n\nignore bpnumber [count]\n\n Set the ignore count for the given breakpoint number. If count is\n omitted, the ignore count is set to 0. A breakpoint becomes active\n when the ignore count is zero. When non-zero, the count is\n decremented each time the breakpoint is reached and the breakpoint\n is not disabled and any associated condition evaluates to true.\n\ncondition bpnumber [condition]\n\n Set a new *condition* for the breakpoint, an expression which must\n evaluate to true before the breakpoint is honored. If *condition*\n is absent, any existing condition is removed; i.e., the breakpoint\n is made unconditional.\n\ncommands [bpnumber]\n\n Specify a list of commands for breakpoint number *bpnumber*. The\n commands themselves appear on the following lines. Type a line\n containing just "end" to terminate the commands. An example:\n\n (Pdb) commands 1\n (com) p some_variable\n (com) end\n (Pdb)\n\n To remove all commands from a breakpoint, type commands and follow\n it immediately with "end"; that is, give no commands.\n\n With no *bpnumber* argument, commands refers to the last breakpoint\n set.\n\n You can use breakpoint commands to start your program up again.\n Simply use the continue command, or step, or any other command that\n resumes execution.\n\n Specifying any command resuming execution (currently continue,\n step, next, return, jump, quit and their abbreviations) terminates\n the command list (as if that command was immediately followed by\n end). This is because any time you resume execution (even with a\n simple next or step), you may encounter another breakpoint--which\n could have its own command list, leading to ambiguities about which\n list to execute.\n\n If you use the \'silent\' command in the command list, the usual\n message about stopping at a breakpoint is not printed. This may be\n desirable for breakpoints that are to print a specific message and\n then continue. If none of the other commands print anything, you\n see no sign that the breakpoint was reached.\n\ns(tep)\n\n Execute the current line, stop at the first possible occasion\n (either in a function that is called or on the next line in the\n current function).\n\nn(ext)\n\n Continue execution until the next line in the current function is\n reached or it returns. (The difference between "next" and "step"\n is that "step" stops inside a called function, while "next"\n executes called functions at (nearly) full speed, only stopping at\n the next line in the current function.)\n\nunt(il) [lineno]\n\n Without argument, continue execution until the line with a number\n greater than the current one is reached.\n\n With a line number, continue execution until a line with a number\n greater or equal to that is reached. In both cases, also stop when\n the current frame returns.\n\n Changed in version 3.2: Allow giving an explicit line number.\n\nr(eturn)\n\n Continue execution until the current function returns.\n\nc(ont(inue))\n\n Continue execution, only stop when a breakpoint is encountered.\n\nj(ump) lineno\n\n Set the next line that will be executed. Only available in the\n bottom-most frame. This lets you jump back and execute code again,\n or jump forward to skip code that you don\'t want to run.\n\n It should be noted that not all jumps are allowed -- for instance\n it is not possible to jump into the middle of a "for" loop or out\n of a "finally" clause.\n\nl(ist) [first[, last]]\n\n List source code for the current file. Without arguments, list 11\n lines around the current line or continue the previous listing.\n With "." as argument, list 11 lines around the current line. With\n one argument, list 11 lines around at that line. With two\n arguments, list the given range; if the second argument is less\n than the first, it is interpreted as a count.\n\n The current line in the current frame is indicated by "->". If an\n exception is being debugged, the line where the exception was\n originally raised or propagated is indicated by ">>", if it differs\n from the current line.\n\n New in version 3.2: The ">>" marker.\n\nll | longlist\n\n List all source code for the current function or frame.\n Interesting lines are marked as for "list".\n\n New in version 3.2.\n\na(rgs)\n\n Print the argument list of the current function.\n\np expression\n\n Evaluate the *expression* in the current context and print its\n value.\n\n Note: "print()" can also be used, but is not a debugger command\n --- this executes the Python "print()" function.\n\npp expression\n\n Like the "p" command, except the value of the expression is pretty-\n printed using the "pprint" module.\n\nwhatis expression\n\n Print the type of the *expression*.\n\nsource expression\n\n Try to get source code for the given object and display it.\n\n New in version 3.2.\n\ndisplay [expression]\n\n Display the value of the expression if it changed, each time\n execution stops in the current frame.\n\n Without expression, list all display expressions for the current\n frame.\n\n New in version 3.2.\n\nundisplay [expression]\n\n Do not display the expression any more in the current frame.\n Without expression, clear all display expressions for the current\n frame.\n\n New in version 3.2.\n\ninteract\n\n Start an interative interpreter (using the "code" module) whose\n global namespace contains all the (global and local) names found in\n the current scope.\n\n New in version 3.2.\n\nalias [name [command]]\n\n Create an alias called *name* that executes *command*. The command\n must *not* be enclosed in quotes. Replaceable parameters can be\n indicated by "%1", "%2", and so on, while "%*" is replaced by all\n the parameters. If no command is given, the current alias for\n *name* is shown. If no arguments are given, all aliases are listed.\n\n Aliases may be nested and can contain anything that can be legally\n typed at the pdb prompt. Note that internal pdb commands *can* be\n overridden by aliases. Such a command is then hidden until the\n alias is removed. Aliasing is recursively applied to the first\n word of the command line; all other words in the line are left\n alone.\n\n As an example, here are two useful aliases (especially when placed\n in the ".pdbrc" file):\n\n # Print instance variables (usage "pi classInst")\n alias pi for k in %1.__dict__.keys(): print("%1.",k,"=",%1.__dict__[k])\n # Print instance variables in self\n alias ps pi self\n\nunalias name\n\n Delete the specified alias.\n\n! statement\n\n Execute the (one-line) *statement* in the context of the current\n stack frame. The exclamation point can be omitted unless the first\n word of the statement resembles a debugger command. To set a\n global variable, you can prefix the assignment command with a\n "global" statement on the same line, e.g.:\n\n (Pdb) global list_options; list_options = [\'-l\']\n (Pdb)\n\nrun [args ...]\nrestart [args ...]\n\n Restart the debugged Python program. If an argument is supplied,\n it is split with "shlex" and the result is used as the new\n "sys.argv". History, breakpoints, actions and debugger options are\n preserved. "restart" is an alias for "run".\n\nq(uit)\n\n Quit from the debugger. The program being executed is aborted.\n\n-[ Footnotes ]-\n\n[1] Whether a frame is considered to originate in a certain module\n is determined by the "__name__" in the frame globals.\n', 'del': u'\nThe "del" statement\n*******************\n\n del_stmt ::= "del" target_list\n\nDeletion is recursively defined very similar to the way assignment is\ndefined. Rather than spelling it out in full details, here are some\nhints.\n\nDeletion of a target list recursively deletes each target, from left\nto right.\n\nDeletion of a name removes the binding of that name from the local or\nglobal namespace, depending on whether the name occurs in a "global"\nstatement in the same code block. If the name is unbound, a\n"NameError" exception will be raised.\n\nDeletion of attribute references, subscriptions and slicings is passed\nto the primary object involved; deletion of a slicing is in general\nequivalent to assignment of an empty slice of the right type (but even\nthis is determined by the sliced object).\n\nChanged in version 3.2: Previously it was illegal to delete a name\nfrom the local namespace if it occurs as a free variable in a nested\nblock.\n', - 'dict': u'\nDictionary displays\n*******************\n\nA dictionary display is a possibly empty series of key/datum pairs\nenclosed in curly braces:\n\n dict_display ::= "{" [key_datum_list | dict_comprehension] "}"\n key_datum_list ::= key_datum ("," key_datum)* [","]\n key_datum ::= expression ":" expression\n dict_comprehension ::= expression ":" expression comp_for\n\nA dictionary display yields a new dictionary object.\n\nIf a comma-separated sequence of key/datum pairs is given, they are\nevaluated from left to right to define the entries of the dictionary:\neach key object is used as a key into the dictionary to store the\ncorresponding datum. This means that you can specify the same key\nmultiple times in the key/datum list, and the final dictionary\'s value\nfor that key will be the last one given.\n\nA dict comprehension, in contrast to list and set comprehensions,\nneeds two expressions separated with a colon followed by the usual\n"for" and "if" clauses. When the comprehension is run, the resulting\nkey and value elements are inserted in the new dictionary in the order\nthey are produced.\n\nRestrictions on the types of the key values are listed earlier in\nsection *The standard type hierarchy*. (To summarize, the key type\nshould be *hashable*, which excludes all mutable objects.) Clashes\nbetween duplicate keys are not detected; the last datum (textually\nrightmost in the display) stored for a given key value prevails.\n', + 'dict': u'\nDictionary displays\n*******************\n\nA dictionary display is a possibly empty series of key/datum pairs\nenclosed in curly braces:\n\n dict_display ::= "{" [key_datum_list | dict_comprehension] "}"\n key_datum_list ::= key_datum ("," key_datum)* [","]\n key_datum ::= expression ":" expression | "**" or_expr\n dict_comprehension ::= expression ":" expression comp_for\n\nA dictionary display yields a new dictionary object.\n\nIf a comma-separated sequence of key/datum pairs is given, they are\nevaluated from left to right to define the entries of the dictionary:\neach key object is used as a key into the dictionary to store the\ncorresponding datum. This means that you can specify the same key\nmultiple times in the key/datum list, and the final dictionary\'s value\nfor that key will be the last one given.\n\nA double asterisk "**" denotes *dictionary unpacking*. Its operand\nmust be a *mapping*. Each mapping item is added to the new\ndictionary. Later values replace values already set by earlier\nkey/datum pairs and earlier dictionary unpackings.\n\nNew in version 3.5: Unpacking into dictionary displays, originally\nproposed by **PEP 448**.\n\nA dict comprehension, in contrast to list and set comprehensions,\nneeds two expressions separated with a colon followed by the usual\n"for" and "if" clauses. When the comprehension is run, the resulting\nkey and value elements are inserted in the new dictionary in the order\nthey are produced.\n\nRestrictions on the types of the key values are listed earlier in\nsection *The standard type hierarchy*. (To summarize, the key type\nshould be *hashable*, which excludes all mutable objects.) Clashes\nbetween duplicate keys are not detected; the last datum (textually\nrightmost in the display) stored for a given key value prevails.\n', 'dynamic-features': u'\nInteraction with dynamic features\n*********************************\n\nName resolution of free variables occurs at runtime, not at compile\ntime. This means that the following code will print 42:\n\n i = 10\n def f():\n print(i)\n i = 42\n f()\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nThe "eval()" and "exec()" functions do not have access to the full\nenvironment for resolving names. Names may be resolved in the local\nand global namespaces of the caller. Free variables are not resolved\nin the nearest enclosing namespace, but in the global namespace. [1]\nThe "exec()" and "eval()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n', 'else': u'\nThe "if" statement\n******************\n\nThe "if" statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n', 'exceptions': u'\nExceptions\n**********\n\nExceptions are a means of breaking out of the normal flow of control\nof a code block in order to handle errors or other exceptional\nconditions. An exception is *raised* at the point where the error is\ndetected; it may be *handled* by the surrounding code block or by any\ncode block that directly or indirectly invoked the code block where\nthe error occurred.\n\nThe Python interpreter raises an exception when it detects a run-time\nerror (such as division by zero). A Python program can also\nexplicitly raise an exception with the "raise" statement. Exception\nhandlers are specified with the "try" ... "except" statement. The\n"finally" clause of such a statement can be used to specify cleanup\ncode which does not handle the exception, but is executed whether an\nexception occurred or not in the preceding code.\n\nPython uses the "termination" model of error handling: an exception\nhandler can find out what happened and continue execution at an outer\nlevel, but it cannot repair the cause of the error and retry the\nfailing operation (except by re-entering the offending piece of code\nfrom the top).\n\nWhen an exception is not handled at all, the interpreter terminates\nexecution of the program, or returns to its interactive main loop. In\neither case, it prints a stack backtrace, except when the exception is\n"SystemExit".\n\nExceptions are identified by class instances. The "except" clause is\nselected depending on the class of the instance: it must reference the\nclass of the instance or a base class thereof. The instance can be\nreceived by the handler and can carry additional information about the\nexceptional condition.\n\nNote: Exception messages are not part of the Python API. Their\n contents may change from one version of Python to the next without\n warning and should not be relied on by code which will run under\n multiple versions of the interpreter.\n\nSee also the description of the "try" statement in section *The try\nstatement* and "raise" statement in section *The raise statement*.\n\n-[ Footnotes ]-\n\n[1] This limitation occurs because the code that is executed by\n these operations is not available at the time the module is\n compiled.\n', 'execmodel': u'\nExecution model\n***************\n\n\nStructure of a program\n======================\n\nA Python program is constructed from code blocks. A *block* is a piece\nof Python program text that is executed as a unit. The following are\nblocks: a module, a function body, and a class definition. Each\ncommand typed interactively is a block. A script file (a file given\nas standard input to the interpreter or specified as a command line\nargument to the interpreter) is a code block. A script command (a\ncommand specified on the interpreter command line with the \'**-c**\'\noption) is a code block. The string argument passed to the built-in\nfunctions "eval()" and "exec()" is a code block.\n\nA code block is executed in an *execution frame*. A frame contains\nsome administrative information (used for debugging) and determines\nwhere and how execution continues after the code block\'s execution has\ncompleted.\n\n\nNaming and binding\n==================\n\n\nBinding of names\n----------------\n\n*Names* refer to objects. Names are introduced by name binding\noperations.\n\nThe following constructs bind names: formal parameters to functions,\n"import" statements, class and function definitions (these bind the\nclass or function name in the defining block), and targets that are\nidentifiers if occurring in an assignment, "for" loop header, or after\n"as" in a "with" statement or "except" clause. The "import" statement\nof the form "from ... import *" binds all names defined in the\nimported module, except those beginning with an underscore. This form\nmay only be used at the module level.\n\nA target occurring in a "del" statement is also considered bound for\nthis purpose (though the actual semantics are to unbind the name).\n\nEach assignment or import statement occurs within a block defined by a\nclass or function definition or at the module level (the top-level\ncode block).\n\nIf a name is bound in a block, it is a local variable of that block,\nunless declared as "nonlocal" or "global". If a name is bound at the\nmodule level, it is a global variable. (The variables of the module\ncode block are local and global.) If a variable is used in a code\nblock but not defined there, it is a *free variable*.\n\nEach occurrence of a name in the program text refers to the *binding*\nof that name established by the following name resolution rules.\n\n\nResolution of names\n-------------------\n\nA *scope* defines the visibility of a name within a block. If a local\nvariable is defined in a block, its scope includes that block. If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces\na different binding for the name.\n\nWhen a name is used in a code block, it is resolved using the nearest\nenclosing scope. The set of all such scopes visible to a code block\nis called the block\'s *environment*.\n\nWhen a name is not found at all, a "NameError" exception is raised. If\nthe current scope is a function scope, and the name refers to a local\nvariable that has not yet been bound to a value at the point where the\nname is used, an "UnboundLocalError" exception is raised.\n"UnboundLocalError" is a subclass of "NameError".\n\nIf a name binding operation occurs anywhere within a code block, all\nuses of the name within the block are treated as references to the\ncurrent block. This can lead to errors when a name is used within a\nblock before it is bound. This rule is subtle. Python lacks\ndeclarations and allows name binding operations to occur anywhere\nwithin a code block. The local variables of a code block can be\ndetermined by scanning the entire text of the block for name binding\noperations.\n\nIf the "global" statement occurs within a block, all uses of the name\nspecified in the statement refer to the binding of that name in the\ntop-level namespace. Names are resolved in the top-level namespace by\nsearching the global namespace, i.e. the namespace of the module\ncontaining the code block, and the builtins namespace, the namespace\nof the module "builtins". The global namespace is searched first. If\nthe name is not found there, the builtins namespace is searched. The\n"global" statement must precede all uses of the name.\n\nThe "global" statement has the same scope as a name binding operation\nin the same block. If the nearest enclosing scope for a free variable\ncontains a global statement, the free variable is treated as a global.\n\nThe "nonlocal" statement causes corresponding names to refer to\npreviously bound variables in the nearest enclosing function scope.\n"SyntaxError" is raised at compile time if the given name does not\nexist in any enclosing function scope.\n\nThe namespace for a module is automatically created the first time a\nmodule is imported. The main module for a script is always called\n"__main__".\n\nClass definition blocks and arguments to "exec()" and "eval()" are\nspecial in the context of name resolution. A class definition is an\nexecutable statement that may use and define names. These references\nfollow the normal rules for name resolution with an exception that\nunbound local variables are looked up in the global namespace. The\nnamespace of the class definition becomes the attribute dictionary of\nthe class. The scope of names defined in a class block is limited to\nthe class block; it does not extend to the code blocks of methods --\nthis includes comprehensions and generator expressions since they are\nimplemented using a function scope. This means that the following\nwill fail:\n\n class A:\n a = 42\n b = list(a + i for i in range(10))\n\n\nBuiltins and restricted execution\n---------------------------------\n\nThe builtins namespace associated with the execution of a code block\nis actually found by looking up the name "__builtins__" in its global\nnamespace; this should be a dictionary or a module (in the latter case\nthe module\'s dictionary is used). By default, when in the "__main__"\nmodule, "__builtins__" is the built-in module "builtins"; when in any\nother module, "__builtins__" is an alias for the dictionary of the\n"builtins" module itself. "__builtins__" can be set to a user-created\ndictionary to create a weak form of restricted execution.\n\n**CPython implementation detail:** Users should not touch\n"__builtins__"; it is strictly an implementation detail. Users\nwanting to override values in the builtins namespace should "import"\nthe "builtins" module and modify its attributes appropriately.\n\n\nInteraction with dynamic features\n---------------------------------\n\nName resolution of free variables occurs at runtime, not at compile\ntime. This means that the following code will print 42:\n\n i = 10\n def f():\n print(i)\n i = 42\n f()\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nThe "eval()" and "exec()" functions do not have access to the full\nenvironment for resolving names. Names may be resolved in the local\nand global namespaces of the caller. Free variables are not resolved\nin the nearest enclosing namespace, but in the global namespace. [1]\nThe "exec()" and "eval()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n\n\nExceptions\n==========\n\nExceptions are a means of breaking out of the normal flow of control\nof a code block in order to handle errors or other exceptional\nconditions. An exception is *raised* at the point where the error is\ndetected; it may be *handled* by the surrounding code block or by any\ncode block that directly or indirectly invoked the code block where\nthe error occurred.\n\nThe Python interpreter raises an exception when it detects a run-time\nerror (such as division by zero). A Python program can also\nexplicitly raise an exception with the "raise" statement. Exception\nhandlers are specified with the "try" ... "except" statement. The\n"finally" clause of such a statement can be used to specify cleanup\ncode which does not handle the exception, but is executed whether an\nexception occurred or not in the preceding code.\n\nPython uses the "termination" model of error handling: an exception\nhandler can find out what happened and continue execution at an outer\nlevel, but it cannot repair the cause of the error and retry the\nfailing operation (except by re-entering the offending piece of code\nfrom the top).\n\nWhen an exception is not handled at all, the interpreter terminates\nexecution of the program, or returns to its interactive main loop. In\neither case, it prints a stack backtrace, except when the exception is\n"SystemExit".\n\nExceptions are identified by class instances. The "except" clause is\nselected depending on the class of the instance: it must reference the\nclass of the instance or a base class thereof. The instance can be\nreceived by the handler and can carry additional information about the\nexceptional condition.\n\nNote: Exception messages are not part of the Python API. Their\n contents may change from one version of Python to the next without\n warning and should not be relied on by code which will run under\n multiple versions of the interpreter.\n\nSee also the description of the "try" statement in section *The try\nstatement* and "raise" statement in section *The raise statement*.\n\n-[ Footnotes ]-\n\n[1] This limitation occurs because the code that is executed by\n these operations is not available at the time the module is\n compiled.\n', - 'exprlists': u'\nExpression lists\n****************\n\n expression_list ::= expression ( "," expression )* [","]\n\nAn expression list containing at least one comma yields a tuple. The\nlength of the tuple is the number of expressions in the list. The\nexpressions are evaluated from left to right.\n\nThe trailing comma is required only to create a single tuple (a.k.a. a\n*singleton*); it is optional in all other cases. A single expression\nwithout a trailing comma doesn\'t create a tuple, but rather yields the\nvalue of that expression. (To create an empty tuple, use an empty pair\nof parentheses: "()".)\n', + 'exprlists': u'\nExpression lists\n****************\n\n expression_list ::= expression ( "," expression )* [","]\n starred_list ::= starred_item ( "," starred_item )* [","]\n starred_expression ::= expression | ( starred_item "," )* [starred_item]\n starred_item ::= expression | "*" or_expr\n\nExcept when part of a list or set display, an expression list\ncontaining at least one comma yields a tuple. The length of the tuple\nis the number of expressions in the list. The expressions are\nevaluated from left to right.\n\nAn asterisk "*" denotes *iterable unpacking*. Its operand must be an\n*iterable*. The iterable is expanded into a sequence of items, which\nare included in the new tuple, list, or set, at the site of the\nunpacking.\n\nNew in version 3.5: Iterable unpacking in expression lists, originally\nproposed by **PEP 448**.\n\nThe trailing comma is required only to create a single tuple (a.k.a. a\n*singleton*); it is optional in all other cases. A single expression\nwithout a trailing comma doesn\'t create a tuple, but rather yields the\nvalue of that expression. (To create an empty tuple, use an empty pair\nof parentheses: "()".)\n', 'floating': u'\nFloating point literals\n***********************\n\nFloating point literals are described by the following lexical\ndefinitions:\n\n floatnumber ::= pointfloat | exponentfloat\n pointfloat ::= [intpart] fraction | intpart "."\n exponentfloat ::= (intpart | pointfloat) exponent\n intpart ::= digit+\n fraction ::= "." digit+\n exponent ::= ("e" | "E") ["+" | "-"] digit+\n\nNote that the integer and exponent parts are always interpreted using\nradix 10. For example, "077e010" is legal, and denotes the same number\nas "77e10". The allowed range of floating point literals is\nimplementation-dependent. Some examples of floating point literals:\n\n 3.14 10. .001 1e100 3.14e-10 0e0\n\nNote that numeric literals do not include a sign; a phrase like "-1"\nis actually an expression composed of the unary operator "-" and the\nliteral "1".\n', 'for': u'\nThe "for" statement\n*******************\n\nThe "for" statement is used to iterate over the elements of a sequence\n(such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n"expression_list". The suite is then executed once for each item\nprovided by the iterator, in the order returned by the iterator. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments (see *Assignment statements*), and then the suite is\nexecuted. When the items are exhausted (which is immediately when the\nsequence is empty or an iterator raises a "StopIteration" exception),\nthe suite in the "else" clause, if present, is executed, and the loop\nterminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and continues\nwith the next item, or with the "else" clause if there is no next\nitem.\n\nThe for-loop makes assignments to the variables(s) in the target list.\nThis overwrites all previous assignments to those variables including\nthose made in the suite of the for-loop:\n\n for i in range(10):\n print(i)\n i = 5 # this will not affect the for-loop\n # because i will be overwritten with the next\n # index in the range\n\nNames in the target list are not deleted when the loop is finished,\nbut if the sequence is empty, they will not have been assigned to at\nall by the loop. Hint: the built-in function "range()" returns an\niterator of integers suitable to emulate the effect of Pascal\'s "for i\n:= a to b do"; e.g., "list(range(3))" returns the list "[0, 1, 2]".\n\nNote: There is a subtlety when the sequence is being modified by the\n loop (this can only occur for mutable sequences, i.e. lists). An\n internal counter is used to keep track of which item is used next,\n and this is incremented on each iteration. When this counter has\n reached the length of the sequence the loop terminates. This means\n that if the suite deletes the current (or a previous) item from the\n sequence, the next item will be skipped (since it gets the index of\n the current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n', - 'formatstrings': u'\nFormat String Syntax\n********************\n\nThe "str.format()" method and the "Formatter" class share the same\nsyntax for format strings (although in the case of "Formatter",\nsubclasses can define their own format string syntax).\n\nFormat strings contain "replacement fields" surrounded by curly braces\n"{}". Anything that is not contained in braces is considered literal\ntext, which is copied unchanged to the output. If you need to include\na brace character in the literal text, it can be escaped by doubling:\n"{{" and "}}".\n\nThe grammar for a replacement field is as follows:\n\n replacement_field ::= "{" [field_name] ["!" conversion] [":" format_spec] "}"\n field_name ::= arg_name ("." attribute_name | "[" element_index "]")*\n arg_name ::= [identifier | integer]\n attribute_name ::= identifier\n element_index ::= integer | index_string\n index_string ::= +\n conversion ::= "r" | "s" | "a"\n format_spec ::= \n\nIn less formal terms, the replacement field can start with a\n*field_name* that specifies the object whose value is to be formatted\nand inserted into the output instead of the replacement field. The\n*field_name* is optionally followed by a *conversion* field, which is\npreceded by an exclamation point "\'!\'", and a *format_spec*, which is\npreceded by a colon "\':\'". These specify a non-default format for the\nreplacement value.\n\nSee also the *Format Specification Mini-Language* section.\n\nThe *field_name* itself begins with an *arg_name* that is either a\nnumber or a keyword. If it\'s a number, it refers to a positional\nargument, and if it\'s a keyword, it refers to a named keyword\nargument. If the numerical arg_names in a format string are 0, 1, 2,\n... in sequence, they can all be omitted (not just some) and the\nnumbers 0, 1, 2, ... will be automatically inserted in that order.\nBecause *arg_name* is not quote-delimited, it is not possible to\nspecify arbitrary dictionary keys (e.g., the strings "\'10\'" or\n"\':-]\'") within a format string. The *arg_name* can be followed by any\nnumber of index or attribute expressions. An expression of the form\n"\'.name\'" selects the named attribute using "getattr()", while an\nexpression of the form "\'[index]\'" does an index lookup using\n"__getitem__()".\n\nChanged in version 3.1: The positional argument specifiers can be\nomitted, so "\'{} {}\'" is equivalent to "\'{0} {1}\'".\n\nSome simple format string examples:\n\n "First, thou shalt count to {0}" # References first positional argument\n "Bring me a {}" # Implicitly references the first positional argument\n "From {} to {}" # Same as "From {0} to {1}"\n "My quest is {name}" # References keyword argument \'name\'\n "Weight in tons {0.weight}" # \'weight\' attribute of first positional arg\n "Units destroyed: {players[0]}" # First element of keyword argument \'players\'.\n\nThe *conversion* field causes a type coercion before formatting.\nNormally, the job of formatting a value is done by the "__format__()"\nmethod of the value itself. However, in some cases it is desirable to\nforce a type to be formatted as a string, overriding its own\ndefinition of formatting. By converting the value to a string before\ncalling "__format__()", the normal formatting logic is bypassed.\n\nThree conversion flags are currently supported: "\'!s\'" which calls\n"str()" on the value, "\'!r\'" which calls "repr()" and "\'!a\'" which\ncalls "ascii()".\n\nSome examples:\n\n "Harold\'s a clever {0!s}" # Calls str() on the argument first\n "Bring out the holy {name!r}" # Calls repr() on the argument first\n "More {!a}" # Calls ascii() on the argument first\n\nThe *format_spec* field contains a specification of how the value\nshould be presented, including such details as field width, alignment,\npadding, decimal precision and so on. Each value type can define its\nown "formatting mini-language" or interpretation of the *format_spec*.\n\nMost built-in types support a common formatting mini-language, which\nis described in the next section.\n\nA *format_spec* field can also include nested replacement fields\nwithin it. These nested replacement fields can contain only a field\nname; conversion flags and format specifications are not allowed. The\nreplacement fields within the format_spec are substituted before the\n*format_spec* string is interpreted. This allows the formatting of a\nvalue to be dynamically specified.\n\nSee the *Format examples* section for some examples.\n\n\nFormat Specification Mini-Language\n==================================\n\n"Format specifications" are used within replacement fields contained\nwithin a format string to define how individual values are presented\n(see *Format String Syntax*). They can also be passed directly to the\nbuilt-in "format()" function. Each formattable type may define how\nthe format specification is to be interpreted.\n\nMost built-in types implement the following options for format\nspecifications, although some of the formatting options are only\nsupported by the numeric types.\n\nA general convention is that an empty format string ("""") produces\nthe same result as if you had called "str()" on the value. A non-empty\nformat string typically modifies the result.\n\nThe general form of a *standard format specifier* is:\n\n format_spec ::= [[fill]align][sign][#][0][width][,][.precision][type]\n fill ::= \n align ::= "<" | ">" | "=" | "^"\n sign ::= "+" | "-" | " "\n width ::= integer\n precision ::= integer\n type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"\n\nIf a valid *align* value is specified, it can be preceded by a *fill*\ncharacter that can be any character and defaults to a space if\nomitted. Note that it is not possible to use "{" and "}" as *fill*\nchar while using the "str.format()" method; this limitation however\ndoesn\'t affect the "format()" function.\n\nThe meaning of the various alignment options is as follows:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | "\'<\'" | Forces the field to be left-aligned within the available |\n | | space (this is the default for most objects). |\n +-----------+------------------------------------------------------------+\n | "\'>\'" | Forces the field to be right-aligned within the available |\n | | space (this is the default for numbers). |\n +-----------+------------------------------------------------------------+\n | "\'=\'" | Forces the padding to be placed after the sign (if any) |\n | | but before the digits. This is used for printing fields |\n | | in the form \'+000000120\'. This alignment option is only |\n | | valid for numeric types. |\n +-----------+------------------------------------------------------------+\n | "\'^\'" | Forces the field to be centered within the available |\n | | space. |\n +-----------+------------------------------------------------------------+\n\nNote that unless a minimum field width is defined, the field width\nwill always be the same size as the data to fill it, so that the\nalignment option has no meaning in this case.\n\nThe *sign* option is only valid for number types, and can be one of\nthe following:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | "\'+\'" | indicates that a sign should be used for both positive as |\n | | well as negative numbers. |\n +-----------+------------------------------------------------------------+\n | "\'-\'" | indicates that a sign should be used only for negative |\n | | numbers (this is the default behavior). |\n +-----------+------------------------------------------------------------+\n | space | indicates that a leading space should be used on positive |\n | | numbers, and a minus sign on negative numbers. |\n +-----------+------------------------------------------------------------+\n\nThe "\'#\'" option causes the "alternate form" to be used for the\nconversion. The alternate form is defined differently for different\ntypes. This option is only valid for integer, float, complex and\nDecimal types. For integers, when binary, octal, or hexadecimal output\nis used, this option adds the prefix respective "\'0b\'", "\'0o\'", or\n"\'0x\'" to the output value. For floats, complex and Decimal the\nalternate form causes the result of the conversion to always contain a\ndecimal-point character, even if no digits follow it. Normally, a\ndecimal-point character appears in the result of these conversions\nonly if a digit follows it. In addition, for "\'g\'" and "\'G\'"\nconversions, trailing zeros are not removed from the result.\n\nThe "\',\'" option signals the use of a comma for a thousands separator.\nFor a locale aware separator, use the "\'n\'" integer presentation type\ninstead.\n\nChanged in version 3.1: Added the "\',\'" option (see also **PEP 378**).\n\n*width* is a decimal integer defining the minimum field width. If not\nspecified, then the field width will be determined by the content.\n\nPreceding the *width* field by a zero ("\'0\'") character enables sign-\naware zero-padding for numeric types. This is equivalent to a *fill*\ncharacter of "\'0\'" with an *alignment* type of "\'=\'".\n\nThe *precision* is a decimal number indicating how many digits should\nbe displayed after the decimal point for a floating point value\nformatted with "\'f\'" and "\'F\'", or before and after the decimal point\nfor a floating point value formatted with "\'g\'" or "\'G\'". For non-\nnumber types the field indicates the maximum field size - in other\nwords, how many characters will be used from the field content. The\n*precision* is not allowed for integer values.\n\nFinally, the *type* determines how the data should be presented.\n\nThe available string presentation types are:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | "\'s\'" | String format. This is the default type for strings and |\n | | may be omitted. |\n +-----------+------------------------------------------------------------+\n | None | The same as "\'s\'". |\n +-----------+------------------------------------------------------------+\n\nThe available integer presentation types are:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | "\'b\'" | Binary format. Outputs the number in base 2. |\n +-----------+------------------------------------------------------------+\n | "\'c\'" | Character. Converts the integer to the corresponding |\n | | unicode character before printing. |\n +-----------+------------------------------------------------------------+\n | "\'d\'" | Decimal Integer. Outputs the number in base 10. |\n +-----------+------------------------------------------------------------+\n | "\'o\'" | Octal format. Outputs the number in base 8. |\n +-----------+------------------------------------------------------------+\n | "\'x\'" | Hex format. Outputs the number in base 16, using lower- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | "\'X\'" | Hex format. Outputs the number in base 16, using upper- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | "\'n\'" | Number. This is the same as "\'d\'", except that it uses the |\n | | current locale setting to insert the appropriate number |\n | | separator characters. |\n +-----------+------------------------------------------------------------+\n | None | The same as "\'d\'". |\n +-----------+------------------------------------------------------------+\n\nIn addition to the above presentation types, integers can be formatted\nwith the floating point presentation types listed below (except "\'n\'"\nand None). When doing so, "float()" is used to convert the integer to\na floating point number before formatting.\n\nThe available presentation types for floating point and decimal values\nare:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | "\'e\'" | Exponent notation. Prints the number in scientific |\n | | notation using the letter \'e\' to indicate the exponent. |\n | | The default precision is "6". |\n +-----------+------------------------------------------------------------+\n | "\'E\'" | Exponent notation. Same as "\'e\'" except it uses an upper |\n | | case \'E\' as the separator character. |\n +-----------+------------------------------------------------------------+\n | "\'f\'" | Fixed point. Displays the number as a fixed-point number. |\n | | The default precision is "6". |\n +-----------+------------------------------------------------------------+\n | "\'F\'" | Fixed point. Same as "\'f\'", but converts "nan" to "NAN" |\n | | and "inf" to "INF". |\n +-----------+------------------------------------------------------------+\n | "\'g\'" | General format. For a given precision "p >= 1", this |\n | | rounds the number to "p" significant digits and then |\n | | formats the result in either fixed-point format or in |\n | | scientific notation, depending on its magnitude. The |\n | | precise rules are as follows: suppose that the result |\n | | formatted with presentation type "\'e\'" and precision "p-1" |\n | | would have exponent "exp". Then if "-4 <= exp < p", the |\n | | number is formatted with presentation type "\'f\'" and |\n | | precision "p-1-exp". Otherwise, the number is formatted |\n | | with presentation type "\'e\'" and precision "p-1". In both |\n | | cases insignificant trailing zeros are removed from the |\n | | significand, and the decimal point is also removed if |\n | | there are no remaining digits following it. Positive and |\n | | negative infinity, positive and negative zero, and nans, |\n | | are formatted as "inf", "-inf", "0", "-0" and "nan" |\n | | respectively, regardless of the precision. A precision of |\n | | "0" is treated as equivalent to a precision of "1". The |\n | | default precision is "6". |\n +-----------+------------------------------------------------------------+\n | "\'G\'" | General format. Same as "\'g\'" except switches to "\'E\'" if |\n | | the number gets too large. The representations of infinity |\n | | and NaN are uppercased, too. |\n +-----------+------------------------------------------------------------+\n | "\'n\'" | Number. This is the same as "\'g\'", except that it uses the |\n | | current locale setting to insert the appropriate number |\n | | separator characters. |\n +-----------+------------------------------------------------------------+\n | "\'%\'" | Percentage. Multiplies the number by 100 and displays in |\n | | fixed ("\'f\'") format, followed by a percent sign. |\n +-----------+------------------------------------------------------------+\n | None | Similar to "\'g\'", except that fixed-point notation, when |\n | | used, has at least one digit past the decimal point. The |\n | | default precision is as high as needed to represent the |\n | | particular value. The overall effect is to match the |\n | | output of "str()" as altered by the other format |\n | | modifiers. |\n +-----------+------------------------------------------------------------+\n\n\nFormat examples\n===============\n\nThis section contains examples of the new format syntax and comparison\nwith the old "%"-formatting.\n\nIn most of the cases the syntax is similar to the old "%"-formatting,\nwith the addition of the "{}" and with ":" used instead of "%". For\nexample, "\'%03.2f\'" can be translated to "\'{:03.2f}\'".\n\nThe new format syntax also supports new and different options, shown\nin the follow examples.\n\nAccessing arguments by position:\n\n >>> \'{0}, {1}, {2}\'.format(\'a\', \'b\', \'c\')\n \'a, b, c\'\n >>> \'{}, {}, {}\'.format(\'a\', \'b\', \'c\') # 3.1+ only\n \'a, b, c\'\n >>> \'{2}, {1}, {0}\'.format(\'a\', \'b\', \'c\')\n \'c, b, a\'\n >>> \'{2}, {1}, {0}\'.format(*\'abc\') # unpacking argument sequence\n \'c, b, a\'\n >>> \'{0}{1}{0}\'.format(\'abra\', \'cad\') # arguments\' indices can be repeated\n \'abracadabra\'\n\nAccessing arguments by name:\n\n >>> \'Coordinates: {latitude}, {longitude}\'.format(latitude=\'37.24N\', longitude=\'-115.81W\')\n \'Coordinates: 37.24N, -115.81W\'\n >>> coord = {\'latitude\': \'37.24N\', \'longitude\': \'-115.81W\'}\n >>> \'Coordinates: {latitude}, {longitude}\'.format(**coord)\n \'Coordinates: 37.24N, -115.81W\'\n\nAccessing arguments\' attributes:\n\n >>> c = 3-5j\n >>> (\'The complex number {0} is formed from the real part {0.real} \'\n ... \'and the imaginary part {0.imag}.\').format(c)\n \'The complex number (3-5j) is formed from the real part 3.0 and the imaginary part -5.0.\'\n >>> class Point:\n ... def __init__(self, x, y):\n ... self.x, self.y = x, y\n ... def __str__(self):\n ... return \'Point({self.x}, {self.y})\'.format(self=self)\n ...\n >>> str(Point(4, 2))\n \'Point(4, 2)\'\n\nAccessing arguments\' items:\n\n >>> coord = (3, 5)\n >>> \'X: {0[0]}; Y: {0[1]}\'.format(coord)\n \'X: 3; Y: 5\'\n\nReplacing "%s" and "%r":\n\n >>> "repr() shows quotes: {!r}; str() doesn\'t: {!s}".format(\'test1\', \'test2\')\n "repr() shows quotes: \'test1\'; str() doesn\'t: test2"\n\nAligning the text and specifying a width:\n\n >>> \'{:<30}\'.format(\'left aligned\')\n \'left aligned \'\n >>> \'{:>30}\'.format(\'right aligned\')\n \' right aligned\'\n >>> \'{:^30}\'.format(\'centered\')\n \' centered \'\n >>> \'{:*^30}\'.format(\'centered\') # use \'*\' as a fill char\n \'***********centered***********\'\n\nReplacing "%+f", "%-f", and "% f" and specifying a sign:\n\n >>> \'{:+f}; {:+f}\'.format(3.14, -3.14) # show it always\n \'+3.140000; -3.140000\'\n >>> \'{: f}; {: f}\'.format(3.14, -3.14) # show a space for positive numbers\n \' 3.140000; -3.140000\'\n >>> \'{:-f}; {:-f}\'.format(3.14, -3.14) # show only the minus -- same as \'{:f}; {:f}\'\n \'3.140000; -3.140000\'\n\nReplacing "%x" and "%o" and converting the value to different bases:\n\n >>> # format also supports binary numbers\n >>> "int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}".format(42)\n \'int: 42; hex: 2a; oct: 52; bin: 101010\'\n >>> # with 0x, 0o, or 0b as prefix:\n >>> "int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: {0:#b}".format(42)\n \'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010\'\n\nUsing the comma as a thousands separator:\n\n >>> \'{:,}\'.format(1234567890)\n \'1,234,567,890\'\n\nExpressing a percentage:\n\n >>> points = 19\n >>> total = 22\n >>> \'Correct answers: {:.2%}\'.format(points/total)\n \'Correct answers: 86.36%\'\n\nUsing type-specific formatting:\n\n >>> import datetime\n >>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n >>> \'{:%Y-%m-%d %H:%M:%S}\'.format(d)\n \'2010-07-04 12:15:58\'\n\nNesting arguments and more complex examples:\n\n >>> for align, text in zip(\'<^>\', [\'left\', \'center\', \'right\']):\n ... \'{0:{fill}{align}16}\'.format(text, fill=align, align=align)\n ...\n \'left<<<<<<<<<<<<\'\n \'^^^^^center^^^^^\'\n \'>>>>>>>>>>>right\'\n >>>\n >>> octets = [192, 168, 0, 1]\n >>> \'{:02X}{:02X}{:02X}{:02X}\'.format(*octets)\n \'C0A80001\'\n >>> int(_, 16)\n 3232235521\n >>>\n >>> width = 5\n >>> for num in range(5,12): #doctest: +NORMALIZE_WHITESPACE\n ... for base in \'dXob\':\n ... print(\'{0:{width}{base}}\'.format(num, base=base, width=width), end=\' \')\n ... print()\n ...\n 5 5 5 101\n 6 6 6 110\n 7 7 7 111\n 8 8 10 1000\n 9 9 11 1001\n 10 A 12 1010\n 11 B 13 1011\n', - 'function': u'\nFunction definitions\n********************\n\nA function definition defines a user-defined function object (see\nsection *The standard type hierarchy*):\n\n funcdef ::= [decorators] "def" funcname "(" [parameter_list] ")" ["->" expression] ":" suite\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [parameter_list [","]] ")"] NEWLINE\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n | "*" [parameter] ("," defparameter)* ["," "**" parameter]\n | "**" parameter\n | defparameter [","] )\n parameter ::= identifier [":" expression]\n defparameter ::= parameter ["=" expression]\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more *parameters* have the form *parameter* "="\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding *argument* may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters up until the ""*"" must also have a default value --- this\nis a syntactic restriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated from left to right when the\nfunction definition is executed.** This means that the expression is\nevaluated once, when the function is defined, and that the same "pre-\ncomputed" value is used for each call. This is especially important\nto understand when a default parameter is a mutable object, such as a\nlist or a dictionary: if the function modifies the object (e.g. by\nappending an item to a list), the default value is in effect modified.\nThis is generally not what was intended. A way around this is to use\n"None" as the default, and explicitly test for it in the body of the\nfunction, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section\n*Calls*. A function call always assigns values to all parameters\nmentioned in the parameter list, either from position arguments, from\nkeyword arguments, or from default values. If the form\n""*identifier"" is present, it is initialized to a tuple receiving any\nexcess positional parameters, defaulting to the empty tuple. If the\nform ""**identifier"" is present, it is initialized to a new\ndictionary receiving any excess keyword arguments, defaulting to a new\nempty dictionary. Parameters after ""*"" or ""*identifier"" are\nkeyword-only parameters and may only be passed used keyword arguments.\n\nParameters may have annotations of the form "": expression"" following\nthe parameter name. Any parameter may have an annotation even those\nof the form "*identifier" or "**identifier". Functions may have\n"return" annotation of the form ""-> expression"" after the parameter\nlist. These annotations can be any valid Python expression and are\nevaluated when the function definition is executed. Annotations may\nbe evaluated in a different order than they appear in the source code.\nThe presence of annotations does not change the semantics of a\nfunction. The annotation values are available as values of a\ndictionary keyed by the parameters\' names in the "__annotations__"\nattribute of the function object.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda\nexpressions, described in section *Lambdas*. Note that the lambda\nexpression is merely a shorthand for a simplified function definition;\na function defined in a ""def"" statement can be passed around or\nassigned to another name just like a function defined by a lambda\nexpression. The ""def"" form is actually more powerful since it\nallows the execution of multiple statements and annotations.\n\n**Programmer\'s note:** Functions are first-class objects. A ""def""\nstatement executed inside a function definition defines a local\nfunction that can be returned or passed around. Free variables used\nin the nested function can access the local variables of the function\ncontaining the def. See section *Naming and binding* for details.\n\nSee also: **PEP 3107** - Function Annotations\n\n The original specification for function annotations.\n', + 'formatstrings': u'\nFormat String Syntax\n********************\n\nThe "str.format()" method and the "Formatter" class share the same\nsyntax for format strings (although in the case of "Formatter",\nsubclasses can define their own format string syntax).\n\nFormat strings contain "replacement fields" surrounded by curly braces\n"{}". Anything that is not contained in braces is considered literal\ntext, which is copied unchanged to the output. If you need to include\na brace character in the literal text, it can be escaped by doubling:\n"{{" and "}}".\n\nThe grammar for a replacement field is as follows:\n\n replacement_field ::= "{" [field_name] ["!" conversion] [":" format_spec] "}"\n field_name ::= arg_name ("." attribute_name | "[" element_index "]")*\n arg_name ::= [identifier | integer]\n attribute_name ::= identifier\n element_index ::= integer | index_string\n index_string ::= +\n conversion ::= "r" | "s" | "a"\n format_spec ::= \n\nIn less formal terms, the replacement field can start with a\n*field_name* that specifies the object whose value is to be formatted\nand inserted into the output instead of the replacement field. The\n*field_name* is optionally followed by a *conversion* field, which is\npreceded by an exclamation point "\'!\'", and a *format_spec*, which is\npreceded by a colon "\':\'". These specify a non-default format for the\nreplacement value.\n\nSee also the *Format Specification Mini-Language* section.\n\nThe *field_name* itself begins with an *arg_name* that is either a\nnumber or a keyword. If it\'s a number, it refers to a positional\nargument, and if it\'s a keyword, it refers to a named keyword\nargument. If the numerical arg_names in a format string are 0, 1, 2,\n... in sequence, they can all be omitted (not just some) and the\nnumbers 0, 1, 2, ... will be automatically inserted in that order.\nBecause *arg_name* is not quote-delimited, it is not possible to\nspecify arbitrary dictionary keys (e.g., the strings "\'10\'" or\n"\':-]\'") within a format string. The *arg_name* can be followed by any\nnumber of index or attribute expressions. An expression of the form\n"\'.name\'" selects the named attribute using "getattr()", while an\nexpression of the form "\'[index]\'" does an index lookup using\n"__getitem__()".\n\nChanged in version 3.1: The positional argument specifiers can be\nomitted, so "\'{} {}\'" is equivalent to "\'{0} {1}\'".\n\nSome simple format string examples:\n\n "First, thou shalt count to {0}" # References first positional argument\n "Bring me a {}" # Implicitly references the first positional argument\n "From {} to {}" # Same as "From {0} to {1}"\n "My quest is {name}" # References keyword argument \'name\'\n "Weight in tons {0.weight}" # \'weight\' attribute of first positional arg\n "Units destroyed: {players[0]}" # First element of keyword argument \'players\'.\n\nThe *conversion* field causes a type coercion before formatting.\nNormally, the job of formatting a value is done by the "__format__()"\nmethod of the value itself. However, in some cases it is desirable to\nforce a type to be formatted as a string, overriding its own\ndefinition of formatting. By converting the value to a string before\ncalling "__format__()", the normal formatting logic is bypassed.\n\nThree conversion flags are currently supported: "\'!s\'" which calls\n"str()" on the value, "\'!r\'" which calls "repr()" and "\'!a\'" which\ncalls "ascii()".\n\nSome examples:\n\n "Harold\'s a clever {0!s}" # Calls str() on the argument first\n "Bring out the holy {name!r}" # Calls repr() on the argument first\n "More {!a}" # Calls ascii() on the argument first\n\nThe *format_spec* field contains a specification of how the value\nshould be presented, including such details as field width, alignment,\npadding, decimal precision and so on. Each value type can define its\nown "formatting mini-language" or interpretation of the *format_spec*.\n\nMost built-in types support a common formatting mini-language, which\nis described in the next section.\n\nA *format_spec* field can also include nested replacement fields\nwithin it. These nested replacement fields may contain a field name,\nconversion flag and format specification, but deeper nesting is not\nallowed. The replacement fields within the format_spec are\nsubstituted before the *format_spec* string is interpreted. This\nallows the formatting of a value to be dynamically specified.\n\nSee the *Format examples* section for some examples.\n\n\nFormat Specification Mini-Language\n==================================\n\n"Format specifications" are used within replacement fields contained\nwithin a format string to define how individual values are presented\n(see *Format String Syntax*). They can also be passed directly to the\nbuilt-in "format()" function. Each formattable type may define how\nthe format specification is to be interpreted.\n\nMost built-in types implement the following options for format\nspecifications, although some of the formatting options are only\nsupported by the numeric types.\n\nA general convention is that an empty format string ("""") produces\nthe same result as if you had called "str()" on the value. A non-empty\nformat string typically modifies the result.\n\nThe general form of a *standard format specifier* is:\n\n format_spec ::= [[fill]align][sign][#][0][width][,][.precision][type]\n fill ::= \n align ::= "<" | ">" | "=" | "^"\n sign ::= "+" | "-" | " "\n width ::= integer\n precision ::= integer\n type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"\n\nIf a valid *align* value is specified, it can be preceded by a *fill*\ncharacter that can be any character and defaults to a space if\nomitted. It is not possible to use a literal curly brace (""{"" or\n""}"") as the *fill* character when using the "str.format()" method.\nHowever, it is possible to insert a curly brace with a nested\nreplacement field. This limitation doesn\'t affect the "format()"\nfunction.\n\nThe meaning of the various alignment options is as follows:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | "\'<\'" | Forces the field to be left-aligned within the available |\n | | space (this is the default for most objects). |\n +-----------+------------------------------------------------------------+\n | "\'>\'" | Forces the field to be right-aligned within the available |\n | | space (this is the default for numbers). |\n +-----------+------------------------------------------------------------+\n | "\'=\'" | Forces the padding to be placed after the sign (if any) |\n | | but before the digits. This is used for printing fields |\n | | in the form \'+000000120\'. This alignment option is only |\n | | valid for numeric types. It becomes the default when \'0\' |\n | | immediately precedes the field width. |\n +-----------+------------------------------------------------------------+\n | "\'^\'" | Forces the field to be centered within the available |\n | | space. |\n +-----------+------------------------------------------------------------+\n\nNote that unless a minimum field width is defined, the field width\nwill always be the same size as the data to fill it, so that the\nalignment option has no meaning in this case.\n\nThe *sign* option is only valid for number types, and can be one of\nthe following:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | "\'+\'" | indicates that a sign should be used for both positive as |\n | | well as negative numbers. |\n +-----------+------------------------------------------------------------+\n | "\'-\'" | indicates that a sign should be used only for negative |\n | | numbers (this is the default behavior). |\n +-----------+------------------------------------------------------------+\n | space | indicates that a leading space should be used on positive |\n | | numbers, and a minus sign on negative numbers. |\n +-----------+------------------------------------------------------------+\n\nThe "\'#\'" option causes the "alternate form" to be used for the\nconversion. The alternate form is defined differently for different\ntypes. This option is only valid for integer, float, complex and\nDecimal types. For integers, when binary, octal, or hexadecimal output\nis used, this option adds the prefix respective "\'0b\'", "\'0o\'", or\n"\'0x\'" to the output value. For floats, complex and Decimal the\nalternate form causes the result of the conversion to always contain a\ndecimal-point character, even if no digits follow it. Normally, a\ndecimal-point character appears in the result of these conversions\nonly if a digit follows it. In addition, for "\'g\'" and "\'G\'"\nconversions, trailing zeros are not removed from the result.\n\nThe "\',\'" option signals the use of a comma for a thousands separator.\nFor a locale aware separator, use the "\'n\'" integer presentation type\ninstead.\n\nChanged in version 3.1: Added the "\',\'" option (see also **PEP 378**).\n\n*width* is a decimal integer defining the minimum field width. If not\nspecified, then the field width will be determined by the content.\n\nWhen no explicit alignment is given, preceding the *width* field by a\nzero ("\'0\'") character enables sign-aware zero-padding for numeric\ntypes. This is equivalent to a *fill* character of "\'0\'" with an\n*alignment* type of "\'=\'".\n\nThe *precision* is a decimal number indicating how many digits should\nbe displayed after the decimal point for a floating point value\nformatted with "\'f\'" and "\'F\'", or before and after the decimal point\nfor a floating point value formatted with "\'g\'" or "\'G\'". For non-\nnumber types the field indicates the maximum field size - in other\nwords, how many characters will be used from the field content. The\n*precision* is not allowed for integer values.\n\nFinally, the *type* determines how the data should be presented.\n\nThe available string presentation types are:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | "\'s\'" | String format. This is the default type for strings and |\n | | may be omitted. |\n +-----------+------------------------------------------------------------+\n | None | The same as "\'s\'". |\n +-----------+------------------------------------------------------------+\n\nThe available integer presentation types are:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | "\'b\'" | Binary format. Outputs the number in base 2. |\n +-----------+------------------------------------------------------------+\n | "\'c\'" | Character. Converts the integer to the corresponding |\n | | unicode character before printing. |\n +-----------+------------------------------------------------------------+\n | "\'d\'" | Decimal Integer. Outputs the number in base 10. |\n +-----------+------------------------------------------------------------+\n | "\'o\'" | Octal format. Outputs the number in base 8. |\n +-----------+------------------------------------------------------------+\n | "\'x\'" | Hex format. Outputs the number in base 16, using lower- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | "\'X\'" | Hex format. Outputs the number in base 16, using upper- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | "\'n\'" | Number. This is the same as "\'d\'", except that it uses the |\n | | current locale setting to insert the appropriate number |\n | | separator characters. |\n +-----------+------------------------------------------------------------+\n | None | The same as "\'d\'". |\n +-----------+------------------------------------------------------------+\n\nIn addition to the above presentation types, integers can be formatted\nwith the floating point presentation types listed below (except "\'n\'"\nand None). When doing so, "float()" is used to convert the integer to\na floating point number before formatting.\n\nThe available presentation types for floating point and decimal values\nare:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | "\'e\'" | Exponent notation. Prints the number in scientific |\n | | notation using the letter \'e\' to indicate the exponent. |\n | | The default precision is "6". |\n +-----------+------------------------------------------------------------+\n | "\'E\'" | Exponent notation. Same as "\'e\'" except it uses an upper |\n | | case \'E\' as the separator character. |\n +-----------+------------------------------------------------------------+\n | "\'f\'" | Fixed point. Displays the number as a fixed-point number. |\n | | The default precision is "6". |\n +-----------+------------------------------------------------------------+\n | "\'F\'" | Fixed point. Same as "\'f\'", but converts "nan" to "NAN" |\n | | and "inf" to "INF". |\n +-----------+------------------------------------------------------------+\n | "\'g\'" | General format. For a given precision "p >= 1", this |\n | | rounds the number to "p" significant digits and then |\n | | formats the result in either fixed-point format or in |\n | | scientific notation, depending on its magnitude. The |\n | | precise rules are as follows: suppose that the result |\n | | formatted with presentation type "\'e\'" and precision "p-1" |\n | | would have exponent "exp". Then if "-4 <= exp < p", the |\n | | number is formatted with presentation type "\'f\'" and |\n | | precision "p-1-exp". Otherwise, the number is formatted |\n | | with presentation type "\'e\'" and precision "p-1". In both |\n | | cases insignificant trailing zeros are removed from the |\n | | significand, and the decimal point is also removed if |\n | | there are no remaining digits following it. Positive and |\n | | negative infinity, positive and negative zero, and nans, |\n | | are formatted as "inf", "-inf", "0", "-0" and "nan" |\n | | respectively, regardless of the precision. A precision of |\n | | "0" is treated as equivalent to a precision of "1". The |\n | | default precision is "6". |\n +-----------+------------------------------------------------------------+\n | "\'G\'" | General format. Same as "\'g\'" except switches to "\'E\'" if |\n | | the number gets too large. The representations of infinity |\n | | and NaN are uppercased, too. |\n +-----------+------------------------------------------------------------+\n | "\'n\'" | Number. This is the same as "\'g\'", except that it uses the |\n | | current locale setting to insert the appropriate number |\n | | separator characters. |\n +-----------+------------------------------------------------------------+\n | "\'%\'" | Percentage. Multiplies the number by 100 and displays in |\n | | fixed ("\'f\'") format, followed by a percent sign. |\n +-----------+------------------------------------------------------------+\n | None | Similar to "\'g\'", except that fixed-point notation, when |\n | | used, has at least one digit past the decimal point. The |\n | | default precision is as high as needed to represent the |\n | | particular value. The overall effect is to match the |\n | | output of "str()" as altered by the other format |\n | | modifiers. |\n +-----------+------------------------------------------------------------+\n\n\nFormat examples\n===============\n\nThis section contains examples of the "str.format()" syntax and\ncomparison with the old "%"-formatting.\n\nIn most of the cases the syntax is similar to the old "%"-formatting,\nwith the addition of the "{}" and with ":" used instead of "%". For\nexample, "\'%03.2f\'" can be translated to "\'{:03.2f}\'".\n\nThe new format syntax also supports new and different options, shown\nin the follow examples.\n\nAccessing arguments by position:\n\n >>> \'{0}, {1}, {2}\'.format(\'a\', \'b\', \'c\')\n \'a, b, c\'\n >>> \'{}, {}, {}\'.format(\'a\', \'b\', \'c\') # 3.1+ only\n \'a, b, c\'\n >>> \'{2}, {1}, {0}\'.format(\'a\', \'b\', \'c\')\n \'c, b, a\'\n >>> \'{2}, {1}, {0}\'.format(*\'abc\') # unpacking argument sequence\n \'c, b, a\'\n >>> \'{0}{1}{0}\'.format(\'abra\', \'cad\') # arguments\' indices can be repeated\n \'abracadabra\'\n\nAccessing arguments by name:\n\n >>> \'Coordinates: {latitude}, {longitude}\'.format(latitude=\'37.24N\', longitude=\'-115.81W\')\n \'Coordinates: 37.24N, -115.81W\'\n >>> coord = {\'latitude\': \'37.24N\', \'longitude\': \'-115.81W\'}\n >>> \'Coordinates: {latitude}, {longitude}\'.format(**coord)\n \'Coordinates: 37.24N, -115.81W\'\n\nAccessing arguments\' attributes:\n\n >>> c = 3-5j\n >>> (\'The complex number {0} is formed from the real part {0.real} \'\n ... \'and the imaginary part {0.imag}.\').format(c)\n \'The complex number (3-5j) is formed from the real part 3.0 and the imaginary part -5.0.\'\n >>> class Point:\n ... def __init__(self, x, y):\n ... self.x, self.y = x, y\n ... def __str__(self):\n ... return \'Point({self.x}, {self.y})\'.format(self=self)\n ...\n >>> str(Point(4, 2))\n \'Point(4, 2)\'\n\nAccessing arguments\' items:\n\n >>> coord = (3, 5)\n >>> \'X: {0[0]}; Y: {0[1]}\'.format(coord)\n \'X: 3; Y: 5\'\n\nReplacing "%s" and "%r":\n\n >>> "repr() shows quotes: {!r}; str() doesn\'t: {!s}".format(\'test1\', \'test2\')\n "repr() shows quotes: \'test1\'; str() doesn\'t: test2"\n\nAligning the text and specifying a width:\n\n >>> \'{:<30}\'.format(\'left aligned\')\n \'left aligned \'\n >>> \'{:>30}\'.format(\'right aligned\')\n \' right aligned\'\n >>> \'{:^30}\'.format(\'centered\')\n \' centered \'\n >>> \'{:*^30}\'.format(\'centered\') # use \'*\' as a fill char\n \'***********centered***********\'\n\nReplacing "%+f", "%-f", and "% f" and specifying a sign:\n\n >>> \'{:+f}; {:+f}\'.format(3.14, -3.14) # show it always\n \'+3.140000; -3.140000\'\n >>> \'{: f}; {: f}\'.format(3.14, -3.14) # show a space for positive numbers\n \' 3.140000; -3.140000\'\n >>> \'{:-f}; {:-f}\'.format(3.14, -3.14) # show only the minus -- same as \'{:f}; {:f}\'\n \'3.140000; -3.140000\'\n\nReplacing "%x" and "%o" and converting the value to different bases:\n\n >>> # format also supports binary numbers\n >>> "int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}".format(42)\n \'int: 42; hex: 2a; oct: 52; bin: 101010\'\n >>> # with 0x, 0o, or 0b as prefix:\n >>> "int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: {0:#b}".format(42)\n \'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010\'\n\nUsing the comma as a thousands separator:\n\n >>> \'{:,}\'.format(1234567890)\n \'1,234,567,890\'\n\nExpressing a percentage:\n\n >>> points = 19\n >>> total = 22\n >>> \'Correct answers: {:.2%}\'.format(points/total)\n \'Correct answers: 86.36%\'\n\nUsing type-specific formatting:\n\n >>> import datetime\n >>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n >>> \'{:%Y-%m-%d %H:%M:%S}\'.format(d)\n \'2010-07-04 12:15:58\'\n\nNesting arguments and more complex examples:\n\n >>> for align, text in zip(\'<^>\', [\'left\', \'center\', \'right\']):\n ... \'{0:{fill}{align}16}\'.format(text, fill=align, align=align)\n ...\n \'left<<<<<<<<<<<<\'\n \'^^^^^center^^^^^\'\n \'>>>>>>>>>>>right\'\n >>>\n >>> octets = [192, 168, 0, 1]\n >>> \'{:02X}{:02X}{:02X}{:02X}\'.format(*octets)\n \'C0A80001\'\n >>> int(_, 16)\n 3232235521\n >>>\n >>> width = 5\n >>> for num in range(5,12): #doctest: +NORMALIZE_WHITESPACE\n ... for base in \'dXob\':\n ... print(\'{0:{width}{base}}\'.format(num, base=base, width=width), end=\' \')\n ... print()\n ...\n 5 5 5 101\n 6 6 6 110\n 7 7 7 111\n 8 8 10 1000\n 9 9 11 1001\n 10 A 12 1010\n 11 B 13 1011\n', + 'function': u'\nFunction definitions\n********************\n\nA function definition defines a user-defined function object (see\nsection *The standard type hierarchy*):\n\n funcdef ::= [decorators] "def" funcname "(" [parameter_list] ")" ["->" expression] ":" suite\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n | "*" [parameter] ("," defparameter)* ["," "**" parameter]\n | "**" parameter\n | defparameter [","] )\n parameter ::= identifier [":" expression]\n defparameter ::= parameter ["=" expression]\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more *parameters* have the form *parameter* "="\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding *argument* may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters up until the ""*"" must also have a default value --- this\nis a syntactic restriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated from left to right when the\nfunction definition is executed.** This means that the expression is\nevaluated once, when the function is defined, and that the same "pre-\ncomputed" value is used for each call. This is especially important\nto understand when a default parameter is a mutable object, such as a\nlist or a dictionary: if the function modifies the object (e.g. by\nappending an item to a list), the default value is in effect modified.\nThis is generally not what was intended. A way around this is to use\n"None" as the default, and explicitly test for it in the body of the\nfunction, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section\n*Calls*. A function call always assigns values to all parameters\nmentioned in the parameter list, either from position arguments, from\nkeyword arguments, or from default values. If the form\n""*identifier"" is present, it is initialized to a tuple receiving any\nexcess positional parameters, defaulting to the empty tuple. If the\nform ""**identifier"" is present, it is initialized to a new\ndictionary receiving any excess keyword arguments, defaulting to a new\nempty dictionary. Parameters after ""*"" or ""*identifier"" are\nkeyword-only parameters and may only be passed used keyword arguments.\n\nParameters may have annotations of the form "": expression"" following\nthe parameter name. Any parameter may have an annotation even those\nof the form "*identifier" or "**identifier". Functions may have\n"return" annotation of the form ""-> expression"" after the parameter\nlist. These annotations can be any valid Python expression and are\nevaluated when the function definition is executed. Annotations may\nbe evaluated in a different order than they appear in the source code.\nThe presence of annotations does not change the semantics of a\nfunction. The annotation values are available as values of a\ndictionary keyed by the parameters\' names in the "__annotations__"\nattribute of the function object.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda\nexpressions, described in section *Lambdas*. Note that the lambda\nexpression is merely a shorthand for a simplified function definition;\na function defined in a ""def"" statement can be passed around or\nassigned to another name just like a function defined by a lambda\nexpression. The ""def"" form is actually more powerful since it\nallows the execution of multiple statements and annotations.\n\n**Programmer\'s note:** Functions are first-class objects. A ""def""\nstatement executed inside a function definition defines a local\nfunction that can be returned or passed around. Free variables used\nin the nested function can access the local variables of the function\ncontaining the def. See section *Naming and binding* for details.\n\nSee also: **PEP 3107** - Function Annotations\n\n The original specification for function annotations.\n', 'global': u'\nThe "global" statement\n**********************\n\n global_stmt ::= "global" identifier ("," identifier)*\n\nThe "global" statement is a declaration which holds for the entire\ncurrent code block. It means that the listed identifiers are to be\ninterpreted as globals. It would be impossible to assign to a global\nvariable without "global", although free variables may refer to\nglobals without being declared global.\n\nNames listed in a "global" statement must not be used in the same code\nblock textually preceding that "global" statement.\n\nNames listed in a "global" statement must not be defined as formal\nparameters or in a "for" loop control target, "class" definition,\nfunction definition, or "import" statement.\n\n**CPython implementation detail:** The current implementation does not\nenforce the two restrictions, but programs should not abuse this\nfreedom, as future implementations may enforce them or silently change\nthe meaning of the program.\n\n**Programmer\'s note:** the "global" is a directive to the parser. It\napplies only to code parsed at the same time as the "global"\nstatement. In particular, a "global" statement contained in a string\nor code object supplied to the built-in "exec()" function does not\naffect the code block *containing* the function call, and code\ncontained in such a string is unaffected by "global" statements in the\ncode containing the function call. The same applies to the "eval()"\nand "compile()" functions.\n', 'id-classes': u'\nReserved classes of identifiers\n*******************************\n\nCertain classes of identifiers (besides keywords) have special\nmeanings. These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n"_*"\n Not imported by "from module import *". The special identifier "_"\n is used in the interactive interpreter to store the result of the\n last evaluation; it is stored in the "builtins" module. When not\n in interactive mode, "_" has no special meaning and is not defined.\n See section *The import statement*.\n\n Note: The name "_" is often used in conjunction with\n internationalization; refer to the documentation for the\n "gettext" module for more information on this convention.\n\n"__*__"\n System-defined names. These names are defined by the interpreter\n and its implementation (including the standard library). Current\n system names are discussed in the *Special method names* section\n and elsewhere. More will likely be defined in future versions of\n Python. *Any* use of "__*__" names, in any context, that does not\n follow explicitly documented use, is subject to breakage without\n warning.\n\n"__*"\n Class-private names. Names in this category, when used within the\n context of a class definition, are re-written to use a mangled form\n to help avoid name clashes between "private" attributes of base and\n derived classes. See section *Identifiers (Names)*.\n', - 'identifiers': u'\nIdentifiers and keywords\n************************\n\nIdentifiers (also referred to as *names*) are described by the\nfollowing lexical definitions.\n\nThe syntax of identifiers in Python is based on the Unicode standard\nannex UAX-31, with elaboration and changes as defined below; see also\n**PEP 3131** for further details.\n\nWithin the ASCII range (U+0001..U+007F), the valid characters for\nidentifiers are the same as in Python 2.x: the uppercase and lowercase\nletters "A" through "Z", the underscore "_" and, except for the first\ncharacter, the digits "0" through "9".\n\nPython 3.0 introduces additional characters from outside the ASCII\nrange (see **PEP 3131**). For these characters, the classification\nuses the version of the Unicode Character Database as included in the\n"unicodedata" module.\n\nIdentifiers are unlimited in length. Case is significant.\n\n identifier ::= xid_start xid_continue*\n id_start ::= \n id_continue ::= \n xid_start ::= \n xid_continue ::= \n\nThe Unicode category codes mentioned above stand for:\n\n* *Lu* - uppercase letters\n\n* *Ll* - lowercase letters\n\n* *Lt* - titlecase letters\n\n* *Lm* - modifier letters\n\n* *Lo* - other letters\n\n* *Nl* - letter numbers\n\n* *Mn* - nonspacing marks\n\n* *Mc* - spacing combining marks\n\n* *Nd* - decimal numbers\n\n* *Pc* - connector punctuations\n\n* *Other_ID_Start* - explicit list of characters in PropList.txt to\n support backwards compatibility\n\n* *Other_ID_Continue* - likewise\n\nAll identifiers are converted into the normal form NFKC while parsing;\ncomparison of identifiers is based on NFKC.\n\nA non-normative HTML file listing all valid identifier characters for\nUnicode 4.1 can be found at http://www.dcl.hpi.uni-\npotsdam.de/home/loewis/table-3131.html.\n\n\nKeywords\n========\n\nThe following identifiers are used as reserved words, or *keywords* of\nthe language, and cannot be used as ordinary identifiers. They must\nbe spelled exactly as written here:\n\n False class finally is return\n None continue for lambda try\n True def from nonlocal while\n and del global not with\n as elif if or yield\n assert else import pass\n break except in raise\n\n\nReserved classes of identifiers\n===============================\n\nCertain classes of identifiers (besides keywords) have special\nmeanings. These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n"_*"\n Not imported by "from module import *". The special identifier "_"\n is used in the interactive interpreter to store the result of the\n last evaluation; it is stored in the "builtins" module. When not\n in interactive mode, "_" has no special meaning and is not defined.\n See section *The import statement*.\n\n Note: The name "_" is often used in conjunction with\n internationalization; refer to the documentation for the\n "gettext" module for more information on this convention.\n\n"__*__"\n System-defined names. These names are defined by the interpreter\n and its implementation (including the standard library). Current\n system names are discussed in the *Special method names* section\n and elsewhere. More will likely be defined in future versions of\n Python. *Any* use of "__*__" names, in any context, that does not\n follow explicitly documented use, is subject to breakage without\n warning.\n\n"__*"\n Class-private names. Names in this category, when used within the\n context of a class definition, are re-written to use a mangled form\n to help avoid name clashes between "private" attributes of base and\n derived classes. See section *Identifiers (Names)*.\n', + 'identifiers': u'\nIdentifiers and keywords\n************************\n\nIdentifiers (also referred to as *names*) are described by the\nfollowing lexical definitions.\n\nThe syntax of identifiers in Python is based on the Unicode standard\nannex UAX-31, with elaboration and changes as defined below; see also\n**PEP 3131** for further details.\n\nWithin the ASCII range (U+0001..U+007F), the valid characters for\nidentifiers are the same as in Python 2.x: the uppercase and lowercase\nletters "A" through "Z", the underscore "_" and, except for the first\ncharacter, the digits "0" through "9".\n\nPython 3.0 introduces additional characters from outside the ASCII\nrange (see **PEP 3131**). For these characters, the classification\nuses the version of the Unicode Character Database as included in the\n"unicodedata" module.\n\nIdentifiers are unlimited in length. Case is significant.\n\n identifier ::= xid_start xid_continue*\n id_start ::= \n id_continue ::= \n xid_start ::= \n xid_continue ::= \n\nThe Unicode category codes mentioned above stand for:\n\n* *Lu* - uppercase letters\n\n* *Ll* - lowercase letters\n\n* *Lt* - titlecase letters\n\n* *Lm* - modifier letters\n\n* *Lo* - other letters\n\n* *Nl* - letter numbers\n\n* *Mn* - nonspacing marks\n\n* *Mc* - spacing combining marks\n\n* *Nd* - decimal numbers\n\n* *Pc* - connector punctuations\n\n* *Other_ID_Start* - explicit list of characters in PropList.txt to\n support backwards compatibility\n\n* *Other_ID_Continue* - likewise\n\nAll identifiers are converted into the normal form NFKC while parsing;\ncomparison of identifiers is based on NFKC.\n\nA non-normative HTML file listing all valid identifier characters for\nUnicode 4.1 can be found at https://www.dcl.hpi.uni-\npotsdam.de/home/loewis/table-3131.html.\n\n\nKeywords\n========\n\nThe following identifiers are used as reserved words, or *keywords* of\nthe language, and cannot be used as ordinary identifiers. They must\nbe spelled exactly as written here:\n\n False class finally is return\n None continue for lambda try\n True def from nonlocal while\n and del global not with\n as elif if or yield\n assert else import pass\n break except in raise\n\n\nReserved classes of identifiers\n===============================\n\nCertain classes of identifiers (besides keywords) have special\nmeanings. These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n"_*"\n Not imported by "from module import *". The special identifier "_"\n is used in the interactive interpreter to store the result of the\n last evaluation; it is stored in the "builtins" module. When not\n in interactive mode, "_" has no special meaning and is not defined.\n See section *The import statement*.\n\n Note: The name "_" is often used in conjunction with\n internationalization; refer to the documentation for the\n "gettext" module for more information on this convention.\n\n"__*__"\n System-defined names. These names are defined by the interpreter\n and its implementation (including the standard library). Current\n system names are discussed in the *Special method names* section\n and elsewhere. More will likely be defined in future versions of\n Python. *Any* use of "__*__" names, in any context, that does not\n follow explicitly documented use, is subject to breakage without\n warning.\n\n"__*"\n Class-private names. Names in this category, when used within the\n context of a class definition, are re-written to use a mangled form\n to help avoid name clashes between "private" attributes of base and\n derived classes. See section *Identifiers (Names)*.\n', 'if': u'\nThe "if" statement\n******************\n\nThe "if" statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n', 'imaginary': u'\nImaginary literals\n******************\n\nImaginary literals are described by the following lexical definitions:\n\n imagnumber ::= (floatnumber | intpart) ("j" | "J")\n\nAn imaginary literal yields a complex number with a real part of 0.0.\nComplex numbers are represented as a pair of floating point numbers\nand have the same restrictions on their range. To create a complex\nnumber with a nonzero real part, add a floating point number to it,\ne.g., "(3+4j)". Some examples of imaginary literals:\n\n 3.14j 10.j 10j .001j 1e100j 3.14e-10j\n', - 'import': u'\nThe "import" statement\n**********************\n\n import_stmt ::= "import" module ["as" name] ( "," module ["as" name] )*\n | "from" relative_module "import" identifier ["as" name]\n ( "," identifier ["as" name] )*\n | "from" relative_module "import" "(" identifier ["as" name]\n ( "," identifier ["as" name] )* [","] ")"\n | "from" module "import" "*"\n module ::= (identifier ".")* identifier\n relative_module ::= "."* module | "."+\n name ::= identifier\n\nThe basic import statement (no "from" clause) is executed in two\nsteps:\n\n1. find a module, loading and initializing it if necessary\n\n2. define a name or names in the local namespace for the scope\n where the "import" statement occurs.\n\nWhen the statement contains multiple clauses (separated by commas) the\ntwo steps are carried out separately for each clause, just as though\nthe clauses had been separated out into individiual import statements.\n\nThe details of the first step, finding and loading modules are\ndescribed in greater detail in the section on the *import system*,\nwhich also describes the various types of packages and modules that\ncan be imported, as well as all the hooks that can be used to\ncustomize the import system. Note that failures in this step may\nindicate either that the module could not be located, *or* that an\nerror occurred while initializing the module, which includes execution\nof the module\'s code.\n\nIf the requested module is retrieved successfully, it will be made\navailable in the local namespace in one of three ways:\n\n* If the module name is followed by "as", then the name following\n "as" is bound directly to the imported module.\n\n* If no other name is specified, and the module being imported is a\n top level module, the module\'s name is bound in the local namespace\n as a reference to the imported module\n\n* If the module being imported is *not* a top level module, then the\n name of the top level package that contains the module is bound in\n the local namespace as a reference to the top level package. The\n imported module must be accessed using its full qualified name\n rather than directly\n\nThe "from" form uses a slightly more complex process:\n\n1. find the module specified in the "from" clause, loading and\n initializing it if necessary;\n\n2. for each of the identifiers specified in the "import" clauses:\n\n 1. check if the imported module has an attribute by that name\n\n 2. if not, attempt to import a submodule with that name and then\n check the imported module again for that attribute\n\n 3. if the attribute is not found, "ImportError" is raised.\n\n 4. otherwise, a reference to that value is stored in the local\n namespace, using the name in the "as" clause if it is present,\n otherwise using the attribute name\n\nExamples:\n\n import foo # foo imported and bound locally\n import foo.bar.baz # foo.bar.baz imported, foo bound locally\n import foo.bar.baz as fbb # foo.bar.baz imported and bound as fbb\n from foo.bar import baz # foo.bar.baz imported and bound as baz\n from foo import attr # foo imported and foo.attr bound as attr\n\nIf the list of identifiers is replaced by a star ("\'*\'"), all public\nnames defined in the module are bound in the local namespace for the\nscope where the "import" statement occurs.\n\nThe *public names* defined by a module are determined by checking the\nmodule\'s namespace for a variable named "__all__"; if defined, it must\nbe a sequence of strings which are names defined or imported by that\nmodule. The names given in "__all__" are all considered public and\nare required to exist. If "__all__" is not defined, the set of public\nnames includes all names found in the module\'s namespace which do not\nbegin with an underscore character ("\'_\'"). "__all__" should contain\nthe entire public API. It is intended to avoid accidentally exporting\nitems that are not part of the API (such as library modules which were\nimported and used within the module).\n\nThe wild card form of import --- "from module import *" --- is only\nallowed at the module level. Attempting to use it in class or\nfunction definitions will raise a "SyntaxError".\n\nWhen specifying what module to import you do not have to specify the\nabsolute name of the module. When a module or package is contained\nwithin another package it is possible to make a relative import within\nthe same top package without having to mention the package name. By\nusing leading dots in the specified module or package after "from" you\ncan specify how high to traverse up the current package hierarchy\nwithout specifying exact names. One leading dot means the current\npackage where the module making the import exists. Two dots means up\none package level. Three dots is up two levels, etc. So if you execute\n"from . import mod" from a module in the "pkg" package then you will\nend up importing "pkg.mod". If you execute "from ..subpkg2 import mod"\nfrom within "pkg.subpkg1" you will import "pkg.subpkg2.mod". The\nspecification for relative imports is contained within **PEP 328**.\n\n"importlib.import_module()" is provided to support applications that\ndetermine dynamically the modules to be loaded.\n\n\nFuture statements\n=================\n\nA *future statement* is a directive to the compiler that a particular\nmodule should be compiled using syntax or semantics that will be\navailable in a specified future release of Python where the feature\nbecomes standard.\n\nThe future statement is intended to ease migration to future versions\nof Python that introduce incompatible changes to the language. It\nallows use of the new features on a per-module basis before the\nrelease in which the feature becomes standard.\n\n future_statement ::= "from" "__future__" "import" feature ["as" name]\n ("," feature ["as" name])*\n | "from" "__future__" "import" "(" feature ["as" name]\n ("," feature ["as" name])* [","] ")"\n feature ::= identifier\n name ::= identifier\n\nA future statement must appear near the top of the module. The only\nlines that can appear before a future statement are:\n\n* the module docstring (if any),\n\n* comments,\n\n* blank lines, and\n\n* other future statements.\n\nThe features recognized by Python 3.0 are "absolute_import",\n"division", "generators", "unicode_literals", "print_function",\n"nested_scopes" and "with_statement". They are all redundant because\nthey are always enabled, and only kept for backwards compatibility.\n\nA future statement is recognized and treated specially at compile\ntime: Changes to the semantics of core constructs are often\nimplemented by generating different code. It may even be the case\nthat a new feature introduces new incompatible syntax (such as a new\nreserved word), in which case the compiler may need to parse the\nmodule differently. Such decisions cannot be pushed off until\nruntime.\n\nFor any given release, the compiler knows which feature names have\nbeen defined, and raises a compile-time error if a future statement\ncontains a feature not known to it.\n\nThe direct runtime semantics are the same as for any import statement:\nthere is a standard module "__future__", described later, and it will\nbe imported in the usual way at the time the future statement is\nexecuted.\n\nThe interesting runtime semantics depend on the specific feature\nenabled by the future statement.\n\nNote that there is nothing special about the statement:\n\n import __future__ [as name]\n\nThat is not a future statement; it\'s an ordinary import statement with\nno special semantics or syntax restrictions.\n\nCode compiled by calls to the built-in functions "exec()" and\n"compile()" that occur in a module "M" containing a future statement\nwill, by default, use the new syntax or semantics associated with the\nfuture statement. This can be controlled by optional arguments to\n"compile()" --- see the documentation of that function for details.\n\nA future statement typed at an interactive interpreter prompt will\ntake effect for the rest of the interpreter session. If an\ninterpreter is started with the *-i* option, is passed a script name\nto execute, and the script includes a future statement, it will be in\neffect in the interactive session started after the script is\nexecuted.\n\nSee also: **PEP 236** - Back to the __future__\n\n The original proposal for the __future__ mechanism.\n', + 'import': u'\nThe "import" statement\n**********************\n\n import_stmt ::= "import" module ["as" name] ( "," module ["as" name] )*\n | "from" relative_module "import" identifier ["as" name]\n ( "," identifier ["as" name] )*\n | "from" relative_module "import" "(" identifier ["as" name]\n ( "," identifier ["as" name] )* [","] ")"\n | "from" module "import" "*"\n module ::= (identifier ".")* identifier\n relative_module ::= "."* module | "."+\n name ::= identifier\n\nThe basic import statement (no "from" clause) is executed in two\nsteps:\n\n1. find a module, loading and initializing it if necessary\n\n2. define a name or names in the local namespace for the scope\n where the "import" statement occurs.\n\nWhen the statement contains multiple clauses (separated by commas) the\ntwo steps are carried out separately for each clause, just as though\nthe clauses had been separated out into individual import statements.\n\nThe details of the first step, finding and loading modules are\ndescribed in greater detail in the section on the *import system*,\nwhich also describes the various types of packages and modules that\ncan be imported, as well as all the hooks that can be used to\ncustomize the import system. Note that failures in this step may\nindicate either that the module could not be located, *or* that an\nerror occurred while initializing the module, which includes execution\nof the module\'s code.\n\nIf the requested module is retrieved successfully, it will be made\navailable in the local namespace in one of three ways:\n\n* If the module name is followed by "as", then the name following\n "as" is bound directly to the imported module.\n\n* If no other name is specified, and the module being imported is a\n top level module, the module\'s name is bound in the local namespace\n as a reference to the imported module\n\n* If the module being imported is *not* a top level module, then the\n name of the top level package that contains the module is bound in\n the local namespace as a reference to the top level package. The\n imported module must be accessed using its full qualified name\n rather than directly\n\nThe "from" form uses a slightly more complex process:\n\n1. find the module specified in the "from" clause, loading and\n initializing it if necessary;\n\n2. for each of the identifiers specified in the "import" clauses:\n\n 1. check if the imported module has an attribute by that name\n\n 2. if not, attempt to import a submodule with that name and then\n check the imported module again for that attribute\n\n 3. if the attribute is not found, "ImportError" is raised.\n\n 4. otherwise, a reference to that value is stored in the local\n namespace, using the name in the "as" clause if it is present,\n otherwise using the attribute name\n\nExamples:\n\n import foo # foo imported and bound locally\n import foo.bar.baz # foo.bar.baz imported, foo bound locally\n import foo.bar.baz as fbb # foo.bar.baz imported and bound as fbb\n from foo.bar import baz # foo.bar.baz imported and bound as baz\n from foo import attr # foo imported and foo.attr bound as attr\n\nIf the list of identifiers is replaced by a star ("\'*\'"), all public\nnames defined in the module are bound in the local namespace for the\nscope where the "import" statement occurs.\n\nThe *public names* defined by a module are determined by checking the\nmodule\'s namespace for a variable named "__all__"; if defined, it must\nbe a sequence of strings which are names defined or imported by that\nmodule. The names given in "__all__" are all considered public and\nare required to exist. If "__all__" is not defined, the set of public\nnames includes all names found in the module\'s namespace which do not\nbegin with an underscore character ("\'_\'"). "__all__" should contain\nthe entire public API. It is intended to avoid accidentally exporting\nitems that are not part of the API (such as library modules which were\nimported and used within the module).\n\nThe wild card form of import --- "from module import *" --- is only\nallowed at the module level. Attempting to use it in class or\nfunction definitions will raise a "SyntaxError".\n\nWhen specifying what module to import you do not have to specify the\nabsolute name of the module. When a module or package is contained\nwithin another package it is possible to make a relative import within\nthe same top package without having to mention the package name. By\nusing leading dots in the specified module or package after "from" you\ncan specify how high to traverse up the current package hierarchy\nwithout specifying exact names. One leading dot means the current\npackage where the module making the import exists. Two dots means up\none package level. Three dots is up two levels, etc. So if you execute\n"from . import mod" from a module in the "pkg" package then you will\nend up importing "pkg.mod". If you execute "from ..subpkg2 import mod"\nfrom within "pkg.subpkg1" you will import "pkg.subpkg2.mod". The\nspecification for relative imports is contained within **PEP 328**.\n\n"importlib.import_module()" is provided to support applications that\ndetermine dynamically the modules to be loaded.\n\n\nFuture statements\n=================\n\nA *future statement* is a directive to the compiler that a particular\nmodule should be compiled using syntax or semantics that will be\navailable in a specified future release of Python where the feature\nbecomes standard.\n\nThe future statement is intended to ease migration to future versions\nof Python that introduce incompatible changes to the language. It\nallows use of the new features on a per-module basis before the\nrelease in which the feature becomes standard.\n\n future_statement ::= "from" "__future__" "import" feature ["as" name]\n ("," feature ["as" name])*\n | "from" "__future__" "import" "(" feature ["as" name]\n ("," feature ["as" name])* [","] ")"\n feature ::= identifier\n name ::= identifier\n\nA future statement must appear near the top of the module. The only\nlines that can appear before a future statement are:\n\n* the module docstring (if any),\n\n* comments,\n\n* blank lines, and\n\n* other future statements.\n\nThe features recognized by Python 3.0 are "absolute_import",\n"division", "generators", "unicode_literals", "print_function",\n"nested_scopes" and "with_statement". They are all redundant because\nthey are always enabled, and only kept for backwards compatibility.\n\nA future statement is recognized and treated specially at compile\ntime: Changes to the semantics of core constructs are often\nimplemented by generating different code. It may even be the case\nthat a new feature introduces new incompatible syntax (such as a new\nreserved word), in which case the compiler may need to parse the\nmodule differently. Such decisions cannot be pushed off until\nruntime.\n\nFor any given release, the compiler knows which feature names have\nbeen defined, and raises a compile-time error if a future statement\ncontains a feature not known to it.\n\nThe direct runtime semantics are the same as for any import statement:\nthere is a standard module "__future__", described later, and it will\nbe imported in the usual way at the time the future statement is\nexecuted.\n\nThe interesting runtime semantics depend on the specific feature\nenabled by the future statement.\n\nNote that there is nothing special about the statement:\n\n import __future__ [as name]\n\nThat is not a future statement; it\'s an ordinary import statement with\nno special semantics or syntax restrictions.\n\nCode compiled by calls to the built-in functions "exec()" and\n"compile()" that occur in a module "M" containing a future statement\nwill, by default, use the new syntax or semantics associated with the\nfuture statement. This can be controlled by optional arguments to\n"compile()" --- see the documentation of that function for details.\n\nA future statement typed at an interactive interpreter prompt will\ntake effect for the rest of the interpreter session. If an\ninterpreter is started with the *-i* option, is passed a script name\nto execute, and the script includes a future statement, it will be in\neffect in the interactive session started after the script is\nexecuted.\n\nSee also: **PEP 236** - Back to the __future__\n\n The original proposal for the __future__ mechanism.\n', 'in': u'\nMembership test operations\n**************************\n\nThe operators "in" and "not in" test for membership. "x in s"\nevaluates to true if *x* is a member of *s*, and false otherwise. "x\nnot in s" returns the negation of "x in s". All built-in sequences\nand set types support this as well as dictionary, for which "in" tests\nwhether the dictionary has a given key. For container types such as\nlist, tuple, set, frozenset, dict, or collections.deque, the\nexpression "x in y" is equivalent to "any(x is e or x == e for e in\ny)".\n\nFor the string and bytes types, "x in y" is true if and only if *x* is\na substring of *y*. An equivalent test is "y.find(x) != -1". Empty\nstrings are always considered to be a substring of any other string,\nso """ in "abc"" will return "True".\n\nFor user-defined classes which define the "__contains__()" method, "x\nin y" is true if and only if "y.__contains__(x)" is true.\n\nFor user-defined classes which do not define "__contains__()" but do\ndefine "__iter__()", "x in y" is true if some value "z" with "x == z"\nis produced while iterating over "y". If an exception is raised\nduring the iteration, it is as if "in" raised that exception.\n\nLastly, the old-style iteration protocol is tried: if a class defines\n"__getitem__()", "x in y" is true if and only if there is a non-\nnegative integer index *i* such that "x == y[i]", and all lower\ninteger indices do not raise "IndexError" exception. (If any other\nexception is raised, it is as if "in" raised that exception).\n\nThe operator "not in" is defined to have the inverse true value of\n"in".\n', 'integers': u'\nInteger literals\n****************\n\nInteger literals are described by the following lexical definitions:\n\n integer ::= decimalinteger | octinteger | hexinteger | bininteger\n decimalinteger ::= nonzerodigit digit* | "0"+\n nonzerodigit ::= "1"..."9"\n digit ::= "0"..."9"\n octinteger ::= "0" ("o" | "O") octdigit+\n hexinteger ::= "0" ("x" | "X") hexdigit+\n bininteger ::= "0" ("b" | "B") bindigit+\n octdigit ::= "0"..."7"\n hexdigit ::= digit | "a"..."f" | "A"..."F"\n bindigit ::= "0" | "1"\n\nThere is no limit for the length of integer literals apart from what\ncan be stored in available memory.\n\nNote that leading zeros in a non-zero decimal number are not allowed.\nThis is for disambiguation with C-style octal literals, which Python\nused before version 3.0.\n\nSome examples of integer literals:\n\n 7 2147483647 0o177 0b100110111\n 3 79228162514264337593543950336 0o377 0xdeadbeef\n', 'lambda': u'\nLambdas\n*******\n\n lambda_expr ::= "lambda" [parameter_list]: expression\n lambda_expr_nocond ::= "lambda" [parameter_list]: expression_nocond\n\nLambda expressions (sometimes called lambda forms) are used to create\nanonymous functions. The expression "lambda arguments: expression"\nyields a function object. The unnamed object behaves like a function\nobject defined with\n\n def (arguments):\n return expression\n\nSee section *Function definitions* for the syntax of parameter lists.\nNote that functions created with lambda expressions cannot contain\nstatements or annotations.\n', - 'lists': u'\nList displays\n*************\n\nA list display is a possibly empty series of expressions enclosed in\nsquare brackets:\n\n list_display ::= "[" [expression_list | comprehension] "]"\n\nA list display yields a new list object, the contents being specified\nby either a list of expressions or a comprehension. When a comma-\nseparated list of expressions is supplied, its elements are evaluated\nfrom left to right and placed into the list object in that order.\nWhen a comprehension is supplied, the list is constructed from the\nelements resulting from the comprehension.\n', + 'lists': u'\nList displays\n*************\n\nA list display is a possibly empty series of expressions enclosed in\nsquare brackets:\n\n list_display ::= "[" [starred_list | comprehension] "]"\n\nA list display yields a new list object, the contents being specified\nby either a list of expressions or a comprehension. When a comma-\nseparated list of expressions is supplied, its elements are evaluated\nfrom left to right and placed into the list object in that order.\nWhen a comprehension is supplied, the list is constructed from the\nelements resulting from the comprehension.\n', 'naming': u'\nNaming and binding\n******************\n\n\nBinding of names\n================\n\n*Names* refer to objects. Names are introduced by name binding\noperations.\n\nThe following constructs bind names: formal parameters to functions,\n"import" statements, class and function definitions (these bind the\nclass or function name in the defining block), and targets that are\nidentifiers if occurring in an assignment, "for" loop header, or after\n"as" in a "with" statement or "except" clause. The "import" statement\nof the form "from ... import *" binds all names defined in the\nimported module, except those beginning with an underscore. This form\nmay only be used at the module level.\n\nA target occurring in a "del" statement is also considered bound for\nthis purpose (though the actual semantics are to unbind the name).\n\nEach assignment or import statement occurs within a block defined by a\nclass or function definition or at the module level (the top-level\ncode block).\n\nIf a name is bound in a block, it is a local variable of that block,\nunless declared as "nonlocal" or "global". If a name is bound at the\nmodule level, it is a global variable. (The variables of the module\ncode block are local and global.) If a variable is used in a code\nblock but not defined there, it is a *free variable*.\n\nEach occurrence of a name in the program text refers to the *binding*\nof that name established by the following name resolution rules.\n\n\nResolution of names\n===================\n\nA *scope* defines the visibility of a name within a block. If a local\nvariable is defined in a block, its scope includes that block. If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces\na different binding for the name.\n\nWhen a name is used in a code block, it is resolved using the nearest\nenclosing scope. The set of all such scopes visible to a code block\nis called the block\'s *environment*.\n\nWhen a name is not found at all, a "NameError" exception is raised. If\nthe current scope is a function scope, and the name refers to a local\nvariable that has not yet been bound to a value at the point where the\nname is used, an "UnboundLocalError" exception is raised.\n"UnboundLocalError" is a subclass of "NameError".\n\nIf a name binding operation occurs anywhere within a code block, all\nuses of the name within the block are treated as references to the\ncurrent block. This can lead to errors when a name is used within a\nblock before it is bound. This rule is subtle. Python lacks\ndeclarations and allows name binding operations to occur anywhere\nwithin a code block. The local variables of a code block can be\ndetermined by scanning the entire text of the block for name binding\noperations.\n\nIf the "global" statement occurs within a block, all uses of the name\nspecified in the statement refer to the binding of that name in the\ntop-level namespace. Names are resolved in the top-level namespace by\nsearching the global namespace, i.e. the namespace of the module\ncontaining the code block, and the builtins namespace, the namespace\nof the module "builtins". The global namespace is searched first. If\nthe name is not found there, the builtins namespace is searched. The\n"global" statement must precede all uses of the name.\n\nThe "global" statement has the same scope as a name binding operation\nin the same block. If the nearest enclosing scope for a free variable\ncontains a global statement, the free variable is treated as a global.\n\nThe "nonlocal" statement causes corresponding names to refer to\npreviously bound variables in the nearest enclosing function scope.\n"SyntaxError" is raised at compile time if the given name does not\nexist in any enclosing function scope.\n\nThe namespace for a module is automatically created the first time a\nmodule is imported. The main module for a script is always called\n"__main__".\n\nClass definition blocks and arguments to "exec()" and "eval()" are\nspecial in the context of name resolution. A class definition is an\nexecutable statement that may use and define names. These references\nfollow the normal rules for name resolution with an exception that\nunbound local variables are looked up in the global namespace. The\nnamespace of the class definition becomes the attribute dictionary of\nthe class. The scope of names defined in a class block is limited to\nthe class block; it does not extend to the code blocks of methods --\nthis includes comprehensions and generator expressions since they are\nimplemented using a function scope. This means that the following\nwill fail:\n\n class A:\n a = 42\n b = list(a + i for i in range(10))\n\n\nBuiltins and restricted execution\n=================================\n\nThe builtins namespace associated with the execution of a code block\nis actually found by looking up the name "__builtins__" in its global\nnamespace; this should be a dictionary or a module (in the latter case\nthe module\'s dictionary is used). By default, when in the "__main__"\nmodule, "__builtins__" is the built-in module "builtins"; when in any\nother module, "__builtins__" is an alias for the dictionary of the\n"builtins" module itself. "__builtins__" can be set to a user-created\ndictionary to create a weak form of restricted execution.\n\n**CPython implementation detail:** Users should not touch\n"__builtins__"; it is strictly an implementation detail. Users\nwanting to override values in the builtins namespace should "import"\nthe "builtins" module and modify its attributes appropriately.\n\n\nInteraction with dynamic features\n=================================\n\nName resolution of free variables occurs at runtime, not at compile\ntime. This means that the following code will print 42:\n\n i = 10\n def f():\n print(i)\n i = 42\n f()\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nThe "eval()" and "exec()" functions do not have access to the full\nenvironment for resolving names. Names may be resolved in the local\nand global namespaces of the caller. Free variables are not resolved\nin the nearest enclosing namespace, but in the global namespace. [1]\nThe "exec()" and "eval()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n', 'nonlocal': u'\nThe "nonlocal" statement\n************************\n\n nonlocal_stmt ::= "nonlocal" identifier ("," identifier)*\n\nThe "nonlocal" statement causes the listed identifiers to refer to\npreviously bound variables in the nearest enclosing scope excluding\nglobals. This is important because the default behavior for binding is\nto search the local namespace first. The statement allows\nencapsulated code to rebind variables outside of the local scope\nbesides the global (module) scope.\n\nNames listed in a "nonlocal" statement, unlike those listed in a\n"global" statement, must refer to pre-existing bindings in an\nenclosing scope (the scope in which a new binding should be created\ncannot be determined unambiguously).\n\nNames listed in a "nonlocal" statement must not collide with pre-\nexisting bindings in the local scope.\n\nSee also: **PEP 3104** - Access to Names in Outer Scopes\n\n The specification for the "nonlocal" statement.\n', 'numbers': u'\nNumeric literals\n****************\n\nThere are three types of numeric literals: integers, floating point\nnumbers, and imaginary numbers. There are no complex literals\n(complex numbers can be formed by adding a real number and an\nimaginary number).\n\nNote that numeric literals do not include a sign; a phrase like "-1"\nis actually an expression composed of the unary operator \'"-"\' and the\nliteral "1".\n', @@ -53,16 +53,16 @@ 'objects': u'\nObjects, values and types\n*************************\n\n*Objects* are Python\'s abstraction for data. All data in a Python\nprogram is represented by objects or by relations between objects. (In\na sense, and in conformance to Von Neumann\'s model of a "stored\nprogram computer," code is also represented by objects.)\n\nEvery object has an identity, a type and a value. An object\'s\n*identity* never changes once it has been created; you may think of it\nas the object\'s address in memory. The \'"is"\' operator compares the\nidentity of two objects; the "id()" function returns an integer\nrepresenting its identity.\n\n**CPython implementation detail:** For CPython, "id(x)" is the memory\naddress where "x" is stored.\n\nAn object\'s type determines the operations that the object supports\n(e.g., "does it have a length?") and also defines the possible values\nfor objects of that type. The "type()" function returns an object\'s\ntype (which is an object itself). Like its identity, an object\'s\n*type* is also unchangeable. [1]\n\nThe *value* of some objects can change. Objects whose value can\nchange are said to be *mutable*; objects whose value is unchangeable\nonce they are created are called *immutable*. (The value of an\nimmutable container object that contains a reference to a mutable\nobject can change when the latter\'s value is changed; however the\ncontainer is still considered immutable, because the collection of\nobjects it contains cannot be changed. So, immutability is not\nstrictly the same as having an unchangeable value, it is more subtle.)\nAn object\'s mutability is determined by its type; for instance,\nnumbers, strings and tuples are immutable, while dictionaries and\nlists are mutable.\n\nObjects are never explicitly destroyed; however, when they become\nunreachable they may be garbage-collected. An implementation is\nallowed to postpone garbage collection or omit it altogether --- it is\na matter of implementation quality how garbage collection is\nimplemented, as long as no objects are collected that are still\nreachable.\n\n**CPython implementation detail:** CPython currently uses a reference-\ncounting scheme with (optional) delayed detection of cyclically linked\ngarbage, which collects most objects as soon as they become\nunreachable, but is not guaranteed to collect garbage containing\ncircular references. See the documentation of the "gc" module for\ninformation on controlling the collection of cyclic garbage. Other\nimplementations act differently and CPython may change. Do not depend\non immediate finalization of objects when they become unreachable (so\nyou should always close files explicitly).\n\nNote that the use of the implementation\'s tracing or debugging\nfacilities may keep objects alive that would normally be collectable.\nAlso note that catching an exception with a \'"try"..."except"\'\nstatement may keep objects alive.\n\nSome objects contain references to "external" resources such as open\nfiles or windows. It is understood that these resources are freed\nwhen the object is garbage-collected, but since garbage collection is\nnot guaranteed to happen, such objects also provide an explicit way to\nrelease the external resource, usually a "close()" method. Programs\nare strongly recommended to explicitly close such objects. The\n\'"try"..."finally"\' statement and the \'"with"\' statement provide\nconvenient ways to do this.\n\nSome objects contain references to other objects; these are called\n*containers*. Examples of containers are tuples, lists and\ndictionaries. The references are part of a container\'s value. In\nmost cases, when we talk about the value of a container, we imply the\nvalues, not the identities of the contained objects; however, when we\ntalk about the mutability of a container, only the identities of the\nimmediately contained objects are implied. So, if an immutable\ncontainer (like a tuple) contains a reference to a mutable object, its\nvalue changes if that mutable object is changed.\n\nTypes affect almost all aspects of object behavior. Even the\nimportance of object identity is affected in some sense: for immutable\ntypes, operations that compute new values may actually return a\nreference to any existing object with the same type and value, while\nfor mutable objects this is not allowed. E.g., after "a = 1; b = 1",\n"a" and "b" may or may not refer to the same object with the value\none, depending on the implementation, but after "c = []; d = []", "c"\nand "d" are guaranteed to refer to two different, unique, newly\ncreated empty lists. (Note that "c = d = []" assigns the same object\nto both "c" and "d".)\n', 'operator-summary': u'\nOperator precedence\n*******************\n\nThe following table summarizes the operator precedence in Python, from\nlowest precedence (least binding) to highest precedence (most\nbinding). Operators in the same box have the same precedence. Unless\nthe syntax is explicitly given, operators are binary. Operators in\nthe same box group left to right (except for exponentiation, which\ngroups from right to left).\n\nNote that comparisons, membership tests, and identity tests, all have\nthe same precedence and have a left-to-right chaining feature as\ndescribed in the *Comparisons* section.\n\n+-------------------------------------------------+---------------------------------------+\n| Operator | Description |\n+=================================================+=======================================+\n| "lambda" | Lambda expression |\n+-------------------------------------------------+---------------------------------------+\n| "if" -- "else" | Conditional expression |\n+-------------------------------------------------+---------------------------------------+\n| "or" | Boolean OR |\n+-------------------------------------------------+---------------------------------------+\n| "and" | Boolean AND |\n+-------------------------------------------------+---------------------------------------+\n| "not" "x" | Boolean NOT |\n+-------------------------------------------------+---------------------------------------+\n| "in", "not in", "is", "is not", "<", "<=", ">", | Comparisons, including membership |\n| ">=", "!=", "==" | tests and identity tests |\n+-------------------------------------------------+---------------------------------------+\n| "|" | Bitwise OR |\n+-------------------------------------------------+---------------------------------------+\n| "^" | Bitwise XOR |\n+-------------------------------------------------+---------------------------------------+\n| "&" | Bitwise AND |\n+-------------------------------------------------+---------------------------------------+\n| "<<", ">>" | Shifts |\n+-------------------------------------------------+---------------------------------------+\n| "+", "-" | Addition and subtraction |\n+-------------------------------------------------+---------------------------------------+\n| "*", "@", "/", "//", "%" | Multiplication, matrix multiplication |\n| | division, remainder [5] |\n+-------------------------------------------------+---------------------------------------+\n| "+x", "-x", "~x" | Positive, negative, bitwise NOT |\n+-------------------------------------------------+---------------------------------------+\n| "**" | Exponentiation [6] |\n+-------------------------------------------------+---------------------------------------+\n| "await" "x" | Await expression |\n+-------------------------------------------------+---------------------------------------+\n| "x[index]", "x[index:index]", | Subscription, slicing, call, |\n| "x(arguments...)", "x.attribute" | attribute reference |\n+-------------------------------------------------+---------------------------------------+\n| "(expressions...)", "[expressions...]", "{key: | Binding or tuple display, list |\n| value...}", "{expressions...}" | display, dictionary display, set |\n| | display |\n+-------------------------------------------------+---------------------------------------+\n\n-[ Footnotes ]-\n\n[1] While "abs(x%y) < abs(y)" is true mathematically, for floats\n it may not be true numerically due to roundoff. For example, and\n assuming a platform on which a Python float is an IEEE 754 double-\n precision number, in order that "-1e-100 % 1e100" have the same\n sign as "1e100", the computed result is "-1e-100 + 1e100", which\n is numerically exactly equal to "1e100". The function\n "math.fmod()" returns a result whose sign matches the sign of the\n first argument instead, and so returns "-1e-100" in this case.\n Which approach is more appropriate depends on the application.\n\n[2] If x is very close to an exact integer multiple of y, it\'s\n possible for "x//y" to be one larger than "(x-x%y)//y" due to\n rounding. In such cases, Python returns the latter result, in\n order to preserve that "divmod(x,y)[0] * y + x % y" be very close\n to "x".\n\n[3] The Unicode standard distinguishes between *code points* (e.g.\n U+0041) and *abstract characters* (e.g. "LATIN CAPITAL LETTER A").\n While most abstract characters in Unicode are only represented\n using one code point, there is a number of abstract characters\n that can in addition be represented using a sequence of more than\n one code point. For example, the abstract character "LATIN\n CAPITAL LETTER C WITH CEDILLA" can be represented as a single\n *precomposed character* at code position U+00C7, or as a sequence\n of a *base character* at code position U+0043 (LATIN CAPITAL\n LETTER C), followed by a *combining character* at code position\n U+0327 (COMBINING CEDILLA).\n\n The comparison operators on strings compare at the level of\n Unicode code points. This may be counter-intuitive to humans. For\n example, ""\\u00C7" == "\\u0043\\u0327"" is "False", even though both\n strings represent the same abstract character "LATIN CAPITAL\n LETTER C WITH CEDILLA".\n\n To compare strings at the level of abstract characters (that is,\n in a way intuitive to humans), use "unicodedata.normalize()".\n\n[4] Due to automatic garbage-collection, free lists, and the\n dynamic nature of descriptors, you may notice seemingly unusual\n behaviour in certain uses of the "is" operator, like those\n involving comparisons between instance methods, or constants.\n Check their documentation for more info.\n\n[5] The "%" operator is also used for string formatting; the same\n precedence applies.\n\n[6] The power operator "**" binds less tightly than an arithmetic\n or bitwise unary operator on its right, that is, "2**-1" is "0.5".\n', 'pass': u'\nThe "pass" statement\n********************\n\n pass_stmt ::= "pass"\n\n"pass" is a null operation --- when it is executed, nothing happens.\nIt is useful as a placeholder when a statement is required\nsyntactically, but no code needs to be executed, for example:\n\n def f(arg): pass # a function that does nothing (yet)\n\n class C: pass # a class with no methods (yet)\n', - 'power': u'\nThe power operator\n******************\n\nThe power operator binds more tightly than unary operators on its\nleft; it binds less tightly than unary operators on its right. The\nsyntax is:\n\n power ::= await ["**" u_expr]\n\nThus, in an unparenthesized sequence of power and unary operators, the\noperators are evaluated from right to left (this does not constrain\nthe evaluation order for the operands): "-1**2" results in "-1".\n\nThe power operator has the same semantics as the built-in "pow()"\nfunction, when called with two arguments: it yields its left argument\nraised to the power of its right argument. The numeric arguments are\nfirst converted to a common type, and the result is of that type.\n\nFor int operands, the result has the same type as the operands unless\nthe second argument is negative; in that case, all arguments are\nconverted to float and a float result is delivered. For example,\n"10**2" returns "100", but "10**-2" returns "0.01".\n\nRaising "0.0" to a negative power results in a "ZeroDivisionError".\nRaising a negative number to a fractional power results in a "complex"\nnumber. (In earlier versions it raised a "ValueError".)\n', + 'power': u'\nThe power operator\n******************\n\nThe power operator binds more tightly than unary operators on its\nleft; it binds less tightly than unary operators on its right. The\nsyntax is:\n\n power ::= ( await_expr | primary ) ["**" u_expr]\n\nThus, in an unparenthesized sequence of power and unary operators, the\noperators are evaluated from right to left (this does not constrain\nthe evaluation order for the operands): "-1**2" results in "-1".\n\nThe power operator has the same semantics as the built-in "pow()"\nfunction, when called with two arguments: it yields its left argument\nraised to the power of its right argument. The numeric arguments are\nfirst converted to a common type, and the result is of that type.\n\nFor int operands, the result has the same type as the operands unless\nthe second argument is negative; in that case, all arguments are\nconverted to float and a float result is delivered. For example,\n"10**2" returns "100", but "10**-2" returns "0.01".\n\nRaising "0.0" to a negative power results in a "ZeroDivisionError".\nRaising a negative number to a fractional power results in a "complex"\nnumber. (In earlier versions it raised a "ValueError".)\n', 'raise': u'\nThe "raise" statement\n*********************\n\n raise_stmt ::= "raise" [expression ["from" expression]]\n\nIf no expressions are present, "raise" re-raises the last exception\nthat was active in the current scope. If no exception is active in\nthe current scope, a "RuntimeError" exception is raised indicating\nthat this is an error.\n\nOtherwise, "raise" evaluates the first expression as the exception\nobject. It must be either a subclass or an instance of\n"BaseException". If it is a class, the exception instance will be\nobtained when needed by instantiating the class with no arguments.\n\nThe *type* of the exception is the exception instance\'s class, the\n*value* is the instance itself.\n\nA traceback object is normally created automatically when an exception\nis raised and attached to it as the "__traceback__" attribute, which\nis writable. You can create an exception and set your own traceback in\none step using the "with_traceback()" exception method (which returns\nthe same exception instance, with its traceback set to its argument),\nlike so:\n\n raise Exception("foo occurred").with_traceback(tracebackobj)\n\nThe "from" clause is used for exception chaining: if given, the second\n*expression* must be another exception class or instance, which will\nthen be attached to the raised exception as the "__cause__" attribute\n(which is writable). If the raised exception is not handled, both\nexceptions will be printed:\n\n >>> try:\n ... print(1 / 0)\n ... except Exception as exc:\n ... raise RuntimeError("Something bad happened") from exc\n ...\n Traceback (most recent call last):\n File "", line 2, in \n ZeroDivisionError: int division or modulo by zero\n\n The above exception was the direct cause of the following exception:\n\n Traceback (most recent call last):\n File "", line 4, in \n RuntimeError: Something bad happened\n\nA similar mechanism works implicitly if an exception is raised inside\nan exception handler or a "finally" clause: the previous exception is\nthen attached as the new exception\'s "__context__" attribute:\n\n >>> try:\n ... print(1 / 0)\n ... except:\n ... raise RuntimeError("Something bad happened")\n ...\n Traceback (most recent call last):\n File "", line 2, in \n ZeroDivisionError: int division or modulo by zero\n\n During handling of the above exception, another exception occurred:\n\n Traceback (most recent call last):\n File "", line 4, in \n RuntimeError: Something bad happened\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information about handling exceptions is in section\n*The try statement*.\n', 'return': u'\nThe "return" statement\n**********************\n\n return_stmt ::= "return" [expression_list]\n\n"return" may only occur syntactically nested in a function definition,\nnot within a nested class definition.\n\nIf an expression list is present, it is evaluated, else "None" is\nsubstituted.\n\n"return" leaves the current function call with the expression list (or\n"None") as return value.\n\nWhen "return" passes control out of a "try" statement with a "finally"\nclause, that "finally" clause is executed before really leaving the\nfunction.\n\nIn a generator function, the "return" statement indicates that the\ngenerator is done and will cause "StopIteration" to be raised. The\nreturned value (if any) is used as an argument to construct\n"StopIteration" and becomes the "StopIteration.value" attribute.\n', 'sequence-types': u'\nEmulating container types\n*************************\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which "0 <= k < N" where\n*N* is the length of the sequence, or slice objects, which define a\nrange of items. It is also recommended that mappings provide the\nmethods "keys()", "values()", "items()", "get()", "clear()",\n"setdefault()", "pop()", "popitem()", "copy()", and "update()"\nbehaving similar to those for Python\'s standard dictionary objects.\nThe "collections" module provides a "MutableMapping" abstract base\nclass to help create those methods from a base set of "__getitem__()",\n"__setitem__()", "__delitem__()", and "keys()". Mutable sequences\nshould provide methods "append()", "count()", "index()", "extend()",\n"insert()", "pop()", "remove()", "reverse()" and "sort()", like Python\nstandard list objects. Finally, sequence types should implement\naddition (meaning concatenation) and multiplication (meaning\nrepetition) by defining the methods "__add__()", "__radd__()",\n"__iadd__()", "__mul__()", "__rmul__()" and "__imul__()" described\nbelow; they should not define other numerical operators. It is\nrecommended that both mappings and sequences implement the\n"__contains__()" method to allow efficient use of the "in" operator;\nfor mappings, "in" should search the mapping\'s keys; for sequences, it\nshould search through the values. It is further recommended that both\nmappings and sequences implement the "__iter__()" method to allow\nefficient iteration through the container; for mappings, "__iter__()"\nshould be the same as "keys()"; for sequences, it should iterate\nthrough the values.\n\nobject.__len__(self)\n\n Called to implement the built-in function "len()". Should return\n the length of the object, an integer ">=" 0. Also, an object that\n doesn\'t define a "__bool__()" method and whose "__len__()" method\n returns zero is considered to be false in a Boolean context.\n\nobject.__length_hint__(self)\n\n Called to implement "operator.length_hint()". Should return an\n estimated length for the object (which may be greater or less than\n the actual length). The length must be an integer ">=" 0. This\n method is purely an optimization and is never required for\n correctness.\n\n New in version 3.4.\n\nNote: Slicing is done exclusively with the following three methods.\n A call like\n\n a[1:2] = b\n\n is translated to\n\n a[slice(1, 2, None)] = b\n\n and so forth. Missing slice items are always filled in with "None".\n\nobject.__getitem__(self, key)\n\n Called to implement evaluation of "self[key]". For sequence types,\n the accepted keys should be integers and slice objects. Note that\n the special interpretation of negative indexes (if the class wishes\n to emulate a sequence type) is up to the "__getitem__()" method. If\n *key* is of an inappropriate type, "TypeError" may be raised; if of\n a value outside the set of indexes for the sequence (after any\n special interpretation of negative values), "IndexError" should be\n raised. For mapping types, if *key* is missing (not in the\n container), "KeyError" should be raised.\n\n Note: "for" loops expect that an "IndexError" will be raised for\n illegal indexes to allow proper detection of the end of the\n sequence.\n\nobject.__missing__(self, key)\n\n Called by "dict"."__getitem__()" to implement "self[key]" for dict\n subclasses when key is not in the dictionary.\n\nobject.__setitem__(self, key, value)\n\n Called to implement assignment to "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support changes to the values for keys, or if new keys\n can be added, or for sequences if elements can be replaced. The\n same exceptions should be raised for improper *key* values as for\n the "__getitem__()" method.\n\nobject.__delitem__(self, key)\n\n Called to implement deletion of "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support removal of keys, or for sequences if elements\n can be removed from the sequence. The same exceptions should be\n raised for improper *key* values as for the "__getitem__()" method.\n\nobject.__iter__(self)\n\n This method is called when an iterator is required for a container.\n This method should return a new iterator object that can iterate\n over all the objects in the container. For mappings, it should\n iterate over the keys of the container.\n\n Iterator objects also need to implement this method; they are\n required to return themselves. For more information on iterator\n objects, see *Iterator Types*.\n\nobject.__reversed__(self)\n\n Called (if present) by the "reversed()" built-in to implement\n reverse iteration. It should return a new iterator object that\n iterates over all the objects in the container in reverse order.\n\n If the "__reversed__()" method is not provided, the "reversed()"\n built-in will fall back to using the sequence protocol ("__len__()"\n and "__getitem__()"). Objects that support the sequence protocol\n should only provide "__reversed__()" if they can provide an\n implementation that is more efficient than the one provided by\n "reversed()".\n\nThe membership test operators ("in" and "not in") are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n Called to implement membership test operators. Should return true\n if *item* is in *self*, false otherwise. For mapping objects, this\n should consider the keys of the mapping rather than the values or\n the key-item pairs.\n\n For objects that don\'t define "__contains__()", the membership test\n first tries iteration via "__iter__()", then the old sequence\n iteration protocol via "__getitem__()", see *this section in the\n language reference*.\n', 'shifting': u'\nShifting operations\n*******************\n\nThe shifting operations have lower priority than the arithmetic\noperations:\n\n shift_expr ::= a_expr | shift_expr ( "<<" | ">>" ) a_expr\n\nThese operators accept integers as arguments. They shift the first\nargument to the left or right by the number of bits given by the\nsecond argument.\n\nA right shift by *n* bits is defined as floor division by "pow(2,n)".\nA left shift by *n* bits is defined as multiplication with "pow(2,n)".\n\nNote: In the current implementation, the right-hand operand is\n required to be at most "sys.maxsize". If the right-hand operand is\n larger than "sys.maxsize" an "OverflowError" exception is raised.\n', 'slicings': u'\nSlicings\n********\n\nA slicing selects a range of items in a sequence object (e.g., a\nstring, tuple or list). Slicings may be used as expressions or as\ntargets in assignment or "del" statements. The syntax for a slicing:\n\n slicing ::= primary "[" slice_list "]"\n slice_list ::= slice_item ("," slice_item)* [","]\n slice_item ::= expression | proper_slice\n proper_slice ::= [lower_bound] ":" [upper_bound] [ ":" [stride] ]\n lower_bound ::= expression\n upper_bound ::= expression\n stride ::= expression\n\nThere is ambiguity in the formal syntax here: anything that looks like\nan expression list also looks like a slice list, so any subscription\ncan be interpreted as a slicing. Rather than further complicating the\nsyntax, this is disambiguated by defining that in this case the\ninterpretation as a subscription takes priority over the\ninterpretation as a slicing (this is the case if the slice list\ncontains no proper slice).\n\nThe semantics for a slicing are as follows. The primary is indexed\n(using the same "__getitem__()" method as normal subscription) with a\nkey that is constructed from the slice list, as follows. If the slice\nlist contains at least one comma, the key is a tuple containing the\nconversion of the slice items; otherwise, the conversion of the lone\nslice item is the key. The conversion of a slice item that is an\nexpression is that expression. The conversion of a proper slice is a\nslice object (see section *The standard type hierarchy*) whose\n"start", "stop" and "step" attributes are the values of the\nexpressions given as lower bound, upper bound and stride,\nrespectively, substituting "None" for missing expressions.\n', 'specialattrs': u'\nSpecial Attributes\n******************\n\nThe implementation adds a few special read-only attributes to several\nobject types, where they are relevant. Some of these are not reported\nby the "dir()" built-in function.\n\nobject.__dict__\n\n A dictionary or other mapping object used to store an object\'s\n (writable) attributes.\n\ninstance.__class__\n\n The class to which a class instance belongs.\n\nclass.__bases__\n\n The tuple of base classes of a class object.\n\nclass.__name__\n\n The name of the class or type.\n\nclass.__qualname__\n\n The *qualified name* of the class or type.\n\n New in version 3.3.\n\nclass.__mro__\n\n This attribute is a tuple of classes that are considered when\n looking for base classes during method resolution.\n\nclass.mro()\n\n This method can be overridden by a metaclass to customize the\n method resolution order for its instances. It is called at class\n instantiation, and its result is stored in "__mro__".\n\nclass.__subclasses__()\n\n Each class keeps a list of weak references to its immediate\n subclasses. This method returns a list of all those references\n still alive. Example:\n\n >>> int.__subclasses__()\n []\n\n-[ Footnotes ]-\n\n[1] Additional information on these special methods may be found\n in the Python Reference Manual (*Basic customization*).\n\n[2] As a consequence, the list "[1, 2]" is considered equal to\n "[1.0, 2.0]", and similarly for tuples.\n\n[3] They must have since the parser can\'t tell the type of the\n operands.\n\n[4] Cased characters are those with general category property\n being one of "Lu" (Letter, uppercase), "Ll" (Letter, lowercase),\n or "Lt" (Letter, titlecase).\n\n[5] To format only a tuple you should therefore provide a\n singleton tuple whose only element is the tuple to be formatted.\n', - 'specialnames': u'\nSpecial method names\n********************\n\nA class can implement certain operations that are invoked by special\nsyntax (such as arithmetic operations or subscripting and slicing) by\ndefining methods with special names. This is Python\'s approach to\n*operator overloading*, allowing classes to define their own behavior\nwith respect to language operators. For instance, if a class defines\na method named "__getitem__()", and "x" is an instance of this class,\nthen "x[i]" is roughly equivalent to "type(x).__getitem__(x, i)".\nExcept where mentioned, attempts to execute an operation raise an\nexception when no appropriate method is defined (typically\n"AttributeError" or "TypeError").\n\nWhen implementing a class that emulates any built-in type, it is\nimportant that the emulation only be implemented to the degree that it\nmakes sense for the object being modelled. For example, some\nsequences may work well with retrieval of individual elements, but\nextracting a slice may not make sense. (One example of this is the\n"NodeList" interface in the W3C\'s Document Object Model.)\n\n\nBasic customization\n===================\n\nobject.__new__(cls[, ...])\n\n Called to create a new instance of class *cls*. "__new__()" is a\n static method (special-cased so you need not declare it as such)\n that takes the class of which an instance was requested as its\n first argument. The remaining arguments are those passed to the\n object constructor expression (the call to the class). The return\n value of "__new__()" should be the new object instance (usually an\n instance of *cls*).\n\n Typical implementations create a new instance of the class by\n invoking the superclass\'s "__new__()" method using\n "super(currentclass, cls).__new__(cls[, ...])" with appropriate\n arguments and then modifying the newly-created instance as\n necessary before returning it.\n\n If "__new__()" returns an instance of *cls*, then the new\n instance\'s "__init__()" method will be invoked like\n "__init__(self[, ...])", where *self* is the new instance and the\n remaining arguments are the same as were passed to "__new__()".\n\n If "__new__()" does not return an instance of *cls*, then the new\n instance\'s "__init__()" method will not be invoked.\n\n "__new__()" is intended mainly to allow subclasses of immutable\n types (like int, str, or tuple) to customize instance creation. It\n is also commonly overridden in custom metaclasses in order to\n customize class creation.\n\nobject.__init__(self[, ...])\n\n Called after the instance has been created (by "__new__()"), but\n before it is returned to the caller. The arguments are those\n passed to the class constructor expression. If a base class has an\n "__init__()" method, the derived class\'s "__init__()" method, if\n any, must explicitly call it to ensure proper initialization of the\n base class part of the instance; for example:\n "BaseClass.__init__(self, [args...])".\n\n Because "__new__()" and "__init__()" work together in constructing\n objects ("__new__()" to create it, and "__init__()" to customise\n it), no non-"None" value may be returned by "__init__()"; doing so\n will cause a "TypeError" to be raised at runtime.\n\nobject.__del__(self)\n\n Called when the instance is about to be destroyed. This is also\n called a destructor. If a base class has a "__del__()" method, the\n derived class\'s "__del__()" method, if any, must explicitly call it\n to ensure proper deletion of the base class part of the instance.\n Note that it is possible (though not recommended!) for the\n "__del__()" method to postpone destruction of the instance by\n creating a new reference to it. It may then be called at a later\n time when this new reference is deleted. It is not guaranteed that\n "__del__()" methods are called for objects that still exist when\n the interpreter exits.\n\n Note: "del x" doesn\'t directly call "x.__del__()" --- the former\n decrements the reference count for "x" by one, and the latter is\n only called when "x"\'s reference count reaches zero. Some common\n situations that may prevent the reference count of an object from\n going to zero include: circular references between objects (e.g.,\n a doubly-linked list or a tree data structure with parent and\n child pointers); a reference to the object on the stack frame of\n a function that caught an exception (the traceback stored in\n "sys.exc_info()[2]" keeps the stack frame alive); or a reference\n to the object on the stack frame that raised an unhandled\n exception in interactive mode (the traceback stored in\n "sys.last_traceback" keeps the stack frame alive). The first\n situation can only be remedied by explicitly breaking the cycles;\n the second can be resolved by freeing the reference to the\n traceback object when it is no longer useful, and the third can\n be resolved by storing "None" in "sys.last_traceback". Circular\n references which are garbage are detected and cleaned up when the\n cyclic garbage collector is enabled (it\'s on by default). Refer\n to the documentation for the "gc" module for more information\n about this topic.\n\n Warning: Due to the precarious circumstances under which\n "__del__()" methods are invoked, exceptions that occur during\n their execution are ignored, and a warning is printed to\n "sys.stderr" instead. Also, when "__del__()" is invoked in\n response to a module being deleted (e.g., when execution of the\n program is done), other globals referenced by the "__del__()"\n method may already have been deleted or in the process of being\n torn down (e.g. the import machinery shutting down). For this\n reason, "__del__()" methods should do the absolute minimum needed\n to maintain external invariants. Starting with version 1.5,\n Python guarantees that globals whose name begins with a single\n underscore are deleted from their module before other globals are\n deleted; if no other references to such globals exist, this may\n help in assuring that imported modules are still available at the\n time when the "__del__()" method is called.\n\nobject.__repr__(self)\n\n Called by the "repr()" built-in function to compute the "official"\n string representation of an object. If at all possible, this\n should look like a valid Python expression that could be used to\n recreate an object with the same value (given an appropriate\n environment). If this is not possible, a string of the form\n "<...some useful description...>" should be returned. The return\n value must be a string object. If a class defines "__repr__()" but\n not "__str__()", then "__repr__()" is also used when an "informal"\n string representation of instances of that class is required.\n\n This is typically used for debugging, so it is important that the\n representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n Called by "str(object)" and the built-in functions "format()" and\n "print()" to compute the "informal" or nicely printable string\n representation of an object. The return value must be a *string*\n object.\n\n This method differs from "object.__repr__()" in that there is no\n expectation that "__str__()" return a valid Python expression: a\n more convenient or concise representation can be used.\n\n The default implementation defined by the built-in type "object"\n calls "object.__repr__()".\n\nobject.__bytes__(self)\n\n Called by "bytes()" to compute a byte-string representation of an\n object. This should return a "bytes" object.\n\nobject.__format__(self, format_spec)\n\n Called by the "format()" built-in function (and by extension, the\n "str.format()" method of class "str") to produce a "formatted"\n string representation of an object. The "format_spec" argument is a\n string that contains a description of the formatting options\n desired. The interpretation of the "format_spec" argument is up to\n the type implementing "__format__()", however most classes will\n either delegate formatting to one of the built-in types, or use a\n similar formatting option syntax.\n\n See *Format Specification Mini-Language* for a description of the\n standard formatting syntax.\n\n The return value must be a string object.\n\n Changed in version 3.4: The __format__ method of "object" itself\n raises a "TypeError" if passed any non-empty string.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n These are the so-called "rich comparison" methods. The\n correspondence between operator symbols and method names is as\n follows: "xy" calls\n "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n\n A rich comparison method may return the singleton "NotImplemented"\n if it does not implement the operation for a given pair of\n arguments. By convention, "False" and "True" are returned for a\n successful comparison. However, these methods can return any value,\n so if the comparison operator is used in a Boolean context (e.g.,\n in the condition of an "if" statement), Python will call "bool()"\n on the value to determine if the result is true or false.\n\n By default, "__ne__()" delegates to "__eq__()" and inverts the\n result unless it is "NotImplemented". There are no other implied\n relationships among the comparison operators, for example, the\n truth of "(x.__hash__".\n\n If a class that does not override "__eq__()" wishes to suppress\n hash support, it should include "__hash__ = None" in the class\n definition. A class which defines its own "__hash__()" that\n explicitly raises a "TypeError" would be incorrectly identified as\n hashable by an "isinstance(obj, collections.Hashable)" call.\n\n Note: By default, the "__hash__()" values of str, bytes and\n datetime objects are "salted" with an unpredictable random value.\n Although they remain constant within an individual Python\n process, they are not predictable between repeated invocations of\n Python.This is intended to provide protection against a denial-\n of-service caused by carefully-chosen inputs that exploit the\n worst case performance of a dict insertion, O(n^2) complexity.\n See http://www.ocert.org/advisories/ocert-2011-003.html for\n details.Changing hash values affects the iteration order of\n dicts, sets and other mappings. Python has never made guarantees\n about this ordering (and it typically varies between 32-bit and\n 64-bit builds).See also "PYTHONHASHSEED".\n\n Changed in version 3.3: Hash randomization is enabled by default.\n\nobject.__bool__(self)\n\n Called to implement truth value testing and the built-in operation\n "bool()"; should return "False" or "True". When this method is not\n defined, "__len__()" is called, if it is defined, and the object is\n considered true if its result is nonzero. If a class defines\n neither "__len__()" nor "__bool__()", all its instances are\n considered true.\n\n\nCustomizing attribute access\n============================\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of "x.name") for\nclass instances.\n\nobject.__getattr__(self, name)\n\n Called when an attribute lookup has not found the attribute in the\n usual places (i.e. it is not an instance attribute nor is it found\n in the class tree for "self"). "name" is the attribute name. This\n method should return the (computed) attribute value or raise an\n "AttributeError" exception.\n\n Note that if the attribute is found through the normal mechanism,\n "__getattr__()" is not called. (This is an intentional asymmetry\n between "__getattr__()" and "__setattr__()".) This is done both for\n efficiency reasons and because otherwise "__getattr__()" would have\n no way to access other attributes of the instance. Note that at\n least for instance variables, you can fake total control by not\n inserting any values in the instance attribute dictionary (but\n instead inserting them in another object). See the\n "__getattribute__()" method below for a way to actually get total\n control over attribute access.\n\nobject.__getattribute__(self, name)\n\n Called unconditionally to implement attribute accesses for\n instances of the class. If the class also defines "__getattr__()",\n the latter will not be called unless "__getattribute__()" either\n calls it explicitly or raises an "AttributeError". This method\n should return the (computed) attribute value or raise an\n "AttributeError" exception. In order to avoid infinite recursion in\n this method, its implementation should always call the base class\n method with the same name to access any attributes it needs, for\n example, "object.__getattribute__(self, name)".\n\n Note: This method may still be bypassed when looking up special\n methods as the result of implicit invocation via language syntax\n or built-in functions. See *Special method lookup*.\n\nobject.__setattr__(self, name, value)\n\n Called when an attribute assignment is attempted. This is called\n instead of the normal mechanism (i.e. store the value in the\n instance dictionary). *name* is the attribute name, *value* is the\n value to be assigned to it.\n\n If "__setattr__()" wants to assign to an instance attribute, it\n should call the base class method with the same name, for example,\n "object.__setattr__(self, name, value)".\n\nobject.__delattr__(self, name)\n\n Like "__setattr__()" but for attribute deletion instead of\n assignment. This should only be implemented if "del obj.name" is\n meaningful for the object.\n\nobject.__dir__(self)\n\n Called when "dir()" is called on the object. A sequence must be\n returned. "dir()" converts the returned sequence to a list and\n sorts it.\n\n\nImplementing Descriptors\n------------------------\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in an\n*owner* class (the descriptor must be in either the owner\'s class\ndictionary or in the class dictionary for one of its parents). In the\nexamples below, "the attribute" refers to the attribute whose name is\nthe key of the property in the owner class\' "__dict__".\n\nobject.__get__(self, instance, owner)\n\n Called to get the attribute of the owner class (class attribute\n access) or of an instance of that class (instance attribute\n access). *owner* is always the owner class, while *instance* is the\n instance that the attribute was accessed through, or "None" when\n the attribute is accessed through the *owner*. This method should\n return the (computed) attribute value or raise an "AttributeError"\n exception.\n\nobject.__set__(self, instance, value)\n\n Called to set the attribute on an instance *instance* of the owner\n class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n Called to delete the attribute on an instance *instance* of the\n owner class.\n\nThe attribute "__objclass__" is interpreted by the "inspect" module as\nspecifying the class where this object was defined (setting this\nappropriately can assist in runtime introspection of dynamic class\nattributes). For callables, it may indicate that an instance of the\ngiven type (or a subclass) is expected or required as the first\npositional argument (for example, CPython sets this attribute for\nunbound methods that are implemented in C).\n\n\nInvoking Descriptors\n--------------------\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol: "__get__()", "__set__()", and\n"__delete__()". If any of those methods are defined for an object, it\nis said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, "a.x" has a\nlookup chain starting with "a.__dict__[\'x\']", then\n"type(a).__dict__[\'x\']", and continuing through the base classes of\n"type(a)" excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead. Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called.\n\nThe starting point for descriptor invocation is a binding, "a.x". How\nthe arguments are assembled depends on "a":\n\nDirect Call\n The simplest and least common call is when user code directly\n invokes a descriptor method: "x.__get__(a)".\n\nInstance Binding\n If binding to an object instance, "a.x" is transformed into the\n call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n\nClass Binding\n If binding to a class, "A.x" is transformed into the call:\n "A.__dict__[\'x\'].__get__(None, A)".\n\nSuper Binding\n If "a" is an instance of "super", then the binding "super(B,\n obj).m()" searches "obj.__class__.__mro__" for the base class "A"\n immediately preceding "B" and then invokes the descriptor with the\n call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined. A descriptor can define\nany combination of "__get__()", "__set__()" and "__delete__()". If it\ndoes not define "__get__()", then accessing the attribute will return\nthe descriptor object itself unless there is a value in the object\'s\ninstance dictionary. If the descriptor defines "__set__()" and/or\n"__delete__()", it is a data descriptor; if it defines neither, it is\na non-data descriptor. Normally, data descriptors define both\n"__get__()" and "__set__()", while non-data descriptors have just the\n"__get__()" method. Data descriptors with "__set__()" and "__get__()"\ndefined always override a redefinition in an instance dictionary. In\ncontrast, non-data descriptors can be overridden by instances.\n\nPython methods (including "staticmethod()" and "classmethod()") are\nimplemented as non-data descriptors. Accordingly, instances can\nredefine and override methods. This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe "property()" function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n---------\n\nBy default, instances of classes have a dictionary for attribute\nstorage. This wastes space for objects having very few instance\nvariables. The space consumption can become acute when creating large\nnumbers of instances.\n\nThe default can be overridden by defining *__slots__* in a class\ndefinition. The *__slots__* declaration takes a sequence of instance\nvariables and reserves just enough space in each instance to hold a\nvalue for each variable. Space is saved because *__dict__* is not\ncreated for each instance.\n\nobject.__slots__\n\n This class variable can be assigned a string, iterable, or sequence\n of strings with variable names used by instances. *__slots__*\n reserves space for the declared variables and prevents the\n automatic creation of *__dict__* and *__weakref__* for each\n instance.\n\n\nNotes on using *__slots__*\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n* When inheriting from a class without *__slots__*, the *__dict__*\n attribute of that class will always be accessible, so a *__slots__*\n definition in the subclass is meaningless.\n\n* Without a *__dict__* variable, instances cannot be assigned new\n variables not listed in the *__slots__* definition. Attempts to\n assign to an unlisted variable name raises "AttributeError". If\n dynamic assignment of new variables is desired, then add\n "\'__dict__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n* Without a *__weakref__* variable for each instance, classes\n defining *__slots__* do not support weak references to its\n instances. If weak reference support is needed, then add\n "\'__weakref__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n* *__slots__* are implemented at the class level by creating\n descriptors (*Implementing Descriptors*) for each variable name. As\n a result, class attributes cannot be used to set default values for\n instance variables defined by *__slots__*; otherwise, the class\n attribute would overwrite the descriptor assignment.\n\n* The action of a *__slots__* declaration is limited to the class\n where it is defined. As a result, subclasses will have a *__dict__*\n unless they also define *__slots__* (which must only contain names\n of any *additional* slots).\n\n* If a class defines a slot also defined in a base class, the\n instance variable defined by the base class slot is inaccessible\n (except by retrieving its descriptor directly from the base class).\n This renders the meaning of the program undefined. In the future, a\n check may be added to prevent this.\n\n* Nonempty *__slots__* does not work for classes derived from\n "variable-length" built-in types such as "int", "bytes" and "tuple".\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings\n may also be used; however, in the future, special meaning may be\n assigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n *__slots__*.\n\n\nCustomizing class creation\n==========================\n\nBy default, classes are constructed using "type()". The class body is\nexecuted in a new namespace and the class name is bound locally to the\nresult of "type(name, bases, namespace)".\n\nThe class creation process can be customised by passing the\n"metaclass" keyword argument in the class definition line, or by\ninheriting from an existing class that included such an argument. In\nthe following example, both "MyClass" and "MySubclass" are instances\nof "Meta":\n\n class Meta(type):\n pass\n\n class MyClass(metaclass=Meta):\n pass\n\n class MySubclass(MyClass):\n pass\n\nAny other keyword arguments that are specified in the class definition\nare passed through to all metaclass operations described below.\n\nWhen a class definition is executed, the following steps occur:\n\n* the appropriate metaclass is determined\n\n* the class namespace is prepared\n\n* the class body is executed\n\n* the class object is created\n\n\nDetermining the appropriate metaclass\n-------------------------------------\n\nThe appropriate metaclass for a class definition is determined as\nfollows:\n\n* if no bases and no explicit metaclass are given, then "type()" is\n used\n\n* if an explicit metaclass is given and it is *not* an instance of\n "type()", then it is used directly as the metaclass\n\n* if an instance of "type()" is given as the explicit metaclass, or\n bases are defined, then the most derived metaclass is used\n\nThe most derived metaclass is selected from the explicitly specified\nmetaclass (if any) and the metaclasses (i.e. "type(cls)") of all\nspecified base classes. The most derived metaclass is one which is a\nsubtype of *all* of these candidate metaclasses. If none of the\ncandidate metaclasses meets that criterion, then the class definition\nwill fail with "TypeError".\n\n\nPreparing the class namespace\n-----------------------------\n\nOnce the appropriate metaclass has been identified, then the class\nnamespace is prepared. If the metaclass has a "__prepare__" attribute,\nit is called as "namespace = metaclass.__prepare__(name, bases,\n**kwds)" (where the additional keyword arguments, if any, come from\nthe class definition).\n\nIf the metaclass has no "__prepare__" attribute, then the class\nnamespace is initialised as an empty "dict()" instance.\n\nSee also: **PEP 3115** - Metaclasses in Python 3000\n\n Introduced the "__prepare__" namespace hook\n\n\nExecuting the class body\n------------------------\n\nThe class body is executed (approximately) as "exec(body, globals(),\nnamespace)". The key difference from a normal call to "exec()" is that\nlexical scoping allows the class body (including any methods) to\nreference names from the current and outer scopes when the class\ndefinition occurs inside a function.\n\nHowever, even when the class definition occurs inside the function,\nmethods defined inside the class still cannot see names defined at the\nclass scope. Class variables must be accessed through the first\nparameter of instance or class methods, and cannot be accessed at all\nfrom static methods.\n\n\nCreating the class object\n-------------------------\n\nOnce the class namespace has been populated by executing the class\nbody, the class object is created by calling "metaclass(name, bases,\nnamespace, **kwds)" (the additional keywords passed here are the same\nas those passed to "__prepare__").\n\nThis class object is the one that will be referenced by the zero-\nargument form of "super()". "__class__" is an implicit closure\nreference created by the compiler if any methods in a class body refer\nto either "__class__" or "super". This allows the zero argument form\nof "super()" to correctly identify the class being defined based on\nlexical scoping, while the class or instance that was used to make the\ncurrent call is identified based on the first argument passed to the\nmethod.\n\nAfter the class object is created, it is passed to the class\ndecorators included in the class definition (if any) and the resulting\nobject is bound in the local namespace as the defined class.\n\nSee also: **PEP 3135** - New super\n\n Describes the implicit "__class__" closure reference\n\n\nMetaclass example\n-----------------\n\nThe potential uses for metaclasses are boundless. Some ideas that have\nbeen explored include logging, interface checking, automatic\ndelegation, automatic property creation, proxies, frameworks, and\nautomatic resource locking/synchronization.\n\nHere is an example of a metaclass that uses an\n"collections.OrderedDict" to remember the order that class variables\nare defined:\n\n class OrderedClass(type):\n\n @classmethod\n def __prepare__(metacls, name, bases, **kwds):\n return collections.OrderedDict()\n\n def __new__(cls, name, bases, namespace, **kwds):\n result = type.__new__(cls, name, bases, dict(namespace))\n result.members = tuple(namespace)\n return result\n\n class A(metaclass=OrderedClass):\n def one(self): pass\n def two(self): pass\n def three(self): pass\n def four(self): pass\n\n >>> A.members\n (\'__module__\', \'one\', \'two\', \'three\', \'four\')\n\nWhen the class definition for *A* gets executed, the process begins\nwith calling the metaclass\'s "__prepare__()" method which returns an\nempty "collections.OrderedDict". That mapping records the methods and\nattributes of *A* as they are defined within the body of the class\nstatement. Once those definitions are executed, the ordered dictionary\nis fully populated and the metaclass\'s "__new__()" method gets\ninvoked. That method builds the new type and it saves the ordered\ndictionary keys in an attribute called "members".\n\n\nCustomizing instance and subclass checks\n========================================\n\nThe following methods are used to override the default behavior of the\n"isinstance()" and "issubclass()" built-in functions.\n\nIn particular, the metaclass "abc.ABCMeta" implements these methods in\norder to allow the addition of Abstract Base Classes (ABCs) as\n"virtual base classes" to any class or type (including built-in\ntypes), including other ABCs.\n\nclass.__instancecheck__(self, instance)\n\n Return true if *instance* should be considered a (direct or\n indirect) instance of *class*. If defined, called to implement\n "isinstance(instance, class)".\n\nclass.__subclasscheck__(self, subclass)\n\n Return true if *subclass* should be considered a (direct or\n indirect) subclass of *class*. If defined, called to implement\n "issubclass(subclass, class)".\n\nNote that these methods are looked up on the type (metaclass) of a\nclass. They cannot be defined as class methods in the actual class.\nThis is consistent with the lookup of special methods that are called\non instances, only in this case the instance is itself a class.\n\nSee also: **PEP 3119** - Introducing Abstract Base Classes\n\n Includes the specification for customizing "isinstance()" and\n "issubclass()" behavior through "__instancecheck__()" and\n "__subclasscheck__()", with motivation for this functionality in\n the context of adding Abstract Base Classes (see the "abc"\n module) to the language.\n\n\nEmulating callable objects\n==========================\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, "x(arg1, arg2, ...)" is a shorthand for\n "x.__call__(arg1, arg2, ...)".\n\n\nEmulating container types\n=========================\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which "0 <= k < N" where\n*N* is the length of the sequence, or slice objects, which define a\nrange of items. It is also recommended that mappings provide the\nmethods "keys()", "values()", "items()", "get()", "clear()",\n"setdefault()", "pop()", "popitem()", "copy()", and "update()"\nbehaving similar to those for Python\'s standard dictionary objects.\nThe "collections" module provides a "MutableMapping" abstract base\nclass to help create those methods from a base set of "__getitem__()",\n"__setitem__()", "__delitem__()", and "keys()". Mutable sequences\nshould provide methods "append()", "count()", "index()", "extend()",\n"insert()", "pop()", "remove()", "reverse()" and "sort()", like Python\nstandard list objects. Finally, sequence types should implement\naddition (meaning concatenation) and multiplication (meaning\nrepetition) by defining the methods "__add__()", "__radd__()",\n"__iadd__()", "__mul__()", "__rmul__()" and "__imul__()" described\nbelow; they should not define other numerical operators. It is\nrecommended that both mappings and sequences implement the\n"__contains__()" method to allow efficient use of the "in" operator;\nfor mappings, "in" should search the mapping\'s keys; for sequences, it\nshould search through the values. It is further recommended that both\nmappings and sequences implement the "__iter__()" method to allow\nefficient iteration through the container; for mappings, "__iter__()"\nshould be the same as "keys()"; for sequences, it should iterate\nthrough the values.\n\nobject.__len__(self)\n\n Called to implement the built-in function "len()". Should return\n the length of the object, an integer ">=" 0. Also, an object that\n doesn\'t define a "__bool__()" method and whose "__len__()" method\n returns zero is considered to be false in a Boolean context.\n\nobject.__length_hint__(self)\n\n Called to implement "operator.length_hint()". Should return an\n estimated length for the object (which may be greater or less than\n the actual length). The length must be an integer ">=" 0. This\n method is purely an optimization and is never required for\n correctness.\n\n New in version 3.4.\n\nNote: Slicing is done exclusively with the following three methods.\n A call like\n\n a[1:2] = b\n\n is translated to\n\n a[slice(1, 2, None)] = b\n\n and so forth. Missing slice items are always filled in with "None".\n\nobject.__getitem__(self, key)\n\n Called to implement evaluation of "self[key]". For sequence types,\n the accepted keys should be integers and slice objects. Note that\n the special interpretation of negative indexes (if the class wishes\n to emulate a sequence type) is up to the "__getitem__()" method. If\n *key* is of an inappropriate type, "TypeError" may be raised; if of\n a value outside the set of indexes for the sequence (after any\n special interpretation of negative values), "IndexError" should be\n raised. For mapping types, if *key* is missing (not in the\n container), "KeyError" should be raised.\n\n Note: "for" loops expect that an "IndexError" will be raised for\n illegal indexes to allow proper detection of the end of the\n sequence.\n\nobject.__missing__(self, key)\n\n Called by "dict"."__getitem__()" to implement "self[key]" for dict\n subclasses when key is not in the dictionary.\n\nobject.__setitem__(self, key, value)\n\n Called to implement assignment to "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support changes to the values for keys, or if new keys\n can be added, or for sequences if elements can be replaced. The\n same exceptions should be raised for improper *key* values as for\n the "__getitem__()" method.\n\nobject.__delitem__(self, key)\n\n Called to implement deletion of "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support removal of keys, or for sequences if elements\n can be removed from the sequence. The same exceptions should be\n raised for improper *key* values as for the "__getitem__()" method.\n\nobject.__iter__(self)\n\n This method is called when an iterator is required for a container.\n This method should return a new iterator object that can iterate\n over all the objects in the container. For mappings, it should\n iterate over the keys of the container.\n\n Iterator objects also need to implement this method; they are\n required to return themselves. For more information on iterator\n objects, see *Iterator Types*.\n\nobject.__reversed__(self)\n\n Called (if present) by the "reversed()" built-in to implement\n reverse iteration. It should return a new iterator object that\n iterates over all the objects in the container in reverse order.\n\n If the "__reversed__()" method is not provided, the "reversed()"\n built-in will fall back to using the sequence protocol ("__len__()"\n and "__getitem__()"). Objects that support the sequence protocol\n should only provide "__reversed__()" if they can provide an\n implementation that is more efficient than the one provided by\n "reversed()".\n\nThe membership test operators ("in" and "not in") are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n Called to implement membership test operators. Should return true\n if *item* is in *self*, false otherwise. For mapping objects, this\n should consider the keys of the mapping rather than the values or\n the key-item pairs.\n\n For objects that don\'t define "__contains__()", the membership test\n first tries iteration via "__iter__()", then the old sequence\n iteration protocol via "__getitem__()", see *this section in the\n language reference*.\n\n\nEmulating numeric types\n=======================\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__matmul__(self, other)\nobject.__truediv__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "@", "/", "//", "%", "divmod()",\n "pow()", "**", "<<", ">>", "&", "^", "|"). For instance, to\n evaluate the expression "x + y", where *x* is an instance of a\n class that has an "__add__()" method, "x.__add__(y)" is called.\n The "__divmod__()" method should be the equivalent to using\n "__floordiv__()" and "__mod__()"; it should not be related to\n "__truediv__()". Note that "__pow__()" should be defined to accept\n an optional third argument if the ternary version of the built-in\n "pow()" function is to be supported.\n\n If one of those methods does not support the operation with the\n supplied arguments, it should return "NotImplemented".\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rmatmul__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "@", "/", "//", "%", "divmod()",\n "pow()", "**", "<<", ">>", "&", "^", "|") with reflected (swapped)\n operands. These functions are only called if the left operand does\n not support the corresponding operation and the operands are of\n different types. [2] For instance, to evaluate the expression "x -\n y", where *y* is an instance of a class that has an "__rsub__()"\n method, "y.__rsub__(x)" is called if "x.__sub__(y)" returns\n *NotImplemented*.\n\n Note that ternary "pow()" will not try calling "__rpow__()" (the\n coercion rules would become too complicated).\n\n Note: If the right operand\'s type is a subclass of the left\n operand\'s type and that subclass provides the reflected method\n for the operation, this method will be called before the left\n operand\'s non-reflected method. This behavior allows subclasses\n to override their ancestors\' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__imatmul__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n These methods are called to implement the augmented arithmetic\n assignments ("+=", "-=", "*=", "@=", "/=", "//=", "%=", "**=",\n "<<=", ">>=", "&=", "^=", "|="). These methods should attempt to\n do the operation in-place (modifying *self*) and return the result\n (which could be, but does not have to be, *self*). If a specific\n method is not defined, the augmented assignment falls back to the\n normal methods. For instance, if *x* is an instance of a class\n with an "__iadd__()" method, "x += y" is equivalent to "x =\n x.__iadd__(y)" . Otherwise, "x.__add__(y)" and "y.__radd__(x)" are\n considered, as with the evaluation of "x + y". In certain\n situations, augmented assignment can result in unexpected errors\n (see *Why does a_tuple[i] += [\'item\'] raise an exception when the\n addition works?*), but this behavior is in fact part of the data\n model.\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n Called to implement the unary arithmetic operations ("-", "+",\n "abs()" and "~").\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__float__(self)\nobject.__round__(self[, n])\n\n Called to implement the built-in functions "complex()", "int()",\n "float()" and "round()". Should return a value of the appropriate\n type.\n\nobject.__index__(self)\n\n Called to implement "operator.index()", and whenever Python needs\n to losslessly convert the numeric object to an integer object (such\n as in slicing, or in the built-in "bin()", "hex()" and "oct()"\n functions). Presence of this method indicates that the numeric\n object is an integer type. Must return an integer.\n\n Note: In order to have a coherent integer type class, when\n "__index__()" is defined "__int__()" should also be defined, and\n both should return the same value.\n\n\nWith Statement Context Managers\n===============================\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a "with" statement. The context manager\nhandles the entry into, and the exit from, the desired runtime context\nfor the execution of the block of code. Context managers are normally\ninvoked using the "with" statement (described in section *The with\nstatement*), but can also be used by directly invoking their methods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see *Context Manager Types*.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The "with"\n statement will bind this method\'s return value to the target(s)\n specified in the "as" clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be "None".\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that "__exit__()" methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also: **PEP 0343** - The "with" statement\n\n The specification, background, and examples for the Python "with"\n statement.\n\n\nSpecial method lookup\n=====================\n\nFor custom classes, implicit invocations of special methods are only\nguaranteed to work correctly if defined on an object\'s type, not in\nthe object\'s instance dictionary. That behaviour is the reason why\nthe following code raises an exception:\n\n >>> class C:\n ... pass\n ...\n >>> c = C()\n >>> c.__len__ = lambda: 5\n >>> len(c)\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: object of type \'C\' has no len()\n\nThe rationale behind this behaviour lies with a number of special\nmethods such as "__hash__()" and "__repr__()" that are implemented by\nall objects, including type objects. If the implicit lookup of these\nmethods used the conventional lookup process, they would fail when\ninvoked on the type object itself:\n\n >>> 1 .__hash__() == hash(1)\n True\n >>> int.__hash__() == hash(int)\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: descriptor \'__hash__\' of \'int\' object needs an argument\n\nIncorrectly attempting to invoke an unbound method of a class in this\nway is sometimes referred to as \'metaclass confusion\', and is avoided\nby bypassing the instance when looking up special methods:\n\n >>> type(1).__hash__(1) == hash(1)\n True\n >>> type(int).__hash__(int) == hash(int)\n True\n\nIn addition to bypassing any instance attributes in the interest of\ncorrectness, implicit special method lookup generally also bypasses\nthe "__getattribute__()" method even of the object\'s metaclass:\n\n >>> class Meta(type):\n ... def __getattribute__(*args):\n ... print("Metaclass getattribute invoked")\n ... return type.__getattribute__(*args)\n ...\n >>> class C(object, metaclass=Meta):\n ... def __len__(self):\n ... return 10\n ... def __getattribute__(*args):\n ... print("Class getattribute invoked")\n ... return object.__getattribute__(*args)\n ...\n >>> c = C()\n >>> c.__len__() # Explicit lookup via instance\n Class getattribute invoked\n 10\n >>> type(c).__len__(c) # Explicit lookup via type\n Metaclass getattribute invoked\n 10\n >>> len(c) # Implicit lookup\n 10\n\nBypassing the "__getattribute__()" machinery in this fashion provides\nsignificant scope for speed optimisations within the interpreter, at\nthe cost of some flexibility in the handling of special methods (the\nspecial method *must* be set on the class object itself in order to be\nconsistently invoked by the interpreter).\n', - 'string-methods': u'\nString Methods\n**************\n\nStrings implement all of the *common* sequence operations, along with\nthe additional methods described below.\n\nStrings also support two styles of string formatting, one providing a\nlarge degree of flexibility and customization (see "str.format()",\n*Format String Syntax* and *String Formatting*) and the other based on\nC "printf" style formatting that handles a narrower range of types and\nis slightly harder to use correctly, but is often faster for the cases\nit can handle (*printf-style String Formatting*).\n\nThe *Text Processing Services* section of the standard library covers\na number of other modules that provide various text related utilities\n(including regular expression support in the "re" module).\n\nstr.capitalize()\n\n Return a copy of the string with its first character capitalized\n and the rest lowercased.\n\nstr.casefold()\n\n Return a casefolded copy of the string. Casefolded strings may be\n used for caseless matching.\n\n Casefolding is similar to lowercasing but more aggressive because\n it is intended to remove all case distinctions in a string. For\n example, the German lowercase letter "\'\xdf\'" is equivalent to ""ss"".\n Since it is already lowercase, "lower()" would do nothing to "\'\xdf\'";\n "casefold()" converts it to ""ss"".\n\n The casefolding algorithm is described in section 3.13 of the\n Unicode Standard.\n\n New in version 3.3.\n\nstr.center(width[, fillchar])\n\n Return centered in a string of length *width*. Padding is done\n using the specified *fillchar* (default is an ASCII space). The\n original string is returned if *width* is less than or equal to\n "len(s)".\n\nstr.count(sub[, start[, end]])\n\n Return the number of non-overlapping occurrences of substring *sub*\n in the range [*start*, *end*]. Optional arguments *start* and\n *end* are interpreted as in slice notation.\n\nstr.encode(encoding="utf-8", errors="strict")\n\n Return an encoded version of the string as a bytes object. Default\n encoding is "\'utf-8\'". *errors* may be given to set a different\n error handling scheme. The default for *errors* is "\'strict\'",\n meaning that encoding errors raise a "UnicodeError". Other possible\n values are "\'ignore\'", "\'replace\'", "\'xmlcharrefreplace\'",\n "\'backslashreplace\'" and any other name registered via\n "codecs.register_error()", see section *Error Handlers*. For a list\n of possible encodings, see section *Standard Encodings*.\n\n Changed in version 3.1: Support for keyword arguments added.\n\nstr.endswith(suffix[, start[, end]])\n\n Return "True" if the string ends with the specified *suffix*,\n otherwise return "False". *suffix* can also be a tuple of suffixes\n to look for. With optional *start*, test beginning at that\n position. With optional *end*, stop comparing at that position.\n\nstr.expandtabs(tabsize=8)\n\n Return a copy of the string where all tab characters are replaced\n by one or more spaces, depending on the current column and the\n given tab size. Tab positions occur every *tabsize* characters\n (default is 8, giving tab positions at columns 0, 8, 16 and so on).\n To expand the string, the current column is set to zero and the\n string is examined character by character. If the character is a\n tab ("\\t"), one or more space characters are inserted in the result\n until the current column is equal to the next tab position. (The\n tab character itself is not copied.) If the character is a newline\n ("\\n") or return ("\\r"), it is copied and the current column is\n reset to zero. Any other character is copied unchanged and the\n current column is incremented by one regardless of how the\n character is represented when printed.\n\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs()\n \'01 012 0123 01234\'\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs(4)\n \'01 012 0123 01234\'\n\nstr.find(sub[, start[, end]])\n\n Return the lowest index in the string where substring *sub* is\n found, such that *sub* is contained in the slice "s[start:end]".\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return "-1" if *sub* is not found.\n\n Note: The "find()" method should be used only if you need to know\n the position of *sub*. To check if *sub* is a substring or not,\n use the "in" operator:\n\n >>> \'Py\' in \'Python\'\n True\n\nstr.format(*args, **kwargs)\n\n Perform a string formatting operation. The string on which this\n method is called can contain literal text or replacement fields\n delimited by braces "{}". Each replacement field contains either\n the numeric index of a positional argument, or the name of a\n keyword argument. Returns a copy of the string where each\n replacement field is replaced with the string value of the\n corresponding argument.\n\n >>> "The sum of 1 + 2 is {0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\n See *Format String Syntax* for a description of the various\n formatting options that can be specified in format strings.\n\nstr.format_map(mapping)\n\n Similar to "str.format(**mapping)", except that "mapping" is used\n directly and not copied to a "dict". This is useful if for example\n "mapping" is a dict subclass:\n\n >>> class Default(dict):\n ... def __missing__(self, key):\n ... return key\n ...\n >>> \'{name} was born in {country}\'.format_map(Default(name=\'Guido\'))\n \'Guido was born in country\'\n\n New in version 3.2.\n\nstr.index(sub[, start[, end]])\n\n Like "find()", but raise "ValueError" when the substring is not\n found.\n\nstr.isalnum()\n\n Return true if all characters in the string are alphanumeric and\n there is at least one character, false otherwise. A character "c"\n is alphanumeric if one of the following returns "True":\n "c.isalpha()", "c.isdecimal()", "c.isdigit()", or "c.isnumeric()".\n\nstr.isalpha()\n\n Return true if all characters in the string are alphabetic and\n there is at least one character, false otherwise. Alphabetic\n characters are those characters defined in the Unicode character\n database as "Letter", i.e., those with general category property\n being one of "Lm", "Lt", "Lu", "Ll", or "Lo". Note that this is\n different from the "Alphabetic" property defined in the Unicode\n Standard.\n\nstr.isdecimal()\n\n Return true if all characters in the string are decimal characters\n and there is at least one character, false otherwise. Decimal\n characters are those from general category "Nd". This category\n includes digit characters, and all characters that can be used to\n form decimal-radix numbers, e.g. U+0660, ARABIC-INDIC DIGIT ZERO.\n\nstr.isdigit()\n\n Return true if all characters in the string are digits and there is\n at least one character, false otherwise. Digits include decimal\n characters and digits that need special handling, such as the\n compatibility superscript digits. Formally, a digit is a character\n that has the property value Numeric_Type=Digit or\n Numeric_Type=Decimal.\n\nstr.isidentifier()\n\n Return true if the string is a valid identifier according to the\n language definition, section *Identifiers and keywords*.\n\n Use "keyword.iskeyword()" to test for reserved identifiers such as\n "def" and "class".\n\nstr.islower()\n\n Return true if all cased characters [4] in the string are lowercase\n and there is at least one cased character, false otherwise.\n\nstr.isnumeric()\n\n Return true if all characters in the string are numeric characters,\n and there is at least one character, false otherwise. Numeric\n characters include digit characters, and all characters that have\n the Unicode numeric value property, e.g. U+2155, VULGAR FRACTION\n ONE FIFTH. Formally, numeric characters are those with the\n property value Numeric_Type=Digit, Numeric_Type=Decimal or\n Numeric_Type=Numeric.\n\nstr.isprintable()\n\n Return true if all characters in the string are printable or the\n string is empty, false otherwise. Nonprintable characters are\n those characters defined in the Unicode character database as\n "Other" or "Separator", excepting the ASCII space (0x20) which is\n considered printable. (Note that printable characters in this\n context are those which should not be escaped when "repr()" is\n invoked on a string. It has no bearing on the handling of strings\n written to "sys.stdout" or "sys.stderr".)\n\nstr.isspace()\n\n Return true if there are only whitespace characters in the string\n and there is at least one character, false otherwise. Whitespace\n characters are those characters defined in the Unicode character\n database as "Other" or "Separator" and those with bidirectional\n property being one of "WS", "B", or "S".\n\nstr.istitle()\n\n Return true if the string is a titlecased string and there is at\n least one character, for example uppercase characters may only\n follow uncased characters and lowercase characters only cased ones.\n Return false otherwise.\n\nstr.isupper()\n\n Return true if all cased characters [4] in the string are uppercase\n and there is at least one cased character, false otherwise.\n\nstr.join(iterable)\n\n Return a string which is the concatenation of the strings in the\n *iterable* *iterable*. A "TypeError" will be raised if there are\n any non-string values in *iterable*, including "bytes" objects.\n The separator between elements is the string providing this method.\n\nstr.ljust(width[, fillchar])\n\n Return the string left justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is an ASCII\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\nstr.lower()\n\n Return a copy of the string with all the cased characters [4]\n converted to lowercase.\n\n The lowercasing algorithm used is described in section 3.13 of the\n Unicode Standard.\n\nstr.lstrip([chars])\n\n Return a copy of the string with leading characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a prefix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.lstrip()\n \'spacious \'\n >>> \'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\nstatic str.maketrans(x[, y[, z]])\n\n This static method returns a translation table usable for\n "str.translate()".\n\n If there is only one argument, it must be a dictionary mapping\n Unicode ordinals (integers) or characters (strings of length 1) to\n Unicode ordinals, strings (of arbitrary lengths) or None.\n Character keys will then be converted to ordinals.\n\n If there are two arguments, they must be strings of equal length,\n and in the resulting dictionary, each character in x will be mapped\n to the character at the same position in y. If there is a third\n argument, it must be a string, whose characters will be mapped to\n None in the result.\n\nstr.partition(sep)\n\n Split the string at the first occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing the string itself, followed by\n two empty strings.\n\nstr.replace(old, new[, count])\n\n Return a copy of the string with all occurrences of substring *old*\n replaced by *new*. If the optional argument *count* is given, only\n the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n Return the highest index in the string where substring *sub* is\n found, such that *sub* is contained within "s[start:end]".\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return "-1" on failure.\n\nstr.rindex(sub[, start[, end]])\n\n Like "rfind()" but raises "ValueError" when the substring *sub* is\n not found.\n\nstr.rjust(width[, fillchar])\n\n Return the string right justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is an ASCII\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\nstr.rpartition(sep)\n\n Split the string at the last occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing two empty strings, followed by\n the string itself.\n\nstr.rsplit(sep=None, maxsplit=-1)\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n are done, the *rightmost* ones. If *sep* is not specified or\n "None", any whitespace string is a separator. Except for splitting\n from the right, "rsplit()" behaves like "split()" which is\n described in detail below.\n\nstr.rstrip([chars])\n\n Return a copy of the string with trailing characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a suffix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.rstrip()\n \' spacious\'\n >>> \'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\nstr.split(sep=None, maxsplit=-1)\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit*\n splits are done (thus, the list will have at most "maxsplit+1"\n elements). If *maxsplit* is not specified or "-1", then there is\n no limit on the number of splits (all possible splits are made).\n\n If *sep* is given, consecutive delimiters are not grouped together\n and are deemed to delimit empty strings (for example,\n "\'1,,2\'.split(\',\')" returns "[\'1\', \'\', \'2\']"). The *sep* argument\n may consist of multiple characters (for example,\n "\'1<>2<>3\'.split(\'<>\')" returns "[\'1\', \'2\', \'3\']"). Splitting an\n empty string with a specified separator returns "[\'\']".\n\n For example:\n\n >>> \'1,2,3\'.split(\',\')\n [\'1\', \'2\', \'3\']\n >>> \'1,2,3\'.split(\',\', maxsplit=1)\n [\'1\', \'2,3\']\n >>> \'1,2,,3,\'.split(\',\')\n [\'1\', \'2\', \'\', \'3\', \'\']\n\n If *sep* is not specified or is "None", a different splitting\n algorithm is applied: runs of consecutive whitespace are regarded\n as a single separator, and the result will contain no empty strings\n at the start or end if the string has leading or trailing\n whitespace. Consequently, splitting an empty string or a string\n consisting of just whitespace with a "None" separator returns "[]".\n\n For example:\n\n >>> \'1 2 3\'.split()\n [\'1\', \'2\', \'3\']\n >>> \'1 2 3\'.split(maxsplit=1)\n [\'1\', \'2 3\']\n >>> \' 1 2 3 \'.split()\n [\'1\', \'2\', \'3\']\n\nstr.splitlines([keepends])\n\n Return a list of the lines in the string, breaking at line\n boundaries. Line breaks are not included in the resulting list\n unless *keepends* is given and true.\n\n This method splits on the following line boundaries. In\n particular, the boundaries are a superset of *universal newlines*.\n\n +-------------------------+-------------------------------+\n | Representation | Description |\n +=========================+===============================+\n | "\\n" | Line Feed |\n +-------------------------+-------------------------------+\n | "\\r" | Carriage Return |\n +-------------------------+-------------------------------+\n | "\\r\\n" | Carriage Return + Line Feed |\n +-------------------------+-------------------------------+\n | "\\v" or "\\x0b" | Line Tabulation |\n +-------------------------+-------------------------------+\n | "\\f" or "\\x0c" | Form Feed |\n +-------------------------+-------------------------------+\n | "\\x1c" | File Separator |\n +-------------------------+-------------------------------+\n | "\\x1d" | Group Separator |\n +-------------------------+-------------------------------+\n | "\\x1e" | Record Separator |\n +-------------------------+-------------------------------+\n | "\\x85" | Next Line (C1 Control Code) |\n +-------------------------+-------------------------------+\n | "\\u2028" | Line Separator |\n +-------------------------+-------------------------------+\n | "\\u2029" | Paragraph Separator |\n +-------------------------+-------------------------------+\n\n Changed in version 3.2: "\\v" and "\\f" added to list of line\n boundaries.\n\n For example:\n\n >>> \'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines()\n [\'ab c\', \'\', \'de fg\', \'kl\']\n >>> \'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines(keepends=True)\n [\'ab c\\n\', \'\\n\', \'de fg\\r\', \'kl\\r\\n\']\n\n Unlike "split()" when a delimiter string *sep* is given, this\n method returns an empty list for the empty string, and a terminal\n line break does not result in an extra line:\n\n >>> "".splitlines()\n []\n >>> "One line\\n".splitlines()\n [\'One line\']\n\n For comparison, "split(\'\\n\')" gives:\n\n >>> \'\'.split(\'\\n\')\n [\'\']\n >>> \'Two lines\\n\'.split(\'\\n\')\n [\'Two lines\', \'\']\n\nstr.startswith(prefix[, start[, end]])\n\n Return "True" if string starts with the *prefix*, otherwise return\n "False". *prefix* can also be a tuple of prefixes to look for.\n With optional *start*, test string beginning at that position.\n With optional *end*, stop comparing string at that position.\n\nstr.strip([chars])\n\n Return a copy of the string with the leading and trailing\n characters removed. The *chars* argument is a string specifying the\n set of characters to be removed. If omitted or "None", the *chars*\n argument defaults to removing whitespace. The *chars* argument is\n not a prefix or suffix; rather, all combinations of its values are\n stripped:\n\n >>> \' spacious \'.strip()\n \'spacious\'\n >>> \'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\n The outermost leading and trailing *chars* argument values are\n stripped from the string. Characters are removed from the leading\n end until reaching a string character that is not contained in the\n set of characters in *chars*. A similar action takes place on the\n trailing end. For example:\n\n >>> comment_string = \'#....... Section 3.2.1 Issue #32 .......\'\n >>> comment_string.strip(\'.#! \')\n \'Section 3.2.1 Issue #32\'\n\nstr.swapcase()\n\n Return a copy of the string with uppercase characters converted to\n lowercase and vice versa. Note that it is not necessarily true that\n "s.swapcase().swapcase() == s".\n\nstr.title()\n\n Return a titlecased version of the string where words start with an\n uppercase character and the remaining characters are lowercase.\n\n For example:\n\n >>> \'Hello world\'.title()\n \'Hello World\'\n\n The algorithm uses a simple language-independent definition of a\n word as groups of consecutive letters. The definition works in\n many contexts but it means that apostrophes in contractions and\n possessives form word boundaries, which may not be the desired\n result:\n\n >>> "they\'re bill\'s friends from the UK".title()\n "They\'Re Bill\'S Friends From The Uk"\n\n A workaround for apostrophes can be constructed using regular\n expressions:\n\n >>> import re\n >>> def titlecase(s):\n ... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n ... lambda mo: mo.group(0)[0].upper() +\n ... mo.group(0)[1:].lower(),\n ... s)\n ...\n >>> titlecase("they\'re bill\'s friends.")\n "They\'re Bill\'s Friends."\n\nstr.translate(table)\n\n Return a copy of the string in which each character has been mapped\n through the given translation table. The table must be an object\n that implements indexing via "__getitem__()", typically a *mapping*\n or *sequence*. When indexed by a Unicode ordinal (an integer), the\n table object can do any of the following: return a Unicode ordinal\n or a string, to map the character to one or more other characters;\n return "None", to delete the character from the return string; or\n raise a "LookupError" exception, to map the character to itself.\n\n You can use "str.maketrans()" to create a translation map from\n character-to-character mappings in different formats.\n\n See also the "codecs" module for a more flexible approach to custom\n character mappings.\n\nstr.upper()\n\n Return a copy of the string with all the cased characters [4]\n converted to uppercase. Note that "str.upper().isupper()" might be\n "False" if "s" contains uncased characters or if the Unicode\n category of the resulting character(s) is not "Lu" (Letter,\n uppercase), but e.g. "Lt" (Letter, titlecase).\n\n The uppercasing algorithm used is described in section 3.13 of the\n Unicode Standard.\n\nstr.zfill(width)\n\n Return a copy of the string left filled with ASCII "\'0\'" digits to\n make a string of length *width*. A leading sign prefix\n ("\'+\'"/"\'-\'") is handled by inserting the padding *after* the sign\n character rather than before. The original string is returned if\n *width* is less than or equal to "len(s)".\n\n For example:\n\n >>> "42".zfill(5)\n \'00042\'\n >>> "-42".zfill(5)\n \'-0042\'\n', - 'strings': u'\nString and Bytes literals\n*************************\n\nString literals are described by the following lexical definitions:\n\n stringliteral ::= [stringprefix](shortstring | longstring)\n stringprefix ::= "r" | "u" | "R" | "U"\n shortstring ::= "\'" shortstringitem* "\'" | \'"\' shortstringitem* \'"\'\n longstring ::= "\'\'\'" longstringitem* "\'\'\'" | \'"""\' longstringitem* \'"""\'\n shortstringitem ::= shortstringchar | stringescapeseq\n longstringitem ::= longstringchar | stringescapeseq\n shortstringchar ::= \n longstringchar ::= \n stringescapeseq ::= "\\" \n\n bytesliteral ::= bytesprefix(shortbytes | longbytes)\n bytesprefix ::= "b" | "B" | "br" | "Br" | "bR" | "BR" | "rb" | "rB" | "Rb" | "RB"\n shortbytes ::= "\'" shortbytesitem* "\'" | \'"\' shortbytesitem* \'"\'\n longbytes ::= "\'\'\'" longbytesitem* "\'\'\'" | \'"""\' longbytesitem* \'"""\'\n shortbytesitem ::= shortbyteschar | bytesescapeseq\n longbytesitem ::= longbyteschar | bytesescapeseq\n shortbyteschar ::= \n longbyteschar ::= \n bytesescapeseq ::= "\\" \n\nOne syntactic restriction not indicated by these productions is that\nwhitespace is not allowed between the "stringprefix" or "bytesprefix"\nand the rest of the literal. The source character set is defined by\nthe encoding declaration; it is UTF-8 if no encoding declaration is\ngiven in the source file; see section *Encoding declarations*.\n\nIn plain English: Both types of literals can be enclosed in matching\nsingle quotes ("\'") or double quotes ("""). They can also be enclosed\nin matching groups of three single or double quotes (these are\ngenerally referred to as *triple-quoted strings*). The backslash\n("\\") character is used to escape characters that otherwise have a\nspecial meaning, such as newline, backslash itself, or the quote\ncharacter.\n\nBytes literals are always prefixed with "\'b\'" or "\'B\'"; they produce\nan instance of the "bytes" type instead of the "str" type. They may\nonly contain ASCII characters; bytes with a numeric value of 128 or\ngreater must be expressed with escapes.\n\nAs of Python 3.3 it is possible again to prefix string literals with a\n"u" prefix to simplify maintenance of dual 2.x and 3.x codebases.\n\nBoth string and bytes literals may optionally be prefixed with a\nletter "\'r\'" or "\'R\'"; such strings are called *raw strings* and treat\nbackslashes as literal characters. As a result, in string literals,\n"\'\\U\'" and "\'\\u\'" escapes in raw strings are not treated specially.\nGiven that Python 2.x\'s raw unicode literals behave differently than\nPython 3.x\'s the "\'ur\'" syntax is not supported.\n\nNew in version 3.3: The "\'rb\'" prefix of raw bytes literals has been\nadded as a synonym of "\'br\'".\n\nNew in version 3.3: Support for the unicode legacy literal\n("u\'value\'") was reintroduced to simplify the maintenance of dual\nPython 2.x and 3.x codebases. See **PEP 414** for more information.\n\nIn triple-quoted literals, unescaped newlines and quotes are allowed\n(and are retained), except that three unescaped quotes in a row\nterminate the literal. (A "quote" is the character used to open the\nliteral, i.e. either "\'" or """.)\n\nUnless an "\'r\'" or "\'R\'" prefix is present, escape sequences in string\nand bytes literals are interpreted according to rules similar to those\nused by Standard C. The recognized escape sequences are:\n\n+-------------------+-----------------------------------+---------+\n| Escape Sequence | Meaning | Notes |\n+===================+===================================+=========+\n| "\\newline" | Backslash and newline ignored | |\n+-------------------+-----------------------------------+---------+\n| "\\\\" | Backslash ("\\") | |\n+-------------------+-----------------------------------+---------+\n| "\\\'" | Single quote ("\'") | |\n+-------------------+-----------------------------------+---------+\n| "\\"" | Double quote (""") | |\n+-------------------+-----------------------------------+---------+\n| "\\a" | ASCII Bell (BEL) | |\n+-------------------+-----------------------------------+---------+\n| "\\b" | ASCII Backspace (BS) | |\n+-------------------+-----------------------------------+---------+\n| "\\f" | ASCII Formfeed (FF) | |\n+-------------------+-----------------------------------+---------+\n| "\\n" | ASCII Linefeed (LF) | |\n+-------------------+-----------------------------------+---------+\n| "\\r" | ASCII Carriage Return (CR) | |\n+-------------------+-----------------------------------+---------+\n| "\\t" | ASCII Horizontal Tab (TAB) | |\n+-------------------+-----------------------------------+---------+\n| "\\v" | ASCII Vertical Tab (VT) | |\n+-------------------+-----------------------------------+---------+\n| "\\ooo" | Character with octal value *ooo* | (1,3) |\n+-------------------+-----------------------------------+---------+\n| "\\xhh" | Character with hex value *hh* | (2,3) |\n+-------------------+-----------------------------------+---------+\n\nEscape sequences only recognized in string literals are:\n\n+-------------------+-----------------------------------+---------+\n| Escape Sequence | Meaning | Notes |\n+===================+===================================+=========+\n| "\\N{name}" | Character named *name* in the | (4) |\n| | Unicode database | |\n+-------------------+-----------------------------------+---------+\n| "\\uxxxx" | Character with 16-bit hex value | (5) |\n| | *xxxx* | |\n+-------------------+-----------------------------------+---------+\n| "\\Uxxxxxxxx" | Character with 32-bit hex value | (6) |\n| | *xxxxxxxx* | |\n+-------------------+-----------------------------------+---------+\n\nNotes:\n\n1. As in Standard C, up to three octal digits are accepted.\n\n2. Unlike in Standard C, exactly two hex digits are required.\n\n3. In a bytes literal, hexadecimal and octal escapes denote the\n byte with the given value. In a string literal, these escapes\n denote a Unicode character with the given value.\n\n4. Changed in version 3.3: Support for name aliases [1] has been\n added.\n\n5. Individual code units which form parts of a surrogate pair can\n be encoded using this escape sequence. Exactly four hex digits are\n required.\n\n6. Any Unicode character can be encoded this way. Exactly eight\n hex digits are required.\n\nUnlike Standard C, all unrecognized escape sequences are left in the\nstring unchanged, i.e., *the backslash is left in the result*. (This\nbehavior is useful when debugging: if an escape sequence is mistyped,\nthe resulting output is more easily recognized as broken.) It is also\nimportant to note that the escape sequences only recognized in string\nliterals fall into the category of unrecognized escapes for bytes\nliterals.\n\nEven in a raw literal, quotes can be escaped with a backslash, but the\nbackslash remains in the result; for example, "r"\\""" is a valid\nstring literal consisting of two characters: a backslash and a double\nquote; "r"\\"" is not a valid string literal (even a raw string cannot\nend in an odd number of backslashes). Specifically, *a raw literal\ncannot end in a single backslash* (since the backslash would escape\nthe following quote character). Note also that a single backslash\nfollowed by a newline is interpreted as those two characters as part\nof the literal, *not* as a line continuation.\n', + 'specialnames': u'\nSpecial method names\n********************\n\nA class can implement certain operations that are invoked by special\nsyntax (such as arithmetic operations or subscripting and slicing) by\ndefining methods with special names. This is Python\'s approach to\n*operator overloading*, allowing classes to define their own behavior\nwith respect to language operators. For instance, if a class defines\na method named "__getitem__()", and "x" is an instance of this class,\nthen "x[i]" is roughly equivalent to "type(x).__getitem__(x, i)".\nExcept where mentioned, attempts to execute an operation raise an\nexception when no appropriate method is defined (typically\n"AttributeError" or "TypeError").\n\nWhen implementing a class that emulates any built-in type, it is\nimportant that the emulation only be implemented to the degree that it\nmakes sense for the object being modelled. For example, some\nsequences may work well with retrieval of individual elements, but\nextracting a slice may not make sense. (One example of this is the\n"NodeList" interface in the W3C\'s Document Object Model.)\n\n\nBasic customization\n===================\n\nobject.__new__(cls[, ...])\n\n Called to create a new instance of class *cls*. "__new__()" is a\n static method (special-cased so you need not declare it as such)\n that takes the class of which an instance was requested as its\n first argument. The remaining arguments are those passed to the\n object constructor expression (the call to the class). The return\n value of "__new__()" should be the new object instance (usually an\n instance of *cls*).\n\n Typical implementations create a new instance of the class by\n invoking the superclass\'s "__new__()" method using\n "super(currentclass, cls).__new__(cls[, ...])" with appropriate\n arguments and then modifying the newly-created instance as\n necessary before returning it.\n\n If "__new__()" returns an instance of *cls*, then the new\n instance\'s "__init__()" method will be invoked like\n "__init__(self[, ...])", where *self* is the new instance and the\n remaining arguments are the same as were passed to "__new__()".\n\n If "__new__()" does not return an instance of *cls*, then the new\n instance\'s "__init__()" method will not be invoked.\n\n "__new__()" is intended mainly to allow subclasses of immutable\n types (like int, str, or tuple) to customize instance creation. It\n is also commonly overridden in custom metaclasses in order to\n customize class creation.\n\nobject.__init__(self[, ...])\n\n Called after the instance has been created (by "__new__()"), but\n before it is returned to the caller. The arguments are those\n passed to the class constructor expression. If a base class has an\n "__init__()" method, the derived class\'s "__init__()" method, if\n any, must explicitly call it to ensure proper initialization of the\n base class part of the instance; for example:\n "BaseClass.__init__(self, [args...])".\n\n Because "__new__()" and "__init__()" work together in constructing\n objects ("__new__()" to create it, and "__init__()" to customise\n it), no non-"None" value may be returned by "__init__()"; doing so\n will cause a "TypeError" to be raised at runtime.\n\nobject.__del__(self)\n\n Called when the instance is about to be destroyed. This is also\n called a destructor. If a base class has a "__del__()" method, the\n derived class\'s "__del__()" method, if any, must explicitly call it\n to ensure proper deletion of the base class part of the instance.\n Note that it is possible (though not recommended!) for the\n "__del__()" method to postpone destruction of the instance by\n creating a new reference to it. It may then be called at a later\n time when this new reference is deleted. It is not guaranteed that\n "__del__()" methods are called for objects that still exist when\n the interpreter exits.\n\n Note: "del x" doesn\'t directly call "x.__del__()" --- the former\n decrements the reference count for "x" by one, and the latter is\n only called when "x"\'s reference count reaches zero. Some common\n situations that may prevent the reference count of an object from\n going to zero include: circular references between objects (e.g.,\n a doubly-linked list or a tree data structure with parent and\n child pointers); a reference to the object on the stack frame of\n a function that caught an exception (the traceback stored in\n "sys.exc_info()[2]" keeps the stack frame alive); or a reference\n to the object on the stack frame that raised an unhandled\n exception in interactive mode (the traceback stored in\n "sys.last_traceback" keeps the stack frame alive). The first\n situation can only be remedied by explicitly breaking the cycles;\n the second can be resolved by freeing the reference to the\n traceback object when it is no longer useful, and the third can\n be resolved by storing "None" in "sys.last_traceback". Circular\n references which are garbage are detected and cleaned up when the\n cyclic garbage collector is enabled (it\'s on by default). Refer\n to the documentation for the "gc" module for more information\n about this topic.\n\n Warning: Due to the precarious circumstances under which\n "__del__()" methods are invoked, exceptions that occur during\n their execution are ignored, and a warning is printed to\n "sys.stderr" instead. Also, when "__del__()" is invoked in\n response to a module being deleted (e.g., when execution of the\n program is done), other globals referenced by the "__del__()"\n method may already have been deleted or in the process of being\n torn down (e.g. the import machinery shutting down). For this\n reason, "__del__()" methods should do the absolute minimum needed\n to maintain external invariants. Starting with version 1.5,\n Python guarantees that globals whose name begins with a single\n underscore are deleted from their module before other globals are\n deleted; if no other references to such globals exist, this may\n help in assuring that imported modules are still available at the\n time when the "__del__()" method is called.\n\nobject.__repr__(self)\n\n Called by the "repr()" built-in function to compute the "official"\n string representation of an object. If at all possible, this\n should look like a valid Python expression that could be used to\n recreate an object with the same value (given an appropriate\n environment). If this is not possible, a string of the form\n "<...some useful description...>" should be returned. The return\n value must be a string object. If a class defines "__repr__()" but\n not "__str__()", then "__repr__()" is also used when an "informal"\n string representation of instances of that class is required.\n\n This is typically used for debugging, so it is important that the\n representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n Called by "str(object)" and the built-in functions "format()" and\n "print()" to compute the "informal" or nicely printable string\n representation of an object. The return value must be a *string*\n object.\n\n This method differs from "object.__repr__()" in that there is no\n expectation that "__str__()" return a valid Python expression: a\n more convenient or concise representation can be used.\n\n The default implementation defined by the built-in type "object"\n calls "object.__repr__()".\n\nobject.__bytes__(self)\n\n Called by "bytes()" to compute a byte-string representation of an\n object. This should return a "bytes" object.\n\nobject.__format__(self, format_spec)\n\n Called by the "format()" built-in function (and by extension, the\n "str.format()" method of class "str") to produce a "formatted"\n string representation of an object. The "format_spec" argument is a\n string that contains a description of the formatting options\n desired. The interpretation of the "format_spec" argument is up to\n the type implementing "__format__()", however most classes will\n either delegate formatting to one of the built-in types, or use a\n similar formatting option syntax.\n\n See *Format Specification Mini-Language* for a description of the\n standard formatting syntax.\n\n The return value must be a string object.\n\n Changed in version 3.4: The __format__ method of "object" itself\n raises a "TypeError" if passed any non-empty string.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n These are the so-called "rich comparison" methods. The\n correspondence between operator symbols and method names is as\n follows: "xy" calls\n "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n\n A rich comparison method may return the singleton "NotImplemented"\n if it does not implement the operation for a given pair of\n arguments. By convention, "False" and "True" are returned for a\n successful comparison. However, these methods can return any value,\n so if the comparison operator is used in a Boolean context (e.g.,\n in the condition of an "if" statement), Python will call "bool()"\n on the value to determine if the result is true or false.\n\n By default, "__ne__()" delegates to "__eq__()" and inverts the\n result unless it is "NotImplemented". There are no other implied\n relationships among the comparison operators, for example, the\n truth of "(x.__hash__".\n\n If a class that does not override "__eq__()" wishes to suppress\n hash support, it should include "__hash__ = None" in the class\n definition. A class which defines its own "__hash__()" that\n explicitly raises a "TypeError" would be incorrectly identified as\n hashable by an "isinstance(obj, collections.Hashable)" call.\n\n Note: By default, the "__hash__()" values of str, bytes and\n datetime objects are "salted" with an unpredictable random value.\n Although they remain constant within an individual Python\n process, they are not predictable between repeated invocations of\n Python.This is intended to provide protection against a denial-\n of-service caused by carefully-chosen inputs that exploit the\n worst case performance of a dict insertion, O(n^2) complexity.\n See http://www.ocert.org/advisories/ocert-2011-003.html for\n details.Changing hash values affects the iteration order of\n dicts, sets and other mappings. Python has never made guarantees\n about this ordering (and it typically varies between 32-bit and\n 64-bit builds).See also "PYTHONHASHSEED".\n\n Changed in version 3.3: Hash randomization is enabled by default.\n\nobject.__bool__(self)\n\n Called to implement truth value testing and the built-in operation\n "bool()"; should return "False" or "True". When this method is not\n defined, "__len__()" is called, if it is defined, and the object is\n considered true if its result is nonzero. If a class defines\n neither "__len__()" nor "__bool__()", all its instances are\n considered true.\n\n\nCustomizing attribute access\n============================\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of "x.name") for\nclass instances.\n\nobject.__getattr__(self, name)\n\n Called when an attribute lookup has not found the attribute in the\n usual places (i.e. it is not an instance attribute nor is it found\n in the class tree for "self"). "name" is the attribute name. This\n method should return the (computed) attribute value or raise an\n "AttributeError" exception.\n\n Note that if the attribute is found through the normal mechanism,\n "__getattr__()" is not called. (This is an intentional asymmetry\n between "__getattr__()" and "__setattr__()".) This is done both for\n efficiency reasons and because otherwise "__getattr__()" would have\n no way to access other attributes of the instance. Note that at\n least for instance variables, you can fake total control by not\n inserting any values in the instance attribute dictionary (but\n instead inserting them in another object). See the\n "__getattribute__()" method below for a way to actually get total\n control over attribute access.\n\nobject.__getattribute__(self, name)\n\n Called unconditionally to implement attribute accesses for\n instances of the class. If the class also defines "__getattr__()",\n the latter will not be called unless "__getattribute__()" either\n calls it explicitly or raises an "AttributeError". This method\n should return the (computed) attribute value or raise an\n "AttributeError" exception. In order to avoid infinite recursion in\n this method, its implementation should always call the base class\n method with the same name to access any attributes it needs, for\n example, "object.__getattribute__(self, name)".\n\n Note: This method may still be bypassed when looking up special\n methods as the result of implicit invocation via language syntax\n or built-in functions. See *Special method lookup*.\n\nobject.__setattr__(self, name, value)\n\n Called when an attribute assignment is attempted. This is called\n instead of the normal mechanism (i.e. store the value in the\n instance dictionary). *name* is the attribute name, *value* is the\n value to be assigned to it.\n\n If "__setattr__()" wants to assign to an instance attribute, it\n should call the base class method with the same name, for example,\n "object.__setattr__(self, name, value)".\n\nobject.__delattr__(self, name)\n\n Like "__setattr__()" but for attribute deletion instead of\n assignment. This should only be implemented if "del obj.name" is\n meaningful for the object.\n\nobject.__dir__(self)\n\n Called when "dir()" is called on the object. A sequence must be\n returned. "dir()" converts the returned sequence to a list and\n sorts it.\n\n\nImplementing Descriptors\n------------------------\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in an\n*owner* class (the descriptor must be in either the owner\'s class\ndictionary or in the class dictionary for one of its parents). In the\nexamples below, "the attribute" refers to the attribute whose name is\nthe key of the property in the owner class\' "__dict__".\n\nobject.__get__(self, instance, owner)\n\n Called to get the attribute of the owner class (class attribute\n access) or of an instance of that class (instance attribute\n access). *owner* is always the owner class, while *instance* is the\n instance that the attribute was accessed through, or "None" when\n the attribute is accessed through the *owner*. This method should\n return the (computed) attribute value or raise an "AttributeError"\n exception.\n\nobject.__set__(self, instance, value)\n\n Called to set the attribute on an instance *instance* of the owner\n class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n Called to delete the attribute on an instance *instance* of the\n owner class.\n\nThe attribute "__objclass__" is interpreted by the "inspect" module as\nspecifying the class where this object was defined (setting this\nappropriately can assist in runtime introspection of dynamic class\nattributes). For callables, it may indicate that an instance of the\ngiven type (or a subclass) is expected or required as the first\npositional argument (for example, CPython sets this attribute for\nunbound methods that are implemented in C).\n\n\nInvoking Descriptors\n--------------------\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol: "__get__()", "__set__()", and\n"__delete__()". If any of those methods are defined for an object, it\nis said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, "a.x" has a\nlookup chain starting with "a.__dict__[\'x\']", then\n"type(a).__dict__[\'x\']", and continuing through the base classes of\n"type(a)" excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead. Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called.\n\nThe starting point for descriptor invocation is a binding, "a.x". How\nthe arguments are assembled depends on "a":\n\nDirect Call\n The simplest and least common call is when user code directly\n invokes a descriptor method: "x.__get__(a)".\n\nInstance Binding\n If binding to an object instance, "a.x" is transformed into the\n call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n\nClass Binding\n If binding to a class, "A.x" is transformed into the call:\n "A.__dict__[\'x\'].__get__(None, A)".\n\nSuper Binding\n If "a" is an instance of "super", then the binding "super(B,\n obj).m()" searches "obj.__class__.__mro__" for the base class "A"\n immediately preceding "B" and then invokes the descriptor with the\n call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined. A descriptor can define\nany combination of "__get__()", "__set__()" and "__delete__()". If it\ndoes not define "__get__()", then accessing the attribute will return\nthe descriptor object itself unless there is a value in the object\'s\ninstance dictionary. If the descriptor defines "__set__()" and/or\n"__delete__()", it is a data descriptor; if it defines neither, it is\na non-data descriptor. Normally, data descriptors define both\n"__get__()" and "__set__()", while non-data descriptors have just the\n"__get__()" method. Data descriptors with "__set__()" and "__get__()"\ndefined always override a redefinition in an instance dictionary. In\ncontrast, non-data descriptors can be overridden by instances.\n\nPython methods (including "staticmethod()" and "classmethod()") are\nimplemented as non-data descriptors. Accordingly, instances can\nredefine and override methods. This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe "property()" function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n---------\n\nBy default, instances of classes have a dictionary for attribute\nstorage. This wastes space for objects having very few instance\nvariables. The space consumption can become acute when creating large\nnumbers of instances.\n\nThe default can be overridden by defining *__slots__* in a class\ndefinition. The *__slots__* declaration takes a sequence of instance\nvariables and reserves just enough space in each instance to hold a\nvalue for each variable. Space is saved because *__dict__* is not\ncreated for each instance.\n\nobject.__slots__\n\n This class variable can be assigned a string, iterable, or sequence\n of strings with variable names used by instances. *__slots__*\n reserves space for the declared variables and prevents the\n automatic creation of *__dict__* and *__weakref__* for each\n instance.\n\n\nNotes on using *__slots__*\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n* When inheriting from a class without *__slots__*, the *__dict__*\n attribute of that class will always be accessible, so a *__slots__*\n definition in the subclass is meaningless.\n\n* Without a *__dict__* variable, instances cannot be assigned new\n variables not listed in the *__slots__* definition. Attempts to\n assign to an unlisted variable name raises "AttributeError". If\n dynamic assignment of new variables is desired, then add\n "\'__dict__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n* Without a *__weakref__* variable for each instance, classes\n defining *__slots__* do not support weak references to its\n instances. If weak reference support is needed, then add\n "\'__weakref__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n* *__slots__* are implemented at the class level by creating\n descriptors (*Implementing Descriptors*) for each variable name. As\n a result, class attributes cannot be used to set default values for\n instance variables defined by *__slots__*; otherwise, the class\n attribute would overwrite the descriptor assignment.\n\n* The action of a *__slots__* declaration is limited to the class\n where it is defined. As a result, subclasses will have a *__dict__*\n unless they also define *__slots__* (which must only contain names\n of any *additional* slots).\n\n* If a class defines a slot also defined in a base class, the\n instance variable defined by the base class slot is inaccessible\n (except by retrieving its descriptor directly from the base class).\n This renders the meaning of the program undefined. In the future, a\n check may be added to prevent this.\n\n* Nonempty *__slots__* does not work for classes derived from\n "variable-length" built-in types such as "int", "bytes" and "tuple".\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings\n may also be used; however, in the future, special meaning may be\n assigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n *__slots__*.\n\n\nCustomizing class creation\n==========================\n\nBy default, classes are constructed using "type()". The class body is\nexecuted in a new namespace and the class name is bound locally to the\nresult of "type(name, bases, namespace)".\n\nThe class creation process can be customised by passing the\n"metaclass" keyword argument in the class definition line, or by\ninheriting from an existing class that included such an argument. In\nthe following example, both "MyClass" and "MySubclass" are instances\nof "Meta":\n\n class Meta(type):\n pass\n\n class MyClass(metaclass=Meta):\n pass\n\n class MySubclass(MyClass):\n pass\n\nAny other keyword arguments that are specified in the class definition\nare passed through to all metaclass operations described below.\n\nWhen a class definition is executed, the following steps occur:\n\n* the appropriate metaclass is determined\n\n* the class namespace is prepared\n\n* the class body is executed\n\n* the class object is created\n\n\nDetermining the appropriate metaclass\n-------------------------------------\n\nThe appropriate metaclass for a class definition is determined as\nfollows:\n\n* if no bases and no explicit metaclass are given, then "type()" is\n used\n\n* if an explicit metaclass is given and it is *not* an instance of\n "type()", then it is used directly as the metaclass\n\n* if an instance of "type()" is given as the explicit metaclass, or\n bases are defined, then the most derived metaclass is used\n\nThe most derived metaclass is selected from the explicitly specified\nmetaclass (if any) and the metaclasses (i.e. "type(cls)") of all\nspecified base classes. The most derived metaclass is one which is a\nsubtype of *all* of these candidate metaclasses. If none of the\ncandidate metaclasses meets that criterion, then the class definition\nwill fail with "TypeError".\n\n\nPreparing the class namespace\n-----------------------------\n\nOnce the appropriate metaclass has been identified, then the class\nnamespace is prepared. If the metaclass has a "__prepare__" attribute,\nit is called as "namespace = metaclass.__prepare__(name, bases,\n**kwds)" (where the additional keyword arguments, if any, come from\nthe class definition).\n\nIf the metaclass has no "__prepare__" attribute, then the class\nnamespace is initialised as an empty "dict()" instance.\n\nSee also: **PEP 3115** - Metaclasses in Python 3000\n\n Introduced the "__prepare__" namespace hook\n\n\nExecuting the class body\n------------------------\n\nThe class body is executed (approximately) as "exec(body, globals(),\nnamespace)". The key difference from a normal call to "exec()" is that\nlexical scoping allows the class body (including any methods) to\nreference names from the current and outer scopes when the class\ndefinition occurs inside a function.\n\nHowever, even when the class definition occurs inside the function,\nmethods defined inside the class still cannot see names defined at the\nclass scope. Class variables must be accessed through the first\nparameter of instance or class methods, and cannot be accessed at all\nfrom static methods.\n\n\nCreating the class object\n-------------------------\n\nOnce the class namespace has been populated by executing the class\nbody, the class object is created by calling "metaclass(name, bases,\nnamespace, **kwds)" (the additional keywords passed here are the same\nas those passed to "__prepare__").\n\nThis class object is the one that will be referenced by the zero-\nargument form of "super()". "__class__" is an implicit closure\nreference created by the compiler if any methods in a class body refer\nto either "__class__" or "super". This allows the zero argument form\nof "super()" to correctly identify the class being defined based on\nlexical scoping, while the class or instance that was used to make the\ncurrent call is identified based on the first argument passed to the\nmethod.\n\nAfter the class object is created, it is passed to the class\ndecorators included in the class definition (if any) and the resulting\nobject is bound in the local namespace as the defined class.\n\nWhen a new class is created by "type.__new__", the object provided as\nthe namespace parameter is copied to a standard Python dictionary and\nthe original object is discarded. The new copy becomes the "__dict__"\nattribute of the class object.\n\nSee also: **PEP 3135** - New super\n\n Describes the implicit "__class__" closure reference\n\n\nMetaclass example\n-----------------\n\nThe potential uses for metaclasses are boundless. Some ideas that have\nbeen explored include logging, interface checking, automatic\ndelegation, automatic property creation, proxies, frameworks, and\nautomatic resource locking/synchronization.\n\nHere is an example of a metaclass that uses an\n"collections.OrderedDict" to remember the order that class variables\nare defined:\n\n class OrderedClass(type):\n\n @classmethod\n def __prepare__(metacls, name, bases, **kwds):\n return collections.OrderedDict()\n\n def __new__(cls, name, bases, namespace, **kwds):\n result = type.__new__(cls, name, bases, dict(namespace))\n result.members = tuple(namespace)\n return result\n\n class A(metaclass=OrderedClass):\n def one(self): pass\n def two(self): pass\n def three(self): pass\n def four(self): pass\n\n >>> A.members\n (\'__module__\', \'one\', \'two\', \'three\', \'four\')\n\nWhen the class definition for *A* gets executed, the process begins\nwith calling the metaclass\'s "__prepare__()" method which returns an\nempty "collections.OrderedDict". That mapping records the methods and\nattributes of *A* as they are defined within the body of the class\nstatement. Once those definitions are executed, the ordered dictionary\nis fully populated and the metaclass\'s "__new__()" method gets\ninvoked. That method builds the new type and it saves the ordered\ndictionary keys in an attribute called "members".\n\n\nCustomizing instance and subclass checks\n========================================\n\nThe following methods are used to override the default behavior of the\n"isinstance()" and "issubclass()" built-in functions.\n\nIn particular, the metaclass "abc.ABCMeta" implements these methods in\norder to allow the addition of Abstract Base Classes (ABCs) as\n"virtual base classes" to any class or type (including built-in\ntypes), including other ABCs.\n\nclass.__instancecheck__(self, instance)\n\n Return true if *instance* should be considered a (direct or\n indirect) instance of *class*. If defined, called to implement\n "isinstance(instance, class)".\n\nclass.__subclasscheck__(self, subclass)\n\n Return true if *subclass* should be considered a (direct or\n indirect) subclass of *class*. If defined, called to implement\n "issubclass(subclass, class)".\n\nNote that these methods are looked up on the type (metaclass) of a\nclass. They cannot be defined as class methods in the actual class.\nThis is consistent with the lookup of special methods that are called\non instances, only in this case the instance is itself a class.\n\nSee also: **PEP 3119** - Introducing Abstract Base Classes\n\n Includes the specification for customizing "isinstance()" and\n "issubclass()" behavior through "__instancecheck__()" and\n "__subclasscheck__()", with motivation for this functionality in\n the context of adding Abstract Base Classes (see the "abc"\n module) to the language.\n\n\nEmulating callable objects\n==========================\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, "x(arg1, arg2, ...)" is a shorthand for\n "x.__call__(arg1, arg2, ...)".\n\n\nEmulating container types\n=========================\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which "0 <= k < N" where\n*N* is the length of the sequence, or slice objects, which define a\nrange of items. It is also recommended that mappings provide the\nmethods "keys()", "values()", "items()", "get()", "clear()",\n"setdefault()", "pop()", "popitem()", "copy()", and "update()"\nbehaving similar to those for Python\'s standard dictionary objects.\nThe "collections" module provides a "MutableMapping" abstract base\nclass to help create those methods from a base set of "__getitem__()",\n"__setitem__()", "__delitem__()", and "keys()". Mutable sequences\nshould provide methods "append()", "count()", "index()", "extend()",\n"insert()", "pop()", "remove()", "reverse()" and "sort()", like Python\nstandard list objects. Finally, sequence types should implement\naddition (meaning concatenation) and multiplication (meaning\nrepetition) by defining the methods "__add__()", "__radd__()",\n"__iadd__()", "__mul__()", "__rmul__()" and "__imul__()" described\nbelow; they should not define other numerical operators. It is\nrecommended that both mappings and sequences implement the\n"__contains__()" method to allow efficient use of the "in" operator;\nfor mappings, "in" should search the mapping\'s keys; for sequences, it\nshould search through the values. It is further recommended that both\nmappings and sequences implement the "__iter__()" method to allow\nefficient iteration through the container; for mappings, "__iter__()"\nshould be the same as "keys()"; for sequences, it should iterate\nthrough the values.\n\nobject.__len__(self)\n\n Called to implement the built-in function "len()". Should return\n the length of the object, an integer ">=" 0. Also, an object that\n doesn\'t define a "__bool__()" method and whose "__len__()" method\n returns zero is considered to be false in a Boolean context.\n\nobject.__length_hint__(self)\n\n Called to implement "operator.length_hint()". Should return an\n estimated length for the object (which may be greater or less than\n the actual length). The length must be an integer ">=" 0. This\n method is purely an optimization and is never required for\n correctness.\n\n New in version 3.4.\n\nNote: Slicing is done exclusively with the following three methods.\n A call like\n\n a[1:2] = b\n\n is translated to\n\n a[slice(1, 2, None)] = b\n\n and so forth. Missing slice items are always filled in with "None".\n\nobject.__getitem__(self, key)\n\n Called to implement evaluation of "self[key]". For sequence types,\n the accepted keys should be integers and slice objects. Note that\n the special interpretation of negative indexes (if the class wishes\n to emulate a sequence type) is up to the "__getitem__()" method. If\n *key* is of an inappropriate type, "TypeError" may be raised; if of\n a value outside the set of indexes for the sequence (after any\n special interpretation of negative values), "IndexError" should be\n raised. For mapping types, if *key* is missing (not in the\n container), "KeyError" should be raised.\n\n Note: "for" loops expect that an "IndexError" will be raised for\n illegal indexes to allow proper detection of the end of the\n sequence.\n\nobject.__missing__(self, key)\n\n Called by "dict"."__getitem__()" to implement "self[key]" for dict\n subclasses when key is not in the dictionary.\n\nobject.__setitem__(self, key, value)\n\n Called to implement assignment to "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support changes to the values for keys, or if new keys\n can be added, or for sequences if elements can be replaced. The\n same exceptions should be raised for improper *key* values as for\n the "__getitem__()" method.\n\nobject.__delitem__(self, key)\n\n Called to implement deletion of "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support removal of keys, or for sequences if elements\n can be removed from the sequence. The same exceptions should be\n raised for improper *key* values as for the "__getitem__()" method.\n\nobject.__iter__(self)\n\n This method is called when an iterator is required for a container.\n This method should return a new iterator object that can iterate\n over all the objects in the container. For mappings, it should\n iterate over the keys of the container.\n\n Iterator objects also need to implement this method; they are\n required to return themselves. For more information on iterator\n objects, see *Iterator Types*.\n\nobject.__reversed__(self)\n\n Called (if present) by the "reversed()" built-in to implement\n reverse iteration. It should return a new iterator object that\n iterates over all the objects in the container in reverse order.\n\n If the "__reversed__()" method is not provided, the "reversed()"\n built-in will fall back to using the sequence protocol ("__len__()"\n and "__getitem__()"). Objects that support the sequence protocol\n should only provide "__reversed__()" if they can provide an\n implementation that is more efficient than the one provided by\n "reversed()".\n\nThe membership test operators ("in" and "not in") are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n Called to implement membership test operators. Should return true\n if *item* is in *self*, false otherwise. For mapping objects, this\n should consider the keys of the mapping rather than the values or\n the key-item pairs.\n\n For objects that don\'t define "__contains__()", the membership test\n first tries iteration via "__iter__()", then the old sequence\n iteration protocol via "__getitem__()", see *this section in the\n language reference*.\n\n\nEmulating numeric types\n=======================\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__matmul__(self, other)\nobject.__truediv__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "@", "/", "//", "%", "divmod()",\n "pow()", "**", "<<", ">>", "&", "^", "|"). For instance, to\n evaluate the expression "x + y", where *x* is an instance of a\n class that has an "__add__()" method, "x.__add__(y)" is called.\n The "__divmod__()" method should be the equivalent to using\n "__floordiv__()" and "__mod__()"; it should not be related to\n "__truediv__()". Note that "__pow__()" should be defined to accept\n an optional third argument if the ternary version of the built-in\n "pow()" function is to be supported.\n\n If one of those methods does not support the operation with the\n supplied arguments, it should return "NotImplemented".\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rmatmul__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "@", "/", "//", "%", "divmod()",\n "pow()", "**", "<<", ">>", "&", "^", "|") with reflected (swapped)\n operands. These functions are only called if the left operand does\n not support the corresponding operation and the operands are of\n different types. [2] For instance, to evaluate the expression "x -\n y", where *y* is an instance of a class that has an "__rsub__()"\n method, "y.__rsub__(x)" is called if "x.__sub__(y)" returns\n *NotImplemented*.\n\n Note that ternary "pow()" will not try calling "__rpow__()" (the\n coercion rules would become too complicated).\n\n Note: If the right operand\'s type is a subclass of the left\n operand\'s type and that subclass provides the reflected method\n for the operation, this method will be called before the left\n operand\'s non-reflected method. This behavior allows subclasses\n to override their ancestors\' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__imatmul__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n These methods are called to implement the augmented arithmetic\n assignments ("+=", "-=", "*=", "@=", "/=", "//=", "%=", "**=",\n "<<=", ">>=", "&=", "^=", "|="). These methods should attempt to\n do the operation in-place (modifying *self*) and return the result\n (which could be, but does not have to be, *self*). If a specific\n method is not defined, the augmented assignment falls back to the\n normal methods. For instance, if *x* is an instance of a class\n with an "__iadd__()" method, "x += y" is equivalent to "x =\n x.__iadd__(y)" . Otherwise, "x.__add__(y)" and "y.__radd__(x)" are\n considered, as with the evaluation of "x + y". In certain\n situations, augmented assignment can result in unexpected errors\n (see *Why does a_tuple[i] += [\'item\'] raise an exception when the\n addition works?*), but this behavior is in fact part of the data\n model.\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n Called to implement the unary arithmetic operations ("-", "+",\n "abs()" and "~").\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__float__(self)\nobject.__round__(self[, n])\n\n Called to implement the built-in functions "complex()", "int()",\n "float()" and "round()". Should return a value of the appropriate\n type.\n\nobject.__index__(self)\n\n Called to implement "operator.index()", and whenever Python needs\n to losslessly convert the numeric object to an integer object (such\n as in slicing, or in the built-in "bin()", "hex()" and "oct()"\n functions). Presence of this method indicates that the numeric\n object is an integer type. Must return an integer.\n\n Note: In order to have a coherent integer type class, when\n "__index__()" is defined "__int__()" should also be defined, and\n both should return the same value.\n\n\nWith Statement Context Managers\n===============================\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a "with" statement. The context manager\nhandles the entry into, and the exit from, the desired runtime context\nfor the execution of the block of code. Context managers are normally\ninvoked using the "with" statement (described in section *The with\nstatement*), but can also be used by directly invoking their methods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see *Context Manager Types*.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The "with"\n statement will bind this method\'s return value to the target(s)\n specified in the "as" clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be "None".\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that "__exit__()" methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also: **PEP 343** - The "with" statement\n\n The specification, background, and examples for the Python "with"\n statement.\n\n\nSpecial method lookup\n=====================\n\nFor custom classes, implicit invocations of special methods are only\nguaranteed to work correctly if defined on an object\'s type, not in\nthe object\'s instance dictionary. That behaviour is the reason why\nthe following code raises an exception:\n\n >>> class C:\n ... pass\n ...\n >>> c = C()\n >>> c.__len__ = lambda: 5\n >>> len(c)\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: object of type \'C\' has no len()\n\nThe rationale behind this behaviour lies with a number of special\nmethods such as "__hash__()" and "__repr__()" that are implemented by\nall objects, including type objects. If the implicit lookup of these\nmethods used the conventional lookup process, they would fail when\ninvoked on the type object itself:\n\n >>> 1 .__hash__() == hash(1)\n True\n >>> int.__hash__() == hash(int)\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: descriptor \'__hash__\' of \'int\' object needs an argument\n\nIncorrectly attempting to invoke an unbound method of a class in this\nway is sometimes referred to as \'metaclass confusion\', and is avoided\nby bypassing the instance when looking up special methods:\n\n >>> type(1).__hash__(1) == hash(1)\n True\n >>> type(int).__hash__(int) == hash(int)\n True\n\nIn addition to bypassing any instance attributes in the interest of\ncorrectness, implicit special method lookup generally also bypasses\nthe "__getattribute__()" method even of the object\'s metaclass:\n\n >>> class Meta(type):\n ... def __getattribute__(*args):\n ... print("Metaclass getattribute invoked")\n ... return type.__getattribute__(*args)\n ...\n >>> class C(object, metaclass=Meta):\n ... def __len__(self):\n ... return 10\n ... def __getattribute__(*args):\n ... print("Class getattribute invoked")\n ... return object.__getattribute__(*args)\n ...\n >>> c = C()\n >>> c.__len__() # Explicit lookup via instance\n Class getattribute invoked\n 10\n >>> type(c).__len__(c) # Explicit lookup via type\n Metaclass getattribute invoked\n 10\n >>> len(c) # Implicit lookup\n 10\n\nBypassing the "__getattribute__()" machinery in this fashion provides\nsignificant scope for speed optimisations within the interpreter, at\nthe cost of some flexibility in the handling of special methods (the\nspecial method *must* be set on the class object itself in order to be\nconsistently invoked by the interpreter).\n', + 'string-methods': u'\nString Methods\n**************\n\nStrings implement all of the *common* sequence operations, along with\nthe additional methods described below.\n\nStrings also support two styles of string formatting, one providing a\nlarge degree of flexibility and customization (see "str.format()",\n*Format String Syntax* and *Custom String Formatting*) and the other\nbased on C "printf" style formatting that handles a narrower range of\ntypes and is slightly harder to use correctly, but is often faster for\nthe cases it can handle (*printf-style String Formatting*).\n\nThe *Text Processing Services* section of the standard library covers\na number of other modules that provide various text related utilities\n(including regular expression support in the "re" module).\n\nstr.capitalize()\n\n Return a copy of the string with its first character capitalized\n and the rest lowercased.\n\nstr.casefold()\n\n Return a casefolded copy of the string. Casefolded strings may be\n used for caseless matching.\n\n Casefolding is similar to lowercasing but more aggressive because\n it is intended to remove all case distinctions in a string. For\n example, the German lowercase letter "\'\xdf\'" is equivalent to ""ss"".\n Since it is already lowercase, "lower()" would do nothing to "\'\xdf\'";\n "casefold()" converts it to ""ss"".\n\n The casefolding algorithm is described in section 3.13 of the\n Unicode Standard.\n\n New in version 3.3.\n\nstr.center(width[, fillchar])\n\n Return centered in a string of length *width*. Padding is done\n using the specified *fillchar* (default is an ASCII space). The\n original string is returned if *width* is less than or equal to\n "len(s)".\n\nstr.count(sub[, start[, end]])\n\n Return the number of non-overlapping occurrences of substring *sub*\n in the range [*start*, *end*]. Optional arguments *start* and\n *end* are interpreted as in slice notation.\n\nstr.encode(encoding="utf-8", errors="strict")\n\n Return an encoded version of the string as a bytes object. Default\n encoding is "\'utf-8\'". *errors* may be given to set a different\n error handling scheme. The default for *errors* is "\'strict\'",\n meaning that encoding errors raise a "UnicodeError". Other possible\n values are "\'ignore\'", "\'replace\'", "\'xmlcharrefreplace\'",\n "\'backslashreplace\'" and any other name registered via\n "codecs.register_error()", see section *Error Handlers*. For a list\n of possible encodings, see section *Standard Encodings*.\n\n Changed in version 3.1: Support for keyword arguments added.\n\nstr.endswith(suffix[, start[, end]])\n\n Return "True" if the string ends with the specified *suffix*,\n otherwise return "False". *suffix* can also be a tuple of suffixes\n to look for. With optional *start*, test beginning at that\n position. With optional *end*, stop comparing at that position.\n\nstr.expandtabs(tabsize=8)\n\n Return a copy of the string where all tab characters are replaced\n by one or more spaces, depending on the current column and the\n given tab size. Tab positions occur every *tabsize* characters\n (default is 8, giving tab positions at columns 0, 8, 16 and so on).\n To expand the string, the current column is set to zero and the\n string is examined character by character. If the character is a\n tab ("\\t"), one or more space characters are inserted in the result\n until the current column is equal to the next tab position. (The\n tab character itself is not copied.) If the character is a newline\n ("\\n") or return ("\\r"), it is copied and the current column is\n reset to zero. Any other character is copied unchanged and the\n current column is incremented by one regardless of how the\n character is represented when printed.\n\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs()\n \'01 012 0123 01234\'\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs(4)\n \'01 012 0123 01234\'\n\nstr.find(sub[, start[, end]])\n\n Return the lowest index in the string where substring *sub* is\n found within the slice "s[start:end]". Optional arguments *start*\n and *end* are interpreted as in slice notation. Return "-1" if\n *sub* is not found.\n\n Note: The "find()" method should be used only if you need to know\n the position of *sub*. To check if *sub* is a substring or not,\n use the "in" operator:\n\n >>> \'Py\' in \'Python\'\n True\n\nstr.format(*args, **kwargs)\n\n Perform a string formatting operation. The string on which this\n method is called can contain literal text or replacement fields\n delimited by braces "{}". Each replacement field contains either\n the numeric index of a positional argument, or the name of a\n keyword argument. Returns a copy of the string where each\n replacement field is replaced with the string value of the\n corresponding argument.\n\n >>> "The sum of 1 + 2 is {0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\n See *Format String Syntax* for a description of the various\n formatting options that can be specified in format strings.\n\nstr.format_map(mapping)\n\n Similar to "str.format(**mapping)", except that "mapping" is used\n directly and not copied to a "dict". This is useful if for example\n "mapping" is a dict subclass:\n\n >>> class Default(dict):\n ... def __missing__(self, key):\n ... return key\n ...\n >>> \'{name} was born in {country}\'.format_map(Default(name=\'Guido\'))\n \'Guido was born in country\'\n\n New in version 3.2.\n\nstr.index(sub[, start[, end]])\n\n Like "find()", but raise "ValueError" when the substring is not\n found.\n\nstr.isalnum()\n\n Return true if all characters in the string are alphanumeric and\n there is at least one character, false otherwise. A character "c"\n is alphanumeric if one of the following returns "True":\n "c.isalpha()", "c.isdecimal()", "c.isdigit()", or "c.isnumeric()".\n\nstr.isalpha()\n\n Return true if all characters in the string are alphabetic and\n there is at least one character, false otherwise. Alphabetic\n characters are those characters defined in the Unicode character\n database as "Letter", i.e., those with general category property\n being one of "Lm", "Lt", "Lu", "Ll", or "Lo". Note that this is\n different from the "Alphabetic" property defined in the Unicode\n Standard.\n\nstr.isdecimal()\n\n Return true if all characters in the string are decimal characters\n and there is at least one character, false otherwise. Decimal\n characters are those from general category "Nd". This category\n includes digit characters, and all characters that can be used to\n form decimal-radix numbers, e.g. U+0660, ARABIC-INDIC DIGIT ZERO.\n\nstr.isdigit()\n\n Return true if all characters in the string are digits and there is\n at least one character, false otherwise. Digits include decimal\n characters and digits that need special handling, such as the\n compatibility superscript digits. Formally, a digit is a character\n that has the property value Numeric_Type=Digit or\n Numeric_Type=Decimal.\n\nstr.isidentifier()\n\n Return true if the string is a valid identifier according to the\n language definition, section *Identifiers and keywords*.\n\n Use "keyword.iskeyword()" to test for reserved identifiers such as\n "def" and "class".\n\nstr.islower()\n\n Return true if all cased characters [4] in the string are lowercase\n and there is at least one cased character, false otherwise.\n\nstr.isnumeric()\n\n Return true if all characters in the string are numeric characters,\n and there is at least one character, false otherwise. Numeric\n characters include digit characters, and all characters that have\n the Unicode numeric value property, e.g. U+2155, VULGAR FRACTION\n ONE FIFTH. Formally, numeric characters are those with the\n property value Numeric_Type=Digit, Numeric_Type=Decimal or\n Numeric_Type=Numeric.\n\nstr.isprintable()\n\n Return true if all characters in the string are printable or the\n string is empty, false otherwise. Nonprintable characters are\n those characters defined in the Unicode character database as\n "Other" or "Separator", excepting the ASCII space (0x20) which is\n considered printable. (Note that printable characters in this\n context are those which should not be escaped when "repr()" is\n invoked on a string. It has no bearing on the handling of strings\n written to "sys.stdout" or "sys.stderr".)\n\nstr.isspace()\n\n Return true if there are only whitespace characters in the string\n and there is at least one character, false otherwise. Whitespace\n characters are those characters defined in the Unicode character\n database as "Other" or "Separator" and those with bidirectional\n property being one of "WS", "B", or "S".\n\nstr.istitle()\n\n Return true if the string is a titlecased string and there is at\n least one character, for example uppercase characters may only\n follow uncased characters and lowercase characters only cased ones.\n Return false otherwise.\n\nstr.isupper()\n\n Return true if all cased characters [4] in the string are uppercase\n and there is at least one cased character, false otherwise.\n\nstr.join(iterable)\n\n Return a string which is the concatenation of the strings in the\n *iterable* *iterable*. A "TypeError" will be raised if there are\n any non-string values in *iterable*, including "bytes" objects.\n The separator between elements is the string providing this method.\n\nstr.ljust(width[, fillchar])\n\n Return the string left justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is an ASCII\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\nstr.lower()\n\n Return a copy of the string with all the cased characters [4]\n converted to lowercase.\n\n The lowercasing algorithm used is described in section 3.13 of the\n Unicode Standard.\n\nstr.lstrip([chars])\n\n Return a copy of the string with leading characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a prefix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.lstrip()\n \'spacious \'\n >>> \'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\nstatic str.maketrans(x[, y[, z]])\n\n This static method returns a translation table usable for\n "str.translate()".\n\n If there is only one argument, it must be a dictionary mapping\n Unicode ordinals (integers) or characters (strings of length 1) to\n Unicode ordinals, strings (of arbitrary lengths) or None.\n Character keys will then be converted to ordinals.\n\n If there are two arguments, they must be strings of equal length,\n and in the resulting dictionary, each character in x will be mapped\n to the character at the same position in y. If there is a third\n argument, it must be a string, whose characters will be mapped to\n None in the result.\n\nstr.partition(sep)\n\n Split the string at the first occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing the string itself, followed by\n two empty strings.\n\nstr.replace(old, new[, count])\n\n Return a copy of the string with all occurrences of substring *old*\n replaced by *new*. If the optional argument *count* is given, only\n the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n Return the highest index in the string where substring *sub* is\n found, such that *sub* is contained within "s[start:end]".\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return "-1" on failure.\n\nstr.rindex(sub[, start[, end]])\n\n Like "rfind()" but raises "ValueError" when the substring *sub* is\n not found.\n\nstr.rjust(width[, fillchar])\n\n Return the string right justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is an ASCII\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\nstr.rpartition(sep)\n\n Split the string at the last occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing two empty strings, followed by\n the string itself.\n\nstr.rsplit(sep=None, maxsplit=-1)\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n are done, the *rightmost* ones. If *sep* is not specified or\n "None", any whitespace string is a separator. Except for splitting\n from the right, "rsplit()" behaves like "split()" which is\n described in detail below.\n\nstr.rstrip([chars])\n\n Return a copy of the string with trailing characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a suffix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.rstrip()\n \' spacious\'\n >>> \'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\nstr.split(sep=None, maxsplit=-1)\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit*\n splits are done (thus, the list will have at most "maxsplit+1"\n elements). If *maxsplit* is not specified or "-1", then there is\n no limit on the number of splits (all possible splits are made).\n\n If *sep* is given, consecutive delimiters are not grouped together\n and are deemed to delimit empty strings (for example,\n "\'1,,2\'.split(\',\')" returns "[\'1\', \'\', \'2\']"). The *sep* argument\n may consist of multiple characters (for example,\n "\'1<>2<>3\'.split(\'<>\')" returns "[\'1\', \'2\', \'3\']"). Splitting an\n empty string with a specified separator returns "[\'\']".\n\n For example:\n\n >>> \'1,2,3\'.split(\',\')\n [\'1\', \'2\', \'3\']\n >>> \'1,2,3\'.split(\',\', maxsplit=1)\n [\'1\', \'2,3\']\n >>> \'1,2,,3,\'.split(\',\')\n [\'1\', \'2\', \'\', \'3\', \'\']\n\n If *sep* is not specified or is "None", a different splitting\n algorithm is applied: runs of consecutive whitespace are regarded\n as a single separator, and the result will contain no empty strings\n at the start or end if the string has leading or trailing\n whitespace. Consequently, splitting an empty string or a string\n consisting of just whitespace with a "None" separator returns "[]".\n\n For example:\n\n >>> \'1 2 3\'.split()\n [\'1\', \'2\', \'3\']\n >>> \'1 2 3\'.split(maxsplit=1)\n [\'1\', \'2 3\']\n >>> \' 1 2 3 \'.split()\n [\'1\', \'2\', \'3\']\n\nstr.splitlines([keepends])\n\n Return a list of the lines in the string, breaking at line\n boundaries. Line breaks are not included in the resulting list\n unless *keepends* is given and true.\n\n This method splits on the following line boundaries. In\n particular, the boundaries are a superset of *universal newlines*.\n\n +-------------------------+-------------------------------+\n | Representation | Description |\n +=========================+===============================+\n | "\\n" | Line Feed |\n +-------------------------+-------------------------------+\n | "\\r" | Carriage Return |\n +-------------------------+-------------------------------+\n | "\\r\\n" | Carriage Return + Line Feed |\n +-------------------------+-------------------------------+\n | "\\v" or "\\x0b" | Line Tabulation |\n +-------------------------+-------------------------------+\n | "\\f" or "\\x0c" | Form Feed |\n +-------------------------+-------------------------------+\n | "\\x1c" | File Separator |\n +-------------------------+-------------------------------+\n | "\\x1d" | Group Separator |\n +-------------------------+-------------------------------+\n | "\\x1e" | Record Separator |\n +-------------------------+-------------------------------+\n | "\\x85" | Next Line (C1 Control Code) |\n +-------------------------+-------------------------------+\n | "\\u2028" | Line Separator |\n +-------------------------+-------------------------------+\n | "\\u2029" | Paragraph Separator |\n +-------------------------+-------------------------------+\n\n Changed in version 3.2: "\\v" and "\\f" added to list of line\n boundaries.\n\n For example:\n\n >>> \'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines()\n [\'ab c\', \'\', \'de fg\', \'kl\']\n >>> \'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines(keepends=True)\n [\'ab c\\n\', \'\\n\', \'de fg\\r\', \'kl\\r\\n\']\n\n Unlike "split()" when a delimiter string *sep* is given, this\n method returns an empty list for the empty string, and a terminal\n line break does not result in an extra line:\n\n >>> "".splitlines()\n []\n >>> "One line\\n".splitlines()\n [\'One line\']\n\n For comparison, "split(\'\\n\')" gives:\n\n >>> \'\'.split(\'\\n\')\n [\'\']\n >>> \'Two lines\\n\'.split(\'\\n\')\n [\'Two lines\', \'\']\n\nstr.startswith(prefix[, start[, end]])\n\n Return "True" if string starts with the *prefix*, otherwise return\n "False". *prefix* can also be a tuple of prefixes to look for.\n With optional *start*, test string beginning at that position.\n With optional *end*, stop comparing string at that position.\n\nstr.strip([chars])\n\n Return a copy of the string with the leading and trailing\n characters removed. The *chars* argument is a string specifying the\n set of characters to be removed. If omitted or "None", the *chars*\n argument defaults to removing whitespace. The *chars* argument is\n not a prefix or suffix; rather, all combinations of its values are\n stripped:\n\n >>> \' spacious \'.strip()\n \'spacious\'\n >>> \'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\n The outermost leading and trailing *chars* argument values are\n stripped from the string. Characters are removed from the leading\n end until reaching a string character that is not contained in the\n set of characters in *chars*. A similar action takes place on the\n trailing end. For example:\n\n >>> comment_string = \'#....... Section 3.2.1 Issue #32 .......\'\n >>> comment_string.strip(\'.#! \')\n \'Section 3.2.1 Issue #32\'\n\nstr.swapcase()\n\n Return a copy of the string with uppercase characters converted to\n lowercase and vice versa. Note that it is not necessarily true that\n "s.swapcase().swapcase() == s".\n\nstr.title()\n\n Return a titlecased version of the string where words start with an\n uppercase character and the remaining characters are lowercase.\n\n For example:\n\n >>> \'Hello world\'.title()\n \'Hello World\'\n\n The algorithm uses a simple language-independent definition of a\n word as groups of consecutive letters. The definition works in\n many contexts but it means that apostrophes in contractions and\n possessives form word boundaries, which may not be the desired\n result:\n\n >>> "they\'re bill\'s friends from the UK".title()\n "They\'Re Bill\'S Friends From The Uk"\n\n A workaround for apostrophes can be constructed using regular\n expressions:\n\n >>> import re\n >>> def titlecase(s):\n ... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n ... lambda mo: mo.group(0)[0].upper() +\n ... mo.group(0)[1:].lower(),\n ... s)\n ...\n >>> titlecase("they\'re bill\'s friends.")\n "They\'re Bill\'s Friends."\n\nstr.translate(table)\n\n Return a copy of the string in which each character has been mapped\n through the given translation table. The table must be an object\n that implements indexing via "__getitem__()", typically a *mapping*\n or *sequence*. When indexed by a Unicode ordinal (an integer), the\n table object can do any of the following: return a Unicode ordinal\n or a string, to map the character to one or more other characters;\n return "None", to delete the character from the return string; or\n raise a "LookupError" exception, to map the character to itself.\n\n You can use "str.maketrans()" to create a translation map from\n character-to-character mappings in different formats.\n\n See also the "codecs" module for a more flexible approach to custom\n character mappings.\n\nstr.upper()\n\n Return a copy of the string with all the cased characters [4]\n converted to uppercase. Note that "str.upper().isupper()" might be\n "False" if "s" contains uncased characters or if the Unicode\n category of the resulting character(s) is not "Lu" (Letter,\n uppercase), but e.g. "Lt" (Letter, titlecase).\n\n The uppercasing algorithm used is described in section 3.13 of the\n Unicode Standard.\n\nstr.zfill(width)\n\n Return a copy of the string left filled with ASCII "\'0\'" digits to\n make a string of length *width*. A leading sign prefix\n ("\'+\'"/"\'-\'") is handled by inserting the padding *after* the sign\n character rather than before. The original string is returned if\n *width* is less than or equal to "len(s)".\n\n For example:\n\n >>> "42".zfill(5)\n \'00042\'\n >>> "-42".zfill(5)\n \'-0042\'\n', + 'strings': u'\nString and Bytes literals\n*************************\n\nString literals are described by the following lexical definitions:\n\n stringliteral ::= [stringprefix](shortstring | longstring)\n stringprefix ::= "r" | "u" | "R" | "U"\n shortstring ::= "\'" shortstringitem* "\'" | \'"\' shortstringitem* \'"\'\n longstring ::= "\'\'\'" longstringitem* "\'\'\'" | \'"""\' longstringitem* \'"""\'\n shortstringitem ::= shortstringchar | stringescapeseq\n longstringitem ::= longstringchar | stringescapeseq\n shortstringchar ::= \n longstringchar ::= \n stringescapeseq ::= "\\" \n\n bytesliteral ::= bytesprefix(shortbytes | longbytes)\n bytesprefix ::= "b" | "B" | "br" | "Br" | "bR" | "BR" | "rb" | "rB" | "Rb" | "RB"\n shortbytes ::= "\'" shortbytesitem* "\'" | \'"\' shortbytesitem* \'"\'\n longbytes ::= "\'\'\'" longbytesitem* "\'\'\'" | \'"""\' longbytesitem* \'"""\'\n shortbytesitem ::= shortbyteschar | bytesescapeseq\n longbytesitem ::= longbyteschar | bytesescapeseq\n shortbyteschar ::= \n longbyteschar ::= \n bytesescapeseq ::= "\\" \n\nOne syntactic restriction not indicated by these productions is that\nwhitespace is not allowed between the "stringprefix" or "bytesprefix"\nand the rest of the literal. The source character set is defined by\nthe encoding declaration; it is UTF-8 if no encoding declaration is\ngiven in the source file; see section *Encoding declarations*.\n\nIn plain English: Both types of literals can be enclosed in matching\nsingle quotes ("\'") or double quotes ("""). They can also be enclosed\nin matching groups of three single or double quotes (these are\ngenerally referred to as *triple-quoted strings*). The backslash\n("\\") character is used to escape characters that otherwise have a\nspecial meaning, such as newline, backslash itself, or the quote\ncharacter.\n\nBytes literals are always prefixed with "\'b\'" or "\'B\'"; they produce\nan instance of the "bytes" type instead of the "str" type. They may\nonly contain ASCII characters; bytes with a numeric value of 128 or\ngreater must be expressed with escapes.\n\nAs of Python 3.3 it is possible again to prefix string literals with a\n"u" prefix to simplify maintenance of dual 2.x and 3.x codebases.\n\nBoth string and bytes literals may optionally be prefixed with a\nletter "\'r\'" or "\'R\'"; such strings are called *raw strings* and treat\nbackslashes as literal characters. As a result, in string literals,\n"\'\\U\'" and "\'\\u\'" escapes in raw strings are not treated specially.\nGiven that Python 2.x\'s raw unicode literals behave differently than\nPython 3.x\'s the "\'ur\'" syntax is not supported.\n\nNew in version 3.3: The "\'rb\'" prefix of raw bytes literals has been\nadded as a synonym of "\'br\'".\n\nNew in version 3.3: Support for the unicode legacy literal\n("u\'value\'") was reintroduced to simplify the maintenance of dual\nPython 2.x and 3.x codebases. See **PEP 414** for more information.\n\nIn triple-quoted literals, unescaped newlines and quotes are allowed\n(and are retained), except that three unescaped quotes in a row\nterminate the literal. (A "quote" is the character used to open the\nliteral, i.e. either "\'" or """.)\n\nUnless an "\'r\'" or "\'R\'" prefix is present, escape sequences in string\nand bytes literals are interpreted according to rules similar to those\nused by Standard C. The recognized escape sequences are:\n\n+-------------------+-----------------------------------+---------+\n| Escape Sequence | Meaning | Notes |\n+===================+===================================+=========+\n| "\\newline" | Backslash and newline ignored | |\n+-------------------+-----------------------------------+---------+\n| "\\\\" | Backslash ("\\") | |\n+-------------------+-----------------------------------+---------+\n| "\\\'" | Single quote ("\'") | |\n+-------------------+-----------------------------------+---------+\n| "\\"" | Double quote (""") | |\n+-------------------+-----------------------------------+---------+\n| "\\a" | ASCII Bell (BEL) | |\n+-------------------+-----------------------------------+---------+\n| "\\b" | ASCII Backspace (BS) | |\n+-------------------+-----------------------------------+---------+\n| "\\f" | ASCII Formfeed (FF) | |\n+-------------------+-----------------------------------+---------+\n| "\\n" | ASCII Linefeed (LF) | |\n+-------------------+-----------------------------------+---------+\n| "\\r" | ASCII Carriage Return (CR) | |\n+-------------------+-----------------------------------+---------+\n| "\\t" | ASCII Horizontal Tab (TAB) | |\n+-------------------+-----------------------------------+---------+\n| "\\v" | ASCII Vertical Tab (VT) | |\n+-------------------+-----------------------------------+---------+\n| "\\ooo" | Character with octal value *ooo* | (1,3) |\n+-------------------+-----------------------------------+---------+\n| "\\xhh" | Character with hex value *hh* | (2,3) |\n+-------------------+-----------------------------------+---------+\n\nEscape sequences only recognized in string literals are:\n\n+-------------------+-----------------------------------+---------+\n| Escape Sequence | Meaning | Notes |\n+===================+===================================+=========+\n| "\\N{name}" | Character named *name* in the | (4) |\n| | Unicode database | |\n+-------------------+-----------------------------------+---------+\n| "\\uxxxx" | Character with 16-bit hex value | (5) |\n| | *xxxx* | |\n+-------------------+-----------------------------------+---------+\n| "\\Uxxxxxxxx" | Character with 32-bit hex value | (6) |\n| | *xxxxxxxx* | |\n+-------------------+-----------------------------------+---------+\n\nNotes:\n\n1. As in Standard C, up to three octal digits are accepted.\n\n2. Unlike in Standard C, exactly two hex digits are required.\n\n3. In a bytes literal, hexadecimal and octal escapes denote the\n byte with the given value. In a string literal, these escapes\n denote a Unicode character with the given value.\n\n4. Changed in version 3.3: Support for name aliases [1] has been\n added.\n\n5. Exactly four hex digits are required.\n\n6. Any Unicode character can be encoded this way. Exactly eight\n hex digits are required.\n\nUnlike Standard C, all unrecognized escape sequences are left in the\nstring unchanged, i.e., *the backslash is left in the result*. (This\nbehavior is useful when debugging: if an escape sequence is mistyped,\nthe resulting output is more easily recognized as broken.) It is also\nimportant to note that the escape sequences only recognized in string\nliterals fall into the category of unrecognized escapes for bytes\nliterals.\n\nEven in a raw literal, quotes can be escaped with a backslash, but the\nbackslash remains in the result; for example, "r"\\""" is a valid\nstring literal consisting of two characters: a backslash and a double\nquote; "r"\\"" is not a valid string literal (even a raw string cannot\nend in an odd number of backslashes). Specifically, *a raw literal\ncannot end in a single backslash* (since the backslash would escape\nthe following quote character). Note also that a single backslash\nfollowed by a newline is interpreted as those two characters as part\nof the literal, *not* as a line continuation.\n', 'subscriptions': u'\nSubscriptions\n*************\n\nA subscription selects an item of a sequence (string, tuple or list)\nor mapping (dictionary) object:\n\n subscription ::= primary "[" expression_list "]"\n\nThe primary must evaluate to an object that supports subscription\n(lists or dictionaries for example). User-defined objects can support\nsubscription by defining a "__getitem__()" method.\n\nFor built-in objects, there are two types of objects that support\nsubscription:\n\nIf the primary is a mapping, the expression list must evaluate to an\nobject whose value is one of the keys of the mapping, and the\nsubscription selects the value in the mapping that corresponds to that\nkey. (The expression list is a tuple except if it has exactly one\nitem.)\n\nIf the primary is a sequence, the expression (list) must evaluate to\nan integer or a slice (as discussed in the following section).\n\nThe formal syntax makes no special provision for negative indices in\nsequences; however, built-in sequences all provide a "__getitem__()"\nmethod that interprets negative indices by adding the length of the\nsequence to the index (so that "x[-1]" selects the last item of "x").\nThe resulting value must be a nonnegative integer less than the number\nof items in the sequence, and the subscription selects the item whose\nindex is that value (counting from zero). Since the support for\nnegative indices and slicing occurs in the object\'s "__getitem__()"\nmethod, subclasses overriding this method will need to explicitly add\nthat support.\n\nA string\'s items are characters. A character is not a separate data\ntype but a string of exactly one character.\n', 'truth': u'\nTruth Value Testing\n*******************\n\nAny object can be tested for truth value, for use in an "if" or\n"while" condition or as operand of the Boolean operations below. The\nfollowing values are considered false:\n\n* "None"\n\n* "False"\n\n* zero of any numeric type, for example, "0", "0.0", "0j".\n\n* any empty sequence, for example, "\'\'", "()", "[]".\n\n* any empty mapping, for example, "{}".\n\n* instances of user-defined classes, if the class defines a\n "__bool__()" or "__len__()" method, when that method returns the\n integer zero or "bool" value "False". [1]\n\nAll other values are considered true --- so objects of many types are\nalways true.\n\nOperations and built-in functions that have a Boolean result always\nreturn "0" or "False" for false and "1" or "True" for true, unless\notherwise stated. (Important exception: the Boolean operations "or"\nand "and" always return one of their operands.)\n', 'try': u'\nThe "try" statement\n*******************\n\nThe "try" statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression ["as" identifier]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nThe "except" clause(s) specify one or more exception handlers. When no\nexception occurs in the "try" clause, no exception handler is\nexecuted. When an exception occurs in the "try" suite, a search for an\nexception handler is started. This search inspects the except clauses\nin turn until one is found that matches the exception. An expression-\nless except clause, if present, must be last; it matches any\nexception. For an except clause with an expression, that expression\nis evaluated, and the clause matches the exception if the resulting\nobject is "compatible" with the exception. An object is compatible\nwith an exception if it is the class or a base class of the exception\nobject or a tuple containing an item compatible with the exception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire "try" statement raised\nthe exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified after the "as" keyword in that except clause, if\npresent, and the except clause\'s suite is executed. All except\nclauses must have an executable block. When the end of this block is\nreached, execution continues normally after the entire try statement.\n(This means that if two nested handlers exist for the same exception,\nand the exception occurs in the try clause of the inner handler, the\nouter handler will not handle the exception.)\n\nWhen an exception has been assigned using "as target", it is cleared\nat the end of the except clause. This is as if\n\n except E as N:\n foo\n\nwas translated to\n\n except E as N:\n try:\n foo\n finally:\n del N\n\nThis means the exception must be assigned to a different name to be\nable to refer to it after the except clause. Exceptions are cleared\nbecause with the traceback attached to them, they form a reference\ncycle with the stack frame, keeping all locals in that frame alive\nuntil the next garbage collection occurs.\n\nBefore an except clause\'s suite is executed, details about the\nexception are stored in the "sys" module and can be accessed via\n"sys.exc_info()". "sys.exc_info()" returns a 3-tuple consisting of the\nexception class, the exception instance and a traceback object (see\nsection *The standard type hierarchy*) identifying the point in the\nprogram where the exception occurred. "sys.exc_info()" values are\nrestored to their previous values (before the call) when returning\nfrom a function that handled an exception.\n\nThe optional "else" clause is executed if and when control flows off\nthe end of the "try" clause. [2] Exceptions in the "else" clause are\nnot handled by the preceding "except" clauses.\n\nIf "finally" is present, it specifies a \'cleanup\' handler. The "try"\nclause is executed, including any "except" and "else" clauses. If an\nexception occurs in any of the clauses and is not handled, the\nexception is temporarily saved. The "finally" clause is executed. If\nthere is a saved exception it is re-raised at the end of the "finally"\nclause. If the "finally" clause raises another exception, the saved\nexception is set as the context of the new exception. If the "finally"\nclause executes a "return" or "break" statement, the saved exception\nis discarded:\n\n >>> def f():\n ... try:\n ... 1/0\n ... finally:\n ... return 42\n ...\n >>> f()\n 42\n\nThe exception information is not available to the program during\nexecution of the "finally" clause.\n\nWhen a "return", "break" or "continue" statement is executed in the\n"try" suite of a "try"..."finally" statement, the "finally" clause is\nalso executed \'on the way out.\' A "continue" statement is illegal in\nthe "finally" clause. (The reason is a problem with the current\nimplementation --- this restriction may be lifted in the future).\n\nThe return value of a function is determined by the last "return"\nstatement executed. Since the "finally" clause always executes, a\n"return" statement executed in the "finally" clause will always be the\nlast one executed:\n\n >>> def foo():\n ... try:\n ... return \'try\'\n ... finally:\n ... return \'finally\'\n ...\n >>> foo()\n \'finally\'\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information on using the "raise" statement to\ngenerate exceptions may be found in section *The raise statement*.\n', @@ -71,9 +71,9 @@ 'typesmapping': u'\nMapping Types --- "dict"\n************************\n\nA *mapping* object maps *hashable* values to arbitrary objects.\nMappings are mutable objects. There is currently only one standard\nmapping type, the *dictionary*. (For other containers see the built-\nin "list", "set", and "tuple" classes, and the "collections" module.)\n\nA dictionary\'s keys are *almost* arbitrary values. Values that are\nnot *hashable*, that is, values containing lists, dictionaries or\nother mutable types (that are compared by value rather than by object\nidentity) may not be used as keys. Numeric types used for keys obey\nthe normal rules for numeric comparison: if two numbers compare equal\n(such as "1" and "1.0") then they can be used interchangeably to index\nthe same dictionary entry. (Note however, that since computers store\nfloating-point numbers as approximations it is usually unwise to use\nthem as dictionary keys.)\n\nDictionaries can be created by placing a comma-separated list of "key:\nvalue" pairs within braces, for example: "{\'jack\': 4098, \'sjoerd\':\n4127}" or "{4098: \'jack\', 4127: \'sjoerd\'}", or by the "dict"\nconstructor.\n\nclass class dict(**kwarg)\nclass class dict(mapping, **kwarg)\nclass class dict(iterable, **kwarg)\n\n Return a new dictionary initialized from an optional positional\n argument and a possibly empty set of keyword arguments.\n\n If no positional argument is given, an empty dictionary is created.\n If a positional argument is given and it is a mapping object, a\n dictionary is created with the same key-value pairs as the mapping\n object. Otherwise, the positional argument must be an *iterable*\n object. Each item in the iterable must itself be an iterable with\n exactly two objects. The first object of each item becomes a key\n in the new dictionary, and the second object the corresponding\n value. If a key occurs more than once, the last value for that key\n becomes the corresponding value in the new dictionary.\n\n If keyword arguments are given, the keyword arguments and their\n values are added to the dictionary created from the positional\n argument. If a key being added is already present, the value from\n the keyword argument replaces the value from the positional\n argument.\n\n To illustrate, the following examples all return a dictionary equal\n to "{"one": 1, "two": 2, "three": 3}":\n\n >>> a = dict(one=1, two=2, three=3)\n >>> b = {\'one\': 1, \'two\': 2, \'three\': 3}\n >>> c = dict(zip([\'one\', \'two\', \'three\'], [1, 2, 3]))\n >>> d = dict([(\'two\', 2), (\'one\', 1), (\'three\', 3)])\n >>> e = dict({\'three\': 3, \'one\': 1, \'two\': 2})\n >>> a == b == c == d == e\n True\n\n Providing keyword arguments as in the first example only works for\n keys that are valid Python identifiers. Otherwise, any valid keys\n can be used.\n\n These are the operations that dictionaries support (and therefore,\n custom mapping types should support too):\n\n len(d)\n\n Return the number of items in the dictionary *d*.\n\n d[key]\n\n Return the item of *d* with key *key*. Raises a "KeyError" if\n *key* is not in the map.\n\n If a subclass of dict defines a method "__missing__()" and *key*\n is not present, the "d[key]" operation calls that method with\n the key *key* as argument. The "d[key]" operation then returns\n or raises whatever is returned or raised by the\n "__missing__(key)" call. No other operations or methods invoke\n "__missing__()". If "__missing__()" is not defined, "KeyError"\n is raised. "__missing__()" must be a method; it cannot be an\n instance variable:\n\n >>> class Counter(dict):\n ... def __missing__(self, key):\n ... return 0\n >>> c = Counter()\n >>> c[\'red\']\n 0\n >>> c[\'red\'] += 1\n >>> c[\'red\']\n 1\n\n The example above shows part of the implementation of\n "collections.Counter". A different "__missing__" method is used\n by "collections.defaultdict".\n\n d[key] = value\n\n Set "d[key]" to *value*.\n\n del d[key]\n\n Remove "d[key]" from *d*. Raises a "KeyError" if *key* is not\n in the map.\n\n key in d\n\n Return "True" if *d* has a key *key*, else "False".\n\n key not in d\n\n Equivalent to "not key in d".\n\n iter(d)\n\n Return an iterator over the keys of the dictionary. This is a\n shortcut for "iter(d.keys())".\n\n clear()\n\n Remove all items from the dictionary.\n\n copy()\n\n Return a shallow copy of the dictionary.\n\n classmethod fromkeys(seq[, value])\n\n Create a new dictionary with keys from *seq* and values set to\n *value*.\n\n "fromkeys()" is a class method that returns a new dictionary.\n *value* defaults to "None".\n\n get(key[, default])\n\n Return the value for *key* if *key* is in the dictionary, else\n *default*. If *default* is not given, it defaults to "None", so\n that this method never raises a "KeyError".\n\n items()\n\n Return a new view of the dictionary\'s items ("(key, value)"\n pairs). See the *documentation of view objects*.\n\n keys()\n\n Return a new view of the dictionary\'s keys. See the\n *documentation of view objects*.\n\n pop(key[, default])\n\n If *key* is in the dictionary, remove it and return its value,\n else return *default*. If *default* is not given and *key* is\n not in the dictionary, a "KeyError" is raised.\n\n popitem()\n\n Remove and return an arbitrary "(key, value)" pair from the\n dictionary.\n\n "popitem()" is useful to destructively iterate over a\n dictionary, as often used in set algorithms. If the dictionary\n is empty, calling "popitem()" raises a "KeyError".\n\n setdefault(key[, default])\n\n If *key* is in the dictionary, return its value. If not, insert\n *key* with a value of *default* and return *default*. *default*\n defaults to "None".\n\n update([other])\n\n Update the dictionary with the key/value pairs from *other*,\n overwriting existing keys. Return "None".\n\n "update()" accepts either another dictionary object or an\n iterable of key/value pairs (as tuples or other iterables of\n length two). If keyword arguments are specified, the dictionary\n is then updated with those key/value pairs: "d.update(red=1,\n blue=2)".\n\n values()\n\n Return a new view of the dictionary\'s values. See the\n *documentation of view objects*.\n\n Dictionaries compare equal if and only if they have the same "(key,\n value)" pairs. Order comparisons (\'<\', \'<=\', \'>=\', \'>\') raise\n "TypeError".\n\nSee also: "types.MappingProxyType" can be used to create a read-only\n view of a "dict".\n\n\nDictionary view objects\n=======================\n\nThe objects returned by "dict.keys()", "dict.values()" and\n"dict.items()" are *view objects*. They provide a dynamic view on the\ndictionary\'s entries, which means that when the dictionary changes,\nthe view reflects these changes.\n\nDictionary views can be iterated over to yield their respective data,\nand support membership tests:\n\nlen(dictview)\n\n Return the number of entries in the dictionary.\n\niter(dictview)\n\n Return an iterator over the keys, values or items (represented as\n tuples of "(key, value)") in the dictionary.\n\n Keys and values are iterated over in an arbitrary order which is\n non-random, varies across Python implementations, and depends on\n the dictionary\'s history of insertions and deletions. If keys,\n values and items views are iterated over with no intervening\n modifications to the dictionary, the order of items will directly\n correspond. This allows the creation of "(value, key)" pairs using\n "zip()": "pairs = zip(d.values(), d.keys())". Another way to\n create the same list is "pairs = [(v, k) for (k, v) in d.items()]".\n\n Iterating views while adding or deleting entries in the dictionary\n may raise a "RuntimeError" or fail to iterate over all entries.\n\nx in dictview\n\n Return "True" if *x* is in the underlying dictionary\'s keys, values\n or items (in the latter case, *x* should be a "(key, value)"\n tuple).\n\nKeys views are set-like since their entries are unique and hashable.\nIf all values are hashable, so that "(key, value)" pairs are unique\nand hashable, then the items view is also set-like. (Values views are\nnot treated as set-like since the entries are generally not unique.)\nFor set-like views, all of the operations defined for the abstract\nbase class "collections.abc.Set" are available (for example, "==",\n"<", or "^").\n\nAn example of dictionary view usage:\n\n >>> dishes = {\'eggs\': 2, \'sausage\': 1, \'bacon\': 1, \'spam\': 500}\n >>> keys = dishes.keys()\n >>> values = dishes.values()\n\n >>> # iteration\n >>> n = 0\n >>> for val in values:\n ... n += val\n >>> print(n)\n 504\n\n >>> # keys and values are iterated over in the same order\n >>> list(keys)\n [\'eggs\', \'bacon\', \'sausage\', \'spam\']\n >>> list(values)\n [2, 1, 1, 500]\n\n >>> # view objects are dynamic and reflect dict changes\n >>> del dishes[\'eggs\']\n >>> del dishes[\'sausage\']\n >>> list(keys)\n [\'spam\', \'bacon\']\n\n >>> # set operations\n >>> keys & {\'eggs\', \'bacon\', \'salad\'}\n {\'bacon\'}\n >>> keys ^ {\'sausage\', \'juice\'}\n {\'juice\', \'sausage\', \'bacon\', \'spam\'}\n', 'typesmethods': u'\nMethods\n*******\n\nMethods are functions that are called using the attribute notation.\nThere are two flavors: built-in methods (such as "append()" on lists)\nand class instance methods. Built-in methods are described with the\ntypes that support them.\n\nIf you access a method (a function defined in a class namespace)\nthrough an instance, you get a special object: a *bound method* (also\ncalled *instance method*) object. When called, it will add the "self"\nargument to the argument list. Bound methods have two special read-\nonly attributes: "m.__self__" is the object on which the method\noperates, and "m.__func__" is the function implementing the method.\nCalling "m(arg-1, arg-2, ..., arg-n)" is completely equivalent to\ncalling "m.__func__(m.__self__, arg-1, arg-2, ..., arg-n)".\n\nLike function objects, bound method objects support getting arbitrary\nattributes. However, since method attributes are actually stored on\nthe underlying function object ("meth.__func__"), setting method\nattributes on bound methods is disallowed. Attempting to set an\nattribute on a method results in an "AttributeError" being raised. In\norder to set a method attribute, you need to explicitly set it on the\nunderlying function object:\n\n >>> class C:\n ... def method(self):\n ... pass\n ...\n >>> c = C()\n >>> c.method.whoami = \'my name is method\' # can\'t set on the method\n Traceback (most recent call last):\n File "", line 1, in \n AttributeError: \'method\' object has no attribute \'whoami\'\n >>> c.method.__func__.whoami = \'my name is method\'\n >>> c.method.whoami\n \'my name is method\'\n\nSee *The standard type hierarchy* for more information.\n', 'typesmodules': u'\nModules\n*******\n\nThe only special operation on a module is attribute access: "m.name",\nwhere *m* is a module and *name* accesses a name defined in *m*\'s\nsymbol table. Module attributes can be assigned to. (Note that the\n"import" statement is not, strictly speaking, an operation on a module\nobject; "import foo" does not require a module object named *foo* to\nexist, rather it requires an (external) *definition* for a module\nnamed *foo* somewhere.)\n\nA special attribute of every module is "__dict__". This is the\ndictionary containing the module\'s symbol table. Modifying this\ndictionary will actually change the module\'s symbol table, but direct\nassignment to the "__dict__" attribute is not possible (you can write\n"m.__dict__[\'a\'] = 1", which defines "m.a" to be "1", but you can\'t\nwrite "m.__dict__ = {}"). Modifying "__dict__" directly is not\nrecommended.\n\nModules built into the interpreter are written like this: "". If loaded from a file, they are written as\n"".\n', - 'typesseq': u'\nSequence Types --- "list", "tuple", "range"\n*******************************************\n\nThere are three basic sequence types: lists, tuples, and range\nobjects. Additional sequence types tailored for processing of *binary\ndata* and *text strings* are described in dedicated sections.\n\n\nCommon Sequence Operations\n==========================\n\nThe operations in the following table are supported by most sequence\ntypes, both mutable and immutable. The "collections.abc.Sequence" ABC\nis provided to make it easier to correctly implement these operations\non custom sequence types.\n\nThis table lists the sequence operations sorted in ascending priority.\nIn the table, *s* and *t* are sequences of the same type, *n*, *i*,\n*j* and *k* are integers and *x* is an arbitrary object that meets any\ntype and value restrictions imposed by *s*.\n\nThe "in" and "not in" operations have the same priorities as the\ncomparison operations. The "+" (concatenation) and "*" (repetition)\noperations have the same priority as the corresponding numeric\noperations.\n\n+----------------------------+----------------------------------+------------+\n| Operation | Result | Notes |\n+============================+==================================+============+\n| "x in s" | "True" if an item of *s* is | (1) |\n| | equal to *x*, else "False" | |\n+----------------------------+----------------------------------+------------+\n| "x not in s" | "False" if an item of *s* is | (1) |\n| | equal to *x*, else "True" | |\n+----------------------------+----------------------------------+------------+\n| "s + t" | the concatenation of *s* and *t* | (6)(7) |\n+----------------------------+----------------------------------+------------+\n| "s * n" or "n * s" | equivalent to adding *s* to | (2)(7) |\n| | itself *n* times | |\n+----------------------------+----------------------------------+------------+\n| "s[i]" | *i*th item of *s*, origin 0 | (3) |\n+----------------------------+----------------------------------+------------+\n| "s[i:j]" | slice of *s* from *i* to *j* | (3)(4) |\n+----------------------------+----------------------------------+------------+\n| "s[i:j:k]" | slice of *s* from *i* to *j* | (3)(5) |\n| | with step *k* | |\n+----------------------------+----------------------------------+------------+\n| "len(s)" | length of *s* | |\n+----------------------------+----------------------------------+------------+\n| "min(s)" | smallest item of *s* | |\n+----------------------------+----------------------------------+------------+\n| "max(s)" | largest item of *s* | |\n+----------------------------+----------------------------------+------------+\n| "s.index(x[, i[, j]])" | index of the first occurrence of | (8) |\n| | *x* in *s* (at or after index | |\n| | *i* and before index *j*) | |\n+----------------------------+----------------------------------+------------+\n| "s.count(x)" | total number of occurrences of | |\n| | *x* in *s* | |\n+----------------------------+----------------------------------+------------+\n\nSequences of the same type also support comparisons. In particular,\ntuples and lists are compared lexicographically by comparing\ncorresponding elements. This means that to compare equal, every\nelement must compare equal and the two sequences must be of the same\ntype and have the same length. (For full details see *Comparisons* in\nthe language reference.)\n\nNotes:\n\n1. While the "in" and "not in" operations are used only for simple\n containment testing in the general case, some specialised sequences\n (such as "str", "bytes" and "bytearray") also use them for\n subsequence testing:\n\n >>> "gg" in "eggs"\n True\n\n2. Values of *n* less than "0" are treated as "0" (which yields an\n empty sequence of the same type as *s*). Note that items in the\n sequence *s* are not copied; they are referenced multiple times.\n This often haunts new Python programmers; consider:\n\n >>> lists = [[]] * 3\n >>> lists\n [[], [], []]\n >>> lists[0].append(3)\n >>> lists\n [[3], [3], [3]]\n\n What has happened is that "[[]]" is a one-element list containing\n an empty list, so all three elements of "[[]] * 3" are references\n to this single empty list. Modifying any of the elements of\n "lists" modifies this single list. You can create a list of\n different lists this way:\n\n >>> lists = [[] for i in range(3)]\n >>> lists[0].append(3)\n >>> lists[1].append(5)\n >>> lists[2].append(7)\n >>> lists\n [[3], [5], [7]]\n\n Further explanation is available in the FAQ entry *How do I create\n a multidimensional list?*.\n\n3. If *i* or *j* is negative, the index is relative to the end of\n the string: "len(s) + i" or "len(s) + j" is substituted. But note\n that "-0" is still "0".\n\n4. The slice of *s* from *i* to *j* is defined as the sequence of\n items with index *k* such that "i <= k < j". If *i* or *j* is\n greater than "len(s)", use "len(s)". If *i* is omitted or "None",\n use "0". If *j* is omitted or "None", use "len(s)". If *i* is\n greater than or equal to *j*, the slice is empty.\n\n5. The slice of *s* from *i* to *j* with step *k* is defined as the\n sequence of items with index "x = i + n*k" such that "0 <= n <\n (j-i)/k". In other words, the indices are "i", "i+k", "i+2*k",\n "i+3*k" and so on, stopping when *j* is reached (but never\n including *j*). If *i* or *j* is greater than "len(s)", use\n "len(s)". If *i* or *j* are omitted or "None", they become "end"\n values (which end depends on the sign of *k*). Note, *k* cannot be\n zero. If *k* is "None", it is treated like "1".\n\n6. Concatenating immutable sequences always results in a new\n object. This means that building up a sequence by repeated\n concatenation will have a quadratic runtime cost in the total\n sequence length. To get a linear runtime cost, you must switch to\n one of the alternatives below:\n\n * if concatenating "str" objects, you can build a list and use\n "str.join()" at the end or else write to an "io.StringIO"\n instance and retrieve its value when complete\n\n * if concatenating "bytes" objects, you can similarly use\n "bytes.join()" or "io.BytesIO", or you can do in-place\n concatenation with a "bytearray" object. "bytearray" objects are\n mutable and have an efficient overallocation mechanism\n\n * if concatenating "tuple" objects, extend a "list" instead\n\n * for other types, investigate the relevant class documentation\n\n7. Some sequence types (such as "range") only support item\n sequences that follow specific patterns, and hence don\'t support\n sequence concatenation or repetition.\n\n8. "index" raises "ValueError" when *x* is not found in *s*. When\n supported, the additional arguments to the index method allow\n efficient searching of subsections of the sequence. Passing the\n extra arguments is roughly equivalent to using "s[i:j].index(x)",\n only without copying any data and with the returned index being\n relative to the start of the sequence rather than the start of the\n slice.\n\n\nImmutable Sequence Types\n========================\n\nThe only operation that immutable sequence types generally implement\nthat is not also implemented by mutable sequence types is support for\nthe "hash()" built-in.\n\nThis support allows immutable sequences, such as "tuple" instances, to\nbe used as "dict" keys and stored in "set" and "frozenset" instances.\n\nAttempting to hash an immutable sequence that contains unhashable\nvalues will result in "TypeError".\n\n\nMutable Sequence Types\n======================\n\nThe operations in the following table are defined on mutable sequence\ntypes. The "collections.abc.MutableSequence" ABC is provided to make\nit easier to correctly implement these operations on custom sequence\ntypes.\n\nIn the table *s* is an instance of a mutable sequence type, *t* is any\niterable object and *x* is an arbitrary object that meets any type and\nvalue restrictions imposed by *s* (for example, "bytearray" only\naccepts integers that meet the value restriction "0 <= x <= 255").\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| "s[i] = x" | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j] = t" | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j]" | same as "s[i:j] = []" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j:k] = t" | the elements of "s[i:j:k]" are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j:k]" | removes the elements of | |\n| | "s[i:j:k]" from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.append(x)" | appends *x* to the end of the | |\n| | sequence (same as | |\n| | "s[len(s):len(s)] = [x]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.clear()" | removes all items from "s" (same | (5) |\n| | as "del s[:]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.copy()" | creates a shallow copy of "s" | (5) |\n| | (same as "s[:]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.extend(t)" or "s += t" | extends *s* with the contents of | |\n| | *t* (for the most part the same | |\n| | as "s[len(s):len(s)] = t") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s *= n" | updates *s* with its contents | (6) |\n| | repeated *n* times | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.insert(i, x)" | inserts *x* into *s* at the | |\n| | index given by *i* (same as | |\n| | "s[i:i] = [x]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.pop([i])" | retrieves the item at *i* and | (2) |\n| | also removes it from *s* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.remove(x)" | remove the first item from *s* | (3) |\n| | where "s[i] == x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.reverse()" | reverses the items of *s* in | (4) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. The optional argument *i* defaults to "-1", so that by default\n the last item is removed and returned.\n\n3. "remove" raises "ValueError" when *x* is not found in *s*.\n\n4. The "reverse()" method modifies the sequence in place for\n economy of space when reversing a large sequence. To remind users\n that it operates by side effect, it does not return the reversed\n sequence.\n\n5. "clear()" and "copy()" are included for consistency with the\n interfaces of mutable containers that don\'t support slicing\n operations (such as "dict" and "set")\n\n New in version 3.3: "clear()" and "copy()" methods.\n\n6. The value *n* is an integer, or an object implementing\n "__index__()". Zero and negative values of *n* clear the sequence.\n Items in the sequence are not copied; they are referenced multiple\n times, as explained for "s * n" under *Common Sequence Operations*.\n\n\nLists\n=====\n\nLists are mutable sequences, typically used to store collections of\nhomogeneous items (where the precise degree of similarity will vary by\napplication).\n\nclass class list([iterable])\n\n Lists may be constructed in several ways:\n\n * Using a pair of square brackets to denote the empty list: "[]"\n\n * Using square brackets, separating items with commas: "[a]",\n "[a, b, c]"\n\n * Using a list comprehension: "[x for x in iterable]"\n\n * Using the type constructor: "list()" or "list(iterable)"\n\n The constructor builds a list whose items are the same and in the\n same order as *iterable*\'s items. *iterable* may be either a\n sequence, a container that supports iteration, or an iterator\n object. If *iterable* is already a list, a copy is made and\n returned, similar to "iterable[:]". For example, "list(\'abc\')"\n returns "[\'a\', \'b\', \'c\']" and "list( (1, 2, 3) )" returns "[1, 2,\n 3]". If no argument is given, the constructor creates a new empty\n list, "[]".\n\n Many other operations also produce lists, including the "sorted()"\n built-in.\n\n Lists implement all of the *common* and *mutable* sequence\n operations. Lists also provide the following additional method:\n\n sort(*, key=None, reverse=None)\n\n This method sorts the list in place, using only "<" comparisons\n between items. Exceptions are not suppressed - if any comparison\n operations fail, the entire sort operation will fail (and the\n list will likely be left in a partially modified state).\n\n "sort()" accepts two arguments that can only be passed by\n keyword (*keyword-only arguments*):\n\n *key* specifies a function of one argument that is used to\n extract a comparison key from each list element (for example,\n "key=str.lower"). The key corresponding to each item in the list\n is calculated once and then used for the entire sorting process.\n The default value of "None" means that list items are sorted\n directly without calculating a separate key value.\n\n The "functools.cmp_to_key()" utility is available to convert a\n 2.x style *cmp* function to a *key* function.\n\n *reverse* is a boolean value. If set to "True", then the list\n elements are sorted as if each comparison were reversed.\n\n This method modifies the sequence in place for economy of space\n when sorting a large sequence. To remind users that it operates\n by side effect, it does not return the sorted sequence (use\n "sorted()" to explicitly request a new sorted list instance).\n\n The "sort()" method is guaranteed to be stable. A sort is\n stable if it guarantees not to change the relative order of\n elements that compare equal --- this is helpful for sorting in\n multiple passes (for example, sort by department, then by salary\n grade).\n\n **CPython implementation detail:** While a list is being sorted,\n the effect of attempting to mutate, or even inspect, the list is\n undefined. The C implementation of Python makes the list appear\n empty for the duration, and raises "ValueError" if it can detect\n that the list has been mutated during a sort.\n\n\nTuples\n======\n\nTuples are immutable sequences, typically used to store collections of\nheterogeneous data (such as the 2-tuples produced by the "enumerate()"\nbuilt-in). Tuples are also used for cases where an immutable sequence\nof homogeneous data is needed (such as allowing storage in a "set" or\n"dict" instance).\n\nclass class tuple([iterable])\n\n Tuples may be constructed in a number of ways:\n\n * Using a pair of parentheses to denote the empty tuple: "()"\n\n * Using a trailing comma for a singleton tuple: "a," or "(a,)"\n\n * Separating items with commas: "a, b, c" or "(a, b, c)"\n\n * Using the "tuple()" built-in: "tuple()" or "tuple(iterable)"\n\n The constructor builds a tuple whose items are the same and in the\n same order as *iterable*\'s items. *iterable* may be either a\n sequence, a container that supports iteration, or an iterator\n object. If *iterable* is already a tuple, it is returned\n unchanged. For example, "tuple(\'abc\')" returns "(\'a\', \'b\', \'c\')"\n and "tuple( [1, 2, 3] )" returns "(1, 2, 3)". If no argument is\n given, the constructor creates a new empty tuple, "()".\n\n Note that it is actually the comma which makes a tuple, not the\n parentheses. The parentheses are optional, except in the empty\n tuple case, or when they are needed to avoid syntactic ambiguity.\n For example, "f(a, b, c)" is a function call with three arguments,\n while "f((a, b, c))" is a function call with a 3-tuple as the sole\n argument.\n\n Tuples implement all of the *common* sequence operations.\n\nFor heterogeneous collections of data where access by name is clearer\nthan access by index, "collections.namedtuple()" may be a more\nappropriate choice than a simple tuple object.\n\n\nRanges\n======\n\nThe "range" type represents an immutable sequence of numbers and is\ncommonly used for looping a specific number of times in "for" loops.\n\nclass class range(stop)\nclass class range(start, stop[, step])\n\n The arguments to the range constructor must be integers (either\n built-in "int" or any object that implements the "__index__"\n special method). If the *step* argument is omitted, it defaults to\n "1". If the *start* argument is omitted, it defaults to "0". If\n *step* is zero, "ValueError" is raised.\n\n For a positive *step*, the contents of a range "r" are determined\n by the formula "r[i] = start + step*i" where "i >= 0" and "r[i] <\n stop".\n\n For a negative *step*, the contents of the range are still\n determined by the formula "r[i] = start + step*i", but the\n constraints are "i >= 0" and "r[i] > stop".\n\n A range object will be empty if "r[0]" does not meet the value\n constraint. Ranges do support negative indices, but these are\n interpreted as indexing from the end of the sequence determined by\n the positive indices.\n\n Ranges containing absolute values larger than "sys.maxsize" are\n permitted but some features (such as "len()") may raise\n "OverflowError".\n\n Range examples:\n\n >>> list(range(10))\n [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n >>> list(range(1, 11))\n [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n >>> list(range(0, 30, 5))\n [0, 5, 10, 15, 20, 25]\n >>> list(range(0, 10, 3))\n [0, 3, 6, 9]\n >>> list(range(0, -10, -1))\n [0, -1, -2, -3, -4, -5, -6, -7, -8, -9]\n >>> list(range(0))\n []\n >>> list(range(1, 0))\n []\n\n Ranges implement all of the *common* sequence operations except\n concatenation and repetition (due to the fact that range objects\n can only represent sequences that follow a strict pattern and\n repetition and concatenation will usually violate that pattern).\n\nThe advantage of the "range" type over a regular "list" or "tuple" is\nthat a "range" object will always take the same (small) amount of\nmemory, no matter the size of the range it represents (as it only\nstores the "start", "stop" and "step" values, calculating individual\nitems and subranges as needed).\n\nRange objects implement the "collections.abc.Sequence" ABC, and\nprovide features such as containment tests, element index lookup,\nslicing and support for negative indices (see *Sequence Types ---\nlist, tuple, range*):\n\n>>> r = range(0, 20, 2)\n>>> r\nrange(0, 20, 2)\n>>> 11 in r\nFalse\n>>> 10 in r\nTrue\n>>> r.index(10)\n5\n>>> r[5]\n10\n>>> r[:5]\nrange(0, 10, 2)\n>>> r[-1]\n18\n\nTesting range objects for equality with "==" and "!=" compares them as\nsequences. That is, two range objects are considered equal if they\nrepresent the same sequence of values. (Note that two range objects\nthat compare equal might have different "start", "stop" and "step"\nattributes, for example "range(0) == range(2, 1, 3)" or "range(0, 3,\n2) == range(0, 4, 2)".)\n\nChanged in version 3.2: Implement the Sequence ABC. Support slicing\nand negative indices. Test "int" objects for membership in constant\ntime instead of iterating through all items.\n\nChanged in version 3.3: Define \'==\' and \'!=\' to compare range objects\nbased on the sequence of values they define (instead of comparing\nbased on object identity).\n\nNew in version 3.3: The "start", "stop" and "step" attributes.\n', + 'typesseq': u'\nSequence Types --- "list", "tuple", "range"\n*******************************************\n\nThere are three basic sequence types: lists, tuples, and range\nobjects. Additional sequence types tailored for processing of *binary\ndata* and *text strings* are described in dedicated sections.\n\n\nCommon Sequence Operations\n==========================\n\nThe operations in the following table are supported by most sequence\ntypes, both mutable and immutable. The "collections.abc.Sequence" ABC\nis provided to make it easier to correctly implement these operations\non custom sequence types.\n\nThis table lists the sequence operations sorted in ascending priority.\nIn the table, *s* and *t* are sequences of the same type, *n*, *i*,\n*j* and *k* are integers and *x* is an arbitrary object that meets any\ntype and value restrictions imposed by *s*.\n\nThe "in" and "not in" operations have the same priorities as the\ncomparison operations. The "+" (concatenation) and "*" (repetition)\noperations have the same priority as the corresponding numeric\noperations.\n\n+----------------------------+----------------------------------+------------+\n| Operation | Result | Notes |\n+============================+==================================+============+\n| "x in s" | "True" if an item of *s* is | (1) |\n| | equal to *x*, else "False" | |\n+----------------------------+----------------------------------+------------+\n| "x not in s" | "False" if an item of *s* is | (1) |\n| | equal to *x*, else "True" | |\n+----------------------------+----------------------------------+------------+\n| "s + t" | the concatenation of *s* and *t* | (6)(7) |\n+----------------------------+----------------------------------+------------+\n| "s * n" or "n * s" | equivalent to adding *s* to | (2)(7) |\n| | itself *n* times | |\n+----------------------------+----------------------------------+------------+\n| "s[i]" | *i*th item of *s*, origin 0 | (3) |\n+----------------------------+----------------------------------+------------+\n| "s[i:j]" | slice of *s* from *i* to *j* | (3)(4) |\n+----------------------------+----------------------------------+------------+\n| "s[i:j:k]" | slice of *s* from *i* to *j* | (3)(5) |\n| | with step *k* | |\n+----------------------------+----------------------------------+------------+\n| "len(s)" | length of *s* | |\n+----------------------------+----------------------------------+------------+\n| "min(s)" | smallest item of *s* | |\n+----------------------------+----------------------------------+------------+\n| "max(s)" | largest item of *s* | |\n+----------------------------+----------------------------------+------------+\n| "s.index(x[, i[, j]])" | index of the first occurrence of | (8) |\n| | *x* in *s* (at or after index | |\n| | *i* and before index *j*) | |\n+----------------------------+----------------------------------+------------+\n| "s.count(x)" | total number of occurrences of | |\n| | *x* in *s* | |\n+----------------------------+----------------------------------+------------+\n\nSequences of the same type also support comparisons. In particular,\ntuples and lists are compared lexicographically by comparing\ncorresponding elements. This means that to compare equal, every\nelement must compare equal and the two sequences must be of the same\ntype and have the same length. (For full details see *Comparisons* in\nthe language reference.)\n\nNotes:\n\n1. While the "in" and "not in" operations are used only for simple\n containment testing in the general case, some specialised sequences\n (such as "str", "bytes" and "bytearray") also use them for\n subsequence testing:\n\n >>> "gg" in "eggs"\n True\n\n2. Values of *n* less than "0" are treated as "0" (which yields an\n empty sequence of the same type as *s*). Note that items in the\n sequence *s* are not copied; they are referenced multiple times.\n This often haunts new Python programmers; consider:\n\n >>> lists = [[]] * 3\n >>> lists\n [[], [], []]\n >>> lists[0].append(3)\n >>> lists\n [[3], [3], [3]]\n\n What has happened is that "[[]]" is a one-element list containing\n an empty list, so all three elements of "[[]] * 3" are references\n to this single empty list. Modifying any of the elements of\n "lists" modifies this single list. You can create a list of\n different lists this way:\n\n >>> lists = [[] for i in range(3)]\n >>> lists[0].append(3)\n >>> lists[1].append(5)\n >>> lists[2].append(7)\n >>> lists\n [[3], [5], [7]]\n\n Further explanation is available in the FAQ entry *How do I create\n a multidimensional list?*.\n\n3. If *i* or *j* is negative, the index is relative to the end of\n the string: "len(s) + i" or "len(s) + j" is substituted. But note\n that "-0" is still "0".\n\n4. The slice of *s* from *i* to *j* is defined as the sequence of\n items with index *k* such that "i <= k < j". If *i* or *j* is\n greater than "len(s)", use "len(s)". If *i* is omitted or "None",\n use "0". If *j* is omitted or "None", use "len(s)". If *i* is\n greater than or equal to *j*, the slice is empty.\n\n5. The slice of *s* from *i* to *j* with step *k* is defined as the\n sequence of items with index "x = i + n*k" such that "0 <= n <\n (j-i)/k". In other words, the indices are "i", "i+k", "i+2*k",\n "i+3*k" and so on, stopping when *j* is reached (but never\n including *j*). If *i* or *j* is greater than "len(s)", use\n "len(s)". If *i* or *j* are omitted or "None", they become "end"\n values (which end depends on the sign of *k*). Note, *k* cannot be\n zero. If *k* is "None", it is treated like "1".\n\n6. Concatenating immutable sequences always results in a new\n object. This means that building up a sequence by repeated\n concatenation will have a quadratic runtime cost in the total\n sequence length. To get a linear runtime cost, you must switch to\n one of the alternatives below:\n\n * if concatenating "str" objects, you can build a list and use\n "str.join()" at the end or else write to an "io.StringIO"\n instance and retrieve its value when complete\n\n * if concatenating "bytes" objects, you can similarly use\n "bytes.join()" or "io.BytesIO", or you can do in-place\n concatenation with a "bytearray" object. "bytearray" objects are\n mutable and have an efficient overallocation mechanism\n\n * if concatenating "tuple" objects, extend a "list" instead\n\n * for other types, investigate the relevant class documentation\n\n7. Some sequence types (such as "range") only support item\n sequences that follow specific patterns, and hence don\'t support\n sequence concatenation or repetition.\n\n8. "index" raises "ValueError" when *x* is not found in *s*. When\n supported, the additional arguments to the index method allow\n efficient searching of subsections of the sequence. Passing the\n extra arguments is roughly equivalent to using "s[i:j].index(x)",\n only without copying any data and with the returned index being\n relative to the start of the sequence rather than the start of the\n slice.\n\n\nImmutable Sequence Types\n========================\n\nThe only operation that immutable sequence types generally implement\nthat is not also implemented by mutable sequence types is support for\nthe "hash()" built-in.\n\nThis support allows immutable sequences, such as "tuple" instances, to\nbe used as "dict" keys and stored in "set" and "frozenset" instances.\n\nAttempting to hash an immutable sequence that contains unhashable\nvalues will result in "TypeError".\n\n\nMutable Sequence Types\n======================\n\nThe operations in the following table are defined on mutable sequence\ntypes. The "collections.abc.MutableSequence" ABC is provided to make\nit easier to correctly implement these operations on custom sequence\ntypes.\n\nIn the table *s* is an instance of a mutable sequence type, *t* is any\niterable object and *x* is an arbitrary object that meets any type and\nvalue restrictions imposed by *s* (for example, "bytearray" only\naccepts integers that meet the value restriction "0 <= x <= 255").\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| "s[i] = x" | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j] = t" | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j]" | same as "s[i:j] = []" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j:k] = t" | the elements of "s[i:j:k]" are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j:k]" | removes the elements of | |\n| | "s[i:j:k]" from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.append(x)" | appends *x* to the end of the | |\n| | sequence (same as | |\n| | "s[len(s):len(s)] = [x]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.clear()" | removes all items from "s" (same | (5) |\n| | as "del s[:]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.copy()" | creates a shallow copy of "s" | (5) |\n| | (same as "s[:]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.extend(t)" or "s += t" | extends *s* with the contents of | |\n| | *t* (for the most part the same | |\n| | as "s[len(s):len(s)] = t") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s *= n" | updates *s* with its contents | (6) |\n| | repeated *n* times | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.insert(i, x)" | inserts *x* into *s* at the | |\n| | index given by *i* (same as | |\n| | "s[i:i] = [x]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.pop([i])" | retrieves the item at *i* and | (2) |\n| | also removes it from *s* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.remove(x)" | remove the first item from *s* | (3) |\n| | where "s[i] == x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.reverse()" | reverses the items of *s* in | (4) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. The optional argument *i* defaults to "-1", so that by default\n the last item is removed and returned.\n\n3. "remove" raises "ValueError" when *x* is not found in *s*.\n\n4. The "reverse()" method modifies the sequence in place for\n economy of space when reversing a large sequence. To remind users\n that it operates by side effect, it does not return the reversed\n sequence.\n\n5. "clear()" and "copy()" are included for consistency with the\n interfaces of mutable containers that don\'t support slicing\n operations (such as "dict" and "set")\n\n New in version 3.3: "clear()" and "copy()" methods.\n\n6. The value *n* is an integer, or an object implementing\n "__index__()". Zero and negative values of *n* clear the sequence.\n Items in the sequence are not copied; they are referenced multiple\n times, as explained for "s * n" under *Common Sequence Operations*.\n\n\nLists\n=====\n\nLists are mutable sequences, typically used to store collections of\nhomogeneous items (where the precise degree of similarity will vary by\napplication).\n\nclass class list([iterable])\n\n Lists may be constructed in several ways:\n\n * Using a pair of square brackets to denote the empty list: "[]"\n\n * Using square brackets, separating items with commas: "[a]",\n "[a, b, c]"\n\n * Using a list comprehension: "[x for x in iterable]"\n\n * Using the type constructor: "list()" or "list(iterable)"\n\n The constructor builds a list whose items are the same and in the\n same order as *iterable*\'s items. *iterable* may be either a\n sequence, a container that supports iteration, or an iterator\n object. If *iterable* is already a list, a copy is made and\n returned, similar to "iterable[:]". For example, "list(\'abc\')"\n returns "[\'a\', \'b\', \'c\']" and "list( (1, 2, 3) )" returns "[1, 2,\n 3]". If no argument is given, the constructor creates a new empty\n list, "[]".\n\n Many other operations also produce lists, including the "sorted()"\n built-in.\n\n Lists implement all of the *common* and *mutable* sequence\n operations. Lists also provide the following additional method:\n\n sort(*, key=None, reverse=None)\n\n This method sorts the list in place, using only "<" comparisons\n between items. Exceptions are not suppressed - if any comparison\n operations fail, the entire sort operation will fail (and the\n list will likely be left in a partially modified state).\n\n "sort()" accepts two arguments that can only be passed by\n keyword (*keyword-only arguments*):\n\n *key* specifies a function of one argument that is used to\n extract a comparison key from each list element (for example,\n "key=str.lower"). The key corresponding to each item in the list\n is calculated once and then used for the entire sorting process.\n The default value of "None" means that list items are sorted\n directly without calculating a separate key value.\n\n The "functools.cmp_to_key()" utility is available to convert a\n 2.x style *cmp* function to a *key* function.\n\n *reverse* is a boolean value. If set to "True", then the list\n elements are sorted as if each comparison were reversed.\n\n This method modifies the sequence in place for economy of space\n when sorting a large sequence. To remind users that it operates\n by side effect, it does not return the sorted sequence (use\n "sorted()" to explicitly request a new sorted list instance).\n\n The "sort()" method is guaranteed to be stable. A sort is\n stable if it guarantees not to change the relative order of\n elements that compare equal --- this is helpful for sorting in\n multiple passes (for example, sort by department, then by salary\n grade).\n\n **CPython implementation detail:** While a list is being sorted,\n the effect of attempting to mutate, or even inspect, the list is\n undefined. The C implementation of Python makes the list appear\n empty for the duration, and raises "ValueError" if it can detect\n that the list has been mutated during a sort.\n\n\nTuples\n======\n\nTuples are immutable sequences, typically used to store collections of\nheterogeneous data (such as the 2-tuples produced by the "enumerate()"\nbuilt-in). Tuples are also used for cases where an immutable sequence\nof homogeneous data is needed (such as allowing storage in a "set" or\n"dict" instance).\n\nclass class tuple([iterable])\n\n Tuples may be constructed in a number of ways:\n\n * Using a pair of parentheses to denote the empty tuple: "()"\n\n * Using a trailing comma for a singleton tuple: "a," or "(a,)"\n\n * Separating items with commas: "a, b, c" or "(a, b, c)"\n\n * Using the "tuple()" built-in: "tuple()" or "tuple(iterable)"\n\n The constructor builds a tuple whose items are the same and in the\n same order as *iterable*\'s items. *iterable* may be either a\n sequence, a container that supports iteration, or an iterator\n object. If *iterable* is already a tuple, it is returned\n unchanged. For example, "tuple(\'abc\')" returns "(\'a\', \'b\', \'c\')"\n and "tuple( [1, 2, 3] )" returns "(1, 2, 3)". If no argument is\n given, the constructor creates a new empty tuple, "()".\n\n Note that it is actually the comma which makes a tuple, not the\n parentheses. The parentheses are optional, except in the empty\n tuple case, or when they are needed to avoid syntactic ambiguity.\n For example, "f(a, b, c)" is a function call with three arguments,\n while "f((a, b, c))" is a function call with a 3-tuple as the sole\n argument.\n\n Tuples implement all of the *common* sequence operations.\n\nFor heterogeneous collections of data where access by name is clearer\nthan access by index, "collections.namedtuple()" may be a more\nappropriate choice than a simple tuple object.\n\n\nRanges\n======\n\nThe "range" type represents an immutable sequence of numbers and is\ncommonly used for looping a specific number of times in "for" loops.\n\nclass class range(stop)\nclass class range(start, stop[, step])\n\n The arguments to the range constructor must be integers (either\n built-in "int" or any object that implements the "__index__"\n special method). If the *step* argument is omitted, it defaults to\n "1". If the *start* argument is omitted, it defaults to "0". If\n *step* is zero, "ValueError" is raised.\n\n For a positive *step*, the contents of a range "r" are determined\n by the formula "r[i] = start + step*i" where "i >= 0" and "r[i] <\n stop".\n\n For a negative *step*, the contents of the range are still\n determined by the formula "r[i] = start + step*i", but the\n constraints are "i >= 0" and "r[i] > stop".\n\n A range object will be empty if "r[0]" does not meet the value\n constraint. Ranges do support negative indices, but these are\n interpreted as indexing from the end of the sequence determined by\n the positive indices.\n\n Ranges containing absolute values larger than "sys.maxsize" are\n permitted but some features (such as "len()") may raise\n "OverflowError".\n\n Range examples:\n\n >>> list(range(10))\n [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n >>> list(range(1, 11))\n [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n >>> list(range(0, 30, 5))\n [0, 5, 10, 15, 20, 25]\n >>> list(range(0, 10, 3))\n [0, 3, 6, 9]\n >>> list(range(0, -10, -1))\n [0, -1, -2, -3, -4, -5, -6, -7, -8, -9]\n >>> list(range(0))\n []\n >>> list(range(1, 0))\n []\n\n Ranges implement all of the *common* sequence operations except\n concatenation and repetition (due to the fact that range objects\n can only represent sequences that follow a strict pattern and\n repetition and concatenation will usually violate that pattern).\n\n start\n\n The value of the *start* parameter (or "0" if the parameter was\n not supplied)\n\n stop\n\n The value of the *stop* parameter\n\n step\n\n The value of the *step* parameter (or "1" if the parameter was\n not supplied)\n\nThe advantage of the "range" type over a regular "list" or "tuple" is\nthat a "range" object will always take the same (small) amount of\nmemory, no matter the size of the range it represents (as it only\nstores the "start", "stop" and "step" values, calculating individual\nitems and subranges as needed).\n\nRange objects implement the "collections.abc.Sequence" ABC, and\nprovide features such as containment tests, element index lookup,\nslicing and support for negative indices (see *Sequence Types ---\nlist, tuple, range*):\n\n>>> r = range(0, 20, 2)\n>>> r\nrange(0, 20, 2)\n>>> 11 in r\nFalse\n>>> 10 in r\nTrue\n>>> r.index(10)\n5\n>>> r[5]\n10\n>>> r[:5]\nrange(0, 10, 2)\n>>> r[-1]\n18\n\nTesting range objects for equality with "==" and "!=" compares them as\nsequences. That is, two range objects are considered equal if they\nrepresent the same sequence of values. (Note that two range objects\nthat compare equal might have different "start", "stop" and "step"\nattributes, for example "range(0) == range(2, 1, 3)" or "range(0, 3,\n2) == range(0, 4, 2)".)\n\nChanged in version 3.2: Implement the Sequence ABC. Support slicing\nand negative indices. Test "int" objects for membership in constant\ntime instead of iterating through all items.\n\nChanged in version 3.3: Define \'==\' and \'!=\' to compare range objects\nbased on the sequence of values they define (instead of comparing\nbased on object identity).\n\nNew in version 3.3: The "start", "stop" and "step" attributes.\n', 'typesseq-mutable': u'\nMutable Sequence Types\n**********************\n\nThe operations in the following table are defined on mutable sequence\ntypes. The "collections.abc.MutableSequence" ABC is provided to make\nit easier to correctly implement these operations on custom sequence\ntypes.\n\nIn the table *s* is an instance of a mutable sequence type, *t* is any\niterable object and *x* is an arbitrary object that meets any type and\nvalue restrictions imposed by *s* (for example, "bytearray" only\naccepts integers that meet the value restriction "0 <= x <= 255").\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| "s[i] = x" | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j] = t" | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j]" | same as "s[i:j] = []" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j:k] = t" | the elements of "s[i:j:k]" are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j:k]" | removes the elements of | |\n| | "s[i:j:k]" from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.append(x)" | appends *x* to the end of the | |\n| | sequence (same as | |\n| | "s[len(s):len(s)] = [x]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.clear()" | removes all items from "s" (same | (5) |\n| | as "del s[:]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.copy()" | creates a shallow copy of "s" | (5) |\n| | (same as "s[:]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.extend(t)" or "s += t" | extends *s* with the contents of | |\n| | *t* (for the most part the same | |\n| | as "s[len(s):len(s)] = t") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s *= n" | updates *s* with its contents | (6) |\n| | repeated *n* times | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.insert(i, x)" | inserts *x* into *s* at the | |\n| | index given by *i* (same as | |\n| | "s[i:i] = [x]") | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.pop([i])" | retrieves the item at *i* and | (2) |\n| | also removes it from *s* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.remove(x)" | remove the first item from *s* | (3) |\n| | where "s[i] == x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.reverse()" | reverses the items of *s* in | (4) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. The optional argument *i* defaults to "-1", so that by default\n the last item is removed and returned.\n\n3. "remove" raises "ValueError" when *x* is not found in *s*.\n\n4. The "reverse()" method modifies the sequence in place for\n economy of space when reversing a large sequence. To remind users\n that it operates by side effect, it does not return the reversed\n sequence.\n\n5. "clear()" and "copy()" are included for consistency with the\n interfaces of mutable containers that don\'t support slicing\n operations (such as "dict" and "set")\n\n New in version 3.3: "clear()" and "copy()" methods.\n\n6. The value *n* is an integer, or an object implementing\n "__index__()". Zero and negative values of *n* clear the sequence.\n Items in the sequence are not copied; they are referenced multiple\n times, as explained for "s * n" under *Common Sequence Operations*.\n', 'unary': u'\nUnary arithmetic and bitwise operations\n***************************************\n\nAll unary arithmetic and bitwise operations have the same priority:\n\n u_expr ::= power | "-" u_expr | "+" u_expr | "~" u_expr\n\nThe unary "-" (minus) operator yields the negation of its numeric\nargument.\n\nThe unary "+" (plus) operator yields its numeric argument unchanged.\n\nThe unary "~" (invert) operator yields the bitwise inversion of its\ninteger argument. The bitwise inversion of "x" is defined as\n"-(x+1)". It only applies to integral numbers.\n\nIn all three cases, if the argument does not have the proper type, a\n"TypeError" exception is raised.\n', 'while': u'\nThe "while" statement\n*********************\n\nThe "while" statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the "else" clause, if present, is executed\nand the loop terminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and goes back\nto testing the expression.\n', - 'with': u'\nThe "with" statement\n********************\n\nThe "with" statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section *With Statement\nContext Managers*). This allows common "try"..."except"..."finally"\nusage patterns to be encapsulated for convenient reuse.\n\n with_stmt ::= "with" with_item ("," with_item)* ":" suite\n with_item ::= expression ["as" target]\n\nThe execution of the "with" statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the "with_item")\n is evaluated to obtain a context manager.\n\n2. The context manager\'s "__exit__()" is loaded for later use.\n\n3. The context manager\'s "__enter__()" method is invoked.\n\n4. If a target was included in the "with" statement, the return\n value from "__enter__()" is assigned to it.\n\n Note: The "with" statement guarantees that if the "__enter__()"\n method returns without an error, then "__exit__()" will always be\n called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s "__exit__()" method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to "__exit__()". Otherwise, three\n "None" arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the "__exit__()" method was false, the exception is reraised.\n If the return value was true, the exception is suppressed, and\n execution continues with the statement following the "with"\n statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from "__exit__()" is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple "with" statements were nested:\n\n with A() as a, B() as b:\n suite\n\nis equivalent to\n\n with A() as a:\n with B() as b:\n suite\n\nChanged in version 3.1: Support for multiple context expressions.\n\nSee also: **PEP 0343** - The "with" statement\n\n The specification, background, and examples for the Python "with"\n statement.\n', + 'with': u'\nThe "with" statement\n********************\n\nThe "with" statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section *With Statement\nContext Managers*). This allows common "try"..."except"..."finally"\nusage patterns to be encapsulated for convenient reuse.\n\n with_stmt ::= "with" with_item ("," with_item)* ":" suite\n with_item ::= expression ["as" target]\n\nThe execution of the "with" statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the "with_item")\n is evaluated to obtain a context manager.\n\n2. The context manager\'s "__exit__()" is loaded for later use.\n\n3. The context manager\'s "__enter__()" method is invoked.\n\n4. If a target was included in the "with" statement, the return\n value from "__enter__()" is assigned to it.\n\n Note: The "with" statement guarantees that if the "__enter__()"\n method returns without an error, then "__exit__()" will always be\n called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s "__exit__()" method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to "__exit__()". Otherwise, three\n "None" arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the "__exit__()" method was false, the exception is reraised.\n If the return value was true, the exception is suppressed, and\n execution continues with the statement following the "with"\n statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from "__exit__()" is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple "with" statements were nested:\n\n with A() as a, B() as b:\n suite\n\nis equivalent to\n\n with A() as a:\n with B() as b:\n suite\n\nChanged in version 3.1: Support for multiple context expressions.\n\nSee also: **PEP 343** - The "with" statement\n\n The specification, background, and examples for the Python "with"\n statement.\n', 'yield': u'\nThe "yield" statement\n*********************\n\n yield_stmt ::= yield_expression\n\nA "yield" statement is semantically equivalent to a *yield\nexpression*. The yield statement can be used to omit the parentheses\nthat would otherwise be required in the equivalent yield expression\nstatement. For example, the yield statements\n\n yield \n yield from \n\nare equivalent to the yield expression statements\n\n (yield )\n (yield from )\n\nYield expressions and statements are only used when defining a\n*generator* function, and are only used in the body of the generator\nfunction. Using yield in a function definition is sufficient to cause\nthat definition to create a generator function instead of a normal\nfunction.\n\nFor full details of "yield" semantics, refer to the *Yield\nexpressions* section.\n'} -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 23:33:59 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 13 Jun 2016 03:33:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E4=29=3A_Release_bump_f?= =?utf-8?b?b3IgMy40LjVyYzEu?= Message-ID: <20160613033359.19931.66342.F3A1E048@psf.io> https://hg.python.org/cpython/rev/3631bb4a2490 changeset: 101969:3631bb4a2490 branch: 3.4 tag: v3.4.5rc1 user: Larry Hastings date: Sat Jun 11 22:24:03 2016 -0700 summary: Release bump for 3.4.5rc1. files: Include/patchlevel.h | 8 ++++---- Misc/NEWS | 8 ++++---- README | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -18,12 +18,12 @@ /*--start constants--*/ #define PY_MAJOR_VERSION 3 #define PY_MINOR_VERSION 4 -#define PY_MICRO_VERSION 4 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL -#define PY_RELEASE_SERIAL 0 +#define PY_MICRO_VERSION 5 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA +#define PY_RELEASE_SERIAL 1 /* Version as a string */ -#define PY_VERSION "3.4.4+" +#define PY_VERSION "3.4.5rc1" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,10 +2,10 @@ Python News +++++++++++ -What's New in Python 3.4.5? -=========================== - -Release date: tba +What's New in Python 3.4.5rc1? +============================== + +Release date: 2016-06-11 Core and Builtins ----------------- diff --git a/README b/README --- a/README +++ b/README @@ -1,5 +1,5 @@ -This is Python version 3.4.4 -============================ +This is Python version 3.4.5 release candidate 1 +================================================ Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Python Software Foundation. All rights reserved. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 23:34:04 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 13 Jun 2016 03:34:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E4=29=3A_Added_tag_v3?= =?utf-8?q?=2E4=2E5rc1_for_changeset_3631bb4a2490?= Message-ID: <20160613033359.120818.77650.746EBE64@psf.io> https://hg.python.org/cpython/rev/ca24b5b2d7fe changeset: 101970:ca24b5b2d7fe branch: 3.4 user: Larry Hastings date: Sat Jun 11 22:25:43 2016 -0700 summary: Added tag v3.4.5rc1 for changeset 3631bb4a2490 files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -146,3 +146,4 @@ b4cbecbc0781e89a309d03b60a1f75f8499250e6 v3.4.3 04f3f725896c6961212c3a12e8ac25be6958f4fa v3.4.4rc1 737efcadf5a678b184e0fa431aae11276bf06648 v3.4.4 +3631bb4a2490292ebf81d3e947ae36da145da564 v3.4.5rc1 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 23:34:04 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 13 Jun 2016 03:34:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E4=29=3A_Regenerate_pyd?= =?utf-8?q?oc_topics_for_3=2E4=2E5rc1=2E?= Message-ID: <20160613033359.99278.91536.29768150@psf.io> https://hg.python.org/cpython/rev/837f4c7fd10a changeset: 101968:837f4c7fd10a branch: 3.4 parent: 101892:bb3ce78572f5 user: Larry Hastings date: Sat Jun 11 22:22:07 2016 -0700 summary: Regenerate pydoc topics for 3.4.5rc1. files: Lib/pydoc_data/topics.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Sat Dec 19 19:27:32 2015 +# Autogenerated by Sphinx on Sat Jun 11 22:20:49 2016 topics = {'assert': u'\nThe "assert" statement\n**********************\n\nAssert statements are a convenient way to insert debugging assertions\ninto a program:\n\n assert_stmt ::= "assert" expression ["," expression]\n\nThe simple form, "assert expression", is equivalent to\n\n if __debug__:\n if not expression: raise AssertionError\n\nThe extended form, "assert expression1, expression2", is equivalent to\n\n if __debug__:\n if not expression1: raise AssertionError(expression2)\n\nThese equivalences assume that "__debug__" and "AssertionError" refer\nto the built-in variables with those names. In the current\nimplementation, the built-in variable "__debug__" is "True" under\nnormal circumstances, "False" when optimization is requested (command\nline option -O). The current code generator emits no code for an\nassert statement when optimization is requested at compile time. Note\nthat it is unnecessary to include the source code for the expression\nthat failed in the error message; it will be displayed as part of the\nstack trace.\n\nAssignments to "__debug__" are illegal. The value for the built-in\nvariable is determined when the interpreter starts.\n', 'assignment': u'\nAssignment statements\n*********************\n\nAssignment statements are used to (re)bind names to values and to\nmodify attributes or items of mutable objects:\n\n assignment_stmt ::= (target_list "=")+ (expression_list | yield_expression)\n target_list ::= target ("," target)* [","]\n target ::= identifier\n | "(" target_list ")"\n | "[" target_list "]"\n | attributeref\n | subscription\n | slicing\n | "*" target\n\n(See section *Primaries* for the syntax definitions for\n*attributeref*, *subscription*, and *slicing*.)\n\nAn assignment statement evaluates the expression list (remember that\nthis can be a single expression or a comma-separated list, the latter\nyielding a tuple) and assigns the single resulting object to each of\nthe target lists, from left to right.\n\nAssignment is defined recursively depending on the form of the target\n(list). When a target is part of a mutable object (an attribute\nreference, subscription or slicing), the mutable object must\nultimately perform the assignment and decide about its validity, and\nmay raise an exception if the assignment is unacceptable. The rules\nobserved by various types and the exceptions raised are given with the\ndefinition of the object types (see section *The standard type\nhierarchy*).\n\nAssignment of an object to a target list, optionally enclosed in\nparentheses or square brackets, is recursively defined as follows.\n\n* If the target list is a single target: The object is assigned to\n that target.\n\n* If the target list is a comma-separated list of targets: The\n object must be an iterable with the same number of items as there\n are targets in the target list, and the items are assigned, from\n left to right, to the corresponding targets.\n\n * If the target list contains one target prefixed with an\n asterisk, called a "starred" target: The object must be a sequence\n with at least as many items as there are targets in the target\n list, minus one. The first items of the sequence are assigned,\n from left to right, to the targets before the starred target. The\n final items of the sequence are assigned to the targets after the\n starred target. A list of the remaining items in the sequence is\n then assigned to the starred target (the list can be empty).\n\n * Else: The object must be a sequence with the same number of\n items as there are targets in the target list, and the items are\n assigned, from left to right, to the corresponding targets.\n\nAssignment of an object to a single target is recursively defined as\nfollows.\n\n* If the target is an identifier (name):\n\n * If the name does not occur in a "global" or "nonlocal" statement\n in the current code block: the name is bound to the object in the\n current local namespace.\n\n * Otherwise: the name is bound to the object in the global\n namespace or the outer namespace determined by "nonlocal",\n respectively.\n\n The name is rebound if it was already bound. This may cause the\n reference count for the object previously bound to the name to reach\n zero, causing the object to be deallocated and its destructor (if it\n has one) to be called.\n\n* If the target is a target list enclosed in parentheses or in\n square brackets: The object must be an iterable with the same number\n of items as there are targets in the target list, and its items are\n assigned, from left to right, to the corresponding targets.\n\n* If the target is an attribute reference: The primary expression in\n the reference is evaluated. It should yield an object with\n assignable attributes; if this is not the case, "TypeError" is\n raised. That object is then asked to assign the assigned object to\n the given attribute; if it cannot perform the assignment, it raises\n an exception (usually but not necessarily "AttributeError").\n\n Note: If the object is a class instance and the attribute reference\n occurs on both sides of the assignment operator, the RHS expression,\n "a.x" can access either an instance attribute or (if no instance\n attribute exists) a class attribute. The LHS target "a.x" is always\n set as an instance attribute, creating it if necessary. Thus, the\n two occurrences of "a.x" do not necessarily refer to the same\n attribute: if the RHS expression refers to a class attribute, the\n LHS creates a new instance attribute as the target of the\n assignment:\n\n class Cls:\n x = 3 # class variable\n inst = Cls()\n inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x as 3\n\n This description does not necessarily apply to descriptor\n attributes, such as properties created with "property()".\n\n* If the target is a subscription: The primary expression in the\n reference is evaluated. It should yield either a mutable sequence\n object (such as a list) or a mapping object (such as a dictionary).\n Next, the subscript expression is evaluated.\n\n If the primary is a mutable sequence object (such as a list), the\n subscript must yield an integer. If it is negative, the sequence\'s\n length is added to it. The resulting value must be a nonnegative\n integer less than the sequence\'s length, and the sequence is asked\n to assign the assigned object to its item with that index. If the\n index is out of range, "IndexError" is raised (assignment to a\n subscripted sequence cannot add new items to a list).\n\n If the primary is a mapping object (such as a dictionary), the\n subscript must have a type compatible with the mapping\'s key type,\n and the mapping is then asked to create a key/datum pair which maps\n the subscript to the assigned object. This can either replace an\n existing key/value pair with the same key value, or insert a new\n key/value pair (if no key with the same value existed).\n\n For user-defined objects, the "__setitem__()" method is called with\n appropriate arguments.\n\n* If the target is a slicing: The primary expression in the\n reference is evaluated. It should yield a mutable sequence object\n (such as a list). The assigned object should be a sequence object\n of the same type. Next, the lower and upper bound expressions are\n evaluated, insofar they are present; defaults are zero and the\n sequence\'s length. The bounds should evaluate to integers. If\n either bound is negative, the sequence\'s length is added to it. The\n resulting bounds are clipped to lie between zero and the sequence\'s\n length, inclusive. Finally, the sequence object is asked to replace\n the slice with the items of the assigned sequence. The length of\n the slice may be different from the length of the assigned sequence,\n thus changing the length of the target sequence, if the target\n sequence allows it.\n\n**CPython implementation detail:** In the current implementation, the\nsyntax for targets is taken to be the same as for expressions, and\ninvalid syntax is rejected during the code generation phase, causing\nless detailed error messages.\n\nAlthough the definition of assignment implies that overlaps between\nthe left-hand side and the right-hand side are \'simultanenous\' (for\nexample "a, b = b, a" swaps two variables), overlaps *within* the\ncollection of assigned-to variables occur left-to-right, sometimes\nresulting in confusion. For instance, the following program prints\n"[0, 2]":\n\n x = [0, 1]\n i = 0\n i, x[i] = 1, 2 # i is updated, then x[i] is updated\n print(x)\n\nSee also: **PEP 3132** - Extended Iterable Unpacking\n\n The specification for the "*target" feature.\n\n\nAugmented assignment statements\n===============================\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n augtarget ::= identifier | attributeref | subscription | slicing\n augop ::= "+=" | "-=" | "*=" | "/=" | "//=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section *Primaries* for the syntax definitions of the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like "x += 1" can be rewritten as\n"x = x + 1" to achieve a similar, but not exactly equal effect. In the\naugmented version, "x" is only evaluated once. Also, when possible,\nthe actual operation is performed *in-place*, meaning that rather than\ncreating a new object and assigning that to the target, the old object\nis modified instead.\n\nUnlike normal assignments, augmented assignments evaluate the left-\nhand side *before* evaluating the right-hand side. For example, "a[i]\n+= f(x)" first looks-up "a[i]", then it evaluates "f(x)" and performs\nthe addition, and lastly, it writes the result back to "a[i]".\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same *caveat about\nclass and instance attributes* applies as for regular assignments.\n', 'atom-identifiers': u'\nIdentifiers (Names)\n*******************\n\nAn identifier occurring as an atom is a name. See section\n*Identifiers and keywords* for lexical definition and section *Naming\nand binding* for documentation of naming and binding.\n\nWhen the name is bound to an object, evaluation of the atom yields\nthat object. When a name is not bound, an attempt to evaluate it\nraises a "NameError" exception.\n\n**Private name mangling:** When an identifier that textually occurs in\na class definition begins with two or more underscore characters and\ndoes not end in two or more underscores, it is considered a *private\nname* of that class. Private names are transformed to a longer form\nbefore code is generated for them. The transformation inserts the\nclass name, with leading underscores removed and a single underscore\ninserted, in front of the name. For example, the identifier "__spam"\noccurring in a class named "Ham" will be transformed to "_Ham__spam".\nThis transformation is independent of the syntactical context in which\nthe identifier is used. If the transformed name is extremely long\n(longer than 255 characters), implementation defined truncation may\nhappen. If the class name consists only of underscores, no\ntransformation is done.\n', @@ -61,7 +61,7 @@ 'slicings': u'\nSlicings\n********\n\nA slicing selects a range of items in a sequence object (e.g., a\nstring, tuple or list). Slicings may be used as expressions or as\ntargets in assignment or "del" statements. The syntax for a slicing:\n\n slicing ::= primary "[" slice_list "]"\n slice_list ::= slice_item ("," slice_item)* [","]\n slice_item ::= expression | proper_slice\n proper_slice ::= [lower_bound] ":" [upper_bound] [ ":" [stride] ]\n lower_bound ::= expression\n upper_bound ::= expression\n stride ::= expression\n\nThere is ambiguity in the formal syntax here: anything that looks like\nan expression list also looks like a slice list, so any subscription\ncan be interpreted as a slicing. Rather than further complicating the\nsyntax, this is disambiguated by defining that in this case the\ninterpretation as a subscription takes priority over the\ninterpretation as a slicing (this is the case if the slice list\ncontains no proper slice).\n\nThe semantics for a slicing are as follows. The primary is indexed\n(using the same "__getitem__()" method as normal subscription) with a\nkey that is constructed from the slice list, as follows. If the slice\nlist contains at least one comma, the key is a tuple containing the\nconversion of the slice items; otherwise, the conversion of the lone\nslice item is the key. The conversion of a slice item that is an\nexpression is that expression. The conversion of a proper slice is a\nslice object (see section *The standard type hierarchy*) whose\n"start", "stop" and "step" attributes are the values of the\nexpressions given as lower bound, upper bound and stride,\nrespectively, substituting "None" for missing expressions.\n', 'specialattrs': u'\nSpecial Attributes\n******************\n\nThe implementation adds a few special read-only attributes to several\nobject types, where they are relevant. Some of these are not reported\nby the "dir()" built-in function.\n\nobject.__dict__\n\n A dictionary or other mapping object used to store an object\'s\n (writable) attributes.\n\ninstance.__class__\n\n The class to which a class instance belongs.\n\nclass.__bases__\n\n The tuple of base classes of a class object.\n\nclass.__name__\n\n The name of the class or type.\n\nclass.__qualname__\n\n The *qualified name* of the class or type.\n\n New in version 3.3.\n\nclass.__mro__\n\n This attribute is a tuple of classes that are considered when\n looking for base classes during method resolution.\n\nclass.mro()\n\n This method can be overridden by a metaclass to customize the\n method resolution order for its instances. It is called at class\n instantiation, and its result is stored in "__mro__".\n\nclass.__subclasses__()\n\n Each class keeps a list of weak references to its immediate\n subclasses. This method returns a list of all those references\n still alive. Example:\n\n >>> int.__subclasses__()\n []\n\n-[ Footnotes ]-\n\n[1] Additional information on these special methods may be found\n in the Python Reference Manual (*Basic customization*).\n\n[2] As a consequence, the list "[1, 2]" is considered equal to\n "[1.0, 2.0]", and similarly for tuples.\n\n[3] They must have since the parser can\'t tell the type of the\n operands.\n\n[4] Cased characters are those with general category property\n being one of "Lu" (Letter, uppercase), "Ll" (Letter, lowercase),\n or "Lt" (Letter, titlecase).\n\n[5] To format only a tuple you should therefore provide a\n singleton tuple whose only element is the tuple to be formatted.\n', 'specialnames': u'\nSpecial method names\n********************\n\nA class can implement certain operations that are invoked by special\nsyntax (such as arithmetic operations or subscripting and slicing) by\ndefining methods with special names. This is Python\'s approach to\n*operator overloading*, allowing classes to define their own behavior\nwith respect to language operators. For instance, if a class defines\na method named "__getitem__()", and "x" is an instance of this class,\nthen "x[i]" is roughly equivalent to "type(x).__getitem__(x, i)".\nExcept where mentioned, attempts to execute an operation raise an\nexception when no appropriate method is defined (typically\n"AttributeError" or "TypeError").\n\nWhen implementing a class that emulates any built-in type, it is\nimportant that the emulation only be implemented to the degree that it\nmakes sense for the object being modelled. For example, some\nsequences may work well with retrieval of individual elements, but\nextracting a slice may not make sense. (One example of this is the\n"NodeList" interface in the W3C\'s Document Object Model.)\n\n\nBasic customization\n===================\n\nobject.__new__(cls[, ...])\n\n Called to create a new instance of class *cls*. "__new__()" is a\n static method (special-cased so you need not declare it as such)\n that takes the class of which an instance was requested as its\n first argument. The remaining arguments are those passed to the\n object constructor expression (the call to the class). The return\n value of "__new__()" should be the new object instance (usually an\n instance of *cls*).\n\n Typical implementations create a new instance of the class by\n invoking the superclass\'s "__new__()" method using\n "super(currentclass, cls).__new__(cls[, ...])" with appropriate\n arguments and then modifying the newly-created instance as\n necessary before returning it.\n\n If "__new__()" returns an instance of *cls*, then the new\n instance\'s "__init__()" method will be invoked like\n "__init__(self[, ...])", where *self* is the new instance and the\n remaining arguments are the same as were passed to "__new__()".\n\n If "__new__()" does not return an instance of *cls*, then the new\n instance\'s "__init__()" method will not be invoked.\n\n "__new__()" is intended mainly to allow subclasses of immutable\n types (like int, str, or tuple) to customize instance creation. It\n is also commonly overridden in custom metaclasses in order to\n customize class creation.\n\nobject.__init__(self[, ...])\n\n Called after the instance has been created (by "__new__()"), but\n before it is returned to the caller. The arguments are those\n passed to the class constructor expression. If a base class has an\n "__init__()" method, the derived class\'s "__init__()" method, if\n any, must explicitly call it to ensure proper initialization of the\n base class part of the instance; for example:\n "BaseClass.__init__(self, [args...])".\n\n Because "__new__()" and "__init__()" work together in constructing\n objects ("__new__()" to create it, and "__init__()" to customise\n it), no non-"None" value may be returned by "__init__()"; doing so\n will cause a "TypeError" to be raised at runtime.\n\nobject.__del__(self)\n\n Called when the instance is about to be destroyed. This is also\n called a destructor. If a base class has a "__del__()" method, the\n derived class\'s "__del__()" method, if any, must explicitly call it\n to ensure proper deletion of the base class part of the instance.\n Note that it is possible (though not recommended!) for the\n "__del__()" method to postpone destruction of the instance by\n creating a new reference to it. It may then be called at a later\n time when this new reference is deleted. It is not guaranteed that\n "__del__()" methods are called for objects that still exist when\n the interpreter exits.\n\n Note: "del x" doesn\'t directly call "x.__del__()" --- the former\n decrements the reference count for "x" by one, and the latter is\n only called when "x"\'s reference count reaches zero. Some common\n situations that may prevent the reference count of an object from\n going to zero include: circular references between objects (e.g.,\n a doubly-linked list or a tree data structure with parent and\n child pointers); a reference to the object on the stack frame of\n a function that caught an exception (the traceback stored in\n "sys.exc_info()[2]" keeps the stack frame alive); or a reference\n to the object on the stack frame that raised an unhandled\n exception in interactive mode (the traceback stored in\n "sys.last_traceback" keeps the stack frame alive). The first\n situation can only be remedied by explicitly breaking the cycles;\n the second can be resolved by freeing the reference to the\n traceback object when it is no longer useful, and the third can\n be resolved by storing "None" in "sys.last_traceback". Circular\n references which are garbage are detected and cleaned up when the\n cyclic garbage collector is enabled (it\'s on by default). Refer\n to the documentation for the "gc" module for more information\n about this topic.\n\n Warning: Due to the precarious circumstances under which\n "__del__()" methods are invoked, exceptions that occur during\n their execution are ignored, and a warning is printed to\n "sys.stderr" instead. Also, when "__del__()" is invoked in\n response to a module being deleted (e.g., when execution of the\n program is done), other globals referenced by the "__del__()"\n method may already have been deleted or in the process of being\n torn down (e.g. the import machinery shutting down). For this\n reason, "__del__()" methods should do the absolute minimum needed\n to maintain external invariants. Starting with version 1.5,\n Python guarantees that globals whose name begins with a single\n underscore are deleted from their module before other globals are\n deleted; if no other references to such globals exist, this may\n help in assuring that imported modules are still available at the\n time when the "__del__()" method is called.\n\nobject.__repr__(self)\n\n Called by the "repr()" built-in function to compute the "official"\n string representation of an object. If at all possible, this\n should look like a valid Python expression that could be used to\n recreate an object with the same value (given an appropriate\n environment). If this is not possible, a string of the form\n "<...some useful description...>" should be returned. The return\n value must be a string object. If a class defines "__repr__()" but\n not "__str__()", then "__repr__()" is also used when an "informal"\n string representation of instances of that class is required.\n\n This is typically used for debugging, so it is important that the\n representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n Called by "str(object)" and the built-in functions "format()" and\n "print()" to compute the "informal" or nicely printable string\n representation of an object. The return value must be a *string*\n object.\n\n This method differs from "object.__repr__()" in that there is no\n expectation that "__str__()" return a valid Python expression: a\n more convenient or concise representation can be used.\n\n The default implementation defined by the built-in type "object"\n calls "object.__repr__()".\n\nobject.__bytes__(self)\n\n Called by "bytes()" to compute a byte-string representation of an\n object. This should return a "bytes" object.\n\nobject.__format__(self, format_spec)\n\n Called by the "format()" built-in function (and by extension, the\n "str.format()" method of class "str") to produce a "formatted"\n string representation of an object. The "format_spec" argument is a\n string that contains a description of the formatting options\n desired. The interpretation of the "format_spec" argument is up to\n the type implementing "__format__()", however most classes will\n either delegate formatting to one of the built-in types, or use a\n similar formatting option syntax.\n\n See *Format Specification Mini-Language* for a description of the\n standard formatting syntax.\n\n The return value must be a string object.\n\n Changed in version 3.4: The __format__ method of "object" itself\n raises a "TypeError" if passed any non-empty string.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n These are the so-called "rich comparison" methods. The\n correspondence between operator symbols and method names is as\n follows: "xy" calls\n "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n\n A rich comparison method may return the singleton "NotImplemented"\n if it does not implement the operation for a given pair of\n arguments. By convention, "False" and "True" are returned for a\n successful comparison. However, these methods can return any value,\n so if the comparison operator is used in a Boolean context (e.g.,\n in the condition of an "if" statement), Python will call "bool()"\n on the value to determine if the result is true or false.\n\n By default, "__ne__()" delegates to "__eq__()" and inverts the\n result unless it is "NotImplemented". There are no other implied\n relationships among the comparison operators, for example, the\n truth of "(x.__hash__".\n\n If a class that does not override "__eq__()" wishes to suppress\n hash support, it should include "__hash__ = None" in the class\n definition. A class which defines its own "__hash__()" that\n explicitly raises a "TypeError" would be incorrectly identified as\n hashable by an "isinstance(obj, collections.Hashable)" call.\n\n Note: By default, the "__hash__()" values of str, bytes and\n datetime objects are "salted" with an unpredictable random value.\n Although they remain constant within an individual Python\n process, they are not predictable between repeated invocations of\n Python.This is intended to provide protection against a denial-\n of-service caused by carefully-chosen inputs that exploit the\n worst case performance of a dict insertion, O(n^2) complexity.\n See http://www.ocert.org/advisories/ocert-2011-003.html for\n details.Changing hash values affects the iteration order of\n dicts, sets and other mappings. Python has never made guarantees\n about this ordering (and it typically varies between 32-bit and\n 64-bit builds).See also "PYTHONHASHSEED".\n\n Changed in version 3.3: Hash randomization is enabled by default.\n\nobject.__bool__(self)\n\n Called to implement truth value testing and the built-in operation\n "bool()"; should return "False" or "True". When this method is not\n defined, "__len__()" is called, if it is defined, and the object is\n considered true if its result is nonzero. If a class defines\n neither "__len__()" nor "__bool__()", all its instances are\n considered true.\n\n\nCustomizing attribute access\n============================\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of "x.name") for\nclass instances.\n\nobject.__getattr__(self, name)\n\n Called when an attribute lookup has not found the attribute in the\n usual places (i.e. it is not an instance attribute nor is it found\n in the class tree for "self"). "name" is the attribute name. This\n method should return the (computed) attribute value or raise an\n "AttributeError" exception.\n\n Note that if the attribute is found through the normal mechanism,\n "__getattr__()" is not called. (This is an intentional asymmetry\n between "__getattr__()" and "__setattr__()".) This is done both for\n efficiency reasons and because otherwise "__getattr__()" would have\n no way to access other attributes of the instance. Note that at\n least for instance variables, you can fake total control by not\n inserting any values in the instance attribute dictionary (but\n instead inserting them in another object). See the\n "__getattribute__()" method below for a way to actually get total\n control over attribute access.\n\nobject.__getattribute__(self, name)\n\n Called unconditionally to implement attribute accesses for\n instances of the class. If the class also defines "__getattr__()",\n the latter will not be called unless "__getattribute__()" either\n calls it explicitly or raises an "AttributeError". This method\n should return the (computed) attribute value or raise an\n "AttributeError" exception. In order to avoid infinite recursion in\n this method, its implementation should always call the base class\n method with the same name to access any attributes it needs, for\n example, "object.__getattribute__(self, name)".\n\n Note: This method may still be bypassed when looking up special\n methods as the result of implicit invocation via language syntax\n or built-in functions. See *Special method lookup*.\n\nobject.__setattr__(self, name, value)\n\n Called when an attribute assignment is attempted. This is called\n instead of the normal mechanism (i.e. store the value in the\n instance dictionary). *name* is the attribute name, *value* is the\n value to be assigned to it.\n\n If "__setattr__()" wants to assign to an instance attribute, it\n should call the base class method with the same name, for example,\n "object.__setattr__(self, name, value)".\n\nobject.__delattr__(self, name)\n\n Like "__setattr__()" but for attribute deletion instead of\n assignment. This should only be implemented if "del obj.name" is\n meaningful for the object.\n\nobject.__dir__(self)\n\n Called when "dir()" is called on the object. A sequence must be\n returned. "dir()" converts the returned sequence to a list and\n sorts it.\n\n\nImplementing Descriptors\n------------------------\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in an\n*owner* class (the descriptor must be in either the owner\'s class\ndictionary or in the class dictionary for one of its parents). In the\nexamples below, "the attribute" refers to the attribute whose name is\nthe key of the property in the owner class\' "__dict__".\n\nobject.__get__(self, instance, owner)\n\n Called to get the attribute of the owner class (class attribute\n access) or of an instance of that class (instance attribute\n access). *owner* is always the owner class, while *instance* is the\n instance that the attribute was accessed through, or "None" when\n the attribute is accessed through the *owner*. This method should\n return the (computed) attribute value or raise an "AttributeError"\n exception.\n\nobject.__set__(self, instance, value)\n\n Called to set the attribute on an instance *instance* of the owner\n class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n Called to delete the attribute on an instance *instance* of the\n owner class.\n\nThe attribute "__objclass__" is interpreted by the "inspect" module as\nspecifying the class where this object was defined (setting this\nappropriately can assist in runtime introspection of dynamic class\nattributes). For callables, it may indicate that an instance of the\ngiven type (or a subclass) is expected or required as the first\npositional argument (for example, CPython sets this attribute for\nunbound methods that are implemented in C).\n\n\nInvoking Descriptors\n--------------------\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol: "__get__()", "__set__()", and\n"__delete__()". If any of those methods are defined for an object, it\nis said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, "a.x" has a\nlookup chain starting with "a.__dict__[\'x\']", then\n"type(a).__dict__[\'x\']", and continuing through the base classes of\n"type(a)" excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead. Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called.\n\nThe starting point for descriptor invocation is a binding, "a.x". How\nthe arguments are assembled depends on "a":\n\nDirect Call\n The simplest and least common call is when user code directly\n invokes a descriptor method: "x.__get__(a)".\n\nInstance Binding\n If binding to an object instance, "a.x" is transformed into the\n call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n\nClass Binding\n If binding to a class, "A.x" is transformed into the call:\n "A.__dict__[\'x\'].__get__(None, A)".\n\nSuper Binding\n If "a" is an instance of "super", then the binding "super(B,\n obj).m()" searches "obj.__class__.__mro__" for the base class "A"\n immediately preceding "B" and then invokes the descriptor with the\n call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined. A descriptor can define\nany combination of "__get__()", "__set__()" and "__delete__()". If it\ndoes not define "__get__()", then accessing the attribute will return\nthe descriptor object itself unless there is a value in the object\'s\ninstance dictionary. If the descriptor defines "__set__()" and/or\n"__delete__()", it is a data descriptor; if it defines neither, it is\na non-data descriptor. Normally, data descriptors define both\n"__get__()" and "__set__()", while non-data descriptors have just the\n"__get__()" method. Data descriptors with "__set__()" and "__get__()"\ndefined always override a redefinition in an instance dictionary. In\ncontrast, non-data descriptors can be overridden by instances.\n\nPython methods (including "staticmethod()" and "classmethod()") are\nimplemented as non-data descriptors. Accordingly, instances can\nredefine and override methods. This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe "property()" function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n---------\n\nBy default, instances of classes have a dictionary for attribute\nstorage. This wastes space for objects having very few instance\nvariables. The space consumption can become acute when creating large\nnumbers of instances.\n\nThe default can be overridden by defining *__slots__* in a class\ndefinition. The *__slots__* declaration takes a sequence of instance\nvariables and reserves just enough space in each instance to hold a\nvalue for each variable. Space is saved because *__dict__* is not\ncreated for each instance.\n\nobject.__slots__\n\n This class variable can be assigned a string, iterable, or sequence\n of strings with variable names used by instances. *__slots__*\n reserves space for the declared variables and prevents the\n automatic creation of *__dict__* and *__weakref__* for each\n instance.\n\n\nNotes on using *__slots__*\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n* When inheriting from a class without *__slots__*, the *__dict__*\n attribute of that class will always be accessible, so a *__slots__*\n definition in the subclass is meaningless.\n\n* Without a *__dict__* variable, instances cannot be assigned new\n variables not listed in the *__slots__* definition. Attempts to\n assign to an unlisted variable name raises "AttributeError". If\n dynamic assignment of new variables is desired, then add\n "\'__dict__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n* Without a *__weakref__* variable for each instance, classes\n defining *__slots__* do not support weak references to its\n instances. If weak reference support is needed, then add\n "\'__weakref__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n* *__slots__* are implemented at the class level by creating\n descriptors (*Implementing Descriptors*) for each variable name. As\n a result, class attributes cannot be used to set default values for\n instance variables defined by *__slots__*; otherwise, the class\n attribute would overwrite the descriptor assignment.\n\n* The action of a *__slots__* declaration is limited to the class\n where it is defined. As a result, subclasses will have a *__dict__*\n unless they also define *__slots__* (which must only contain names\n of any *additional* slots).\n\n* If a class defines a slot also defined in a base class, the\n instance variable defined by the base class slot is inaccessible\n (except by retrieving its descriptor directly from the base class).\n This renders the meaning of the program undefined. In the future, a\n check may be added to prevent this.\n\n* Nonempty *__slots__* does not work for classes derived from\n "variable-length" built-in types such as "int", "bytes" and "tuple".\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings\n may also be used; however, in the future, special meaning may be\n assigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n *__slots__*.\n\n\nCustomizing class creation\n==========================\n\nBy default, classes are constructed using "type()". The class body is\nexecuted in a new namespace and the class name is bound locally to the\nresult of "type(name, bases, namespace)".\n\nThe class creation process can be customised by passing the\n"metaclass" keyword argument in the class definition line, or by\ninheriting from an existing class that included such an argument. In\nthe following example, both "MyClass" and "MySubclass" are instances\nof "Meta":\n\n class Meta(type):\n pass\n\n class MyClass(metaclass=Meta):\n pass\n\n class MySubclass(MyClass):\n pass\n\nAny other keyword arguments that are specified in the class definition\nare passed through to all metaclass operations described below.\n\nWhen a class definition is executed, the following steps occur:\n\n* the appropriate metaclass is determined\n\n* the class namespace is prepared\n\n* the class body is executed\n\n* the class object is created\n\n\nDetermining the appropriate metaclass\n-------------------------------------\n\nThe appropriate metaclass for a class definition is determined as\nfollows:\n\n* if no bases and no explicit metaclass are given, then "type()" is\n used\n\n* if an explicit metaclass is given and it is *not* an instance of\n "type()", then it is used directly as the metaclass\n\n* if an instance of "type()" is given as the explicit metaclass, or\n bases are defined, then the most derived metaclass is used\n\nThe most derived metaclass is selected from the explicitly specified\nmetaclass (if any) and the metaclasses (i.e. "type(cls)") of all\nspecified base classes. The most derived metaclass is one which is a\nsubtype of *all* of these candidate metaclasses. If none of the\ncandidate metaclasses meets that criterion, then the class definition\nwill fail with "TypeError".\n\n\nPreparing the class namespace\n-----------------------------\n\nOnce the appropriate metaclass has been identified, then the class\nnamespace is prepared. If the metaclass has a "__prepare__" attribute,\nit is called as "namespace = metaclass.__prepare__(name, bases,\n**kwds)" (where the additional keyword arguments, if any, come from\nthe class definition).\n\nIf the metaclass has no "__prepare__" attribute, then the class\nnamespace is initialised as an empty "dict()" instance.\n\nSee also: **PEP 3115** - Metaclasses in Python 3000\n\n Introduced the "__prepare__" namespace hook\n\n\nExecuting the class body\n------------------------\n\nThe class body is executed (approximately) as "exec(body, globals(),\nnamespace)". The key difference from a normal call to "exec()" is that\nlexical scoping allows the class body (including any methods) to\nreference names from the current and outer scopes when the class\ndefinition occurs inside a function.\n\nHowever, even when the class definition occurs inside the function,\nmethods defined inside the class still cannot see names defined at the\nclass scope. Class variables must be accessed through the first\nparameter of instance or class methods, and cannot be accessed at all\nfrom static methods.\n\n\nCreating the class object\n-------------------------\n\nOnce the class namespace has been populated by executing the class\nbody, the class object is created by calling "metaclass(name, bases,\nnamespace, **kwds)" (the additional keywords passed here are the same\nas those passed to "__prepare__").\n\nThis class object is the one that will be referenced by the zero-\nargument form of "super()". "__class__" is an implicit closure\nreference created by the compiler if any methods in a class body refer\nto either "__class__" or "super". This allows the zero argument form\nof "super()" to correctly identify the class being defined based on\nlexical scoping, while the class or instance that was used to make the\ncurrent call is identified based on the first argument passed to the\nmethod.\n\nAfter the class object is created, it is passed to the class\ndecorators included in the class definition (if any) and the resulting\nobject is bound in the local namespace as the defined class.\n\nSee also: **PEP 3135** - New super\n\n Describes the implicit "__class__" closure reference\n\n\nMetaclass example\n-----------------\n\nThe potential uses for metaclasses are boundless. Some ideas that have\nbeen explored include logging, interface checking, automatic\ndelegation, automatic property creation, proxies, frameworks, and\nautomatic resource locking/synchronization.\n\nHere is an example of a metaclass that uses an\n"collections.OrderedDict" to remember the order that class variables\nare defined:\n\n class OrderedClass(type):\n\n @classmethod\n def __prepare__(metacls, name, bases, **kwds):\n return collections.OrderedDict()\n\n def __new__(cls, name, bases, namespace, **kwds):\n result = type.__new__(cls, name, bases, dict(namespace))\n result.members = tuple(namespace)\n return result\n\n class A(metaclass=OrderedClass):\n def one(self): pass\n def two(self): pass\n def three(self): pass\n def four(self): pass\n\n >>> A.members\n (\'__module__\', \'one\', \'two\', \'three\', \'four\')\n\nWhen the class definition for *A* gets executed, the process begins\nwith calling the metaclass\'s "__prepare__()" method which returns an\nempty "collections.OrderedDict". That mapping records the methods and\nattributes of *A* as they are defined within the body of the class\nstatement. Once those definitions are executed, the ordered dictionary\nis fully populated and the metaclass\'s "__new__()" method gets\ninvoked. That method builds the new type and it saves the ordered\ndictionary keys in an attribute called "members".\n\n\nCustomizing instance and subclass checks\n========================================\n\nThe following methods are used to override the default behavior of the\n"isinstance()" and "issubclass()" built-in functions.\n\nIn particular, the metaclass "abc.ABCMeta" implements these methods in\norder to allow the addition of Abstract Base Classes (ABCs) as\n"virtual base classes" to any class or type (including built-in\ntypes), including other ABCs.\n\nclass.__instancecheck__(self, instance)\n\n Return true if *instance* should be considered a (direct or\n indirect) instance of *class*. If defined, called to implement\n "isinstance(instance, class)".\n\nclass.__subclasscheck__(self, subclass)\n\n Return true if *subclass* should be considered a (direct or\n indirect) subclass of *class*. If defined, called to implement\n "issubclass(subclass, class)".\n\nNote that these methods are looked up on the type (metaclass) of a\nclass. They cannot be defined as class methods in the actual class.\nThis is consistent with the lookup of special methods that are called\non instances, only in this case the instance is itself a class.\n\nSee also: **PEP 3119** - Introducing Abstract Base Classes\n\n Includes the specification for customizing "isinstance()" and\n "issubclass()" behavior through "__instancecheck__()" and\n "__subclasscheck__()", with motivation for this functionality in\n the context of adding Abstract Base Classes (see the "abc"\n module) to the language.\n\n\nEmulating callable objects\n==========================\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, "x(arg1, arg2, ...)" is a shorthand for\n "x.__call__(arg1, arg2, ...)".\n\n\nEmulating container types\n=========================\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which "0 <= k < N" where\n*N* is the length of the sequence, or slice objects, which define a\nrange of items. It is also recommended that mappings provide the\nmethods "keys()", "values()", "items()", "get()", "clear()",\n"setdefault()", "pop()", "popitem()", "copy()", and "update()"\nbehaving similar to those for Python\'s standard dictionary objects.\nThe "collections" module provides a "MutableMapping" abstract base\nclass to help create those methods from a base set of "__getitem__()",\n"__setitem__()", "__delitem__()", and "keys()". Mutable sequences\nshould provide methods "append()", "count()", "index()", "extend()",\n"insert()", "pop()", "remove()", "reverse()" and "sort()", like Python\nstandard list objects. Finally, sequence types should implement\naddition (meaning concatenation) and multiplication (meaning\nrepetition) by defining the methods "__add__()", "__radd__()",\n"__iadd__()", "__mul__()", "__rmul__()" and "__imul__()" described\nbelow; they should not define other numerical operators. It is\nrecommended that both mappings and sequences implement the\n"__contains__()" method to allow efficient use of the "in" operator;\nfor mappings, "in" should search the mapping\'s keys; for sequences, it\nshould search through the values. It is further recommended that both\nmappings and sequences implement the "__iter__()" method to allow\nefficient iteration through the container; for mappings, "__iter__()"\nshould be the same as "keys()"; for sequences, it should iterate\nthrough the values.\n\nobject.__len__(self)\n\n Called to implement the built-in function "len()". Should return\n the length of the object, an integer ">=" 0. Also, an object that\n doesn\'t define a "__bool__()" method and whose "__len__()" method\n returns zero is considered to be false in a Boolean context.\n\nobject.__length_hint__(self)\n\n Called to implement "operator.length_hint()". Should return an\n estimated length for the object (which may be greater or less than\n the actual length). The length must be an integer ">=" 0. This\n method is purely an optimization and is never required for\n correctness.\n\n New in version 3.4.\n\nNote: Slicing is done exclusively with the following three methods.\n A call like\n\n a[1:2] = b\n\n is translated to\n\n a[slice(1, 2, None)] = b\n\n and so forth. Missing slice items are always filled in with "None".\n\nobject.__getitem__(self, key)\n\n Called to implement evaluation of "self[key]". For sequence types,\n the accepted keys should be integers and slice objects. Note that\n the special interpretation of negative indexes (if the class wishes\n to emulate a sequence type) is up to the "__getitem__()" method. If\n *key* is of an inappropriate type, "TypeError" may be raised; if of\n a value outside the set of indexes for the sequence (after any\n special interpretation of negative values), "IndexError" should be\n raised. For mapping types, if *key* is missing (not in the\n container), "KeyError" should be raised.\n\n Note: "for" loops expect that an "IndexError" will be raised for\n illegal indexes to allow proper detection of the end of the\n sequence.\n\nobject.__missing__(self, key)\n\n Called by "dict"."__getitem__()" to implement "self[key]" for dict\n subclasses when key is not in the dictionary.\n\nobject.__setitem__(self, key, value)\n\n Called to implement assignment to "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support changes to the values for keys, or if new keys\n can be added, or for sequences if elements can be replaced. The\n same exceptions should be raised for improper *key* values as for\n the "__getitem__()" method.\n\nobject.__delitem__(self, key)\n\n Called to implement deletion of "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support removal of keys, or for sequences if elements\n can be removed from the sequence. The same exceptions should be\n raised for improper *key* values as for the "__getitem__()" method.\n\nobject.__iter__(self)\n\n This method is called when an iterator is required for a container.\n This method should return a new iterator object that can iterate\n over all the objects in the container. For mappings, it should\n iterate over the keys of the container.\n\n Iterator objects also need to implement this method; they are\n required to return themselves. For more information on iterator\n objects, see *Iterator Types*.\n\nobject.__reversed__(self)\n\n Called (if present) by the "reversed()" built-in to implement\n reverse iteration. It should return a new iterator object that\n iterates over all the objects in the container in reverse order.\n\n If the "__reversed__()" method is not provided, the "reversed()"\n built-in will fall back to using the sequence protocol ("__len__()"\n and "__getitem__()"). Objects that support the sequence protocol\n should only provide "__reversed__()" if they can provide an\n implementation that is more efficient than the one provided by\n "reversed()".\n\nThe membership test operators ("in" and "not in") are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n Called to implement membership test operators. Should return true\n if *item* is in *self*, false otherwise. For mapping objects, this\n should consider the keys of the mapping rather than the values or\n the key-item pairs.\n\n For objects that don\'t define "__contains__()", the membership test\n first tries iteration via "__iter__()", then the old sequence\n iteration protocol via "__getitem__()", see *this section in the\n language reference*.\n\n\nEmulating numeric types\n=======================\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__truediv__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "/", "//", "%", "divmod()", "pow()",\n "**", "<<", ">>", "&", "^", "|"). For instance, to evaluate the\n expression "x + y", where *x* is an instance of a class that has an\n "__add__()" method, "x.__add__(y)" is called. The "__divmod__()"\n method should be the equivalent to using "__floordiv__()" and\n "__mod__()"; it should not be related to "__truediv__()". Note\n that "__pow__()" should be defined to accept an optional third\n argument if the ternary version of the built-in "pow()" function is\n to be supported.\n\n If one of those methods does not support the operation with the\n supplied arguments, it should return "NotImplemented".\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "/", "//", "%", "divmod()", "pow()",\n "**", "<<", ">>", "&", "^", "|") with reflected (swapped) operands.\n These functions are only called if the left operand does not\n support the corresponding operation and the operands are of\n different types. [2] For instance, to evaluate the expression "x -\n y", where *y* is an instance of a class that has an "__rsub__()"\n method, "y.__rsub__(x)" is called if "x.__sub__(y)" returns\n *NotImplemented*.\n\n Note that ternary "pow()" will not try calling "__rpow__()" (the\n coercion rules would become too complicated).\n\n Note: If the right operand\'s type is a subclass of the left\n operand\'s type and that subclass provides the reflected method\n for the operation, this method will be called before the left\n operand\'s non-reflected method. This behavior allows subclasses\n to override their ancestors\' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n These methods are called to implement the augmented arithmetic\n assignments ("+=", "-=", "*=", "/=", "//=", "%=", "**=", "<<=",\n ">>=", "&=", "^=", "|="). These methods should attempt to do the\n operation in-place (modifying *self*) and return the result (which\n could be, but does not have to be, *self*). If a specific method\n is not defined, the augmented assignment falls back to the normal\n methods. For instance, if *x* is an instance of a class with an\n "__iadd__()" method, "x += y" is equivalent to "x = x.__iadd__(y)"\n . Otherwise, "x.__add__(y)" and "y.__radd__(x)" are considered, as\n with the evaluation of "x + y". In certain situations, augmented\n assignment can result in unexpected errors (see *Why does\n a_tuple[i] += [\'item\'] raise an exception when the addition\n works?*), but this behavior is in fact part of the data model.\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n Called to implement the unary arithmetic operations ("-", "+",\n "abs()" and "~").\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__float__(self)\nobject.__round__(self[, n])\n\n Called to implement the built-in functions "complex()", "int()",\n "float()" and "round()". Should return a value of the appropriate\n type.\n\nobject.__index__(self)\n\n Called to implement "operator.index()", and whenever Python needs\n to losslessly convert the numeric object to an integer object (such\n as in slicing, or in the built-in "bin()", "hex()" and "oct()"\n functions). Presence of this method indicates that the numeric\n object is an integer type. Must return an integer.\n\n Note: In order to have a coherent integer type class, when\n "__index__()" is defined "__int__()" should also be defined, and\n both should return the same value.\n\n\nWith Statement Context Managers\n===============================\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a "with" statement. The context manager\nhandles the entry into, and the exit from, the desired runtime context\nfor the execution of the block of code. Context managers are normally\ninvoked using the "with" statement (described in section *The with\nstatement*), but can also be used by directly invoking their methods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see *Context Manager Types*.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The "with"\n statement will bind this method\'s return value to the target(s)\n specified in the "as" clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be "None".\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that "__exit__()" methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also: **PEP 0343** - The "with" statement\n\n The specification, background, and examples for the Python "with"\n statement.\n\n\nSpecial method lookup\n=====================\n\nFor custom classes, implicit invocations of special methods are only\nguaranteed to work correctly if defined on an object\'s type, not in\nthe object\'s instance dictionary. That behaviour is the reason why\nthe following code raises an exception:\n\n >>> class C:\n ... pass\n ...\n >>> c = C()\n >>> c.__len__ = lambda: 5\n >>> len(c)\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: object of type \'C\' has no len()\n\nThe rationale behind this behaviour lies with a number of special\nmethods such as "__hash__()" and "__repr__()" that are implemented by\nall objects, including type objects. If the implicit lookup of these\nmethods used the conventional lookup process, they would fail when\ninvoked on the type object itself:\n\n >>> 1 .__hash__() == hash(1)\n True\n >>> int.__hash__() == hash(int)\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: descriptor \'__hash__\' of \'int\' object needs an argument\n\nIncorrectly attempting to invoke an unbound method of a class in this\nway is sometimes referred to as \'metaclass confusion\', and is avoided\nby bypassing the instance when looking up special methods:\n\n >>> type(1).__hash__(1) == hash(1)\n True\n >>> type(int).__hash__(int) == hash(int)\n True\n\nIn addition to bypassing any instance attributes in the interest of\ncorrectness, implicit special method lookup generally also bypasses\nthe "__getattribute__()" method even of the object\'s metaclass:\n\n >>> class Meta(type):\n ... def __getattribute__(*args):\n ... print("Metaclass getattribute invoked")\n ... return type.__getattribute__(*args)\n ...\n >>> class C(object, metaclass=Meta):\n ... def __len__(self):\n ... return 10\n ... def __getattribute__(*args):\n ... print("Class getattribute invoked")\n ... return object.__getattribute__(*args)\n ...\n >>> c = C()\n >>> c.__len__() # Explicit lookup via instance\n Class getattribute invoked\n 10\n >>> type(c).__len__(c) # Explicit lookup via type\n Metaclass getattribute invoked\n 10\n >>> len(c) # Implicit lookup\n 10\n\nBypassing the "__getattribute__()" machinery in this fashion provides\nsignificant scope for speed optimisations within the interpreter, at\nthe cost of some flexibility in the handling of special methods (the\nspecial method *must* be set on the class object itself in order to be\nconsistently invoked by the interpreter).\n\n-[ Footnotes ]-\n\n[1] It *is* possible in some cases to change an object\'s type,\n under certain controlled conditions. It generally isn\'t a good\n idea though, since it can lead to some very strange behaviour if\n it is handled incorrectly.\n\n[2] For operands of the same type, it is assumed that if the non-\n reflected method (such as "__add__()") fails the operation is not\n supported, which is why the reflected method is not called.\n', - 'string-methods': u'\nString Methods\n**************\n\nStrings implement all of the *common* sequence operations, along with\nthe additional methods described below.\n\nStrings also support two styles of string formatting, one providing a\nlarge degree of flexibility and customization (see "str.format()",\n*Format String Syntax* and *String Formatting*) and the other based on\nC "printf" style formatting that handles a narrower range of types and\nis slightly harder to use correctly, but is often faster for the cases\nit can handle (*printf-style String Formatting*).\n\nThe *Text Processing Services* section of the standard library covers\na number of other modules that provide various text related utilities\n(including regular expression support in the "re" module).\n\nstr.capitalize()\n\n Return a copy of the string with its first character capitalized\n and the rest lowercased.\n\nstr.casefold()\n\n Return a casefolded copy of the string. Casefolded strings may be\n used for caseless matching.\n\n Casefolding is similar to lowercasing but more aggressive because\n it is intended to remove all case distinctions in a string. For\n example, the German lowercase letter "\'\xdf\'" is equivalent to ""ss"".\n Since it is already lowercase, "lower()" would do nothing to "\'\xdf\'";\n "casefold()" converts it to ""ss"".\n\n The casefolding algorithm is described in section 3.13 of the\n Unicode Standard.\n\n New in version 3.3.\n\nstr.center(width[, fillchar])\n\n Return centered in a string of length *width*. Padding is done\n using the specified *fillchar* (default is an ASCII space). The\n original string is returned if *width* is less than or equal to\n "len(s)".\n\nstr.count(sub[, start[, end]])\n\n Return the number of non-overlapping occurrences of substring *sub*\n in the range [*start*, *end*]. Optional arguments *start* and\n *end* are interpreted as in slice notation.\n\nstr.encode(encoding="utf-8", errors="strict")\n\n Return an encoded version of the string as a bytes object. Default\n encoding is "\'utf-8\'". *errors* may be given to set a different\n error handling scheme. The default for *errors* is "\'strict\'",\n meaning that encoding errors raise a "UnicodeError". Other possible\n values are "\'ignore\'", "\'replace\'", "\'xmlcharrefreplace\'",\n "\'backslashreplace\'" and any other name registered via\n "codecs.register_error()", see section *Error Handlers*. For a list\n of possible encodings, see section *Standard Encodings*.\n\n Changed in version 3.1: Support for keyword arguments added.\n\nstr.endswith(suffix[, start[, end]])\n\n Return "True" if the string ends with the specified *suffix*,\n otherwise return "False". *suffix* can also be a tuple of suffixes\n to look for. With optional *start*, test beginning at that\n position. With optional *end*, stop comparing at that position.\n\nstr.expandtabs(tabsize=8)\n\n Return a copy of the string where all tab characters are replaced\n by one or more spaces, depending on the current column and the\n given tab size. Tab positions occur every *tabsize* characters\n (default is 8, giving tab positions at columns 0, 8, 16 and so on).\n To expand the string, the current column is set to zero and the\n string is examined character by character. If the character is a\n tab ("\\t"), one or more space characters are inserted in the result\n until the current column is equal to the next tab position. (The\n tab character itself is not copied.) If the character is a newline\n ("\\n") or return ("\\r"), it is copied and the current column is\n reset to zero. Any other character is copied unchanged and the\n current column is incremented by one regardless of how the\n character is represented when printed.\n\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs()\n \'01 012 0123 01234\'\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs(4)\n \'01 012 0123 01234\'\n\nstr.find(sub[, start[, end]])\n\n Return the lowest index in the string where substring *sub* is\n found, such that *sub* is contained in the slice "s[start:end]".\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return "-1" if *sub* is not found.\n\n Note: The "find()" method should be used only if you need to know\n the position of *sub*. To check if *sub* is a substring or not,\n use the "in" operator:\n\n >>> \'Py\' in \'Python\'\n True\n\nstr.format(*args, **kwargs)\n\n Perform a string formatting operation. The string on which this\n method is called can contain literal text or replacement fields\n delimited by braces "{}". Each replacement field contains either\n the numeric index of a positional argument, or the name of a\n keyword argument. Returns a copy of the string where each\n replacement field is replaced with the string value of the\n corresponding argument.\n\n >>> "The sum of 1 + 2 is {0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\n See *Format String Syntax* for a description of the various\n formatting options that can be specified in format strings.\n\nstr.format_map(mapping)\n\n Similar to "str.format(**mapping)", except that "mapping" is used\n directly and not copied to a "dict". This is useful if for example\n "mapping" is a dict subclass:\n\n >>> class Default(dict):\n ... def __missing__(self, key):\n ... return key\n ...\n >>> \'{name} was born in {country}\'.format_map(Default(name=\'Guido\'))\n \'Guido was born in country\'\n\n New in version 3.2.\n\nstr.index(sub[, start[, end]])\n\n Like "find()", but raise "ValueError" when the substring is not\n found.\n\nstr.isalnum()\n\n Return true if all characters in the string are alphanumeric and\n there is at least one character, false otherwise. A character "c"\n is alphanumeric if one of the following returns "True":\n "c.isalpha()", "c.isdecimal()", "c.isdigit()", or "c.isnumeric()".\n\nstr.isalpha()\n\n Return true if all characters in the string are alphabetic and\n there is at least one character, false otherwise. Alphabetic\n characters are those characters defined in the Unicode character\n database as "Letter", i.e., those with general category property\n being one of "Lm", "Lt", "Lu", "Ll", or "Lo". Note that this is\n different from the "Alphabetic" property defined in the Unicode\n Standard.\n\nstr.isdecimal()\n\n Return true if all characters in the string are decimal characters\n and there is at least one character, false otherwise. Decimal\n characters are those from general category "Nd". This category\n includes digit characters, and all characters that can be used to\n form decimal-radix numbers, e.g. U+0660, ARABIC-INDIC DIGIT ZERO.\n\nstr.isdigit()\n\n Return true if all characters in the string are digits and there is\n at least one character, false otherwise. Digits include decimal\n characters and digits that need special handling, such as the\n compatibility superscript digits. Formally, a digit is a character\n that has the property value Numeric_Type=Digit or\n Numeric_Type=Decimal.\n\nstr.isidentifier()\n\n Return true if the string is a valid identifier according to the\n language definition, section *Identifiers and keywords*.\n\n Use "keyword.iskeyword()" to test for reserved identifiers such as\n "def" and "class".\n\nstr.islower()\n\n Return true if all cased characters [4] in the string are lowercase\n and there is at least one cased character, false otherwise.\n\nstr.isnumeric()\n\n Return true if all characters in the string are numeric characters,\n and there is at least one character, false otherwise. Numeric\n characters include digit characters, and all characters that have\n the Unicode numeric value property, e.g. U+2155, VULGAR FRACTION\n ONE FIFTH. Formally, numeric characters are those with the\n property value Numeric_Type=Digit, Numeric_Type=Decimal or\n Numeric_Type=Numeric.\n\nstr.isprintable()\n\n Return true if all characters in the string are printable or the\n string is empty, false otherwise. Nonprintable characters are\n those characters defined in the Unicode character database as\n "Other" or "Separator", excepting the ASCII space (0x20) which is\n considered printable. (Note that printable characters in this\n context are those which should not be escaped when "repr()" is\n invoked on a string. It has no bearing on the handling of strings\n written to "sys.stdout" or "sys.stderr".)\n\nstr.isspace()\n\n Return true if there are only whitespace characters in the string\n and there is at least one character, false otherwise. Whitespace\n characters are those characters defined in the Unicode character\n database as "Other" or "Separator" and those with bidirectional\n property being one of "WS", "B", or "S".\n\nstr.istitle()\n\n Return true if the string is a titlecased string and there is at\n least one character, for example uppercase characters may only\n follow uncased characters and lowercase characters only cased ones.\n Return false otherwise.\n\nstr.isupper()\n\n Return true if all cased characters [4] in the string are uppercase\n and there is at least one cased character, false otherwise.\n\nstr.join(iterable)\n\n Return a string which is the concatenation of the strings in the\n *iterable* *iterable*. A "TypeError" will be raised if there are\n any non-string values in *iterable*, including "bytes" objects.\n The separator between elements is the string providing this method.\n\nstr.ljust(width[, fillchar])\n\n Return the string left justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is an ASCII\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\nstr.lower()\n\n Return a copy of the string with all the cased characters [4]\n converted to lowercase.\n\n The lowercasing algorithm used is described in section 3.13 of the\n Unicode Standard.\n\nstr.lstrip([chars])\n\n Return a copy of the string with leading characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a prefix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.lstrip()\n \'spacious \'\n >>> \'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\nstatic str.maketrans(x[, y[, z]])\n\n This static method returns a translation table usable for\n "str.translate()".\n\n If there is only one argument, it must be a dictionary mapping\n Unicode ordinals (integers) or characters (strings of length 1) to\n Unicode ordinals, strings (of arbitrary lengths) or None.\n Character keys will then be converted to ordinals.\n\n If there are two arguments, they must be strings of equal length,\n and in the resulting dictionary, each character in x will be mapped\n to the character at the same position in y. If there is a third\n argument, it must be a string, whose characters will be mapped to\n None in the result.\n\nstr.partition(sep)\n\n Split the string at the first occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing the string itself, followed by\n two empty strings.\n\nstr.replace(old, new[, count])\n\n Return a copy of the string with all occurrences of substring *old*\n replaced by *new*. If the optional argument *count* is given, only\n the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n Return the highest index in the string where substring *sub* is\n found, such that *sub* is contained within "s[start:end]".\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return "-1" on failure.\n\nstr.rindex(sub[, start[, end]])\n\n Like "rfind()" but raises "ValueError" when the substring *sub* is\n not found.\n\nstr.rjust(width[, fillchar])\n\n Return the string right justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is an ASCII\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\nstr.rpartition(sep)\n\n Split the string at the last occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing two empty strings, followed by\n the string itself.\n\nstr.rsplit(sep=None, maxsplit=-1)\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n are done, the *rightmost* ones. If *sep* is not specified or\n "None", any whitespace string is a separator. Except for splitting\n from the right, "rsplit()" behaves like "split()" which is\n described in detail below.\n\nstr.rstrip([chars])\n\n Return a copy of the string with trailing characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a suffix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.rstrip()\n \' spacious\'\n >>> \'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\nstr.split(sep=None, maxsplit=-1)\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit*\n splits are done (thus, the list will have at most "maxsplit+1"\n elements). If *maxsplit* is not specified or "-1", then there is\n no limit on the number of splits (all possible splits are made).\n\n If *sep* is given, consecutive delimiters are not grouped together\n and are deemed to delimit empty strings (for example,\n "\'1,,2\'.split(\',\')" returns "[\'1\', \'\', \'2\']"). The *sep* argument\n may consist of multiple characters (for example,\n "\'1<>2<>3\'.split(\'<>\')" returns "[\'1\', \'2\', \'3\']"). Splitting an\n empty string with a specified separator returns "[\'\']".\n\n For example:\n\n >>> \'1,2,3\'.split(\',\')\n [\'1\', \'2\', \'3\']\n >>> \'1,2,3\'.split(\',\', maxsplit=1)\n [\'1\', \'2,3\']\n >>> \'1,2,,3,\'.split(\',\')\n [\'1\', \'2\', \'\', \'3\', \'\']\n\n If *sep* is not specified or is "None", a different splitting\n algorithm is applied: runs of consecutive whitespace are regarded\n as a single separator, and the result will contain no empty strings\n at the start or end if the string has leading or trailing\n whitespace. Consequently, splitting an empty string or a string\n consisting of just whitespace with a "None" separator returns "[]".\n\n For example:\n\n >>> \'1 2 3\'.split()\n [\'1\', \'2\', \'3\']\n >>> \'1 2 3\'.split(maxsplit=1)\n [\'1\', \'2 3\']\n >>> \' 1 2 3 \'.split()\n [\'1\', \'2\', \'3\']\n\nstr.splitlines([keepends])\n\n Return a list of the lines in the string, breaking at line\n boundaries. Line breaks are not included in the resulting list\n unless *keepends* is given and true.\n\n This method splits on the following line boundaries. In\n particular, the boundaries are a superset of *universal newlines*.\n\n +-------------------------+-------------------------------+\n | Representation | Description |\n +=========================+===============================+\n | "\\n" | Line Feed |\n +-------------------------+-------------------------------+\n | "\\r" | Carriage Return |\n +-------------------------+-------------------------------+\n | "\\r\\n" | Carriage Return + Line Feed |\n +-------------------------+-------------------------------+\n | "\\v" or "\\x0b" | Line Tabulation |\n +-------------------------+-------------------------------+\n | "\\f" or "\\x0c" | Form Feed |\n +-------------------------+-------------------------------+\n | "\\x1c" | File Separator |\n +-------------------------+-------------------------------+\n | "\\x1d" | Group Separator |\n +-------------------------+-------------------------------+\n | "\\x1e" | Record Separator |\n +-------------------------+-------------------------------+\n | "\\x85" | Next Line (C1 Control Code) |\n +-------------------------+-------------------------------+\n | "\\u2028" | Line Separator |\n +-------------------------+-------------------------------+\n | "\\u2029" | Paragraph Separator |\n +-------------------------+-------------------------------+\n\n Changed in version 3.2: "\\v" and "\\f" added to list of line\n boundaries.\n\n For example:\n\n >>> \'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines()\n [\'ab c\', \'\', \'de fg\', \'kl\']\n >>> \'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines(keepends=True)\n [\'ab c\\n\', \'\\n\', \'de fg\\r\', \'kl\\r\\n\']\n\n Unlike "split()" when a delimiter string *sep* is given, this\n method returns an empty list for the empty string, and a terminal\n line break does not result in an extra line:\n\n >>> "".splitlines()\n []\n >>> "One line\\n".splitlines()\n [\'One line\']\n\n For comparison, "split(\'\\n\')" gives:\n\n >>> \'\'.split(\'\\n\')\n [\'\']\n >>> \'Two lines\\n\'.split(\'\\n\')\n [\'Two lines\', \'\']\n\nstr.startswith(prefix[, start[, end]])\n\n Return "True" if string starts with the *prefix*, otherwise return\n "False". *prefix* can also be a tuple of prefixes to look for.\n With optional *start*, test string beginning at that position.\n With optional *end*, stop comparing string at that position.\n\nstr.strip([chars])\n\n Return a copy of the string with the leading and trailing\n characters removed. The *chars* argument is a string specifying the\n set of characters to be removed. If omitted or "None", the *chars*\n argument defaults to removing whitespace. The *chars* argument is\n not a prefix or suffix; rather, all combinations of its values are\n stripped:\n\n >>> \' spacious \'.strip()\n \'spacious\'\n >>> \'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\nstr.swapcase()\n\n Return a copy of the string with uppercase characters converted to\n lowercase and vice versa. Note that it is not necessarily true that\n "s.swapcase().swapcase() == s".\n\nstr.title()\n\n Return a titlecased version of the string where words start with an\n uppercase character and the remaining characters are lowercase.\n\n For example:\n\n >>> \'Hello world\'.title()\n \'Hello World\'\n\n The algorithm uses a simple language-independent definition of a\n word as groups of consecutive letters. The definition works in\n many contexts but it means that apostrophes in contractions and\n possessives form word boundaries, which may not be the desired\n result:\n\n >>> "they\'re bill\'s friends from the UK".title()\n "They\'Re Bill\'S Friends From The Uk"\n\n A workaround for apostrophes can be constructed using regular\n expressions:\n\n >>> import re\n >>> def titlecase(s):\n ... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n ... lambda mo: mo.group(0)[0].upper() +\n ... mo.group(0)[1:].lower(),\n ... s)\n ...\n >>> titlecase("they\'re bill\'s friends.")\n "They\'re Bill\'s Friends."\n\nstr.translate(table)\n\n Return a copy of the string in which each character has been mapped\n through the given translation table. The table must be an object\n that implements indexing via "__getitem__()", typically a *mapping*\n or *sequence*. When indexed by a Unicode ordinal (an integer), the\n table object can do any of the following: return a Unicode ordinal\n or a string, to map the character to one or more other characters;\n return "None", to delete the character from the return string; or\n raise a "LookupError" exception, to map the character to itself.\n\n You can use "str.maketrans()" to create a translation map from\n character-to-character mappings in different formats.\n\n See also the "codecs" module for a more flexible approach to custom\n character mappings.\n\nstr.upper()\n\n Return a copy of the string with all the cased characters [4]\n converted to uppercase. Note that "str.upper().isupper()" might be\n "False" if "s" contains uncased characters or if the Unicode\n category of the resulting character(s) is not "Lu" (Letter,\n uppercase), but e.g. "Lt" (Letter, titlecase).\n\n The uppercasing algorithm used is described in section 3.13 of the\n Unicode Standard.\n\nstr.zfill(width)\n\n Return a copy of the string left filled with ASCII "\'0\'" digits to\n make a string of length *width*. A leading sign prefix\n ("\'+\'"/"\'-\'") is handled by inserting the padding *after* the sign\n character rather than before. The original string is returned if\n *width* is less than or equal to "len(s)".\n\n For example:\n\n >>> "42".zfill(5)\n \'00042\'\n >>> "-42".zfill(5)\n \'-0042\'\n', + 'string-methods': u'\nString Methods\n**************\n\nStrings implement all of the *common* sequence operations, along with\nthe additional methods described below.\n\nStrings also support two styles of string formatting, one providing a\nlarge degree of flexibility and customization (see "str.format()",\n*Format String Syntax* and *String Formatting*) and the other based on\nC "printf" style formatting that handles a narrower range of types and\nis slightly harder to use correctly, but is often faster for the cases\nit can handle (*printf-style String Formatting*).\n\nThe *Text Processing Services* section of the standard library covers\na number of other modules that provide various text related utilities\n(including regular expression support in the "re" module).\n\nstr.capitalize()\n\n Return a copy of the string with its first character capitalized\n and the rest lowercased.\n\nstr.casefold()\n\n Return a casefolded copy of the string. Casefolded strings may be\n used for caseless matching.\n\n Casefolding is similar to lowercasing but more aggressive because\n it is intended to remove all case distinctions in a string. For\n example, the German lowercase letter "\'\xdf\'" is equivalent to ""ss"".\n Since it is already lowercase, "lower()" would do nothing to "\'\xdf\'";\n "casefold()" converts it to ""ss"".\n\n The casefolding algorithm is described in section 3.13 of the\n Unicode Standard.\n\n New in version 3.3.\n\nstr.center(width[, fillchar])\n\n Return centered in a string of length *width*. Padding is done\n using the specified *fillchar* (default is an ASCII space). The\n original string is returned if *width* is less than or equal to\n "len(s)".\n\nstr.count(sub[, start[, end]])\n\n Return the number of non-overlapping occurrences of substring *sub*\n in the range [*start*, *end*]. Optional arguments *start* and\n *end* are interpreted as in slice notation.\n\nstr.encode(encoding="utf-8", errors="strict")\n\n Return an encoded version of the string as a bytes object. Default\n encoding is "\'utf-8\'". *errors* may be given to set a different\n error handling scheme. The default for *errors* is "\'strict\'",\n meaning that encoding errors raise a "UnicodeError". Other possible\n values are "\'ignore\'", "\'replace\'", "\'xmlcharrefreplace\'",\n "\'backslashreplace\'" and any other name registered via\n "codecs.register_error()", see section *Error Handlers*. For a list\n of possible encodings, see section *Standard Encodings*.\n\n Changed in version 3.1: Support for keyword arguments added.\n\nstr.endswith(suffix[, start[, end]])\n\n Return "True" if the string ends with the specified *suffix*,\n otherwise return "False". *suffix* can also be a tuple of suffixes\n to look for. With optional *start*, test beginning at that\n position. With optional *end*, stop comparing at that position.\n\nstr.expandtabs(tabsize=8)\n\n Return a copy of the string where all tab characters are replaced\n by one or more spaces, depending on the current column and the\n given tab size. Tab positions occur every *tabsize* characters\n (default is 8, giving tab positions at columns 0, 8, 16 and so on).\n To expand the string, the current column is set to zero and the\n string is examined character by character. If the character is a\n tab ("\\t"), one or more space characters are inserted in the result\n until the current column is equal to the next tab position. (The\n tab character itself is not copied.) If the character is a newline\n ("\\n") or return ("\\r"), it is copied and the current column is\n reset to zero. Any other character is copied unchanged and the\n current column is incremented by one regardless of how the\n character is represented when printed.\n\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs()\n \'01 012 0123 01234\'\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs(4)\n \'01 012 0123 01234\'\n\nstr.find(sub[, start[, end]])\n\n Return the lowest index in the string where substring *sub* is\n found within the slice "s[start:end]". Optional arguments *start*\n and *end* are interpreted as in slice notation. Return "-1" if\n *sub* is not found.\n\n Note: The "find()" method should be used only if you need to know\n the position of *sub*. To check if *sub* is a substring or not,\n use the "in" operator:\n\n >>> \'Py\' in \'Python\'\n True\n\nstr.format(*args, **kwargs)\n\n Perform a string formatting operation. The string on which this\n method is called can contain literal text or replacement fields\n delimited by braces "{}". Each replacement field contains either\n the numeric index of a positional argument, or the name of a\n keyword argument. Returns a copy of the string where each\n replacement field is replaced with the string value of the\n corresponding argument.\n\n >>> "The sum of 1 + 2 is {0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\n See *Format String Syntax* for a description of the various\n formatting options that can be specified in format strings.\n\nstr.format_map(mapping)\n\n Similar to "str.format(**mapping)", except that "mapping" is used\n directly and not copied to a "dict". This is useful if for example\n "mapping" is a dict subclass:\n\n >>> class Default(dict):\n ... def __missing__(self, key):\n ... return key\n ...\n >>> \'{name} was born in {country}\'.format_map(Default(name=\'Guido\'))\n \'Guido was born in country\'\n\n New in version 3.2.\n\nstr.index(sub[, start[, end]])\n\n Like "find()", but raise "ValueError" when the substring is not\n found.\n\nstr.isalnum()\n\n Return true if all characters in the string are alphanumeric and\n there is at least one character, false otherwise. A character "c"\n is alphanumeric if one of the following returns "True":\n "c.isalpha()", "c.isdecimal()", "c.isdigit()", or "c.isnumeric()".\n\nstr.isalpha()\n\n Return true if all characters in the string are alphabetic and\n there is at least one character, false otherwise. Alphabetic\n characters are those characters defined in the Unicode character\n database as "Letter", i.e., those with general category property\n being one of "Lm", "Lt", "Lu", "Ll", or "Lo". Note that this is\n different from the "Alphabetic" property defined in the Unicode\n Standard.\n\nstr.isdecimal()\n\n Return true if all characters in the string are decimal characters\n and there is at least one character, false otherwise. Decimal\n characters are those from general category "Nd". This category\n includes digit characters, and all characters that can be used to\n form decimal-radix numbers, e.g. U+0660, ARABIC-INDIC DIGIT ZERO.\n\nstr.isdigit()\n\n Return true if all characters in the string are digits and there is\n at least one character, false otherwise. Digits include decimal\n characters and digits that need special handling, such as the\n compatibility superscript digits. Formally, a digit is a character\n that has the property value Numeric_Type=Digit or\n Numeric_Type=Decimal.\n\nstr.isidentifier()\n\n Return true if the string is a valid identifier according to the\n language definition, section *Identifiers and keywords*.\n\n Use "keyword.iskeyword()" to test for reserved identifiers such as\n "def" and "class".\n\nstr.islower()\n\n Return true if all cased characters [4] in the string are lowercase\n and there is at least one cased character, false otherwise.\n\nstr.isnumeric()\n\n Return true if all characters in the string are numeric characters,\n and there is at least one character, false otherwise. Numeric\n characters include digit characters, and all characters that have\n the Unicode numeric value property, e.g. U+2155, VULGAR FRACTION\n ONE FIFTH. Formally, numeric characters are those with the\n property value Numeric_Type=Digit, Numeric_Type=Decimal or\n Numeric_Type=Numeric.\n\nstr.isprintable()\n\n Return true if all characters in the string are printable or the\n string is empty, false otherwise. Nonprintable characters are\n those characters defined in the Unicode character database as\n "Other" or "Separator", excepting the ASCII space (0x20) which is\n considered printable. (Note that printable characters in this\n context are those which should not be escaped when "repr()" is\n invoked on a string. It has no bearing on the handling of strings\n written to "sys.stdout" or "sys.stderr".)\n\nstr.isspace()\n\n Return true if there are only whitespace characters in the string\n and there is at least one character, false otherwise. Whitespace\n characters are those characters defined in the Unicode character\n database as "Other" or "Separator" and those with bidirectional\n property being one of "WS", "B", or "S".\n\nstr.istitle()\n\n Return true if the string is a titlecased string and there is at\n least one character, for example uppercase characters may only\n follow uncased characters and lowercase characters only cased ones.\n Return false otherwise.\n\nstr.isupper()\n\n Return true if all cased characters [4] in the string are uppercase\n and there is at least one cased character, false otherwise.\n\nstr.join(iterable)\n\n Return a string which is the concatenation of the strings in the\n *iterable* *iterable*. A "TypeError" will be raised if there are\n any non-string values in *iterable*, including "bytes" objects.\n The separator between elements is the string providing this method.\n\nstr.ljust(width[, fillchar])\n\n Return the string left justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is an ASCII\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\nstr.lower()\n\n Return a copy of the string with all the cased characters [4]\n converted to lowercase.\n\n The lowercasing algorithm used is described in section 3.13 of the\n Unicode Standard.\n\nstr.lstrip([chars])\n\n Return a copy of the string with leading characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a prefix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.lstrip()\n \'spacious \'\n >>> \'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\nstatic str.maketrans(x[, y[, z]])\n\n This static method returns a translation table usable for\n "str.translate()".\n\n If there is only one argument, it must be a dictionary mapping\n Unicode ordinals (integers) or characters (strings of length 1) to\n Unicode ordinals, strings (of arbitrary lengths) or None.\n Character keys will then be converted to ordinals.\n\n If there are two arguments, they must be strings of equal length,\n and in the resulting dictionary, each character in x will be mapped\n to the character at the same position in y. If there is a third\n argument, it must be a string, whose characters will be mapped to\n None in the result.\n\nstr.partition(sep)\n\n Split the string at the first occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing the string itself, followed by\n two empty strings.\n\nstr.replace(old, new[, count])\n\n Return a copy of the string with all occurrences of substring *old*\n replaced by *new*. If the optional argument *count* is given, only\n the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n Return the highest index in the string where substring *sub* is\n found, such that *sub* is contained within "s[start:end]".\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return "-1" on failure.\n\nstr.rindex(sub[, start[, end]])\n\n Like "rfind()" but raises "ValueError" when the substring *sub* is\n not found.\n\nstr.rjust(width[, fillchar])\n\n Return the string right justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is an ASCII\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\nstr.rpartition(sep)\n\n Split the string at the last occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing two empty strings, followed by\n the string itself.\n\nstr.rsplit(sep=None, maxsplit=-1)\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n are done, the *rightmost* ones. If *sep* is not specified or\n "None", any whitespace string is a separator. Except for splitting\n from the right, "rsplit()" behaves like "split()" which is\n described in detail below.\n\nstr.rstrip([chars])\n\n Return a copy of the string with trailing characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a suffix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.rstrip()\n \' spacious\'\n >>> \'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\nstr.split(sep=None, maxsplit=-1)\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit*\n splits are done (thus, the list will have at most "maxsplit+1"\n elements). If *maxsplit* is not specified or "-1", then there is\n no limit on the number of splits (all possible splits are made).\n\n If *sep* is given, consecutive delimiters are not grouped together\n and are deemed to delimit empty strings (for example,\n "\'1,,2\'.split(\',\')" returns "[\'1\', \'\', \'2\']"). The *sep* argument\n may consist of multiple characters (for example,\n "\'1<>2<>3\'.split(\'<>\')" returns "[\'1\', \'2\', \'3\']"). Splitting an\n empty string with a specified separator returns "[\'\']".\n\n For example:\n\n >>> \'1,2,3\'.split(\',\')\n [\'1\', \'2\', \'3\']\n >>> \'1,2,3\'.split(\',\', maxsplit=1)\n [\'1\', \'2,3\']\n >>> \'1,2,,3,\'.split(\',\')\n [\'1\', \'2\', \'\', \'3\', \'\']\n\n If *sep* is not specified or is "None", a different splitting\n algorithm is applied: runs of consecutive whitespace are regarded\n as a single separator, and the result will contain no empty strings\n at the start or end if the string has leading or trailing\n whitespace. Consequently, splitting an empty string or a string\n consisting of just whitespace with a "None" separator returns "[]".\n\n For example:\n\n >>> \'1 2 3\'.split()\n [\'1\', \'2\', \'3\']\n >>> \'1 2 3\'.split(maxsplit=1)\n [\'1\', \'2 3\']\n >>> \' 1 2 3 \'.split()\n [\'1\', \'2\', \'3\']\n\nstr.splitlines([keepends])\n\n Return a list of the lines in the string, breaking at line\n boundaries. Line breaks are not included in the resulting list\n unless *keepends* is given and true.\n\n This method splits on the following line boundaries. In\n particular, the boundaries are a superset of *universal newlines*.\n\n +-------------------------+-------------------------------+\n | Representation | Description |\n +=========================+===============================+\n | "\\n" | Line Feed |\n +-------------------------+-------------------------------+\n | "\\r" | Carriage Return |\n +-------------------------+-------------------------------+\n | "\\r\\n" | Carriage Return + Line Feed |\n +-------------------------+-------------------------------+\n | "\\v" or "\\x0b" | Line Tabulation |\n +-------------------------+-------------------------------+\n | "\\f" or "\\x0c" | Form Feed |\n +-------------------------+-------------------------------+\n | "\\x1c" | File Separator |\n +-------------------------+-------------------------------+\n | "\\x1d" | Group Separator |\n +-------------------------+-------------------------------+\n | "\\x1e" | Record Separator |\n +-------------------------+-------------------------------+\n | "\\x85" | Next Line (C1 Control Code) |\n +-------------------------+-------------------------------+\n | "\\u2028" | Line Separator |\n +-------------------------+-------------------------------+\n | "\\u2029" | Paragraph Separator |\n +-------------------------+-------------------------------+\n\n Changed in version 3.2: "\\v" and "\\f" added to list of line\n boundaries.\n\n For example:\n\n >>> \'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines()\n [\'ab c\', \'\', \'de fg\', \'kl\']\n >>> \'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines(keepends=True)\n [\'ab c\\n\', \'\\n\', \'de fg\\r\', \'kl\\r\\n\']\n\n Unlike "split()" when a delimiter string *sep* is given, this\n method returns an empty list for the empty string, and a terminal\n line break does not result in an extra line:\n\n >>> "".splitlines()\n []\n >>> "One line\\n".splitlines()\n [\'One line\']\n\n For comparison, "split(\'\\n\')" gives:\n\n >>> \'\'.split(\'\\n\')\n [\'\']\n >>> \'Two lines\\n\'.split(\'\\n\')\n [\'Two lines\', \'\']\n\nstr.startswith(prefix[, start[, end]])\n\n Return "True" if string starts with the *prefix*, otherwise return\n "False". *prefix* can also be a tuple of prefixes to look for.\n With optional *start*, test string beginning at that position.\n With optional *end*, stop comparing string at that position.\n\nstr.strip([chars])\n\n Return a copy of the string with the leading and trailing\n characters removed. The *chars* argument is a string specifying the\n set of characters to be removed. If omitted or "None", the *chars*\n argument defaults to removing whitespace. The *chars* argument is\n not a prefix or suffix; rather, all combinations of its values are\n stripped:\n\n >>> \' spacious \'.strip()\n \'spacious\'\n >>> \'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\nstr.swapcase()\n\n Return a copy of the string with uppercase characters converted to\n lowercase and vice versa. Note that it is not necessarily true that\n "s.swapcase().swapcase() == s".\n\nstr.title()\n\n Return a titlecased version of the string where words start with an\n uppercase character and the remaining characters are lowercase.\n\n For example:\n\n >>> \'Hello world\'.title()\n \'Hello World\'\n\n The algorithm uses a simple language-independent definition of a\n word as groups of consecutive letters. The definition works in\n many contexts but it means that apostrophes in contractions and\n possessives form word boundaries, which may not be the desired\n result:\n\n >>> "they\'re bill\'s friends from the UK".title()\n "They\'Re Bill\'S Friends From The Uk"\n\n A workaround for apostrophes can be constructed using regular\n expressions:\n\n >>> import re\n >>> def titlecase(s):\n ... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n ... lambda mo: mo.group(0)[0].upper() +\n ... mo.group(0)[1:].lower(),\n ... s)\n ...\n >>> titlecase("they\'re bill\'s friends.")\n "They\'re Bill\'s Friends."\n\nstr.translate(table)\n\n Return a copy of the string in which each character has been mapped\n through the given translation table. The table must be an object\n that implements indexing via "__getitem__()", typically a *mapping*\n or *sequence*. When indexed by a Unicode ordinal (an integer), the\n table object can do any of the following: return a Unicode ordinal\n or a string, to map the character to one or more other characters;\n return "None", to delete the character from the return string; or\n raise a "LookupError" exception, to map the character to itself.\n\n You can use "str.maketrans()" to create a translation map from\n character-to-character mappings in different formats.\n\n See also the "codecs" module for a more flexible approach to custom\n character mappings.\n\nstr.upper()\n\n Return a copy of the string with all the cased characters [4]\n converted to uppercase. Note that "str.upper().isupper()" might be\n "False" if "s" contains uncased characters or if the Unicode\n category of the resulting character(s) is not "Lu" (Letter,\n uppercase), but e.g. "Lt" (Letter, titlecase).\n\n The uppercasing algorithm used is described in section 3.13 of the\n Unicode Standard.\n\nstr.zfill(width)\n\n Return a copy of the string left filled with ASCII "\'0\'" digits to\n make a string of length *width*. A leading sign prefix\n ("\'+\'"/"\'-\'") is handled by inserting the padding *after* the sign\n character rather than before. The original string is returned if\n *width* is less than or equal to "len(s)".\n\n For example:\n\n >>> "42".zfill(5)\n \'00042\'\n >>> "-42".zfill(5)\n \'-0042\'\n', 'strings': u'\nString and Bytes literals\n*************************\n\nString literals are described by the following lexical definitions:\n\n stringliteral ::= [stringprefix](shortstring | longstring)\n stringprefix ::= "r" | "u" | "R" | "U"\n shortstring ::= "\'" shortstringitem* "\'" | \'"\' shortstringitem* \'"\'\n longstring ::= "\'\'\'" longstringitem* "\'\'\'" | \'"""\' longstringitem* \'"""\'\n shortstringitem ::= shortstringchar | stringescapeseq\n longstringitem ::= longstringchar | stringescapeseq\n shortstringchar ::= \n longstringchar ::= \n stringescapeseq ::= "\\" \n\n bytesliteral ::= bytesprefix(shortbytes | longbytes)\n bytesprefix ::= "b" | "B" | "br" | "Br" | "bR" | "BR" | "rb" | "rB" | "Rb" | "RB"\n shortbytes ::= "\'" shortbytesitem* "\'" | \'"\' shortbytesitem* \'"\'\n longbytes ::= "\'\'\'" longbytesitem* "\'\'\'" | \'"""\' longbytesitem* \'"""\'\n shortbytesitem ::= shortbyteschar | bytesescapeseq\n longbytesitem ::= longbyteschar | bytesescapeseq\n shortbyteschar ::= \n longbyteschar ::= \n bytesescapeseq ::= "\\" \n\nOne syntactic restriction not indicated by these productions is that\nwhitespace is not allowed between the "stringprefix" or "bytesprefix"\nand the rest of the literal. The source character set is defined by\nthe encoding declaration; it is UTF-8 if no encoding declaration is\ngiven in the source file; see section *Encoding declarations*.\n\nIn plain English: Both types of literals can be enclosed in matching\nsingle quotes ("\'") or double quotes ("""). They can also be enclosed\nin matching groups of three single or double quotes (these are\ngenerally referred to as *triple-quoted strings*). The backslash\n("\\") character is used to escape characters that otherwise have a\nspecial meaning, such as newline, backslash itself, or the quote\ncharacter.\n\nBytes literals are always prefixed with "\'b\'" or "\'B\'"; they produce\nan instance of the "bytes" type instead of the "str" type. They may\nonly contain ASCII characters; bytes with a numeric value of 128 or\ngreater must be expressed with escapes.\n\nAs of Python 3.3 it is possible again to prefix string literals with a\n"u" prefix to simplify maintenance of dual 2.x and 3.x codebases.\n\nBoth string and bytes literals may optionally be prefixed with a\nletter "\'r\'" or "\'R\'"; such strings are called *raw strings* and treat\nbackslashes as literal characters. As a result, in string literals,\n"\'\\U\'" and "\'\\u\'" escapes in raw strings are not treated specially.\nGiven that Python 2.x\'s raw unicode literals behave differently than\nPython 3.x\'s the "\'ur\'" syntax is not supported.\n\nNew in version 3.3: The "\'rb\'" prefix of raw bytes literals has been\nadded as a synonym of "\'br\'".\n\nNew in version 3.3: Support for the unicode legacy literal\n("u\'value\'") was reintroduced to simplify the maintenance of dual\nPython 2.x and 3.x codebases. See **PEP 414** for more information.\n\nIn triple-quoted literals, unescaped newlines and quotes are allowed\n(and are retained), except that three unescaped quotes in a row\nterminate the literal. (A "quote" is the character used to open the\nliteral, i.e. either "\'" or """.)\n\nUnless an "\'r\'" or "\'R\'" prefix is present, escape sequences in string\nand bytes literals are interpreted according to rules similar to those\nused by Standard C. The recognized escape sequences are:\n\n+-------------------+-----------------------------------+---------+\n| Escape Sequence | Meaning | Notes |\n+===================+===================================+=========+\n| "\\newline" | Backslash and newline ignored | |\n+-------------------+-----------------------------------+---------+\n| "\\\\" | Backslash ("\\") | |\n+-------------------+-----------------------------------+---------+\n| "\\\'" | Single quote ("\'") | |\n+-------------------+-----------------------------------+---------+\n| "\\"" | Double quote (""") | |\n+-------------------+-----------------------------------+---------+\n| "\\a" | ASCII Bell (BEL) | |\n+-------------------+-----------------------------------+---------+\n| "\\b" | ASCII Backspace (BS) | |\n+-------------------+-----------------------------------+---------+\n| "\\f" | ASCII Formfeed (FF) | |\n+-------------------+-----------------------------------+---------+\n| "\\n" | ASCII Linefeed (LF) | |\n+-------------------+-----------------------------------+---------+\n| "\\r" | ASCII Carriage Return (CR) | |\n+-------------------+-----------------------------------+---------+\n| "\\t" | ASCII Horizontal Tab (TAB) | |\n+-------------------+-----------------------------------+---------+\n| "\\v" | ASCII Vertical Tab (VT) | |\n+-------------------+-----------------------------------+---------+\n| "\\ooo" | Character with octal value *ooo* | (1,3) |\n+-------------------+-----------------------------------+---------+\n| "\\xhh" | Character with hex value *hh* | (2,3) |\n+-------------------+-----------------------------------+---------+\n\nEscape sequences only recognized in string literals are:\n\n+-------------------+-----------------------------------+---------+\n| Escape Sequence | Meaning | Notes |\n+===================+===================================+=========+\n| "\\N{name}" | Character named *name* in the | (4) |\n| | Unicode database | |\n+-------------------+-----------------------------------+---------+\n| "\\uxxxx" | Character with 16-bit hex value | (5) |\n| | *xxxx* | |\n+-------------------+-----------------------------------+---------+\n| "\\Uxxxxxxxx" | Character with 32-bit hex value | (6) |\n| | *xxxxxxxx* | |\n+-------------------+-----------------------------------+---------+\n\nNotes:\n\n1. As in Standard C, up to three octal digits are accepted.\n\n2. Unlike in Standard C, exactly two hex digits are required.\n\n3. In a bytes literal, hexadecimal and octal escapes denote the\n byte with the given value. In a string literal, these escapes\n denote a Unicode character with the given value.\n\n4. Changed in version 3.3: Support for name aliases [1] has been\n added.\n\n5. Individual code units which form parts of a surrogate pair can\n be encoded using this escape sequence. Exactly four hex digits are\n required.\n\n6. Any Unicode character can be encoded this way. Exactly eight\n hex digits are required.\n\nUnlike Standard C, all unrecognized escape sequences are left in the\nstring unchanged, i.e., *the backslash is left in the result*. (This\nbehavior is useful when debugging: if an escape sequence is mistyped,\nthe resulting output is more easily recognized as broken.) It is also\nimportant to note that the escape sequences only recognized in string\nliterals fall into the category of unrecognized escapes for bytes\nliterals.\n\nEven in a raw literal, quotes can be escaped with a backslash, but the\nbackslash remains in the result; for example, "r"\\""" is a valid\nstring literal consisting of two characters: a backslash and a double\nquote; "r"\\"" is not a valid string literal (even a raw string cannot\nend in an odd number of backslashes). Specifically, *a raw literal\ncannot end in a single backslash* (since the backslash would escape\nthe following quote character). Note also that a single backslash\nfollowed by a newline is interpreted as those two characters as part\nof the literal, *not* as a line continuation.\n', 'subscriptions': u'\nSubscriptions\n*************\n\nA subscription selects an item of a sequence (string, tuple or list)\nor mapping (dictionary) object:\n\n subscription ::= primary "[" expression_list "]"\n\nThe primary must evaluate to an object that supports subscription\n(lists or dictionaries for example). User-defined objects can support\nsubscription by defining a "__getitem__()" method.\n\nFor built-in objects, there are two types of objects that support\nsubscription:\n\nIf the primary is a mapping, the expression list must evaluate to an\nobject whose value is one of the keys of the mapping, and the\nsubscription selects the value in the mapping that corresponds to that\nkey. (The expression list is a tuple except if it has exactly one\nitem.)\n\nIf the primary is a sequence, the expression (list) must evaluate to\nan integer or a slice (as discussed in the following section).\n\nThe formal syntax makes no special provision for negative indices in\nsequences; however, built-in sequences all provide a "__getitem__()"\nmethod that interprets negative indices by adding the length of the\nsequence to the index (so that "x[-1]" selects the last item of "x").\nThe resulting value must be a nonnegative integer less than the number\nof items in the sequence, and the subscription selects the item whose\nindex is that value (counting from zero). Since the support for\nnegative indices and slicing occurs in the object\'s "__getitem__()"\nmethod, subclasses overriding this method will need to explicitly add\nthat support.\n\nA string\'s items are characters. A character is not a separate data\ntype but a string of exactly one character.\n', 'truth': u'\nTruth Value Testing\n*******************\n\nAny object can be tested for truth value, for use in an "if" or\n"while" condition or as operand of the Boolean operations below. The\nfollowing values are considered false:\n\n* "None"\n\n* "False"\n\n* zero of any numeric type, for example, "0", "0.0", "0j".\n\n* any empty sequence, for example, "\'\'", "()", "[]".\n\n* any empty mapping, for example, "{}".\n\n* instances of user-defined classes, if the class defines a\n "__bool__()" or "__len__()" method, when that method returns the\n integer zero or "bool" value "False". [1]\n\nAll other values are considered true --- so objects of many types are\nalways true.\n\nOperations and built-in functions that have a Boolean result always\nreturn "0" or "False" for false and "1" or "True" for true, unless\notherwise stated. (Important exception: the Boolean operations "or"\nand "and" always return one of their operands.)\n', -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 12 23:38:18 2016 From: python-checkins at python.org (martin.panter) Date: Mon, 13 Jun 2016 03:38:18 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327186=3A_Skip_sca?= =?utf-8?q?ndir=28bytes=29_test_with_os=2Ename_=3D=3D_=22nt=22?= Message-ID: <20160613033817.99132.89231.69F16353@psf.io> https://hg.python.org/cpython/rev/f384c5c14488 changeset: 101971:f384c5c14488 parent: 101961:0b18f7d262cc user: Martin Panter date: Mon Jun 13 03:28:35 2016 +0000 summary: Issue #27186: Skip scandir(bytes) test with os.name == "nt" files: Lib/test/test_os.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) 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 @@ -2953,7 +2953,7 @@ entry = self.create_file_entry() self.assertEqual(os.fspath(entry), os.path.join(self.path, 'file.txt')) - @unittest.skipIf(sys.platform == "nt", "test requires bytes path support") + @unittest.skipIf(os.name == "nt", "test requires bytes path support") def test_fspath_protocol_bytes(self): bytes_filename = os.fsencode('bytesfile.txt') bytes_entry = self.create_file_entry(name=bytes_filename) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 00:43:03 2016 From: python-checkins at python.org (terry.reedy) Date: Mon, 13 Jun 2016 04:43:03 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327163=3A_Add_idle?= =?utf-8?q?lib/IDLE_entry_to_What=27s_New_in_3=2E6=2E?= Message-ID: <20160613044303.19950.18890.961C4633@psf.io> https://hg.python.org/cpython/rev/a3cffed2c9ad changeset: 101972:a3cffed2c9ad user: Terry Jan Reedy date: Mon Jun 13 00:41:53 2016 -0400 summary: Issue #27163: Add idlelib/IDLE entry to What's New in 3.6. files: Doc/whatsnew/3.6.rst | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -281,6 +281,16 @@ :issue:`23848`.) +idlelib and IDLE +---------------- + +The idlelib package is being modernized and refactored to make IDLE look and work better and to make the code easier to understand, test, and improve. Part of making IDLE look better, especially on Linux and Mac, is using ttk widgets, mostly in the dialogs. As a result, IDLE no longer runs with tcl/tk 8.4. It now requires tcl/tk 8.5 or 8.6. We recommend running the latest release of either. + +'Modernizing' includes renaming and consolidation of idlelib modules. The renaming of files with partial uppercase names is similar to the renaming of, for instance, Tkinter and TkFont to tkinter and tkinter.font in 3.0. As a result, imports of idlelib files that worked in 3.5 will usually not work in 3.6. At least a module name change will be needed (see idlelib/README.txt), sometimes more. (Name changes contributed by Al Swiegart and Terry Reedy in :issue:`24225`. Most idlelib patches since have been and will be part of the process.) + +In compensation, the eventual result with be that some idlelib classes will be easier to use, with better APIs and docstrings explaining them. Additional useful information will be added to idlelib when available. + + os -- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 00:43:04 2016 From: python-checkins at python.org (terry.reedy) Date: Mon, 13 Jun 2016 04:43:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Whitespace?= Message-ID: <20160613044303.114533.74431.6C2DD1F7@psf.io> https://hg.python.org/cpython/rev/34a9733f9941 changeset: 101973:34a9733f9941 user: Terry Jan Reedy date: Mon Jun 13 00:42:42 2016 -0400 summary: Whitespace files: Doc/whatsnew/3.6.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -288,7 +288,7 @@ 'Modernizing' includes renaming and consolidation of idlelib modules. The renaming of files with partial uppercase names is similar to the renaming of, for instance, Tkinter and TkFont to tkinter and tkinter.font in 3.0. As a result, imports of idlelib files that worked in 3.5 will usually not work in 3.6. At least a module name change will be needed (see idlelib/README.txt), sometimes more. (Name changes contributed by Al Swiegart and Terry Reedy in :issue:`24225`. Most idlelib patches since have been and will be part of the process.) -In compensation, the eventual result with be that some idlelib classes will be easier to use, with better APIs and docstrings explaining them. Additional useful information will be added to idlelib when available. +In compensation, the eventual result with be that some idlelib classes will be easier to use, with better APIs and docstrings explaining them. Additional useful information will be added to idlelib when available. os -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 02:24:37 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Mon, 13 Jun 2016 06:24:37 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327025=3A_Generate?= =?utf-8?q?d_names_for_Tkinter_widgets_are_now_more_meanful?= Message-ID: <20160613062436.19990.76317.6BC8BB66@psf.io> https://hg.python.org/cpython/rev/304c61263ae6 changeset: 101974:304c61263ae6 user: Serhiy Storchaka date: Mon Jun 13 09:24:11 2016 +0300 summary: Issue #27025: Generated names for Tkinter widgets are now more meanful and recognizirable. files: Lib/tkinter/__init__.py | 16 +++++++-- Lib/tkinter/test/test_tkinter/test_misc.py | 8 +++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -489,6 +489,9 @@ Base class which defines methods common for interior widgets.""" + # used for generating child widget names + _last_child_ids = None + # XXX font command? _tclCommands = None def destroy(self): @@ -2174,7 +2177,15 @@ name = cnf['name'] del cnf['name'] if not name: - name = repr(id(self)) + name = self.__class__.__name__.lower() + if master._last_child_ids is None: + master._last_child_ids = {} + count = master._last_child_ids.get(name, 0) + 1 + master._last_child_ids[name] = count + if count == 1: + name = '`%s' % (name,) + else: + name = '`%s%d' % (name, count) self._name = name if master._w=='.': self._w = '.' + name @@ -3392,9 +3403,6 @@ if not name: Image._last_id += 1 name = "pyimage%r" % (Image._last_id,) # tk itself would use image - # The following is needed for systems where id(x) - # can return a negative number, such as Linux/m68k: - if name[0] == '-': name = '_' + name[1:] if kw and cnf: cnf = _cnfmerge((cnf, kw)) elif kw: cnf = kw options = () diff --git a/Lib/tkinter/test/test_tkinter/test_misc.py b/Lib/tkinter/test/test_tkinter/test_misc.py --- a/Lib/tkinter/test/test_tkinter/test_misc.py +++ b/Lib/tkinter/test/test_tkinter/test_misc.py @@ -12,6 +12,14 @@ f = tkinter.Frame(t, name='child') self.assertEqual(repr(f), '') + def test_generated_names(self): + t = tkinter.Toplevel(self.root) + f = tkinter.Frame(t) + f2 = tkinter.Frame(t) + b = tkinter.Button(f2) + for name in str(b).split('.'): + self.assertFalse(name.isidentifier(), msg=repr(name)) + def test_tk_setPalette(self): root = self.root root.tk_setPalette('black') -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Mon Jun 13 04:55:08 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 13 Jun 2016 08:55:08 +0000 Subject: [Python-checkins] Daily reference leaks (34a9733f9941): sum=5 Message-ID: <20160613085508.114435.57892.C86F599C@psf.io> results for 34a9733f9941 on branch "default" -------------------------------------------- test_collections leaked [0, 0, -2] references, sum=-2 test_collections leaked [4, -4, 3] memory blocks, sum=3 test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogF1R5aG', '--timeout', '7200'] From lp_benchmark_robot at intel.com Mon Jun 13 07:09:48 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Mon, 13 Jun 2016 12:09:48 +0100 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2016-06-13 Message-ID: Results for project Python 2.7, build date 2016-06-13 02:45:59 +0000 commit: f520ae3b537b previous commit: e981a4273cf6 revision date: 2016-06-12 13:37:57 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.20% -0.44% 4.08% 6.84% :-) pybench 0.20% 0.02% 5.69% 5.21% :-( regex_v8 0.47% 0.26% -2.28% 10.46% :-) nbody 0.09% 0.23% 8.89% 1.91% :-) json_dump_v2 0.44% -0.17% 2.15% 12.21% :-( normal_startup 1.91% -0.05% -5.77% 2.48% :-| ssbench 0.14% 0.39% 0.94% 3.15% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-2-7-2016-06-13/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Mon Jun 13 07:09:08 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Mon, 13 Jun 2016 12:09:08 +0100 Subject: [Python-checkins] UGLY Benchmark Results for Python Default 2016-06-13 Message-ID: <9e57f5d9-7429-4acd-a1ba-6f8c23adf027@irsmsx103.ger.corp.intel.com> Results for project Python default, build date 2016-06-13 02:02:22 +0000 commit: 0b18f7d262cc previous commit: 76f831e4b806 revision date: 2016-06-12 20:23:15 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.23% -4.34% 7.00% 19.63% :-| pybench 0.12% 0.22% 1.82% 7.53% :-( regex_v8 2.80% 0.81% -3.33% 3.48% :-| nbody 0.29% 1.21% 0.49% 7.12% :-| json_dump_v2 0.31% 0.68% -0.76% 12.44% :-| normal_startup 0.82% 0.37% 0.80% 6.62% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/ugly-benchmark-results-for-python-default-2016-06-13/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Mon Jun 13 10:34:08 2016 From: python-checkins at python.org (matthias.klose) Date: Mon, 13 Jun 2016 14:34:08 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_-_Comment_out_socket_=28SO?= =?utf-8?q?=5FREUSEPORT=29_and_posix_=28O=5FSHLOCK=2C_O=5FEXLOCK=29_consta?= =?utf-8?q?nts?= Message-ID: <20160613143312.28042.29348.0A835D67@psf.io> https://hg.python.org/cpython/rev/c78774c7d032 changeset: 101975:c78774c7d032 user: doko at ubuntu.com date: Mon Jun 13 16:33:04 2016 +0200 summary: - Comment out socket (SO_REUSEPORT) and posix (O_SHLOCK, O_EXLOCK) constants exposed on the API which are not implemented on GNU/Hurd. They would not work at runtime anyway. files: Misc/NEWS | 4 ++++ Modules/posixmodule.c | 2 ++ Modules/socketmodule.c | 2 ++ 3 files changed, 8 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -50,6 +50,10 @@ Library ------- +- Comment out socket (SO_REUSEPORT) and posix (O_SHLOCK, O_EXLOCK) constants + exposed on the API which are not implemented on GNU/Hurd. They would not + work at runtime anyway. + - Issue #25455: Fixed crashes in repr of recursive ElementTree.Element and functools.partial objects. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -12658,12 +12658,14 @@ #ifdef O_LARGEFILE if (PyModule_AddIntMacro(m, O_LARGEFILE)) return -1; #endif +#ifndef __GNU__ #ifdef O_SHLOCK if (PyModule_AddIntMacro(m, O_SHLOCK)) return -1; #endif #ifdef O_EXLOCK if (PyModule_AddIntMacro(m, O_EXLOCK)) return -1; #endif +#endif #ifdef O_EXEC if (PyModule_AddIntMacro(m, O_EXEC)) return -1; #endif diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -6529,9 +6529,11 @@ #ifdef SO_OOBINLINE PyModule_AddIntMacro(m, SO_OOBINLINE); #endif +#ifndef __GNU__ #ifdef SO_REUSEPORT PyModule_AddIntMacro(m, SO_REUSEPORT); #endif +#endif #ifdef SO_SNDBUF PyModule_AddIntMacro(m, SO_SNDBUF); #endif -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 16:02:26 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 13 Jun 2016 20:02:26 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy40IC0+IDMuNSk6?= =?utf-8?q?_Forward-merge_from_3=2E4_to_3=2E5=2E?= Message-ID: <20160613200225.26088.7786.5C3B600F@psf.io> https://hg.python.org/cpython/rev/65259ba6b329 changeset: 101976:65259ba6b329 branch: 3.5 parent: 101967:adc6fed9fe5d parent: 101970:ca24b5b2d7fe user: Larry Hastings date: Mon Jun 13 12:55:11 2016 -0700 summary: Forward-merge from 3.4 to 3.5. files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -146,6 +146,7 @@ b4cbecbc0781e89a309d03b60a1f75f8499250e6 v3.4.3 04f3f725896c6961212c3a12e8ac25be6958f4fa v3.4.4rc1 737efcadf5a678b184e0fa431aae11276bf06648 v3.4.4 +3631bb4a2490292ebf81d3e947ae36da145da564 v3.4.5rc1 5d4b6a57d5fd7564bf73f3db0e46fe5eeb00bcd8 v3.5.0a1 0337bd7ebcb6559d69679bc7025059ad1ce4f432 v3.5.0a2 82656e28b5e5c4ae48d8dd8b5f0d7968908a82b6 v3.5.0a3 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 16:03:19 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 13 Jun 2016 20:03:19 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Forward-merge_from_3=2E5_to_default=2E?= Message-ID: <20160613200225.81381.3558.01D65B7B@psf.io> https://hg.python.org/cpython/rev/aa03416594ca changeset: 101977:aa03416594ca parent: 101975:c78774c7d032 parent: 101976:65259ba6b329 user: Larry Hastings date: Mon Jun 13 13:01:51 2016 -0700 summary: Forward-merge from 3.5 to default. files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -161,4 +161,5 @@ 374f501f4567b7595f2ad7798aa09afa2456bb28 v3.5.0 948ef16a69513ba1ff15c9d7d0b012b949df4c80 v3.5.1rc1 37a07cee5969e6d3672583187a73cf636ff28e1b v3.5.1 +68feec6488b26327a85a634605dd28eca4daa5f1 v3.5.2rc1 5896da372fb044e38595fb74495de1e1e7c8fb3c v3.6.0a1 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 16:13:08 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 13 Jun 2016 20:13:08 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Merge_the_3=2E4=2E5rc1_tag?= =?utf-8?q?_all_the_way_into_default_=283=2E6=29=2E?= Message-ID: <20160613201300.114539.88504.344120D5@psf.io> https://hg.python.org/cpython/rev/bb67de625cb2 changeset: 101978:bb67de625cb2 user: Larry Hastings date: Mon Jun 13 13:12:52 2016 -0700 summary: Merge the 3.4.5rc1 tag all the way into default (3.6). files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -146,6 +146,7 @@ b4cbecbc0781e89a309d03b60a1f75f8499250e6 v3.4.3 04f3f725896c6961212c3a12e8ac25be6958f4fa v3.4.4rc1 737efcadf5a678b184e0fa431aae11276bf06648 v3.4.4 +3631bb4a2490292ebf81d3e947ae36da145da564 v3.4.5rc1 5d4b6a57d5fd7564bf73f3db0e46fe5eeb00bcd8 v3.5.0a1 0337bd7ebcb6559d69679bc7025059ad1ce4f432 v3.5.0a2 82656e28b5e5c4ae48d8dd8b5f0d7968908a82b6 v3.5.0a3 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 17:42:55 2016 From: python-checkins at python.org (berker.peksag) Date: Mon, 13 Jun 2016 21:42:55 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5?= Message-ID: <20160613214254.27788.41362.4C3084E2@psf.io> https://hg.python.org/cpython/rev/26b6a2fad37c changeset: 101980:26b6a2fad37c parent: 101978:bb67de625cb2 parent: 101979:e5822da9a609 user: Berker Peksag date: Tue Jun 14 00:43:14 2016 +0300 summary: Merge from 3.5 files: Lib/sqlite3/test/dbapi.py | 3 +-- Lib/sqlite3/test/hooks.py | 4 ++-- Lib/sqlite3/test/regression.py | 12 +++--------- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py --- a/Lib/sqlite3/test/dbapi.py +++ b/Lib/sqlite3/test/dbapi.py @@ -335,8 +335,7 @@ def CheckTotalChanges(self): self.cu.execute("insert into test(name) values ('foo')") self.cu.execute("insert into test(name) values ('foo')") - if self.cx.total_changes < 2: - self.fail("total changes reported wrong value") + self.assertLess(2, self.cx.total_changes, msg='total changes reported wrong value') # Checks for executemany: # Sequences are required by the DB-API, iterators diff --git a/Lib/sqlite3/test/hooks.py b/Lib/sqlite3/test/hooks.py --- a/Lib/sqlite3/test/hooks.py +++ b/Lib/sqlite3/test/hooks.py @@ -61,8 +61,8 @@ ) order by x collate mycoll """ result = con.execute(sql).fetchall() - if result[0][0] != "c" or result[1][0] != "b" or result[2][0] != "a": - self.fail("the expected order was not returned") + self.assertEqual(result, [('c',), ('b',), ('a',)], + msg='the expected order was not returned') con.create_collation("mycoll", None) with self.assertRaises(sqlite.OperationalError) as cm: diff --git a/Lib/sqlite3/test/regression.py b/Lib/sqlite3/test/regression.py --- a/Lib/sqlite3/test/regression.py +++ b/Lib/sqlite3/test/regression.py @@ -134,17 +134,11 @@ def CheckErrorMsgDecodeError(self): # When porting the module to Python 3.0, the error message about # decoding errors disappeared. This verifies they're back again. - failure = None - try: + with self.assertRaises(sqlite.OperationalError) as cm: self.con.execute("select 'xxx' || ? || 'yyy' colname", (bytes(bytearray([250])),)).fetchone() - failure = "should have raised an OperationalError with detailed description" - except sqlite.OperationalError as e: - msg = e.args[0] - if not msg.startswith("Could not decode to UTF-8 column 'colname' with text 'xxx"): - failure = "OperationalError did not have expected description text" - if failure: - self.fail(failure) + msg = "Could not decode to UTF-8 column 'colname' with text 'xxx" + self.assertIn(msg, str(cm.exception)) def CheckRegisterAdapter(self): """ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 17:42:57 2016 From: python-checkins at python.org (berker.peksag) Date: Mon, 13 Jun 2016 21:42:57 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Replace_more_b?= =?utf-8?q?oilerplate_code_with_modern_unittest_features_in_sqlite3_tests?= Message-ID: <20160613214254.81041.24777.7AB1DB66@psf.io> https://hg.python.org/cpython/rev/e5822da9a609 changeset: 101979:e5822da9a609 branch: 3.5 parent: 101976:65259ba6b329 user: Berker Peksag date: Tue Jun 14 00:42:50 2016 +0300 summary: Replace more boilerplate code with modern unittest features in sqlite3 tests files: Lib/sqlite3/test/dbapi.py | 3 +-- Lib/sqlite3/test/hooks.py | 4 ++-- Lib/sqlite3/test/regression.py | 12 +++--------- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py --- a/Lib/sqlite3/test/dbapi.py +++ b/Lib/sqlite3/test/dbapi.py @@ -335,8 +335,7 @@ def CheckTotalChanges(self): self.cu.execute("insert into test(name) values ('foo')") self.cu.execute("insert into test(name) values ('foo')") - if self.cx.total_changes < 2: - self.fail("total changes reported wrong value") + self.assertLess(2, self.cx.total_changes, msg='total changes reported wrong value') # Checks for executemany: # Sequences are required by the DB-API, iterators diff --git a/Lib/sqlite3/test/hooks.py b/Lib/sqlite3/test/hooks.py --- a/Lib/sqlite3/test/hooks.py +++ b/Lib/sqlite3/test/hooks.py @@ -61,8 +61,8 @@ ) order by x collate mycoll """ result = con.execute(sql).fetchall() - if result[0][0] != "c" or result[1][0] != "b" or result[2][0] != "a": - self.fail("the expected order was not returned") + self.assertEqual(result, [('c',), ('b',), ('a',)], + msg='the expected order was not returned') con.create_collation("mycoll", None) with self.assertRaises(sqlite.OperationalError) as cm: diff --git a/Lib/sqlite3/test/regression.py b/Lib/sqlite3/test/regression.py --- a/Lib/sqlite3/test/regression.py +++ b/Lib/sqlite3/test/regression.py @@ -134,17 +134,11 @@ def CheckErrorMsgDecodeError(self): # When porting the module to Python 3.0, the error message about # decoding errors disappeared. This verifies they're back again. - failure = None - try: + with self.assertRaises(sqlite.OperationalError) as cm: self.con.execute("select 'xxx' || ? || 'yyy' colname", (bytes(bytearray([250])),)).fetchone() - failure = "should have raised an OperationalError with detailed description" - except sqlite.OperationalError as e: - msg = e.args[0] - if not msg.startswith("Could not decode to UTF-8 column 'colname' with text 'xxx"): - failure = "OperationalError did not have expected description text" - if failure: - self.fail(failure) + msg = "Could not decode to UTF-8 column 'colname' with text 'xxx" + self.assertIn(msg, str(cm.exception)) def CheckRegisterAdapter(self): """ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 17:48:48 2016 From: python-checkins at python.org (berker.peksag) Date: Mon, 13 Jun 2016 21:48:48 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327306=3A_Merge_from_3=2E5?= Message-ID: <20160613214845.99302.72563.8BA980BA@psf.io> https://hg.python.org/cpython/rev/9c9ed326d981 changeset: 101982:9c9ed326d981 parent: 101980:26b6a2fad37c parent: 101981:48052a140eed user: Berker Peksag date: Tue Jun 14 00:49:05 2016 +0300 summary: Issue #27306: Merge from 3.5 files: Doc/library/tarfile.rst | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Doc/library/tarfile.rst b/Doc/library/tarfile.rst --- a/Doc/library/tarfile.rst +++ b/Doc/library/tarfile.rst @@ -64,19 +64,19 @@ | ``'x'`` or | Create a tarfile exclusively without | | ``'x:'`` | compression. | | | Raise an :exc:`FileExistsError` exception | - | | if it is already exists. | + | | if it already exists. | +------------------+---------------------------------------------+ | ``'x:gz'`` | Create a tarfile with gzip compression. | | | Raise an :exc:`FileExistsError` exception | - | | if it is already exists. | + | | if it already exists. | +------------------+---------------------------------------------+ | ``'x:bz2'`` | Create a tarfile with bzip2 compression. | | | Raise an :exc:`FileExistsError` exception | - | | if it is already exists. | + | | if it already exists. | +------------------+---------------------------------------------+ | ``'x:xz'`` | Create a tarfile with lzma compression. | | | Raise an :exc:`FileExistsError` exception | - | | if it is already exists. | + | | if it already exists. | +------------------+---------------------------------------------+ | ``'a' or 'a:'`` | Open for appending with no compression. The | | | file is created if it does not exist. | @@ -148,8 +148,8 @@ .. class:: TarFile - Class for reading and writing tar archives. Do not use this class directly, - better use :func:`tarfile.open` instead. See :ref:`tarfile-objects`. + Class for reading and writing tar archives. Do not use this class directly: + use :func:`tarfile.open` instead. See :ref:`tarfile-objects`. .. function:: is_tarfile(name) @@ -271,7 +271,7 @@ *mode* is either ``'r'`` to read from an existing archive, ``'a'`` to append data to an existing file, ``'w'`` to create a new file overwriting an existing - one or ``'x'`` to create a new file only if it's not exists. + one, or ``'x'`` to create a new file only if it does not already exist. If *fileobj* is given, it is used for reading or writing data. If it can be determined, *mode* is overridden by *fileobj*'s mode. *fileobj* will be used -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 17:48:48 2016 From: python-checkins at python.org (berker.peksag) Date: Mon, 13 Jun 2016 21:48:48 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MzA2?= =?utf-8?q?=3A_Fix_typo_in_tarfile_documentation?= Message-ID: <20160613214844.101804.60076.E0B9E3F7@psf.io> https://hg.python.org/cpython/rev/48052a140eed changeset: 101981:48052a140eed branch: 3.5 parent: 101979:e5822da9a609 user: Berker Peksag date: Tue Jun 14 00:48:35 2016 +0300 summary: Issue #27306: Fix typo in tarfile documentation Patch by Gareth Rees. files: Doc/library/tarfile.rst | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Doc/library/tarfile.rst b/Doc/library/tarfile.rst --- a/Doc/library/tarfile.rst +++ b/Doc/library/tarfile.rst @@ -64,19 +64,19 @@ | ``'x'`` or | Create a tarfile exclusively without | | ``'x:'`` | compression. | | | Raise an :exc:`FileExistsError` exception | - | | if it is already exists. | + | | if it already exists. | +------------------+---------------------------------------------+ | ``'x:gz'`` | Create a tarfile with gzip compression. | | | Raise an :exc:`FileExistsError` exception | - | | if it is already exists. | + | | if it already exists. | +------------------+---------------------------------------------+ | ``'x:bz2'`` | Create a tarfile with bzip2 compression. | | | Raise an :exc:`FileExistsError` exception | - | | if it is already exists. | + | | if it already exists. | +------------------+---------------------------------------------+ | ``'x:xz'`` | Create a tarfile with lzma compression. | | | Raise an :exc:`FileExistsError` exception | - | | if it is already exists. | + | | if it already exists. | +------------------+---------------------------------------------+ | ``'a' or 'a:'`` | Open for appending with no compression. The | | | file is created if it does not exist. | @@ -148,8 +148,8 @@ .. class:: TarFile - Class for reading and writing tar archives. Do not use this class directly, - better use :func:`tarfile.open` instead. See :ref:`tarfile-objects`. + Class for reading and writing tar archives. Do not use this class directly: + use :func:`tarfile.open` instead. See :ref:`tarfile-objects`. .. function:: is_tarfile(name) @@ -271,7 +271,7 @@ *mode* is either ``'r'`` to read from an existing archive, ``'a'`` to append data to an existing file, ``'w'`` to create a new file overwriting an existing - one or ``'x'`` to create a new file only if it's not exists. + one, or ``'x'`` to create a new file only if it does not already exist. If *fileobj* is given, it is used for reading or writing data. If it can be determined, *mode* is overridden by *fileobj*'s mode. *fileobj* will be used -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 20:03:04 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 14 Jun 2016 00:03:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327136=3A_Merge_test=5Fasyncio_fix_from_3=2E5?= Message-ID: <20160614000302.9952.36012.0B58838A@psf.io> https://hg.python.org/cpython/rev/f31b6c3e41f7 changeset: 101984:f31b6c3e41f7 parent: 101982:9c9ed326d981 parent: 101983:e032ffd5ae84 user: Martin Panter date: Mon Jun 13 23:51:02 2016 +0000 summary: Issue #27136: Merge test_asyncio fix from 3.5 files: Lib/test/test_asyncio/test_base_events.py | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -1185,14 +1185,14 @@ test_utils.run_briefly(self.loop) # allow transport to close sock.family = socket.AF_INET6 - coro = self.loop.create_connection(asyncio.Protocol, '::2', 80) + coro = self.loop.create_connection(asyncio.Protocol, '::1', 80) t, p = self.loop.run_until_complete(coro) try: - # Without inet_pton we use getaddrinfo, which transforms ('::2', 80) - # to ('::0.0.0.2', 80, 0, 0). The last 0s are flow info, scope id. + # Without inet_pton we use getaddrinfo, which transforms ('::1', 80) + # to ('::1', 80, 0, 0). The last 0s are flow info, scope id. [address] = sock.connect.call_args[0] host, port = address[:2] - self.assertRegex(host, r'::(0\.)*2') + self.assertRegex(host, r'::(0\.)*1') self.assertEqual(port, 80) _, kwargs = m_socket.socket.call_args self.assertEqual(kwargs['family'], m_socket.AF_INET6) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 20:03:04 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 14 Jun 2016 00:03:04 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MTM2?= =?utf-8?q?=3A_Change_test_to_use_=3A=3A1_for_better_OS_X_Tiger_compatibil?= =?utf-8?q?ity?= Message-ID: <20160614000302.26001.90280.65F34675@psf.io> https://hg.python.org/cpython/rev/e032ffd5ae84 changeset: 101983:e032ffd5ae84 branch: 3.5 parent: 101981:48052a140eed user: Martin Panter date: Mon Jun 13 03:17:47 2016 +0000 summary: Issue #27136: Change test to use ::1 for better OS X Tiger compatibility files: Lib/test/test_asyncio/test_base_events.py | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -1185,14 +1185,14 @@ test_utils.run_briefly(self.loop) # allow transport to close sock.family = socket.AF_INET6 - coro = self.loop.create_connection(asyncio.Protocol, '::2', 80) + coro = self.loop.create_connection(asyncio.Protocol, '::1', 80) t, p = self.loop.run_until_complete(coro) try: - # Without inet_pton we use getaddrinfo, which transforms ('::2', 80) - # to ('::0.0.0.2', 80, 0, 0). The last 0s are flow info, scope id. + # Without inet_pton we use getaddrinfo, which transforms ('::1', 80) + # to ('::1', 80, 0, 0). The last 0s are flow info, scope id. [address] = sock.connect.call_args[0] host, port = address[:2] - self.assertRegex(host, r'::(0\.)*2') + self.assertRegex(host, r'::(0\.)*1') self.assertEqual(port, 80) _, kwargs = m_socket.socket.call_args self.assertEqual(kwargs['family'], m_socket.AF_INET6) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 20:28:33 2016 From: python-checkins at python.org (ned.deily) Date: Tue, 14 Jun 2016 00:28:33 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MzEw?= =?utf-8?q?=3A_remove_vestigial_import_in_IDLE=2Eapp?= Message-ID: <20160614002832.114484.9031.2278F4AF@psf.io> https://hg.python.org/cpython/rev/0cf4bda2882c changeset: 101986:0cf4bda2882c branch: 3.5 parent: 101983:e032ffd5ae84 user: Ned Deily date: Mon Jun 13 20:22:53 2016 -0400 summary: Issue #27310: remove vestigial import in IDLE.app files: Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py b/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py --- a/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py +++ b/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py @@ -68,8 +68,6 @@ break # Now it is safe to import idlelib. -from idlelib import macosxSupport -macosxSupport._appbundle = True from idlelib.PyShell import main if __name__ == '__main__': main() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 20:28:33 2016 From: python-checkins at python.org (ned.deily) Date: Tue, 14 Jun 2016 00:28:33 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI3MzEw?= =?utf-8?q?=3A_remove_vestigial_import_in_IDLE=2Eapp?= Message-ID: <20160614002831.81210.48155.56364C7E@psf.io> https://hg.python.org/cpython/rev/675569bee37f changeset: 101985:675569bee37f branch: 2.7 parent: 101951:f520ae3b537b user: Ned Deily date: Mon Jun 13 20:21:57 2016 -0400 summary: Issue #27310: remove vestigial import in IDLE.app files: Mac/IDLE/idlemain.py | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/Mac/IDLE/idlemain.py b/Mac/IDLE/idlemain.py --- a/Mac/IDLE/idlemain.py +++ b/Mac/IDLE/idlemain.py @@ -68,8 +68,6 @@ break # Now it is safe to import idlelib. -from idlelib import macosxSupport -macosxSupport._appbundle = True from idlelib.PyShell import main if __name__ == '__main__': main() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 20:28:34 2016 From: python-checkins at python.org (ned.deily) Date: Tue, 14 Jun 2016 00:28:34 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327310=3A_Fix_IDLE=2Eapp_failure_to_launch_on_OS?= =?utf-8?q?_X_due_to_vestigial_import=2E?= Message-ID: <20160614002832.19990.2620.5DD5C7DF@psf.io> https://hg.python.org/cpython/rev/9ba934d159e3 changeset: 101987:9ba934d159e3 parent: 101984:f31b6c3e41f7 parent: 101986:0cf4bda2882c user: Ned Deily date: Mon Jun 13 20:27:57 2016 -0400 summary: Issue #27310: Fix IDLE.app failure to launch on OS X due to vestigial import. files: Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py | 2 - Misc/NEWS | 11 ++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py b/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py --- a/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py +++ b/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py @@ -68,8 +68,6 @@ break # Now it is safe to import idlelib. -from idlelib import macosxSupport -macosxSupport._appbundle = True from idlelib.pyshell import main if __name__ == '__main__': main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,6 +2,17 @@ Python News +++++++++++ +What's New in Python 3.6.0 alpha 3 +================================== + +*Release date: XXXX-XX-XX* + +IDLE +++++ + +- Issue #27310: Fix IDLE.app failure to launch on OS X due to vestigial import. + + What's New in Python 3.6.0 alpha 2 ================================== -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 23:03:41 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 14 Jun 2016 03:03:41 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2317500=3A_Remove_m?= =?utf-8?q?erge_conflict_scar_tissue?= Message-ID: <20160614030340.99302.34718.42618103@psf.io> https://hg.python.org/cpython/rev/d9090aa75607 changeset: 101990:d9090aa75607 parent: 101987:9ba934d159e3 user: Martin Panter date: Tue Jun 14 02:23:31 2016 +0000 summary: Issue #17500: Remove merge conflict scar tissue files: Misc/NEWS | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -1573,7 +1573,6 @@ - Issue #26316: Fix variable name typo in Argument Clinic. -<<<<<<< local - Issue #25440: Fix output of python-config --extension-suffix. - Issue #25154: The pyvenv script has been deprecated in favour of -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 23:03:40 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 14 Jun 2016 03:03:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIyNjM2?= =?utf-8?q?=3A_avoid_using_a_shell_in_the_ctypes=2Eutil_module?= Message-ID: <20160614030340.26001.70350.162F67D8@psf.io> https://hg.python.org/cpython/rev/0715d403cae2 changeset: 101989:0715d403cae2 branch: 3.5 user: Martin Panter date: Tue Jun 14 01:27:11 2016 +0000 summary: Issue #22636: avoid using a shell in the ctypes.util module Replace os.popen() with subprocess.Popen. Based on patch by Victor Stinner. If the "gcc", "cc" or "objdump" command is not available, the code was supposed to raise an OSError exception. But there was a bug in the code. The shell code returns the exit code 10 if the required command is missing, and the code tries to check for the status 10. The problem is that os.popen() doesn't return the exit code directly, but a status which should be processed by os.WIFEXITED() and os.WEXITSTATUS(). In practice, the exception was never raised. The OSError exception was not documented and ctypes.util.find_library() is expected to return None if the library is not found. files: Lib/ctypes/test/test_find.py | 7 +- Lib/ctypes/util.py | 119 ++++++++++++++-------- Misc/NEWS | 3 + 3 files changed, 85 insertions(+), 44 deletions(-) diff --git a/Lib/ctypes/test/test_find.py b/Lib/ctypes/test/test_find.py --- a/Lib/ctypes/test/test_find.py +++ b/Lib/ctypes/test/test_find.py @@ -1,5 +1,5 @@ import unittest -import os +import os, os.path import sys import test.support from ctypes import * @@ -64,6 +64,11 @@ self.skipTest('lib_gle not available') self.gle.gleGetJoinStyle + def test_shell_injection(self): + result = find_library('; echo Hello shell > ' + test.support.TESTFN) + self.assertFalse(os.path.lexists(test.support.TESTFN)) + self.assertIsNone(result) + # On platforms where the default shared library suffix is '.so', # at least some libraries can be loaded as attributes of the cdll # object, since ctypes now tries loading the lib again diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py --- a/Lib/ctypes/util.py +++ b/Lib/ctypes/util.py @@ -1,6 +1,7 @@ -import sys, os -import contextlib +import os +import shutil import subprocess +import sys # find_library(name) returns the pathname of a library, or None. if os.name == "nt": @@ -94,28 +95,43 @@ import re, tempfile def _findLib_gcc(name): - expr = r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name) - fdout, ccout = tempfile.mkstemp() - os.close(fdout) - cmd = 'if type gcc >/dev/null 2>&1; then CC=gcc; elif type cc >/dev/null 2>&1; then CC=cc;else exit 10; fi;' \ - 'LANG=C LC_ALL=C $CC -Wl,-t -o ' + ccout + ' 2>&1 -l' + name + # Run GCC's linker with the -t (aka --trace) option and examine the + # library name it prints out. The GCC command will fail because we + # haven't supplied a proper program with main(), but that does not + # matter. + expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)) + + c_compiler = shutil.which('gcc') + if not c_compiler: + c_compiler = shutil.which('cc') + if not c_compiler: + # No C compiler available, give up + return None + + temp = tempfile.NamedTemporaryFile() try: - f = os.popen(cmd) - try: - trace = f.read() - finally: - rv = f.close() + args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name] + + env = dict(os.environ) + env['LC_ALL'] = 'C' + env['LANG'] = 'C' + proc = subprocess.Popen(args, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + env=env) + with proc: + trace = proc.stdout.read() finally: try: - os.unlink(ccout) + temp.close() except FileNotFoundError: + # Raised if the file was already removed, which is the normal + # behaviour of GCC if linking fails pass - if rv == 10: - raise OSError('gcc or cc command not found') res = re.search(expr, trace) if not res: return None - return res.group(0) + return os.fsdecode(res.group(0)) if sys.platform == "sunos5": @@ -123,55 +139,65 @@ def _get_soname(f): if not f: return None - cmd = "/usr/ccs/bin/dump -Lpv 2>/dev/null " + f - with contextlib.closing(os.popen(cmd)) as f: - data = f.read() - res = re.search(r'\[.*\]\sSONAME\s+([^\s]+)', data) + + proc = subprocess.Popen(("/usr/ccs/bin/dump", "-Lpv", f), + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL) + with proc: + data = proc.stdout.read() + res = re.search(br'\[.*\]\sSONAME\s+([^\s]+)', data) if not res: return None - return res.group(1) + return os.fsdecode(res.group(1)) else: def _get_soname(f): # assuming GNU binutils / ELF if not f: return None - cmd = 'if ! type objdump >/dev/null 2>&1; then exit 10; fi;' \ - "objdump -p -j .dynamic 2>/dev/null " + f - f = os.popen(cmd) - try: - dump = f.read() - finally: - rv = f.close() - if rv == 10: - raise OSError('objdump command not found') - res = re.search(r'\sSONAME\s+([^\s]+)', dump) + objdump = shutil.which('objdump') + if not objdump: + # objdump is not available, give up + return None + + proc = subprocess.Popen((objdump, '-p', '-j', '.dynamic', f), + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL) + with proc: + dump = proc.stdout.read() + res = re.search(br'\sSONAME\s+([^\s]+)', dump) if not res: return None - return res.group(1) + return os.fsdecode(res.group(1)) if sys.platform.startswith(("freebsd", "openbsd", "dragonfly")): def _num_version(libname): # "libxyz.so.MAJOR.MINOR" => [ MAJOR, MINOR ] - parts = libname.split(".") + parts = libname.split(b".") nums = [] try: while parts: nums.insert(0, int(parts.pop())) except ValueError: pass - return nums or [ sys.maxsize ] + return nums or [sys.maxsize] def find_library(name): ename = re.escape(name) expr = r':-l%s\.\S+ => \S*/(lib%s\.\S+)' % (ename, ename) - with contextlib.closing(os.popen('/sbin/ldconfig -r 2>/dev/null')) as f: - data = f.read() + expr = os.fsencode(expr) + + proc = subprocess.Popen(('/sbin/ldconfig', '-r'), + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL) + with proc: + data = proc.stdout.read() + res = re.findall(expr, data) if not res: return _get_soname(_findLib_gcc(name)) res.sort(key=_num_version) - return res[-1] + return os.fsdecode(res[-1]) elif sys.platform == "sunos5": @@ -179,17 +205,24 @@ if not os.path.exists('/usr/bin/crle'): return None + env = dict(os.environ) + env['LC_ALL'] = 'C' + if is64: - cmd = 'env LC_ALL=C /usr/bin/crle -64 2>/dev/null' + args = ('/usr/bin/crle', '-64') else: - cmd = 'env LC_ALL=C /usr/bin/crle 2>/dev/null' + args = ('/usr/bin/crle',) paths = None - with contextlib.closing(os.popen(cmd)) as f: - for line in f.readlines(): + proc = subprocess.Popen(args, + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL, + env=env) + with proc: + for line in proc.stdout: line = line.strip() - if line.startswith('Default Library Path (ELF):'): - paths = line.split()[4] + if line.startswith(b'Default Library Path (ELF):'): + paths = os.fsdecode(line).split()[4] if not paths: return None diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,9 @@ Library ------- +- Issue #22636: Avoid shell injection problems with + ctypes.util.find_library(). + - Issue #16182: Fix various functions in the "readline" module to use the locale encoding, and fix get_begidx() and get_endidx() to return code point indexes. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 23:03:40 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 14 Jun 2016 03:03:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzE2MTgy?= =?utf-8?q?=3A_Fix_readline_begidx=2C_endidx=2C_and_use_locale_encoding?= Message-ID: <20160614030340.28411.37338.42964D0A@psf.io> https://hg.python.org/cpython/rev/5122b3465a38 changeset: 101988:5122b3465a38 branch: 3.5 parent: 101986:0cf4bda2882c user: Martin Panter date: Tue Jun 14 01:16:16 2016 +0000 summary: Issue #16182: Fix readline begidx, endidx, and use locale encoding Based on patch by Serhiy Storchaka. files: Lib/test/test_readline.py | 141 +++++++++++++++++++++++++- Misc/NEWS | 4 + Modules/readline.c | 132 +++++++++++++++++------- 3 files changed, 235 insertions(+), 42 deletions(-) diff --git a/Lib/test/test_readline.py b/Lib/test/test_readline.py --- a/Lib/test/test_readline.py +++ b/Lib/test/test_readline.py @@ -1,15 +1,23 @@ """ Very minimal unittests for parts of the readline module. """ +from contextlib import ExitStack +from errno import EIO import os +import selectors +import subprocess +import sys import tempfile import unittest -from test.support import import_module, unlink +from test.support import import_module, unlink, TESTFN from test.support.script_helper import assert_python_ok # Skip tests if there is no readline module readline = import_module('readline') + at unittest.skipUnless(hasattr(readline, "clear_history"), + "The history update test cannot be run because the " + "clear_history method is not available.") class TestHistoryManipulation (unittest.TestCase): """ These tests were added to check that the libedit emulation on OSX and the @@ -17,9 +25,6 @@ why the tests cover only a small subset of the interface. """ - @unittest.skipUnless(hasattr(readline, "clear_history"), - "The history update test cannot be run because the " - "clear_history method is not available.") def testHistoryUpdates(self): readline.clear_history() @@ -82,6 +87,21 @@ # write_history_file can create the target readline.write_history_file(hfilename) + def test_nonascii_history(self): + readline.clear_history() + try: + readline.add_history("entr?e 1") + except UnicodeEncodeError as err: + self.skipTest("Locale cannot encode test data: " + format(err)) + readline.add_history("entr?e 2") + readline.replace_history_item(1, "entr?e 22") + readline.write_history_file(TESTFN) + self.addCleanup(os.remove, TESTFN) + readline.clear_history() + readline.read_history_file(TESTFN) + self.assertEqual(readline.get_history_item(1), "entr?e 1") + self.assertEqual(readline.get_history_item(2), "entr?e 22") + class TestReadline(unittest.TestCase): @@ -96,6 +116,119 @@ TERM='xterm-256color') self.assertEqual(stdout, b'') + def test_nonascii(self): + try: + readline.add_history("\xEB\xEF") + except UnicodeEncodeError as err: + self.skipTest("Locale cannot encode test data: " + format(err)) + + script = r"""import readline + +if readline.__doc__ and "libedit" in readline.__doc__: + readline.parse_and_bind(r'bind ^B ed-prev-char') + readline.parse_and_bind(r'bind "\t" rl_complete') + readline.parse_and_bind('bind -s ^A "|t\xEB[after]"') +else: + readline.parse_and_bind(r'Control-b: backward-char') + readline.parse_and_bind(r'"\t": complete') + readline.parse_and_bind(r'set disable-completion off') + readline.parse_and_bind(r'set show-all-if-ambiguous off') + readline.parse_and_bind(r'set show-all-if-unmodified off') + readline.parse_and_bind('Control-a: "|t\xEB[after]"') + +def pre_input_hook(): + readline.insert_text("[\xEFnserted]") + readline.redisplay() +readline.set_pre_input_hook(pre_input_hook) + +def completer(text, state): + if text == "t\xEB": + if state == 0: + print("text", ascii(text)) + print("line", ascii(readline.get_line_buffer())) + print("indexes", readline.get_begidx(), readline.get_endidx()) + return "t\xEBnt" + if state == 1: + return "t\xEBxt" + if text == "t\xEBx" and state == 0: + return "t\xEBxt" + return None +readline.set_completer(completer) + +def display(substitution, matches, longest_match_length): + print("substitution", ascii(substitution)) + print("matches", ascii(matches)) +readline.set_completion_display_matches_hook(display) + +print("result", ascii(input())) +print("history", ascii(readline.get_history_item(1))) +""" + + input = b"\x01" # Ctrl-A, expands to "|t\xEB[after]" + input += b"\x02" * len("[after]") # Move cursor back + input += b"\t\t" # Display possible completions + input += b"x\t" # Complete "t\xEBx" -> "t\xEBxt" + input += b"\r" + output = run_pty(script, input) + self.assertIn(b"text 't\\xeb'\r\n", output) + self.assertIn(b"line '[\\xefnserted]|t\\xeb[after]'\r\n", output) + self.assertIn(b"indexes 11 13\r\n", output) + self.assertIn(b"substitution 't\\xeb'\r\n", output) + self.assertIn(b"matches ['t\\xebnt', 't\\xebxt']\r\n", output) + expected = br"'[\xefnserted]|t\xebxt[after]'" + self.assertIn(b"result " + expected + b"\r\n", output) + self.assertIn(b"history " + expected + b"\r\n", output) + + +def run_pty(script, input=b"dummy input\r"): + pty = import_module('pty') + output = bytearray() + [master, slave] = pty.openpty() + args = (sys.executable, '-c', script) + proc = subprocess.Popen(args, stdin=slave, stdout=slave, stderr=slave) + os.close(slave) + with ExitStack() as cleanup: + cleanup.enter_context(proc) + def terminate(proc): + try: + proc.terminate() + except ProcessLookupError: + # Workaround for Open/Net BSD bug (Issue 16762) + pass + cleanup.callback(terminate, proc) + cleanup.callback(os.close, master) + # Avoid using DefaultSelector and PollSelector. Kqueue() does not + # work with pseudo-terminals on OS X < 10.9 (Issue 20365) and Open + # BSD (Issue 20667). Poll() does not work with OS X 10.6 or 10.4 + # either (Issue 20472). Hopefully the file descriptor is low enough + # to use with select(). + sel = cleanup.enter_context(selectors.SelectSelector()) + sel.register(master, selectors.EVENT_READ | selectors.EVENT_WRITE) + os.set_blocking(master, False) + while True: + for [_, events] in sel.select(): + if events & selectors.EVENT_READ: + try: + chunk = os.read(master, 0x10000) + except OSError as err: + # Linux raises EIO when slave is closed (Issue 5380) + if err.errno != EIO: + raise + chunk = b"" + if not chunk: + return output + output.extend(chunk) + if events & selectors.EVENT_WRITE: + try: + input = input[os.write(master, input):] + except OSError as err: + # Apparently EIO means the slave was closed + if err.errno != EIO: + raise + input = b"" # Stop writing + if not input: + sel.modify(master, selectors.EVENT_READ) + if __name__ == "__main__": unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,10 @@ Library ------- +- Issue #16182: Fix various functions in the "readline" module to use the + locale encoding, and fix get_begidx() and get_endidx() to return code point + indexes. + What's New in Python 3.5.2 final? ================================= diff --git a/Modules/readline.c b/Modules/readline.c --- a/Modules/readline.c +++ b/Modules/readline.c @@ -128,20 +128,40 @@ #define readlinestate_global ((readlinestate *)PyModule_GetState(PyState_FindModule(&readlinemodule))) +/* Convert to/from multibyte C strings */ + +static PyObject * +encode(PyObject *b) +{ + return PyUnicode_EncodeLocale(b, "surrogateescape"); +} + +static PyObject * +decode(const char *s) +{ + return PyUnicode_DecodeLocale(s, "surrogateescape"); +} + + /* Exported function to send one line to readline's init file parser */ static PyObject * -parse_and_bind(PyObject *self, PyObject *args) +parse_and_bind(PyObject *self, PyObject *string) { - char *s, *copy; - if (!PyArg_ParseTuple(args, "s:parse_and_bind", &s)) + char *copy; + PyObject *encoded = encode(string); + if (encoded == NULL) { return NULL; + } /* Make a copy -- rl_parse_and_bind() modifies its argument */ /* Bernard Herzog */ - copy = PyMem_Malloc(1 + strlen(s)); - if (copy == NULL) + copy = PyMem_Malloc(1 + PyBytes_GET_SIZE(encoded)); + if (copy == NULL) { + Py_DECREF(encoded); return PyErr_NoMemory(); - strcpy(copy, s); + } + strcpy(copy, PyBytes_AS_STRING(encoded)); + Py_DECREF(encoded); rl_parse_and_bind(copy); PyMem_Free(copy); /* Free the copy */ Py_RETURN_NONE; @@ -441,17 +461,18 @@ /* Set the tab-completion word-delimiters that readline uses */ static PyObject * -set_completer_delims(PyObject *self, PyObject *args) +set_completer_delims(PyObject *self, PyObject *string) { char *break_chars; - - if (!PyArg_ParseTuple(args, "s:set_completer_delims", &break_chars)) { + PyObject *encoded = encode(string); + if (encoded == NULL) { return NULL; } /* Keep a reference to the allocated memory in the module state in case some other module modifies rl_completer_word_break_characters (see issue #17289). */ - break_chars = strdup(break_chars); + break_chars = strdup(PyBytes_AS_STRING(encoded)); + Py_DECREF(encoded); if (break_chars) { free(completer_word_break_characters); completer_word_break_characters = break_chars; @@ -531,10 +552,11 @@ py_replace_history(PyObject *self, PyObject *args) { int entry_number; - char *line; + PyObject *line; + PyObject *encoded; HIST_ENTRY *old_entry; - if (!PyArg_ParseTuple(args, "is:replace_history_item", &entry_number, + if (!PyArg_ParseTuple(args, "iU:replace_history_item", &entry_number, &line)) { return NULL; } @@ -543,7 +565,12 @@ "History index cannot be negative"); return NULL; } - old_entry = replace_history_entry(entry_number, line, (void *)NULL); + encoded = encode(line); + if (encoded == NULL) { + return NULL; + } + old_entry = replace_history_entry(entry_number, PyBytes_AS_STRING(encoded), (void *)NULL); + Py_DECREF(encoded); if (!old_entry) { PyErr_Format(PyExc_ValueError, "No history item at position %d", @@ -562,14 +589,14 @@ /* Add a line to the history buffer */ static PyObject * -py_add_history(PyObject *self, PyObject *args) +py_add_history(PyObject *self, PyObject *string) { - char *line; - - if(!PyArg_ParseTuple(args, "s:add_history", &line)) { + PyObject *encoded = encode(string); + if (encoded == NULL) { return NULL; } - add_history(line); + add_history(PyBytes_AS_STRING(encoded)); + Py_DECREF(encoded); Py_RETURN_NONE; } @@ -583,7 +610,7 @@ static PyObject * get_completer_delims(PyObject *self, PyObject *noarg) { - return PyUnicode_FromString(rl_completer_word_break_characters); + return decode(rl_completer_word_break_characters); } PyDoc_STRVAR(doc_get_completer_delims, @@ -673,7 +700,7 @@ } #endif /* __APPLE__ */ if ((hist_ent = history_get(idx))) - return PyUnicode_FromString(hist_ent->line); + return decode(hist_ent->line); else { Py_RETURN_NONE; } @@ -702,7 +729,7 @@ static PyObject * get_line_buffer(PyObject *self, PyObject *noarg) { - return PyUnicode_FromString(rl_line_buffer); + return decode(rl_line_buffer); } PyDoc_STRVAR(doc_get_line_buffer, @@ -730,12 +757,14 @@ /* Exported function to insert text into the line buffer */ static PyObject * -insert_text(PyObject *self, PyObject *args) +insert_text(PyObject *self, PyObject *string) { - char *s; - if (!PyArg_ParseTuple(args, "s:insert_text", &s)) + PyObject *encoded = encode(string); + if (encoded == NULL) { return NULL; - rl_insert_text(s); + } + rl_insert_text(PyBytes_AS_STRING(encoded)); + Py_DECREF(encoded); Py_RETURN_NONE; } @@ -763,9 +792,9 @@ static struct PyMethodDef readline_methods[] = { - {"parse_and_bind", parse_and_bind, METH_VARARGS, doc_parse_and_bind}, + {"parse_and_bind", parse_and_bind, METH_O, doc_parse_and_bind}, {"get_line_buffer", get_line_buffer, METH_NOARGS, doc_get_line_buffer}, - {"insert_text", insert_text, METH_VARARGS, doc_insert_text}, + {"insert_text", insert_text, METH_O, doc_insert_text}, {"redisplay", redisplay, METH_NOARGS, doc_redisplay}, {"read_init_file", read_init_file, METH_VARARGS, doc_read_init_file}, {"read_history_file", read_history_file, @@ -792,8 +821,8 @@ {"get_endidx", get_endidx, METH_NOARGS, doc_get_endidx}, {"set_completer_delims", set_completer_delims, - METH_VARARGS, doc_set_completer_delims}, - {"add_history", py_add_history, METH_VARARGS, doc_add_history}, + METH_O, doc_set_completer_delims}, + {"add_history", py_add_history, METH_O, doc_add_history}, {"remove_history_item", py_remove_history, METH_VARARGS, doc_remove_history}, {"replace_history_item", py_replace_history, METH_VARARGS, doc_replace_history}, {"get_completer_delims", get_completer_delims, @@ -890,7 +919,7 @@ int num_matches, int max_length) { int i; - PyObject *m=NULL, *s=NULL, *r=NULL; + PyObject *sub, *m=NULL, *s=NULL, *r=NULL; #ifdef WITH_THREAD PyGILState_STATE gilstate = PyGILState_Ensure(); #endif @@ -898,16 +927,17 @@ if (m == NULL) goto error; for (i = 0; i < num_matches; i++) { - s = PyUnicode_FromString(matches[i+1]); + s = decode(matches[i+1]); if (s == NULL) goto error; if (PyList_SetItem(m, i, s) == -1) goto error; } + sub = decode(matches[0]); r = PyObject_CallFunction(readlinestate_global->completion_display_matches_hook, - "sOi", matches[0], m, max_length); + "NNi", sub, m, max_length); - Py_DECREF(m); m=NULL; + m=NULL; if (r == NULL || (r != Py_None && PyLong_AsLong(r) == -1 && PyErr_Occurred())) { @@ -955,22 +985,24 @@ { char *result = NULL; if (readlinestate_global->completer != NULL) { - PyObject *r; + PyObject *r = NULL, *t; #ifdef WITH_THREAD PyGILState_STATE gilstate = PyGILState_Ensure(); #endif rl_attempted_completion_over = 1; - r = PyObject_CallFunction(readlinestate_global->completer, "si", text, state); + t = decode(text); + r = PyObject_CallFunction(readlinestate_global->completer, "Ni", t, state); if (r == NULL) goto error; if (r == Py_None) { result = NULL; } else { - char *s = _PyUnicode_AsString(r); - if (s == NULL) + PyObject *encoded = encode(r); + if (encoded == NULL) goto error; - result = strdup(s); + result = strdup(PyBytes_AS_STRING(encoded)); + Py_DECREF(encoded); } Py_DECREF(r); goto done; @@ -994,6 +1026,9 @@ flex_complete(const char *text, int start, int end) { char **result; + char saved; + size_t start_size, end_size; + wchar_t *s; #ifdef WITH_THREAD PyGILState_STATE gilstate = PyGILState_Ensure(); #endif @@ -1003,6 +1038,27 @@ #ifdef HAVE_RL_COMPLETION_SUPPRESS_APPEND rl_completion_suppress_append = 0; #endif + + saved = rl_line_buffer[start]; + rl_line_buffer[start] = 0; + s = Py_DecodeLocale(rl_line_buffer, &start_size); + rl_line_buffer[start] = saved; + if (s == NULL) { + goto done; + } + PyMem_RawFree(s); + saved = rl_line_buffer[end]; + rl_line_buffer[end] = 0; + s = Py_DecodeLocale(rl_line_buffer + start, &end_size); + rl_line_buffer[end] = saved; + if (s == NULL) { + goto done; + } + PyMem_RawFree(s); + start = (int)start_size; + end = start + (int)end_size; + +done: Py_XDECREF(readlinestate_global->begidx); Py_XDECREF(readlinestate_global->endidx); readlinestate_global->begidx = PyLong_FromLong((long) start); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 23:03:41 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 14 Jun 2016 03:03:41 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2316182=3A_Merge_readline_locale_fix_from_3=2E5?= Message-ID: <20160614030340.9952.55990.FFFA36A3@psf.io> https://hg.python.org/cpython/rev/2ae2657d87a6 changeset: 101991:2ae2657d87a6 parent: 101990:d9090aa75607 parent: 101988:5122b3465a38 user: Martin Panter date: Tue Jun 14 02:47:56 2016 +0000 summary: Issue #16182: Merge readline locale fix from 3.5 files: Lib/test/test_readline.py | 96 +++++++++++++++++- Misc/NEWS | 7 + Modules/readline.c | 132 ++++++++++++++++++------- 3 files changed, 191 insertions(+), 44 deletions(-) diff --git a/Lib/test/test_readline.py b/Lib/test/test_readline.py --- a/Lib/test/test_readline.py +++ b/Lib/test/test_readline.py @@ -9,12 +9,15 @@ import sys import tempfile import unittest -from test.support import import_module, unlink +from test.support import import_module, unlink, TESTFN from test.support.script_helper import assert_python_ok # Skip tests if there is no readline module readline = import_module('readline') + at unittest.skipUnless(hasattr(readline, "clear_history"), + "The history update test cannot be run because the " + "clear_history method is not available.") class TestHistoryManipulation (unittest.TestCase): """ These tests were added to check that the libedit emulation on OSX and the @@ -22,9 +25,6 @@ why the tests cover only a small subset of the interface. """ - @unittest.skipUnless(hasattr(readline, "clear_history"), - "The history update test cannot be run because the " - "clear_history method is not available.") def testHistoryUpdates(self): readline.clear_history() @@ -87,6 +87,21 @@ # write_history_file can create the target readline.write_history_file(hfilename) + def test_nonascii_history(self): + readline.clear_history() + try: + readline.add_history("entr?e 1") + except UnicodeEncodeError as err: + self.skipTest("Locale cannot encode test data: " + format(err)) + readline.add_history("entr?e 2") + readline.replace_history_item(1, "entr?e 22") + readline.write_history_file(TESTFN) + self.addCleanup(os.remove, TESTFN) + readline.clear_history() + readline.read_history_file(TESTFN) + self.assertEqual(readline.get_history_item(1), "entr?e 1") + self.assertEqual(readline.get_history_item(2), "entr?e 22") + class TestReadline(unittest.TestCase): @@ -116,6 +131,69 @@ output = run_pty(self.auto_history_script.format(False)) self.assertIn(b"History length: 0\r\n", output) + def test_nonascii(self): + try: + readline.add_history("\xEB\xEF") + except UnicodeEncodeError as err: + self.skipTest("Locale cannot encode test data: " + format(err)) + + script = r"""import readline + +if readline.__doc__ and "libedit" in readline.__doc__: + readline.parse_and_bind(r'bind ^B ed-prev-char') + readline.parse_and_bind(r'bind "\t" rl_complete') + readline.parse_and_bind('bind -s ^A "|t\xEB[after]"') +else: + readline.parse_and_bind(r'Control-b: backward-char') + readline.parse_and_bind(r'"\t": complete') + readline.parse_and_bind(r'set disable-completion off') + readline.parse_and_bind(r'set show-all-if-ambiguous off') + readline.parse_and_bind(r'set show-all-if-unmodified off') + readline.parse_and_bind('Control-a: "|t\xEB[after]"') + +def pre_input_hook(): + readline.insert_text("[\xEFnserted]") + readline.redisplay() +readline.set_pre_input_hook(pre_input_hook) + +def completer(text, state): + if text == "t\xEB": + if state == 0: + print("text", ascii(text)) + print("line", ascii(readline.get_line_buffer())) + print("indexes", readline.get_begidx(), readline.get_endidx()) + return "t\xEBnt" + if state == 1: + return "t\xEBxt" + if text == "t\xEBx" and state == 0: + return "t\xEBxt" + return None +readline.set_completer(completer) + +def display(substitution, matches, longest_match_length): + print("substitution", ascii(substitution)) + print("matches", ascii(matches)) +readline.set_completion_display_matches_hook(display) + +print("result", ascii(input())) +print("history", ascii(readline.get_history_item(1))) +""" + + input = b"\x01" # Ctrl-A, expands to "|t\xEB[after]" + input += b"\x02" * len("[after]") # Move cursor back + input += b"\t\t" # Display possible completions + input += b"x\t" # Complete "t\xEBx" -> "t\xEBxt" + input += b"\r" + output = run_pty(script, input) + self.assertIn(b"text 't\\xeb'\r\n", output) + self.assertIn(b"line '[\\xefnserted]|t\\xeb[after]'\r\n", output) + self.assertIn(b"indexes 11 13\r\n", output) + self.assertIn(b"substitution 't\\xeb'\r\n", output) + self.assertIn(b"matches ['t\\xebnt', 't\\xebxt']\r\n", output) + expected = br"'[\xefnserted]|t\xebxt[after]'" + self.assertIn(b"result " + expected + b"\r\n", output) + self.assertIn(b"history " + expected + b"\r\n", output) + def run_pty(script, input=b"dummy input\r"): pty = import_module('pty') @@ -148,7 +226,7 @@ try: chunk = os.read(master, 0x10000) except OSError as err: - # Linux raises EIO when the slave is closed + # Linux raises EIO when slave is closed (Issue 5380) if err.errno != EIO: raise chunk = b"" @@ -156,7 +234,13 @@ return output output.extend(chunk) if events & selectors.EVENT_WRITE: - input = input[os.write(master, input):] + try: + input = input[os.write(master, input):] + except OSError as err: + # Apparently EIO means the slave was closed + if err.errno != EIO: + raise + input = b"" # Stop writing if not input: sel.modify(master, selectors.EVENT_READ) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -7,6 +7,13 @@ *Release date: XXXX-XX-XX* +Library ++++++++ + +- Issue #16182: Fix various functions in the "readline" module to use the + locale encoding, and fix get_begidx() and get_endidx() to return code point + indexes. + IDLE ++++ diff --git a/Modules/readline.c b/Modules/readline.c --- a/Modules/readline.c +++ b/Modules/readline.c @@ -128,20 +128,40 @@ #define readlinestate_global ((readlinestate *)PyModule_GetState(PyState_FindModule(&readlinemodule))) +/* Convert to/from multibyte C strings */ + +static PyObject * +encode(PyObject *b) +{ + return PyUnicode_EncodeLocale(b, "surrogateescape"); +} + +static PyObject * +decode(const char *s) +{ + return PyUnicode_DecodeLocale(s, "surrogateescape"); +} + + /* Exported function to send one line to readline's init file parser */ static PyObject * -parse_and_bind(PyObject *self, PyObject *args) +parse_and_bind(PyObject *self, PyObject *string) { - char *s, *copy; - if (!PyArg_ParseTuple(args, "s:parse_and_bind", &s)) + char *copy; + PyObject *encoded = encode(string); + if (encoded == NULL) { return NULL; + } /* Make a copy -- rl_parse_and_bind() modifies its argument */ /* Bernard Herzog */ - copy = PyMem_Malloc(1 + strlen(s)); - if (copy == NULL) + copy = PyMem_Malloc(1 + PyBytes_GET_SIZE(encoded)); + if (copy == NULL) { + Py_DECREF(encoded); return PyErr_NoMemory(); - strcpy(copy, s); + } + strcpy(copy, PyBytes_AS_STRING(encoded)); + Py_DECREF(encoded); rl_parse_and_bind(copy); PyMem_Free(copy); /* Free the copy */ Py_RETURN_NONE; @@ -439,17 +459,18 @@ /* Set the tab-completion word-delimiters that readline uses */ static PyObject * -set_completer_delims(PyObject *self, PyObject *args) +set_completer_delims(PyObject *self, PyObject *string) { char *break_chars; - - if (!PyArg_ParseTuple(args, "s:set_completer_delims", &break_chars)) { + PyObject *encoded = encode(string); + if (encoded == NULL) { return NULL; } /* Keep a reference to the allocated memory in the module state in case some other module modifies rl_completer_word_break_characters (see issue #17289). */ - break_chars = strdup(break_chars); + break_chars = strdup(PyBytes_AS_STRING(encoded)); + Py_DECREF(encoded); if (break_chars) { free(completer_word_break_characters); completer_word_break_characters = break_chars; @@ -529,10 +550,11 @@ py_replace_history(PyObject *self, PyObject *args) { int entry_number; - char *line; + PyObject *line; + PyObject *encoded; HIST_ENTRY *old_entry; - if (!PyArg_ParseTuple(args, "is:replace_history_item", &entry_number, + if (!PyArg_ParseTuple(args, "iU:replace_history_item", &entry_number, &line)) { return NULL; } @@ -541,7 +563,12 @@ "History index cannot be negative"); return NULL; } - old_entry = replace_history_entry(entry_number, line, (void *)NULL); + encoded = encode(line); + if (encoded == NULL) { + return NULL; + } + old_entry = replace_history_entry(entry_number, PyBytes_AS_STRING(encoded), (void *)NULL); + Py_DECREF(encoded); if (!old_entry) { PyErr_Format(PyExc_ValueError, "No history item at position %d", @@ -560,14 +587,14 @@ /* Add a line to the history buffer */ static PyObject * -py_add_history(PyObject *self, PyObject *args) +py_add_history(PyObject *self, PyObject *string) { - char *line; - - if(!PyArg_ParseTuple(args, "s:add_history", &line)) { + PyObject *encoded = encode(string); + if (encoded == NULL) { return NULL; } - add_history(line); + add_history(PyBytes_AS_STRING(encoded)); + Py_DECREF(encoded); Py_RETURN_NONE; } @@ -599,7 +626,7 @@ static PyObject * get_completer_delims(PyObject *self, PyObject *noarg) { - return PyUnicode_FromString(rl_completer_word_break_characters); + return decode(rl_completer_word_break_characters); } PyDoc_STRVAR(doc_get_completer_delims, @@ -689,7 +716,7 @@ } #endif /* __APPLE__ */ if ((hist_ent = history_get(idx))) - return PyUnicode_FromString(hist_ent->line); + return decode(hist_ent->line); else { Py_RETURN_NONE; } @@ -718,7 +745,7 @@ static PyObject * get_line_buffer(PyObject *self, PyObject *noarg) { - return PyUnicode_FromString(rl_line_buffer); + return decode(rl_line_buffer); } PyDoc_STRVAR(doc_get_line_buffer, @@ -746,12 +773,14 @@ /* Exported function to insert text into the line buffer */ static PyObject * -insert_text(PyObject *self, PyObject *args) +insert_text(PyObject *self, PyObject *string) { - char *s; - if (!PyArg_ParseTuple(args, "s:insert_text", &s)) + PyObject *encoded = encode(string); + if (encoded == NULL) { return NULL; - rl_insert_text(s); + } + rl_insert_text(PyBytes_AS_STRING(encoded)); + Py_DECREF(encoded); Py_RETURN_NONE; } @@ -779,9 +808,9 @@ static struct PyMethodDef readline_methods[] = { - {"parse_and_bind", parse_and_bind, METH_VARARGS, doc_parse_and_bind}, + {"parse_and_bind", parse_and_bind, METH_O, doc_parse_and_bind}, {"get_line_buffer", get_line_buffer, METH_NOARGS, doc_get_line_buffer}, - {"insert_text", insert_text, METH_VARARGS, doc_insert_text}, + {"insert_text", insert_text, METH_O, doc_insert_text}, {"redisplay", redisplay, METH_NOARGS, doc_redisplay}, {"read_init_file", read_init_file, METH_VARARGS, doc_read_init_file}, {"read_history_file", read_history_file, @@ -808,9 +837,9 @@ {"get_endidx", get_endidx, METH_NOARGS, doc_get_endidx}, {"set_completer_delims", set_completer_delims, - METH_VARARGS, doc_set_completer_delims}, + METH_O, doc_set_completer_delims}, {"set_auto_history", py_set_auto_history, METH_VARARGS, doc_set_auto_history}, - {"add_history", py_add_history, METH_VARARGS, doc_add_history}, + {"add_history", py_add_history, METH_O, doc_add_history}, {"remove_history_item", py_remove_history, METH_VARARGS, doc_remove_history}, {"replace_history_item", py_replace_history, METH_VARARGS, doc_replace_history}, {"get_completer_delims", get_completer_delims, @@ -907,7 +936,7 @@ int num_matches, int max_length) { int i; - PyObject *m=NULL, *s=NULL, *r=NULL; + PyObject *sub, *m=NULL, *s=NULL, *r=NULL; #ifdef WITH_THREAD PyGILState_STATE gilstate = PyGILState_Ensure(); #endif @@ -915,16 +944,17 @@ if (m == NULL) goto error; for (i = 0; i < num_matches; i++) { - s = PyUnicode_FromString(matches[i+1]); + s = decode(matches[i+1]); if (s == NULL) goto error; if (PyList_SetItem(m, i, s) == -1) goto error; } + sub = decode(matches[0]); r = PyObject_CallFunction(readlinestate_global->completion_display_matches_hook, - "sOi", matches[0], m, max_length); + "NNi", sub, m, max_length); - Py_DECREF(m); m=NULL; + m=NULL; if (r == NULL || (r != Py_None && PyLong_AsLong(r) == -1 && PyErr_Occurred())) { @@ -972,22 +1002,24 @@ { char *result = NULL; if (readlinestate_global->completer != NULL) { - PyObject *r; + PyObject *r = NULL, *t; #ifdef WITH_THREAD PyGILState_STATE gilstate = PyGILState_Ensure(); #endif rl_attempted_completion_over = 1; - r = PyObject_CallFunction(readlinestate_global->completer, "si", text, state); + t = decode(text); + r = PyObject_CallFunction(readlinestate_global->completer, "Ni", t, state); if (r == NULL) goto error; if (r == Py_None) { result = NULL; } else { - char *s = _PyUnicode_AsString(r); - if (s == NULL) + PyObject *encoded = encode(r); + if (encoded == NULL) goto error; - result = strdup(s); + result = strdup(PyBytes_AS_STRING(encoded)); + Py_DECREF(encoded); } Py_DECREF(r); goto done; @@ -1011,6 +1043,9 @@ flex_complete(const char *text, int start, int end) { char **result; + char saved; + size_t start_size, end_size; + wchar_t *s; #ifdef WITH_THREAD PyGILState_STATE gilstate = PyGILState_Ensure(); #endif @@ -1020,6 +1055,27 @@ #ifdef HAVE_RL_COMPLETION_SUPPRESS_APPEND rl_completion_suppress_append = 0; #endif + + saved = rl_line_buffer[start]; + rl_line_buffer[start] = 0; + s = Py_DecodeLocale(rl_line_buffer, &start_size); + rl_line_buffer[start] = saved; + if (s == NULL) { + goto done; + } + PyMem_RawFree(s); + saved = rl_line_buffer[end]; + rl_line_buffer[end] = 0; + s = Py_DecodeLocale(rl_line_buffer + start, &end_size); + rl_line_buffer[end] = saved; + if (s == NULL) { + goto done; + } + PyMem_RawFree(s); + start = (int)start_size; + end = start + (int)end_size; + +done: Py_XDECREF(readlinestate_global->begidx); Py_XDECREF(readlinestate_global->endidx); readlinestate_global->begidx = PyLong_FromLong((long) start); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 23:03:41 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 14 Jun 2016 03:03:41 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2322636=3A_Merge_ctypes=2Eutil_shell_injection_fi?= =?utf-8?q?xes_from_3=2E5?= Message-ID: <20160614030341.28193.47449.C4C104DC@psf.io> https://hg.python.org/cpython/rev/60613ecad578 changeset: 101992:60613ecad578 parent: 101991:2ae2657d87a6 parent: 101989:0715d403cae2 user: Martin Panter date: Tue Jun 14 02:59:21 2016 +0000 summary: Issue #22636: Merge ctypes.util shell injection fixes from 3.5 files: Lib/ctypes/test/test_find.py | 7 +- Lib/ctypes/util.py | 119 ++++++++++++++-------- Misc/NEWS | 3 + 3 files changed, 85 insertions(+), 44 deletions(-) diff --git a/Lib/ctypes/test/test_find.py b/Lib/ctypes/test/test_find.py --- a/Lib/ctypes/test/test_find.py +++ b/Lib/ctypes/test/test_find.py @@ -1,5 +1,5 @@ import unittest -import os +import os, os.path import sys import test.support from ctypes import * @@ -64,6 +64,11 @@ self.skipTest('lib_gle not available') self.gle.gleGetJoinStyle + def test_shell_injection(self): + result = find_library('; echo Hello shell > ' + test.support.TESTFN) + self.assertFalse(os.path.lexists(test.support.TESTFN)) + self.assertIsNone(result) + # On platforms where the default shared library suffix is '.so', # at least some libraries can be loaded as attributes of the cdll # object, since ctypes now tries loading the lib again diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py --- a/Lib/ctypes/util.py +++ b/Lib/ctypes/util.py @@ -1,6 +1,7 @@ -import sys, os -import contextlib +import os +import shutil import subprocess +import sys # find_library(name) returns the pathname of a library, or None. if os.name == "nt": @@ -94,28 +95,43 @@ import re, tempfile def _findLib_gcc(name): - expr = r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name) - fdout, ccout = tempfile.mkstemp() - os.close(fdout) - cmd = 'if type gcc >/dev/null 2>&1; then CC=gcc; elif type cc >/dev/null 2>&1; then CC=cc;else exit 10; fi;' \ - 'LANG=C LC_ALL=C $CC -Wl,-t -o ' + ccout + ' 2>&1 -l' + name + # Run GCC's linker with the -t (aka --trace) option and examine the + # library name it prints out. The GCC command will fail because we + # haven't supplied a proper program with main(), but that does not + # matter. + expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)) + + c_compiler = shutil.which('gcc') + if not c_compiler: + c_compiler = shutil.which('cc') + if not c_compiler: + # No C compiler available, give up + return None + + temp = tempfile.NamedTemporaryFile() try: - f = os.popen(cmd) - try: - trace = f.read() - finally: - rv = f.close() + args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name] + + env = dict(os.environ) + env['LC_ALL'] = 'C' + env['LANG'] = 'C' + proc = subprocess.Popen(args, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + env=env) + with proc: + trace = proc.stdout.read() finally: try: - os.unlink(ccout) + temp.close() except FileNotFoundError: + # Raised if the file was already removed, which is the normal + # behaviour of GCC if linking fails pass - if rv == 10: - raise OSError('gcc or cc command not found') res = re.search(expr, trace) if not res: return None - return res.group(0) + return os.fsdecode(res.group(0)) if sys.platform == "sunos5": @@ -123,55 +139,65 @@ def _get_soname(f): if not f: return None - cmd = "/usr/ccs/bin/dump -Lpv 2>/dev/null " + f - with contextlib.closing(os.popen(cmd)) as f: - data = f.read() - res = re.search(r'\[.*\]\sSONAME\s+([^\s]+)', data) + + proc = subprocess.Popen(("/usr/ccs/bin/dump", "-Lpv", f), + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL) + with proc: + data = proc.stdout.read() + res = re.search(br'\[.*\]\sSONAME\s+([^\s]+)', data) if not res: return None - return res.group(1) + return os.fsdecode(res.group(1)) else: def _get_soname(f): # assuming GNU binutils / ELF if not f: return None - cmd = 'if ! type objdump >/dev/null 2>&1; then exit 10; fi;' \ - "objdump -p -j .dynamic 2>/dev/null " + f - f = os.popen(cmd) - try: - dump = f.read() - finally: - rv = f.close() - if rv == 10: - raise OSError('objdump command not found') - res = re.search(r'\sSONAME\s+([^\s]+)', dump) + objdump = shutil.which('objdump') + if not objdump: + # objdump is not available, give up + return None + + proc = subprocess.Popen((objdump, '-p', '-j', '.dynamic', f), + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL) + with proc: + dump = proc.stdout.read() + res = re.search(br'\sSONAME\s+([^\s]+)', dump) if not res: return None - return res.group(1) + return os.fsdecode(res.group(1)) if sys.platform.startswith(("freebsd", "openbsd", "dragonfly")): def _num_version(libname): # "libxyz.so.MAJOR.MINOR" => [ MAJOR, MINOR ] - parts = libname.split(".") + parts = libname.split(b".") nums = [] try: while parts: nums.insert(0, int(parts.pop())) except ValueError: pass - return nums or [ sys.maxsize ] + return nums or [sys.maxsize] def find_library(name): ename = re.escape(name) expr = r':-l%s\.\S+ => \S*/(lib%s\.\S+)' % (ename, ename) - with contextlib.closing(os.popen('/sbin/ldconfig -r 2>/dev/null')) as f: - data = f.read() + expr = os.fsencode(expr) + + proc = subprocess.Popen(('/sbin/ldconfig', '-r'), + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL) + with proc: + data = proc.stdout.read() + res = re.findall(expr, data) if not res: return _get_soname(_findLib_gcc(name)) res.sort(key=_num_version) - return res[-1] + return os.fsdecode(res[-1]) elif sys.platform == "sunos5": @@ -179,17 +205,24 @@ if not os.path.exists('/usr/bin/crle'): return None + env = dict(os.environ) + env['LC_ALL'] = 'C' + if is64: - cmd = 'env LC_ALL=C /usr/bin/crle -64 2>/dev/null' + args = ('/usr/bin/crle', '-64') else: - cmd = 'env LC_ALL=C /usr/bin/crle 2>/dev/null' + args = ('/usr/bin/crle',) paths = None - with contextlib.closing(os.popen(cmd)) as f: - for line in f.readlines(): + proc = subprocess.Popen(args, + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL, + env=env) + with proc: + for line in proc.stdout: line = line.strip() - if line.startswith('Default Library Path (ELF):'): - paths = line.split()[4] + if line.startswith(b'Default Library Path (ELF):'): + paths = os.fsdecode(line).split()[4] if not paths: return None diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Library +++++++ +- Issue #22636: Avoid shell injection problems with + ctypes.util.find_library(). + - Issue #16182: Fix various functions in the "readline" module to use the locale encoding, and fix get_begidx() and get_endidx() to return code point indexes. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 23:56:24 2016 From: python-checkins at python.org (ned.deily) Date: Tue, 14 Jun 2016 03:56:24 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Added_tag_v3=2E6=2E0a2_for?= =?utf-8?q?_changeset_378893423552?= Message-ID: <20160614035624.101587.69095.D15FFBC2@psf.io> https://hg.python.org/cpython/rev/9374ec32e450 changeset: 101995:9374ec32e450 user: Ned Deily date: Mon Jun 13 16:55:39 2016 -0400 summary: Added tag v3.6.0a2 for changeset 378893423552 files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -164,3 +164,4 @@ 37a07cee5969e6d3672583187a73cf636ff28e1b v3.5.1 68feec6488b26327a85a634605dd28eca4daa5f1 v3.5.2rc1 5896da372fb044e38595fb74495de1e1e7c8fb3c v3.6.0a1 +37889342355223e2fc1438de3dc7ffcd625c60f7 v3.6.0a2 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 23:56:24 2016 From: python-checkins at python.org (ned.deily) Date: Tue, 14 Jun 2016 03:56:24 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Version_bump_for_3=2E6=2E0?= =?utf-8?q?a2?= Message-ID: <20160614035624.26129.41205.1AF01C82@psf.io> https://hg.python.org/cpython/rev/378893423552 changeset: 101994:378893423552 tag: v3.6.0a2 user: Ned Deily date: Mon Jun 13 16:54:49 2016 -0400 summary: Version bump for 3.6.0a2 files: Include/patchlevel.h | 4 ++-- Misc/NEWS | 2 +- README | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -20,10 +20,10 @@ #define PY_MINOR_VERSION 6 #define PY_MICRO_VERSION 0 #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA -#define PY_RELEASE_SERIAL 1 +#define PY_RELEASE_SERIAL 2 /* Version as a string */ -#define PY_VERSION "3.6.0a1+" +#define PY_VERSION "3.6.0a2" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -5,7 +5,7 @@ What's New in Python 3.6.0 alpha 2 ================================== -*Release date: XXXX-XX-XX* +*Release date: 2016-06-13* Core and Builtins ----------------- diff --git a/README b/README --- a/README +++ b/README @@ -1,4 +1,4 @@ -This is Python version 3.6.0 alpha 1 +This is Python version 3.6.0 alpha 2 ==================================== Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 23:56:24 2016 From: python-checkins at python.org (ned.deily) Date: Tue, 14 Jun 2016 03:56:24 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Update_pydoc_topics_for_3?= =?utf-8?b?LjYuMGEy?= Message-ID: <20160614035624.120727.25404.8FDF9C97@psf.io> https://hg.python.org/cpython/rev/58c90eacf9e7 changeset: 101993:58c90eacf9e7 parent: 101978:bb67de625cb2 user: Ned Deily date: Mon Jun 13 16:51:55 2016 -0400 summary: Update pydoc topics for 3.6.0a2 files: Lib/pydoc_data/topics.py | 202 ++++++++++++++++---------- 1 files changed, 122 insertions(+), 80 deletions(-) diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Mon May 16 13:41:38 2016 +# Autogenerated by Sphinx on Mon Jun 13 16:49:58 2016 topics = {'assert': '\n' 'The "assert" statement\n' '**********************\n' @@ -47,12 +47,12 @@ 'to\n' 'modify attributes or items of mutable objects:\n' '\n' - ' assignment_stmt ::= (target_list "=")+ (expression_list | ' - 'yield_expression)\n' + ' assignment_stmt ::= (target_list "=")+ (starred_expression ' + '| yield_expression)\n' ' target_list ::= target ("," target)* [","]\n' ' target ::= identifier\n' - ' | "(" target_list ")"\n' - ' | "[" target_list "]"\n' + ' | "(" [target_list] ")"\n' + ' | "[" [target_list] "]"\n' ' | attributeref\n' ' | subscription\n' ' | slicing\n' @@ -89,35 +89,42 @@ 'parentheses or square brackets, is recursively defined as ' 'follows.\n' '\n' - '* If the target list is a single target: The object is ' - 'assigned to\n' - ' that target.\n' + '* If the target list is empty: The object must also be an ' + 'empty\n' + ' iterable.\n' '\n' - '* If the target list is a comma-separated list of targets: ' - 'The\n' - ' object must be an iterable with the same number of items as ' - 'there\n' - ' are targets in the target list, and the items are assigned, ' - 'from\n' - ' left to right, to the corresponding targets.\n' + '* If the target list is a single target in parentheses: The ' + 'object\n' + ' is assigned to that target.\n' + '\n' + '* If the target list is a comma-separated list of targets, or ' + 'a\n' + ' single target in square brackets: The object must be an ' + 'iterable\n' + ' with the same number of items as there are targets in the ' + 'target\n' + ' list, and the items are assigned, from left to right, to ' + 'the\n' + ' corresponding targets.\n' '\n' ' * If the target list contains one target prefixed with an\n' - ' asterisk, called a "starred" target: The object must be a ' - 'sequence\n' - ' with at least as many items as there are targets in the ' - 'target\n' - ' list, minus one. The first items of the sequence are ' - 'assigned,\n' - ' from left to right, to the targets before the starred ' - 'target. The\n' - ' final items of the sequence are assigned to the targets ' - 'after the\n' - ' starred target. A list of the remaining items in the ' - 'sequence is\n' - ' then assigned to the starred target (the list can be ' - 'empty).\n' + ' asterisk, called a "starred" target: The object must be ' + 'an\n' + ' iterable with at least as many items as there are targets ' + 'in the\n' + ' target list, minus one. The first items of the iterable ' + 'are\n' + ' assigned, from left to right, to the targets before the ' + 'starred\n' + ' target. The final items of the iterable are assigned to ' + 'the\n' + ' targets after the starred target. A list of the remaining ' + 'items\n' + ' in the iterable is then assigned to the starred target ' + '(the list\n' + ' can be empty).\n' '\n' - ' * Else: The object must be a sequence with the same number ' + ' * Else: The object must be an iterable with the same number ' 'of\n' ' items as there are targets in the target list, and the ' 'items are\n' @@ -149,14 +156,6 @@ 'destructor (if it\n' ' has one) to be called.\n' '\n' - '* If the target is a target list enclosed in parentheses or ' - 'in\n' - ' square brackets: The object must be an iterable with the ' - 'same number\n' - ' of items as there are targets in the target list, and its ' - 'items are\n' - ' assigned, from left to right, to the corresponding targets.\n' - '\n' '* If the target is an attribute reference: The primary ' 'expression in\n' ' the reference is evaluated. It should yield an object with\n' @@ -1148,18 +1147,18 @@ ' call ::= primary "(" [argument_list [","] | ' 'comprehension] ")"\n' ' argument_list ::= positional_arguments ["," ' - 'keyword_arguments]\n' - ' ["," "*" expression] ["," ' - 'keyword_arguments]\n' - ' ["," "**" expression]\n' - ' | keyword_arguments ["," "*" expression]\n' - ' ["," keyword_arguments] ["," "**" ' - 'expression]\n' - ' | "*" expression ["," keyword_arguments] ["," ' - '"**" expression]\n' - ' | "**" expression\n' - ' positional_arguments ::= expression ("," expression)*\n' - ' keyword_arguments ::= keyword_item ("," keyword_item)*\n' + 'starred_and_keywords]\n' + ' ["," keywords_arguments]\n' + ' | starred_and_keywords ["," ' + 'keywords_arguments]\n' + ' | keywords_arguments\n' + ' positional_arguments ::= ["*"] expression ("," ["*"] ' + 'expression)*\n' + ' starred_and_keywords ::= ("*" expression | keyword_item)\n' + ' ("," "*" expression | "," ' + 'keyword_item)*\n' + ' keywords_arguments ::= (keyword_item | "**" expression)\n' + ' ("," keyword_item | "**" expression)*\n' ' keyword_item ::= identifier "=" expression\n' '\n' 'An optional trailing comma may be present after the positional and\n' @@ -1235,20 +1234,21 @@ '\n' 'If the syntax "*expression" appears in the function call, ' '"expression"\n' - 'must evaluate to an iterable. Elements from this iterable are ' - 'treated\n' - 'as if they were additional positional arguments; if there are\n' - 'positional arguments *x1*, ..., *xN*, and "expression" evaluates to ' - 'a\n' - 'sequence *y1*, ..., *yM*, this is equivalent to a call with M+N\n' - 'positional arguments *x1*, ..., *xN*, *y1*, ..., *yM*.\n' + 'must evaluate to an *iterable*. Elements from these iterables are\n' + 'treated as if they were additional positional arguments. For the ' + 'call\n' + '"f(x1, x2, *y, x3, x4)", if *y* evaluates to a sequence *y1*, ...,\n' + '*yM*, this is equivalent to a call with M+4 positional arguments ' + '*x1*,\n' + '*x2*, *y1*, ..., *yM*, *x3*, *x4*.\n' '\n' 'A consequence of this is that although the "*expression" syntax ' 'may\n' - 'appear *after* some keyword arguments, it is processed *before* ' - 'the\n' - 'keyword arguments (and the "**expression" argument, if any -- see\n' - 'below). So:\n' + 'appear *after* explicit keyword arguments, it is processed ' + '*before*\n' + 'the keyword arguments (and any "**expression" arguments -- see ' + 'below).\n' + 'So:\n' '\n' ' >>> def f(a, b):\n' ' ... print(a, b)\n' @@ -1269,16 +1269,25 @@ 'arise.\n' '\n' 'If the syntax "**expression" appears in the function call,\n' - '"expression" must evaluate to a mapping, the contents of which are\n' - 'treated as additional keyword arguments. In the case of a keyword\n' - 'appearing in both "expression" and as an explicit keyword argument, ' - 'a\n' - '"TypeError" exception is raised.\n' + '"expression" must evaluate to a *mapping*, the contents of which ' + 'are\n' + 'treated as additional keyword arguments. If a keyword is already\n' + 'present (as an explicit keyword argument, or from another ' + 'unpacking),\n' + 'a "TypeError" exception is raised.\n' '\n' 'Formal parameters using the syntax "*identifier" or "**identifier"\n' 'cannot be used as positional argument slots or as keyword argument\n' 'names.\n' '\n' + 'Changed in version 3.5: Function calls accept any number of "*" ' + 'and\n' + '"**" unpackings, positional arguments may follow iterable ' + 'unpackings\n' + '("*"), and keyword arguments may follow dictionary unpackings ' + '("**").\n' + 'Originally proposed by **PEP 448**.\n' + '\n' 'A call always returns some value, possibly "None", unless it raises ' 'an\n' 'exception. How this value is computed depends on the type of the\n' @@ -1324,7 +1333,7 @@ '\n' ' classdef ::= [decorators] "class" classname [inheritance] ":" ' 'suite\n' - ' inheritance ::= "(" [parameter_list] ")"\n' + ' inheritance ::= "(" [argument_list] ")"\n' ' classname ::= identifier\n' '\n' 'A class definition is an executable statement. The inheritance ' @@ -2261,7 +2270,7 @@ '[parameter_list] ")" ["->" expression] ":" suite\n' ' decorators ::= decorator+\n' ' decorator ::= "@" dotted_name ["(" ' - '[parameter_list [","]] ")"] NEWLINE\n' + '[argument_list [","]] ")"] NEWLINE\n' ' dotted_name ::= identifier ("." identifier)*\n' ' parameter_list ::= defparameter ("," defparameter)* ' '["," [parameter_list_starargs]]\n' @@ -2426,7 +2435,7 @@ '\n' ' classdef ::= [decorators] "class" classname [inheritance] ' '":" suite\n' - ' inheritance ::= "(" [parameter_list] ")"\n' + ' inheritance ::= "(" [argument_list] ")"\n' ' classname ::= identifier\n' '\n' 'A class definition is an executable statement. The inheritance ' @@ -2563,7 +2572,7 @@ 'Is semantically equivalent to:\n' '\n' ' iter = (ITER)\n' - ' iter = await type(iter).__aiter__(iter)\n' + ' iter = type(iter).__aiter__(iter)\n' ' running = True\n' ' while running:\n' ' try:\n' @@ -3889,7 +3898,7 @@ ' dict_display ::= "{" [key_datum_list | dict_comprehension] ' '"}"\n' ' key_datum_list ::= key_datum ("," key_datum)* [","]\n' - ' key_datum ::= expression ":" expression\n' + ' key_datum ::= expression ":" expression | "**" or_expr\n' ' dict_comprehension ::= expression ":" expression comp_for\n' '\n' 'A dictionary display yields a new dictionary object.\n' @@ -3903,6 +3912,14 @@ 'value\n' 'for that key will be the last one given.\n' '\n' + 'A double asterisk "**" denotes *dictionary unpacking*. Its operand\n' + 'must be a *mapping*. Each mapping item is added to the new\n' + 'dictionary. Later values replace values already set by earlier\n' + 'key/datum pairs and earlier dictionary unpackings.\n' + '\n' + 'New in version 3.5: Unpacking into dictionary displays, originally\n' + 'proposed by **PEP 448**.\n' + '\n' 'A dict comprehension, in contrast to list and set comprehensions,\n' 'needs two expressions separated with a colon followed by the usual\n' '"for" and "if" clauses. When the comprehension is run, the ' @@ -4384,13 +4401,30 @@ 'Expression lists\n' '****************\n' '\n' - ' expression_list ::= expression ( "," expression )* [","]\n' + ' expression_list ::= expression ( "," expression )* [","]\n' + ' starred_list ::= starred_item ( "," starred_item )* ' + '[","]\n' + ' starred_expression ::= expression | ( starred_item "," )* ' + '[starred_item]\n' + ' starred_item ::= expression | "*" or_expr\n' '\n' - 'An expression list containing at least one comma yields a ' - 'tuple. The\n' - 'length of the tuple is the number of expressions in the list. ' - 'The\n' - 'expressions are evaluated from left to right.\n' + 'Except when part of a list or set display, an expression list\n' + 'containing at least one comma yields a tuple. The length of ' + 'the tuple\n' + 'is the number of expressions in the list. The expressions are\n' + 'evaluated from left to right.\n' + '\n' + 'An asterisk "*" denotes *iterable unpacking*. Its operand must ' + 'be an\n' + '*iterable*. The iterable is expanded into a sequence of items, ' + 'which\n' + 'are included in the new tuple, list, or set, at the site of ' + 'the\n' + 'unpacking.\n' + '\n' + 'New in version 3.5: Iterable unpacking in expression lists, ' + 'originally\n' + 'proposed by **PEP 448**.\n' '\n' 'The trailing comma is required only to create a single tuple ' '(a.k.a. a\n' @@ -5220,7 +5254,7 @@ '[parameter_list] ")" ["->" expression] ":" suite\n' ' decorators ::= decorator+\n' ' decorator ::= "@" dotted_name ["(" ' - '[parameter_list [","]] ")"] NEWLINE\n' + '[argument_list [","]] ")"] NEWLINE\n' ' dotted_name ::= identifier ("." identifier)*\n' ' parameter_list ::= defparameter ("," defparameter)* ' '["," [parameter_list_starargs]]\n' @@ -5682,7 +5716,7 @@ 'the\n' 'two steps are carried out separately for each clause, just as ' 'though\n' - 'the clauses had been separated out into individiual import ' + 'the clauses had been separated out into individual import ' 'statements.\n' '\n' 'The details of the first step, finding and loading modules are\n' @@ -6016,7 +6050,7 @@ 'in\n' 'square brackets:\n' '\n' - ' list_display ::= "[" [expression_list | comprehension] "]"\n' + ' list_display ::= "[" [starred_list | comprehension] "]"\n' '\n' 'A list display yields a new list object, the contents being ' 'specified\n' @@ -8305,6 +8339,14 @@ 'object is bound in the local namespace as the defined ' 'class.\n' '\n' + 'When a new class is created by "type.__new__", the object ' + 'provided as\n' + 'the namespace parameter is copied to a standard Python ' + 'dictionary and\n' + 'the original object is discarded. The new copy becomes the ' + '"__dict__"\n' + 'attribute of the class object.\n' + '\n' 'See also:\n' '\n' ' **PEP 3135** - New super\n' -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 23:56:26 2016 From: python-checkins at python.org (ned.deily) Date: Tue, 14 Jun 2016 03:56:26 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_default_-=3E_default?= =?utf-8?q?=29=3A_Merge_3=2E6=2E0a2_releasing_branch_into_default?= Message-ID: <20160614035624.81192.46663.A3582977@psf.io> https://hg.python.org/cpython/rev/5899b2925b91 changeset: 101997:5899b2925b91 parent: 101992:60613ecad578 parent: 101996:678afc089ebd user: Ned Deily date: Mon Jun 13 23:55:33 2016 -0400 summary: Merge 3.6.0a2 releasing branch into default files: .hgtags | 1 + Include/patchlevel.h | 4 +- Lib/pydoc_data/topics.py | 202 ++++++++++++++++---------- Misc/NEWS | 6 +- README | 2 +- 5 files changed, 129 insertions(+), 86 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -164,3 +164,4 @@ 37a07cee5969e6d3672583187a73cf636ff28e1b v3.5.1 68feec6488b26327a85a634605dd28eca4daa5f1 v3.5.2rc1 5896da372fb044e38595fb74495de1e1e7c8fb3c v3.6.0a1 +37889342355223e2fc1438de3dc7ffcd625c60f7 v3.6.0a2 diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -20,10 +20,10 @@ #define PY_MINOR_VERSION 6 #define PY_MICRO_VERSION 0 #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA -#define PY_RELEASE_SERIAL 1 +#define PY_RELEASE_SERIAL 2 /* Version as a string */ -#define PY_VERSION "3.6.0a1+" +#define PY_VERSION "3.6.0a2+" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Mon May 16 13:41:38 2016 +# Autogenerated by Sphinx on Mon Jun 13 16:49:58 2016 topics = {'assert': '\n' 'The "assert" statement\n' '**********************\n' @@ -47,12 +47,12 @@ 'to\n' 'modify attributes or items of mutable objects:\n' '\n' - ' assignment_stmt ::= (target_list "=")+ (expression_list | ' - 'yield_expression)\n' + ' assignment_stmt ::= (target_list "=")+ (starred_expression ' + '| yield_expression)\n' ' target_list ::= target ("," target)* [","]\n' ' target ::= identifier\n' - ' | "(" target_list ")"\n' - ' | "[" target_list "]"\n' + ' | "(" [target_list] ")"\n' + ' | "[" [target_list] "]"\n' ' | attributeref\n' ' | subscription\n' ' | slicing\n' @@ -89,35 +89,42 @@ 'parentheses or square brackets, is recursively defined as ' 'follows.\n' '\n' - '* If the target list is a single target: The object is ' - 'assigned to\n' - ' that target.\n' + '* If the target list is empty: The object must also be an ' + 'empty\n' + ' iterable.\n' '\n' - '* If the target list is a comma-separated list of targets: ' - 'The\n' - ' object must be an iterable with the same number of items as ' - 'there\n' - ' are targets in the target list, and the items are assigned, ' - 'from\n' - ' left to right, to the corresponding targets.\n' + '* If the target list is a single target in parentheses: The ' + 'object\n' + ' is assigned to that target.\n' + '\n' + '* If the target list is a comma-separated list of targets, or ' + 'a\n' + ' single target in square brackets: The object must be an ' + 'iterable\n' + ' with the same number of items as there are targets in the ' + 'target\n' + ' list, and the items are assigned, from left to right, to ' + 'the\n' + ' corresponding targets.\n' '\n' ' * If the target list contains one target prefixed with an\n' - ' asterisk, called a "starred" target: The object must be a ' - 'sequence\n' - ' with at least as many items as there are targets in the ' - 'target\n' - ' list, minus one. The first items of the sequence are ' - 'assigned,\n' - ' from left to right, to the targets before the starred ' - 'target. The\n' - ' final items of the sequence are assigned to the targets ' - 'after the\n' - ' starred target. A list of the remaining items in the ' - 'sequence is\n' - ' then assigned to the starred target (the list can be ' - 'empty).\n' + ' asterisk, called a "starred" target: The object must be ' + 'an\n' + ' iterable with at least as many items as there are targets ' + 'in the\n' + ' target list, minus one. The first items of the iterable ' + 'are\n' + ' assigned, from left to right, to the targets before the ' + 'starred\n' + ' target. The final items of the iterable are assigned to ' + 'the\n' + ' targets after the starred target. A list of the remaining ' + 'items\n' + ' in the iterable is then assigned to the starred target ' + '(the list\n' + ' can be empty).\n' '\n' - ' * Else: The object must be a sequence with the same number ' + ' * Else: The object must be an iterable with the same number ' 'of\n' ' items as there are targets in the target list, and the ' 'items are\n' @@ -149,14 +156,6 @@ 'destructor (if it\n' ' has one) to be called.\n' '\n' - '* If the target is a target list enclosed in parentheses or ' - 'in\n' - ' square brackets: The object must be an iterable with the ' - 'same number\n' - ' of items as there are targets in the target list, and its ' - 'items are\n' - ' assigned, from left to right, to the corresponding targets.\n' - '\n' '* If the target is an attribute reference: The primary ' 'expression in\n' ' the reference is evaluated. It should yield an object with\n' @@ -1148,18 +1147,18 @@ ' call ::= primary "(" [argument_list [","] | ' 'comprehension] ")"\n' ' argument_list ::= positional_arguments ["," ' - 'keyword_arguments]\n' - ' ["," "*" expression] ["," ' - 'keyword_arguments]\n' - ' ["," "**" expression]\n' - ' | keyword_arguments ["," "*" expression]\n' - ' ["," keyword_arguments] ["," "**" ' - 'expression]\n' - ' | "*" expression ["," keyword_arguments] ["," ' - '"**" expression]\n' - ' | "**" expression\n' - ' positional_arguments ::= expression ("," expression)*\n' - ' keyword_arguments ::= keyword_item ("," keyword_item)*\n' + 'starred_and_keywords]\n' + ' ["," keywords_arguments]\n' + ' | starred_and_keywords ["," ' + 'keywords_arguments]\n' + ' | keywords_arguments\n' + ' positional_arguments ::= ["*"] expression ("," ["*"] ' + 'expression)*\n' + ' starred_and_keywords ::= ("*" expression | keyword_item)\n' + ' ("," "*" expression | "," ' + 'keyword_item)*\n' + ' keywords_arguments ::= (keyword_item | "**" expression)\n' + ' ("," keyword_item | "**" expression)*\n' ' keyword_item ::= identifier "=" expression\n' '\n' 'An optional trailing comma may be present after the positional and\n' @@ -1235,20 +1234,21 @@ '\n' 'If the syntax "*expression" appears in the function call, ' '"expression"\n' - 'must evaluate to an iterable. Elements from this iterable are ' - 'treated\n' - 'as if they were additional positional arguments; if there are\n' - 'positional arguments *x1*, ..., *xN*, and "expression" evaluates to ' - 'a\n' - 'sequence *y1*, ..., *yM*, this is equivalent to a call with M+N\n' - 'positional arguments *x1*, ..., *xN*, *y1*, ..., *yM*.\n' + 'must evaluate to an *iterable*. Elements from these iterables are\n' + 'treated as if they were additional positional arguments. For the ' + 'call\n' + '"f(x1, x2, *y, x3, x4)", if *y* evaluates to a sequence *y1*, ...,\n' + '*yM*, this is equivalent to a call with M+4 positional arguments ' + '*x1*,\n' + '*x2*, *y1*, ..., *yM*, *x3*, *x4*.\n' '\n' 'A consequence of this is that although the "*expression" syntax ' 'may\n' - 'appear *after* some keyword arguments, it is processed *before* ' - 'the\n' - 'keyword arguments (and the "**expression" argument, if any -- see\n' - 'below). So:\n' + 'appear *after* explicit keyword arguments, it is processed ' + '*before*\n' + 'the keyword arguments (and any "**expression" arguments -- see ' + 'below).\n' + 'So:\n' '\n' ' >>> def f(a, b):\n' ' ... print(a, b)\n' @@ -1269,16 +1269,25 @@ 'arise.\n' '\n' 'If the syntax "**expression" appears in the function call,\n' - '"expression" must evaluate to a mapping, the contents of which are\n' - 'treated as additional keyword arguments. In the case of a keyword\n' - 'appearing in both "expression" and as an explicit keyword argument, ' - 'a\n' - '"TypeError" exception is raised.\n' + '"expression" must evaluate to a *mapping*, the contents of which ' + 'are\n' + 'treated as additional keyword arguments. If a keyword is already\n' + 'present (as an explicit keyword argument, or from another ' + 'unpacking),\n' + 'a "TypeError" exception is raised.\n' '\n' 'Formal parameters using the syntax "*identifier" or "**identifier"\n' 'cannot be used as positional argument slots or as keyword argument\n' 'names.\n' '\n' + 'Changed in version 3.5: Function calls accept any number of "*" ' + 'and\n' + '"**" unpackings, positional arguments may follow iterable ' + 'unpackings\n' + '("*"), and keyword arguments may follow dictionary unpackings ' + '("**").\n' + 'Originally proposed by **PEP 448**.\n' + '\n' 'A call always returns some value, possibly "None", unless it raises ' 'an\n' 'exception. How this value is computed depends on the type of the\n' @@ -1324,7 +1333,7 @@ '\n' ' classdef ::= [decorators] "class" classname [inheritance] ":" ' 'suite\n' - ' inheritance ::= "(" [parameter_list] ")"\n' + ' inheritance ::= "(" [argument_list] ")"\n' ' classname ::= identifier\n' '\n' 'A class definition is an executable statement. The inheritance ' @@ -2261,7 +2270,7 @@ '[parameter_list] ")" ["->" expression] ":" suite\n' ' decorators ::= decorator+\n' ' decorator ::= "@" dotted_name ["(" ' - '[parameter_list [","]] ")"] NEWLINE\n' + '[argument_list [","]] ")"] NEWLINE\n' ' dotted_name ::= identifier ("." identifier)*\n' ' parameter_list ::= defparameter ("," defparameter)* ' '["," [parameter_list_starargs]]\n' @@ -2426,7 +2435,7 @@ '\n' ' classdef ::= [decorators] "class" classname [inheritance] ' '":" suite\n' - ' inheritance ::= "(" [parameter_list] ")"\n' + ' inheritance ::= "(" [argument_list] ")"\n' ' classname ::= identifier\n' '\n' 'A class definition is an executable statement. The inheritance ' @@ -2563,7 +2572,7 @@ 'Is semantically equivalent to:\n' '\n' ' iter = (ITER)\n' - ' iter = await type(iter).__aiter__(iter)\n' + ' iter = type(iter).__aiter__(iter)\n' ' running = True\n' ' while running:\n' ' try:\n' @@ -3889,7 +3898,7 @@ ' dict_display ::= "{" [key_datum_list | dict_comprehension] ' '"}"\n' ' key_datum_list ::= key_datum ("," key_datum)* [","]\n' - ' key_datum ::= expression ":" expression\n' + ' key_datum ::= expression ":" expression | "**" or_expr\n' ' dict_comprehension ::= expression ":" expression comp_for\n' '\n' 'A dictionary display yields a new dictionary object.\n' @@ -3903,6 +3912,14 @@ 'value\n' 'for that key will be the last one given.\n' '\n' + 'A double asterisk "**" denotes *dictionary unpacking*. Its operand\n' + 'must be a *mapping*. Each mapping item is added to the new\n' + 'dictionary. Later values replace values already set by earlier\n' + 'key/datum pairs and earlier dictionary unpackings.\n' + '\n' + 'New in version 3.5: Unpacking into dictionary displays, originally\n' + 'proposed by **PEP 448**.\n' + '\n' 'A dict comprehension, in contrast to list and set comprehensions,\n' 'needs two expressions separated with a colon followed by the usual\n' '"for" and "if" clauses. When the comprehension is run, the ' @@ -4384,13 +4401,30 @@ 'Expression lists\n' '****************\n' '\n' - ' expression_list ::= expression ( "," expression )* [","]\n' + ' expression_list ::= expression ( "," expression )* [","]\n' + ' starred_list ::= starred_item ( "," starred_item )* ' + '[","]\n' + ' starred_expression ::= expression | ( starred_item "," )* ' + '[starred_item]\n' + ' starred_item ::= expression | "*" or_expr\n' '\n' - 'An expression list containing at least one comma yields a ' - 'tuple. The\n' - 'length of the tuple is the number of expressions in the list. ' - 'The\n' - 'expressions are evaluated from left to right.\n' + 'Except when part of a list or set display, an expression list\n' + 'containing at least one comma yields a tuple. The length of ' + 'the tuple\n' + 'is the number of expressions in the list. The expressions are\n' + 'evaluated from left to right.\n' + '\n' + 'An asterisk "*" denotes *iterable unpacking*. Its operand must ' + 'be an\n' + '*iterable*. The iterable is expanded into a sequence of items, ' + 'which\n' + 'are included in the new tuple, list, or set, at the site of ' + 'the\n' + 'unpacking.\n' + '\n' + 'New in version 3.5: Iterable unpacking in expression lists, ' + 'originally\n' + 'proposed by **PEP 448**.\n' '\n' 'The trailing comma is required only to create a single tuple ' '(a.k.a. a\n' @@ -5220,7 +5254,7 @@ '[parameter_list] ")" ["->" expression] ":" suite\n' ' decorators ::= decorator+\n' ' decorator ::= "@" dotted_name ["(" ' - '[parameter_list [","]] ")"] NEWLINE\n' + '[argument_list [","]] ")"] NEWLINE\n' ' dotted_name ::= identifier ("." identifier)*\n' ' parameter_list ::= defparameter ("," defparameter)* ' '["," [parameter_list_starargs]]\n' @@ -5682,7 +5716,7 @@ 'the\n' 'two steps are carried out separately for each clause, just as ' 'though\n' - 'the clauses had been separated out into individiual import ' + 'the clauses had been separated out into individual import ' 'statements.\n' '\n' 'The details of the first step, finding and loading modules are\n' @@ -6016,7 +6050,7 @@ 'in\n' 'square brackets:\n' '\n' - ' list_display ::= "[" [expression_list | comprehension] "]"\n' + ' list_display ::= "[" [starred_list | comprehension] "]"\n' '\n' 'A list display yields a new list object, the contents being ' 'specified\n' @@ -8305,6 +8339,14 @@ 'object is bound in the local namespace as the defined ' 'class.\n' '\n' + 'When a new class is created by "type.__new__", the object ' + 'provided as\n' + 'the namespace parameter is copied to a standard Python ' + 'dictionary and\n' + 'the original object is discarded. The new copy becomes the ' + '"__dict__"\n' + 'attribute of the class object.\n' + '\n' 'See also:\n' '\n' ' **PEP 3135** - New super\n' diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -8,7 +8,7 @@ *Release date: XXXX-XX-XX* Library -+++++++ +------- - Issue #22636: Avoid shell injection problems with ctypes.util.find_library(). @@ -18,7 +18,7 @@ indexes. IDLE -++++ +---- - Issue #27310: Fix IDLE.app failure to launch on OS X due to vestigial import. @@ -26,7 +26,7 @@ What's New in Python 3.6.0 alpha 2 ================================== -*Release date: XXXX-XX-XX* +*Release date: 2016-06-13* Core and Builtins ----------------- diff --git a/README b/README --- a/README +++ b/README @@ -1,4 +1,4 @@ -This is Python version 3.6.0 alpha 1 +This is Python version 3.6.0 alpha 2 ==================================== Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 23:56:28 2016 From: python-checkins at python.org (ned.deily) Date: Tue, 14 Jun 2016 03:56:28 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Start_3=2E6=2E0a3?= Message-ID: <20160614035624.101606.67883.8291687F@psf.io> https://hg.python.org/cpython/rev/678afc089ebd changeset: 101996:678afc089ebd user: Ned Deily date: Mon Jun 13 23:46:45 2016 -0400 summary: Start 3.6.0a3 files: Include/patchlevel.h | 2 +- Misc/NEWS | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -23,7 +23,7 @@ #define PY_RELEASE_SERIAL 2 /* Version as a string */ -#define PY_VERSION "3.6.0a2" +#define PY_VERSION "3.6.0a2+" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,6 +2,18 @@ Python News +++++++++++ +What's New in Python 3.6.0 alpha 3 +================================== + +*Release date: XXXX-XX-XX* + +Core and Builtins +----------------- + +Library +------- + + What's New in Python 3.6.0 alpha 2 ================================== -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 13 23:59:48 2016 From: python-checkins at python.org (ned.deily) Date: Tue, 14 Jun 2016 03:59:48 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_update_for_3=2E6=2E0a2?= Message-ID: <20160614035948.101804.81562.E0BB3EB1@psf.io> https://hg.python.org/peps/rev/21c980d3111f changeset: 6376:21c980d3111f user: Ned Deily date: Mon Jun 13 23:59:45 2016 -0400 summary: update for 3.6.0a2 files: pep-0494.txt | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/pep-0494.txt b/pep-0494.txt --- a/pep-0494.txt +++ b/pep-0494.txt @@ -49,8 +49,8 @@ - 3.6 development begins: 2015-05-24 - 3.6.0 alpha 1: 2016-05-17 +- 3.6.0 alpha 2: 2016-06-13 -- 3.6.0 alpha 2: 2016-06-13 - 3.6.0 alpha 3: 2016-07-11 - 3.6.0 alpha 4: 2016-08-08 - 3.6.0 beta 1: 2016-09-07 -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Tue Jun 14 00:40:31 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 14 Jun 2016 04:40:31 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2322636=3A_Merge_ctypes=2Eutil_from_3=2E5?= Message-ID: <20160614044030.10026.76945.2904758B@psf.io> https://hg.python.org/cpython/rev/a6a36bb6ee50 changeset: 101999:a6a36bb6ee50 parent: 101997:5899b2925b91 parent: 101998:96d297e9a8a8 user: Martin Panter date: Tue Jun 14 04:31:14 2016 +0000 summary: Issue #22636: Merge ctypes.util from 3.5 files: Lib/ctypes/util.py | 54 ++++++++++++++++++++++----------- 1 files changed, 35 insertions(+), 19 deletions(-) diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py --- a/Lib/ctypes/util.py +++ b/Lib/ctypes/util.py @@ -115,10 +115,13 @@ env = dict(os.environ) env['LC_ALL'] = 'C' env['LANG'] = 'C' - proc = subprocess.Popen(args, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - env=env) + try: + proc = subprocess.Popen(args, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + env=env) + except OSError: # E.g. bad executable + return None with proc: trace = proc.stdout.read() finally: @@ -140,9 +143,12 @@ if not f: return None - proc = subprocess.Popen(("/usr/ccs/bin/dump", "-Lpv", f), - stdout=subprocess.PIPE, - stderr=subprocess.DEVNULL) + try: + proc = subprocess.Popen(("/usr/ccs/bin/dump", "-Lpv", f), + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL) + except OSError: # E.g. command not found + return None with proc: data = proc.stdout.read() res = re.search(br'\[.*\]\sSONAME\s+([^\s]+)', data) @@ -159,9 +165,12 @@ # objdump is not available, give up return None - proc = subprocess.Popen((objdump, '-p', '-j', '.dynamic', f), - stdout=subprocess.PIPE, - stderr=subprocess.DEVNULL) + try: + proc = subprocess.Popen((objdump, '-p', '-j', '.dynamic', f), + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL) + except OSError: # E.g. bad executable + return None with proc: dump = proc.stdout.read() res = re.search(br'\sSONAME\s+([^\s]+)', dump) @@ -187,11 +196,15 @@ expr = r':-l%s\.\S+ => \S*/(lib%s\.\S+)' % (ename, ename) expr = os.fsencode(expr) - proc = subprocess.Popen(('/sbin/ldconfig', '-r'), - stdout=subprocess.PIPE, - stderr=subprocess.DEVNULL) - with proc: - data = proc.stdout.read() + try: + proc = subprocess.Popen(('/sbin/ldconfig', '-r'), + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL) + except OSError: # E.g. command not found + data = b'' + else: + with proc: + data = proc.stdout.read() res = re.findall(expr, data) if not res: @@ -214,10 +227,13 @@ args = ('/usr/bin/crle',) paths = None - proc = subprocess.Popen(args, - stdout=subprocess.PIPE, - stderr=subprocess.DEVNULL, - env=env) + try: + proc = subprocess.Popen(args, + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL, + env=env) + except OSError: # E.g. bad executable + return None with proc: for line in proc.stdout: line = line.strip() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 00:40:32 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 14 Jun 2016 04:40:32 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIyNjM2?= =?utf-8?q?=3A_Handle_OSError_from_subprocess=2C_e=2Eg=2E_if_command_not_f?= =?utf-8?q?ound?= Message-ID: <20160614044030.114506.54534.3BA00BA3@psf.io> https://hg.python.org/cpython/rev/96d297e9a8a8 changeset: 101998:96d297e9a8a8 branch: 3.5 parent: 101989:0715d403cae2 user: Martin Panter date: Tue Jun 14 04:08:30 2016 +0000 summary: Issue #22636: Handle OSError from subprocess, e.g. if command not found files: Lib/ctypes/util.py | 54 ++++++++++++++++++++++----------- 1 files changed, 35 insertions(+), 19 deletions(-) diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py --- a/Lib/ctypes/util.py +++ b/Lib/ctypes/util.py @@ -115,10 +115,13 @@ env = dict(os.environ) env['LC_ALL'] = 'C' env['LANG'] = 'C' - proc = subprocess.Popen(args, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - env=env) + try: + proc = subprocess.Popen(args, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + env=env) + except OSError: # E.g. bad executable + return None with proc: trace = proc.stdout.read() finally: @@ -140,9 +143,12 @@ if not f: return None - proc = subprocess.Popen(("/usr/ccs/bin/dump", "-Lpv", f), - stdout=subprocess.PIPE, - stderr=subprocess.DEVNULL) + try: + proc = subprocess.Popen(("/usr/ccs/bin/dump", "-Lpv", f), + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL) + except OSError: # E.g. command not found + return None with proc: data = proc.stdout.read() res = re.search(br'\[.*\]\sSONAME\s+([^\s]+)', data) @@ -159,9 +165,12 @@ # objdump is not available, give up return None - proc = subprocess.Popen((objdump, '-p', '-j', '.dynamic', f), - stdout=subprocess.PIPE, - stderr=subprocess.DEVNULL) + try: + proc = subprocess.Popen((objdump, '-p', '-j', '.dynamic', f), + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL) + except OSError: # E.g. bad executable + return None with proc: dump = proc.stdout.read() res = re.search(br'\sSONAME\s+([^\s]+)', dump) @@ -187,11 +196,15 @@ expr = r':-l%s\.\S+ => \S*/(lib%s\.\S+)' % (ename, ename) expr = os.fsencode(expr) - proc = subprocess.Popen(('/sbin/ldconfig', '-r'), - stdout=subprocess.PIPE, - stderr=subprocess.DEVNULL) - with proc: - data = proc.stdout.read() + try: + proc = subprocess.Popen(('/sbin/ldconfig', '-r'), + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL) + except OSError: # E.g. command not found + data = b'' + else: + with proc: + data = proc.stdout.read() res = re.findall(expr, data) if not res: @@ -214,10 +227,13 @@ args = ('/usr/bin/crle',) paths = None - proc = subprocess.Popen(args, - stdout=subprocess.PIPE, - stderr=subprocess.DEVNULL, - env=env) + try: + proc = subprocess.Popen(args, + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL, + env=env) + except OSError: # E.g. bad executable + return None with proc: for line in proc.stdout: line = line.strip() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 00:54:02 2016 From: python-checkins at python.org (terry.reedy) Date: Tue, 14 Jun 2016 04:54:02 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI3MjQ1?= =?utf-8?q?=3A_IDLE=3A_Cleanly_delete_custom_themes_and_key_bindings=2E?= Message-ID: <20160614045402.20067.75186.C8953785@psf.io> https://hg.python.org/cpython/rev/5c8cddc4a8ee changeset: 102000:5c8cddc4a8ee branch: 2.7 parent: 101985:675569bee37f user: Terry Jan Reedy date: Tue Jun 14 00:53:18 2016 -0400 summary: Issue #27245: IDLE: Cleanly delete custom themes and key bindings. Previously, when IDLE was started from a console or by import, a cascade of warnings was emitted. Patch by Serhiy Storchaka. files: Lib/idlelib/configDialog.py | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/configDialog.py b/Lib/idlelib/configDialog.py --- a/Lib/idlelib/configDialog.py +++ b/Lib/idlelib/configDialog.py @@ -767,6 +767,7 @@ if not tkMessageBox.askyesno( 'Delete Key Set', delmsg % keySetName, parent=self): return + self.DeactivateCurrentConfig() #remove key set from config idleConf.userCfg['keys'].remove_section(keySetName) if keySetName in self.changedItems['keys']: @@ -785,7 +786,8 @@ self.keysAreBuiltin.set(idleConf.defaultCfg['main'].Get('Keys', 'default')) self.builtinKeys.set(idleConf.defaultCfg['main'].Get('Keys', 'name')) #user can't back out of these changes, they must be applied now - self.Apply() + self.SaveAllChangedConfigs() + self.ActivateConfigChanges() self.SetKeysType() def DeleteCustomTheme(self): @@ -794,6 +796,7 @@ if not tkMessageBox.askyesno( 'Delete Theme', delmsg % themeName, parent=self): return + self.DeactivateCurrentConfig() #remove theme from config idleConf.userCfg['highlight'].remove_section(themeName) if themeName in self.changedItems['highlight']: @@ -812,7 +815,8 @@ self.themeIsBuiltin.set(idleConf.defaultCfg['main'].Get('Theme', 'default')) self.builtinTheme.set(idleConf.defaultCfg['main'].Get('Theme', 'name')) #user can't back out of these changes, they must be applied now - self.Apply() + self.SaveAllChangedConfigs() + self.ActivateConfigChanges() self.SetThemeType() def GetColour(self): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 00:54:03 2016 From: python-checkins at python.org (terry.reedy) Date: Tue, 14 Jun 2016 04:54:03 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MjQ1?= =?utf-8?q?=3A_IDLE=3A_Cleanly_delete_custom_themes_and_key_bindings=2E?= Message-ID: <20160614045402.101743.88236.7DFE420F@psf.io> https://hg.python.org/cpython/rev/438359d00a83 changeset: 102001:438359d00a83 branch: 3.5 parent: 101998:96d297e9a8a8 user: Terry Jan Reedy date: Tue Jun 14 00:53:25 2016 -0400 summary: Issue #27245: IDLE: Cleanly delete custom themes and key bindings. Previously, when IDLE was started from a console or by import, a cascade of warnings was emitted. Patch by Serhiy Storchaka. files: Lib/idlelib/configDialog.py | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/configDialog.py b/Lib/idlelib/configDialog.py --- a/Lib/idlelib/configDialog.py +++ b/Lib/idlelib/configDialog.py @@ -751,6 +751,7 @@ if not tkMessageBox.askyesno( 'Delete Key Set', delmsg % keySetName, parent=self): return + self.DeactivateCurrentConfig() #remove key set from config idleConf.userCfg['keys'].remove_section(keySetName) if keySetName in self.changedItems['keys']: @@ -769,7 +770,8 @@ self.keysAreBuiltin.set(idleConf.defaultCfg['main'].Get('Keys', 'default')) self.builtinKeys.set(idleConf.defaultCfg['main'].Get('Keys', 'name')) #user can't back out of these changes, they must be applied now - self.Apply() + self.SaveAllChangedConfigs() + self.ActivateConfigChanges() self.SetKeysType() def DeleteCustomTheme(self): @@ -778,6 +780,7 @@ if not tkMessageBox.askyesno( 'Delete Theme', delmsg % themeName, parent=self): return + self.DeactivateCurrentConfig() #remove theme from config idleConf.userCfg['highlight'].remove_section(themeName) if themeName in self.changedItems['highlight']: @@ -796,7 +799,8 @@ self.themeIsBuiltin.set(idleConf.defaultCfg['main'].Get('Theme', 'default')) self.builtinTheme.set(idleConf.defaultCfg['main'].Get('Theme', 'name')) #user can't back out of these changes, they must be applied now - self.Apply() + self.SaveAllChangedConfigs() + self.ActivateConfigChanges() self.SetThemeType() def GetColour(self): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 00:54:03 2016 From: python-checkins at python.org (terry.reedy) Date: Tue, 14 Jun 2016 04:54:03 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327245=3A_temporar?= =?utf-8?q?y_rename_for_merge=2E?= Message-ID: <20160614045402.114579.17016.1667ADF2@psf.io> https://hg.python.org/cpython/rev/7948633608d5 changeset: 102002:7948633608d5 parent: 101999:a6a36bb6ee50 user: Terry Jan Reedy date: Tue Jun 14 00:53:30 2016 -0400 summary: Issue #27245: temporary rename for merge. files: Lib/idlelib/configDialog.py | 0 1 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configDialog.py rename from Lib/idlelib/configdialog.py rename to Lib/idlelib/configDialog.py -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 00:54:03 2016 From: python-checkins at python.org (terry.reedy) Date: Tue, 14 Jun 2016 04:54:03 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_with_3=2E5?= Message-ID: <20160614045403.81413.75900.19903F03@psf.io> https://hg.python.org/cpython/rev/e3275bde7982 changeset: 102003:e3275bde7982 parent: 102002:7948633608d5 parent: 102001:438359d00a83 user: Terry Jan Reedy date: Tue Jun 14 00:53:41 2016 -0400 summary: Merge with 3.5 files: Lib/idlelib/configDialog.py | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/idlelib/configDialog.py b/Lib/idlelib/configDialog.py --- a/Lib/idlelib/configDialog.py +++ b/Lib/idlelib/configDialog.py @@ -752,6 +752,7 @@ if not tkMessageBox.askyesno( 'Delete Key Set', delmsg % keySetName, parent=self): return + self.DeactivateCurrentConfig() #remove key set from config idleConf.userCfg['keys'].remove_section(keySetName) if keySetName in self.changedItems['keys']: @@ -770,7 +771,8 @@ self.keysAreBuiltin.set(idleConf.defaultCfg['main'].Get('Keys', 'default')) self.builtinKeys.set(idleConf.defaultCfg['main'].Get('Keys', 'name')) #user can't back out of these changes, they must be applied now - self.Apply() + self.SaveAllChangedConfigs() + self.ActivateConfigChanges() self.SetKeysType() def DeleteCustomTheme(self): @@ -779,6 +781,7 @@ if not tkMessageBox.askyesno( 'Delete Theme', delmsg % themeName, parent=self): return + self.DeactivateCurrentConfig() #remove theme from config idleConf.userCfg['highlight'].remove_section(themeName) if themeName in self.changedItems['highlight']: @@ -797,7 +800,8 @@ self.themeIsBuiltin.set(idleConf.defaultCfg['main'].Get('Theme', 'default')) self.builtinTheme.set(idleConf.defaultCfg['main'].Get('Theme', 'name')) #user can't back out of these changes, they must be applied now - self.Apply() + self.SaveAllChangedConfigs() + self.ActivateConfigChanges() self.SetThemeType() def GetColour(self): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 00:55:25 2016 From: python-checkins at python.org (terry.reedy) Date: Tue, 14 Jun 2016 04:55:25 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327245=3A_revert_t?= =?utf-8?q?emporary_rename?= Message-ID: <20160614045524.20145.32057.B2C03C96@psf.io> https://hg.python.org/cpython/rev/3ac9e7466d8b changeset: 102004:3ac9e7466d8b user: Terry Jan Reedy date: Tue Jun 14 00:55:09 2016 -0400 summary: Issue #27245: revert temporary rename files: Lib/idlelib/configdialog.py | 0 1 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/configDialog.py b/Lib/idlelib/configdialog.py rename from Lib/idlelib/configDialog.py rename to Lib/idlelib/configdialog.py -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 01:28:07 2016 From: python-checkins at python.org (matthias.klose) Date: Tue, 14 Jun 2016 05:28:07 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_-_Modules/=5Fcollectionsmo?= =?utf-8?q?dule=2Ec=3A_Mark_one_more_internal_symbol_as_static=2E?= Message-ID: <20160614052807.20104.38143.BAE0F0C8@psf.io> https://hg.python.org/cpython/rev/079794e90f4e changeset: 102005:079794e90f4e user: doko at ubuntu.com date: Tue Jun 14 07:27:58 2016 +0200 summary: - Modules/_collectionsmodule.c: Mark one more internal symbol as static. files: Modules/_collectionsmodule.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -301,7 +301,7 @@ PyDoc_STRVAR(append_doc, "Add an element to the right side of the deque."); -int +static int deque_appendleft_internal(dequeobject *deque, PyObject *item, Py_ssize_t maxlen) { if (deque->leftindex == 0) { -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 01:51:12 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 14 Jun 2016 05:51:12 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzE2MTgy?= =?utf-8?q?=3A_Attempted_workarounds_for_Apple_Editline?= Message-ID: <20160614055112.26389.9557.A7CAB911@psf.io> https://hg.python.org/cpython/rev/0794bbfceec6 changeset: 102006:0794bbfceec6 branch: 3.5 parent: 102001:438359d00a83 user: Martin Panter date: Tue Jun 14 05:45:31 2016 +0000 summary: Issue #16182: Attempted workarounds for Apple Editline files: Lib/test/test_readline.py | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_readline.py b/Lib/test/test_readline.py --- a/Lib/test/test_readline.py +++ b/Lib/test/test_readline.py @@ -15,6 +15,8 @@ # Skip tests if there is no readline module readline = import_module('readline') +is_editline = readline.__doc__ and "libedit" in readline.__doc__ + @unittest.skipUnless(hasattr(readline, "clear_history"), "The history update test cannot be run because the " "clear_history method is not available.") @@ -99,14 +101,17 @@ self.addCleanup(os.remove, TESTFN) readline.clear_history() readline.read_history_file(TESTFN) + if is_editline: + # An add_history() call seems to be required for get_history_ + # item() to register items from the file + readline.add_history("dummy") self.assertEqual(readline.get_history_item(1), "entr?e 1") self.assertEqual(readline.get_history_item(2), "entr?e 22") class TestReadline(unittest.TestCase): - @unittest.skipIf(readline._READLINE_VERSION < 0x0600 - and "libedit" not in readline.__doc__, + @unittest.skipIf(readline._READLINE_VERSION < 0x0600 and not is_editline, "not supported in this library version") def test_init(self): # Issue #19884: Ensure that the ANSI sequence "\033[1034h" is not @@ -127,7 +132,9 @@ if readline.__doc__ and "libedit" in readline.__doc__: readline.parse_and_bind(r'bind ^B ed-prev-char') readline.parse_and_bind(r'bind "\t" rl_complete') - readline.parse_and_bind('bind -s ^A "|t\xEB[after]"') + # The insert_line() call via pre_input_hook() does nothing with Editline, + # so include the extra text that would have been inserted here + readline.parse_and_bind('bind -s ^A "[\xEFnserted]|t\xEB[after]"') else: readline.parse_and_bind(r'Control-b: backward-char') readline.parse_and_bind(r'"\t": complete') @@ -173,8 +180,9 @@ self.assertIn(b"text 't\\xeb'\r\n", output) self.assertIn(b"line '[\\xefnserted]|t\\xeb[after]'\r\n", output) self.assertIn(b"indexes 11 13\r\n", output) - self.assertIn(b"substitution 't\\xeb'\r\n", output) - self.assertIn(b"matches ['t\\xebnt', 't\\xebxt']\r\n", output) + if not is_editline: # display() hook not called under Editline + self.assertIn(b"substitution 't\\xeb'\r\n", output) + self.assertIn(b"matches ['t\\xebnt', 't\\xebxt']\r\n", output) expected = br"'[\xefnserted]|t\xebxt[after]'" self.assertIn(b"result " + expected + b"\r\n", output) self.assertIn(b"history " + expected + b"\r\n", output) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 01:51:14 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 14 Jun 2016 05:51:14 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2316182=3A_Merge_test=5Freadline_from_3=2E5?= Message-ID: <20160614055113.101799.53236.4D92F2A5@psf.io> https://hg.python.org/cpython/rev/a1ca9c0ebc05 changeset: 102007:a1ca9c0ebc05 parent: 102005:079794e90f4e parent: 102006:0794bbfceec6 user: Martin Panter date: Tue Jun 14 05:46:17 2016 +0000 summary: Issue #16182: Merge test_readline from 3.5 files: Lib/test/test_readline.py | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_readline.py b/Lib/test/test_readline.py --- a/Lib/test/test_readline.py +++ b/Lib/test/test_readline.py @@ -15,6 +15,8 @@ # Skip tests if there is no readline module readline = import_module('readline') +is_editline = readline.__doc__ and "libedit" in readline.__doc__ + @unittest.skipUnless(hasattr(readline, "clear_history"), "The history update test cannot be run because the " "clear_history method is not available.") @@ -99,14 +101,17 @@ self.addCleanup(os.remove, TESTFN) readline.clear_history() readline.read_history_file(TESTFN) + if is_editline: + # An add_history() call seems to be required for get_history_ + # item() to register items from the file + readline.add_history("dummy") self.assertEqual(readline.get_history_item(1), "entr?e 1") self.assertEqual(readline.get_history_item(2), "entr?e 22") class TestReadline(unittest.TestCase): - @unittest.skipIf(readline._READLINE_VERSION < 0x0600 - and "libedit" not in readline.__doc__, + @unittest.skipIf(readline._READLINE_VERSION < 0x0600 and not is_editline, "not supported in this library version") def test_init(self): # Issue #19884: Ensure that the ANSI sequence "\033[1034h" is not @@ -142,7 +147,9 @@ if readline.__doc__ and "libedit" in readline.__doc__: readline.parse_and_bind(r'bind ^B ed-prev-char') readline.parse_and_bind(r'bind "\t" rl_complete') - readline.parse_and_bind('bind -s ^A "|t\xEB[after]"') + # The insert_line() call via pre_input_hook() does nothing with Editline, + # so include the extra text that would have been inserted here + readline.parse_and_bind('bind -s ^A "[\xEFnserted]|t\xEB[after]"') else: readline.parse_and_bind(r'Control-b: backward-char') readline.parse_and_bind(r'"\t": complete') @@ -188,8 +195,9 @@ self.assertIn(b"text 't\\xeb'\r\n", output) self.assertIn(b"line '[\\xefnserted]|t\\xeb[after]'\r\n", output) self.assertIn(b"indexes 11 13\r\n", output) - self.assertIn(b"substitution 't\\xeb'\r\n", output) - self.assertIn(b"matches ['t\\xebnt', 't\\xebxt']\r\n", output) + if not is_editline: # display() hook not called under Editline + self.assertIn(b"substitution 't\\xeb'\r\n", output) + self.assertIn(b"matches ['t\\xebnt', 't\\xebxt']\r\n", output) expected = br"'[\xefnserted]|t\xebxt[after]'" self.assertIn(b"result " + expected + b"\r\n", output) self.assertIn(b"history " + expected + b"\r\n", output) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 02:39:42 2016 From: python-checkins at python.org (matthias.klose) Date: Tue, 14 Jun 2016 06:39:42 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_-_Issue_=238637=3A_Honor_a?= =?utf-8?q?_pager_set_by_the_env_var_MANPAGER_=28in_preference_to?= Message-ID: <20160614063941.10071.92894.61588FDC@psf.io> https://hg.python.org/cpython/rev/820d21c97d66 changeset: 102008:820d21c97d66 user: doko at ubuntu.com date: Tue Jun 14 08:39:31 2016 +0200 summary: - Issue #8637: Honor a pager set by the env var MANPAGER (in preference to one set by the env var PAGER). files: Lib/pydoc.py | 3 ++- Misc/NEWS | 3 +++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Lib/pydoc.py b/Lib/pydoc.py --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -1429,7 +1429,8 @@ return plainpager if not sys.stdin.isatty() or not sys.stdout.isatty(): return plainpager - if 'PAGER' in os.environ: + use_pager = os.environ.get('MANPAGER') or os.environ.get('PAGER') + if use_pager: if sys.platform == 'win32': # pipes completely broken in Windows return lambda text: tempfilepager(plain(text), os.environ['PAGER']) elif os.environ.get('TERM') in ('dumb', 'emacs'): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Library ------- +- Issue #8637: Honor a pager set by the env var MANPAGER (in preference to + one set by the env var PAGER). + - Issue #22636: Avoid shell injection problems with ctypes.util.find_library(). -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 02:43:49 2016 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 14 Jun 2016 06:43:49 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogbWVyZ2UgMy41?= Message-ID: <20160614064348.20104.1955.9DBE17FE@psf.io> https://hg.python.org/cpython/rev/264bf2551038 changeset: 102011:264bf2551038 parent: 102008:820d21c97d66 parent: 102010:376a379f12fe user: Benjamin Peterson date: Mon Jun 13 23:43:40 2016 -0700 summary: merge 3.5 files: Modules/expat/xmlrole.c | 4 ++-- Modules/expat/xmltok.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/expat/xmlrole.c b/Modules/expat/xmlrole.c --- a/Modules/expat/xmlrole.c +++ b/Modules/expat/xmlrole.c @@ -2,6 +2,8 @@ See the file COPYING for copying permission. */ +#include + #ifdef COMPILED_FROM_DSP #include "winconfig.h" #elif defined(MACOS_CLASSIC) @@ -16,8 +18,6 @@ #endif #endif /* ndef COMPILED_FROM_DSP */ -#include - #include "expat_external.h" #include "internal.h" #include "xmlrole.h" diff --git a/Modules/expat/xmltok.c b/Modules/expat/xmltok.c --- a/Modules/expat/xmltok.c +++ b/Modules/expat/xmltok.c @@ -2,6 +2,8 @@ See the file COPYING for copying permission. */ +#include + #ifdef COMPILED_FROM_DSP #include "winconfig.h" #elif defined(MACOS_CLASSIC) @@ -16,8 +18,6 @@ #endif #endif /* ndef COMPILED_FROM_DSP */ -#include - #include "expat_external.h" #include "internal.h" #include "xmltok.h" -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 02:43:49 2016 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 14 Jun 2016 06:43:49 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E4=29=3A_sync_ordering_?= =?utf-8?q?of_stddef=2Eh_includes_with_expat_2=2E1=2E1?= Message-ID: <20160614064348.26389.72034.9571BFCB@psf.io> https://hg.python.org/cpython/rev/aa4f7fc6d8c7 changeset: 102009:aa4f7fc6d8c7 branch: 3.4 parent: 101970:ca24b5b2d7fe user: Benjamin Peterson date: Mon Jun 13 23:41:19 2016 -0700 summary: sync ordering of stddef.h includes with expat 2.1.1 files: Modules/expat/xmlrole.c | 4 ++-- Modules/expat/xmltok.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/expat/xmlrole.c b/Modules/expat/xmlrole.c --- a/Modules/expat/xmlrole.c +++ b/Modules/expat/xmlrole.c @@ -2,6 +2,8 @@ See the file COPYING for copying permission. */ +#include + #ifdef COMPILED_FROM_DSP #include "winconfig.h" #elif defined(MACOS_CLASSIC) @@ -16,8 +18,6 @@ #endif #endif /* ndef COMPILED_FROM_DSP */ -#include - #include "expat_external.h" #include "internal.h" #include "xmlrole.h" diff --git a/Modules/expat/xmltok.c b/Modules/expat/xmltok.c --- a/Modules/expat/xmltok.c +++ b/Modules/expat/xmltok.c @@ -2,6 +2,8 @@ See the file COPYING for copying permission. */ +#include + #ifdef COMPILED_FROM_DSP #include "winconfig.h" #elif defined(MACOS_CLASSIC) @@ -16,8 +18,6 @@ #endif #endif /* ndef COMPILED_FROM_DSP */ -#include - #include "expat_external.h" #include "internal.h" #include "xmltok.h" -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 02:43:52 2016 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 14 Jun 2016 06:43:52 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy40IC0+IDMuNSk6?= =?utf-8?q?_merge_3=2E4?= Message-ID: <20160614064348.99116.88858.B6CA5AD8@psf.io> https://hg.python.org/cpython/rev/376a379f12fe changeset: 102010:376a379f12fe branch: 3.5 parent: 102006:0794bbfceec6 parent: 102009:aa4f7fc6d8c7 user: Benjamin Peterson date: Mon Jun 13 23:41:40 2016 -0700 summary: merge 3.4 files: Modules/expat/xmlrole.c | 4 ++-- Modules/expat/xmltok.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/expat/xmlrole.c b/Modules/expat/xmlrole.c --- a/Modules/expat/xmlrole.c +++ b/Modules/expat/xmlrole.c @@ -2,6 +2,8 @@ See the file COPYING for copying permission. */ +#include + #ifdef COMPILED_FROM_DSP #include "winconfig.h" #elif defined(MACOS_CLASSIC) @@ -16,8 +18,6 @@ #endif #endif /* ndef COMPILED_FROM_DSP */ -#include - #include "expat_external.h" #include "internal.h" #include "xmlrole.h" diff --git a/Modules/expat/xmltok.c b/Modules/expat/xmltok.c --- a/Modules/expat/xmltok.c +++ b/Modules/expat/xmltok.c @@ -2,6 +2,8 @@ See the file COPYING for copying permission. */ +#include + #ifdef COMPILED_FROM_DSP #include "winconfig.h" #elif defined(MACOS_CLASSIC) @@ -16,8 +18,6 @@ #endif #endif /* ndef COMPILED_FROM_DSP */ -#include - #include "expat_external.h" #include "internal.h" #include "xmltok.h" -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 02:55:30 2016 From: python-checkins at python.org (matthias.klose) Date: Tue, 14 Jun 2016 06:55:30 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_-_Issue_=2323968=3A_Rename?= =?utf-8?q?_the_platform_directory_from_plat-=24=28MACHDEP=29_to?= Message-ID: <20160614065530.81080.54403.B3966CC4@psf.io> https://hg.python.org/cpython/rev/78d2cb7f66b6 changeset: 102012:78d2cb7f66b6 user: doko at ubuntu.com date: Tue Jun 14 08:55:19 2016 +0200 summary: - Issue #23968: Rename the platform directory from plat-$(MACHDEP) to plat-$(PLATFORM_TRIPLET). Rename the config directory (LIBPL) from config-$(LDVERSION) to config-$(LDVERSION)-$(PLATFORM_TRIPLET). Install the platform specifc _sysconfigdata module into the platform directory and rename it to include the ABIFLAGS. files: Lib/distutils/sysconfig.py | 2 + Lib/plat-linux/regen | 31 ++++++++++++++++++++-- Lib/sysconfig.py | 8 ++++- Makefile.pre.in | 22 ++++++++++++++-- Misc/NEWS | 10 +++++++ Python/sysmodule.c | 10 +++++++ configure | 35 ++++++++++++++++++++++--- configure.ac | 17 ++++++++++-- 8 files changed, 119 insertions(+), 16 deletions(-) diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -242,6 +242,8 @@ return os.path.join(_sys_home or project_base, "Makefile") lib_dir = get_python_lib(plat_specific=0, standard_lib=1) config_file = 'config-{}{}'.format(get_python_version(), build_flags) + if hasattr(sys.implementation, '_multiarch'): + config_file += '-%s' % sys.implementation._multiarch return os.path.join(lib_dir, config_file, 'Makefile') diff --git a/Lib/plat-linux/regen b/Lib/plat-linux/regen --- a/Lib/plat-linux/regen +++ b/Lib/plat-linux/regen @@ -1,8 +1,33 @@ #! /bin/sh case `uname` in -Linux*) ;; +Linux*|GNU*) ;; *) echo Probably not on a Linux system 1>&2 exit 1;; esac -set -v -h2py -i '(u_long)' /usr/include/sys/types.h /usr/include/netinet/in.h /usr/include/dlfcn.h +if [ -z "$CC" ]; then + echo >&2 "$(basename $0): CC is not set" + exit 1 +fi +headers="sys/types.h netinet/in.h dlfcn.h" +incdirs="$(echo $($CC -v -E - < /dev/null 2>&1|awk '/^#include/, /^End of search/' | grep '^ '))" +if [ -z "$incdirs" ]; then + incdirs="/usr/include" +fi +for h in $headers; do + absh= + for d in $incdirs; do + if [ -f "$d/$h" ]; then + absh="$d/$h" + break + fi + done + if [ -n "$absh" ]; then + absheaders="$absheaders $absh" + else + echo >&2 "$(basename $0): header $h not found" + exit 1 + fi +done + +set -x +${H2PY:-h2py} -i '(u_long)' $absheaders diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -337,6 +337,8 @@ config_dir_name = 'config-%s%s' % (_PY_VERSION_SHORT, sys.abiflags) else: config_dir_name = 'config' + if hasattr(sys.implementation, '_multiarch'): + config_dir_name += '-%s' % sys.implementation._multiarch return os.path.join(get_path('stdlib'), config_dir_name, 'Makefile') def _generate_posix_vars(): @@ -379,7 +381,7 @@ # _sysconfigdata module manually and populate it with the build vars. # This is more than sufficient for ensuring the subsequent call to # get_platform() succeeds. - name = '_sysconfigdata' + name = '_sysconfigdata_' + sys.abiflags if 'darwin' in sys.platform: import types module = types.ModuleType(name) @@ -405,7 +407,9 @@ def _init_posix(vars): """Initialize the module as appropriate for POSIX systems.""" # _sysconfigdata is generated at build time, see _generate_posix_vars() - from _sysconfigdata import build_time_vars + name = '_sysconfigdata_' + sys.abiflags + _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0) + build_time_vars = _temp.build_time_vars vars.update(build_time_vars) def _init_non_posix(vars): diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -109,6 +109,7 @@ # Multiarch directory (may be empty) MULTIARCH= @MULTIARCH@ +MULTIARCH_CPPFLAGS = @MULTIARCH_CPPFLAGS@ # Install prefix for architecture-independent files prefix= @prefix@ @@ -784,6 +785,7 @@ Python/sysmodule.o: $(srcdir)/Python/sysmodule.c Makefile $(CC) -c $(PY_CORE_CFLAGS) \ -DABIFLAGS='"$(ABIFLAGS)"' \ + $(MULTIARCH_CPPFLAGS) \ -o $@ $(srcdir)/Python/sysmodule.c $(IO_OBJS): $(IO_H) @@ -1263,7 +1265,7 @@ else true; \ fi; \ done - @for i in $(srcdir)/Lib/*.py `cat pybuilddir.txt`/_sysconfigdata.py; \ + @for i in $(srcdir)/Lib/*.py; \ do \ if test -x $$i; then \ $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \ @@ -1298,6 +1300,10 @@ esac; \ done; \ done + $(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata_$(ABIFLAGS).py \ + $(DESTDIR)$(LIBDEST)/$(PLATDIR); \ + echo $(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata_$(ABIFLAGS).py \ + $(LIBDEST)/$(PLATDIR) $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \ $(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \ @@ -1336,13 +1342,19 @@ $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt # Create the PLATDIR source directory, if one wasn't distributed.. +# For multiarch targets, use the plat-linux/regen script. $(srcdir)/Lib/$(PLATDIR): mkdir $(srcdir)/Lib/$(PLATDIR) - cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen + if [ -n "$(MULTIARCH)" ]; then \ + cp $(srcdir)/Lib/plat-linux/regen $(srcdir)/Lib/$(PLATDIR)/regen; \ + else \ + cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen; \ + fi; \ export PATH; PATH="`pwd`:$$PATH"; \ export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \ export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \ export EXE; EXE="$(BUILDEXE)"; \ + export CC; CC="$(CC)"; \ if [ -n "$(MULTIARCH)" ]; then export MULTIARCH; MULTIARCH=$(MULTIARCH); fi; \ export PYTHON_FOR_BUILD; \ if [ "$(BUILD_GNU_TYPE)" = "$(HOST_GNU_TYPE)" ]; then \ @@ -1350,6 +1362,7 @@ else \ PYTHON_FOR_BUILD="$(PYTHON_FOR_BUILD)"; \ fi; \ + export H2PY; H2PY="$$PYTHON_FOR_BUILD $(abs_srcdir)/Tools/scripts/h2py.py"; \ cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh @@ -1448,7 +1461,7 @@ --install-scripts=$(BINDIR) \ --install-platlib=$(DESTSHARED) \ --root=$(DESTDIR)/ - -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata.py + -rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata_$(ABIFLAGS).py -rm -r $(DESTDIR)$(DESTSHARED)/__pycache__ # Here are a couple of targets for MacOSX again, to install a full @@ -1627,6 +1640,9 @@ -rm -rf build platform -rm -rf $(PYTHONFRAMEWORKDIR) -rm -f python-config.py python-config + if [ -n "$(MULTIARCH)" ]; then \ + rm -rf $(srcdir)/Lib/$(PLATDIR); \ + fi # Make things extra clean, before making a distribution: # remove all generated files, even Makefile[.pre] diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -25,6 +25,16 @@ - Issue #27310: Fix IDLE.app failure to launch on OS X due to vestigial import. +Build +----- + +- Issue #23968: Rename the platform directory from plat-$(MACHDEP) to + plat-$(PLATFORM_TRIPLET). + Rename the config directory (LIBPL) from config-$(LDVERSION) to + config-$(LDVERSION)-$(PLATFORM_TRIPLET). + Install the platform specifc _sysconfigdata module into the platform + directory and rename it to include the ABIFLAGS. + What's New in Python 3.6.0 alpha 2 ================================== diff --git a/Python/sysmodule.c b/Python/sysmodule.c --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1693,6 +1693,16 @@ if (res < 0) goto error; +#ifdef MULTIARCH + value = PyUnicode_FromString(MULTIARCH); + if (value == NULL) + goto error; + res = PyDict_SetItemString(impl_info, "_multiarch", value); + Py_DECREF(value); + if (res < 0) + goto error; +#endif + /* dict ready */ ns = _PyNamespace_New(impl_info); diff --git a/configure b/configure --- a/configure +++ b/configure @@ -704,6 +704,7 @@ BUILDEXEEXT EGREP NO_AS_NEEDED +MULTIARCH_CPPFLAGS PLATFORM_TRIPLET PLATDIR MULTIARCH @@ -776,6 +777,7 @@ docdir oldincludedir includedir +runstatedir localstatedir sharedstatedir sysconfdir @@ -886,6 +888,7 @@ sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1138,6 +1141,15 @@ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1275,7 +1287,7 @@ for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir + libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1428,6 +1440,7 @@ --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -2877,6 +2890,7 @@ + ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then @@ -5332,9 +5346,16 @@ as_fn_error $? "internal configure error for the platform triplet, please file a bug report" "$LINENO" 5 fi fi -PLATDIR=plat-$MACHDEP - - +if test x$PLATFORM_TRIPLET = x; then + PLATDIR=plat-$MACHDEP +else + PLATDIR=plat-$PLATFORM_TRIPLET +fi + + +if test x$MULTIARCH != x; then + MULTIARCH_CPPFLAGS="-DMULTIARCH=\\\"$MULTIARCH\\\"" +fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -Wl,--no-as-needed" >&5 @@ -14768,7 +14789,11 @@ $as_echo "$LDVERSION" >&6; } -LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}" +if test x$PLATFORM_TRIPLET = x; then + LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}" +else + LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}" +fi # Check whether right shifting a negative integer extends the sign bit diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -872,10 +872,17 @@ AC_MSG_ERROR([internal configure error for the platform triplet, please file a bug report]) fi fi -PLATDIR=plat-$MACHDEP +if test x$PLATFORM_TRIPLET = x; then + PLATDIR=plat-$MACHDEP +else + PLATDIR=plat-$PLATFORM_TRIPLET +fi AC_SUBST(PLATDIR) AC_SUBST(PLATFORM_TRIPLET) - +if test x$MULTIARCH != x; then + MULTIARCH_CPPFLAGS="-DMULTIARCH=\\\"$MULTIARCH\\\"" +fi +AC_SUBST(MULTIARCH_CPPFLAGS) AC_MSG_CHECKING([for -Wl,--no-as-needed]) save_LDFLAGS="$LDFLAGS" @@ -4462,7 +4469,11 @@ dnl define LIBPL after ABIFLAGS and LDVERSION is defined. AC_SUBST(PY_ENABLE_SHARED) -LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}" +if test x$PLATFORM_TRIPLET = x; then + LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}" +else + LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}" +fi AC_SUBST(LIBPL) # Check whether right shifting a negative integer extends the sign bit -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 03:04:01 2016 From: python-checkins at python.org (matthias.klose) Date: Tue, 14 Jun 2016 07:04:01 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_-_Issue_=238637=3A_Honor_a?= =?utf-8?q?_pager_set_by_the_env_var_MANPAGER_=28in_preference_to?= Message-ID: <20160614070400.101725.27924.E2D4D8C8@psf.io> https://hg.python.org/cpython/rev/dea9f9b5582b changeset: 102013:dea9f9b5582b user: doko at ubuntu.com date: Tue Jun 14 09:03:52 2016 +0200 summary: - Issue #8637: Honor a pager set by the env var MANPAGER (in preference to one set by the env var PAGER). files: Lib/pydoc.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/pydoc.py b/Lib/pydoc.py --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -1432,11 +1432,11 @@ use_pager = os.environ.get('MANPAGER') or os.environ.get('PAGER') if use_pager: if sys.platform == 'win32': # pipes completely broken in Windows - return lambda text: tempfilepager(plain(text), os.environ['PAGER']) + return lambda text: tempfilepager(plain(text), use_pager) elif os.environ.get('TERM') in ('dumb', 'emacs'): - return lambda text: pipepager(plain(text), os.environ['PAGER']) + return lambda text: pipepager(plain(text), use_pager) else: - return lambda text: pipepager(text, os.environ['PAGER']) + return lambda text: pipepager(text, use_pager) if os.environ.get('TERM') in ('dumb', 'emacs'): return plainpager if sys.platform == 'win32': -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 03:22:53 2016 From: python-checkins at python.org (matthias.klose) Date: Tue, 14 Jun 2016 07:22:53 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A__-_Issue_=2323968=3A_Updat?= =?utf-8?q?e_distutils/sysconfig=2Epy_to_look_for_the_renamed?= Message-ID: <20160614072224.28277.52078.59F5EC69@psf.io> https://hg.python.org/cpython/rev/a062c60c9f7d changeset: 102014:a062c60c9f7d user: doko at ubuntu.com date: Tue Jun 14 09:22:16 2016 +0200 summary: - Issue #23968: Update distutils/sysconfig.py to look for the renamed _sysconfigdata module too. files: Lib/distutils/sysconfig.py | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -418,7 +418,9 @@ def _init_posix(): """Initialize the module as appropriate for POSIX systems.""" # _sysconfigdata is generated at build time, see the sysconfig module - from _sysconfigdata import build_time_vars + name = '_sysconfigdata_' + sys.abiflags + _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0) + build_time_vars = _temp.build_time_vars global _config_vars _config_vars = {} _config_vars.update(build_time_vars) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 04:16:25 2016 From: python-checkins at python.org (matthias.klose) Date: Tue, 14 Jun 2016 08:16:25 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_-_Don=27t_use_largefile_su?= =?utf-8?q?pport_for_GNU/Hurd=2E?= Message-ID: <20160614081611.101526.62694.A14C1A25@psf.io> https://hg.python.org/cpython/rev/8d493e1ec34b changeset: 102015:8d493e1ec34b user: doko at ubuntu.com date: Tue Jun 14 10:15:25 2016 +0200 summary: - Don't use largefile support for GNU/Hurd. files: Misc/NEWS | 2 ++ configure | 6 +++++- configure.ac | 5 +++++ 3 files changed, 12 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -35,6 +35,8 @@ Install the platform specifc _sysconfigdata module into the platform directory and rename it to include the ABIFLAGS. +- Don't use largefile support for GNU/Hurd. + What's New in Python 3.6.0 alpha 2 ================================== diff --git a/configure b/configure --- a/configure +++ b/configure @@ -2890,7 +2890,6 @@ - ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then @@ -8018,6 +8017,11 @@ use_lfs=no fi +# Don't use largefile support for GNU/Hurd +case $ac_sys_system in GNU*) + use_lfs=no +esac + if test "$use_lfs" = "yes"; then # Two defines needed to enable largefile support on various platforms # These may affect some typedefs diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -1986,6 +1986,11 @@ use_lfs=no fi +# Don't use largefile support for GNU/Hurd +case $ac_sys_system in GNU*) + use_lfs=no +esac + if test "$use_lfs" = "yes"; then # Two defines needed to enable largefile support on various platforms # These may affect some typedefs -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Tue Jun 14 04:55:45 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 14 Jun 2016 08:55:45 +0000 Subject: [Python-checkins] Daily reference leaks (079794e90f4e): sum=0 Message-ID: <20160614085545.20127.56724.3B99F7AE@psf.io> results for 079794e90f4e on branch "default" -------------------------------------------- test_collections leaked [-4, 4, -4] memory blocks, sum=-4 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_spawn leaked [-2, 2, 0] memory blocks, sum=0 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogY5gKuM', '--timeout', '7200'] From python-checkins at python.org Tue Jun 14 05:02:06 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 14 Jun 2016 09:02:06 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE2MTgy?= =?utf-8?q?=3A_Backport_documentation_of_set=5Fpre=5Finput=5Fhook=28=29_av?= =?utf-8?q?ailability?= Message-ID: <20160614090205.99396.1697.C68E310B@psf.io> https://hg.python.org/cpython/rev/cff695a0b449 changeset: 102018:cff695a0b449 branch: 2.7 parent: 102000:5c8cddc4a8ee user: Martin Panter date: Tue Jun 14 08:45:43 2016 +0000 summary: Issue #16182: Backport documentation of set_pre_input_hook() availability files: Doc/library/readline.rst | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Doc/library/readline.rst b/Doc/library/readline.rst --- a/Doc/library/readline.rst +++ b/Doc/library/readline.rst @@ -186,7 +186,8 @@ be used as the new hook function; if omitted or ``None``, any function already installed is removed. The hook is called with no arguments after the first prompt has been printed and just before - readline starts reading input characters. + readline starts reading input characters. This function only exists + if Python was compiled for a version of the library that supports it. Completion -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 05:02:16 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 14 Jun 2016 09:02:16 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2316182=3A_Merge_readline_update_from_3=2E5?= Message-ID: <20160614090205.26023.99393.639406CD@psf.io> https://hg.python.org/cpython/rev/c4dd384ee3fa changeset: 102017:c4dd384ee3fa parent: 102015:8d493e1ec34b parent: 102016:005cab4f5629 user: Martin Panter date: Tue Jun 14 08:49:51 2016 +0000 summary: Issue #16182: Merge readline update from 3.5 files: Doc/library/readline.rst | 7 +++++-- Lib/test/test_readline.py | 22 +++++++++++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Doc/library/readline.rst b/Doc/library/readline.rst --- a/Doc/library/readline.rst +++ b/Doc/library/readline.rst @@ -104,7 +104,9 @@ Append the last *nelements* items of history to a file. The default filename is :file:`~/.history`. The file must already exist. This calls - :c:func:`append_history` in the underlying library. + :c:func:`append_history` in the underlying library. This function + only exists if Python was compiled for a version of the library + that supports it. .. versionadded:: 3.5 @@ -199,7 +201,8 @@ be used as the new hook function; if omitted or ``None``, any function already installed is removed. The hook is called with no arguments after the first prompt has been printed and just before - readline starts reading input characters. + readline starts reading input characters. This function only exists + if Python was compiled for a version of the library that supports it. Completion diff --git a/Lib/test/test_readline.py b/Lib/test/test_readline.py --- a/Lib/test/test_readline.py +++ b/Lib/test/test_readline.py @@ -144,24 +144,32 @@ script = r"""import readline -if readline.__doc__ and "libedit" in readline.__doc__: +is_editline = readline.__doc__ and "libedit" in readline.__doc__ +inserted = "[\xEFnserted]" +macro = "|t\xEB[after]" +set_pre_input_hook = getattr(readline, "set_pre_input_hook", None) +if is_editline or not set_pre_input_hook: + # The insert_line() call via pre_input_hook() does nothing with Editline, + # so include the extra text that would have been inserted here + macro = inserted + macro + +if is_editline: readline.parse_and_bind(r'bind ^B ed-prev-char') readline.parse_and_bind(r'bind "\t" rl_complete') - # The insert_line() call via pre_input_hook() does nothing with Editline, - # so include the extra text that would have been inserted here - readline.parse_and_bind('bind -s ^A "[\xEFnserted]|t\xEB[after]"') + readline.parse_and_bind(r'bind -s ^A "{}"'.format(macro)) else: readline.parse_and_bind(r'Control-b: backward-char') readline.parse_and_bind(r'"\t": complete') readline.parse_and_bind(r'set disable-completion off') readline.parse_and_bind(r'set show-all-if-ambiguous off') readline.parse_and_bind(r'set show-all-if-unmodified off') - readline.parse_and_bind('Control-a: "|t\xEB[after]"') + readline.parse_and_bind(r'Control-a: "{}"'.format(macro)) def pre_input_hook(): - readline.insert_text("[\xEFnserted]") + readline.insert_text(inserted) readline.redisplay() -readline.set_pre_input_hook(pre_input_hook) +if set_pre_input_hook: + set_pre_input_hook(pre_input_hook) def completer(text, state): if text == "t\xEB": -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 05:02:16 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 14 Jun 2016 09:02:16 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzE2MTgy?= =?utf-8?q?=3A_set=5Fpre=5Finput=5Fhook=28=29_may_not_exist=3B_document=2C?= =?utf-8?q?_and_update_test?= Message-ID: <20160614090204.11470.55148.6373DE4E@psf.io> https://hg.python.org/cpython/rev/005cab4f5629 changeset: 102016:005cab4f5629 branch: 3.5 parent: 102010:376a379f12fe user: Martin Panter date: Tue Jun 14 08:45:43 2016 +0000 summary: Issue #16182: set_pre_input_hook() may not exist; document, and update test files: Doc/library/readline.rst | 7 +++++-- Lib/test/test_readline.py | 22 +++++++++++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Doc/library/readline.rst b/Doc/library/readline.rst --- a/Doc/library/readline.rst +++ b/Doc/library/readline.rst @@ -104,7 +104,9 @@ Append the last *nelements* items of history to a file. The default filename is :file:`~/.history`. The file must already exist. This calls - :c:func:`append_history` in the underlying library. + :c:func:`append_history` in the underlying library. This function + only exists if Python was compiled for a version of the library + that supports it. .. versionadded:: 3.5 @@ -185,7 +187,8 @@ be used as the new hook function; if omitted or ``None``, any function already installed is removed. The hook is called with no arguments after the first prompt has been printed and just before - readline starts reading input characters. + readline starts reading input characters. This function only exists + if Python was compiled for a version of the library that supports it. Completion diff --git a/Lib/test/test_readline.py b/Lib/test/test_readline.py --- a/Lib/test/test_readline.py +++ b/Lib/test/test_readline.py @@ -129,24 +129,32 @@ script = r"""import readline -if readline.__doc__ and "libedit" in readline.__doc__: +is_editline = readline.__doc__ and "libedit" in readline.__doc__ +inserted = "[\xEFnserted]" +macro = "|t\xEB[after]" +set_pre_input_hook = getattr(readline, "set_pre_input_hook", None) +if is_editline or not set_pre_input_hook: + # The insert_line() call via pre_input_hook() does nothing with Editline, + # so include the extra text that would have been inserted here + macro = inserted + macro + +if is_editline: readline.parse_and_bind(r'bind ^B ed-prev-char') readline.parse_and_bind(r'bind "\t" rl_complete') - # The insert_line() call via pre_input_hook() does nothing with Editline, - # so include the extra text that would have been inserted here - readline.parse_and_bind('bind -s ^A "[\xEFnserted]|t\xEB[after]"') + readline.parse_and_bind(r'bind -s ^A "{}"'.format(macro)) else: readline.parse_and_bind(r'Control-b: backward-char') readline.parse_and_bind(r'"\t": complete') readline.parse_and_bind(r'set disable-completion off') readline.parse_and_bind(r'set show-all-if-ambiguous off') readline.parse_and_bind(r'set show-all-if-unmodified off') - readline.parse_and_bind('Control-a: "|t\xEB[after]"') + readline.parse_and_bind(r'Control-a: "{}"'.format(macro)) def pre_input_hook(): - readline.insert_text("[\xEFnserted]") + readline.insert_text(inserted) readline.redisplay() -readline.set_pre_input_hook(pre_input_hook) +if set_pre_input_hook: + set_pre_input_hook(pre_input_hook) def completer(text, state): if text == "t\xEB": -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 05:46:22 2016 From: python-checkins at python.org (xavier.degaye) Date: Tue, 14 Jun 2016 09:46:22 +0000 Subject: [Python-checkins] =?utf-8?q?devguide=3A_Issue_=2327270=3A_=60pare?= =?utf-8?q?ntheses-equality=60_warnings_when_building_with_clang_and?= Message-ID: <20160614094621.28042.28646.D2EEF348@psf.io> https://hg.python.org/devguide/rev/18e960f930ab changeset: 810:18e960f930ab user: Xavier de Gaye date: Tue Jun 14 11:45:34 2016 +0200 summary: Issue #27270: `parentheses-equality` warnings when building with clang and ccache. files: setup.rst | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/setup.rst b/setup.rst --- a/setup.rst +++ b/setup.rst @@ -182,6 +182,7 @@ root access is beyond the scope of this guide. .. _clang: http://clang.llvm.org/ +.. _ccache: https://ccache.samba.org/ .. note:: While you need a C compiler to build CPython, you don't need any knowledge of the C language to contribute! Vast areas of CPython are @@ -247,6 +248,12 @@ ``-Wno-unused-value -Wno-empty-body -Qunused-arguments``. You can set your ``CFLAGS`` environment variable to these flags when running ``configure``. +If you are using clang_ with ccache_, turn off the noisy +``parentheses-equality`` warnings with the ``-Wno-parentheses-equality`` flag. +These warnings are caused by clang not having enough information to detect +that extraneous parentheses in expanded macros are valid, because the +preprocessing is done separately by ccache. + If you are using LLVM 2.8, also use the ``-no-integrated-as`` flag in order to build the :py:mod:`ctypes` module (without the flag the rest of CPython will still build properly). -- Repository URL: https://hg.python.org/devguide From python-checkins at python.org Tue Jun 14 05:46:44 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 14 Jun 2016 09:46:44 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI2Mzg2?= =?utf-8?q?=3A_Fixed_ttk=2ETreeView_selection_operations_with_item_id=27s?= Message-ID: <20160614094642.26389.42179.B3D562B3@psf.io> https://hg.python.org/cpython/rev/ac7c10f5e36e changeset: 102021:ac7c10f5e36e branch: 2.7 parent: 102018:cff695a0b449 user: Serhiy Storchaka date: Tue Jun 14 12:46:14 2016 +0300 summary: Issue #26386: Fixed ttk.TreeView selection operations with item id's containing spaces. files: Lib/lib-tk/test/test_ttk/test_widgets.py | 60 +++++++++++- Lib/lib-tk/ttk.py | 4 +- Misc/NEWS | 3 + 3 files changed, 65 insertions(+), 2 deletions(-) diff --git a/Lib/lib-tk/test/test_ttk/test_widgets.py b/Lib/lib-tk/test/test_ttk/test_widgets.py --- a/Lib/lib-tk/test/test_ttk/test_widgets.py +++ b/Lib/lib-tk/test/test_ttk/test_widgets.py @@ -2,7 +2,7 @@ import Tkinter as tkinter from Tkinter import TclError import ttk -from test.test_support import requires, run_unittest +from test.test_support import requires, run_unittest, have_unicode, u import sys from test_functions import MockTclObj @@ -1486,6 +1486,60 @@ value) + def test_selection(self): + # item 'none' doesn't exist + self.assertRaises(tkinter.TclError, self.tv.selection_set, 'none') + self.assertRaises(tkinter.TclError, self.tv.selection_add, 'none') + self.assertRaises(tkinter.TclError, self.tv.selection_remove, 'none') + self.assertRaises(tkinter.TclError, self.tv.selection_toggle, 'none') + + item1 = self.tv.insert('', 'end') + item2 = self.tv.insert('', 'end') + c1 = self.tv.insert(item1, 'end') + c2 = self.tv.insert(item1, 'end') + c3 = self.tv.insert(item1, 'end') + self.assertEqual(self.tv.selection(), ()) + + self.tv.selection_set((c1, item2)) + self.assertEqual(self.tv.selection(), (c1, item2)) + self.tv.selection_set(c2) + self.assertEqual(self.tv.selection(), (c2,)) + + self.tv.selection_add((c1, item2)) + self.assertEqual(self.tv.selection(), (c1, c2, item2)) + self.tv.selection_add(item1) + self.assertEqual(self.tv.selection(), (item1, c1, c2, item2)) + + self.tv.selection_remove((item1, c3)) + self.assertEqual(self.tv.selection(), (c1, c2, item2)) + self.tv.selection_remove(c2) + self.assertEqual(self.tv.selection(), (c1, item2)) + + self.tv.selection_toggle((c1, c3)) + self.assertEqual(self.tv.selection(), (c3, item2)) + self.tv.selection_toggle(item2) + self.assertEqual(self.tv.selection(), (c3,)) + + self.tv.insert('', 'end', id='with spaces') + self.tv.selection_set('with spaces') + self.assertEqual(self.tv.selection(), ('with spaces',)) + + self.tv.insert('', 'end', id='{brace') + self.tv.selection_set('{brace') + self.assertEqual(self.tv.selection(), ('{brace',)) + + if have_unicode: + self.tv.insert('', 'end', id=u(r'unicode\u20ac')) + self.tv.selection_set(u(r'unicode\u20ac')) + self.assertEqual(self.tv.selection(), (u(r'unicode\u20ac'),)) + + self.tv.insert('', 'end', id='bytes\xe2\x82\xac') + self.tv.selection_set('bytes\xe2\x82\xac') + self.assertEqual(self.tv.selection(), + (u(r'bytes\u20ac') if have_unicode else + 'bytes\xe2\x82\xac',)) + + def test_set(self): self.tv['columns'] = ['A', 'B'] item = self.tv.insert('', 'end', values=['a', 'b']) @@ -1612,5 +1666,9 @@ SizegripTest, TreeviewTest, WidgetTest, ) +tests_gui = ( + TreeviewTest, + ) + if __name__ == "__main__": run_unittest(*tests_gui) diff --git a/Lib/lib-tk/ttk.py b/Lib/lib-tk/ttk.py --- a/Lib/lib-tk/ttk.py +++ b/Lib/lib-tk/ttk.py @@ -1394,7 +1394,9 @@ def selection(self, selop=None, items=None): """If selop is not specified, returns selected items.""" - return self.tk.call(self._w, "selection", selop, items) + if isinstance(items, basestring): + items = (items,) + return self.tk.splitlist(self.tk.call(self._w, "selection", selop, items)) def selection_set(self, items): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,9 @@ Library ------- +- Issue #26386: Fixed ttk.TreeView selection operations with item id's + containing spaces. + - Issue #25455: Fixed a crash in repr of cElementTree.Element with recursive tag. Documentation -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 05:46:44 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 14 Jun 2016 09:46:44 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI2Mzg2?= =?utf-8?q?=3A_Fixed_ttk=2ETreeView_selection_operations_with_item_id=27s?= Message-ID: <20160614094642.101651.5276.39B67808@psf.io> https://hg.python.org/cpython/rev/0885477fecfd changeset: 102019:0885477fecfd branch: 3.5 parent: 102016:005cab4f5629 user: Serhiy Storchaka date: Tue Jun 14 12:33:31 2016 +0300 summary: Issue #26386: Fixed ttk.TreeView selection operations with item id's containing spaces. files: Lib/tkinter/test/test_ttk/test_widgets.py | 51 +++++++++++ Lib/tkinter/ttk.py | 4 +- Misc/NEWS | 3 + 3 files changed, 57 insertions(+), 1 deletions(-) diff --git a/Lib/tkinter/test/test_ttk/test_widgets.py b/Lib/tkinter/test/test_ttk/test_widgets.py --- a/Lib/tkinter/test/test_ttk/test_widgets.py +++ b/Lib/tkinter/test/test_ttk/test_widgets.py @@ -1486,6 +1486,57 @@ value) + def test_selection(self): + # item 'none' doesn't exist + self.assertRaises(tkinter.TclError, self.tv.selection_set, 'none') + self.assertRaises(tkinter.TclError, self.tv.selection_add, 'none') + self.assertRaises(tkinter.TclError, self.tv.selection_remove, 'none') + self.assertRaises(tkinter.TclError, self.tv.selection_toggle, 'none') + + item1 = self.tv.insert('', 'end') + item2 = self.tv.insert('', 'end') + c1 = self.tv.insert(item1, 'end') + c2 = self.tv.insert(item1, 'end') + c3 = self.tv.insert(item1, 'end') + self.assertEqual(self.tv.selection(), ()) + + self.tv.selection_set((c1, item2)) + self.assertEqual(self.tv.selection(), (c1, item2)) + self.tv.selection_set(c2) + self.assertEqual(self.tv.selection(), (c2,)) + + self.tv.selection_add((c1, item2)) + self.assertEqual(self.tv.selection(), (c1, c2, item2)) + self.tv.selection_add(item1) + self.assertEqual(self.tv.selection(), (item1, c1, c2, item2)) + + self.tv.selection_remove((item1, c3)) + self.assertEqual(self.tv.selection(), (c1, c2, item2)) + self.tv.selection_remove(c2) + self.assertEqual(self.tv.selection(), (c1, item2)) + + self.tv.selection_toggle((c1, c3)) + self.assertEqual(self.tv.selection(), (c3, item2)) + self.tv.selection_toggle(item2) + self.assertEqual(self.tv.selection(), (c3,)) + + self.tv.insert('', 'end', id='with spaces') + self.tv.selection_set('with spaces') + self.assertEqual(self.tv.selection(), ('with spaces',)) + + self.tv.insert('', 'end', id='{brace') + self.tv.selection_set('{brace') + self.assertEqual(self.tv.selection(), ('{brace',)) + + self.tv.insert('', 'end', id='unicode\u20ac') + self.tv.selection_set('unicode\u20ac') + self.assertEqual(self.tv.selection(), ('unicode\u20ac',)) + + self.tv.insert('', 'end', id=b'bytes\xe2\x82\xac') + self.tv.selection_set(b'bytes\xe2\x82\xac') + self.assertEqual(self.tv.selection(), ('bytes\xe2\x82\xac',)) + + def test_set(self): self.tv['columns'] = ['A', 'B'] item = self.tv.insert('', 'end', values=['a', 'b']) diff --git a/Lib/tkinter/ttk.py b/Lib/tkinter/ttk.py --- a/Lib/tkinter/ttk.py +++ b/Lib/tkinter/ttk.py @@ -1392,7 +1392,9 @@ def selection(self, selop=None, items=None): """If selop is not specified, returns selected items.""" - return self.tk.call(self._w, "selection", selop, items) + if isinstance(items, (str, bytes)): + items = (items,) + return self.tk.splitlist(self.tk.call(self._w, "selection", selop, items)) def selection_set(self, items): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,9 @@ Library ------- +- Issue #26386: Fixed ttk.TreeView selection operations with item id's + containing spaces. + - Issue #22636: Avoid shell injection problems with ctypes.util.find_library(). -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 05:46:44 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 14 Jun 2016 09:46:44 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2326386=3A_Fixed_ttk=2ETreeView_selection_operati?= =?utf-8?q?ons_with_item_id=27s?= Message-ID: <20160614094642.114361.14035.EB383C81@psf.io> https://hg.python.org/cpython/rev/d1c0bc1d0625 changeset: 102020:d1c0bc1d0625 parent: 102017:c4dd384ee3fa parent: 102019:0885477fecfd user: Serhiy Storchaka date: Tue Jun 14 12:39:18 2016 +0300 summary: Issue #26386: Fixed ttk.TreeView selection operations with item id's containing spaces. files: Lib/tkinter/test/test_ttk/test_widgets.py | 51 +++++++++++ Lib/tkinter/ttk.py | 4 +- Misc/NEWS | 3 + 3 files changed, 57 insertions(+), 1 deletions(-) diff --git a/Lib/tkinter/test/test_ttk/test_widgets.py b/Lib/tkinter/test/test_ttk/test_widgets.py --- a/Lib/tkinter/test/test_ttk/test_widgets.py +++ b/Lib/tkinter/test/test_ttk/test_widgets.py @@ -1486,6 +1486,57 @@ value) + def test_selection(self): + # item 'none' doesn't exist + self.assertRaises(tkinter.TclError, self.tv.selection_set, 'none') + self.assertRaises(tkinter.TclError, self.tv.selection_add, 'none') + self.assertRaises(tkinter.TclError, self.tv.selection_remove, 'none') + self.assertRaises(tkinter.TclError, self.tv.selection_toggle, 'none') + + item1 = self.tv.insert('', 'end') + item2 = self.tv.insert('', 'end') + c1 = self.tv.insert(item1, 'end') + c2 = self.tv.insert(item1, 'end') + c3 = self.tv.insert(item1, 'end') + self.assertEqual(self.tv.selection(), ()) + + self.tv.selection_set((c1, item2)) + self.assertEqual(self.tv.selection(), (c1, item2)) + self.tv.selection_set(c2) + self.assertEqual(self.tv.selection(), (c2,)) + + self.tv.selection_add((c1, item2)) + self.assertEqual(self.tv.selection(), (c1, c2, item2)) + self.tv.selection_add(item1) + self.assertEqual(self.tv.selection(), (item1, c1, c2, item2)) + + self.tv.selection_remove((item1, c3)) + self.assertEqual(self.tv.selection(), (c1, c2, item2)) + self.tv.selection_remove(c2) + self.assertEqual(self.tv.selection(), (c1, item2)) + + self.tv.selection_toggle((c1, c3)) + self.assertEqual(self.tv.selection(), (c3, item2)) + self.tv.selection_toggle(item2) + self.assertEqual(self.tv.selection(), (c3,)) + + self.tv.insert('', 'end', id='with spaces') + self.tv.selection_set('with spaces') + self.assertEqual(self.tv.selection(), ('with spaces',)) + + self.tv.insert('', 'end', id='{brace') + self.tv.selection_set('{brace') + self.assertEqual(self.tv.selection(), ('{brace',)) + + self.tv.insert('', 'end', id='unicode\u20ac') + self.tv.selection_set('unicode\u20ac') + self.assertEqual(self.tv.selection(), ('unicode\u20ac',)) + + self.tv.insert('', 'end', id=b'bytes\xe2\x82\xac') + self.tv.selection_set(b'bytes\xe2\x82\xac') + self.assertEqual(self.tv.selection(), ('bytes\xe2\x82\xac',)) + + def test_set(self): self.tv['columns'] = ['A', 'B'] item = self.tv.insert('', 'end', values=['a', 'b']) diff --git a/Lib/tkinter/ttk.py b/Lib/tkinter/ttk.py --- a/Lib/tkinter/ttk.py +++ b/Lib/tkinter/ttk.py @@ -1396,7 +1396,9 @@ def selection(self, selop=None, items=None): """If selop is not specified, returns selected items.""" - return self.tk.call(self._w, "selection", selop, items) + if isinstance(items, (str, bytes)): + items = (items,) + return self.tk.splitlist(self.tk.call(self._w, "selection", selop, items)) def selection_set(self, items): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Library ------- +- Issue #26386: Fixed ttk.TreeView selection operations with item id's + containing spaces. + - Issue #8637: Honor a pager set by the env var MANPAGER (in preference to one set by the env var PAGER). -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 05:51:09 2016 From: python-checkins at python.org (berker.peksag) Date: Tue, 14 Jun 2016 09:51:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5?= Message-ID: <20160614095108.9708.31349.95C4A764@psf.io> https://hg.python.org/cpython/rev/5e24a791303b changeset: 102023:5e24a791303b parent: 102020:d1c0bc1d0625 parent: 102022:e02298f48b49 user: Berker Peksag date: Tue Jun 14 12:51:28 2016 +0300 summary: Merge from 3.5 files: Doc/library/sqlite3.rst | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -489,10 +489,6 @@ :mod:`sqlite3` module will return Unicode objects for ``TEXT``. If you want to return bytestrings instead, you can set it to :class:`bytes`. - For efficiency reasons, there's also a way to return :class:`str` objects - only for non-ASCII data, and :class:`bytes` otherwise. To activate it, set - this attribute to :const:`sqlite3.OptimizedUnicode`. - You can also set it to any other callable that accepts a single bytestring parameter and returns the resulting object. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 05:51:09 2016 From: python-checkins at python.org (berker.peksag) Date: Tue, 14 Jun 2016 09:51:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Delete_outdate?= =?utf-8?q?d_paragraph_about_OptimizedUnicode_again?= Message-ID: <20160614095107.99256.19029.3F5D362F@psf.io> https://hg.python.org/cpython/rev/e02298f48b49 changeset: 102022:e02298f48b49 branch: 3.5 parent: 102019:0885477fecfd user: Berker Peksag date: Tue Jun 14 12:51:07 2016 +0300 summary: Delete outdated paragraph about OptimizedUnicode again sqlite3.OptimizedUnicode is an alias for str in Python 3 and its behavior is already tested in CheckOptimizedUnicode in Lib/sqlite3/test/factory.py. sqlite3.OptimizedUnicode was undocumented in 0fc10a33eb4c and probably added back with the result of a bad merge. files: Doc/library/sqlite3.rst | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -489,10 +489,6 @@ :mod:`sqlite3` module will return Unicode objects for ``TEXT``. If you want to return bytestrings instead, you can set it to :class:`bytes`. - For efficiency reasons, there's also a way to return :class:`str` objects - only for non-ASCII data, and :class:`bytes` otherwise. To activate it, set - this attribute to :const:`sqlite3.OptimizedUnicode`. - You can also set it to any other callable that accepts a single bytestring parameter and returns the resulting object. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 06:25:13 2016 From: python-checkins at python.org (berker.peksag) Date: Tue, 14 Jun 2016 10:25:13 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Remove_empty_s?= =?utf-8?q?etUp_and_tearDown_methods_from_sqlite3_tests?= Message-ID: <20160614102512.11591.22168.32BCD727@psf.io> https://hg.python.org/cpython/rev/38c1ccdfd38a changeset: 102024:38c1ccdfd38a branch: 3.5 parent: 102022:e02298f48b49 user: Berker Peksag date: Tue Jun 14 13:25:11 2016 +0300 summary: Remove empty setUp and tearDown methods from sqlite3 tests They are not used as base classes by another tests so they can safely be removed. files: Lib/sqlite3/test/dbapi.py | 12 ------------ Lib/sqlite3/test/hooks.py | 6 ------ 2 files changed, 0 insertions(+), 18 deletions(-) diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py --- a/Lib/sqlite3/test/dbapi.py +++ b/Lib/sqlite3/test/dbapi.py @@ -695,12 +695,6 @@ self.assertEqual(result, 5, "Basic test of Connection.executescript") class ClosedConTests(unittest.TestCase): - def setUp(self): - pass - - def tearDown(self): - pass - def CheckClosedConCursor(self): con = sqlite.connect(":memory:") con.close() @@ -768,12 +762,6 @@ con() class ClosedCurTests(unittest.TestCase): - def setUp(self): - pass - - def tearDown(self): - pass - def CheckClosed(self): con = sqlite.connect(":memory:") cur = con.cursor() diff --git a/Lib/sqlite3/test/hooks.py b/Lib/sqlite3/test/hooks.py --- a/Lib/sqlite3/test/hooks.py +++ b/Lib/sqlite3/test/hooks.py @@ -25,12 +25,6 @@ import sqlite3 as sqlite class CollationTests(unittest.TestCase): - def setUp(self): - pass - - def tearDown(self): - pass - def CheckCreateCollationNotCallable(self): con = sqlite.connect(":memory:") with self.assertRaises(TypeError) as cm: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 06:25:13 2016 From: python-checkins at python.org (berker.peksag) Date: Tue, 14 Jun 2016 10:25:13 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5?= Message-ID: <20160614102512.28015.81549.9F623E26@psf.io> https://hg.python.org/cpython/rev/4c7187448c62 changeset: 102025:4c7187448c62 parent: 102023:5e24a791303b parent: 102024:38c1ccdfd38a user: Berker Peksag date: Tue Jun 14 13:25:35 2016 +0300 summary: Merge from 3.5 files: Lib/sqlite3/test/dbapi.py | 12 ------------ Lib/sqlite3/test/hooks.py | 6 ------ 2 files changed, 0 insertions(+), 18 deletions(-) diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py --- a/Lib/sqlite3/test/dbapi.py +++ b/Lib/sqlite3/test/dbapi.py @@ -695,12 +695,6 @@ self.assertEqual(result, 5, "Basic test of Connection.executescript") class ClosedConTests(unittest.TestCase): - def setUp(self): - pass - - def tearDown(self): - pass - def CheckClosedConCursor(self): con = sqlite.connect(":memory:") con.close() @@ -768,12 +762,6 @@ con() class ClosedCurTests(unittest.TestCase): - def setUp(self): - pass - - def tearDown(self): - pass - def CheckClosed(self): con = sqlite.connect(":memory:") cur = con.cursor() diff --git a/Lib/sqlite3/test/hooks.py b/Lib/sqlite3/test/hooks.py --- a/Lib/sqlite3/test/hooks.py +++ b/Lib/sqlite3/test/hooks.py @@ -25,12 +25,6 @@ import sqlite3 as sqlite class CollationTests(unittest.TestCase): - def setUp(self): - pass - - def tearDown(self): - pass - def CheckCreateCollationNotCallable(self): con = sqlite.connect(":memory:") with self.assertRaises(TypeError) as cm: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 07:19:13 2016 From: python-checkins at python.org (berker.peksag) Date: Tue, 14 Jun 2016 11:19:13 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5?= Message-ID: <20160614111911.20084.89631.EA6E8E01@psf.io> https://hg.python.org/cpython/rev/b907321fec78 changeset: 102027:b907321fec78 parent: 102025:4c7187448c62 parent: 102026:b1d27f36b8e1 user: Berker Peksag date: Tue Jun 14 14:19:33 2016 +0300 summary: Merge from 3.5 files: Lib/sqlite3/test/dbapi.py | 4 ++-- Lib/sqlite3/test/regression.py | 3 +-- Lib/sqlite3/test/transactions.py | 12 ++++-------- Lib/sqlite3/test/types.py | 6 ++---- 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py --- a/Lib/sqlite3/test/dbapi.py +++ b/Lib/sqlite3/test/dbapi.py @@ -177,9 +177,9 @@ with self.assertRaises(sqlite.OperationalError): cx.execute('insert into test(id) values(1)') + @unittest.skipIf(sqlite.sqlite_version_info >= (3, 3, 1), + 'needs sqlite versions older than 3.3.1') def CheckSameThreadErrorOnOldVersion(self): - if sqlite.sqlite_version_info >= (3, 3, 1): - self.skipTest('test needs sqlite3 versions older than 3.3.1') with self.assertRaises(sqlite.NotSupportedError) as cm: sqlite.connect(':memory:', check_same_thread=False) self.assertEqual(str(cm.exception), 'shared connections not available') diff --git a/Lib/sqlite3/test/regression.py b/Lib/sqlite3/test/regression.py --- a/Lib/sqlite3/test/regression.py +++ b/Lib/sqlite3/test/regression.py @@ -84,9 +84,8 @@ cur.execute("select 1 x union select " + str(i)) con.close() + @unittest.skipIf(sqlite.sqlite_version_info < (3, 2, 2), 'needs sqlite 3.2.2 or newer') def CheckOnConflictRollback(self): - if sqlite.sqlite_version_info < (3, 2, 2): - return con = sqlite.connect(":memory:") con.execute("create table foo(x, unique(x) on conflict rollback)") con.execute("insert into foo(x) values (1)") diff --git a/Lib/sqlite3/test/transactions.py b/Lib/sqlite3/test/transactions.py --- a/Lib/sqlite3/test/transactions.py +++ b/Lib/sqlite3/test/transactions.py @@ -111,25 +111,21 @@ res = self.cur2.fetchall() self.assertEqual(len(res), 1) + @unittest.skipIf(sqlite.sqlite_version_info < (3, 2, 2), + 'test hangs on sqlite versions older than 3.2.2') def CheckRaiseTimeout(self): - if sqlite.sqlite_version_info < (3, 2, 2): - # This will fail (hang) on earlier versions of sqlite. - # Determine exact version it was fixed. 3.2.1 hangs. - return self.cur1.execute("create table test(i)") self.cur1.execute("insert into test(i) values (5)") with self.assertRaises(sqlite.OperationalError): self.cur2.execute("insert into test(i) values (5)") + @unittest.skipIf(sqlite.sqlite_version_info < (3, 2, 2), + 'test hangs on sqlite versions older than 3.2.2') def CheckLocking(self): """ This tests the improved concurrency with pysqlite 2.3.4. You needed to roll back con2 before you could commit con1. """ - if sqlite.sqlite_version_info < (3, 2, 2): - # This will fail (hang) on earlier versions of sqlite. - # Determine exact version it was fixed. 3.2.1 hangs. - return self.cur1.execute("create table test(i)") self.cur1.execute("insert into test(i) values (5)") with self.assertRaises(sqlite.OperationalError): diff --git a/Lib/sqlite3/test/types.py b/Lib/sqlite3/test/types.py --- a/Lib/sqlite3/test/types.py +++ b/Lib/sqlite3/test/types.py @@ -340,11 +340,9 @@ ts2 = self.cur.fetchone()[0] self.assertEqual(ts, ts2) + @unittest.skipIf(sqlite.sqlite_version_info < (3, 1), + 'the date functions are available on 3.1 or later') def CheckSqlTimestamp(self): - # The date functions are only available in SQLite version 3.1 or later - if sqlite.sqlite_version_info < (3, 1): - return - # SQLite's current_timestamp uses UTC time, while datetime.datetime.now() uses local time. now = datetime.datetime.now() self.cur.execute("insert into test(ts) values (current_timestamp)") -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 07:19:15 2016 From: python-checkins at python.org (berker.peksag) Date: Tue, 14 Jun 2016 11:19:15 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Mark_tests_as_?= =?utf-8?q?skipped_when_a_SQLite_version_is_not_supported?= Message-ID: <20160614111911.114506.91270.13263816@psf.io> https://hg.python.org/cpython/rev/b1d27f36b8e1 changeset: 102026:b1d27f36b8e1 branch: 3.5 parent: 102024:38c1ccdfd38a user: Berker Peksag date: Tue Jun 14 14:19:02 2016 +0300 summary: Mark tests as skipped when a SQLite version is not supported files: Lib/sqlite3/test/dbapi.py | 4 ++-- Lib/sqlite3/test/regression.py | 3 +-- Lib/sqlite3/test/transactions.py | 12 ++++-------- Lib/sqlite3/test/types.py | 6 ++---- 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py --- a/Lib/sqlite3/test/dbapi.py +++ b/Lib/sqlite3/test/dbapi.py @@ -177,9 +177,9 @@ with self.assertRaises(sqlite.OperationalError): cx.execute('insert into test(id) values(1)') + @unittest.skipIf(sqlite.sqlite_version_info >= (3, 3, 1), + 'needs sqlite versions older than 3.3.1') def CheckSameThreadErrorOnOldVersion(self): - if sqlite.sqlite_version_info >= (3, 3, 1): - self.skipTest('test needs sqlite3 versions older than 3.3.1') with self.assertRaises(sqlite.NotSupportedError) as cm: sqlite.connect(':memory:', check_same_thread=False) self.assertEqual(str(cm.exception), 'shared connections not available') diff --git a/Lib/sqlite3/test/regression.py b/Lib/sqlite3/test/regression.py --- a/Lib/sqlite3/test/regression.py +++ b/Lib/sqlite3/test/regression.py @@ -84,9 +84,8 @@ cur.execute("select 1 x union select " + str(i)) con.close() + @unittest.skipIf(sqlite.sqlite_version_info < (3, 2, 2), 'needs sqlite 3.2.2 or newer') def CheckOnConflictRollback(self): - if sqlite.sqlite_version_info < (3, 2, 2): - return con = sqlite.connect(":memory:") con.execute("create table foo(x, unique(x) on conflict rollback)") con.execute("insert into foo(x) values (1)") diff --git a/Lib/sqlite3/test/transactions.py b/Lib/sqlite3/test/transactions.py --- a/Lib/sqlite3/test/transactions.py +++ b/Lib/sqlite3/test/transactions.py @@ -111,25 +111,21 @@ res = self.cur2.fetchall() self.assertEqual(len(res), 1) + @unittest.skipIf(sqlite.sqlite_version_info < (3, 2, 2), + 'test hangs on sqlite versions older than 3.2.2') def CheckRaiseTimeout(self): - if sqlite.sqlite_version_info < (3, 2, 2): - # This will fail (hang) on earlier versions of sqlite. - # Determine exact version it was fixed. 3.2.1 hangs. - return self.cur1.execute("create table test(i)") self.cur1.execute("insert into test(i) values (5)") with self.assertRaises(sqlite.OperationalError): self.cur2.execute("insert into test(i) values (5)") + @unittest.skipIf(sqlite.sqlite_version_info < (3, 2, 2), + 'test hangs on sqlite versions older than 3.2.2') def CheckLocking(self): """ This tests the improved concurrency with pysqlite 2.3.4. You needed to roll back con2 before you could commit con1. """ - if sqlite.sqlite_version_info < (3, 2, 2): - # This will fail (hang) on earlier versions of sqlite. - # Determine exact version it was fixed. 3.2.1 hangs. - return self.cur1.execute("create table test(i)") self.cur1.execute("insert into test(i) values (5)") with self.assertRaises(sqlite.OperationalError): diff --git a/Lib/sqlite3/test/types.py b/Lib/sqlite3/test/types.py --- a/Lib/sqlite3/test/types.py +++ b/Lib/sqlite3/test/types.py @@ -340,11 +340,9 @@ ts2 = self.cur.fetchone()[0] self.assertEqual(ts, ts2) + @unittest.skipIf(sqlite.sqlite_version_info < (3, 1), + 'the date functions are available on 3.1 or later') def CheckSqlTimestamp(self): - # The date functions are only available in SQLite version 3.1 or later - if sqlite.sqlite_version_info < (3, 1): - return - # SQLite's current_timestamp uses UTC time, while datetime.datetime.now() uses local time. now = datetime.datetime.now() self.cur.execute("insert into test(ts) values (current_timestamp)") -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 07:37:17 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 14 Jun 2016 11:37:17 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2316182=3A_Merge_test=5Freadline_from_3=2E5?= Message-ID: <20160614113716.20039.77246.6D14723C@psf.io> https://hg.python.org/cpython/rev/241bae60cef8 changeset: 102029:241bae60cef8 parent: 102027:b907321fec78 parent: 102028:ef234a5c5817 user: Martin Panter date: Tue Jun 14 11:31:39 2016 +0000 summary: Issue #16182: Merge test_readline from 3.5 files: Lib/test/test_readline.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_readline.py b/Lib/test/test_readline.py --- a/Lib/test/test_readline.py +++ b/Lib/test/test_readline.py @@ -203,7 +203,7 @@ self.assertIn(b"text 't\\xeb'\r\n", output) self.assertIn(b"line '[\\xefnserted]|t\\xeb[after]'\r\n", output) self.assertIn(b"indexes 11 13\r\n", output) - if not is_editline: # display() hook not called under Editline + if not is_editline and hasattr(readline, "set_pre_input_hook"): self.assertIn(b"substitution 't\\xeb'\r\n", output) self.assertIn(b"matches ['t\\xebnt', 't\\xebxt']\r\n", output) expected = br"'[\xefnserted]|t\xebxt[after]'" -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 07:37:17 2016 From: python-checkins at python.org (martin.panter) Date: Tue, 14 Jun 2016 11:37:17 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzE2MTgy?= =?utf-8?q?=3A_One_more_check_for_set=5Fpre=5Finput=5Fhook=28=29?= Message-ID: <20160614113716.26064.21654.D8E0E188@psf.io> https://hg.python.org/cpython/rev/ef234a5c5817 changeset: 102028:ef234a5c5817 branch: 3.5 parent: 102026:b1d27f36b8e1 user: Martin Panter date: Tue Jun 14 11:29:31 2016 +0000 summary: Issue #16182: One more check for set_pre_input_hook() files: Lib/test/test_readline.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_readline.py b/Lib/test/test_readline.py --- a/Lib/test/test_readline.py +++ b/Lib/test/test_readline.py @@ -188,7 +188,7 @@ self.assertIn(b"text 't\\xeb'\r\n", output) self.assertIn(b"line '[\\xefnserted]|t\\xeb[after]'\r\n", output) self.assertIn(b"indexes 11 13\r\n", output) - if not is_editline: # display() hook not called under Editline + if not is_editline and hasattr(readline, "set_pre_input_hook"): self.assertIn(b"substitution 't\\xeb'\r\n", output) self.assertIn(b"matches ['t\\xebnt', 't\\xebxt']\r\n", output) expected = br"'[\xefnserted]|t\xebxt[after]'" -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 08:25:47 2016 From: python-checkins at python.org (berker.peksag) Date: Tue, 14 Jun 2016 12:25:47 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2316864=3A_Cursor?= =?utf-8?q?=2Elastrowid_now_supports_REPLACE_statement?= Message-ID: <20160614122516.114454.39185.B4526032@psf.io> https://hg.python.org/cpython/rev/2126e8cbc12f changeset: 102030:2126e8cbc12f user: Berker Peksag date: Tue Jun 14 15:25:36 2016 +0300 summary: Issue #16864: Cursor.lastrowid now supports REPLACE statement Initial patch by Alex LordThorsen. files: Doc/library/sqlite3.rst | 13 ++++++- Doc/whatsnew/3.6.rst | 7 ++++ Lib/sqlite3/test/dbapi.py | 43 ++++++++++++++++++++++++++- Misc/ACKS | 1 + Misc/NEWS | 3 + Modules/_sqlite/cursor.c | 4 +- 6 files changed, 66 insertions(+), 5 deletions(-) diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -629,9 +629,16 @@ .. attribute:: lastrowid This read-only attribute provides the rowid of the last modified row. It is - only set if you issued an ``INSERT`` statement using the :meth:`execute` - method. For operations other than ``INSERT`` or when :meth:`executemany` is - called, :attr:`lastrowid` is set to :const:`None`. + only set if you issued an ``INSERT`` or a ``REPLACE`` statement using the + :meth:`execute` method. For operations other than ``INSERT`` or + ``REPLACE`` or when :meth:`executemany` is called, :attr:`lastrowid` is + set to :const:`None`. + + If the ``INSERT`` or ``REPLACE`` statement failed to insert the previous + successful rowid is returned. + + .. versionchanged:: 3.6 + Added support for the ``REPLACE`` statement. .. attribute:: description diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -339,6 +339,13 @@ (Contributed by Wolfgang Langner in :issue:`26587`). +sqlite3 +------- + +* :attr:`sqlite3.Cursor.lastrowid` now supports the ``REPLACE`` statement. + (Contributed by Alex LordThorsen in :issue:`16864`.) + + socketserver ------------ diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py --- a/Lib/sqlite3/test/dbapi.py +++ b/Lib/sqlite3/test/dbapi.py @@ -188,7 +188,10 @@ def setUp(self): self.cx = sqlite.connect(":memory:") self.cu = self.cx.cursor() - self.cu.execute("create table test(id integer primary key, name text, income number)") + self.cu.execute( + "create table test(id integer primary key, name text, " + "income number, unique_test text unique)" + ) self.cu.execute("insert into test(name) values (?)", ("foo",)) def tearDown(self): @@ -462,6 +465,44 @@ with self.assertRaises(TypeError): cur = sqlite.Cursor(foo) + def CheckLastRowIDOnReplace(self): + """ + INSERT OR REPLACE and REPLACE INTO should produce the same behavior. + """ + sql = '{} INTO test(id, unique_test) VALUES (?, ?)' + for statement in ('INSERT OR REPLACE', 'REPLACE'): + with self.subTest(statement=statement): + self.cu.execute(sql.format(statement), (1, 'foo')) + self.assertEqual(self.cu.lastrowid, 1) + + def CheckLastRowIDOnIgnore(self): + self.cu.execute( + "insert or ignore into test(unique_test) values (?)", + ('test',)) + self.assertEqual(self.cu.lastrowid, 2) + self.cu.execute( + "insert or ignore into test(unique_test) values (?)", + ('test',)) + self.assertEqual(self.cu.lastrowid, 2) + + def CheckLastRowIDInsertOR(self): + results = [] + for statement in ('FAIL', 'ABORT', 'ROLLBACK'): + sql = 'INSERT OR {} INTO test(unique_test) VALUES (?)' + with self.subTest(statement='INSERT OR {}'.format(statement)): + self.cu.execute(sql.format(statement), (statement,)) + results.append((statement, self.cu.lastrowid)) + with self.assertRaises(sqlite.IntegrityError): + self.cu.execute(sql.format(statement), (statement,)) + results.append((statement, self.cu.lastrowid)) + expected = [ + ('FAIL', 2), ('FAIL', 2), + ('ABORT', 3), ('ABORT', 3), + ('ROLLBACK', 4), ('ROLLBACK', 4), + ] + self.assertEqual(results, expected) + + @unittest.skipUnless(threading, 'This test requires threading.') class ThreadTests(unittest.TestCase): def setUp(self): diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -895,6 +895,7 @@ Hugo Lopes Tavares Guillermo L?pez-Anglada Anne Lord +Alex LordThorsen Tom Loredo Justin Love Ned Jackson Lovely diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Library ------- +- Issue #16864: sqlite3.Cursor.lastrowid now supports REPLACE statement. + Initial patch by Alex LordThorsen. + - Issue #26386: Fixed ttk.TreeView selection operations with item id's containing spaces. diff --git a/Modules/_sqlite/cursor.c b/Modules/_sqlite/cursor.c --- a/Modules/_sqlite/cursor.c +++ b/Modules/_sqlite/cursor.c @@ -698,7 +698,9 @@ } Py_DECREF(self->lastrowid); - if (!multiple && statement_type == STATEMENT_INSERT) { + if (!multiple && + /* REPLACE is an alias for INSERT OR REPLACE */ + (statement_type == STATEMENT_INSERT || statement_type == STATEMENT_REPLACE)) { sqlite_int64 lastrowid; Py_BEGIN_ALLOW_THREADS lastrowid = sqlite3_last_insert_rowid(self->connection->db); -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Tue Jun 14 08:50:13 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 14 Jun 2016 13:50:13 +0100 Subject: [Python-checkins] GOOD Benchmark Results for Python Default 2016-06-14 Message-ID: Results for project Python default, build date 2016-06-14 02:02:20 +0000 commit: 9ba934d159e3 previous commit: 0b18f7d262cc revision date: 2016-06-14 00:27:57 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.15% 1.09% 8.01% 17.98% :-| pybench 0.12% 0.04% 1.86% 8.01% :-( regex_v8 2.81% 0.02% -3.31% 4.44% :-| nbody 0.30% -0.05% 0.44% 9.97% :-| json_dump_v2 0.33% 0.77% 0.01% 13.15% :-| normal_startup 0.91% 0.18% 0.89% 6.25% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-default-2016-06-14/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Tue Jun 14 08:50:40 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 14 Jun 2016 13:50:40 +0100 Subject: [Python-checkins] GOOD Benchmark Results for Python 2.7 2016-06-14 Message-ID: Results for project Python 2.7, build date 2016-06-14 02:46:06 +0000 commit: 675569bee37f previous commit: f520ae3b537b revision date: 2016-06-14 00:21:57 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.15% 1.41% 5.44% 5.17% :-) pybench 0.16% 0.04% 5.72% 5.19% :-( regex_v8 0.48% -0.07% -2.35% 11.21% :-) nbody 0.05% 0.07% 8.96% 2.36% :-) json_dump_v2 0.40% -0.06% 2.09% 10.52% :-( normal_startup 1.62% 0.44% -5.31% 1.48% :-| ssbench 0.18% -0.15% 0.79% 3.11% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-2-7-2016-06-14/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Tue Jun 14 09:05:46 2016 From: python-checkins at python.org (victor.stinner) Date: Tue, 14 Jun 2016 13:05:46 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy41?= Message-ID: <20160614130535.19990.81132.B2971468@psf.io> https://hg.python.org/cpython/rev/1f376758837d changeset: 102032:1f376758837d parent: 102030:2126e8cbc12f parent: 102031:a36238de31ae user: Victor Stinner date: Tue Jun 14 15:05:21 2016 +0200 summary: Merge 3.5 files: Misc/NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -477,7 +477,7 @@ - Issue #25843: When compiling code, don't merge constants if they are equal but have a different types. For example, ``f1, f2 = lambda: 1, lambda: 1.0`` is now correctly compiled to two different functions: ``f1()`` returns ``1`` - (``int``) and ``f2()`` returns ``1.0`` (``int``), even if ``1`` and ``1.0`` + (``int``) and ``f2()`` returns ``1.0`` (``float``), even if ``1`` and ``1.0`` are equal. - Issue #26107: The format of the ``co_lnotab`` attribute of code objects -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 09:05:54 2016 From: python-checkins at python.org (victor.stinner) Date: Tue, 14 Jun 2016 13:05:54 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI1ODQz?= =?utf-8?q?=3A_Fix_the_NEWS_entry?= Message-ID: <20160614130535.120848.68151.C6AEBDFE@psf.io> https://hg.python.org/cpython/rev/a36238de31ae changeset: 102031:a36238de31ae branch: 3.5 parent: 102028:ef234a5c5817 user: Victor Stinner date: Tue Jun 14 15:04:44 2016 +0200 summary: Issue #25843: Fix the NEWS entry files: Misc/NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -124,7 +124,7 @@ - Issue #25843: When compiling code, don't merge constants if they are equal but have a different types. For example, ``f1, f2 = lambda: 1, lambda: 1.0`` is now correctly compiled to two different functions: ``f1()`` returns ``1`` - (``int``) and ``f2()`` returns ``1.0`` (``int``), even if ``1`` and ``1.0`` + (``int``) and ``f2()`` returns ``1.0`` (``float``), even if ``1`` and ``1.0`` are equal. - Issue #22995: [UPDATE] Comment out the one of the pickleability tests in -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 10:34:09 2016 From: python-checkins at python.org (victor.stinner) Date: Tue, 14 Jun 2016 14:34:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy41IChvcy51cmFuZG9tLCBpc3N1ZSAjMjcyNzgp?= Message-ID: <20160614143358.120707.12606.C04DF651@psf.io> https://hg.python.org/cpython/rev/0d39bd9028e8 changeset: 102034:0d39bd9028e8 parent: 102032:1f376758837d parent: 102033:e028e86a5b73 user: Victor Stinner date: Tue Jun 14 16:33:17 2016 +0200 summary: Merge 3.5 (os.urandom, issue #27278) files: Misc/NEWS | 4 ++++ Python/random.c | 2 +- 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,10 @@ Library ------- +- Issue #27278: Fix os.urandom() implementation using getrandom() on Linux. + Truncate size to INT_MAX and loop until we collected enough random bytes, + instead of casting a directly Py_ssize_t to int. + - Issue #16864: sqlite3.Cursor.lastrowid now supports REPLACE statement. Initial patch by Alex LordThorsen. diff --git a/Python/random.c b/Python/random.c --- a/Python/random.c +++ b/Python/random.c @@ -146,7 +146,7 @@ to 1024 bytes */ n = Py_MIN(size, 1024); #else - n = size; + n = Py_MIN(size, INT_MAX); #endif errno = 0; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 10:36:25 2016 From: python-checkins at python.org (victor.stinner) Date: Tue, 14 Jun 2016 14:36:25 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_cleanup_random?= =?utf-8?q?=2Ec?= Message-ID: <20160614143613.101550.37841.7A746464@psf.io> https://hg.python.org/cpython/rev/de2df41ebf97 changeset: 102035:de2df41ebf97 branch: 3.5 parent: 102033:e028e86a5b73 user: Victor Stinner date: Tue Jun 14 16:35:49 2016 +0200 summary: cleanup random.c Casting Py_ssize_t to Py_ssize_t is useless. files: Python/random.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Python/random.c b/Python/random.c --- a/Python/random.c +++ b/Python/random.c @@ -251,7 +251,7 @@ break; } buffer += n; - size -= (Py_ssize_t)n; + size -= n; } close(fd); } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 10:36:27 2016 From: python-checkins at python.org (victor.stinner) Date: Tue, 14 Jun 2016 14:36:27 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy41?= Message-ID: <20160614143613.20145.4986.B8D8FC95@psf.io> https://hg.python.org/cpython/rev/be21d5b29cdc changeset: 102036:be21d5b29cdc parent: 102034:0d39bd9028e8 parent: 102035:de2df41ebf97 user: Victor Stinner date: Tue Jun 14 16:36:00 2016 +0200 summary: Merge 3.5 files: Python/random.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Python/random.c b/Python/random.c --- a/Python/random.c +++ b/Python/random.c @@ -254,7 +254,7 @@ break; } buffer += n; - size -= (Py_ssize_t)n; + size -= n; } close(fd); } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 10:36:27 2016 From: python-checkins at python.org (victor.stinner) Date: Tue, 14 Jun 2016 14:36:27 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogRml4IG9zLnVyYW5k?= =?utf-8?q?om=28=29_using_getrandom=28=29_on_Linux?= Message-ID: <20160614143358.10086.1428.9B00D7BE@psf.io> https://hg.python.org/cpython/rev/e028e86a5b73 changeset: 102033:e028e86a5b73 branch: 3.5 parent: 102031:a36238de31ae user: Victor Stinner date: Tue Jun 14 16:31:35 2016 +0200 summary: Fix os.urandom() using getrandom() on Linux Issue #27278: Fix os.urandom() implementation using getrandom() on Linux. Truncate size to INT_MAX and loop until we collected enough random bytes, instead of casting a directly Py_ssize_t to int. files: Misc/NEWS | 4 ++++ Python/random.c | 2 +- 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,10 @@ Library ------- +- Issue #27278: Fix os.urandom() implementation using getrandom() on Linux. + Truncate size to INT_MAX and loop until we collected enough random bytes, + instead of casting a directly Py_ssize_t to int. + - Issue #26386: Fixed ttk.TreeView selection operations with item id's containing spaces. diff --git a/Python/random.c b/Python/random.c --- a/Python/random.c +++ b/Python/random.c @@ -143,7 +143,7 @@ to 1024 bytes */ n = Py_MIN(size, 1024); #else - n = size; + n = Py_MIN(size, INT_MAX); #endif errno = 0; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 10:45:00 2016 From: python-checkins at python.org (victor.stinner) Date: Tue, 14 Jun 2016 14:45:00 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_subprocess=3A_enhance_Reso?= =?utf-8?q?urceWarning_message?= Message-ID: <20160614144451.9983.73458.5A066CB5@psf.io> https://hg.python.org/cpython/rev/5bee11956448 changeset: 102037:5bee11956448 user: Victor Stinner date: Tue Jun 14 16:42:59 2016 +0200 summary: subprocess: enhance ResourceWarning message * Add the process identifier to the warning message * Add also a comment to explain the issue files: Lib/subprocess.py | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Lib/subprocess.py b/Lib/subprocess.py --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -993,7 +993,6 @@ raise - def _translate_newlines(self, data, encoding): data = data.decode(encoding) return data.replace("\r\n", "\n").replace("\r", "\n") @@ -1018,8 +1017,10 @@ # We didn't get to successfully create a child process. return if self.returncode is None: - warnings.warn("running subprocess %r" % self, ResourceWarning, - source=self) + # Not reading subprocess exit status creates a zombi process which + # is only destroyed at the parent python process exit + warnings.warn("subprocess %s is still running" % self.pid, + ResourceWarning, source=self) # In case the child hasn't been waited on, check if it's done. self._internal_poll(_deadstate=_maxsize) if self.returncode is None and _active is not None: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 12:24:56 2016 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 14 Jun 2016 16:24:56 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327123=3A_When_an_exception_is_raised_within_the?= =?utf-8?q?_context_being?= Message-ID: <20160614162438.81161.88075.40192997@psf.io> https://hg.python.org/cpython/rev/9fadeee05880 changeset: 102039:9fadeee05880 parent: 102037:5bee11956448 parent: 102038:9ee36b74b432 user: Gregory P. Smith date: Tue Jun 14 09:24:31 2016 -0700 summary: Issue #27123: When an exception is raised within the context being managed by a contextlib.ExitStack() and one of the exit stack generators catches and raises it in a chain, do not re-raise the original exception when exiting, let the new chained one through. This avoids the PEP 479 bug described in issue25782. files: Lib/contextlib.py | 3 ++ Lib/test/test_contextlib.py | 28 +++++++++++++++++++++++++ Misc/NEWS | 6 +++++ 3 files changed, 37 insertions(+), 0 deletions(-) diff --git a/Lib/contextlib.py b/Lib/contextlib.py --- a/Lib/contextlib.py +++ b/Lib/contextlib.py @@ -105,6 +105,9 @@ # raised inside the "with" statement from being suppressed. return exc is not value except RuntimeError as exc: + # Don't re-raise the passed in exception. (issue27112) + if exc is value: + return False # Likewise, avoid suppressing if a StopIteration exception # was passed to throw() and later wrapped into a RuntimeError # (see PEP 479). diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py --- a/Lib/test/test_contextlib.py +++ b/Lib/test/test_contextlib.py @@ -795,6 +795,34 @@ stack.push(cm) self.assertIs(stack._exit_callbacks[-1], cm) + def test_dont_reraise_RuntimeError(self): + """https://bugs.python.org/issue27122""" + class UniqueException(Exception): pass + + @contextmanager + def second(): + try: + yield 1 + except Exception as exc: + raise UniqueException("new exception") from exc + + @contextmanager + def first(): + try: + yield 1 + except Exception as exc: + raise exc + + # The RuntimeError should be caught by second()'s exception + # handler which chain raised a new UniqueException. + with self.assertRaises(UniqueException) as err_ctx: + with ExitStack() as es_ctx: + es_ctx.enter_context(second()) + es_ctx.enter_context(first()) + raise RuntimeError("please no infinite loop.") + + self.assertEqual(err_ctx.exception.args[0], "new exception") + class TestRedirectStream: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,12 @@ Library ------- +- Issue #27123: When an exception is raised within the context being managed + by a contextlib.ExitStack() and one of the exit stack generators + catches and raises it in a chain, do not re-raise the original exception + when exiting, let the new chained one through. This avoids the PEP 479 + bug described in issue25782. + - Issue #27278: Fix os.urandom() implementation using getrandom() on Linux. Truncate size to INT_MAX and loop until we collected enough random bytes, instead of casting a directly Py_ssize_t to int. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 12:24:56 2016 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 14 Jun 2016 16:24:56 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MTIz?= =?utf-8?q?=3A_When_an_exception_is_raised_within_the_context_being?= Message-ID: <20160614162437.120419.69967.F9AF6280@psf.io> https://hg.python.org/cpython/rev/9ee36b74b432 changeset: 102038:9ee36b74b432 branch: 3.5 parent: 102035:de2df41ebf97 user: Gregory P. Smith date: Tue Jun 14 09:19:20 2016 -0700 summary: Issue #27123: When an exception is raised within the context being managed by a contextlib.ExitStack() and one of the exit stack generators catches and raises it in a chain, do not re-raise the original exception when exiting, let the new chained one through. This avoids the PEP 479 bug described in issue25782. files: Lib/contextlib.py | 3 ++ Lib/test/test_contextlib.py | 28 +++++++++++++++++++++++++ Misc/NEWS | 6 +++++ 3 files changed, 37 insertions(+), 0 deletions(-) diff --git a/Lib/contextlib.py b/Lib/contextlib.py --- a/Lib/contextlib.py +++ b/Lib/contextlib.py @@ -82,6 +82,9 @@ # raised inside the "with" statement from being suppressed. return exc is not value except RuntimeError as exc: + # Don't re-raise the passed in exception. (issue27112) + if exc is value: + return False # Likewise, avoid suppressing if a StopIteration exception # was passed to throw() and later wrapped into a RuntimeError # (see PEP 479). diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py --- a/Lib/test/test_contextlib.py +++ b/Lib/test/test_contextlib.py @@ -762,6 +762,34 @@ stack.push(cm) self.assertIs(stack._exit_callbacks[-1], cm) + def test_dont_reraise_RuntimeError(self): + """https://bugs.python.org/issue27122""" + class UniqueException(Exception): pass + + @contextmanager + def second(): + try: + yield 1 + except Exception as exc: + raise UniqueException("new exception") from exc + + @contextmanager + def first(): + try: + yield 1 + except Exception as exc: + raise exc + + # The RuntimeError should be caught by second()'s exception + # handler which chain raised a new UniqueException. + with self.assertRaises(UniqueException) as err_ctx: + with ExitStack() as es_ctx: + es_ctx.enter_context(second()) + es_ctx.enter_context(first()) + raise RuntimeError("please no infinite loop.") + + self.assertEqual(err_ctx.exception.args[0], "new exception") + class TestRedirectStream: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,12 @@ Library ------- +- Issue #27123: When an exception is raised within the context being managed + by a contextlib.ExitStack() and one of the exit stack generators + catches and raises it in a chain, do not re-raise the original exception + when exiting, let the new chained one through. This avoids the PEP 479 + bug described in issue25782. + - Issue #27278: Fix os.urandom() implementation using getrandom() on Linux. Truncate size to INT_MAX and loop until we collected enough random bytes, instead of casting a directly Py_ssize_t to int. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 12:28:43 2016 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 14 Jun 2016 16:28:43 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogaXNzdWUyNzEyMjog?= =?utf-8?q?fix_typo_in_the_news_file=2C_wrong_issue_=23=2E__not_issue27123?= =?utf-8?q?=2E?= Message-ID: <20160614162818.81210.99546.255E7B26@psf.io> https://hg.python.org/cpython/rev/6bb68eae63e8 changeset: 102040:6bb68eae63e8 branch: 3.5 parent: 102038:9ee36b74b432 user: Gregory P. Smith date: Tue Jun 14 09:27:44 2016 -0700 summary: issue27122: fix typo in the news file, wrong issue #. not issue27123. files: Misc/NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,7 +13,7 @@ Library ------- -- Issue #27123: When an exception is raised within the context being managed +- Issue #27122: When an exception is raised within the context being managed by a contextlib.ExitStack() and one of the exit stack generators catches and raises it in a chain, do not re-raise the original exception when exiting, let the new chained one through. This avoids the PEP 479 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 12:34:20 2016 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 14 Jun 2016 16:34:20 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_issue27122=3A_fix_typo_in_the_news_file=2C_wrong_issue_?= =?utf-8?q?=23=2E__not_issue27123=2E?= Message-ID: <20160614162818.9881.96603.3831587F@psf.io> https://hg.python.org/cpython/rev/4e1dbfcc9449 changeset: 102041:4e1dbfcc9449 parent: 102039:9fadeee05880 parent: 102040:6bb68eae63e8 user: Gregory P. Smith date: Tue Jun 14 09:28:08 2016 -0700 summary: issue27122: fix typo in the news file, wrong issue #. not issue27123. files: Misc/NEWS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,7 +10,7 @@ Library ------- -- Issue #27123: When an exception is raised within the context being managed +- Issue #27122: When an exception is raised within the context being managed by a contextlib.ExitStack() and one of the exit stack generators catches and raises it in a chain, do not re-raise the original exception when exiting, let the new chained one through. This avoids the PEP 479 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 15:55:04 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 14 Jun 2016 19:55:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327238=3A_Got_rid_of_bare_excepts_in_the_turtle_?= =?utf-8?q?module=2E__Original_patch?= Message-ID: <20160614195409.19931.23321.46A2E38A@psf.io> https://hg.python.org/cpython/rev/cd68cf41adf2 changeset: 102044:cd68cf41adf2 parent: 102041:4e1dbfcc9449 parent: 102042:78e5efa3dd9e user: Serhiy Storchaka date: Tue Jun 14 22:53:43 2016 +0300 summary: Issue #27238: Got rid of bare excepts in the turtle module. Original patch by Jelle Zijlstra. files: Lib/turtle.py | 18 +++++++++--------- Misc/NEWS | 3 +++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Lib/turtle.py b/Lib/turtle.py --- a/Lib/turtle.py +++ b/Lib/turtle.py @@ -179,7 +179,7 @@ continue try: key, value = line.split("=") - except: + except ValueError: print("Bad line in config-file %s:\n%s" % (filename,line)) continue key = key.strip() @@ -192,7 +192,7 @@ value = float(value) else: value = int(value) - except: + except ValueError: pass # value need not be converted cfgdict[key] = value return cfgdict @@ -220,7 +220,7 @@ try: head, tail = split(__file__) cfg_file2 = join(head, default_cfg) - except: + except Exception: cfg_file2 = "" if isfile(cfg_file2): cfgdict2 = config_dict(cfg_file2) @@ -229,7 +229,7 @@ try: readconfig(_CFG) -except: +except Exception: print ("No configfile read, reason unknown") @@ -653,7 +653,7 @@ x, y = (self.cv.canvasx(event.x)/self.xscale, -self.cv.canvasy(event.y)/self.yscale) fun(x, y) - except: + except Exception: pass self.cv.tag_bind(item, "" % num, eventfun, add) @@ -1158,7 +1158,7 @@ raise TurtleGraphicsError("bad color string: %s" % str(color)) try: r, g, b = color - except: + except (TypeError, ValueError): raise TurtleGraphicsError("bad color arguments: %s" % str(color)) if self._colormode == 1.0: r, g, b = [round(255.0*x) for x in (r, g, b)] @@ -2702,7 +2702,7 @@ return args try: r, g, b = args - except: + except (TypeError, ValueError): raise TurtleGraphicsError("bad color arguments: %s" % str(args)) if self.screen._colormode == 1.0: r, g, b = [round(255.0*x) for x in (r, g, b)] @@ -3865,7 +3865,7 @@ try: # eval(key).im_func.__doc__ = docsdict[key] eval(key).__doc__ = docsdict[key] - except: + except Exception: print("Bad docstring-entry: %s" % key) _LANGUAGE = _CFG["language"] @@ -3875,7 +3875,7 @@ read_docstrings(_LANGUAGE) except ImportError: print("Cannot find docsdict for", _LANGUAGE) -except: +except Exception: print ("Unknown Error when trying to import %s-docstring-dictionary" % _LANGUAGE) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Library ------- +- Issue #27238: Got rid of bare excepts in the turtle module. Original patch + by Jelle Zijlstra. + - Issue #27122: When an exception is raised within the context being managed by a contextlib.ExitStack() and one of the exit stack generators catches and raises it in a chain, do not re-raise the original exception -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 15:55:04 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 14 Jun 2016 19:55:04 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MjM4?= =?utf-8?q?=3A_Got_rid_of_bare_excepts_in_the_turtle_module=2E__Original_p?= =?utf-8?q?atch?= Message-ID: <20160614195408.26279.18039.B3CD262F@psf.io> https://hg.python.org/cpython/rev/78e5efa3dd9e changeset: 102042:78e5efa3dd9e branch: 3.5 parent: 102040:6bb68eae63e8 user: Serhiy Storchaka date: Tue Jun 14 22:52:04 2016 +0300 summary: Issue #27238: Got rid of bare excepts in the turtle module. Original patch by Jelle Zijlstra. files: Lib/turtle.py | 18 +++++++++--------- Misc/ACKS | 1 + Misc/NEWS | 3 +++ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Lib/turtle.py b/Lib/turtle.py --- a/Lib/turtle.py +++ b/Lib/turtle.py @@ -179,7 +179,7 @@ continue try: key, value = line.split("=") - except: + except ValueError: print("Bad line in config-file %s:\n%s" % (filename,line)) continue key = key.strip() @@ -192,7 +192,7 @@ value = float(value) else: value = int(value) - except: + except ValueError: pass # value need not be converted cfgdict[key] = value return cfgdict @@ -220,7 +220,7 @@ try: head, tail = split(__file__) cfg_file2 = join(head, default_cfg) - except: + except Exception: cfg_file2 = "" if isfile(cfg_file2): cfgdict2 = config_dict(cfg_file2) @@ -229,7 +229,7 @@ try: readconfig(_CFG) -except: +except Exception: print ("No configfile read, reason unknown") @@ -653,7 +653,7 @@ x, y = (self.cv.canvasx(event.x)/self.xscale, -self.cv.canvasy(event.y)/self.yscale) fun(x, y) - except: + except Exception: pass self.cv.tag_bind(item, "" % num, eventfun, add) @@ -1158,7 +1158,7 @@ raise TurtleGraphicsError("bad color string: %s" % str(color)) try: r, g, b = color - except: + except (TypeError, ValueError): raise TurtleGraphicsError("bad color arguments: %s" % str(color)) if self._colormode == 1.0: r, g, b = [round(255.0*x) for x in (r, g, b)] @@ -2702,7 +2702,7 @@ return args try: r, g, b = args - except: + except (TypeError, ValueError): raise TurtleGraphicsError("bad color arguments: %s" % str(args)) if self.screen._colormode == 1.0: r, g, b = [round(255.0*x) for x in (r, g, b)] @@ -3865,7 +3865,7 @@ try: # eval(key).im_func.__doc__ = docsdict[key] eval(key).__doc__ = docsdict[key] - except: + except Exception: print("Bad docstring-entry: %s" % key) _LANGUAGE = _CFG["language"] @@ -3875,7 +3875,7 @@ read_docstrings(_LANGUAGE) except ImportError: print("Cannot find docsdict for", _LANGUAGE) -except: +except Exception: print ("Unknown Error when trying to import %s-docstring-dictionary" % _LANGUAGE) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1655,6 +1655,7 @@ Cheng Zhang Kai Zhu Tarek Ziad? +Jelle Zijlstra Gennadiy Zlobin Doug Zongker Peter ?strand diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,9 @@ Library ------- +- Issue #27238: Got rid of bare excepts in the turtle module. Original patch + by Jelle Zijlstra. + - Issue #27122: When an exception is raised within the context being managed by a contextlib.ExitStack() and one of the exit stack generators catches and raises it in a chain, do not re-raise the original exception -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 15:55:04 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 14 Jun 2016 19:55:04 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI3MjM4?= =?utf-8?q?=3A_Got_rid_of_bare_excepts_in_the_turtle_module=2E__Original_p?= =?utf-8?q?atch?= Message-ID: <20160614195408.26206.26479.5145125E@psf.io> https://hg.python.org/cpython/rev/e9d023b7d676 changeset: 102043:e9d023b7d676 branch: 2.7 parent: 102021:ac7c10f5e36e user: Serhiy Storchaka date: Tue Jun 14 22:52:13 2016 +0300 summary: Issue #27238: Got rid of bare excepts in the turtle module. Original patch by Jelle Zijlstra. files: Lib/lib-tk/turtle.py | 18 +++++++++--------- Misc/ACKS | 1 + Misc/NEWS | 3 +++ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Lib/lib-tk/turtle.py b/Lib/lib-tk/turtle.py --- a/Lib/lib-tk/turtle.py +++ b/Lib/lib-tk/turtle.py @@ -192,7 +192,7 @@ continue try: key, value = line.split("=") - except: + except ValueError: print "Bad line in config-file %s:\n%s" % (filename,line) continue key = key.strip() @@ -205,7 +205,7 @@ value = float(value) else: value = int(value) - except: + except ValueError: pass # value need not be converted cfgdict[key] = value return cfgdict @@ -234,7 +234,7 @@ try: head, tail = split(__file__) cfg_file2 = join(head, default_cfg) - except: + except BaseException: cfg_file2 = "" if isfile(cfg_file2): #print "2. Loading config-file %s:" % cfg_file2 @@ -249,7 +249,7 @@ try: readconfig(_CFG) -except: +except BaseException: print "No configfile read, reason unknown" @@ -677,7 +677,7 @@ x, y = (self.cv.canvasx(event.x)/self.xscale, -self.cv.canvasy(event.y)/self.yscale) fun(x, y) - except: + except BaseException: pass self.cv.tag_bind(item, "" % num, eventfun, add) @@ -1105,7 +1105,7 @@ raise TurtleGraphicsError("bad color string: %s" % str(color)) try: r, g, b = color - except: + except (TypeError, ValueError): raise TurtleGraphicsError("bad color arguments: %s" % str(color)) if self._colormode == 1.0: r, g, b = [round(255.0*x) for x in (r, g, b)] @@ -2606,7 +2606,7 @@ return args try: r, g, b = args - except: + except (TypeError, ValueError): raise TurtleGraphicsError("bad color arguments: %s" % str(args)) if self.screen._colormode == 1.0: r, g, b = [round(255.0*x) for x in (r, g, b)] @@ -3755,7 +3755,7 @@ #print key try: eval(key).im_func.__doc__ = docsdict[key] - except: + except BaseException: print "Bad docstring-entry: %s" % key _LANGUAGE = _CFG["language"] @@ -3765,7 +3765,7 @@ read_docstrings(_LANGUAGE) except ImportError: print "Cannot find docsdict for", _LANGUAGE -except: +except BaseException: print ("Unknown Error when trying to import %s-docstring-dictionary" % _LANGUAGE) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1554,5 +1554,6 @@ Cheng Zhang Kai Zhu Tarek Ziad? +Jelle Zijlstra Gennadiy Zlobin Peter ?strand diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,9 @@ Library ------- +- Issue #27238: Got rid of bare excepts in the turtle module. Original patch + by Jelle Zijlstra. + - Issue #26386: Fixed ttk.TreeView selection operations with item id's containing spaces. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 17:13:15 2016 From: python-checkins at python.org (berker.peksag) Date: Tue, 14 Jun 2016 21:13:15 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_PEP_103=3A_Update_from_Oleg_B?= =?utf-8?q?roytman?= Message-ID: <20160614211303.26206.62359.23C9C931@psf.io> https://hg.python.org/peps/rev/e4dea1dda7e4 changeset: 6377:e4dea1dda7e4 user: Berker Peksag date: Wed Jun 15 00:13:30 2016 +0300 summary: PEP 103: Update from Oleg Broytman files: pep-0103.txt | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-) diff --git a/pep-0103.txt b/pep-0103.txt --- a/pep-0103.txt +++ b/pep-0103.txt @@ -193,6 +193,14 @@ to track upstream remotes/origin/v1 branch and checks out ``v1`` into the working directory. +Some commands, like ``git status``, report the difference between +local and remote branches. Please remember they only do comparison +with remote-tracking branches in your local repository, and the state +of those remote-tracking branches can be outdated. To update +remote-tracking branches you either fetch and merge (or rebase) +commits from the remote repository or update remote-tracking branches +without updating local branches. + Updating local and remote-tracking branches ------------------------------------------- @@ -344,6 +352,12 @@ for caveats; in 2.4 the push-to-deploy feature was `further improved `_. +To update remote-tracking branches without updating local branches run +``git remote update [$REMOTE...]``. For example:: + + $ git remote update + $ git remote update origin + Tags '''' @@ -878,7 +892,11 @@ `_ or `cgit `_. Both are CGI scripts (written in Perl and C). In addition to web interface both provide read-only dumb -http access for git (http(s):// URLs). +http access for git (http(s):// URLs). `Klaus +`_ is a small and simple WSGI web +server that implements both web interface and git smart HTTP +transport; supports Python 2 and Python 3, performs syntax +highlighting. There are also more advanced web-based development environments that include ability to manage users, groups and projects; private, -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Tue Jun 14 21:14:08 2016 From: python-checkins at python.org (martin.panter) Date: Wed, 15 Jun 2016 01:14:08 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327311=3A_Merge_zipfile_doc_from_3=2E5?= Message-ID: <20160615010800.120727.23214.3393259B@psf.io> https://hg.python.org/cpython/rev/e3bb87952c62 changeset: 102046:e3bb87952c62 parent: 102044:cd68cf41adf2 parent: 102045:32af78a8b88f user: Martin Panter date: Wed Jun 15 01:05:27 2016 +0000 summary: Issue #27311: Merge zipfile doc from 3.5 files: Doc/library/zipfile.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -348,9 +348,9 @@ If ``arcname`` (or ``filename``, if ``arcname`` is not given) contains a null byte, the name of the file in the archive will be truncated at the null byte. -.. method:: ZipFile.writestr(zinfo_or_arcname, bytes[, compress_type]) +.. method:: ZipFile.writestr(zinfo_or_arcname, data[, compress_type]) - Write the string *bytes* to the archive; *zinfo_or_arcname* is either the file + Write the string *data* to the archive; *zinfo_or_arcname* is either the file name it will be given in the archive, or a :class:`ZipInfo` instance. If it's an instance, at least the filename, date, and time must be given. If it's a name, the date and time is set to the current date and time. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 21:14:08 2016 From: python-checkins at python.org (martin.panter) Date: Wed, 15 Jun 2016 01:14:08 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MzEx?= =?utf-8?q?=3A_Fix_ZipFile=2Ewritestr_data_argument_name=2E?= Message-ID: <20160615010800.101804.2640.14D57972@psf.io> https://hg.python.org/cpython/rev/32af78a8b88f changeset: 102045:32af78a8b88f branch: 3.5 parent: 102042:78e5efa3dd9e user: Martin Panter date: Wed Jun 15 00:24:34 2016 +0000 summary: Issue #27311: Fix ZipFile.writestr data argument name. Patch by John Hagen. files: Doc/library/zipfile.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -343,9 +343,9 @@ If ``arcname`` (or ``filename``, if ``arcname`` is not given) contains a null byte, the name of the file in the archive will be truncated at the null byte. -.. method:: ZipFile.writestr(zinfo_or_arcname, bytes[, compress_type]) +.. method:: ZipFile.writestr(zinfo_or_arcname, data[, compress_type]) - Write the string *bytes* to the archive; *zinfo_or_arcname* is either the file + Write the string *data* to the archive; *zinfo_or_arcname* is either the file name it will be given in the archive, or a :class:`ZipInfo` instance. If it's an instance, at least the filename, date, and time must be given. If it's a name, the date and time is set to the current date and time. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 14 21:43:40 2016 From: python-checkins at python.org (martin.panter) Date: Wed, 15 Jun 2016 01:43:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzEyODU1?= =?utf-8?q?=3A_Document_what_exactly_unicode=2Esplitlines=28=29_splits_on?= Message-ID: <20160615014333.114316.70599.3BBE630F@psf.io> https://hg.python.org/cpython/rev/2e6fda267a20 changeset: 102047:2e6fda267a20 branch: 2.7 parent: 102043:e9d023b7d676 user: Martin Panter date: Wed Jun 01 09:39:46 2016 +0000 summary: Issue #12855: Document what exactly unicode.splitlines() splits on Also synchronize with Python 3 examples. Based on patches by Matthew Boehm and Alexander Schrijver. files: Doc/library/stdtypes.rst | 63 ++++++++++++++++++++++++++- 1 files changed, 59 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 @@ -1217,13 +1217,68 @@ Line breaks are not included in the resulting list unless *keepends* is given and true. - For example, ``'ab c\n\nde fg\rkl\r\n'.splitlines()`` returns - ``['ab c', '', 'de fg', 'kl']``, while the same call with ``splitlines(True)`` - returns ``['ab c\n', '\n', 'de fg\r', 'kl\r\n']``. + Python recognizes ``"\r"``, ``"\n"``, and ``"\r\n"`` as line boundaries for + 8-bit strings. + + For example:: + + >>> 'ab c\n\nde fg\rkl\r\n'.splitlines() + ['ab c', '', 'de fg', 'kl'] + >>> 'ab c\n\nde fg\rkl\r\n'.splitlines(True) + ['ab c\n', '\n', 'de fg\r', 'kl\r\n'] Unlike :meth:`~str.split` when a delimiter string *sep* is given, this method returns an empty list for the empty string, and a terminal line - break does not result in an extra line. + break does not result in an extra line:: + + >>> "".splitlines() + [] + >>> "One line\n".splitlines() + ['One line'] + + For comparison, ``split('\n')`` gives:: + + >>> ''.split('\n') + [''] + >>> 'Two lines\n'.split('\n') + ['Two lines', ''] + +.. method:: unicode.splitlines([keepends]) + + Return a list of the lines in the string, like :meth:`str.splitlines`. + However, the Unicode method splits on the following line boundaries, + which are a superset of the :term:`universal newlines` recognized for + 8-bit strings. + + +-----------------------+-----------------------------+ + | Representation | Description | + +=======================+=============================+ + | ``\n`` | Line Feed | + +-----------------------+-----------------------------+ + | ``\r`` | Carriage Return | + +-----------------------+-----------------------------+ + | ``\r\n`` | Carriage Return + Line Feed | + +-----------------------+-----------------------------+ + | ``\v`` or ``\x0b`` | Line Tabulation | + +-----------------------+-----------------------------+ + | ``\f`` or ``\x0c`` | Form Feed | + +-----------------------+-----------------------------+ + | ``\x1c`` | File Separator | + +-----------------------+-----------------------------+ + | ``\x1d`` | Group Separator | + +-----------------------+-----------------------------+ + | ``\x1e`` | Record Separator | + +-----------------------+-----------------------------+ + | ``\x85`` | Next Line (C1 Control Code) | + +-----------------------+-----------------------------+ + | ``\u2028`` | Line Separator | + +-----------------------+-----------------------------+ + | ``\u2029`` | Paragraph Separator | + +-----------------------+-----------------------------+ + + .. versionchanged:: 2.7 + + ``\v`` and ``\f`` added to list of line boundaries. .. method:: str.startswith(prefix[, start[, end]]) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 15 02:59:40 2016 From: python-checkins at python.org (georg.brandl) Date: Wed, 15 Jun 2016 06:59:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy40IC0+IDMuNSk6?= =?utf-8?q?_merge_with_3=2E4?= Message-ID: <20160615065939.11688.69851.9D362A56@psf.io> https://hg.python.org/cpython/rev/1e7072d53b84 changeset: 102049:1e7072d53b84 branch: 3.5 parent: 102045:32af78a8b88f parent: 102048:dfc57c66a670 user: Georg Brandl date: Wed Jun 15 08:58:00 2016 +0200 summary: merge with 3.4 files: Doc/Makefile | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/Doc/Makefile b/Doc/Makefile --- a/Doc/Makefile +++ b/Doc/Makefile @@ -166,7 +166,7 @@ -make suspicious # for quick rebuilds (HTML only) -autobuild-html: +autobuild-dev-html: make html SPHINXOPTS='-A daily=1 -A versionswitcher=1' # for stable releases: only build if not in pre-release stage (alpha, beta) @@ -177,3 +177,10 @@ exit 1;; \ esac @make autobuild-dev + +autobuild-stable-html: + @case $(DISTVERSION) in *[ab]*) \ + echo "Not building; $(DISTVERSION) is not a release version."; \ + exit 1;; \ + esac + @make autobuild-dev-html -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 15 02:59:41 2016 From: python-checkins at python.org (georg.brandl) Date: Wed, 15 Jun 2016 06:59:41 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_merge_with_3=2E5?= Message-ID: <20160615065939.81210.51246.A5DB5A28@psf.io> https://hg.python.org/cpython/rev/41df7f924de6 changeset: 102050:41df7f924de6 parent: 102046:e3bb87952c62 parent: 102049:1e7072d53b84 user: Georg Brandl date: Wed Jun 15 08:58:46 2016 +0200 summary: merge with 3.5 files: Doc/Makefile | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/Doc/Makefile b/Doc/Makefile --- a/Doc/Makefile +++ b/Doc/Makefile @@ -166,7 +166,7 @@ -make suspicious # for quick rebuilds (HTML only) -autobuild-html: +autobuild-dev-html: make html SPHINXOPTS='-A daily=1 -A versionswitcher=1' # for stable releases: only build if not in pre-release stage (alpha, beta) @@ -177,3 +177,10 @@ exit 1;; \ esac @make autobuild-dev + +autobuild-stable-html: + @case $(DISTVERSION) in *[ab]*) \ + echo "Not building; $(DISTVERSION) is not a release version."; \ + exit 1;; \ + esac + @make autobuild-dev-html -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 15 02:59:41 2016 From: python-checkins at python.org (georg.brandl) Date: Wed, 15 Jun 2016 06:59:41 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy40KTogRG9jczogYWRkIGh0?= =?utf-8?q?ml-stable_autobuild_variant?= Message-ID: <20160615065939.81060.62983.4867A75A@psf.io> https://hg.python.org/cpython/rev/dfc57c66a670 changeset: 102048:dfc57c66a670 branch: 3.4 parent: 102009:aa4f7fc6d8c7 user: Georg Brandl date: Wed Jun 15 08:57:32 2016 +0200 summary: Docs: add html-stable autobuild variant files: Doc/Makefile | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/Doc/Makefile b/Doc/Makefile --- a/Doc/Makefile +++ b/Doc/Makefile @@ -161,7 +161,7 @@ -make suspicious # for quick rebuilds (HTML only) -autobuild-html: +autobuild-dev-html: make html SPHINXOPTS='-A daily=1 -A versionswitcher=1' # for stable releases: only build if not in pre-release stage (alpha, beta) @@ -173,3 +173,9 @@ esac @make autobuild-dev +autobuild-stable-html: + @case $(DISTVERSION) in *[ab]*) \ + echo "Not building; $(DISTVERSION) is not a release version."; \ + exit 1;; \ + esac + @make autobuild-dev-html -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 15 02:59:48 2016 From: python-checkins at python.org (georg.brandl) Date: Wed, 15 Jun 2016 06:59:48 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogRG9jczogYWRkIGh0?= =?utf-8?q?ml-stable_autobuild_variant?= Message-ID: <20160615065943.81413.18842.86F9E1AE@psf.io> https://hg.python.org/cpython/rev/ce8b8e1055d1 changeset: 102051:ce8b8e1055d1 branch: 2.7 parent: 102047:2e6fda267a20 user: Georg Brandl date: Wed Jun 15 08:57:32 2016 +0200 summary: Docs: add html-stable autobuild variant files: Doc/Makefile | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/Doc/Makefile b/Doc/Makefile --- a/Doc/Makefile +++ b/Doc/Makefile @@ -161,7 +161,7 @@ -make suspicious # for quick rebuilds (HTML only) -autobuild-html: +autobuild-dev-html: make html SPHINXOPTS='-A daily=1 -A versionswitcher=1' # for stable releases: only build if not in pre-release stage (alpha, beta) @@ -173,3 +173,9 @@ esac @make autobuild-dev +autobuild-stable-html: + @case $(DISTVERSION) in *[ab]*) \ + echo "Not building; $(DISTVERSION) is not a release version."; \ + exit 1;; \ + esac + @make autobuild-dev-html -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 15 03:00:11 2016 From: python-checkins at python.org (georg.brandl) Date: Wed, 15 Jun 2016 07:00:11 +0000 Subject: [Python-checkins] =?utf-8?q?release=3A_Also_build_doc_archives_fo?= =?utf-8?q?r_rcs=2E?= Message-ID: <20160615070007.99132.13931.0BF79C4B@psf.io> https://hg.python.org/release/rev/d28acc0485cf changeset: 104:d28acc0485cf user: Georg Brandl date: Wed Jun 15 09:00:04 2016 +0200 summary: Also build doc archives for rcs. files: release.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/release.py b/release.py --- a/release.py +++ b/release.py @@ -250,9 +250,9 @@ except OSError: pass - if tag.is_final: + if tag.is_final or tag.level == 'rc': docdist = build_docs() - if tag.is_final: + if tag.is_final or tag.level == 'rc': shutil.copytree(docdist, 'docs') with changed_dir(os.path.join(archivename, 'Doc')): -- Repository URL: https://hg.python.org/release From solipsis at pitrou.net Wed Jun 15 04:50:27 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 15 Jun 2016 08:50:27 +0000 Subject: [Python-checkins] Daily reference leaks (e3bb87952c62): sum=8 Message-ID: <20160615085024.10043.22045.095317EE@psf.io> results for e3bb87952c62 on branch "default" -------------------------------------------- test_collections leaked [0, 0, 4] memory blocks, sum=4 test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogeDrKjB', '--timeout', '7200'] From python-checkins at python.org Wed Jun 15 06:02:02 2016 From: python-checkins at python.org (xavier.degaye) Date: Wed, 15 Jun 2016 10:02:02 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2326862=3A_SYS=5Fge?= =?utf-8?q?tdents64_does_not_need_to_be_defined_on_android_API_21=2E?= Message-ID: <20160615100153.20145.523.BE41E43C@psf.io> https://hg.python.org/cpython/rev/4ef3a93e1be2 changeset: 102052:4ef3a93e1be2 parent: 102050:41df7f924de6 user: Xavier de Gaye date: Wed Jun 15 11:35:29 2016 +0200 summary: Issue #26862: SYS_getdents64 does not need to be defined on android API 21. files: Modules/_posixsubprocess.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -21,8 +21,7 @@ #include #endif -#if defined(__ANDROID__) && !defined(SYS_getdents64) -/* Android doesn't expose syscalls, add the definition manually. */ +#if defined(__ANDROID__) && __ANDROID_API__ < 21 && !defined(SYS_getdents64) # include # define SYS_getdents64 __NR_getdents64 #endif -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Wed Jun 15 07:08:16 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 15 Jun 2016 12:08:16 +0100 Subject: [Python-checkins] BAD Benchmark Results for Python Default 2016-06-15 Message-ID: <245f2745-3032-49c5-9c0e-49bc4bf1940a@irsmsx151.ger.corp.intel.com> Results for project Python default, build date 2016-06-15 02:02:43 +0000 commit: e3bb87952c62 previous commit: 9ba934d159e3 revision date: 2016-06-15 01:05:27 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.20% -0.49% 7.56% 19.78% :-| pybench 0.17% 0.14% 2.00% 7.83% :-( regex_v8 2.71% 0.72% -2.57% 3.61% :-| nbody 0.40% 0.10% 0.54% 6.68% :-( json_dump_v2 0.31% -2.66% -2.65% 14.17% :-| normal_startup 0.84% 0.57% 1.44% 6.18% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/bad-benchmark-results-for-python-default-2016-06-15/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Wed Jun 15 07:08:58 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 15 Jun 2016 12:08:58 +0100 Subject: [Python-checkins] BAD Benchmark Results for Python 2.7 2016-06-15 Message-ID: <8096ab5c-3094-4e71-85ad-11789d828d0f@irsmsx151.ger.corp.intel.com> Results for project Python 2.7, build date 2016-06-15 02:48:35 +0000 commit: 2e6fda267a20 previous commit: 675569bee37f revision date: 2016-06-01 09:39:46 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.18% -1.35% 4.17% 8.94% :-) pybench 0.15% 0.06% 5.77% 4.23% :-( regex_v8 0.48% 0.06% -2.28% 11.28% :-) nbody 0.05% 0.02% 8.97% 3.73% :-) json_dump_v2 0.45% 0.25% 2.34% 11.23% :-( normal_startup 1.91% -0.07% -5.38% 1.61% :-| ssbench 0.18% -0.26% 0.53% 3.70% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/bad-benchmark-results-for-python-2-7-2016-06-15/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Wed Jun 15 11:16:48 2016 From: python-checkins at python.org (berker.peksag) Date: Wed, 15 Jun 2016 15:16:48 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Make_faq/gener?= =?utf-8?q?al=2Erst_gender-inclusive=2C_patch_by_Sam_Hathaway=2E?= Message-ID: <20160615151242.28042.5586.6A42C11C@psf.io> https://hg.python.org/cpython/rev/e9fb7970f8b0 changeset: 102053:e9fb7970f8b0 branch: 3.5 parent: 102049:1e7072d53b84 user: Berker Peksag date: Wed Jun 15 18:12:49 2016 +0300 summary: Make faq/general.rst gender-inclusive, patch by Sam Hathaway. files: Doc/faq/general.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/faq/general.rst b/Doc/faq/general.rst --- a/Doc/faq/general.rst +++ b/Doc/faq/general.rst @@ -438,7 +438,7 @@ >>> L [1] -With the interpreter, documentation is never far from the student as he's +With the interpreter, documentation is never far from the student as they are programming. There are also good IDEs for Python. IDLE is a cross-platform IDE for Python -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 15 11:16:48 2016 From: python-checkins at python.org (berker.peksag) Date: Wed, 15 Jun 2016 15:16:48 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5?= Message-ID: <20160615151243.9983.25201.B42D8FB3@psf.io> https://hg.python.org/cpython/rev/5d2784a3e463 changeset: 102054:5d2784a3e463 parent: 102052:4ef3a93e1be2 parent: 102053:e9fb7970f8b0 user: Berker Peksag date: Wed Jun 15 18:13:12 2016 +0300 summary: Merge from 3.5 files: Doc/faq/general.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/faq/general.rst b/Doc/faq/general.rst --- a/Doc/faq/general.rst +++ b/Doc/faq/general.rst @@ -438,7 +438,7 @@ >>> L [1] -With the interpreter, documentation is never far from the student as he's +With the interpreter, documentation is never far from the student as they are programming. There are also good IDEs for Python. IDLE is a cross-platform IDE for Python -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 15 13:09:14 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 15 Jun 2016 17:09:14 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327301=3A_Fixed_incorrect_return_codes_for_error?= =?utf-8?q?s_in_compile=2Ec=2E?= Message-ID: <20160615170858.11591.96079.7BF44ECF@psf.io> https://hg.python.org/cpython/rev/2b3cd7e4b2b6 changeset: 102057:2b3cd7e4b2b6 parent: 102054:5d2784a3e463 parent: 102055:51fe72949245 user: Serhiy Storchaka date: Wed Jun 15 20:07:53 2016 +0300 summary: Issue #27301: Fixed incorrect return codes for errors in compile.c. files: Python/compile.c | 62 ++++++++++++++++++++++------------- 1 files changed, 38 insertions(+), 24 deletions(-) diff --git a/Python/compile.c b/Python/compile.c --- a/Python/compile.c +++ b/Python/compile.c @@ -1532,10 +1532,14 @@ return 1; } -static Py_ssize_t +static int compiler_visit_kwonlydefaults(struct compiler *c, asdl_seq *kwonlyargs, asdl_seq *kw_defaults) { + /* Push a dict of keyword-only default values. + + Return 0 on error, -1 if no dict pushed, 1 if a dict is pushed. + */ int i; PyObject *keys = NULL; @@ -1551,7 +1555,7 @@ keys = PyList_New(1); if (keys == NULL) { Py_DECREF(mangled); - return -1; + return 0; } PyList_SET_ITEM(keys, 0, mangled); } @@ -1572,19 +1576,20 @@ PyObject *keys_tuple = PyList_AsTuple(keys); Py_DECREF(keys); if (keys_tuple == NULL) { - return -1; + return 0; } ADDOP_N(c, LOAD_CONST, keys_tuple, consts); ADDOP_I(c, BUILD_CONST_KEY_MAP, default_count); - return default_count; + assert(default_count > 0); + return 1; } else { - return 0; + return -1; } error: Py_XDECREF(keys); - return -1; + return 0; } static int @@ -1623,21 +1628,21 @@ return 1; } -static Py_ssize_t +static int compiler_visit_annotations(struct compiler *c, arguments_ty args, expr_ty returns) { - /* Push arg annotation dict. Return # of items pushed. + /* Push arg annotation dict. The expressions are evaluated out-of-order wrt the source code. - Returns -1 on error. + Return 0 on error, -1 if no dict pushed, 1 if a dict is pushed. */ static identifier return_str; PyObject *names; Py_ssize_t len; names = PyList_New(0); if (!names) - return -1; + return 0; if (!compiler_visit_argannotations(c, args->args, names)) goto error; @@ -1666,19 +1671,28 @@ PyObject *keytuple = PyList_AsTuple(names); Py_DECREF(names); if (keytuple == NULL) { - return -1; + return 0; } ADDOP_N(c, LOAD_CONST, keytuple, consts); ADDOP_I(c, BUILD_CONST_KEY_MAP, len); + return 1; } else { Py_DECREF(names); + return -1; } - return len; error: Py_DECREF(names); - return -1; + return 0; +} + +static int +compiler_visit_defaults(struct compiler *c, arguments_ty args) +{ + VISIT_SEQ(c, expr, args->defaults); + ADDOP_I(c, BUILD_TUPLE, asdl_seq_LEN(args->defaults)); + return 1; } static Py_ssize_t @@ -1686,14 +1700,14 @@ { Py_ssize_t funcflags = 0; if (args->defaults && asdl_seq_LEN(args->defaults) > 0) { - VISIT_SEQ(c, expr, args->defaults); - ADDOP_I(c, BUILD_TUPLE, asdl_seq_LEN(args->defaults)); + if (!compiler_visit_defaults(c, args)) + return -1; funcflags |= 0x01; } if (args->kwonlyargs) { - Py_ssize_t res = compiler_visit_kwonlydefaults(c, args->kwonlyargs, + int res = compiler_visit_kwonlydefaults(c, args->kwonlyargs, args->kw_defaults); - if (res < 0) { + if (res == 0) { return -1; } else if (res > 0) { @@ -1716,7 +1730,7 @@ stmt_ty st; Py_ssize_t i, n, funcflags; int docstring; - int num_annotations; + int annotations; int scope_type; if (is_async) { @@ -1749,11 +1763,11 @@ return 0; } - num_annotations = compiler_visit_annotations(c, args, returns); - if (num_annotations < 0) { + annotations = compiler_visit_annotations(c, args, returns); + if (annotations == 0) { return 0; } - else if (num_annotations > 0) { + else if (annotations > 0) { funcflags |= 0x04; } @@ -2478,7 +2492,7 @@ Py_ssize_t dot = PyUnicode_FindChar(name, '.', 0, PyUnicode_GET_LENGTH(name), 1); if (dot == -2) - return -1; + return 0; if (dot != -1) { /* Consume the base module name to get the first attribute */ Py_ssize_t pos = dot + 1; @@ -2487,12 +2501,12 @@ dot = PyUnicode_FindChar(name, '.', pos, PyUnicode_GET_LENGTH(name), 1); if (dot == -2) - return -1; + return 0; attr = PyUnicode_Substring(name, pos, (dot != -1) ? dot : PyUnicode_GET_LENGTH(name)); if (!attr) - return -1; + return 0; ADDOP_O(c, LOAD_ATTR, attr, names); Py_DECREF(attr); pos = dot + 1; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 15 13:11:46 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 15 Jun 2016 17:11:46 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MzAx?= =?utf-8?q?=3A_Fixed_incorrect_return_codes_for_errors_in_compile=2Ec=2E?= Message-ID: <20160615170857.87676.98104.99895B32@psf.io> https://hg.python.org/cpython/rev/51fe72949245 changeset: 102055:51fe72949245 branch: 3.5 parent: 102053:e9fb7970f8b0 user: Serhiy Storchaka date: Wed Jun 15 20:06:07 2016 +0300 summary: Issue #27301: Fixed incorrect return codes for errors in compile.c. files: Python/compile.c | 36 ++++++++++++++++++++---------------- 1 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Python/compile.c b/Python/compile.c --- a/Python/compile.c +++ b/Python/compile.c @@ -1494,6 +1494,9 @@ compiler_visit_kwonlydefaults(struct compiler *c, asdl_seq *kwonlyargs, asdl_seq *kw_defaults) { + /* Return the number of defaults + 1. + Returns 0 on error. + */ int i, default_count = 0; for (i = 0; i < asdl_seq_LEN(kwonlyargs); i++) { arg_ty arg = asdl_seq_GET(kwonlyargs, i); @@ -1501,16 +1504,16 @@ if (default_) { PyObject *mangled = _Py_Mangle(c->u->u_private, arg->arg); if (!mangled) - return -1; + return 0; ADDOP_O(c, LOAD_CONST, mangled, consts); Py_DECREF(mangled); if (!compiler_visit_expr(c, default_)) { - return -1; + return 0; } default_count++; } } - return default_count; + return default_count + 1; } static int @@ -1554,17 +1557,17 @@ expr_ty returns) { /* Push arg annotations and a list of the argument names. Return the # - of items pushed. The expressions are evaluated out-of-order wrt the + of items pushed + 1. The expressions are evaluated out-of-order wrt the source code. - More than 2^16-1 annotations is a SyntaxError. Returns -1 on error. + More than 2^16-1 annotations is a SyntaxError. Returns 0 on error. */ static identifier return_str; PyObject *names; Py_ssize_t len; names = PyList_New(0); if (!names) - return -1; + return 0; if (!compiler_visit_argannotations(c, args->args, names)) goto error; @@ -1614,11 +1617,11 @@ Py_DECREF(names); /* We just checked that len <= 65535, see above */ - return Py_SAFE_DOWNCAST(len, Py_ssize_t, int); + return Py_SAFE_DOWNCAST(len + 1, Py_ssize_t, int); error: Py_DECREF(names); - return -1; + return 0; } static int @@ -1667,13 +1670,14 @@ if (args->kwonlyargs) { int res = compiler_visit_kwonlydefaults(c, args->kwonlyargs, args->kw_defaults); - if (res < 0) + if (res == 0) return 0; - kw_default_count = res; + kw_default_count = res - 1; } num_annotations = compiler_visit_annotations(c, args, returns); - if (num_annotations < 0) + if (num_annotations == 0) return 0; + num_annotations--; assert((num_annotations & 0xFFFF) == num_annotations); if (!compiler_enter_scope(c, name, @@ -1889,8 +1893,8 @@ if (args->kwonlyargs) { int res = compiler_visit_kwonlydefaults(c, args->kwonlyargs, args->kw_defaults); - if (res < 0) return 0; - kw_default_count = res; + if (res == 0) return 0; + kw_default_count = res - 1; } if (!compiler_enter_scope(c, name, COMPILER_SCOPE_LAMBDA, (void *)e, e->lineno)) @@ -2403,7 +2407,7 @@ Py_ssize_t dot = PyUnicode_FindChar(name, '.', 0, PyUnicode_GET_LENGTH(name), 1); if (dot == -2) - return -1; + return 0; if (dot != -1) { /* Consume the base module name to get the first attribute */ Py_ssize_t pos = dot + 1; @@ -2412,12 +2416,12 @@ dot = PyUnicode_FindChar(name, '.', pos, PyUnicode_GET_LENGTH(name), 1); if (dot == -2) - return -1; + return 0; attr = PyUnicode_Substring(name, pos, (dot != -1) ? dot : PyUnicode_GET_LENGTH(name)); if (!attr) - return -1; + return 0; ADDOP_O(c, LOAD_ATTR, attr, names); Py_DECREF(attr); pos = dot + 1; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 15 13:11:46 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 15 Jun 2016 17:11:46 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI3MzAx?= =?utf-8?q?=3A_Fixed_incorrect_return_code_for_error_in_compile=2Ec=2E?= Message-ID: <20160615170858.114454.78477.3470850C@psf.io> https://hg.python.org/cpython/rev/c388b0751290 changeset: 102056:c388b0751290 branch: 2.7 parent: 102051:ce8b8e1055d1 user: Serhiy Storchaka date: Wed Jun 15 20:06:29 2016 +0300 summary: Issue #27301: Fixed incorrect return code for error in compile.c. files: Python/compile.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Python/compile.c b/Python/compile.c --- a/Python/compile.c +++ b/Python/compile.c @@ -1889,7 +1889,7 @@ attr = PyString_FromStringAndSize(src, dot ? dot - src : strlen(src)); if (!attr) - return -1; + return 0; ADDOP_O(c, LOAD_ATTR, attr, names); Py_DECREF(attr); src = dot + 1; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 15 15:13:11 2016 From: python-checkins at python.org (brett.cannon) Date: Wed, 15 Jun 2016 19:13:11 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Fix_an_indentation_problem?= Message-ID: <20160615191307.99256.94090.025CD675@psf.io> https://hg.python.org/peps/rev/06493d03607d changeset: 6379:06493d03607d user: Brett Cannon date: Wed Jun 15 12:13:03 2016 -0700 summary: Fix an indentation problem files: pep-0519.txt | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pep-0519.txt b/pep-0519.txt --- a/pep-0519.txt +++ b/pep-0519.txt @@ -326,10 +326,10 @@ (`done `__) #. Add ``os.PathLike`` (`code `__ and - `docs `__ done) + `docs `__ done) #. Add ``PyOS_FSPath()`` (`code `__ and - `docs `__ done) + `docs `__ done) #. Add ``os.fspath()`` (`done `__) #. Update ``os.fsencode()`` -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Wed Jun 15 15:13:12 2016 From: python-checkins at python.org (brett.cannon) Date: Wed, 15 Jun 2016 19:13:12 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Ignore_VS_Code=27s_config_dir?= =?utf-8?q?ectory=2E?= Message-ID: <20160615191306.26023.32221.7061A6EA@psf.io> https://hg.python.org/peps/rev/41abf423ef37 changeset: 6378:41abf423ef37 user: Brett Cannon date: Wed Jun 15 12:12:50 2016 -0700 summary: Ignore VS Code's config directory. files: .gitignore | 1 + .hgignore | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) diff --git a/.gitignore b/.gitignore --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ *.pyo *~ *env +.vscode diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -5,3 +5,4 @@ *.pyo *~ *env +.vscode -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Wed Jun 15 15:56:42 2016 From: python-checkins at python.org (brett.cannon) Date: Wed, 15 Jun 2016 19:56:42 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Update_PEP_519_as_per?= Message-ID: <20160615195635.19950.31363.4328F7EC@psf.io> https://hg.python.org/peps/rev/92feff129ee4 changeset: 6380:92feff129ee4 user: Brett Cannon date: Wed Jun 15 12:56:31 2016 -0700 summary: Update PEP 519 as per https://mail.python.org/pipermail/python-dev/2016-June/145219.html files: pep-0519.txt | 25 +++++++++++++++++++++---- 1 files changed, 21 insertions(+), 4 deletions(-) diff --git a/pep-0519.txt b/pep-0519.txt --- a/pep-0519.txt +++ b/pep-0519.txt @@ -149,7 +149,10 @@ def fspath(path: t.Union[PathLike, str, bytes]) -> t.Union[str, bytes]: """Return the string representation of the path. - If str or bytes is passed in, it is returned unchanged. + If str or bytes is passed in, it is returned unchanged. If __fspath__() + returns something other than str or bytes then TypeError is raised. If + this function is given something that is not str, bytes, or os.PathLike + then TypeError is raised. """ if isinstance(path, (str, bytes)): return path @@ -158,13 +161,19 @@ # methods. path_type = type(path) try: - return path_type.__fspath__(path) + path = path_type.__fspath__(path) except AttributeError: if hasattr(path_type, '__fspath__'): raise + else: + if isinstance(path, (str, bytes)): + return path + else: + raise TypeError("expected __fspath__() to return str or bytes, " + "not " + type(path).__name__) - raise TypeError("expected str, bytes or os.PathLike object, not " - + path_type.__name__) + raise TypeError("expected str, bytes or os.PathLike object, not " + + path_type.__name__) The ``os.fsencode()`` [#os-fsencode]_ and ``os.fsdecode()`` [#os-fsdecode]_ functions will be updated to accept @@ -294,6 +303,14 @@ path_repr = PyObject_CallFunctionObjArgs(func, NULL); Py_DECREF(func); + if (!PyUnicode_Check(path_repr) && !PyBytes_Check(path_repr)) { + Py_DECREF(path_repr); + return PyErr_Format(PyExc_TypeError, + "expected __fspath__() to return str or bytes, " + "not %S", + path_repr->ob_type); + } + return path_repr; } -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Wed Jun 15 18:10:27 2016 From: python-checkins at python.org (ned.deily) Date: Wed, 15 Jun 2016 22:10:27 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MzI3?= =?utf-8?q?=3A_fix_doc_typo=2C_noted_by_Jakub_Wilk=2E?= Message-ID: <20160615221017.99278.19892.E9FE0226@psf.io> https://hg.python.org/cpython/rev/2a7dd5414485 changeset: 102058:2a7dd5414485 branch: 3.5 parent: 102055:51fe72949245 user: Ned Deily date: Wed Jun 15 18:06:32 2016 -0400 summary: Issue #27327: fix doc typo, noted by Jakub Wilk. files: Doc/library/re.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/re.rst b/Doc/library/re.rst --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -443,7 +443,7 @@ The ``'\u'`` and ``'\U'`` escape sequences have been added. .. deprecated-removed:: 3.5 3.6 - Unknown escapes consist of ``'\'`` and ASCII letter now raise a + Unknown escapes consisting of ``'\'`` and ASCII letter now raise a deprecation warning and will be forbidden in Python 3.6. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 15 18:10:27 2016 From: python-checkins at python.org (ned.deily) Date: Wed, 15 Jun 2016 22:10:27 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327327=3A_null_merge_from_3=2E5?= Message-ID: <20160615221017.81161.27631.6679F544@psf.io> https://hg.python.org/cpython/rev/b3f97ed4a904 changeset: 102059:b3f97ed4a904 parent: 102057:2b3cd7e4b2b6 parent: 102058:2a7dd5414485 user: Ned Deily date: Wed Jun 15 18:09:45 2016 -0400 summary: Issue #27327: null merge from 3.5 files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 15 18:17:12 2016 From: python-checkins at python.org (zach.ware) Date: Wed, 15 Jun 2016 22:17:12 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI2OTMw?= =?utf-8?q?=3A_Update_Windows_build_to_OpenSSL_1=2E0=2E2h?= Message-ID: <20160615221711.101682.92618.56E39BA0@psf.io> https://hg.python.org/cpython/rev/155e665428c6 changeset: 102061:155e665428c6 branch: 3.5 parent: 102058:2a7dd5414485 user: Zachary Ware date: Wed Jun 15 17:13:28 2016 -0500 summary: Issue #26930: Update Windows build to OpenSSL 1.0.2h files: Misc/NEWS | 1 + PCbuild/get_externals.bat | 2 +- PCbuild/python.props | 2 +- PCbuild/readme.txt | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -36,6 +36,7 @@ locale encoding, and fix get_begidx() and get_endidx() to return code point indexes. +- Issue #26930: Update Windows builds to use OpenSSL 1.0.2h. What's New in Python 3.5.2 final? ================================= diff --git a/PCbuild/get_externals.bat b/PCbuild/get_externals.bat --- a/PCbuild/get_externals.bat +++ b/PCbuild/get_externals.bat @@ -54,7 +54,7 @@ set libraries= set libraries=%libraries% bzip2-1.0.6 if NOT "%IncludeSSL%"=="false" set libraries=%libraries% nasm-2.11.06 -if NOT "%IncludeSSL%"=="false" set libraries=%libraries% openssl-1.0.2g +if NOT "%IncludeSSL%"=="false" set libraries=%libraries% openssl-1.0.2h set libraries=%libraries% sqlite-3.8.11.0 if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tcl-core-8.6.4.2 if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tk-8.6.4.2 diff --git a/PCbuild/python.props b/PCbuild/python.props --- a/PCbuild/python.props +++ b/PCbuild/python.props @@ -41,7 +41,7 @@ $(ExternalsDir)sqlite-3.8.11.0\ $(ExternalsDir)bzip2-1.0.6\ $(ExternalsDir)xz-5.0.5\ - $(ExternalsDir)openssl-1.0.2g\ + $(ExternalsDir)openssl-1.0.2h\ $(opensslDir)include32 $(opensslDir)include64 $(ExternalsDir)\nasm-2.11.06\ diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt --- a/PCbuild/readme.txt +++ b/PCbuild/readme.txt @@ -169,7 +169,7 @@ Homepage: http://tukaani.org/xz/ _ssl - Python wrapper for version 1.0.2g of the OpenSSL secure sockets + Python wrapper for version 1.0.2h of the OpenSSL secure sockets library, which is built by ssl.vcxproj Homepage: http://www.openssl.org/ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 15 18:17:12 2016 From: python-checkins at python.org (zach.ware) Date: Wed, 15 Jun 2016 22:17:12 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI2OTMw?= =?utf-8?q?=3A_Update_Windows_build_to_OpenSSL_1=2E0=2E2h?= Message-ID: <20160615221711.87546.96353.9609A20B@psf.io> https://hg.python.org/cpython/rev/399d49d4acae changeset: 102060:399d49d4acae branch: 2.7 parent: 102056:c388b0751290 user: Zachary Ware date: Wed Jun 15 17:12:38 2016 -0500 summary: Issue #26930: Update Windows build to OpenSSL 1.0.2h files: Misc/NEWS | 5 +++++ PC/VS9.0/pyproject.vsprops | 2 +- PC/VS9.0/readme.txt | 2 +- PCbuild/get_externals.bat | 2 +- PCbuild/python.props | 2 +- PCbuild/readme.txt | 2 +- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -28,6 +28,11 @@ resulting links to use lowercase. Patch by Sean Rodman, test by Kaushik Nadikuditi. +Build +----- + +- Issue #26930: Update Windows builds to use OpenSSL 1.0.2h. + What's New in Python 2.7.12 release candidate 1? ================================================ diff --git a/PC/VS9.0/pyproject.vsprops b/PC/VS9.0/pyproject.vsprops --- a/PC/VS9.0/pyproject.vsprops +++ b/PC/VS9.0/pyproject.vsprops @@ -82,7 +82,7 @@ /> $(ExternalsDir)sqlite-3.8.11.0\ $(ExternalsDir)bzip2-1.0.6\ $(ExternalsDir)db-4.7.25.0 - $(ExternalsDir)openssl-1.0.2g\ + $(ExternalsDir)openssl-1.0.2h\ $(opensslDir)include32 $(opensslDir)include64 $(ExternalsDir)\nasm-2.11.06\ diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt --- a/PCbuild/readme.txt +++ b/PCbuild/readme.txt @@ -183,7 +183,7 @@ Homepage: http://www.bzip.org/ _ssl - Python wrapper for version 1.0.2g of the OpenSSL secure sockets + Python wrapper for version 1.0.2h of the OpenSSL secure sockets library, which is built by ssl.vcxproj Homepage: http://www.openssl.org/ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 15 18:17:13 2016 From: python-checkins at python.org (zach.ware) Date: Wed, 15 Jun 2016 22:17:13 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2326930=3A_Merge_with_3=2E5?= Message-ID: <20160615221711.9646.92250.BC222EFA@psf.io> https://hg.python.org/cpython/rev/3d726dbfca31 changeset: 102062:3d726dbfca31 parent: 102059:b3f97ed4a904 parent: 102061:155e665428c6 user: Zachary Ware date: Wed Jun 15 17:16:16 2016 -0500 summary: Issue #26930: Merge with 3.5 files: Misc/NEWS | 2 ++ PCbuild/get_externals.bat | 2 +- PCbuild/python.props | 2 +- PCbuild/readme.txt | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -47,6 +47,8 @@ Build ----- +- Issue #26930: Update Windows builds to use OpenSSL 1.0.2h. + - Issue #23968: Rename the platform directory from plat-$(MACHDEP) to plat-$(PLATFORM_TRIPLET). Rename the config directory (LIBPL) from config-$(LDVERSION) to diff --git a/PCbuild/get_externals.bat b/PCbuild/get_externals.bat --- a/PCbuild/get_externals.bat +++ b/PCbuild/get_externals.bat @@ -54,7 +54,7 @@ set libraries= set libraries=%libraries% bzip2-1.0.6 if NOT "%IncludeSSL%"=="false" set libraries=%libraries% nasm-2.11.06 -if NOT "%IncludeSSL%"=="false" set libraries=%libraries% openssl-1.0.2g +if NOT "%IncludeSSL%"=="false" set libraries=%libraries% openssl-1.0.2h set libraries=%libraries% sqlite-3.8.11.0 if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tcl-core-8.6.4.2 if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tk-8.6.4.2 diff --git a/PCbuild/python.props b/PCbuild/python.props --- a/PCbuild/python.props +++ b/PCbuild/python.props @@ -41,7 +41,7 @@ $(ExternalsDir)sqlite-3.8.11.0\ $(ExternalsDir)bzip2-1.0.6\ $(ExternalsDir)xz-5.0.5\ - $(ExternalsDir)openssl-1.0.2g\ + $(ExternalsDir)openssl-1.0.2h\ $(opensslDir)include32 $(opensslDir)include64 $(ExternalsDir)\nasm-2.11.06\ diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt --- a/PCbuild/readme.txt +++ b/PCbuild/readme.txt @@ -169,7 +169,7 @@ Homepage: http://tukaani.org/xz/ _ssl - Python wrapper for version 1.0.2g of the OpenSSL secure sockets + Python wrapper for version 1.0.2h of the OpenSSL secure sockets library, which is built by ssl.vcxproj Homepage: http://www.openssl.org/ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 16 01:49:27 2016 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 16 Jun 2016 05:49:27 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_delete_some_unhelpful_sentenc?= =?utf-8?q?es?= Message-ID: <20160616054927.7813.98510.F032BB8C@psf.io> https://hg.python.org/peps/rev/8575ee1aa314 changeset: 6381:8575ee1aa314 user: Benjamin Peterson date: Wed Jun 15 22:49:21 2016 -0700 summary: delete some unhelpful sentences files: pep-0373.txt | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/pep-0373.txt b/pep-0373.txt --- a/pep-0373.txt +++ b/pep-0373.txt @@ -14,9 +14,7 @@ ======== This document describes the development and release schedule for -Python 2.7. The schedule primarily concerns itself with PEP-sized -items. Small features may be added up to and including the first beta -release. Bugs may be fixed until the final release. +Python 2.7. Update ====== -- Repository URL: https://hg.python.org/peps From solipsis at pitrou.net Thu Jun 16 04:51:33 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 16 Jun 2016 08:51:33 +0000 Subject: [Python-checkins] Daily reference leaks (3d726dbfca31): sum=8 Message-ID: <20160616085133.7792.87772.DAA7AAF2@psf.io> results for 3d726dbfca31 on branch "default" -------------------------------------------- test_collections leaked [0, 0, 4] memory blocks, sum=4 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [-2, 1, -1] memory blocks, sum=-2 test_typing leaked [2, 0, 0] references, sum=2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogRtIttm', '--timeout', '7200'] From lp_benchmark_robot at intel.com Thu Jun 16 09:08:53 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 16 Jun 2016 14:08:53 +0100 Subject: [Python-checkins] GOOD Benchmark Results for Python Default 2016-06-16 Message-ID: Results for project Python default, build date 2016-06-16 02:02:25 +0000 commit: 3d726dbfca31 previous commit: e3bb87952c62 revision date: 2016-06-15 22:16:16 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.21% 1.39% 8.85% 17.61% :-| pybench 0.16% -0.07% 1.93% 7.70% :-( regex_v8 2.71% -0.10% -2.67% 3.20% :-| nbody 0.45% -0.49% 0.05% 8.90% :-| json_dump_v2 0.41% 1.23% -1.39% 13.76% :-| normal_startup 0.76% -0.31% 0.97% 5.99% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-default-2016-06-16/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Thu Jun 16 09:09:21 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 16 Jun 2016 14:09:21 +0100 Subject: [Python-checkins] GOOD Benchmark Results for Python 2.7 2016-06-16 Message-ID: <8d9eeba0-c899-451e-aaf0-7fd0df2452cc@irsmsx106.ger.corp.intel.com> Results for project Python 2.7, build date 2016-06-16 02:46:21 +0000 commit: 399d49d4acae previous commit: 2e6fda267a20 revision date: 2016-06-15 22:12:38 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.15% 1.35% 5.46% 3.32% :-) pybench 0.16% -0.00% 5.77% 4.46% :-( regex_v8 0.48% -0.12% -2.40% 10.99% :-) nbody 0.05% -0.22% 8.77% 2.17% :-) json_dump_v2 0.50% -0.02% 2.32% 11.20% :-( normal_startup 1.70% -0.19% -5.58% 1.31% :-| ssbench 0.14% 0.26% 0.79% 2.65% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-2-7-2016-06-16/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Thu Jun 16 15:10:38 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 16 Jun 2016 19:10:38 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327330=3A_Fixed_possible_leaks_in_the_ctypes_mod?= =?utf-8?q?ule=2E?= Message-ID: <20160616191036.6261.48597.091F190B@psf.io> https://hg.python.org/cpython/rev/27e7945c4ecd changeset: 102065:27e7945c4ecd parent: 102062:3d726dbfca31 parent: 102064:41f99ee19804 user: Serhiy Storchaka date: Thu Jun 16 22:10:13 2016 +0300 summary: Issue #27330: Fixed possible leaks in the ctypes module. files: Misc/NEWS | 2 ++ Modules/_ctypes/_ctypes.c | 25 +++++++++++++++++++------ Modules/_ctypes/callproc.c | 8 +++++++- Modules/_ctypes/cfield.c | 20 +++++--------------- 4 files changed, 33 insertions(+), 22 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Library ------- +- Issue #27330: Fixed possible leaks in the ctypes module. + - Issue #27238: Got rid of bare excepts in the turtle module. Original patch by Jelle Zijlstra. diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -1252,8 +1252,10 @@ descr = PyDescr_NewMethod(type, meth); if (descr == NULL) return -1; - if (PyDict_SetItemString(dict,meth->ml_name, descr) < 0) + if (PyDict_SetItemString(dict, meth->ml_name, descr) < 0) { + Py_DECREF(descr); return -1; + } Py_DECREF(descr); } return 0; @@ -1268,8 +1270,10 @@ descr = PyDescr_NewMember(type, memb); if (descr == NULL) return -1; - if (PyDict_SetItemString(dict, memb->name, descr) < 0) + if (PyDict_SetItemString(dict, memb->name, descr) < 0) { + Py_DECREF(descr); return -1; + } Py_DECREF(descr); } return 0; @@ -1285,8 +1289,10 @@ descr = PyDescr_NewGetSet(type, gsp); if (descr == NULL) return -1; - if (PyDict_SetItemString(dict, gsp->name, descr) < 0) + if (PyDict_SetItemString(dict, gsp->name, descr) < 0) { + Py_DECREF(descr); return -1; + } Py_DECREF(descr); } return 0; @@ -1778,6 +1784,7 @@ newname = PyUnicode_Concat(name, suffix); if (newname == NULL) { + Py_DECREF(swapped_args); return NULL; } @@ -1797,8 +1804,10 @@ stgdict = (StgDictObject *)PyObject_CallObject( (PyObject *)&PyCStgDict_Type, NULL); - if (!stgdict) /* XXX leaks result! */ + if (!stgdict) { + Py_DECREF(result); return NULL; + } stgdict->ffi_type_pointer = *fmt->pffi_type; stgdict->align = fmt->pffi_type->alignment; @@ -1978,8 +1987,10 @@ PyObject *meth; int x; meth = PyDescr_NewClassMethod(result, ml); - if (!meth) + if (!meth) { + Py_DECREF(result); return NULL; + } x = PyDict_SetItemString(result->tp_dict, ml->ml_name, meth); @@ -2159,8 +2170,10 @@ nArgs = PyTuple_GET_SIZE(ob); converters = PyTuple_New(nArgs); - if (!converters) + if (!converters) { + Py_DECREF(ob); return NULL; + } /* I have to check if this is correct. Using c_char, which has a size of 1, will be assumed to be pushed as only one byte! diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -157,8 +157,10 @@ return NULL; memset(space, 0, sizeof(int) * 2); errobj = PyCapsule_New(space, CTYPES_CAPSULE_NAME_PYMEM, pymem_destructor); - if (errobj == NULL) + if (errobj == NULL) { + PyMem_Free(space); return NULL; + } if (-1 == PyDict_SetItem(dict, error_object_name, errobj)) { Py_DECREF(errobj); @@ -1681,6 +1683,10 @@ if (result == NULL) return result; key = PyLong_FromVoidPtr(result); + if (key == NULL) { + Py_DECREF(result); + return NULL; + } } else if (PyType_Check(cls)) { typ = (PyTypeObject *)cls; buf = PyMem_Malloc(strlen(typ->tp_name) + 3 + 1); diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c --- a/Modules/_ctypes/cfield.c +++ b/Modules/_ctypes/cfield.c @@ -1246,8 +1246,7 @@ "unicode string expected instead of %s instance", value->ob_type->tp_name); return NULL; - } else - Py_INCREF(value); + } wstr = PyUnicode_AsUnicodeAndSize(value, &size); if (wstr == NULL) @@ -1256,7 +1255,6 @@ PyErr_Format(PyExc_ValueError, "string too long (%zd, maximum length %zd)", size, length); - Py_DECREF(value); return NULL; } else if (size < length-1) /* copy terminating NUL character if there is space */ @@ -1266,6 +1264,7 @@ return NULL; } + Py_INCREF(value); return value; } @@ -1292,9 +1291,7 @@ char *data; Py_ssize_t size; - if(PyBytes_Check(value)) { - Py_INCREF(value); - } else { + if(!PyBytes_Check(value)) { PyErr_Format(PyExc_TypeError, "expected bytes, %s found", value->ob_type->tp_name); @@ -1302,11 +1299,9 @@ } data = PyBytes_AS_STRING(value); - if (!data) - return NULL; size = strlen(data); /* XXX Why not Py_SIZE(value)? */ if (size < length) { - /* This will copy the leading NUL character + /* This will copy the terminating NUL character * if there is space for it. */ ++size; @@ -1314,13 +1309,11 @@ PyErr_Format(PyExc_ValueError, "bytes too long (%zd, maximum length %zd)", size, length); - Py_DECREF(value); return NULL; } /* Also copy the terminating NUL character if there is space */ memcpy((char *)ptr, data, size); - Py_DECREF(value); _RET(value); } @@ -1428,9 +1421,7 @@ /* convert value into a PyUnicodeObject or NULL */ if (Py_None == value) { value = NULL; - } else if (PyUnicode_Check(value)) { - Py_INCREF(value); /* for the descref below */ - } else { + } else if (!PyUnicode_Check(value)) { PyErr_Format(PyExc_TypeError, "unicode string expected instead of %s instance", value->ob_type->tp_name); @@ -1449,7 +1440,6 @@ return NULL; } bstr = SysAllocStringLen(wvalue, (unsigned)wsize); - Py_DECREF(value); } else bstr = NULL; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 16 15:10:46 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 16 Jun 2016 19:10:46 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MzMw?= =?utf-8?q?=3A_Fixed_possible_leaks_in_the_ctypes_module=2E?= Message-ID: <20160616191036.19998.75557.353D099B@psf.io> https://hg.python.org/cpython/rev/41f99ee19804 changeset: 102064:41f99ee19804 branch: 3.5 parent: 102061:155e665428c6 user: Serhiy Storchaka date: Thu Jun 16 22:08:46 2016 +0300 summary: Issue #27330: Fixed possible leaks in the ctypes module. files: Misc/NEWS | 2 ++ Modules/_ctypes/_ctypes.c | 25 +++++++++++++++++++------ Modules/_ctypes/callproc.c | 8 +++++++- Modules/_ctypes/cfield.c | 20 +++++--------------- 4 files changed, 33 insertions(+), 22 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,8 @@ Library ------- +- Issue #27330: Fixed possible leaks in the ctypes module. + - Issue #27238: Got rid of bare excepts in the turtle module. Original patch by Jelle Zijlstra. diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -1252,8 +1252,10 @@ descr = PyDescr_NewMethod(type, meth); if (descr == NULL) return -1; - if (PyDict_SetItemString(dict,meth->ml_name, descr) < 0) + if (PyDict_SetItemString(dict, meth->ml_name, descr) < 0) { + Py_DECREF(descr); return -1; + } Py_DECREF(descr); } return 0; @@ -1268,8 +1270,10 @@ descr = PyDescr_NewMember(type, memb); if (descr == NULL) return -1; - if (PyDict_SetItemString(dict, memb->name, descr) < 0) + if (PyDict_SetItemString(dict, memb->name, descr) < 0) { + Py_DECREF(descr); return -1; + } Py_DECREF(descr); } return 0; @@ -1285,8 +1289,10 @@ descr = PyDescr_NewGetSet(type, gsp); if (descr == NULL) return -1; - if (PyDict_SetItemString(dict, gsp->name, descr) < 0) + if (PyDict_SetItemString(dict, gsp->name, descr) < 0) { + Py_DECREF(descr); return -1; + } Py_DECREF(descr); } return 0; @@ -1778,6 +1784,7 @@ newname = PyUnicode_Concat(name, suffix); if (newname == NULL) { + Py_DECREF(swapped_args); return NULL; } @@ -1797,8 +1804,10 @@ stgdict = (StgDictObject *)PyObject_CallObject( (PyObject *)&PyCStgDict_Type, NULL); - if (!stgdict) /* XXX leaks result! */ + if (!stgdict) { + Py_DECREF(result); return NULL; + } stgdict->ffi_type_pointer = *fmt->pffi_type; stgdict->align = fmt->pffi_type->alignment; @@ -1978,8 +1987,10 @@ PyObject *meth; int x; meth = PyDescr_NewClassMethod(result, ml); - if (!meth) + if (!meth) { + Py_DECREF(result); return NULL; + } x = PyDict_SetItemString(result->tp_dict, ml->ml_name, meth); @@ -2159,8 +2170,10 @@ nArgs = PyTuple_GET_SIZE(ob); converters = PyTuple_New(nArgs); - if (!converters) + if (!converters) { + Py_DECREF(ob); return NULL; + } /* I have to check if this is correct. Using c_char, which has a size of 1, will be assumed to be pushed as only one byte! diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -157,8 +157,10 @@ return NULL; memset(space, 0, sizeof(int) * 2); errobj = PyCapsule_New(space, CTYPES_CAPSULE_NAME_PYMEM, pymem_destructor); - if (errobj == NULL) + if (errobj == NULL) { + PyMem_Free(space); return NULL; + } if (-1 == PyDict_SetItem(dict, error_object_name, errobj)) { Py_DECREF(errobj); @@ -1681,6 +1683,10 @@ if (result == NULL) return result; key = PyLong_FromVoidPtr(result); + if (key == NULL) { + Py_DECREF(result); + return NULL; + } } else if (PyType_Check(cls)) { typ = (PyTypeObject *)cls; buf = PyMem_Malloc(strlen(typ->tp_name) + 3 + 1); diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c --- a/Modules/_ctypes/cfield.c +++ b/Modules/_ctypes/cfield.c @@ -1246,8 +1246,7 @@ "unicode string expected instead of %s instance", value->ob_type->tp_name); return NULL; - } else - Py_INCREF(value); + } wstr = PyUnicode_AsUnicodeAndSize(value, &size); if (wstr == NULL) @@ -1256,7 +1255,6 @@ PyErr_Format(PyExc_ValueError, "string too long (%zd, maximum length %zd)", size, length); - Py_DECREF(value); return NULL; } else if (size < length-1) /* copy terminating NUL character if there is space */ @@ -1266,6 +1264,7 @@ return NULL; } + Py_INCREF(value); return value; } @@ -1292,9 +1291,7 @@ char *data; Py_ssize_t size; - if(PyBytes_Check(value)) { - Py_INCREF(value); - } else { + if(!PyBytes_Check(value)) { PyErr_Format(PyExc_TypeError, "expected bytes, %s found", value->ob_type->tp_name); @@ -1302,11 +1299,9 @@ } data = PyBytes_AS_STRING(value); - if (!data) - return NULL; size = strlen(data); /* XXX Why not Py_SIZE(value)? */ if (size < length) { - /* This will copy the leading NUL character + /* This will copy the terminating NUL character * if there is space for it. */ ++size; @@ -1314,13 +1309,11 @@ PyErr_Format(PyExc_ValueError, "bytes too long (%zd, maximum length %zd)", size, length); - Py_DECREF(value); return NULL; } /* Also copy the terminating NUL character if there is space */ memcpy((char *)ptr, data, size); - Py_DECREF(value); _RET(value); } @@ -1428,9 +1421,7 @@ /* convert value into a PyUnicodeObject or NULL */ if (Py_None == value) { value = NULL; - } else if (PyUnicode_Check(value)) { - Py_INCREF(value); /* for the descref below */ - } else { + } else if (!PyUnicode_Check(value)) { PyErr_Format(PyExc_TypeError, "unicode string expected instead of %s instance", value->ob_type->tp_name); @@ -1449,7 +1440,6 @@ return NULL; } bstr = SysAllocStringLen(wvalue, (unsigned)wsize); - Py_DECREF(value); } else bstr = NULL; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 16 15:10:49 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 16 Jun 2016 19:10:49 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI3MzMw?= =?utf-8?q?=3A_Fixed_possible_leaks_in_the_ctypes_module=2E?= Message-ID: <20160616191036.20017.44320.486935B5@psf.io> https://hg.python.org/cpython/rev/e04c054beb53 changeset: 102063:e04c054beb53 branch: 2.7 parent: 102060:399d49d4acae user: Serhiy Storchaka date: Thu Jun 16 22:08:11 2016 +0300 summary: Issue #27330: Fixed possible leaks in the ctypes module. files: Misc/NEWS | 2 + Modules/_ctypes/_ctypes.c | 33 +++++++++++++++++++------ Modules/_ctypes/callproc.c | 10 ++++++- Modules/_ctypes/cfield.c | 3 +- 4 files changed, 37 insertions(+), 11 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,8 @@ Library ------- +- Issue #27330: Fixed possible leaks in the ctypes module. + - Issue #27238: Got rid of bare excepts in the turtle module. Original patch by Jelle Zijlstra. diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -1308,8 +1308,10 @@ descr = PyDescr_NewMethod(type, meth); if (descr == NULL) return -1; - if (PyDict_SetItemString(dict,meth->ml_name, descr) < 0) + if (PyDict_SetItemString(dict, meth->ml_name, descr) < 0) { + Py_DECREF(descr); return -1; + } Py_DECREF(descr); } return 0; @@ -1324,8 +1326,10 @@ descr = PyDescr_NewMember(type, memb); if (descr == NULL) return -1; - if (PyDict_SetItemString(dict, memb->name, descr) < 0) + if (PyDict_SetItemString(dict, memb->name, descr) < 0) { + Py_DECREF(descr); return -1; + } Py_DECREF(descr); } return 0; @@ -1341,8 +1345,10 @@ descr = PyDescr_NewGetSet(type, gsp); if (descr == NULL) return -1; - if (PyDict_SetItemString(dict, gsp->name, descr) < 0) + if (PyDict_SetItemString(dict, gsp->name, descr) < 0) { + Py_DECREF(descr); return -1; + } Py_DECREF(descr); } return 0; @@ -1843,8 +1849,10 @@ Py_INCREF(name); PyString_Concat(&name, suffix); - if (name == NULL) + if (name == NULL) { + Py_DECREF(swapped_args); return NULL; + } PyTuple_SET_ITEM(swapped_args, 0, name); for (i=1; iffi_type_pointer = *fmt->pffi_type; stgdict->align = fmt->pffi_type->alignment; @@ -2045,20 +2055,25 @@ PyObject *meth; int x; meth = PyDescr_NewClassMethod(result, ml); - if (!meth) + if (!meth) { + Py_DECREF(result); return NULL; + } #else #error PyObject *meth, *func; int x; func = PyCFunction_New(ml, NULL); - if (!func) + if (!func) { + Py_DECREF(result); return NULL; + } meth = PyObject_CallFunctionObjArgs( (PyObject *)&PyClassMethod_Type, func, NULL); Py_DECREF(func); if (!meth) { + Py_DECREF(result); return NULL; } #endif @@ -2241,8 +2256,10 @@ nArgs = PyTuple_GET_SIZE(ob); converters = PyTuple_New(nArgs); - if (!converters) + if (!converters) { + Py_DECREF(ob); return NULL; + } /* I have to check if this is correct. Using c_char, which has a size of 1, will be assumed to be pushed as only one byte! diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -162,8 +162,10 @@ return NULL; memset(space, 0, sizeof(int) * 2); errobj = CAPSULE_NEW(space, CTYPES_CAPSULE_ERROROBJ); - if (errobj == NULL) + if (errobj == NULL) { + PyMem_Free(space); return NULL; + } if (-1 == PyDict_SetItem(dict, error_object_name, errobj)) { Py_DECREF(errobj); @@ -1277,7 +1279,7 @@ PyObject *nameobj; PyObject *ignored; HMODULE hMod; - if (!PyArg_ParseTuple(args, "O|O:LoadLibrary", &nameobj, &ignored)) + if (!PyArg_ParseTuple(args, "S|O:LoadLibrary", &nameobj, &ignored)) return NULL; #ifdef _UNICODE name = alloca((PyString_Size(nameobj) + 1) * sizeof(WCHAR)); @@ -1815,6 +1817,10 @@ if (result == NULL) return result; key = PyLong_FromVoidPtr(result); + if (key == NULL) { + Py_DECREF(result); + return NULL; + } } else if (PyType_Check(cls)) { typ = (PyTypeObject *)cls; buf = PyMem_Malloc(strlen(typ->tp_name) + 3 + 1); diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c --- a/Modules/_ctypes/cfield.c +++ b/Modules/_ctypes/cfield.c @@ -1313,7 +1313,7 @@ return NULL; size = strlen(data); if (size < length) { - /* This will copy the leading NUL character + /* This will copy the trailing NUL character * if there is space for it. */ ++size; @@ -1508,6 +1508,7 @@ if (value) { Py_ssize_t size = PyUnicode_GET_SIZE(value); if ((unsigned) size != size) { + Py_DECREF(value); PyErr_SetString(PyExc_ValueError, "String too long for BSTR"); return NULL; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 16 16:00:36 2016 From: python-checkins at python.org (georg.brandl) Date: Thu, 16 Jun 2016 20:00:36 +0000 Subject: [Python-checkins] =?utf-8?q?peps=3A_Add_a_note_to_README_that_thi?= =?utf-8?q?s_repo_is_now_migrated_to_Git_and_will_remain?= Message-ID: <20160616200030.5405.6148.D79913EA@psf.io> https://hg.python.org/peps/rev/65c5d45eab5f changeset: 6381:65c5d45eab5f user: Georg Brandl date: Thu Jun 16 21:59:12 2016 +0200 summary: Add a note to README that this repo is now migrated to Git and will remain frozen. files: README.txt | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/README.txt b/README.txt --- a/README.txt +++ b/README.txt @@ -1,3 +1,14 @@ +Important Note +============== + +This repository has been migrated to Git. It is now continued at + +https://github.com/python/peps + +This Mercurial repository will remain available, but will not be +updated with new commits. + + Python Enhancement Proposals ============================ -- Repository URL: https://hg.python.org/peps From python-checkins at python.org Thu Jun 16 18:02:24 2016 From: python-checkins at python.org (victor.stinner) Date: Thu, 16 Jun 2016 22:02:24 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy41?= Message-ID: <20160616220222.10194.30326.E2130981@psf.io> https://hg.python.org/cpython/rev/3e6792af95f0 changeset: 102067:3e6792af95f0 parent: 102065:27e7945c4ecd parent: 102066:193f50babfa4 user: Victor Stinner date: Fri Jun 17 00:01:30 2016 +0200 summary: Merge 3.5 files: Python/random.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/random.c b/Python/random.c --- a/Python/random.c +++ b/Python/random.c @@ -134,7 +134,7 @@ const int flags = GRND_NONBLOCK; char *dest; - int n; + long n; if (!getrandom_works) return 0; @@ -146,7 +146,7 @@ to 1024 bytes */ n = Py_MIN(size, 1024); #else - n = Py_MIN(size, INT_MAX); + n = Py_MIN(size, LONG_MAX); #endif errno = 0; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 16 18:02:53 2016 From: python-checkins at python.org (victor.stinner) Date: Thu, 16 Jun 2016 22:02:53 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogcHlfZ2V0cmFuZG9t?= =?utf-8?q?=28=29=3A_use_long_type_for_the_syscall=28=29_result?= Message-ID: <20160616220222.119669.72367.92461852@psf.io> https://hg.python.org/cpython/rev/193f50babfa4 changeset: 102066:193f50babfa4 branch: 3.5 parent: 102064:41f99ee19804 user: Victor Stinner date: Thu Jun 16 23:53:47 2016 +0200 summary: py_getrandom(): use long type for the syscall() result Issue #27278. It should fix a conversion warning. In practice, the Linux kernel doesn't return more than 32 MB per call to the getrandom() syscall. files: Python/random.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/random.c b/Python/random.c --- a/Python/random.c +++ b/Python/random.c @@ -132,7 +132,7 @@ * see https://bugs.python.org/issue26839. To avoid this, use the * GRND_NONBLOCK flag. */ const int flags = GRND_NONBLOCK; - int n; + long n; if (!getrandom_works) return 0; @@ -143,7 +143,7 @@ to 1024 bytes */ n = Py_MIN(size, 1024); #else - n = Py_MIN(size, INT_MAX); + n = Py_MIN(size, LONG_MAX); #endif errno = 0; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 17 04:13:25 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 17 Jun 2016 08:13:25 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_ctypes=3A_the_type_of_b=5Fsize_is_Py=5Fssize=5Ft=2E?= Message-ID: <20160617081324.19442.12622.C7A29EA4@psf.io> https://hg.python.org/cpython/rev/7efe1a5239e3 changeset: 102070:7efe1a5239e3 parent: 102067:3e6792af95f0 parent: 102068:948652fb074d user: Serhiy Storchaka date: Fri Jun 17 11:13:03 2016 +0300 summary: ctypes: the type of b_size is Py_ssize_t. files: Modules/_ctypes/_ctypes.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -1124,7 +1124,7 @@ static PyObject * CharArray_get_value(CDataObject *self) { - int i; + Py_ssize_t i; char *ptr = self->b_ptr; for (i = 0; i < self->b_size; ++i) if (*ptr++ == '\0') @@ -1180,9 +1180,9 @@ static PyObject * WCharArray_get_value(CDataObject *self) { - unsigned int i; + Py_ssize_t i; wchar_t *ptr = (wchar_t *)self->b_ptr; - for (i = 0; i < self->b_size/sizeof(wchar_t); ++i) + for (i = 0; i < self->b_size/(Py_ssize_t)sizeof(wchar_t); ++i) if (*ptr++ == (wchar_t)0) break; return PyUnicode_FromWideChar((wchar_t *)self->b_ptr, i); @@ -1211,7 +1211,7 @@ wstr = PyUnicode_AsUnicodeAndSize(value, &len); if (wstr == NULL) return -1; - if ((unsigned)len > self->b_size/sizeof(wchar_t)) { + if ((size_t)len > self->b_size/sizeof(wchar_t)) { PyErr_SetString(PyExc_ValueError, "string too long"); result = -1; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 17 04:13:25 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 17 Jun 2016 08:13:25 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogY3R5cGVzOiB0aGUg?= =?utf-8?q?type_of_b=5Fsize_is_Py=5Fssize=5Ft=2E?= Message-ID: <20160617081324.5358.7316.08D2252A@psf.io> https://hg.python.org/cpython/rev/dd2cc11bc170 changeset: 102069:dd2cc11bc170 branch: 2.7 parent: 102063:e04c054beb53 user: Serhiy Storchaka date: Fri Jun 17 11:11:07 2016 +0300 summary: ctypes: the type of b_size is Py_ssize_t. files: Modules/_ctypes/_ctypes.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -1174,7 +1174,7 @@ static PyObject * CharArray_get_value(CDataObject *self) { - int i; + Py_ssize_t i; char *ptr = self->b_ptr; for (i = 0; i < self->b_size; ++i) if (*ptr++ == '\0') @@ -1236,9 +1236,9 @@ static PyObject * WCharArray_get_value(CDataObject *self) { - unsigned int i; + Py_ssize_t i; wchar_t *ptr = (wchar_t *)self->b_ptr; - for (i = 0; i < self->b_size/sizeof(wchar_t); ++i) + for (i = 0; i < self->b_size/(Py_ssize_t)sizeof(wchar_t); ++i) if (*ptr++ == (wchar_t)0) break; return PyUnicode_FromWideChar((wchar_t *)self->b_ptr, i); @@ -1267,7 +1267,7 @@ return -1; } else Py_INCREF(value); - if ((unsigned)PyUnicode_GET_SIZE(value) > self->b_size/sizeof(wchar_t)) { + if ((size_t)PyUnicode_GET_SIZE(value) > self->b_size/sizeof(wchar_t)) { PyErr_SetString(PyExc_ValueError, "string too long"); result = -1; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 17 04:13:25 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 17 Jun 2016 08:13:25 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogY3R5cGVzOiB0aGUg?= =?utf-8?q?type_of_b=5Fsize_is_Py=5Fssize=5Ft=2E?= Message-ID: <20160617081324.67200.75461.9B035C4B@psf.io> https://hg.python.org/cpython/rev/948652fb074d changeset: 102068:948652fb074d branch: 3.5 parent: 102066:193f50babfa4 user: Serhiy Storchaka date: Fri Jun 17 11:11:07 2016 +0300 summary: ctypes: the type of b_size is Py_ssize_t. files: Modules/_ctypes/_ctypes.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -1124,7 +1124,7 @@ static PyObject * CharArray_get_value(CDataObject *self) { - int i; + Py_ssize_t i; char *ptr = self->b_ptr; for (i = 0; i < self->b_size; ++i) if (*ptr++ == '\0') @@ -1180,9 +1180,9 @@ static PyObject * WCharArray_get_value(CDataObject *self) { - unsigned int i; + Py_ssize_t i; wchar_t *ptr = (wchar_t *)self->b_ptr; - for (i = 0; i < self->b_size/sizeof(wchar_t); ++i) + for (i = 0; i < self->b_size/(Py_ssize_t)sizeof(wchar_t); ++i) if (*ptr++ == (wchar_t)0) break; return PyUnicode_FromWideChar((wchar_t *)self->b_ptr, i); @@ -1211,7 +1211,7 @@ wstr = PyUnicode_AsUnicodeAndSize(value, &len); if (wstr == NULL) return -1; - if ((unsigned)len > self->b_size/sizeof(wchar_t)) { + if ((size_t)len > self->b_size/sizeof(wchar_t)) { PyErr_SetString(PyExc_ValueError, "string too long"); result = -1; -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Fri Jun 17 04:52:42 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 17 Jun 2016 08:52:42 +0000 Subject: [Python-checkins] Daily reference leaks (3e6792af95f0): sum=-2 Message-ID: <20160617085239.11551.88924.EA4DAD4D@psf.io> results for 3e6792af95f0 on branch "default" -------------------------------------------- test_collections leaked [-4, 0, 0] memory blocks, sum=-4 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [-1, 1, -2] memory blocks, sum=-2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogxPmXIY', '--timeout', '7200'] From python-checkins at python.org Fri Jun 17 06:24:23 2016 From: python-checkins at python.org (berker.peksag) Date: Fri, 17 Jun 2016 10:24:23 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327336=3A_Fix_comp?= =?utf-8?q?ilation_failures_--without-threads?= Message-ID: <20160617102422.20017.58946.8087AE6D@psf.io> https://hg.python.org/cpython/rev/2baaf7e31b13 changeset: 102071:2baaf7e31b13 user: Berker Peksag date: Fri Jun 17 13:25:01 2016 +0300 summary: Issue #27336: Fix compilation failures --without-threads files: Parser/pgenmain.c | 5 +++-- Python/pylifecycle.c | 2 ++ Python/traceback.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Parser/pgenmain.c b/Parser/pgenmain.c --- a/Parser/pgenmain.c +++ b/Parser/pgenmain.c @@ -38,12 +38,13 @@ } #ifdef WITH_THREAD -/* Functions needed by obmalloc.c */ +/* Needed by obmalloc.c */ int PyGILState_Check(void) { return 1; } +#endif + void _PyMem_DumpTraceback(int fd, const void *ptr) {} -#endif int main(int argc, char **argv) diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -746,9 +746,11 @@ if (!initialized) Py_FatalError("Py_NewInterpreter: call Py_Initialize first"); +#if WITH_THREAD /* Issue #10915, #15751: The GIL API doesn't work with multiple interpreters: disable PyGILState_Check(). */ _PyGILState_check_enabled = 0; +#endif interp = PyInterpreterState_New(); if (interp == NULL) diff --git a/Python/traceback.c b/Python/traceback.c --- a/Python/traceback.c +++ b/Python/traceback.c @@ -745,7 +745,7 @@ if (current_tstate == NULL) { /* Call _PyThreadState_UncheckedGet() instead of PyThreadState_Get() to not fail with a fatal error if the thread state is NULL. */ - current_thread = _PyThreadState_UncheckedGet(); + current_tstate = _PyThreadState_UncheckedGet(); } if (interp == NULL) { -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 17 06:29:47 2016 From: python-checkins at python.org (victor.stinner) Date: Fri, 17 Jun 2016 10:29:47 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327336=3A_Fix_comp?= =?utf-8?q?ilation_on_Windows?= Message-ID: <20160617102945.20330.81362.3FFBAB82@psf.io> https://hg.python.org/cpython/rev/cbe977fd306f changeset: 102072:cbe977fd306f user: Victor Stinner date: Fri Jun 17 12:29:00 2016 +0200 summary: Issue #27336: Fix compilation on Windows Replace "#if WITH_THREAD" with "#ifdef WITH_THREAD". files: Python/pylifecycle.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -746,7 +746,7 @@ if (!initialized) Py_FatalError("Py_NewInterpreter: call Py_Initialize first"); -#if WITH_THREAD +#ifdef WITH_THREAD /* Issue #10915, #15751: The GIL API doesn't work with multiple interpreters: disable PyGILState_Check(). */ _PyGILState_check_enabled = 0; @@ -1409,7 +1409,7 @@ /* Clean up and exit */ #ifdef WITH_THREAD -#include "pythread.h" +# include "pythread.h" #endif static void (*pyexitfunc)(void) = NULL; -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Fri Jun 17 08:00:20 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 17 Jun 2016 13:00:20 +0100 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python Default 2016-06-17 Message-ID: Results for project Python default, build date 2016-06-17 02:05:00 +0000 commit: 3e6792af95f0 previous commit: 3d726dbfca31 revision date: 2016-06-16 22:01:30 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.19% 0.37% 9.19% 18.47% :-| pybench 0.17% -0.18% 1.75% 8.07% :-( regex_v8 2.71% -0.01% -2.69% 3.98% :-| nbody 0.20% 0.71% 0.76% 7.81% :-| json_dump_v2 0.35% 0.32% -1.07% 13.63% :-| normal_startup 0.98% -0.06% 0.76% 6.16% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-default-2016-06-17/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Fri Jun 17 08:00:32 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 17 Jun 2016 13:00:32 +0100 Subject: [Python-checkins] UGLY Benchmark Results for Python 2.7 2016-06-17 Message-ID: Results for project Python 2.7, build date 2016-06-17 02:49:00 +0000 commit: e04c054beb53 previous commit: 399d49d4acae revision date: 2016-06-16 19:08:11 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.17% -1.66% 3.89% 7.78% :-) pybench 0.20% -0.02% 5.76% 5.02% :-( regex_v8 0.48% 1.64% -2.25% 10.82% :-) nbody 0.05% 0.98% 8.94% 0.46% :-) json_dump_v2 0.45% -0.13% 2.10% 11.56% :-( normal_startup 1.91% -0.53% -6.06% 2.25% :-) ssbench 0.32% 1.69% 2.38% 1.93% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/ugly-benchmark-results-for-python-2-7-2016-06-17/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Fri Jun 17 12:34:54 2016 From: python-checkins at python.org (steve.dower) Date: Fri, 17 Jun 2016 16:34:54 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327048=3A_Prevents_distutils_failing_on_Windows_?= =?utf-8?q?when_environment_variables?= Message-ID: <20160617163340.19551.7415.7489DA54@psf.io> https://hg.python.org/cpython/rev/bb22ae1e1bcd changeset: 102074:bb22ae1e1bcd parent: 102072:cbe977fd306f parent: 102073:15900c612ca7 user: Steve Dower date: Fri Jun 17 09:33:11 2016 -0700 summary: Issue #27048: Prevents distutils failing on Windows when environment variables contain non-ASCII characters files: Lib/distutils/_msvccompiler.py | 6 +-- Lib/distutils/tests/test_msvccompiler.py | 18 ++++++++++++ Misc/NEWS | 3 ++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Lib/distutils/_msvccompiler.py b/Lib/distutils/_msvccompiler.py --- a/Lib/distutils/_msvccompiler.py +++ b/Lib/distutils/_msvccompiler.py @@ -86,11 +86,9 @@ try: out = subprocess.check_output( - '"{}" {} && set'.format(vcvarsall, plat_spec), - shell=True, + 'cmd /u /c "{}" {} && set'.format(vcvarsall, plat_spec), stderr=subprocess.STDOUT, - universal_newlines=True, - ) + ).decode('utf-16le', errors='replace') except subprocess.CalledProcessError as exc: log.error(exc.output) raise DistutilsPlatformError("Error executing {}" diff --git a/Lib/distutils/tests/test_msvccompiler.py b/Lib/distutils/tests/test_msvccompiler.py --- a/Lib/distutils/tests/test_msvccompiler.py +++ b/Lib/distutils/tests/test_msvccompiler.py @@ -83,6 +83,24 @@ self.assertFalse(os.path.isfile(os.path.join( tempdir, os.path.basename(dll)))) + def test_get_vc_env_unicode(self): + import distutils._msvccompiler as _msvccompiler + + test_var = '????????' + test_value = '???' + + # Ensure we don't early exit from _get_vc_env + old_distutils_use_sdk = os.environ.pop('DISTUTILS_USE_SDK', None) + os.environ[test_var] = test_value + try: + env = _msvccompiler._get_vc_env('x86') + self.assertIn(test_var.lower(), env) + self.assertEqual(test_value, env[test_var.lower()]) + finally: + os.environ.pop(test_var) + if old_distutils_use_sdk: + os.environ['DISTUTILS_USE_SDK'] = old_distutils_use_sdk + def test_suite(): return unittest.makeSuite(msvccompilerTestCase) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Library ------- +- Issue #27048: Prevents distutils failing on Windows when environment + variables contain non-ASCII characters + - Issue #27330: Fixed possible leaks in the ctypes module. - Issue #27238: Got rid of bare excepts in the turtle module. Original patch -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 17 12:34:54 2016 From: python-checkins at python.org (steve.dower) Date: Fri, 17 Jun 2016 16:34:54 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MDQ4?= =?utf-8?q?=3A_Prevents_distutils_failing_on_Windows_when_environment_vari?= =?utf-8?q?ables?= Message-ID: <20160617163340.19616.8247.7A0F4ABB@psf.io> https://hg.python.org/cpython/rev/15900c612ca7 changeset: 102073:15900c612ca7 branch: 3.5 parent: 102068:948652fb074d user: Steve Dower date: Fri Jun 17 09:32:38 2016 -0700 summary: Issue #27048: Prevents distutils failing on Windows when environment variables contain non-ASCII characters files: Lib/distutils/_msvccompiler.py | 6 +-- Lib/distutils/tests/test_msvccompiler.py | 18 ++++++++++++ Misc/NEWS | 3 ++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Lib/distutils/_msvccompiler.py b/Lib/distutils/_msvccompiler.py --- a/Lib/distutils/_msvccompiler.py +++ b/Lib/distutils/_msvccompiler.py @@ -86,11 +86,9 @@ try: out = subprocess.check_output( - '"{}" {} && set'.format(vcvarsall, plat_spec), - shell=True, + 'cmd /u /c "{}" {} && set'.format(vcvarsall, plat_spec), stderr=subprocess.STDOUT, - universal_newlines=True, - ) + ).decode('utf-16le', errors='replace') except subprocess.CalledProcessError as exc: log.error(exc.output) raise DistutilsPlatformError("Error executing {}" diff --git a/Lib/distutils/tests/test_msvccompiler.py b/Lib/distutils/tests/test_msvccompiler.py --- a/Lib/distutils/tests/test_msvccompiler.py +++ b/Lib/distutils/tests/test_msvccompiler.py @@ -83,6 +83,24 @@ self.assertFalse(os.path.isfile(os.path.join( tempdir, os.path.basename(dll)))) + def test_get_vc_env_unicode(self): + import distutils._msvccompiler as _msvccompiler + + test_var = '????????' + test_value = '???' + + # Ensure we don't early exit from _get_vc_env + old_distutils_use_sdk = os.environ.pop('DISTUTILS_USE_SDK', None) + os.environ[test_var] = test_value + try: + env = _msvccompiler._get_vc_env('x86') + self.assertIn(test_var.lower(), env) + self.assertEqual(test_value, env[test_var.lower()]) + finally: + os.environ.pop(test_var) + if old_distutils_use_sdk: + os.environ['DISTUTILS_USE_SDK'] = old_distutils_use_sdk + def test_suite(): return unittest.makeSuite(msvccompilerTestCase) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,9 @@ Library ------- +- Issue #27048: Prevents distutils failing on Windows when environment + variables contain non-ASCII characters + - Issue #27330: Fixed possible leaks in the ctypes module. - Issue #27238: Got rid of bare excepts in the turtle module. Original patch -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 17 15:52:40 2016 From: python-checkins at python.org (steve.dower) Date: Fri, 17 Jun 2016 19:52:40 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2326536=3A_socket?= =?utf-8?q?=2Eioctl_now_supports_SIO=5FLOOPBACK=5FFAST=5FPATH=2E_Patch_by_?= =?utf-8?q?Daniel?= Message-ID: <20160617195239.25284.65999.8726E660@psf.io> https://hg.python.org/cpython/rev/f8957c755c7a changeset: 102075:f8957c755c7a user: Steve Dower date: Fri Jun 17 12:52:18 2016 -0700 summary: Issue #26536: socket.ioctl now supports SIO_LOOPBACK_FAST_PATH. Patch by Daniel Stokes. files: Doc/library/socket.rst | 13 ++++++++++++- Doc/whatsnew/3.6.rst | 8 ++++++++ Lib/test/test_socket.py | 10 ++++++++++ Misc/ACKS | 1 + Misc/NEWS | 3 +++ Modules/socketmodule.c | 26 +++++++++++++++++++++++--- 6 files changed, 57 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 @@ -329,12 +329,17 @@ .. versionadded:: 3.3 -.. data:: SIO_* +.. data:: SIO_RCVALL + SIO_KEEPALIVE_VALS + SIO_LOOPBACK_FAST_PATH RCVALL_* Constants for Windows' WSAIoctl(). The constants are used as arguments to the :meth:`~socket.socket.ioctl` method of socket objects. + .. versionchanged:: 3.6 + ``SIO_LOOPBACK_FAST_PATH`` was added. + .. data:: TIPC_* @@ -996,6 +1001,12 @@ On other platforms, the generic :func:`fcntl.fcntl` and :func:`fcntl.ioctl` functions may be used; they accept a socket object as their first argument. + Currently only the following control codes are supported: + ``SIO_RCVALL``, ``SIO_KEEPALIVE_VALS``, and ``SIO_LOOPBACK_FAST_PATH``. + + .. versionchanged:: 3.6 + ``SIO_LOOPBACK_FAST_PATH`` was added. + .. method:: socket.listen([backlog]) Enable a server to accept connections. If *backlog* is specified, it must diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -346,6 +346,14 @@ (Contributed by Alex LordThorsen in :issue:`16864`.) +socket +------ + +The :func:`~socket.socket.ioctl` function now supports the :data:`~socket.SIO_LOOPBACK_FAST_PATH` +control code. +(Contributed by Daniel Stokes in :issue:`26536`.) + + socketserver ------------ 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 @@ -1217,6 +1217,16 @@ self.assertRaises(ValueError, s.ioctl, -1, None) s.ioctl(socket.SIO_KEEPALIVE_VALS, (1, 100, 100)) + @unittest.skipUnless(os.name == "nt", "Windows specific") + @unittest.skipUnless(hasattr(socket, 'SIO_LOOPBACK_FAST_PATH'), + 'Loopback fast path support required for this test') + def test_sio_loopback_fast_path(self): + s = socket.socket() + self.addCleanup(s.close) + s.ioctl(socket.SIO_LOOPBACK_FAST_PATH, True) + self.assertRaises(TypeError, s.ioctl, socket.SIO_LOOPBACK_FAST_PATH, None) + + def testGetaddrinfo(self): try: socket.getaddrinfo('localhost', 80) diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1431,6 +1431,7 @@ Richard Stoakley Peter Stoehr Casper Stoel +Daniel Stokes Michael Stone Serhiy Storchaka Ken Stox diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Library ------- +- Issue #26536: socket.ioctl now supports SIO_LOOPBACK_FAST_PATH. Patch by + Daniel Stokes. + - Issue #27048: Prevents distutils failing on Windows when environment variables contain non-ASCII characters diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -4053,6 +4053,17 @@ return set_error(); } return PyLong_FromUnsignedLong(recv); } +#if defined(SIO_LOOPBACK_FAST_PATH) + case SIO_LOOPBACK_FAST_PATH: { + unsigned int option; + if (!PyArg_ParseTuple(arg, "kI:ioctl", &cmd, &option)) + return NULL; + if (WSAIoctl(s->sock_fd, cmd, &option, sizeof(option), + NULL, 0, &recv, NULL, NULL) == SOCKET_ERROR) { + return set_error(); + } + return PyLong_FromUnsignedLong(recv); } +#endif default: PyErr_Format(PyExc_ValueError, "invalid ioctl command %d", cmd); return NULL; @@ -4063,7 +4074,8 @@ \n\ Control the socket with WSAIoctl syscall. Currently supported 'cmd' values are\n\ SIO_RCVALL: 'option' must be one of the socket.RCVALL_* constants.\n\ -SIO_KEEPALIVE_VALS: 'option' is a tuple of (onoff, timeout, interval)."); +SIO_KEEPALIVE_VALS: 'option' is a tuple of (onoff, timeout, interval).\n\ +SIO_LOOPBACK_FAST_PATH: 'option' is a boolean value, and is disabled by default"); #endif #if defined(MS_WINDOWS) @@ -7274,8 +7286,16 @@ #ifdef SIO_RCVALL { - DWORD codes[] = {SIO_RCVALL, SIO_KEEPALIVE_VALS}; - const char *names[] = {"SIO_RCVALL", "SIO_KEEPALIVE_VALS"}; + DWORD codes[] = {SIO_RCVALL, SIO_KEEPALIVE_VALS, +#if defined(SIO_LOOPBACK_FAST_PATH) + SIO_LOOPBACK_FAST_PATH +#endif + }; + const char *names[] = {"SIO_RCVALL", "SIO_KEEPALIVE_VALS", +#if defined(SIO_LOOPBACK_FAST_PATH) + "SIO_LOOPBACK_FAST_PATH" +#endif + }; int i; for(i = 0; i https://hg.python.org/cpython/rev/90fd1c17214b changeset: 102076:90fd1c17214b user: Terry Jan Reedy date: Fri Jun 17 19:55:46 2016 -0400 summary: Issue #27312: mock out function that fails when called from setupApp during IDLE test_macosx and see if addOpenEventSupport() fails. files: Lib/idlelib/idle_test/test_macosx.py | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/idle_test/test_macosx.py b/Lib/idlelib/idle_test/test_macosx.py --- a/Lib/idlelib/idle_test/test_macosx.py +++ b/Lib/idlelib/idle_test/test_macosx.py @@ -83,6 +83,7 @@ cls.root.destroy() del cls.root + @mock.patch('idlelib.macosx.overrideRootMenu') #27312 def test_setupapp(self): "Call setupApp with each possible graphics type." root = self.root -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 17 21:17:40 2016 From: python-checkins at python.org (berker.peksag) Date: Sat, 18 Jun 2016 01:17:40 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327312=3A_Fix_Type?= =?utf-8?q?Error_in_test=5Fsetupapp?= Message-ID: <20160618011740.25307.41110.C8DBE824@psf.io> https://hg.python.org/cpython/rev/61bd6974405f changeset: 102077:61bd6974405f user: Berker Peksag date: Sat Jun 18 04:18:24 2016 +0300 summary: Issue #27312: Fix TypeError in test_setupapp files: Lib/idlelib/idle_test/test_macosx.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/idle_test/test_macosx.py b/Lib/idlelib/idle_test/test_macosx.py --- a/Lib/idlelib/idle_test/test_macosx.py +++ b/Lib/idlelib/idle_test/test_macosx.py @@ -84,7 +84,7 @@ del cls.root @mock.patch('idlelib.macosx.overrideRootMenu') #27312 - def test_setupapp(self): + def test_setupapp(self, overrideRootMenu): "Call setupApp with each possible graphics type." root = self.root flist = FileList(root) @@ -92,6 +92,9 @@ with self.subTest(tktype=tktype): macosx._tk_type = tktype macosx.setupApp(root, flist) + if tktype in ('carbon', 'cocoa'): + self.assertTrue(overrideRootMenu.called) + overrideRootMenu.reset_mock() if __name__ == '__main__': -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 17 22:02:46 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 18 Jun 2016 02:02:46 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzIyNjM2?= =?utf-8?q?=3A_Avoid_using_a_shell_in_the_ctypes=2Eutil_module?= Message-ID: <20160618020246.119548.65587.99D4ADF6@psf.io> https://hg.python.org/cpython/rev/a09ae70f3489 changeset: 102078:a09ae70f3489 branch: 2.7 parent: 102069:dd2cc11bc170 user: Victor Stinner date: Thu Oct 16 09:42:45 2014 +0200 summary: Issue #22636: Avoid using a shell in the ctypes.util module Replace os.popen() with subprocess.Popen. If the "gcc", "cc" or "objdump" command is not available, the code was supposed to raise an OSError exception. But there was a bug in the code. The shell code returns the exit code 10 if the required command is missing, and the code tries to check for the status 10. The problem is that os.popen() doesn't return the exit code directly, but a status which should be processed by os.WIFEXITED() and os.WEXITSTATUS(). In practice, the exception was never raised. The OSError exception was not documented and ctypes.util.find_library() is expected to return None if the library is not found. Based on patch by Victor Stinner. files: Lib/ctypes/test/test_find.py | 8 +- Lib/ctypes/util.py | 127 ++++++++++++++-------- Misc/NEWS | 3 + 3 files changed, 92 insertions(+), 46 deletions(-) diff --git a/Lib/ctypes/test/test_find.py b/Lib/ctypes/test/test_find.py --- a/Lib/ctypes/test/test_find.py +++ b/Lib/ctypes/test/test_find.py @@ -1,6 +1,7 @@ import unittest -import os +import os, os.path import sys +from test import test_support from ctypes import * from ctypes.util import find_library from ctypes.test import is_resource_enabled @@ -65,6 +66,11 @@ if self.gle: self.gle.gleGetJoinStyle + def test_shell_injection(self): + result = find_library('; echo Hello shell > ' + test_support.TESTFN) + self.assertFalse(os.path.lexists(test_support.TESTFN)) + self.assertIsNone(result) + # On platforms where the default shared library suffix is '.so', # at least some libraries can be loaded as attributes of the cdll # object, since ctypes now tries loading the lib again diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py --- a/Lib/ctypes/util.py +++ b/Lib/ctypes/util.py @@ -1,4 +1,6 @@ -import sys, os +import os +import subprocess +import sys # find_library(name) returns the pathname of a library, or None. if os.name == "nt": @@ -86,25 +88,28 @@ import re, tempfile, errno def _findLib_gcc(name): + # Run GCC's linker with the -t (aka --trace) option and examine the + # library name it prints out. The GCC command will fail because we + # haven't supplied a proper program with main(), but that does not + # matter. expr = r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name) - fdout, ccout = tempfile.mkstemp() - os.close(fdout) - cmd = 'if type gcc >/dev/null 2>&1; then CC=gcc; elif type cc >/dev/null 2>&1; then CC=cc;else exit 10; fi;' \ - 'LANG=C LC_ALL=C $CC -Wl,-t -o ' + ccout + ' 2>&1 -l' + name + cmd = 'if type gcc >/dev/null 2>&1; then CC=gcc; elif type cc >/dev/null 2>&1; then CC=cc;else exit; fi;' \ + 'LANG=C LC_ALL=C $CC -Wl,-t -o "$2" 2>&1 -l"$1"' + + temp = tempfile.NamedTemporaryFile() try: - f = os.popen(cmd) - try: - trace = f.read() - finally: - rv = f.close() + proc = subprocess.Popen((cmd, '_findLib_gcc', name, temp.name), + shell=True, + stdout=subprocess.PIPE) + [trace, _] = proc.communicate() finally: try: - os.unlink(ccout) + temp.close() except OSError, e: + # ENOENT is raised if the file was already removed, which is + # the normal behaviour of GCC if linking fails if e.errno != errno.ENOENT: raise - if rv == 10: - raise OSError, 'gcc or cc command not found' res = re.search(expr, trace) if not res: return None @@ -116,13 +121,17 @@ def _get_soname(f): if not f: return None - cmd = "/usr/ccs/bin/dump -Lpv 2>/dev/null " + f - f = os.popen(cmd) + + null = open(os.devnull, "wb") try: - data = f.read() - finally: - f.close() - res = re.search(r'\[.*\]\sSONAME\s+([^\s]+)', data) + with null: + proc = subprocess.Popen(("/usr/ccs/bin/dump", "-Lpv", f), + stdout=subprocess.PIPE, + stderr=null) + except OSError: # E.g. command not found + return None + [data, _] = proc.communicate() + res = re.search(br'\[.*\]\sSONAME\s+([^\s]+)', data) if not res: return None return res.group(1) @@ -131,16 +140,12 @@ # assuming GNU binutils / ELF if not f: return None - cmd = 'if ! type objdump >/dev/null 2>&1; then exit 10; fi;' \ - "objdump -p -j .dynamic 2>/dev/null " + f - f = os.popen(cmd) - try: - dump = f.read() - finally: - rv = f.close() - if rv == 10: - raise OSError, 'objdump command not found' - res = re.search(r'\sSONAME\s+([^\s]+)', dump) + cmd = 'if ! type objdump >/dev/null 2>&1; then exit; fi;' \ + 'objdump -p -j .dynamic 2>/dev/null "$1"' + proc = subprocess.Popen((cmd, '_get_soname', f), shell=True, + stdout=subprocess.PIPE) + [dump, _] = proc.communicate() + res = re.search(br'\sSONAME\s+([^\s]+)', dump) if not res: return None return res.group(1) @@ -151,23 +156,30 @@ def _num_version(libname): # "libxyz.so.MAJOR.MINOR" => [ MAJOR, MINOR ] - parts = libname.split(".") + parts = libname.split(b".") nums = [] try: while parts: nums.insert(0, int(parts.pop())) except ValueError: pass - return nums or [ sys.maxint ] + return nums or [sys.maxint] def find_library(name): ename = re.escape(name) expr = r':-l%s\.\S+ => \S*/(lib%s\.\S+)' % (ename, ename) - f = os.popen('/sbin/ldconfig -r 2>/dev/null') + + null = open(os.devnull, 'wb') try: - data = f.read() - finally: - f.close() + with null: + proc = subprocess.Popen(('/sbin/ldconfig', '-r'), + stdout=subprocess.PIPE, + stderr=null) + except OSError: # E.g. command not found + data = b'' + else: + [data, _] = proc.communicate() + res = re.findall(expr, data) if not res: return _get_soname(_findLib_gcc(name)) @@ -180,16 +192,32 @@ if not os.path.exists('/usr/bin/crle'): return None + env = dict(os.environ) + env['LC_ALL'] = 'C' + if is64: - cmd = 'env LC_ALL=C /usr/bin/crle -64 2>/dev/null' + args = ('/usr/bin/crle', '-64') else: - cmd = 'env LC_ALL=C /usr/bin/crle 2>/dev/null' + args = ('/usr/bin/crle',) paths = None - for line in os.popen(cmd).readlines(): - line = line.strip() - if line.startswith('Default Library Path (ELF):'): - paths = line.split()[4] + null = open(os.devnull, 'wb') + try: + with null: + proc = subprocess.Popen(args, + stdout=subprocess.PIPE, + stderr=null, + env=env) + except OSError: # E.g. bad executable + return None + try: + for line in proc.stdout: + line = line.strip() + if line.startswith(b'Default Library Path (ELF):'): + paths = line.split()[4] + finally: + proc.stdout.close() + proc.wait() if not paths: return None @@ -223,11 +251,20 @@ # XXX assuming GLIBC's ldconfig (with option -p) expr = r'\s+(lib%s\.[^\s]+)\s+\(%s' % (re.escape(name), abi_type) - f = os.popen('LC_ALL=C LANG=C /sbin/ldconfig -p 2>/dev/null') + + env = dict(os.environ) + env['LC_ALL'] = 'C' + env['LANG'] = 'C' + null = open(os.devnull, 'wb') try: - data = f.read() - finally: - f.close() + with null: + p = subprocess.Popen(['/sbin/ldconfig', '-p'], + stderr=null, + stdout=subprocess.PIPE, + env=env) + except OSError: # E.g. command not found + return None + [data, _] = p.communicate() res = re.search(expr, data) if not res: return None diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,9 @@ Library ------- +- Issue #22636: Avoid shell injection problems with + ctypes.util.find_library(). + - Issue #27330: Fixed possible leaks in the ctypes module. - Issue #27238: Got rid of bare excepts in the turtle module. Original patch -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 18 02:44:25 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 18 Jun 2016 06:44:25 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327342=3A_Replaced?= =?utf-8?q?_some_Py=5FXDECREFs_with_Py=5FDECREFs=2E?= Message-ID: <20160618064425.78385.82035.FCE930A4@psf.io> https://hg.python.org/cpython/rev/52931189d7ee changeset: 102079:52931189d7ee parent: 102077:61bd6974405f user: Serhiy Storchaka date: Sat Jun 18 09:44:03 2016 +0300 summary: Issue #27342: Replaced some Py_XDECREFs with Py_DECREFs. Patch by Xiang Zhang. files: Objects/rangeobject.c | 10 +++++----- Python/bltinmodule.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -129,9 +129,9 @@ return (PyObject *) obj; /* Failed to create object, release attributes */ - Py_XDECREF(start); - Py_XDECREF(stop); - Py_XDECREF(step); + Py_DECREF(start); + Py_DECREF(stop); + Py_DECREF(step); return NULL; } @@ -196,7 +196,7 @@ /* if (lo >= hi), return length of 0. */ cmp_result = PyObject_RichCompareBool(lo, hi, Py_GE); if (cmp_result != 0) { - Py_XDECREF(step); + Py_DECREF(step); if (cmp_result < 0) return NULL; return PyLong_FromLong(0); @@ -225,9 +225,9 @@ return result; Fail: + Py_DECREF(step); Py_XDECREF(tmp2); Py_XDECREF(diff); - Py_XDECREF(step); Py_XDECREF(tmp1); Py_XDECREF(one); return NULL; diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -2711,10 +2711,10 @@ SETBUILTIN("zip", &PyZip_Type); debug = PyBool_FromLong(Py_OptimizeFlag == 0); if (PyDict_SetItemString(dict, "__debug__", debug) < 0) { - Py_XDECREF(debug); + Py_DECREF(debug); return NULL; } - Py_XDECREF(debug); + Py_DECREF(debug); return mod; #undef ADD_TO_ALL -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 18 02:52:47 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 18 Jun 2016 06:52:47 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327333=3A_Simplifi?= =?utf-8?q?ed_testing_step_on_0=2E?= Message-ID: <20160618065247.4980.2244.60879D8E@psf.io> https://hg.python.org/cpython/rev/4fbcd58df1a0 changeset: 102080:4fbcd58df1a0 user: Serhiy Storchaka date: Sat Jun 18 09:51:55 2016 +0300 summary: Issue #27333: Simplified testing step on 0. files: Objects/rangeobject.c | 15 ++++----------- 1 files changed, 4 insertions(+), 11 deletions(-) diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c --- a/Objects/rangeobject.c +++ b/Objects/rangeobject.c @@ -29,17 +29,10 @@ return PyLong_FromLong(1); step = PyNumber_Index(step); - if (step) { - Py_ssize_t istep = PyNumber_AsSsize_t(step, NULL); - if (istep == -1 && PyErr_Occurred()) { - /* Ignore OverflowError, we know the value isn't 0. */ - PyErr_Clear(); - } - else if (istep == 0) { - PyErr_SetString(PyExc_ValueError, - "range() arg 3 must not be zero"); - Py_CLEAR(step); - } + if (step && _PyLong_Sign(step) == 0) { + PyErr_SetString(PyExc_ValueError, + "range() arg 3 must not be zero"); + Py_CLEAR(step); } return step; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 18 02:59:16 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 18 Jun 2016 06:59:16 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MzQz?= =?utf-8?q?=3A_Fixed_error_message_for_conflicting_initializers_of?= Message-ID: <20160618065916.9852.20108.4B8589B0@psf.io> https://hg.python.org/cpython/rev/ed81fc7e285b changeset: 102081:ed81fc7e285b branch: 3.5 parent: 102073:15900c612ca7 user: Serhiy Storchaka date: Sat Jun 18 09:58:24 2016 +0300 summary: Issue #27343: Fixed error message for conflicting initializers of ctypes.Structure. files: Lib/ctypes/test/test_structures.py | 6 +++--- Modules/_ctypes/_ctypes.c | 9 ++------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/Lib/ctypes/test/test_structures.py b/Lib/ctypes/test/test_structures.py --- a/Lib/ctypes/test/test_structures.py +++ b/Lib/ctypes/test/test_structures.py @@ -227,10 +227,10 @@ def test_conflicting_initializers(self): class POINT(Structure): - _fields_ = [("x", c_int), ("y", c_int)] + _fields_ = [("phi", c_float), ("rho", c_float)] # conflicting positional and keyword args - self.assertRaises(TypeError, POINT, 2, 3, x=4) - self.assertRaises(TypeError, POINT, 2, 3, y=4) + self.assertRaisesRegex(TypeError, "phi", POINT, 2, 3, phi=4) + self.assertRaisesRegex(TypeError, "rho", POINT, 2, 3, rho=4) # too many initializers self.assertRaises(TypeError, POINT, 2, 3, 4) diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -4065,14 +4065,9 @@ } val = PyTuple_GET_ITEM(args, i + index); if (kwds && PyDict_GetItem(kwds, name)) { - char *field = PyBytes_AsString(name); - if (field == NULL) { - PyErr_Clear(); - field = "???"; - } PyErr_Format(PyExc_TypeError, - "duplicate values for field '%s'", - field); + "duplicate values for field %R", + name); Py_DECREF(pair); Py_DECREF(name); return -1; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 18 02:59:16 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 18 Jun 2016 06:59:16 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327343=3A_Fixed_error_message_for_conflicting_in?= =?utf-8?q?itializers_of?= Message-ID: <20160618065916.19442.75646.A2D0123D@psf.io> https://hg.python.org/cpython/rev/40e3790c2a00 changeset: 102082:40e3790c2a00 parent: 102080:4fbcd58df1a0 parent: 102081:ed81fc7e285b user: Serhiy Storchaka date: Sat Jun 18 09:58:55 2016 +0300 summary: Issue #27343: Fixed error message for conflicting initializers of ctypes.Structure. files: Lib/ctypes/test/test_structures.py | 6 +++--- Modules/_ctypes/_ctypes.c | 9 ++------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/Lib/ctypes/test/test_structures.py b/Lib/ctypes/test/test_structures.py --- a/Lib/ctypes/test/test_structures.py +++ b/Lib/ctypes/test/test_structures.py @@ -227,10 +227,10 @@ def test_conflicting_initializers(self): class POINT(Structure): - _fields_ = [("x", c_int), ("y", c_int)] + _fields_ = [("phi", c_float), ("rho", c_float)] # conflicting positional and keyword args - self.assertRaises(TypeError, POINT, 2, 3, x=4) - self.assertRaises(TypeError, POINT, 2, 3, y=4) + self.assertRaisesRegex(TypeError, "phi", POINT, 2, 3, phi=4) + self.assertRaisesRegex(TypeError, "rho", POINT, 2, 3, rho=4) # too many initializers self.assertRaises(TypeError, POINT, 2, 3, 4) diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -4065,14 +4065,9 @@ } val = PyTuple_GET_ITEM(args, i + index); if (kwds && PyDict_GetItem(kwds, name)) { - char *field = PyBytes_AsString(name); - if (field == NULL) { - PyErr_Clear(); - field = "???"; - } PyErr_Format(PyExc_TypeError, - "duplicate values for field '%s'", - field); + "duplicate values for field %R", + name); Py_DECREF(pair); Py_DECREF(name); return -1; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 18 04:23:12 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 18 Jun 2016 08:23:12 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI0MzE0?= =?utf-8?q?=3A_Fix_doc_links_for_general_attributes_like_=5F=5Fname=5F=5F?= =?utf-8?b?LCBfX2RpY3RfXw==?= Message-ID: <20160618082312.11645.62187.E4565693@psf.io> https://hg.python.org/cpython/rev/4c361e189747 changeset: 102084:4c361e189747 branch: 3.5 parent: 102081:ed81fc7e285b user: Martin Panter date: Sat Jun 18 03:57:31 2016 +0000 summary: Issue #24314: Fix doc links for general attributes like __name__, __dict__ files: Doc/c-api/module.rst | 4 +- Doc/c-api/typeobj.rst | 4 +- Doc/library/builtins.rst | 2 +- Doc/library/enum.rst | 2 +- Doc/library/functions.rst | 10 ++-- Doc/library/functools.rst | 2 +- Doc/library/inspect.rst | 9 ++- Doc/library/stdtypes.rst | 23 ++++++---- Doc/reference/datamodel.rst | 51 ++++++++++++------------ Doc/tutorial/classes.rst | 4 +- Doc/whatsnew/2.1.rst | 4 +- Doc/whatsnew/2.2.rst | 14 +++--- Doc/whatsnew/2.3.rst | 8 +- Doc/whatsnew/3.0.rst | 4 +- 14 files changed, 73 insertions(+), 68 deletions(-) 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 @@ -59,10 +59,10 @@ .. 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 + is the same as the :attr:`~object.__dict__` attribute of the module object. This function never fails. It is recommended extensions use other :c:func:`PyModule_\*` and :c:func:`PyObject_\*` functions rather than directly - manipulate a module's :attr:`__dict__`. + manipulate a module's :attr:`~object.__dict__`. .. c:function:: PyObject* PyModule_GetNameObject(PyObject *module) 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 @@ -111,10 +111,10 @@ For statically allocated type objects, the tp_name field should contain a dot. Everything before the last dot is made accessible as the :attr:`__module__` attribute, and everything after the last dot is made accessible as the - :attr:`__name__` attribute. + :attr:`~definition.__name__` attribute. If no dot is present, the entire :c:member:`~PyTypeObject.tp_name` field is made accessible as the - :attr:`__name__` attribute, and the :attr:`__module__` attribute is undefined + :attr:`~definition.__name__` attribute, and the :attr:`__module__` attribute is undefined (unless explicitly set in the dictionary, as explained above). This means your type will be impossible to pickle. diff --git a/Doc/library/builtins.rst b/Doc/library/builtins.rst --- a/Doc/library/builtins.rst +++ b/Doc/library/builtins.rst @@ -37,6 +37,6 @@ As an implementation detail, most modules have the name ``__builtins__`` made available as part of their globals. The value of ``__builtins__`` is normally -either this module or the value of this module's :attr:`__dict__` attribute. +either this module or the value of this module's :attr:`~object.__dict__` attribute. Since this is an implementation detail, it may not be used by alternate implementations of Python. diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst --- a/Doc/library/enum.rst +++ b/Doc/library/enum.rst @@ -431,7 +431,7 @@ the source, pickling will be disabled. The new pickle protocol 4 also, in some circumstances, relies on -:attr:`__qualname__` being set to the location where pickle will be able +:attr:`~definition.__qualname__` being set to the location where pickle will be able to find the class. For example, if the class was made available in class SomeData in the global scope:: diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -304,7 +304,7 @@ :func:`dir` reports their attributes. If the object does not provide :meth:`__dir__`, the function tries its best to - gather information from the object's :attr:`__dict__` attribute, if defined, and + gather information from the object's :attr:`~object.__dict__` attribute, if defined, and from its type object. The resulting list is not necessarily complete, and may be inaccurate when the object has a custom :func:`__getattr__`. @@ -1446,7 +1446,7 @@ With three arguments, return a new type object. This is essentially a dynamic form of the :keyword:`class` statement. The *name* string is the - class name and becomes the :attr:`~class.__name__` attribute; the *bases* + class name and becomes the :attr:`~definition.__name__` attribute; the *bases* tuple itemizes the base classes and becomes the :attr:`~class.__bases__` attribute; and the *dict* dictionary is the namespace containing definitions for class body and is copied to a standard dictionary to become the @@ -1464,11 +1464,11 @@ .. function:: vars([object]) Return the :attr:`~object.__dict__` attribute for a module, class, instance, - or any other object with a :attr:`__dict__` attribute. + or any other object with a :attr:`~object.__dict__` attribute. - Objects such as modules and instances have an updateable :attr:`__dict__` + Objects such as modules and instances have an updateable :attr:`~object.__dict__` attribute; however, other objects may have write restrictions on their - :attr:`__dict__` attributes (for example, classes use a + :attr:`~object.__dict__` attributes (for example, classes use a dictproxy to prevent direct dictionary updates). Without an argument, :func:`vars` acts like :func:`locals`. Note, the diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -474,7 +474,7 @@ :class:`partial` objects are like :class:`function` objects in that they are callable, weak referencable, and can have attributes. There are some important -differences. For instance, the :attr:`__name__` and :attr:`__doc__` attributes +differences. For instance, the :attr:`~definition.__name__` and :attr:`__doc__` attributes are not created automatically. Also, :class:`partial` objects defined in classes behave like static methods and do not transform into bound methods during instance attribute look-up. diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -374,8 +374,9 @@ are true. This, for example, is true of ``int.__add__``. An object passing this test - has a :attr:`__get__` attribute but not a :attr:`__set__` attribute, but - beyond that the set of attributes varies. :attr:`__name__` is usually + has a :meth:`~object.__get__` method but not a :meth:`~object.__set__` + method, but beyond that the set of attributes varies. A + :attr:`~definition.__name__` attribute is usually sensible, and :attr:`__doc__` often is. Methods implemented via descriptors that also pass one of the other tests @@ -388,11 +389,11 @@ Return true if the object is a data descriptor. - Data descriptors have both a :attr:`__get__` and a :attr:`__set__` attribute. + Data descriptors have both a :attr:`~object.__get__` and a :attr:`~object.__set__` method. Examples are properties (defined in Python), getsets, and members. The latter two are defined in C and there are more specific tests available for those types, which is robust across Python implementations. Typically, data - descriptors will also have :attr:`__name__` and :attr:`__doc__` attributes + descriptors will also have :attr:`~definition.__name__` and :attr:`__doc__` attributes (properties, getsets, and members have both of these attributes), but this is not guaranteed. diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -4360,9 +4360,10 @@ A special attribute of every module is :attr:`~object.__dict__`. This is the dictionary containing the module's symbol table. Modifying this dictionary will actually change the module's symbol table, but direct assignment to the -:attr:`__dict__` attribute is not possible (you can write +:attr:`~object.__dict__` attribute is not possible (you can write ``m.__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but you can't write -``m.__dict__ = {}``). Modifying :attr:`__dict__` directly is not recommended. +``m.__dict__ = {}``). Modifying :attr:`~object.__dict__` directly is +not recommended. Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ``>> class C(object): @@ -383,7 +383,7 @@ AttributeError: 'C' object has no attribute 'newattr' Note how you get an :exc:`AttributeError` on the attempt to assign to an -attribute not listed in :attr:`__slots__`. +attribute not listed in :attr:`~object.__slots__`. .. _sect-rellinks: 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 @@ -1111,10 +1111,10 @@ * One of the noted incompatibilities between old- and new-style classes has been - removed: you can now assign to the :attr:`__name__` and :attr:`__bases__` + removed: you can now assign to the :attr:`~definition.__name__` and :attr:`~class.__bases__` attributes of new-style classes. There are some restrictions on what can be - assigned to :attr:`__bases__` along the lines of those relating to assigning to - an instance's :attr:`__class__` attribute. + assigned to :attr:`~class.__bases__` along the lines of those relating to assigning to + an instance's :attr:`~instance.__class__` attribute. .. ====================================================================== @@ -1920,7 +1920,7 @@ * If you dynamically allocate type objects in your extension, you should be aware of a change in the rules relating to the :attr:`__module__` and - :attr:`__name__` attributes. In summary, you will want to ensure the type's + :attr:`~definition.__name__` attributes. In summary, you will want to ensure the type's dictionary contains a ``'__module__'`` key; making the module name the part of the type name leading up to the final period will no longer have the desired effect. For more detail, read the API reference documentation or the source. diff --git a/Doc/whatsnew/3.0.rst b/Doc/whatsnew/3.0.rst --- a/Doc/whatsnew/3.0.rst +++ b/Doc/whatsnew/3.0.rst @@ -783,8 +783,8 @@ :attr:`func_closure`, :attr:`func_code`, :attr:`func_defaults`, :attr:`func_dict`, :attr:`func_doc`, :attr:`func_globals`, :attr:`func_name` were renamed to :attr:`__closure__`, - :attr:`__code__`, :attr:`__defaults__`, :attr:`__dict__`, - :attr:`__doc__`, :attr:`__globals__`, :attr:`__name__`, + :attr:`__code__`, :attr:`__defaults__`, :attr:`~object.__dict__`, + :attr:`__doc__`, :attr:`__globals__`, :attr:`~definition.__name__`, respectively. * :meth:`__nonzero__` is now :meth:`__bool__`. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 18 04:23:13 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 18 Jun 2016 08:23:13 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2324314=3A_Merge_doc_links_from_3=2E5?= Message-ID: <20160618082312.5214.44931.3DCBD07E@psf.io> https://hg.python.org/cpython/rev/79a3aff60e37 changeset: 102085:79a3aff60e37 parent: 102082:40e3790c2a00 parent: 102084:4c361e189747 user: Martin Panter date: Sat Jun 18 08:20:22 2016 +0000 summary: Issue #24314: Merge doc links from 3.5 files: Doc/c-api/module.rst | 4 +- Doc/c-api/typeobj.rst | 4 +- Doc/library/builtins.rst | 2 +- Doc/library/enum.rst | 2 +- Doc/library/functions.rst | 10 ++-- Doc/library/functools.rst | 2 +- Doc/library/inspect.rst | 9 ++- Doc/library/stdtypes.rst | 23 ++++++---- Doc/reference/datamodel.rst | 51 ++++++++++++------------ Doc/tutorial/classes.rst | 4 +- Doc/whatsnew/2.1.rst | 4 +- Doc/whatsnew/2.2.rst | 14 +++--- Doc/whatsnew/2.3.rst | 8 +- Doc/whatsnew/3.0.rst | 4 +- 14 files changed, 73 insertions(+), 68 deletions(-) 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 @@ -59,10 +59,10 @@ .. 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 + is the same as the :attr:`~object.__dict__` attribute of the module object. This function never fails. It is recommended extensions use other :c:func:`PyModule_\*` and :c:func:`PyObject_\*` functions rather than directly - manipulate a module's :attr:`__dict__`. + manipulate a module's :attr:`~object.__dict__`. .. c:function:: PyObject* PyModule_GetNameObject(PyObject *module) 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 @@ -111,10 +111,10 @@ For statically allocated type objects, the tp_name field should contain a dot. Everything before the last dot is made accessible as the :attr:`__module__` attribute, and everything after the last dot is made accessible as the - :attr:`__name__` attribute. + :attr:`~definition.__name__` attribute. If no dot is present, the entire :c:member:`~PyTypeObject.tp_name` field is made accessible as the - :attr:`__name__` attribute, and the :attr:`__module__` attribute is undefined + :attr:`~definition.__name__` attribute, and the :attr:`__module__` attribute is undefined (unless explicitly set in the dictionary, as explained above). This means your type will be impossible to pickle. diff --git a/Doc/library/builtins.rst b/Doc/library/builtins.rst --- a/Doc/library/builtins.rst +++ b/Doc/library/builtins.rst @@ -37,6 +37,6 @@ As an implementation detail, most modules have the name ``__builtins__`` made available as part of their globals. The value of ``__builtins__`` is normally -either this module or the value of this module's :attr:`__dict__` attribute. +either this module or the value of this module's :attr:`~object.__dict__` attribute. Since this is an implementation detail, it may not be used by alternate implementations of Python. diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst --- a/Doc/library/enum.rst +++ b/Doc/library/enum.rst @@ -431,7 +431,7 @@ the source, pickling will be disabled. The new pickle protocol 4 also, in some circumstances, relies on -:attr:`__qualname__` being set to the location where pickle will be able +:attr:`~definition.__qualname__` being set to the location where pickle will be able to find the class. For example, if the class was made available in class SomeData in the global scope:: diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -304,7 +304,7 @@ :func:`dir` reports their attributes. If the object does not provide :meth:`__dir__`, the function tries its best to - gather information from the object's :attr:`__dict__` attribute, if defined, and + gather information from the object's :attr:`~object.__dict__` attribute, if defined, and from its type object. The resulting list is not necessarily complete, and may be inaccurate when the object has a custom :func:`__getattr__`. @@ -1449,7 +1449,7 @@ With three arguments, return a new type object. This is essentially a dynamic form of the :keyword:`class` statement. The *name* string is the - class name and becomes the :attr:`~class.__name__` attribute; the *bases* + class name and becomes the :attr:`~definition.__name__` attribute; the *bases* tuple itemizes the base classes and becomes the :attr:`~class.__bases__` attribute; and the *dict* dictionary is the namespace containing definitions for class body and is copied to a standard dictionary to become the @@ -1467,11 +1467,11 @@ .. function:: vars([object]) Return the :attr:`~object.__dict__` attribute for a module, class, instance, - or any other object with a :attr:`__dict__` attribute. + or any other object with a :attr:`~object.__dict__` attribute. - Objects such as modules and instances have an updateable :attr:`__dict__` + Objects such as modules and instances have an updateable :attr:`~object.__dict__` attribute; however, other objects may have write restrictions on their - :attr:`__dict__` attributes (for example, classes use a + :attr:`~object.__dict__` attributes (for example, classes use a dictproxy to prevent direct dictionary updates). Without an argument, :func:`vars` acts like :func:`locals`. Note, the diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -474,7 +474,7 @@ :class:`partial` objects are like :class:`function` objects in that they are callable, weak referencable, and can have attributes. There are some important -differences. For instance, the :attr:`__name__` and :attr:`__doc__` attributes +differences. For instance, the :attr:`~definition.__name__` and :attr:`__doc__` attributes are not created automatically. Also, :class:`partial` objects defined in classes behave like static methods and do not transform into bound methods during instance attribute look-up. diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -355,8 +355,9 @@ are true. This, for example, is true of ``int.__add__``. An object passing this test - has a :attr:`__get__` attribute but not a :attr:`__set__` attribute, but - beyond that the set of attributes varies. :attr:`__name__` is usually + has a :meth:`~object.__get__` method but not a :meth:`~object.__set__` + method, but beyond that the set of attributes varies. A + :attr:`~definition.__name__` attribute is usually sensible, and :attr:`__doc__` often is. Methods implemented via descriptors that also pass one of the other tests @@ -369,11 +370,11 @@ Return true if the object is a data descriptor. - Data descriptors have both a :attr:`__get__` and a :attr:`__set__` attribute. + Data descriptors have both a :attr:`~object.__get__` and a :attr:`~object.__set__` method. Examples are properties (defined in Python), getsets, and members. The latter two are defined in C and there are more specific tests available for those types, which is robust across Python implementations. Typically, data - descriptors will also have :attr:`__name__` and :attr:`__doc__` attributes + descriptors will also have :attr:`~definition.__name__` and :attr:`__doc__` attributes (properties, getsets, and members have both of these attributes), but this is not guaranteed. diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -4361,9 +4361,10 @@ A special attribute of every module is :attr:`~object.__dict__`. This is the dictionary containing the module's symbol table. Modifying this dictionary will actually change the module's symbol table, but direct assignment to the -:attr:`__dict__` attribute is not possible (you can write +:attr:`~object.__dict__` attribute is not possible (you can write ``m.__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but you can't write -``m.__dict__ = {}``). Modifying :attr:`__dict__` directly is not recommended. +``m.__dict__ = {}``). Modifying :attr:`~object.__dict__` directly is +not recommended. Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ``>> class C(object): @@ -383,7 +383,7 @@ AttributeError: 'C' object has no attribute 'newattr' Note how you get an :exc:`AttributeError` on the attempt to assign to an -attribute not listed in :attr:`__slots__`. +attribute not listed in :attr:`~object.__slots__`. .. _sect-rellinks: 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 @@ -1111,10 +1111,10 @@ * One of the noted incompatibilities between old- and new-style classes has been - removed: you can now assign to the :attr:`__name__` and :attr:`__bases__` + removed: you can now assign to the :attr:`~definition.__name__` and :attr:`~class.__bases__` attributes of new-style classes. There are some restrictions on what can be - assigned to :attr:`__bases__` along the lines of those relating to assigning to - an instance's :attr:`__class__` attribute. + assigned to :attr:`~class.__bases__` along the lines of those relating to assigning to + an instance's :attr:`~instance.__class__` attribute. .. ====================================================================== @@ -1920,7 +1920,7 @@ * If you dynamically allocate type objects in your extension, you should be aware of a change in the rules relating to the :attr:`__module__` and - :attr:`__name__` attributes. In summary, you will want to ensure the type's + :attr:`~definition.__name__` attributes. In summary, you will want to ensure the type's dictionary contains a ``'__module__'`` key; making the module name the part of the type name leading up to the final period will no longer have the desired effect. For more detail, read the API reference documentation or the source. diff --git a/Doc/whatsnew/3.0.rst b/Doc/whatsnew/3.0.rst --- a/Doc/whatsnew/3.0.rst +++ b/Doc/whatsnew/3.0.rst @@ -783,8 +783,8 @@ :attr:`func_closure`, :attr:`func_code`, :attr:`func_defaults`, :attr:`func_dict`, :attr:`func_doc`, :attr:`func_globals`, :attr:`func_name` were renamed to :attr:`__closure__`, - :attr:`__code__`, :attr:`__defaults__`, :attr:`__dict__`, - :attr:`__doc__`, :attr:`__globals__`, :attr:`__name__`, + :attr:`__code__`, :attr:`__defaults__`, :attr:`~object.__dict__`, + :attr:`__doc__`, :attr:`__globals__`, :attr:`~definition.__name__`, respectively. * :meth:`__nonzero__` is now :meth:`__bool__`. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 18 04:23:13 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 18 Jun 2016 08:23:13 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI0MzE0?= =?utf-8?q?=3A_Add_links_for_general_attributes_like_=5F=5Fname=5F=5F=2C_?= =?utf-8?b?X19kaWN0X18=?= Message-ID: <20160618082311.4917.55083.CE7B4829@psf.io> https://hg.python.org/cpython/rev/1ed4e4a168bb changeset: 102083:1ed4e4a168bb branch: 2.7 parent: 102078:a09ae70f3489 user: Martin Panter date: Sat Jun 18 03:57:31 2016 +0000 summary: Issue #24314: Add links for general attributes like __name__, __dict__ files: Doc/c-api/class.rst | 2 +- Doc/c-api/module.rst | 4 +- Doc/c-api/typeobj.rst | 4 +- Doc/library/__builtin__.rst | 2 +- Doc/library/functions.rst | 10 ++-- Doc/library/functools.rst | 2 +- Doc/library/inspect.rst | 12 ++-- Doc/library/restricted.rst | 2 +- Doc/library/stdtypes.rst | 12 ++-- Doc/reference/datamodel.rst | 61 ++++++++++++------------ Doc/tutorial/classes.rst | 4 +- Doc/whatsnew/2.1.rst | 4 +- Doc/whatsnew/2.2.rst | 14 ++-- Doc/whatsnew/2.3.rst | 8 +- 14 files changed, 73 insertions(+), 68 deletions(-) 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 @@ -61,5 +61,5 @@ 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 - object's :attr:`__dict__`; if *NULL*, a new dictionary will be created for the + object's :attr:`~object.__dict__`; if *NULL*, a new dictionary will be created for the instance. 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 @@ -51,10 +51,10 @@ .. 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 + is the same as the :attr:`~object.__dict__` attribute of the module object. This function never fails. It is recommended extensions use other :c:func:`PyModule_\*` and :c:func:`PyObject_\*` functions rather than directly - manipulate a module's :attr:`__dict__`. + manipulate a module's :attr:`~object.__dict__`. .. c:function:: char* PyModule_GetName(PyObject *module) 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 @@ -117,10 +117,10 @@ For statically allocated type objects, the tp_name field should contain a dot. Everything before the last dot is made accessible as the :attr:`__module__` attribute, and everything after the last dot is made accessible as the - :attr:`__name__` attribute. + :attr:`~definition.__name__` attribute. If no dot is present, the entire :c:member:`~PyTypeObject.tp_name` field is made accessible as the - :attr:`__name__` attribute, and the :attr:`__module__` attribute is undefined + :attr:`~definition.__name__` attribute, and the :attr:`__module__` attribute is undefined (unless explicitly set in the dictionary, as explained above). This means your type will be impossible to pickle. diff --git a/Doc/library/__builtin__.rst b/Doc/library/__builtin__.rst --- a/Doc/library/__builtin__.rst +++ b/Doc/library/__builtin__.rst @@ -39,6 +39,6 @@ Most modules have the name ``__builtins__`` (note the ``'s'``) made available as part of their globals. The value of ``__builtins__`` is normally either - this module or the value of this modules's :attr:`__dict__` attribute. Since + this module or the value of this modules's :attr:`~object.__dict__` attribute. Since this is an implementation detail, it may not be used by alternate implementations of Python. diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -311,7 +311,7 @@ :func:`dir` reports their attributes. If the object does not provide :meth:`__dir__`, the function tries its best to - gather information from the object's :attr:`__dict__` attribute, if defined, and + gather information from the object's :attr:`~object.__dict__` attribute, if defined, and from its type object. The resulting list is not necessarily complete, and may be inaccurate when the object has a custom :func:`__getattr__`. @@ -1477,7 +1477,7 @@ With three arguments, return a new type object. This is essentially a dynamic form of the :keyword:`class` statement. The *name* string is the - class name and becomes the :attr:`~class.__name__` attribute; the *bases* tuple + class name and becomes the :attr:`~definition.__name__` attribute; the *bases* tuple itemizes the base classes and becomes the :attr:`~class.__bases__` attribute; and the *dict* dictionary is the namespace containing definitions for class body and becomes the :attr:`~object.__dict__` attribute. For example, the @@ -1545,11 +1545,11 @@ .. function:: vars([object]) Return the :attr:`~object.__dict__` attribute for a module, class, instance, - or any other object with a :attr:`__dict__` attribute. + or any other object with a :attr:`~object.__dict__` attribute. - Objects such as modules and instances have an updateable :attr:`__dict__` + Objects such as modules and instances have an updateable :attr:`~object.__dict__` attribute; however, other objects may have write restrictions on their - :attr:`__dict__` attributes (for example, new-style classes use a + :attr:`~object.__dict__` attributes (for example, new-style classes use a dictproxy to prevent direct dictionary updates). Without an argument, :func:`vars` acts like :func:`locals`. Note, the diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -185,7 +185,7 @@ :class:`partial` objects are like :class:`function` objects in that they are callable, weak referencable, and can have attributes. There are some important -differences. For instance, the :attr:`__name__` and :attr:`__doc__` attributes +differences. For instance, the :attr:`~definition.__name__` and :attr:`__doc__` attributes are not created automatically. Also, :class:`partial` objects defined in classes behave like static methods and do not transform into bound methods during instance attribute look-up. diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -335,9 +335,11 @@ are true. This is new as of Python 2.2, and, for example, is true of - ``int.__add__``. An object passing this test has a :attr:`__get__` attribute - but not a :attr:`__set__` attribute, but beyond that the set of attributes - varies. :attr:`__name__` is usually sensible, and :attr:`__doc__` often is. + ``int.__add__``. An object passing this test + has a :meth:`~object.__get__` method but not a :meth:`~object.__set__` + method, but beyond that the set of attributes varies. A + :attr:`~definition.__name__` attribute is usually + sensible, and :attr:`__doc__` often is. Methods implemented via descriptors that also pass one of the other tests return false from the :func:`ismethoddescriptor` test, simply because the @@ -349,11 +351,11 @@ Return true if the object is a data descriptor. - Data descriptors have both a :attr:`__get__` and a :attr:`__set__` attribute. + Data descriptors have both a :attr:`~object.__get__` and a :attr:`~object.__set__` method. Examples are properties (defined in Python), getsets, and members. The latter two are defined in C and there are more specific tests available for those types, which is robust across Python implementations. Typically, data - descriptors will also have :attr:`__name__` and :attr:`__doc__` attributes + descriptors will also have :attr:`~definition.__name__` and :attr:`__doc__` attributes (properties, getsets, and members have both of these attributes), but this is not guaranteed. diff --git a/Doc/library/restricted.rst b/Doc/library/restricted.rst --- a/Doc/library/restricted.rst +++ b/Doc/library/restricted.rst @@ -48,7 +48,7 @@ Python code executing in restricted mode faces a number of limitations that are designed to prevent it from escaping from the padded cell. For instance, the function object attribute :attr:`func_globals` and the class and instance object -attribute :attr:`__dict__` are unavailable. +attribute :attr:`~object.__dict__` are unavailable. Two modules provide the framework for setting up restricted execution environments: diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -2927,9 +2927,10 @@ A special attribute of every module is :attr:`~object.__dict__`. This is the dictionary containing the module's symbol table. Modifying this dictionary will actually change the module's symbol table, but direct assignment to the -:attr:`__dict__` attribute is not possible (you can write +:attr:`~object.__dict__` attribute is not possible (you can write ``m.__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but you can't write -``m.__dict__ = {}``). Modifying :attr:`__dict__` directly is not recommended. +``m.__dict__ = {}``). Modifying :attr:`~object.__dict__` directly is +not recommended. Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ``>> class C(object): @@ -383,7 +383,7 @@ AttributeError: 'C' object has no attribute 'newattr' Note how you get an :exc:`AttributeError` on the attempt to assign to an -attribute not listed in :attr:`__slots__`. +attribute not listed in :attr:`~object.__slots__`. .. _sect-rellinks: 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 @@ -1111,10 +1111,10 @@ * One of the noted incompatibilities between old- and new-style classes has been - removed: you can now assign to the :attr:`__name__` and :attr:`__bases__` + removed: you can now assign to the :attr:`~definition.__name__` and :attr:`~class.__bases__` attributes of new-style classes. There are some restrictions on what can be - assigned to :attr:`__bases__` along the lines of those relating to assigning to - an instance's :attr:`__class__` attribute. + assigned to :attr:`~class.__bases__` along the lines of those relating to assigning to + an instance's :attr:`~instance.__class__` attribute. .. ====================================================================== @@ -1920,7 +1920,7 @@ * If you dynamically allocate type objects in your extension, you should be aware of a change in the rules relating to the :attr:`__module__` and - :attr:`__name__` attributes. In summary, you will want to ensure the type's + :attr:`~definition.__name__` attributes. In summary, you will want to ensure the type's dictionary contains a ``'__module__'`` key; making the module name the part of the type name leading up to the final period will no longer have the desired effect. For more detail, read the API reference documentation or the source. -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Sat Jun 18 04:51:21 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 18 Jun 2016 08:51:21 +0000 Subject: [Python-checkins] Daily reference leaks (61bd6974405f): sum=3 Message-ID: <20160618085121.5214.39668.38543458@psf.io> results for 61bd6974405f on branch "default" -------------------------------------------- test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [0, -2, 1] memory blocks, sum=-1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogGI00wH', '--timeout', '7200'] From python-checkins at python.org Sat Jun 18 06:56:38 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 18 Jun 2016 10:56:38 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2326754=3A_PyUnicode=5FFSDecoder=28=29_accepted_a?= =?utf-8?q?_filename_argument_encoded_as?= Message-ID: <20160618105638.9774.10038.1D463C25@psf.io> https://hg.python.org/cpython/rev/e18ac7370113 changeset: 102087:e18ac7370113 parent: 102085:79a3aff60e37 parent: 102086:2e48c2c4c733 user: Serhiy Storchaka date: Sat Jun 18 13:56:16 2016 +0300 summary: Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded as an iterable of integers. Now only strings and byte-like objects are accepted. files: Lib/test/test_compile.py | 7 +++++++ Lib/test/test_parser.py | 16 ++++++++++++++++ Lib/test/test_symtable.py | 6 ++++++ Lib/test/test_zipimport.py | 15 +++++++++++++++ Misc/NEWS | 10 ++++++++++ Objects/unicodeobject.c | 8 +++++++- 6 files changed, 61 insertions(+), 1 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,13 @@ d = {f(): f(), f(): f()} self.assertEqual(d, {1: 2, 3: 4}) + def test_compile_filename(self): + for filename in ('file.py', b'file.py', + bytearray(b'file.py'), memoryview(b'file.py')): + code = compile('pass', filename, 'exec') + self.assertEqual(code.co_filename, 'file.py') + self.assertRaises(TypeError, compile, 'pass', list(b'file.py'), 'exec') + @support.cpython_only def test_same_filename_used(self): s = """def f(): pass\ndef g(): pass""" 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 @@ -626,6 +626,22 @@ code2 = parser.compilest(st) self.assertEqual(eval(code2), -3) + def test_compile_filename(self): + st = parser.expr('a + 5') + code = parser.compilest(st) + self.assertEqual(code.co_filename, '') + code = st.compile() + self.assertEqual(code.co_filename, '') + for filename in ('file.py', b'file.py', + bytearray(b'file.py'), memoryview(b'file.py')): + code = parser.compilest(st, filename) + self.assertEqual(code.co_filename, 'file.py') + code = st.compile(filename) + self.assertEqual(code.co_filename, 'file.py') + self.assertRaises(TypeError, parser.compilest, st, list(b'file.py')) + self.assertRaises(TypeError, st.compile, list(b'file.py')) + + class ParserStackLimitTestCase(unittest.TestCase): """try to push the parser to/over its limits. see http://bugs.python.org/issue1881 for a discussion 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 @@ -157,6 +157,12 @@ self.fail("no SyntaxError for %r" % (brokencode,)) checkfilename("def f(x): foo)(") # parse-time checkfilename("def f(x): global x") # symtable-build-time + symtable.symtable("pass", b"spam", "exec") + with self.assertRaises(TypeError): + symtable.symtable("pass", bytearray(b"spam"), "exec") + symtable.symtable("pass", memoryview(b"spam"), "exec") + with self.assertRaises(TypeError): + symtable.symtable("pass", list(b"spam"), "exec") def test_eval(self): symbols = symtable.symtable("42", "?", "eval") 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 @@ -619,6 +619,19 @@ finally: os.remove(filename) + def testBytesPath(self): + filename = support.TESTFN + ".zip" + self.addCleanup(support.unlink, filename) + with ZipFile(filename, "w") as z: + zinfo = ZipInfo(TESTMOD + ".py", time.localtime(NOW)) + zinfo.compress_type = self.compression + z.writestr(zinfo, test_src) + + zipimport.zipimporter(filename) + zipimport.zipimporter(os.fsencode(filename)) + zipimport.zipimporter(bytearray(os.fsencode(filename))) + zipimport.zipimporter(memoryview(os.fsencode(filename))) + @support.requires_zlib class CompressedZipImportTestCase(UncompressedZipImportTestCase): @@ -639,6 +652,8 @@ def testBadArgs(self): self.assertRaises(TypeError, zipimport.zipimporter, None) self.assertRaises(TypeError, zipimport.zipimporter, TESTMOD, kwd=None) + self.assertRaises(TypeError, zipimport.zipimporter, + list(os.fsencode(TESTMOD))) def testFilenameTooLong(self): self.assertZipFailure('A' * 33000) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,10 @@ Library ------- +- Issue #26754: Some functions (compile() etc) accepted a filename argument + encoded as an iterable of integers. Now only strings and byte-like objects + are accepted. + - Issue #26536: socket.ioctl now supports SIO_LOOPBACK_FAST_PATH. Patch by Daniel Stokes. @@ -52,6 +56,12 @@ - Issue #27310: Fix IDLE.app failure to launch on OS X due to vestigial import. +C API +----- + +- Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded as + an iterable of integers. Now only strings and byte-like objects are accepted. + Build ----- diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -3837,7 +3837,7 @@ output = arg; Py_INCREF(output); } - else { + else if (PyObject_CheckBuffer(arg)) { arg = PyBytes_FromObject(arg); if (!arg) return 0; @@ -3852,6 +3852,12 @@ return 0; } } + else { + PyErr_Format(PyExc_TypeError, + "path should be string or bytes, not %.200s", + Py_TYPE(arg)->tp_name); + return 0; + } if (PyUnicode_READY(output) == -1) { Py_DECREF(output); return 0; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 18 06:56:38 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 18 Jun 2016 10:56:38 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI2NzU0?= =?utf-8?q?=3A_PyUnicode=5FFSDecoder=28=29_accepted_a_filename_argument_en?= =?utf-8?q?coded_as?= Message-ID: <20160618105637.28732.35430.C892E518@psf.io> https://hg.python.org/cpython/rev/2e48c2c4c733 changeset: 102086:2e48c2c4c733 branch: 3.5 parent: 102084:4c361e189747 user: Serhiy Storchaka date: Sat Jun 18 13:53:36 2016 +0300 summary: Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded as an iterable of integers. Now only strings and byte-like objects are accepted. files: Lib/test/test_compile.py | 7 +++++++ Lib/test/test_parser.py | 16 ++++++++++++++++ Lib/test/test_symtable.py | 6 ++++++ Lib/test/test_zipimport.py | 15 +++++++++++++++ Misc/NEWS | 11 +++++++++++ Objects/unicodeobject.c | 8 +++++++- 6 files changed, 62 insertions(+), 1 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,13 @@ d = {f(): f(), f(): f()} self.assertEqual(d, {1: 2, 3: 4}) + def test_compile_filename(self): + for filename in ('file.py', b'file.py', + bytearray(b'file.py'), memoryview(b'file.py')): + code = compile('pass', filename, 'exec') + self.assertEqual(code.co_filename, 'file.py') + self.assertRaises(TypeError, compile, 'pass', list(b'file.py'), 'exec') + @support.cpython_only def test_same_filename_used(self): s = """def f(): pass\ndef g(): pass""" 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 @@ -627,6 +627,22 @@ code2 = parser.compilest(st) self.assertEqual(eval(code2), -3) + def test_compile_filename(self): + st = parser.expr('a + 5') + code = parser.compilest(st) + self.assertEqual(code.co_filename, '') + code = st.compile() + self.assertEqual(code.co_filename, '') + for filename in ('file.py', b'file.py', + bytearray(b'file.py'), memoryview(b'file.py')): + code = parser.compilest(st, filename) + self.assertEqual(code.co_filename, 'file.py') + code = st.compile(filename) + self.assertEqual(code.co_filename, 'file.py') + self.assertRaises(TypeError, parser.compilest, st, list(b'file.py')) + self.assertRaises(TypeError, st.compile, list(b'file.py')) + + class ParserStackLimitTestCase(unittest.TestCase): """try to push the parser to/over its limits. see http://bugs.python.org/issue1881 for a discussion 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 @@ -157,6 +157,12 @@ self.fail("no SyntaxError for %r" % (brokencode,)) checkfilename("def f(x): foo)(") # parse-time checkfilename("def f(x): global x") # symtable-build-time + symtable.symtable("pass", b"spam", "exec") + with self.assertRaises(TypeError): + symtable.symtable("pass", bytearray(b"spam"), "exec") + symtable.symtable("pass", memoryview(b"spam"), "exec") + with self.assertRaises(TypeError): + symtable.symtable("pass", list(b"spam"), "exec") def test_eval(self): symbols = symtable.symtable("42", "?", "eval") 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 @@ -600,6 +600,19 @@ finally: os.remove(filename) + def testBytesPath(self): + filename = support.TESTFN + ".zip" + self.addCleanup(support.unlink, filename) + with ZipFile(filename, "w") as z: + zinfo = ZipInfo(TESTMOD + ".py", time.localtime(NOW)) + zinfo.compress_type = self.compression + z.writestr(zinfo, test_src) + + zipimport.zipimporter(filename) + zipimport.zipimporter(os.fsencode(filename)) + zipimport.zipimporter(bytearray(os.fsencode(filename))) + zipimport.zipimporter(memoryview(os.fsencode(filename))) + @support.requires_zlib class CompressedZipImportTestCase(UncompressedZipImportTestCase): @@ -620,6 +633,8 @@ def testBadArgs(self): self.assertRaises(TypeError, zipimport.zipimporter, None) self.assertRaises(TypeError, zipimport.zipimporter, TESTMOD, kwd=None) + self.assertRaises(TypeError, zipimport.zipimporter, + list(os.fsencode(TESTMOD))) def testFilenameTooLong(self): self.assertZipFailure('A' * 33000) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,10 @@ Library ------- +- Issue #26754: Some functions (compile() etc) accepted a filename argument + encoded as an iterable of integers. Now only strings and byte-like objects + are accepted. + - Issue #27048: Prevents distutils failing on Windows when environment variables contain non-ASCII characters @@ -43,6 +47,13 @@ - Issue #26930: Update Windows builds to use OpenSSL 1.0.2h. +C API +----- + +- Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded as + an iterable of integers. Now only strings and byte-like objects are accepted. + + What's New in Python 3.5.2 final? ================================= diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -3666,7 +3666,7 @@ output = arg; Py_INCREF(output); } - else { + else if (PyObject_CheckBuffer(arg)) { arg = PyBytes_FromObject(arg); if (!arg) return 0; @@ -3681,6 +3681,12 @@ return 0; } } + else { + PyErr_Format(PyExc_TypeError, + "path should be string or bytes, not %.200s", + Py_TYPE(arg)->tp_name); + return 0; + } if (PyUnicode_READY(output) == -1) { Py_DECREF(output); return 0; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 18 09:09:25 2016 From: python-checkins at python.org (berker.peksag) Date: Sat, 18 Jun 2016 13:09:25 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2326536=3A_Skip_tes?= =?utf-8?q?t=5Fsio=5Floopback=5Ffast=5Fpath_under_Windows_7?= Message-ID: <20160618130925.4958.67953.AE33F337@psf.io> https://hg.python.org/cpython/rev/e8b10ed64e63 changeset: 102088:e8b10ed64e63 user: Berker Peksag date: Sat Jun 18 16:10:07 2016 +0300 summary: Issue #26536: Skip test_sio_loopback_fast_path under Windows 7 files: Lib/test/test_socket.py | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 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 @@ -1223,10 +1223,16 @@ def test_sio_loopback_fast_path(self): s = socket.socket() self.addCleanup(s.close) - s.ioctl(socket.SIO_LOOPBACK_FAST_PATH, True) + try: + s.ioctl(socket.SIO_LOOPBACK_FAST_PATH, True) + except OSError as exc: + WSAEOPNOTSUPP = 10045 + if exc.winerror == WSAEOPNOTSUPP: + self.skipTest("SIO_LOOPBACK_FAST_PATH is defined but " + "doesn't implemented in this Windows version") + raise self.assertRaises(TypeError, s.ioctl, socket.SIO_LOOPBACK_FAST_PATH, None) - def testGetaddrinfo(self): try: socket.getaddrinfo('localhost', 80) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 18 09:42:41 2016 From: python-checkins at python.org (berker.peksag) Date: Sat, 18 Jun 2016 13:42:41 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2326536=3A_Use_spac?= =?utf-8?q?es_instead_of_tabs?= Message-ID: <20160618134240.78403.78700.16760B45@psf.io> https://hg.python.org/cpython/rev/213c240cce0a changeset: 102089:213c240cce0a user: Berker Peksag date: Sat Jun 18 16:43:25 2016 +0300 summary: Issue #26536: Use spaces instead of tabs files: Modules/socketmodule.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -7288,14 +7288,14 @@ { DWORD codes[] = {SIO_RCVALL, SIO_KEEPALIVE_VALS, #if defined(SIO_LOOPBACK_FAST_PATH) - SIO_LOOPBACK_FAST_PATH -#endif - }; + SIO_LOOPBACK_FAST_PATH +#endif + }; const char *names[] = {"SIO_RCVALL", "SIO_KEEPALIVE_VALS", #if defined(SIO_LOOPBACK_FAST_PATH) - "SIO_LOOPBACK_FAST_PATH" -#endif - }; + "SIO_LOOPBACK_FAST_PATH" +#endif + }; int i; for(i = 0; i https://hg.python.org/cpython/rev/0303ab246152 changeset: 102090:0303ab246152 user: Serhiy Storchaka date: Sat Jun 18 16:48:07 2016 +0300 summary: Issue #27177: Match objects in the re module now support index-like objects as group indices. Based on patches by Jeroen Demeyer and Xiang Zhang. files: Lib/test/test_re.py | 28 +++++++++++++++++++++------- Misc/NEWS | 3 +++ Modules/_sre.c | 5 +++-- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -414,19 +414,33 @@ self.assertEqual(pat.match('bc').groups(), ('b', None, 'b', 'c')) self.assertEqual(pat.match('bc').groups(""), ('b', "", 'b', 'c')) - # A single group - m = re.match('(a)', 'a') - self.assertEqual(m.group(0), 'a') - self.assertEqual(m.group(0), 'a') - self.assertEqual(m.group(1), 'a') - self.assertEqual(m.group(1, 1), ('a', 'a')) - pat = re.compile('(?:(?Pa)|(?Pb))(?Pc)?') self.assertEqual(pat.match('a').group(1, 2, 3), ('a', None, None)) self.assertEqual(pat.match('b').group('a1', 'b2', 'c3'), (None, 'b', None)) self.assertEqual(pat.match('ac').group(1, 'b2', 3), ('a', None, 'c')) + def test_group(self): + class Index: + def __init__(self, value): + self.value = value + def __index__(self): + return self.value + # A single group + m = re.match('(a)(b)', 'ab') + self.assertEqual(m.group(), 'ab') + self.assertEqual(m.group(0), 'ab') + self.assertEqual(m.group(1), 'a') + self.assertEqual(m.group(Index(1)), 'a') + self.assertRaises(IndexError, m.group, -1) + self.assertRaises(IndexError, m.group, 3) + self.assertRaises(IndexError, m.group, 1<<1000) + self.assertRaises(IndexError, m.group, Index(1<<1000)) + self.assertRaises(IndexError, m.group, 'x') + # Multiple groups + self.assertEqual(m.group(2, 1), ('b', 'a')) + self.assertEqual(m.group(Index(2), Index(1)), ('b', 'a')) + def test_re_fullmatch(self): # Issue 16203: Proposal: add re.fullmatch() method. self.assertEqual(re.fullmatch(r"a", "a").span(), (0, 1)) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Library ------- +- Issue #27177: Match objects in the re module now support index-like objects + as group indices. Based on patches by Jeroen Demeyer and Xiang Zhang. + - Issue #26754: Some functions (compile() etc) accepted a filename argument encoded as an iterable of integers. Now only strings and byte-like objects are accepted. diff --git a/Modules/_sre.c b/Modules/_sre.c --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -2049,8 +2049,9 @@ /* Default value */ return 0; - if (PyLong_Check(index)) - return PyLong_AsSsize_t(index); + if (PyIndex_Check(index)) { + return PyNumber_AsSsize_t(index, NULL); + } i = -1; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 18 14:23:09 2016 From: python-checkins at python.org (senthil.kumaran) Date: Sat, 18 Jun 2016 18:23:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_issue27021_-_D?= =?utf-8?q?ocument_SC=5FIOV=5FMAX_limitation_imposed_by_OS_on_os=2Ewritev?= =?utf-8?q?=2E?= Message-ID: <20160618182309.19464.1745.1634E110@psf.io> https://hg.python.org/cpython/rev/eddbf14f451b changeset: 102091:eddbf14f451b branch: 3.5 parent: 102086:2e48c2c4c733 user: Senthil Kumaran date: Sat Jun 18 11:21:50 2016 -0700 summary: issue27021 - Document SC_IOV_MAX limitation imposed by OS on os.writev. Patch contributed ???? ?????????. files: Doc/library/os.rst | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1195,7 +1195,11 @@ .. function:: writev(fd, buffers) Write the contents of *buffers* to file descriptor *fd*. *buffers* must be a - sequence of :term:`bytes-like objects `. + sequence of :term:`bytes-like objects `. Buffers are + processed in array order. Entire contents of first buffer is written before + proceeding to second, and so on. The operating system may set a limit + (sysconf() value SC_IOV_MAX) on the number of buffers that can be used. + :func:`~os.writev` writes the contents of each object to the file descriptor and returns the total number of bytes written. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 18 14:23:09 2016 From: python-checkins at python.org (senthil.kumaran) Date: Sat, 18 Jun 2016 18:23:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_=5Bmerge_from_3=2E5=5D_-_issue27021_-_Document_SC=5FIOV?= =?utf-8?q?=5FMAX_limitation_imposed_by_OS_on?= Message-ID: <20160618182309.66933.891.38358BCD@psf.io> https://hg.python.org/cpython/rev/0b1cd695e7aa changeset: 102092:0b1cd695e7aa parent: 102090:0303ab246152 parent: 102091:eddbf14f451b user: Senthil Kumaran date: Sat Jun 18 11:23:04 2016 -0700 summary: [merge from 3.5] - issue27021 - Document SC_IOV_MAX limitation imposed by OS on os.writev. Patch contributed ???? ?????????. files: Doc/library/os.rst | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1228,7 +1228,11 @@ .. function:: writev(fd, buffers) Write the contents of *buffers* to file descriptor *fd*. *buffers* must be a - sequence of :term:`bytes-like objects `. + sequence of :term:`bytes-like objects `. Buffers are + processed in array order. Entire contents of first buffer is written before + proceeding to second, and so on. The operating system may set a limit + (sysconf() value SC_IOV_MAX) on the number of buffers that can be used. + :func:`~os.writev` writes the contents of each object to the file descriptor and returns the total number of bytes written. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 18 14:42:31 2016 From: python-checkins at python.org (berker.peksag) Date: Sat, 18 Jun 2016 18:42:31 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MzQ5?= =?utf-8?q?=3A_Fix_typo_in_distutils_upload_command?= Message-ID: <20160618184231.28294.95185.51436AE8@psf.io> https://hg.python.org/cpython/rev/81a9ce02b49b changeset: 102093:81a9ce02b49b branch: 3.5 parent: 102091:eddbf14f451b user: Berker Peksag date: Sat Jun 18 21:42:37 2016 +0300 summary: Issue #27349: Fix typo in distutils upload command files: Lib/distutils/command/upload.py | 2 +- Lib/distutils/tests/test_upload.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/distutils/command/upload.py b/Lib/distutils/command/upload.py --- a/Lib/distutils/command/upload.py +++ b/Lib/distutils/command/upload.py @@ -91,7 +91,7 @@ data = { # action ':action': 'file_upload', - 'protcol_version': '1', + 'protocol_version': '1', # identify release 'name': meta.get_name(), diff --git a/Lib/distutils/tests/test_upload.py b/Lib/distutils/tests/test_upload.py --- a/Lib/distutils/tests/test_upload.py +++ b/Lib/distutils/tests/test_upload.py @@ -130,13 +130,14 @@ # what did we send ? headers = dict(self.last_open.req.headers) - self.assertEqual(headers['Content-length'], '2161') + self.assertEqual(headers['Content-length'], '2162') content_type = headers['Content-type'] self.assertTrue(content_type.startswith('multipart/form-data')) self.assertEqual(self.last_open.req.get_method(), 'POST') expected_url = 'https://pypi.python.org/pypi' self.assertEqual(self.last_open.req.get_full_url(), expected_url) self.assertTrue(b'xxx' in self.last_open.req.data) + self.assertIn(b'protocol_version', self.last_open.req.data) # The PyPI response body was echoed results = self.get_logs(INFO) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 18 14:42:32 2016 From: python-checkins at python.org (berker.peksag) Date: Sat, 18 Jun 2016 18:42:32 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327349=3A_Merge_from_3=2E5?= Message-ID: <20160618184231.27783.63998.7000CD1C@psf.io> https://hg.python.org/cpython/rev/a4d00ae53e35 changeset: 102094:a4d00ae53e35 parent: 102092:0b1cd695e7aa parent: 102093:81a9ce02b49b user: Berker Peksag date: Sat Jun 18 21:43:16 2016 +0300 summary: Issue #27349: Merge from 3.5 files: Lib/distutils/command/upload.py | 2 +- Lib/distutils/tests/test_upload.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/distutils/command/upload.py b/Lib/distutils/command/upload.py --- a/Lib/distutils/command/upload.py +++ b/Lib/distutils/command/upload.py @@ -91,7 +91,7 @@ data = { # action ':action': 'file_upload', - 'protcol_version': '1', + 'protocol_version': '1', # identify release 'name': meta.get_name(), diff --git a/Lib/distutils/tests/test_upload.py b/Lib/distutils/tests/test_upload.py --- a/Lib/distutils/tests/test_upload.py +++ b/Lib/distutils/tests/test_upload.py @@ -130,13 +130,14 @@ # what did we send ? headers = dict(self.last_open.req.headers) - self.assertEqual(headers['Content-length'], '2161') + self.assertEqual(headers['Content-length'], '2162') content_type = headers['Content-type'] self.assertTrue(content_type.startswith('multipart/form-data')) self.assertEqual(self.last_open.req.get_method(), 'POST') expected_url = 'https://pypi.python.org/pypi' self.assertEqual(self.last_open.req.get_full_url(), expected_url) self.assertTrue(b'xxx' in self.last_open.req.data) + self.assertIn(b'protocol_version', self.last_open.req.data) # The PyPI response body was echoed results = self.get_logs(INFO) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 18 14:55:44 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 18 Jun 2016 18:55:44 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327294=3A_Numerica?= =?utf-8?q?l_state_in_the_repr_for_Tkinter_event_objects_is_now?= Message-ID: <20160618185544.20416.80935.9BD480F9@psf.io> https://hg.python.org/cpython/rev/e0ec4abe659f changeset: 102095:e0ec4abe659f user: Serhiy Storchaka date: Sat Jun 18 21:55:26 2016 +0300 summary: Issue #27294: Numerical state in the repr for Tkinter event objects is now represented as a compination of known flags. files: Lib/tkinter/__init__.py | 29 +++++++++++++++++++++-------- Misc/NEWS | 3 +++ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -220,28 +220,41 @@ delta - delta of wheel movement (MouseWheel) """ def __repr__(self): - state = {k: v for k, v in self.__dict__.items() if v != '??'} + attrs = {k: v for k, v in self.__dict__.items() if v != '??'} if not self.char: - del state['char'] + del attrs['char'] elif self.char != '??': - state['char'] = repr(self.char) + attrs['char'] = repr(self.char) if not getattr(self, 'send_event', True): - del state['send_event'] + del attrs['send_event'] if self.state == 0: - del state['state'] + del attrs['state'] + elif isinstance(self.state, int): + state = self.state + mods = ('Shift', 'Lock', 'Control', + 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', + 'Button1', 'Button2', 'Button3', 'Button4', 'Button5') + s = [] + for i, n in enumerate(mods): + if state & (1 << i): + s.append(n) + state = state & ~((1<< len(mods)) - 1) + if state or not s: + s.append(hex(state)) + attrs['state'] = '|'.join(s) if self.delta == 0: - del state['delta'] + del attrs['delta'] # widget usually is known # serial and time are not very interesing # keysym_num duplicates keysym # x_root and y_root mostly duplicate x and y keys = ('send_event', - 'state', 'keycode', 'char', 'keysym', + 'state', 'keysym', 'keycode', 'char', 'num', 'delta', 'focus', 'x', 'y', 'width', 'height') return '<%s event%s>' % ( self.type, - ''.join(' %s=%s' % (k, state[k]) for k in keys if k in state) + ''.join(' %s=%s' % (k, attrs[k]) for k in keys if k in attrs) ) _support_default_root = 1 diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Library ------- +- Issue #27294: Numerical state in the repr for Tkinter event objects is now + represented as a compination of known flags. + - Issue #27177: Match objects in the re module now support index-like objects as group indices. Based on patches by Jeroen Demeyer and Xiang Zhang. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 18 15:09:59 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 18 Jun 2016 19:09:59 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3Mjk0?= =?utf-8?q?=3A_Numerical_state_in_the_repr_for_Tkinter_event_objects_is_no?= =?utf-8?q?w?= Message-ID: <20160618190959.10025.56296.93E8966F@psf.io> https://hg.python.org/cpython/rev/d7b6c07bc713 changeset: 102096:d7b6c07bc713 branch: 3.5 parent: 102093:81a9ce02b49b user: Serhiy Storchaka date: Sat Jun 18 22:08:11 2016 +0300 summary: Issue #27294: Numerical state in the repr for Tkinter event objects is now represented as a compination of known flags. files: Doc/library/curses.ascii.rst | 4 +- Lib/curses/ascii.py | 6 +- Lib/test/test_curses.py | 54 ++++++++++++++++++++++++ Misc/NEWS | 2 + 4 files changed, 61 insertions(+), 5 deletions(-) diff --git a/Doc/library/curses.ascii.rst b/Doc/library/curses.ascii.rst --- a/Doc/library/curses.ascii.rst +++ b/Doc/library/curses.ascii.rst @@ -115,12 +115,12 @@ .. function:: isblank(c) - Checks for an ASCII whitespace character. + Checks for an ASCII whitespace character; space or horizontal tab. .. function:: iscntrl(c) - Checks for an ASCII control character (in the range 0x00 to 0x1f). + Checks for an ASCII control character (in the range 0x00 to 0x1f or 0x7f). .. function:: isdigit(c) diff --git a/Lib/curses/ascii.py b/Lib/curses/ascii.py --- a/Lib/curses/ascii.py +++ b/Lib/curses/ascii.py @@ -54,13 +54,13 @@ def isalnum(c): return isalpha(c) or isdigit(c) def isalpha(c): return isupper(c) or islower(c) def isascii(c): return _ctoi(c) <= 127 # ? -def isblank(c): return _ctoi(c) in (8,32) -def iscntrl(c): return _ctoi(c) <= 31 +def isblank(c): return _ctoi(c) in (9, 32) +def iscntrl(c): return _ctoi(c) <= 31 or _ctoi(c) == 127 def isdigit(c): return _ctoi(c) >= 48 and _ctoi(c) <= 57 def isgraph(c): return _ctoi(c) >= 33 and _ctoi(c) <= 126 def islower(c): return _ctoi(c) >= 97 and _ctoi(c) <= 122 def isprint(c): return _ctoi(c) >= 32 and _ctoi(c) <= 126 -def ispunct(c): return _ctoi(c) != 32 and not isalnum(c) +def ispunct(c): return isgraph(c) and not isalnum(c) def isspace(c): return _ctoi(c) in (9, 10, 11, 12, 13, 32) def isupper(c): return _ctoi(c) >= 65 and _ctoi(c) <= 90 def isxdigit(c): return isdigit(c) or \ diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -10,6 +10,7 @@ # import os +import string import sys import tempfile import unittest @@ -399,6 +400,55 @@ class TestAscii(unittest.TestCase): + def test_controlnames(self): + for name in curses.ascii.controlnames: + self.assertTrue(hasattr(curses.ascii, name), name) + + def test_ctypes(self): + def check(func, expected): + with self.subTest(ch=c, func=func): + self.assertEqual(func(i), expected) + self.assertEqual(func(c), expected) + + for i in range(256): + c = chr(i) + b = bytes([i]) + check(curses.ascii.isalnum, b.isalnum()) + check(curses.ascii.isalpha, b.isalpha()) + check(curses.ascii.isdigit, b.isdigit()) + check(curses.ascii.islower, b.islower()) + check(curses.ascii.isspace, b.isspace()) + check(curses.ascii.isupper, b.isupper()) + + check(curses.ascii.isascii, i < 128) + check(curses.ascii.ismeta, i >= 128) + check(curses.ascii.isctrl, i < 32) + check(curses.ascii.iscntrl, i < 32 or i == 127) + check(curses.ascii.isblank, c in ' \t') + check(curses.ascii.isgraph, 32 < i <= 126) + check(curses.ascii.isprint, 32 <= i <= 126) + check(curses.ascii.ispunct, c in string.punctuation) + check(curses.ascii.isxdigit, c in string.hexdigits) + + def test_ascii(self): + ascii = curses.ascii.ascii + self.assertEqual(ascii('\xc1'), 'A') + self.assertEqual(ascii('A'), 'A') + self.assertEqual(ascii(ord('\xc1')), ord('A')) + + def test_ctrl(self): + ctrl = curses.ascii.ctrl + self.assertEqual(ctrl('J'), '\n') + self.assertEqual(ctrl('\n'), '\n') + self.assertEqual(ctrl('@'), '\0') + self.assertEqual(ctrl(ord('J')), ord('\n')) + + def test_alt(self): + alt = curses.ascii.alt + self.assertEqual(alt('\n'), '\x8a') + self.assertEqual(alt('A'), '\xc1') + self.assertEqual(alt(ord('A')), 0xc1) + def test_unctrl(self): unctrl = curses.ascii.unctrl self.assertEqual(unctrl('a'), 'a') @@ -408,9 +458,13 @@ self.assertEqual(unctrl('\x7f'), '^?') self.assertEqual(unctrl('\n'), '^J') self.assertEqual(unctrl('\0'), '^@') + self.assertEqual(unctrl(ord('A')), 'A') + self.assertEqual(unctrl(ord('\n')), '^J') # Meta-bit characters self.assertEqual(unctrl('\x8a'), '!^J') self.assertEqual(unctrl('\xc1'), '!A') + self.assertEqual(unctrl(ord('\x8a')), '!^J') + self.assertEqual(unctrl(ord('\xc1')), '!A') if __name__ == '__main__': diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,8 @@ Library ------- +- Issue #27079: Fixed curses.ascii functions isblank(), iscntrl() and ispunct(). + - Issue #26754: Some functions (compile() etc) accepted a filename argument encoded as an iterable of integers. Now only strings and byte-like objects are accepted. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 18 15:09:59 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 18 Jun 2016 19:09:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327294=3A_Numerical_state_in_the_repr_for_Tkinte?= =?utf-8?q?r_event_objects_is_now?= Message-ID: <20160618190959.11551.35441.934E5DCE@psf.io> https://hg.python.org/cpython/rev/d03c8d0a6a73 changeset: 102098:d03c8d0a6a73 parent: 102095:e0ec4abe659f parent: 102096:d7b6c07bc713 user: Serhiy Storchaka date: Sat Jun 18 22:09:30 2016 +0300 summary: Issue #27294: Numerical state in the repr for Tkinter event objects is now represented as a compination of known flags. files: Doc/library/curses.ascii.rst | 4 +- Lib/curses/ascii.py | 6 +- Lib/test/test_curses.py | 54 ++++++++++++++++++++++++ Misc/NEWS | 2 + 4 files changed, 61 insertions(+), 5 deletions(-) diff --git a/Doc/library/curses.ascii.rst b/Doc/library/curses.ascii.rst --- a/Doc/library/curses.ascii.rst +++ b/Doc/library/curses.ascii.rst @@ -115,12 +115,12 @@ .. function:: isblank(c) - Checks for an ASCII whitespace character. + Checks for an ASCII whitespace character; space or horizontal tab. .. function:: iscntrl(c) - Checks for an ASCII control character (in the range 0x00 to 0x1f). + Checks for an ASCII control character (in the range 0x00 to 0x1f or 0x7f). .. function:: isdigit(c) diff --git a/Lib/curses/ascii.py b/Lib/curses/ascii.py --- a/Lib/curses/ascii.py +++ b/Lib/curses/ascii.py @@ -54,13 +54,13 @@ def isalnum(c): return isalpha(c) or isdigit(c) def isalpha(c): return isupper(c) or islower(c) def isascii(c): return _ctoi(c) <= 127 # ? -def isblank(c): return _ctoi(c) in (8,32) -def iscntrl(c): return _ctoi(c) <= 31 +def isblank(c): return _ctoi(c) in (9, 32) +def iscntrl(c): return _ctoi(c) <= 31 or _ctoi(c) == 127 def isdigit(c): return _ctoi(c) >= 48 and _ctoi(c) <= 57 def isgraph(c): return _ctoi(c) >= 33 and _ctoi(c) <= 126 def islower(c): return _ctoi(c) >= 97 and _ctoi(c) <= 122 def isprint(c): return _ctoi(c) >= 32 and _ctoi(c) <= 126 -def ispunct(c): return _ctoi(c) != 32 and not isalnum(c) +def ispunct(c): return isgraph(c) and not isalnum(c) def isspace(c): return _ctoi(c) in (9, 10, 11, 12, 13, 32) def isupper(c): return _ctoi(c) >= 65 and _ctoi(c) <= 90 def isxdigit(c): return isdigit(c) or \ diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -10,6 +10,7 @@ # import os +import string import sys import tempfile import unittest @@ -399,6 +400,55 @@ class TestAscii(unittest.TestCase): + def test_controlnames(self): + for name in curses.ascii.controlnames: + self.assertTrue(hasattr(curses.ascii, name), name) + + def test_ctypes(self): + def check(func, expected): + with self.subTest(ch=c, func=func): + self.assertEqual(func(i), expected) + self.assertEqual(func(c), expected) + + for i in range(256): + c = chr(i) + b = bytes([i]) + check(curses.ascii.isalnum, b.isalnum()) + check(curses.ascii.isalpha, b.isalpha()) + check(curses.ascii.isdigit, b.isdigit()) + check(curses.ascii.islower, b.islower()) + check(curses.ascii.isspace, b.isspace()) + check(curses.ascii.isupper, b.isupper()) + + check(curses.ascii.isascii, i < 128) + check(curses.ascii.ismeta, i >= 128) + check(curses.ascii.isctrl, i < 32) + check(curses.ascii.iscntrl, i < 32 or i == 127) + check(curses.ascii.isblank, c in ' \t') + check(curses.ascii.isgraph, 32 < i <= 126) + check(curses.ascii.isprint, 32 <= i <= 126) + check(curses.ascii.ispunct, c in string.punctuation) + check(curses.ascii.isxdigit, c in string.hexdigits) + + def test_ascii(self): + ascii = curses.ascii.ascii + self.assertEqual(ascii('\xc1'), 'A') + self.assertEqual(ascii('A'), 'A') + self.assertEqual(ascii(ord('\xc1')), ord('A')) + + def test_ctrl(self): + ctrl = curses.ascii.ctrl + self.assertEqual(ctrl('J'), '\n') + self.assertEqual(ctrl('\n'), '\n') + self.assertEqual(ctrl('@'), '\0') + self.assertEqual(ctrl(ord('J')), ord('\n')) + + def test_alt(self): + alt = curses.ascii.alt + self.assertEqual(alt('\n'), '\x8a') + self.assertEqual(alt('A'), '\xc1') + self.assertEqual(alt(ord('A')), 0xc1) + def test_unctrl(self): unctrl = curses.ascii.unctrl self.assertEqual(unctrl('a'), 'a') @@ -408,9 +458,13 @@ self.assertEqual(unctrl('\x7f'), '^?') self.assertEqual(unctrl('\n'), '^J') self.assertEqual(unctrl('\0'), '^@') + self.assertEqual(unctrl(ord('A')), 'A') + self.assertEqual(unctrl(ord('\n')), '^J') # Meta-bit characters self.assertEqual(unctrl('\x8a'), '!^J') self.assertEqual(unctrl('\xc1'), '!A') + self.assertEqual(unctrl(ord('\x8a')), '!^J') + self.assertEqual(unctrl(ord('\xc1')), '!A') if __name__ == '__main__': diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Library ------- +- Issue #27079: Fixed curses.ascii functions isblank(), iscntrl() and ispunct(). + - Issue #27294: Numerical state in the repr for Tkinter event objects is now represented as a compination of known flags. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 18 15:09:59 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 18 Jun 2016 19:09:59 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI3Mjk0?= =?utf-8?q?=3A_Numerical_state_in_the_repr_for_Tkinter_event_objects_is_no?= =?utf-8?q?w?= Message-ID: <20160618190959.78349.76640.B4818D74@psf.io> https://hg.python.org/cpython/rev/ac8338546ca8 changeset: 102097:ac8338546ca8 branch: 2.7 parent: 102083:1ed4e4a168bb user: Serhiy Storchaka date: Sat Jun 18 22:08:49 2016 +0300 summary: Issue #27294: Numerical state in the repr for Tkinter event objects is now represented as a compination of known flags. files: Doc/library/curses.ascii.rst | 4 +- Lib/curses/ascii.py | 6 +- Lib/test/test_curses.py | 52 ++++++++++++++++++++++++ Misc/NEWS | 2 + 4 files changed, 59 insertions(+), 5 deletions(-) diff --git a/Doc/library/curses.ascii.rst b/Doc/library/curses.ascii.rst --- a/Doc/library/curses.ascii.rst +++ b/Doc/library/curses.ascii.rst @@ -116,12 +116,12 @@ .. function:: isblank(c) - Checks for an ASCII whitespace character. + Checks for an ASCII whitespace character; space or horizontal tab. .. function:: iscntrl(c) - Checks for an ASCII control character (in the range 0x00 to 0x1f). + Checks for an ASCII control character (in the range 0x00 to 0x1f or 0x7f). .. function:: isdigit(c) diff --git a/Lib/curses/ascii.py b/Lib/curses/ascii.py --- a/Lib/curses/ascii.py +++ b/Lib/curses/ascii.py @@ -54,13 +54,13 @@ def isalnum(c): return isalpha(c) or isdigit(c) def isalpha(c): return isupper(c) or islower(c) def isascii(c): return _ctoi(c) <= 127 # ? -def isblank(c): return _ctoi(c) in (8,32) -def iscntrl(c): return _ctoi(c) <= 31 +def isblank(c): return _ctoi(c) in (9, 32) +def iscntrl(c): return _ctoi(c) <= 31 or _ctoi(c) == 127 def isdigit(c): return _ctoi(c) >= 48 and _ctoi(c) <= 57 def isgraph(c): return _ctoi(c) >= 33 and _ctoi(c) <= 126 def islower(c): return _ctoi(c) >= 97 and _ctoi(c) <= 122 def isprint(c): return _ctoi(c) >= 32 and _ctoi(c) <= 126 -def ispunct(c): return _ctoi(c) != 32 and not isalnum(c) +def ispunct(c): return isgraph(c) and not isalnum(c) def isspace(c): return _ctoi(c) in (9, 10, 11, 12, 13, 32) def isupper(c): return _ctoi(c) >= 65 and _ctoi(c) <= 90 def isxdigit(c): return isdigit(c) or \ diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -10,6 +10,7 @@ # import os +import string import sys import tempfile import unittest @@ -324,6 +325,53 @@ class TestAscii(unittest.TestCase): + def test_controlnames(self): + for name in curses.ascii.controlnames: + self.assertTrue(hasattr(curses.ascii, name), name) + + def test_ctypes(self): + def check(func, expected): + self.assertEqual(func(i), expected) + self.assertEqual(func(c), expected) + + for i in range(256): + c = b = chr(i) + check(curses.ascii.isalnum, b.isalnum()) + check(curses.ascii.isalpha, b.isalpha()) + check(curses.ascii.isdigit, b.isdigit()) + check(curses.ascii.islower, b.islower()) + check(curses.ascii.isspace, b.isspace()) + check(curses.ascii.isupper, b.isupper()) + + check(curses.ascii.isascii, i < 128) + check(curses.ascii.ismeta, i >= 128) + check(curses.ascii.isctrl, i < 32) + check(curses.ascii.iscntrl, i < 32 or i == 127) + check(curses.ascii.isblank, c in ' \t') + check(curses.ascii.isgraph, 32 < i <= 126) + check(curses.ascii.isprint, 32 <= i <= 126) + check(curses.ascii.ispunct, c in string.punctuation) + check(curses.ascii.isxdigit, c in string.hexdigits) + + def test_ascii(self): + ascii = curses.ascii.ascii + self.assertEqual(ascii('\xc1'), 'A') + self.assertEqual(ascii('A'), 'A') + self.assertEqual(ascii(ord('\xc1')), ord('A')) + + def test_ctrl(self): + ctrl = curses.ascii.ctrl + self.assertEqual(ctrl('J'), '\n') + self.assertEqual(ctrl('\n'), '\n') + self.assertEqual(ctrl('@'), '\0') + self.assertEqual(ctrl(ord('J')), ord('\n')) + + def test_alt(self): + alt = curses.ascii.alt + self.assertEqual(alt('\n'), '\x8a') + self.assertEqual(alt('A'), '\xc1') + self.assertEqual(alt(ord('A')), 0xc1) + def test_unctrl(self): unctrl = curses.ascii.unctrl self.assertEqual(unctrl('a'), 'a') @@ -333,9 +381,13 @@ self.assertEqual(unctrl('\x7f'), '^?') self.assertEqual(unctrl('\n'), '^J') self.assertEqual(unctrl('\0'), '^@') + self.assertEqual(unctrl(ord('A')), 'A') + self.assertEqual(unctrl(ord('\n')), '^J') # Meta-bit characters self.assertEqual(unctrl('\x8a'), '!^J') self.assertEqual(unctrl('\xc1'), '!A') + self.assertEqual(unctrl(ord('\x8a')), '!^J') + self.assertEqual(unctrl(ord('\xc1')), '!A') def test_main(): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,8 @@ Library ------- +- Issue #27079: Fixed curses.ascii functions isblank(), iscntrl() and ispunct(). + - Issue #22636: Avoid shell injection problems with ctypes.util.find_library(). -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 18 15:59:20 2016 From: python-checkins at python.org (ned.deily) Date: Sat, 18 Jun 2016 19:59:20 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2323968=3A_Fix_inst?= =?utf-8?q?alls_of_the_renamed_config_directory_for_OS_X?= Message-ID: <20160618195919.119604.8577.DD308332@psf.io> https://hg.python.org/cpython/rev/e2b09c00ee24 changeset: 102099:e2b09c00ee24 user: Ned Deily date: Sat Jun 18 15:58:52 2016 -0400 summary: Issue #23968: Fix installs of the renamed config directory for OS X framework builds. files: Makefile.pre.in | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1507,10 +1507,10 @@ # Install a number of symlinks to keep software that expects a normal unix # install (which includes python-config) happy. frameworkinstallmaclib: - $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config-$(LDVERSION)/libpython$(LDVERSION).a" - $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config-$(LDVERSION)/libpython$(LDVERSION).dylib" - $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config-$(LDVERSION)/libpython$(VERSION).a" - $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config-$(LDVERSION)/libpython$(VERSION).dylib" + $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(LDVERSION).a" + $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(LDVERSION).dylib" + $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(VERSION).a" + $(LN) -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(LIBPL)/libpython$(VERSION).dylib" $(LN) -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(LDVERSION).dylib" $(LN) -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(VERSION).dylib" -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Sun Jun 19 05:46:04 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 19 Jun 2016 09:46:04 +0000 Subject: [Python-checkins] Daily reference leaks (e2b09c00ee24): sum=4 Message-ID: <20160619094604.25199.51072.0B44825C@psf.io> results for e2b09c00ee24 on branch "default" -------------------------------------------- test_collections leaked [0, 4, -4] memory blocks, sum=0 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_fork leaked [2, 0, -1] memory blocks, sum=1 test_multiprocessing_spawn leaked [1, 0, -2] memory blocks, sum=-1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflog3cO_62', '--timeout', '7200'] From python-checkins at python.org Sun Jun 19 11:32:27 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 19 Jun 2016 15:32:27 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogSXNzdWUgIzIzNjQxOiBBZGRlZCBfX2dldG5ld2FyZ3NfZXhfXyB0byB0?= =?utf-8?q?he_list_of_special_mock_attributes=2E?= Message-ID: <20160619153227.11507.8053.FB76EC81@psf.io> https://hg.python.org/cpython/rev/4c5f7b61b6c5 changeset: 102102:4c5f7b61b6c5 parent: 102100:d736c9490333 parent: 102101:75cec736f87d user: Serhiy Storchaka date: Sun Jun 19 18:32:07 2016 +0300 summary: Issue #23641: Added __getnewargs_ex__ to the list of special mock attributes. files: Lib/unittest/mock.py | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -1717,6 +1717,7 @@ '__reduce__', '__reduce_ex__', '__getinitargs__', '__getnewargs__', '__getstate__', '__setstate__', '__getformat__', '__setformat__', '__repr__', '__dir__', '__subclasses__', '__format__', + '__getnewargs_ex__', } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 19 11:32:27 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 19 Jun 2016 15:32:27 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIzNjQx?= =?utf-8?q?=3A_Added_=5F=5Fgetnewargs=5Fex=5F=5F_to_the_list_of_special_mo?= =?utf-8?q?ck_attributes=2E?= Message-ID: <20160619153226.19998.3942.15613403@psf.io> https://hg.python.org/cpython/rev/75cec736f87d changeset: 102101:75cec736f87d branch: 3.5 parent: 102096:d7b6c07bc713 user: Serhiy Storchaka date: Sun Jun 19 18:30:43 2016 +0300 summary: Issue #23641: Added __getnewargs_ex__ to the list of special mock attributes. files: Lib/unittest/mock.py | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -1694,6 +1694,7 @@ '__reduce__', '__reduce_ex__', '__getinitargs__', '__getnewargs__', '__getstate__', '__setstate__', '__getformat__', '__setformat__', '__repr__', '__dir__', '__subclasses__', '__format__', + '__getnewargs_ex__', } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 19 11:32:27 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 19 Jun 2016 15:32:27 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Use_macros_instead_of_corr?= =?utf-8?q?esponding_functions_=28they_never_fail=29_in_=5Ftkinter=2Ec=2E?= Message-ID: <20160619153226.19386.84829.DAD5A080@psf.io> https://hg.python.org/cpython/rev/d736c9490333 changeset: 102100:d736c9490333 user: Serhiy Storchaka date: Sun Jun 19 11:22:47 2016 +0300 summary: Use macros instead of corresponding functions (they never fail) in _tkinter.c. files: Modules/_tkinter.c | 48 ++++++++++++++++++--------------- 1 files changed, 26 insertions(+), 22 deletions(-) diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -462,7 +462,7 @@ v = NULL; break; } - PyTuple_SetItem(v, i, w); + PyTuple_SET_ITEM(v, i, w); } } Tcl_Free(FREECAST argv); @@ -480,13 +480,13 @@ Py_ssize_t i, size; PyObject *elem, *newelem, *result; - size = PyTuple_Size(arg); + size = PyTuple_GET_SIZE(arg); result = NULL; /* Recursively invoke SplitObj for all tuple items. If this does not return a new object, no action is needed. */ for(i = 0; i < size; i++) { - elem = PyTuple_GetItem(arg, i); + elem = PyTuple_GET_ITEM(arg, i); newelem = SplitObj(elem); if (!newelem) { Py_XDECREF(result); @@ -502,12 +502,12 @@ if (!result) return NULL; for(k = 0; k < i; k++) { - elem = PyTuple_GetItem(arg, k); + elem = PyTuple_GET_ITEM(arg, k); Py_INCREF(elem); - PyTuple_SetItem(result, k, elem); + PyTuple_SET_ITEM(result, k, elem); } } - PyTuple_SetItem(result, i, newelem); + PyTuple_SET_ITEM(result, i, newelem); } if (result) return result; @@ -529,7 +529,7 @@ Py_XDECREF(result); return NULL; } - PyTuple_SetItem(result, i, newelem); + PyTuple_SET_ITEM(result, i, newelem); } return result; } @@ -551,7 +551,7 @@ else if (PyBytes_Check(arg)) { int argc; const char **argv; - char *list = PyBytes_AsString(arg); + char *list = PyBytes_AS_STRING(arg); if (Tcl_SplitList((Tcl_Interp *)NULL, list, &argc, &argv) != TCL_OK) { Py_INCREF(arg); @@ -559,7 +559,7 @@ } Tcl_Free(FREECAST argv); if (argc > 1) - return Split(PyBytes_AsString(arg)); + return Split(PyBytes_AS_STRING(arg)); /* Fall through, returning arg. */ } Py_INCREF(arg); @@ -758,7 +758,7 @@ } Tcl_SetVar(v->interp, "tcl_library", - PyBytes_AsString(utf8_path), + PyBytes_AS_STRING(utf8_path), TCL_GLOBAL_ONLY); Py_DECREF(utf8_path); } @@ -1306,7 +1306,7 @@ Py_DECREF(result); return NULL; } - PyTuple_SetItem(result, i, elem); + PyTuple_SET_ITEM(result, i, elem); } return result; } @@ -1517,8 +1517,8 @@ int flags = TCL_EVAL_DIRECT | TCL_EVAL_GLOBAL; /* If args is a single tuple, replace with contents of tuple */ - if (1 == PyTuple_Size(args)){ - PyObject* item = PyTuple_GetItem(args, 0); + if (PyTuple_GET_SIZE(args) == 1) { + PyObject *item = PyTuple_GET_ITEM(args, 0); if (PyTuple_Check(item)) args = item; } @@ -1728,12 +1728,12 @@ char *s; const char **out = (const char**)_out; if (PyBytes_Check(in)) { - if (PyBytes_Size(in) > INT_MAX) { + if (PyBytes_GET_SIZE(in) > INT_MAX) { PyErr_SetString(PyExc_OverflowError, "bytes object is too long"); return 0; } - s = PyBytes_AsString(in); - if (strlen(s) != (size_t)PyBytes_Size(in)) { + s = PyBytes_AS_STRING(in); + if (strlen(s) != (size_t)PyBytes_GET_SIZE(in)) { PyErr_SetString(PyExc_ValueError, "embedded null byte"); return 0; } @@ -2274,10 +2274,11 @@ return NULL; for (i = 0; i < objc; i++) { PyObject *s = FromObj((PyObject*)self, objv[i]); - if (!s || PyTuple_SetItem(v, i, s)) { + if (!s) { Py_DECREF(v); return NULL; } + PyTuple_SET_ITEM(v, i, s); } return v; } @@ -2304,11 +2305,12 @@ for (i = 0; i < argc; i++) { PyObject *s = unicodeFromTclString(argv[i]); - if (!s || PyTuple_SetItem(v, i, s)) { + if (!s) { Py_DECREF(v); v = NULL; goto finally; } + PyTuple_SET_ITEM(v, i, s); } finally: @@ -2349,10 +2351,11 @@ return NULL; for (i = 0; i < objc; i++) { PyObject *s = FromObj((PyObject*)self, objv[i]); - if (!s || PyTuple_SetItem(v, i, s)) { + if (!s) { Py_DECREF(v); return NULL; } + PyTuple_SET_ITEM(v, i, s); } return v; } @@ -2410,10 +2413,11 @@ for (i = 0; i < (argc - 1); i++) { PyObject *s = unicodeFromTclString(argv[i + 1]); - if (!s || PyTuple_SetItem(arg, i, s)) { + if (!s) { Py_DECREF(arg); return PythonCmd_Error(interp); } + PyTuple_SET_ITEM(arg, i, s); } res = PyEval_CallObject(func, arg); Py_DECREF(arg); @@ -3622,14 +3626,14 @@ } } - Tcl_FindExecutable(PyBytes_AsString(cexe)); + Tcl_FindExecutable(PyBytes_AS_STRING(cexe)); if (set_var) { SetEnvironmentVariableW(L"TCL_LIBRARY", NULL); PyMem_Free(wcs_path); } #else - Tcl_FindExecutable(PyBytes_AsString(cexe)); + Tcl_FindExecutable(PyBytes_AS_STRING(cexe)); #endif /* MS_WINDOWS */ } Py_XDECREF(cexe); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 19 17:06:00 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 19 Jun 2016 21:06:00 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327319=3A_Methods_?= =?utf-8?b?c2VsZWN0aW9uX3NldCgpLCBzZWxlY3Rpb25fYWRkKCksIHNlbGVjdGlvbl9y?= =?utf-8?q?emove=28=29?= Message-ID: <20160619210559.20108.11604.7CBFF38A@psf.io> https://hg.python.org/cpython/rev/7b9ad68db14e changeset: 102103:7b9ad68db14e user: Serhiy Storchaka date: Mon Jun 20 00:05:40 2016 +0300 summary: Issue #27319: Methods selection_set(), selection_add(), selection_remove() and selection_toggle() of ttk.TreeView now allow to pass multiple items as multiple arguments instead of passing them as a tuple. Deprecated undocumented ability of calling the selection() method with arguments. files: Lib/tkinter/test/test_ttk/test_widgets.py | 49 ++++++++- Lib/tkinter/ttk.py | 56 +++++++--- Misc/NEWS | 5 + 3 files changed, 90 insertions(+), 20 deletions(-) diff --git a/Lib/tkinter/test/test_ttk/test_widgets.py b/Lib/tkinter/test/test_ttk/test_widgets.py --- a/Lib/tkinter/test/test_ttk/test_widgets.py +++ b/Lib/tkinter/test/test_ttk/test_widgets.py @@ -1487,6 +1487,7 @@ def test_selection(self): + self.assertRaises(TypeError, self.tv.selection, 'spam') # item 'none' doesn't exist self.assertRaises(tkinter.TclError, self.tv.selection_set, 'none') self.assertRaises(tkinter.TclError, self.tv.selection_add, 'none') @@ -1500,25 +1501,31 @@ c3 = self.tv.insert(item1, 'end') self.assertEqual(self.tv.selection(), ()) - self.tv.selection_set((c1, item2)) + self.tv.selection_set(c1, item2) self.assertEqual(self.tv.selection(), (c1, item2)) self.tv.selection_set(c2) self.assertEqual(self.tv.selection(), (c2,)) - self.tv.selection_add((c1, item2)) + self.tv.selection_add(c1, item2) self.assertEqual(self.tv.selection(), (c1, c2, item2)) self.tv.selection_add(item1) self.assertEqual(self.tv.selection(), (item1, c1, c2, item2)) + self.tv.selection_add() + self.assertEqual(self.tv.selection(), (item1, c1, c2, item2)) - self.tv.selection_remove((item1, c3)) + self.tv.selection_remove(item1, c3) self.assertEqual(self.tv.selection(), (c1, c2, item2)) self.tv.selection_remove(c2) self.assertEqual(self.tv.selection(), (c1, item2)) + self.tv.selection_remove() + self.assertEqual(self.tv.selection(), (c1, item2)) - self.tv.selection_toggle((c1, c3)) + self.tv.selection_toggle(c1, c3) self.assertEqual(self.tv.selection(), (c3, item2)) self.tv.selection_toggle(item2) self.assertEqual(self.tv.selection(), (c3,)) + self.tv.selection_toggle() + self.assertEqual(self.tv.selection(), (c3,)) self.tv.insert('', 'end', id='with spaces') self.tv.selection_set('with spaces') @@ -1536,6 +1543,40 @@ self.tv.selection_set(b'bytes\xe2\x82\xac') self.assertEqual(self.tv.selection(), ('bytes\xe2\x82\xac',)) + self.tv.selection_set() + self.assertEqual(self.tv.selection(), ()) + + # Old interface + self.tv.selection_set((c1, item2)) + self.assertEqual(self.tv.selection(), (c1, item2)) + self.tv.selection_add((c1, item1)) + self.assertEqual(self.tv.selection(), (item1, c1, item2)) + self.tv.selection_remove((item1, c3)) + self.assertEqual(self.tv.selection(), (c1, item2)) + self.tv.selection_toggle((c1, c3)) + self.assertEqual(self.tv.selection(), (c3, item2)) + + if sys.version_info >= (3, 7): + import warnings + warnings.warn( + 'Deprecated API of Treeview.selection() should be removed') + self.tv.selection_set() + self.assertEqual(self.tv.selection(), ()) + with self.assertWarns(DeprecationWarning): + self.tv.selection('set', (c1, item2)) + self.assertEqual(self.tv.selection(), (c1, item2)) + with self.assertWarns(DeprecationWarning): + self.tv.selection('add', (c1, item1)) + self.assertEqual(self.tv.selection(), (item1, c1, item2)) + with self.assertWarns(DeprecationWarning): + self.tv.selection('remove', (item1, c3)) + self.assertEqual(self.tv.selection(), (c1, item2)) + with self.assertWarns(DeprecationWarning): + self.tv.selection('toggle', (c1, c3)) + self.assertEqual(self.tv.selection(), (c3, item2)) + with self.assertWarns(DeprecationWarning): + selection = self.tv.selection(None) + self.assertEqual(selection, (c3, item2)) def test_set(self): self.tv['columns'] = ['A', 'B'] diff --git a/Lib/tkinter/ttk.py b/Lib/tkinter/ttk.py --- a/Lib/tkinter/ttk.py +++ b/Lib/tkinter/ttk.py @@ -28,6 +28,8 @@ import tkinter from tkinter import _flatten, _join, _stringify, _splitdict +_sentinel = object() + # Verify if Tk is new enough to not need the Tile package _REQUIRE_TILE = True if tkinter.TkVersion < 8.5 else False @@ -1394,31 +1396,53 @@ self.tk.call(self._w, "see", item) - def selection(self, selop=None, items=None): - """If selop is not specified, returns selected items.""" - if isinstance(items, (str, bytes)): - items = (items,) + def selection(self, selop=_sentinel, items=None): + """Returns the tuple of selected items.""" + if selop is _sentinel: + selop = None + elif selop is None: + import warnings + warnings.warn( + "The selop=None argument of selection() is deprecated " + "and will be removed in Python 3.7", + DeprecationWarning, 3) + elif selop in ('set', 'add', 'remove', 'toggle'): + import warnings + warnings.warn( + "The selop argument of selection() is deprecated " + "and will be removed in Python 3.7, " + "use selection_%s() instead" % (selop,), + DeprecationWarning, 3) + else: + raise TypeError('Unsupported operation') return self.tk.splitlist(self.tk.call(self._w, "selection", selop, items)) - def selection_set(self, items): - """items becomes the new selection.""" - self.selection("set", items) + def _selection(self, selop, items): + if len(items) == 1 and isinstance(items[0], (tuple, list)): + items = items[0] + self.tk.call(self._w, "selection", selop, items) - def selection_add(self, items): - """Add items to the selection.""" - self.selection("add", items) + def selection_set(self, *items): + """The specified items becomes the new selection.""" + self._selection("set", items) - def selection_remove(self, items): - """Remove items from the selection.""" - self.selection("remove", items) + def selection_add(self, *items): + """Add all of the specified items to the selection.""" + self._selection("add", items) - def selection_toggle(self, items): - """Toggle the selection state of each item in items.""" - self.selection("toggle", items) + + def selection_remove(self, *items): + """Remove all of the specified items from the selection.""" + self._selection("remove", items) + + + def selection_toggle(self, *items): + """Toggle the selection state of each specified item.""" + self._selection("toggle", items) def set(self, item, column=None, value=None): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,11 @@ Library ------- +- Issue #27319: Methods selection_set(), selection_add(), selection_remove() + and selection_toggle() of ttk.TreeView now allow to pass multiple items as + multiple arguments instead of passing them as a tuple. Deprecated + undocumented ability of calling the selection() method with arguments. + - Issue #27079: Fixed curses.ascii functions isblank(), iscntrl() and ispunct(). - Issue #27294: Numerical state in the repr for Tkinter event objects is now -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 19 22:30:56 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Mon, 20 Jun 2016 02:30:56 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Added_more_tests_for_issue_=2327122=2E?= Message-ID: <20160620023055.30645.24703.1C8EDE1D@psf.io> https://hg.python.org/cpython/rev/ebc82b840163 changeset: 102105:ebc82b840163 parent: 102103:7b9ad68db14e parent: 102104:a14b93a4eb49 user: Serhiy Storchaka date: Mon Jun 20 05:30:31 2016 +0300 summary: Added more tests for issue #27122. files: Lib/test/test_contextlib.py | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py --- a/Lib/test/test_contextlib.py +++ b/Lib/test/test_contextlib.py @@ -796,8 +796,9 @@ self.assertIs(stack._exit_callbacks[-1], cm) def test_dont_reraise_RuntimeError(self): - """https://bugs.python.org/issue27122""" + # https://bugs.python.org/issue27122 class UniqueException(Exception): pass + class UniqueRuntimeError(RuntimeError): pass @contextmanager def second(): @@ -813,15 +814,20 @@ except Exception as exc: raise exc - # The RuntimeError should be caught by second()'s exception + # The UniqueRuntimeError should be caught by second()'s exception # handler which chain raised a new UniqueException. with self.assertRaises(UniqueException) as err_ctx: with ExitStack() as es_ctx: es_ctx.enter_context(second()) es_ctx.enter_context(first()) - raise RuntimeError("please no infinite loop.") + raise UniqueRuntimeError("please no infinite loop.") - self.assertEqual(err_ctx.exception.args[0], "new exception") + exc = err_ctx.exception + self.assertIsInstance(exc, UniqueException) + self.assertIsInstance(exc.__context__, UniqueRuntimeError) + self.assertIsNone(exc.__context__.__context__) + self.assertIsNone(exc.__context__.__cause__) + self.assertIs(exc.__cause__, exc.__context__) class TestRedirectStream: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 19 22:30:56 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Mon, 20 Jun 2016 02:30:56 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Added_more_tes?= =?utf-8?q?ts_for_issue_=2327122=2E?= Message-ID: <20160620023055.5387.17535.F51EB812@psf.io> https://hg.python.org/cpython/rev/a14b93a4eb49 changeset: 102104:a14b93a4eb49 branch: 3.5 parent: 102101:75cec736f87d user: Serhiy Storchaka date: Mon Jun 20 05:29:54 2016 +0300 summary: Added more tests for issue #27122. files: Lib/test/test_contextlib.py | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py --- a/Lib/test/test_contextlib.py +++ b/Lib/test/test_contextlib.py @@ -763,8 +763,9 @@ self.assertIs(stack._exit_callbacks[-1], cm) def test_dont_reraise_RuntimeError(self): - """https://bugs.python.org/issue27122""" + # https://bugs.python.org/issue27122 class UniqueException(Exception): pass + class UniqueRuntimeError(RuntimeError): pass @contextmanager def second(): @@ -780,15 +781,20 @@ except Exception as exc: raise exc - # The RuntimeError should be caught by second()'s exception + # The UniqueRuntimeError should be caught by second()'s exception # handler which chain raised a new UniqueException. with self.assertRaises(UniqueException) as err_ctx: with ExitStack() as es_ctx: es_ctx.enter_context(second()) es_ctx.enter_context(first()) - raise RuntimeError("please no infinite loop.") + raise UniqueRuntimeError("please no infinite loop.") - self.assertEqual(err_ctx.exception.args[0], "new exception") + exc = err_ctx.exception + self.assertIsInstance(exc, UniqueException) + self.assertIsInstance(exc.__context__, UniqueRuntimeError) + self.assertIsNone(exc.__context__.__context__) + self.assertIsNone(exc.__context__.__cause__) + self.assertIs(exc.__cause__, exc.__context__) class TestRedirectStream: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 20 04:33:10 2016 From: python-checkins at python.org (martin.panter) Date: Mon, 20 Jun 2016 08:33:10 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Fix_spelling_e?= =?utf-8?q?rrors_in_code_comments?= Message-ID: <20160620083310.20017.16214.1DCC5227@psf.io> https://hg.python.org/cpython/rev/1cbe4cf863c5 changeset: 102106:1cbe4cf863c5 branch: 3.5 parent: 102104:a14b93a4eb49 user: Martin Panter date: Mon Jun 20 07:52:50 2016 +0000 summary: Fix spelling errors in code comments files: Doc/tools/extensions/suspicious.py | 2 +- Objects/abstract.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/tools/extensions/suspicious.py b/Doc/tools/extensions/suspicious.py --- a/Doc/tools/extensions/suspicious.py +++ b/Doc/tools/extensions/suspicious.py @@ -270,5 +270,5 @@ # ignore comments -- too much false positives. # (although doing this could miss some errors; # there were two sections "commented-out" by mistake - # in the Python docs that would not be catched) + # in the Python docs that would not be caught) raise nodes.SkipNode diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2109,7 +2109,7 @@ "%s returned NULL without setting an error", where); #ifdef Py_DEBUG - /* Ensure that the bug is catched in debug mode */ + /* Ensure that the bug is caught in debug mode */ Py_FatalError("a function returned NULL without setting an error"); #endif return NULL; @@ -2132,7 +2132,7 @@ where); _PyErr_ChainExceptions(exc, val, tb); #ifdef Py_DEBUG - /* Ensure that the bug is catched in debug mode */ + /* Ensure that the bug is caught in debug mode */ Py_FatalError("a function returned a result with an error set"); #endif return NULL; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 20 04:33:11 2016 From: python-checkins at python.org (martin.panter) Date: Mon, 20 Jun 2016 08:33:11 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_spelling_fixes_from_3=2E5?= Message-ID: <20160620083310.5214.3482.197FC5D2@psf.io> https://hg.python.org/cpython/rev/55ecc8fd88ac changeset: 102107:55ecc8fd88ac parent: 102105:ebc82b840163 parent: 102106:1cbe4cf863c5 user: Martin Panter date: Mon Jun 20 07:55:14 2016 +0000 summary: Merge spelling fixes from 3.5 files: Doc/tools/extensions/suspicious.py | 2 +- Objects/abstract.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/tools/extensions/suspicious.py b/Doc/tools/extensions/suspicious.py --- a/Doc/tools/extensions/suspicious.py +++ b/Doc/tools/extensions/suspicious.py @@ -270,5 +270,5 @@ # ignore comments -- too much false positives. # (although doing this could miss some errors; # there were two sections "commented-out" by mistake - # in the Python docs that would not be catched) + # in the Python docs that would not be caught) raise nodes.SkipNode diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2155,7 +2155,7 @@ where); _PyErr_ChainExceptions(exc, val, tb); #ifdef Py_DEBUG - /* Ensure that the bug is catched in debug mode */ + /* Ensure that the bug is caught in debug mode */ Py_FatalError("a function returned a result with an error set"); #endif return NULL; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 20 04:33:32 2016 From: python-checkins at python.org (martin.panter) Date: Mon, 20 Jun 2016 08:33:32 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbjogRml4IOKAnGFsbG93KHMpIHRv?= =?utf-8?b?4oCd?= Message-ID: <20160620083310.2880.88157.D472374E@psf.io> https://hg.python.org/cpython/rev/7dfcc93c5d79 changeset: 102108:7dfcc93c5d79 user: Martin Panter date: Mon Jun 20 08:00:45 2016 +0000 summary: Fix ?allow(s) to? files: Doc/whatsnew/3.6.rst | 2 +- Misc/NEWS | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -113,7 +113,7 @@ PYTHONMALLOC environment variable --------------------------------- -The new :envvar:`PYTHONMALLOC` environment variable allows to set the Python +The new :envvar:`PYTHONMALLOC` environment variable allows setting the Python memory allocators and/or install debug hooks. It is now possible to install debug hooks on Python memory allocators on Python diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -11,7 +11,7 @@ ------- - Issue #27319: Methods selection_set(), selection_add(), selection_remove() - and selection_toggle() of ttk.TreeView now allow to pass multiple items as + and selection_toggle() of ttk.TreeView now allow passing multiple items as multiple arguments instead of passing them as a tuple. Deprecated undocumented ability of calling the selection() method with arguments. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 20 04:33:32 2016 From: python-checkins at python.org (martin.panter) Date: Mon, 20 Jun 2016 08:33:32 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Fix_English_sp?= =?utf-8?q?elling_and_grammar_errors?= Message-ID: <20160620083310.2860.88736.A1E651CD@psf.io> https://hg.python.org/cpython/rev/340a91cccac8 changeset: 102109:340a91cccac8 branch: 2.7 parent: 102097:ac8338546ca8 user: Martin Panter date: Mon Jun 20 07:52:50 2016 +0000 summary: Fix English spelling and grammar errors files: Doc/tools/extensions/suspicious.py | 2 +- Misc/NEWS | 13 ++++++------- Modules/_tkinter.c | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Doc/tools/extensions/suspicious.py b/Doc/tools/extensions/suspicious.py --- a/Doc/tools/extensions/suspicious.py +++ b/Doc/tools/extensions/suspicious.py @@ -270,5 +270,5 @@ # ignore comments -- too much false positives. # (although doing this could miss some errors; # there were two sections "commented-out" by mistake - # in the Python docs that would not be catched) + # in the Python docs that would not be caught) raise nodes.SkipNode diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -4566,7 +4566,7 @@ - Issue #11450: Don't truncate hg version info in Py_GetBuildInfo() when there are many tags (e.g. when using mq). Patch by Nadeem Vawda. -- Issue #10451: memoryview objects could allow to mutate a readable buffer. +- Issue #10451: memoryview objects could allow mutating a readable buffer. Initial patch by Ross Lagerwall. - Issue #10892: Don't segfault when trying to delete __abstractmethods__ from a @@ -4635,7 +4635,7 @@ seeking a bit forward, writing, then seeking before the previous write but still within buffered data, and writing again). -- Issue #8498: In socket.accept(), allow to specify 0 as a backlog value in +- Issue #8498: In socket.accept(), allow specifying 0 as a backlog value in order to accept exactly one connection. Patch by Daniel Evers. - Issue #12012: ssl.PROTOCOL_SSLv2 becomes optional. @@ -6096,8 +6096,8 @@ - Build the ossaudio extension on GNU/kFreeBSD. -- On Windows, ctypes does no longer check the stack before and after calling a - foreign function. This allows to use the unmodified libffi library. +- On Windows, ctypes no longer checks the stack before and after calling a + foreign function. This allows using the unmodified libffi library. Tests ----- @@ -9432,8 +9432,7 @@ - The mimetools module has been deprecated for removal in 3.0. - The ctypes.byref function now takes an optional second parameter - which allows to specify an offset in bytes for the constructed - pointer-like object. + which specifies an offset in bytes for the constructed pointer-like object. - Added the ast module. @@ -11058,7 +11057,7 @@ -- the failure just occurred later, with a more cumbersome exception. -- Patch #787789: allow to pass custom TestRunner instances to +- Patch #787789: allow passing custom TestRunner instances to unittest's main() function. - Patches #1550273, #1550272: fix a few bugs in unittest and add a diff --git a/Modules/_tkinter.c b/Modules/_tkinter.c --- a/Modules/_tkinter.c +++ b/Modules/_tkinter.c @@ -52,8 +52,8 @@ (size_t)(size) <= UINT_MAX / (size_t)(elemsize)) /* Starting with Tcl 8.4, many APIs offer const-correctness. Unfortunately, - making _tkinter correct for this API means to break earlier - versions. USE_COMPAT_CONST allows to make _tkinter work with both 8.4 and + making _tkinter correct for this API means breaking earlier + versions. USE_COMPAT_CONST allows making _tkinter work with both 8.4 and earlier versions. Once Tcl releases before 8.4 don't need to be supported anymore, this should go. */ #define USE_COMPAT_CONST -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Mon Jun 20 04:50:34 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 20 Jun 2016 08:50:34 +0000 Subject: [Python-checkins] Daily reference leaks (ebc82b840163): sum=0 Message-ID: <20160620085033.6662.95986.54291622@psf.io> results for ebc82b840163 on branch "default" -------------------------------------------- test_collections leaked [-4, 0, 0] memory blocks, sum=-4 test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflog6kLYaO', '--timeout', '7200'] From python-checkins at python.org Mon Jun 20 06:11:25 2016 From: python-checkins at python.org (stefan.krah) Date: Mon, 20 Jun 2016 10:11:25 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy41Lg==?= Message-ID: <20160620101123.66836.38706.09405CD4@psf.io> https://hg.python.org/cpython/rev/a6e6db79009a changeset: 102111:a6e6db79009a parent: 102108:7dfcc93c5d79 parent: 102110:dd3f48f1df86 user: Stefan Krah date: Mon Jun 20 12:10:42 2016 +0200 summary: Merge 3.5. files: Lib/test/test_decimal.py | 5 ++++- Modules/_decimal/_decimal.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -2524,7 +2524,8 @@ Decimal = self.decimal.Decimal class MyDecimal(Decimal): - pass + def __init__(self, _): + self.x = 'y' self.assertTrue(issubclass(MyDecimal, Decimal)) @@ -2532,6 +2533,8 @@ self.assertEqual(type(r), MyDecimal) self.assertEqual(str(r), '0.1000000000000000055511151231257827021181583404541015625') + self.assertEqual(r.x, 'y') + bigint = 12345678901234567890123456789 self.assertEqual(MyDecimal.from_float(bigint), MyDecimal(bigint)) self.assertTrue(MyDecimal.from_float(float('nan')).is_qnan()) diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -2629,12 +2629,18 @@ /* class method */ static PyObject * -dec_from_float(PyObject *dec, PyObject *pyfloat) +dec_from_float(PyObject *type, PyObject *pyfloat) { PyObject *context; + PyObject *result; CURRENT_CONTEXT(context); - return PyDecType_FromFloatExact((PyTypeObject *)dec, pyfloat, context); + result = PyDecType_FromFloatExact(&PyDec_Type, pyfloat, context); + if (!PyDec_CheckExact(type) && result != NULL) { + Py_SETREF(result, PyObject_CallFunctionObjArgs(type, result, NULL)); + } + + return result; } /* create_decimal_from_float */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 20 06:12:01 2016 From: python-checkins at python.org (stefan.krah) Date: Mon, 20 Jun 2016 10:12:01 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MDA2?= =?utf-8?b?OiBmcm9tX2Zsb2F0KCk6IGNhbGwgdGhlIHN1YmNsYXNzJyBfX25ld19fKCkg?= =?utf-8?b?YW5kIF9faW5pdF9fKCku?= Message-ID: <20160620101123.2760.86587.6D01752E@psf.io> https://hg.python.org/cpython/rev/dd3f48f1df86 changeset: 102110:dd3f48f1df86 branch: 3.5 parent: 102106:1cbe4cf863c5 user: Stefan Krah date: Mon Jun 20 12:10:13 2016 +0200 summary: Issue #27006: from_float(): call the subclass' __new__() and __init__(). files: Lib/test/test_decimal.py | 5 ++++- Modules/_decimal/_decimal.c | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -2491,7 +2491,8 @@ Decimal = self.decimal.Decimal class MyDecimal(Decimal): - pass + def __init__(self, _): + self.x = 'y' self.assertTrue(issubclass(MyDecimal, Decimal)) @@ -2499,6 +2500,8 @@ self.assertEqual(type(r), MyDecimal) self.assertEqual(str(r), '0.1000000000000000055511151231257827021181583404541015625') + self.assertEqual(r.x, 'y') + bigint = 12345678901234567890123456789 self.assertEqual(MyDecimal.from_float(bigint), MyDecimal(bigint)) self.assertTrue(MyDecimal.from_float(float('nan')).is_qnan()) diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -2630,12 +2630,18 @@ /* class method */ static PyObject * -dec_from_float(PyObject *dec, PyObject *pyfloat) +dec_from_float(PyObject *type, PyObject *pyfloat) { PyObject *context; + PyObject *result; CURRENT_CONTEXT(context); - return PyDecType_FromFloatExact((PyTypeObject *)dec, pyfloat, context); + result = PyDecType_FromFloatExact(&PyDec_Type, pyfloat, context); + if (!PyDec_CheckExact(type) && result != NULL) { + Py_SETREF(result, PyObject_CallFunctionObjArgs(type, result, NULL)); + } + + return result; } /* create_decimal_from_float */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 20 08:13:45 2016 From: python-checkins at python.org (stefan.krah) Date: Mon, 20 Jun 2016 12:13:45 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MDA2?= =?utf-8?q?=3A_Do_not_use_PyDec=5FCheckExact=28=29_on_a_type=2E?= Message-ID: <20160620121343.5246.27421.D3CFDBE5@psf.io> https://hg.python.org/cpython/rev/51a7a97c3ed4 changeset: 102112:51a7a97c3ed4 branch: 3.5 parent: 102110:dd3f48f1df86 user: Stefan Krah date: Mon Jun 20 14:12:52 2016 +0200 summary: Issue #27006: Do not use PyDec_CheckExact() on a type. files: Modules/_decimal/_decimal.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -2637,7 +2637,7 @@ CURRENT_CONTEXT(context); result = PyDecType_FromFloatExact(&PyDec_Type, pyfloat, context); - if (!PyDec_CheckExact(type) && result != NULL) { + if (type != (PyObject *)&PyDec_Type && result != NULL) { Py_SETREF(result, PyObject_CallFunctionObjArgs(type, result, NULL)); } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 20 08:14:27 2016 From: python-checkins at python.org (stefan.krah) Date: Mon, 20 Jun 2016 12:14:27 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy41Lg==?= Message-ID: <20160620121343.2955.90996.06A82833@psf.io> https://hg.python.org/cpython/rev/30b6cd2b3440 changeset: 102113:30b6cd2b3440 parent: 102111:a6e6db79009a parent: 102112:51a7a97c3ed4 user: Stefan Krah date: Mon Jun 20 14:13:12 2016 +0200 summary: Merge 3.5. files: Modules/_decimal/_decimal.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -2636,7 +2636,7 @@ CURRENT_CONTEXT(context); result = PyDecType_FromFloatExact(&PyDec_Type, pyfloat, context); - if (!PyDec_CheckExact(type) && result != NULL) { + if (type != (PyObject *)&PyDec_Type && result != NULL) { Py_SETREF(result, PyObject_CallFunctionObjArgs(type, result, NULL)); } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 20 14:42:22 2016 From: python-checkins at python.org (berker.peksag) Date: Mon, 20 Jun 2016 18:42:22 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2320120=3A_Merge_from_3=2E5?= Message-ID: <20160620184110.119788.32535.B1BA7383@psf.io> https://hg.python.org/cpython/rev/703d9066c459 changeset: 102115:703d9066c459 parent: 102113:30b6cd2b3440 parent: 102114:83d731f01dde user: Berker Peksag date: Mon Jun 20 21:42:05 2016 +0300 summary: Issue #20120: Merge from 3.5 files: Lib/distutils/tests/test_config.py | 19 ++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/Lib/distutils/tests/test_config.py b/Lib/distutils/tests/test_config.py --- a/Lib/distutils/tests/test_config.py +++ b/Lib/distutils/tests/test_config.py @@ -16,6 +16,7 @@ index-servers = server1 server2 + server3 [server1] username:me @@ -26,6 +27,10 @@ password: secret realm:acme repository:http://another.pypi/ + +[server3] +username:cbiggles +password:yh^%#rest-of-my-password """ PYPIRC_OLD = """\ @@ -111,6 +116,20 @@ finally: f.close() + def test_config_interpolation(self): + # using the % character in .pypirc should not raise an error (#20120) + self.write_file(self.rc, PYPIRC) + cmd = self._cmd(self.dist) + cmd.repository = 'server3' + config = cmd._read_pypirc() + + config = list(sorted(config.items())) + waited = [('password', 'yh^%#rest-of-my-password'), ('realm', 'pypi'), + ('repository', 'https://pypi.python.org/pypi'), + ('server', 'server3'), ('username', 'cbiggles')] + self.assertEqual(config, waited) + + def test_suite(): return unittest.makeSuite(PyPIRCCommandTestCase) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 20 14:42:22 2016 From: python-checkins at python.org (berker.peksag) Date: Mon, 20 Jun 2016 18:42:22 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIwMTIw?= =?utf-8?q?=3A_Add_a_test_case_to_verify_the_=25_char_can_be_used_in_=2Epy?= =?utf-8?q?pirc?= Message-ID: <20160620184109.20032.83053.8718CC8F@psf.io> https://hg.python.org/cpython/rev/83d731f01dde changeset: 102114:83d731f01dde branch: 3.5 parent: 102112:51a7a97c3ed4 user: Berker Peksag date: Mon Jun 20 21:41:34 2016 +0300 summary: Issue #20120: Add a test case to verify the % char can be used in .pypirc I noticed that there is no test for this feature while doing triaging work on pypa/pypi-legacy. files: Lib/distutils/tests/test_config.py | 19 ++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/Lib/distutils/tests/test_config.py b/Lib/distutils/tests/test_config.py --- a/Lib/distutils/tests/test_config.py +++ b/Lib/distutils/tests/test_config.py @@ -18,6 +18,7 @@ index-servers = server1 server2 + server3 [server1] username:me @@ -28,6 +29,10 @@ password: secret realm:acme repository:http://another.pypi/ + +[server3] +username:cbiggles +password:yh^%#rest-of-my-password """ PYPIRC_OLD = """\ @@ -113,6 +118,20 @@ finally: f.close() + def test_config_interpolation(self): + # using the % character in .pypirc should not raise an error (#20120) + self.write_file(self.rc, PYPIRC) + cmd = self._cmd(self.dist) + cmd.repository = 'server3' + config = cmd._read_pypirc() + + config = list(sorted(config.items())) + waited = [('password', 'yh^%#rest-of-my-password'), ('realm', 'pypi'), + ('repository', 'https://pypi.python.org/pypi'), + ('server', 'server3'), ('username', 'cbiggles')] + self.assertEqual(config, waited) + + def test_suite(): return unittest.makeSuite(PyPIRCCommandTestCase) -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Tue Jun 21 04:50:58 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 21 Jun 2016 08:50:58 +0000 Subject: [Python-checkins] Daily reference leaks (703d9066c459): sum=4 Message-ID: <20160621085058.50693.85297.AF0D2C08@psf.io> results for 703d9066c459 on branch "default" -------------------------------------------- test_collections leaked [4, -4, 0] memory blocks, sum=0 test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogAwYlpz', '--timeout', '7200'] From lp_benchmark_robot at intel.com Tue Jun 21 07:08:07 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 21 Jun 2016 12:08:07 +0100 Subject: [Python-checkins] GOOD Benchmark Results for Python Default 2016-06-21 Message-ID: <7cef74d4-274f-40c2-8582-6599e8435bf5@irsmsx105.ger.corp.intel.com> Results for project Python default, build date 2016-06-21 02:02:27 +0000 commit: 703d9066c459 previous commit: 7b9ad68db14e revision date: 2016-06-20 18:42:05 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.30% 1.02% 11.25% 15.45% :-| pybench 0.20% 0.00% 1.41% 8.80% :-| regex_v8 2.72% 0.09% -1.73% 2.20% :-| nbody 0.13% 0.08% -0.65% 7.31% :-| json_dump_v2 0.26% 0.33% -1.28% 13.91% :-| normal_startup 0.68% 0.45% 1.19% 5.38% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-default-2016-06-21/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Tue Jun 21 07:08:58 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 21 Jun 2016 12:08:58 +0100 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2016-06-21 Message-ID: <8cbddfa6-e12f-4e35-9f2a-20952a39446d@irsmsx105.ger.corp.intel.com> Results for project Python 2.7, build date 2016-06-21 02:46:14 +0000 commit: 340a91cccac8 previous commit: ac8338546ca8 revision date: 2016-06-20 07:52:50 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.20% 0.32% 4.91% 5.26% :-) pybench 0.19% 0.04% 5.72% 4.76% :-( regex_v8 0.48% -0.00% -2.44% 9.54% :-) nbody 0.05% 0.02% 8.97% 3.32% :-) json_dump_v2 0.43% -0.23% 2.20% 9.33% :-( normal_startup 1.83% -0.06% -5.51% 2.24% :-| ssbench 0.22% -0.16% 1.97% 1.34% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-2-7-2016-06-21/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Tue Jun 21 17:03:54 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Tue, 21 Jun 2016 21:03:54 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2318726=3A_All_opti?= =?utf-8?q?onal_parameters_of_the_dump=28=29=2C_dumps=28=29=2C?= Message-ID: <20160621210338.27660.15604.DDBB84AA@psf.io> https://hg.python.org/cpython/rev/db5fe5c4d09d changeset: 102116:db5fe5c4d09d user: Serhiy Storchaka date: Wed Jun 22 00:03:20 2016 +0300 summary: Issue #18726: All optional parameters of the dump(), dumps(), load() and loads() functions and JSONEncoder and JSONDecoder class constructors in the json module are now keyword-only. files: Doc/library/json.rst | 24 ++++++++++++++++++------ Doc/whatsnew/3.6.rst | 8 ++++++++ Lib/json/__init__.py | 8 ++++---- Lib/json/decoder.py | 2 +- Lib/json/encoder.py | 2 +- Misc/NEWS | 4 ++++ 6 files changed, 36 insertions(+), 12 deletions(-) diff --git a/Doc/library/json.rst b/Doc/library/json.rst --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -126,7 +126,7 @@ Basic Usage ----------- -.. function:: dump(obj, fp, skipkeys=False, ensure_ascii=True, \ +.. function:: dump(obj, fp, *, skipkeys=False, ensure_ascii=True, \ check_circular=True, allow_nan=True, cls=None, \ indent=None, separators=None, default=None, \ sort_keys=False, **kw) @@ -184,8 +184,11 @@ :meth:`default` method to serialize additional types), specify it with the *cls* kwarg; otherwise :class:`JSONEncoder` is used. + .. versionchanged:: 3.6 + All optional parameters are now :ref:`keyword-only `. -.. function:: dumps(obj, skipkeys=False, ensure_ascii=True, \ + +.. function:: dumps(obj, *, skipkeys=False, ensure_ascii=True, \ check_circular=True, allow_nan=True, cls=None, \ indent=None, separators=None, default=None, \ sort_keys=False, **kw) @@ -209,7 +212,7 @@ the original one. That is, ``loads(dumps(x)) != x`` if x has non-string keys. -.. function:: load(fp, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw) +.. function:: load(fp, *, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw) Deserialize *fp* (a ``.read()``-supporting :term:`file-like object` containing a JSON document) to a Python object using this :ref:`conversion @@ -257,7 +260,10 @@ If the data being deserialized is not a valid JSON document, a :exc:`JSONDecodeError` will be raised. -.. function:: loads(s, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw) + .. versionchanged:: 3.6 + All optional parameters are now :ref:`keyword-only `. + +.. function:: loads(s, *, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw) Deserialize *s* (a :class:`str` instance containing a JSON document) to a Python object using this :ref:`conversion table `. @@ -271,7 +277,7 @@ Encoders and Decoders --------------------- -.. class:: JSONDecoder(object_hook=None, parse_float=None, parse_int=None, parse_constant=None, strict=True, object_pairs_hook=None) +.. class:: JSONDecoder(*, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, strict=True, object_pairs_hook=None) Simple JSON decoder. @@ -341,6 +347,9 @@ If the data being deserialized is not a valid JSON document, a :exc:`JSONDecodeError` will be raised. + .. versionchanged:: 3.6 + All parameters are now :ref:`keyword-only `. + .. method:: decode(s) Return the Python representation of *s* (a :class:`str` instance @@ -359,7 +368,7 @@ extraneous data at the end. -.. class:: JSONEncoder(skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None) +.. class:: JSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None) Extensible JSON encoder for Python data structures. @@ -438,6 +447,9 @@ otherwise be serialized. It should return a JSON encodable version of the object or raise a :exc:`TypeError`. + .. versionchanged:: 3.6 + All parameters are now :ref:`keyword-only `. + .. method:: default(o) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -685,6 +685,14 @@ Code that has already been updated in accordance with the deprecation warning generated by 3.5 will not be affected. +* All optional parameters of the :func:`~json.dump`, :func:`~json.dumps`, + :func:`~json.load` and :func:`~json.loads` functions and + :class:`~json.JSONEncoder` and :class:`~json.JSONDecoder` class + constructors in the :mod:`json` module are now :ref:`keyword-only + `. + (Contributed by Serhiy Storchaka in :issue:`18726`.) + + Changes in the C API -------------------- diff --git a/Lib/json/__init__.py b/Lib/json/__init__.py --- a/Lib/json/__init__.py +++ b/Lib/json/__init__.py @@ -116,7 +116,7 @@ default=None, ) -def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True, +def dump(obj, fp, *, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, default=None, sort_keys=False, **kw): """Serialize ``obj`` as a JSON formatted stream to ``fp`` (a @@ -179,7 +179,7 @@ fp.write(chunk) -def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True, +def dumps(obj, *, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, default=None, sort_keys=False, **kw): """Serialize ``obj`` to a JSON formatted ``str``. @@ -240,7 +240,7 @@ _default_decoder = JSONDecoder(object_hook=None, object_pairs_hook=None) -def load(fp, cls=None, object_hook=None, parse_float=None, +def load(fp, *, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw): """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. @@ -268,7 +268,7 @@ parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw) -def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None, +def loads(s, *, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw): """Deserialize ``s`` (a ``str`` instance containing a JSON document) to a Python object. diff --git a/Lib/json/decoder.py b/Lib/json/decoder.py --- a/Lib/json/decoder.py +++ b/Lib/json/decoder.py @@ -280,7 +280,7 @@ """ - def __init__(self, object_hook=None, parse_float=None, + def __init__(self, *, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, strict=True, object_pairs_hook=None): """``object_hook``, if specified, will be called with the result diff --git a/Lib/json/encoder.py b/Lib/json/encoder.py --- a/Lib/json/encoder.py +++ b/Lib/json/encoder.py @@ -101,7 +101,7 @@ """ item_separator = ', ' key_separator = ': ' - def __init__(self, skipkeys=False, ensure_ascii=True, + def __init__(self, *, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None): """Constructor for JSONEncoder, with sensible defaults. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,10 @@ Library ------- +- Issue #18726: All optional parameters of the dump(), dumps(), + load() and loads() functions and JSONEncoder and JSONDecoder class + constructors in the json module are now keyword-only. + - Issue #27319: Methods selection_set(), selection_add(), selection_remove() and selection_toggle() of ttk.TreeView now allow passing multiple items as multiple arguments instead of passing them as a tuple. Deprecated -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 21 18:42:00 2016 From: python-checkins at python.org (terry.reedy) Date: Tue, 21 Jun 2016 22:42:00 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2324137=3A_Run_IDLE?= =?utf-8?q?=2C_test=5Fidle=2C_and_htest_with_tkinter_default_root_disabled?= =?utf-8?q?=2E?= Message-ID: <20160621224200.102243.21101.918DA697@psf.io> https://hg.python.org/cpython/rev/064b29dde096 changeset: 102117:064b29dde096 user: Terry Jan Reedy date: Tue Jun 21 18:41:38 2016 -0400 summary: Issue #24137: Run IDLE, test_idle, and htest with tkinter default root disabled. Fix code and tests that fail with this restriction. Fix htests to not create a second and redundant root and mainloop. files: Lib/idlelib/debugobj.py | 17 +++--- Lib/idlelib/dynoption.py | 4 +- Lib/idlelib/grep.py | 15 +++--- Lib/idlelib/idle_test/htest.py | 3 +- Lib/idlelib/idle_test/test_searchbase.py | 10 ++- Lib/idlelib/idle_test/test_text.py | 21 ++++++-- Lib/idlelib/multicall.py | 11 ++-- Lib/idlelib/percolator.py | 4 +- Lib/idlelib/pyshell.py | 5 +- Lib/idlelib/redirector.py | 13 ++--- Lib/idlelib/stackviewer.py | 10 ++-- Lib/idlelib/statusbar.py | 28 +++++------ Lib/idlelib/tabbedpages.py | 22 ++++----- Lib/idlelib/undo.py | 12 ++-- Lib/test/test_idle.py | 1 + 15 files changed, 92 insertions(+), 84 deletions(-) diff --git a/Lib/idlelib/debugobj.py b/Lib/idlelib/debugobj.py --- a/Lib/idlelib/debugobj.py +++ b/Lib/idlelib/debugobj.py @@ -122,21 +122,20 @@ return c(labeltext, object, setfunction) -def _object_browser(parent): +def _object_browser(parent): # htest # import sys - from tkinter import Tk - root = Tk() - root.title("Test debug object browser") + from tkinter import Toplevel + top = Toplevel(parent) + top.title("Test debug object browser") width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - root.geometry("+%d+%d"%(x, y + 150)) - root.configure(bd=0, bg="yellow") - root.focus_set() - sc = ScrolledCanvas(root, bg="white", highlightthickness=0, takefocus=1) + top.geometry("+%d+%d"%(x + 100, y + 175)) + top.configure(bd=0, bg="yellow") + top.focus_set() + sc = ScrolledCanvas(top, bg="white", highlightthickness=0, takefocus=1) sc.frame.pack(expand=1, fill="both") item = make_objecttreeitem("sys", sys) node = TreeNode(sc.canvas, None, item) node.update() - root.mainloop() if __name__ == '__main__': from idlelib.idle_test.htest import run diff --git a/Lib/idlelib/dynoption.py b/Lib/idlelib/dynoption.py --- a/Lib/idlelib/dynoption.py +++ b/Lib/idlelib/dynoption.py @@ -34,9 +34,9 @@ self.variable.set(value) def _dyn_option_menu(parent): # htest # - from tkinter import Toplevel + from tkinter import Toplevel # + StringVar, Button - top = Toplevel() + top = Toplevel(parent) top.title("Tets dynamic option menu") top.geometry("200x100+%d+%d" % (parent.winfo_rootx() + 200, parent.winfo_rooty() + 150)) diff --git a/Lib/idlelib/grep.py b/Lib/idlelib/grep.py --- a/Lib/idlelib/grep.py +++ b/Lib/idlelib/grep.py @@ -3,7 +3,6 @@ import re # for htest import sys from tkinter import StringVar, BooleanVar, Checkbutton # for GrepDialog -from tkinter import Tk, Text, Button, SEL, END # for htest from idlelib import searchengine from idlelib.searchbase import SearchDialogBase # Importing OutputWindow fails due to import loop @@ -132,13 +131,14 @@ def _grep_dialog(parent): # htest # from idlelib.pyshell import PyShellFileList - root = Tk() - root.title("Test GrepDialog") + from tkinter import Toplevel, Text, Button, SEL, END + top = Toplevel(parent) + top.title("Test GrepDialog") width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - root.geometry("+%d+%d"%(x, y + 150)) + top.geometry("+%d+%d"%(x, y + 150)) - flist = PyShellFileList(root) - text = Text(root, height=5) + flist = PyShellFileList(top) + text = Text(top, height=5) text.pack() def show_grep_dialog(): @@ -146,9 +146,8 @@ grep(text, flist=flist) text.tag_remove(SEL, "1.0", END) - button = Button(root, text="Show GrepDialog", command=show_grep_dialog) + button = Button(top, text="Show GrepDialog", command=show_grep_dialog) button.pack() - root.mainloop() if __name__ == "__main__": import unittest diff --git a/Lib/idlelib/idle_test/htest.py b/Lib/idlelib/idle_test/htest.py --- a/Lib/idlelib/idle_test/htest.py +++ b/Lib/idlelib/idle_test/htest.py @@ -68,6 +68,7 @@ from importlib import import_module import tkinter as tk from tkinter.ttk import Scrollbar +tk.NoDefaultRoot() AboutDialog_spec = { 'file': 'help_about', @@ -364,7 +365,7 @@ test = getattr(mod, test_name) test_list.append((test_spec, test)) - test_name = tk.StringVar('') + test_name = tk.StringVar(root) callable_object = None test_kwds = None diff --git a/Lib/idlelib/idle_test/test_searchbase.py b/Lib/idlelib/idle_test/test_searchbase.py --- a/Lib/idlelib/idle_test/test_searchbase.py +++ b/Lib/idlelib/idle_test/test_searchbase.py @@ -74,7 +74,7 @@ def test_make_entry(self): equal = self.assertEqual self.dialog.row = 0 - self.dialog.top = Toplevel(self.root) + self.dialog.top = self.root entry, label = self.dialog.make_entry("Test:", 'hello') equal(label['text'], 'Test:') @@ -87,6 +87,7 @@ equal(self.dialog.row, 1) def test_create_entries(self): + self.dialog.top = self.root self.dialog.row = 0 self.engine.setpat('hello') self.dialog.create_entries() @@ -94,7 +95,7 @@ def test_make_frame(self): self.dialog.row = 0 - self.dialog.top = Toplevel(self.root) + self.dialog.top = self.root frame, label = self.dialog.make_frame() self.assertEqual(label, '') self.assertIsInstance(frame, Frame) @@ -104,7 +105,7 @@ self.assertIsInstance(frame, Frame) def btn_test_setup(self, meth): - self.dialog.top = Toplevel(self.root) + self.dialog.top = self.root self.dialog.row = 0 return meth() @@ -145,12 +146,13 @@ self.assertEqual(var.get(), state) def test_make_button(self): - self.dialog.top = Toplevel(self.root) + self.dialog.top = self.root self.dialog.buttonframe = Frame(self.dialog.top) btn = self.dialog.make_button('Test', self.dialog.close) self.assertEqual(btn['text'], 'Test') def test_create_command_buttons(self): + self.dialog.top = self.root self.dialog.create_command_buttons() # Look for close button command in buttonframe closebuttoncommand = '' diff --git a/Lib/idlelib/idle_test/test_text.py b/Lib/idlelib/idle_test/test_text.py --- a/Lib/idlelib/idle_test/test_text.py +++ b/Lib/idlelib/idle_test/test_text.py @@ -1,17 +1,19 @@ -# Test mock_tk.Text class against tkinter.Text class by running same tests with both. +''' Test mock_tk.Text class against tkinter.Text class + +Run same tests with both by creating a mixin class. +''' import unittest from test.support import requires - from _tkinter import TclError class TextTest(object): + "Define items common to both sets of tests." - hw = 'hello\nworld' # usual initial insert after initialization + hw = 'hello\nworld' # Several tests insert this after after initialization. hwn = hw+'\n' # \n present at initialization, before insert - Text = None - def setUp(self): - self.text = self.Text() + # setUpClass defines cls.Text and maybe cls.root. + # setUp defines self.text from Text and maybe root. def test_init(self): self.assertEqual(self.text.get('1.0'), '\n') @@ -196,6 +198,10 @@ from idlelib.idle_test.mock_tk import Text cls.Text = Text + def setUp(self): + self.text = self.Text() + + def test_decode(self): # test endflags (-1, 0) not tested by test_index (which uses +1) decode = self.text._decode @@ -222,6 +228,9 @@ cls.root.destroy() del cls.root + def setUp(self): + self.text = self.Text(self.root) + if __name__ == '__main__': unittest.main(verbosity=2, exit=False) diff --git a/Lib/idlelib/multicall.py b/Lib/idlelib/multicall.py --- a/Lib/idlelib/multicall.py +++ b/Lib/idlelib/multicall.py @@ -414,12 +414,12 @@ return MultiCall -def _multi_call(parent): - root = tkinter.Tk() - root.title("Test MultiCall") +def _multi_call(parent): # htest # + top = tkinter.Toplevel(parent) + top.title("Test MultiCall") width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - root.geometry("+%d+%d"%(x, y + 150)) - text = MultiCallCreator(tkinter.Text)(root) + top.geometry("+%d+%d"%(x, y + 150)) + text = MultiCallCreator(tkinter.Text)(top) text.pack() def bindseq(seq, n=[0]): def handler(event): @@ -439,7 +439,6 @@ bindseq("") bindseq("") bindseq("") - root.mainloop() if __name__ == "__main__": from idlelib.idle_test.htest import run diff --git a/Lib/idlelib/percolator.py b/Lib/idlelib/percolator.py --- a/Lib/idlelib/percolator.py +++ b/Lib/idlelib/percolator.py @@ -89,10 +89,10 @@ (pin if var2.get() else pout)(t2) text.pack() - var1 = tk.IntVar() + var1 = tk.IntVar(parent) cb1 = tk.Checkbutton(box, text="Tracer1", command=toggle1, variable=var1) cb1.pack() - var2 = tk.IntVar() + var2 = tk.IntVar(parent) cb2 = tk.Checkbutton(box, text="Tracer2", command=toggle2, variable=var2) cb2.pack() diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py --- a/Lib/idlelib/pyshell.py +++ b/Lib/idlelib/pyshell.py @@ -1547,7 +1547,9 @@ enable_edit = enable_edit or edit_start enable_shell = enable_shell or not enable_edit - # start editor and/or shell windows: + # Setup root. + if use_subprocess: # Don't break user code run in IDLE process + NoDefaultRoot() root = Tk(className="Idle") root.withdraw() @@ -1563,6 +1565,7 @@ icons = [PhotoImage(file=iconfile) for iconfile in iconfiles] root.wm_iconphoto(True, *icons) + # start editor and/or shell windows: fixwordbreaks(root) fix_x11_paste(root) flist = PyShellFileList(root) diff --git a/Lib/idlelib/redirector.py b/Lib/idlelib/redirector.py --- a/Lib/idlelib/redirector.py +++ b/Lib/idlelib/redirector.py @@ -151,14 +151,14 @@ def _widget_redirector(parent): # htest # - from tkinter import Tk, Text + from tkinter import Toplevel, Text import re - root = Tk() - root.title("Test WidgetRedirector") + top = Toplevel(parent) + top.title("Test WidgetRedirector") width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - root.geometry("+%d+%d"%(x, y + 150)) - text = Text(root) + top.geometry("+%d+%d"%(x, y + 150)) + text = Text(top) text.pack() text.focus_set() redir = WidgetRedirector(text) @@ -166,11 +166,10 @@ print("insert", args) original_insert(*args) original_insert = redir.register("insert", my_insert) - root.mainloop() if __name__ == "__main__": import unittest - unittest.main('idlelib.idle_test.test_widgetredir', + unittest.main('idlelib.idle_test.test_redirector', verbosity=2, exit=False) from idlelib.idle_test.htest import run run(_widget_redirector) diff --git a/Lib/idlelib/stackviewer.py b/Lib/idlelib/stackviewer.py --- a/Lib/idlelib/stackviewer.py +++ b/Lib/idlelib/stackviewer.py @@ -121,11 +121,11 @@ return sublist def _stack_viewer(parent): - root = tk.Tk() - root.title("Test StackViewer") + top = tk.Toplevel(parent) + top.title("Test StackViewer") width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - root.geometry("+%d+%d"%(x, y + 150)) - flist = PyShellFileList(root) + top.geometry("+%d+%d"%(x, y + 150)) + flist = PyShellFileList(top) try: # to obtain a traceback object intentional_name_error except NameError: @@ -136,7 +136,7 @@ sys.last_value = exc_value sys.last_traceback = exc_tb - StackBrowser(root, flist=flist, top=root, tb=exc_tb) + StackBrowser(top, flist=flist, top=top, tb=exc_tb) # restore sys to original state del sys.last_type diff --git a/Lib/idlelib/statusbar.py b/Lib/idlelib/statusbar.py --- a/Lib/idlelib/statusbar.py +++ b/Lib/idlelib/statusbar.py @@ -1,16 +1,14 @@ -from tkinter import * +from tkinter import Frame, Label class MultiStatusBar(Frame): - def __init__(self, master=None, **kw): - if master is None: - master = Tk() + def __init__(self, master, **kw): Frame.__init__(self, master, **kw) self.labels = {} - def set_label(self, name, text='', side=LEFT, width=0): + def set_label(self, name, text='', side='left', width=0): if name not in self.labels: - label = Label(self, borderwidth=0, anchor=W) + label = Label(self, borderwidth=0, anchor='w') label.pack(side=side, pady=0, padx=4) self.labels[name] = label else: @@ -20,27 +18,27 @@ label.config(text=text) def _multistatus_bar(parent): - root = Tk() + import re + from tkinter import Toplevel, Frame, Text, Button + top = Toplevel(parent) width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - root.geometry("+%d+%d" %(x, y + 150)) - root.title("Test multistatus bar") - frame = Frame(root) + top.geometry("+%d+%d" %(x, y + 150)) + top.title("Test multistatus bar") + frame = Frame(top) text = Text(frame) text.pack() msb = MultiStatusBar(frame) msb.set_label("one", "hello") msb.set_label("two", "world") - msb.pack(side=BOTTOM, fill=X) + msb.pack(side='bottom', fill='x') def change(): msb.set_label("one", "foo") msb.set_label("two", "bar") - button = Button(root, text="Update status", command=change) - button.pack(side=BOTTOM) + button = Button(top, text="Update status", command=change) + button.pack(side='bottom') frame.pack() - frame.mainloop() - root.mainloop() if __name__ == '__main__': from idlelib.idle_test.htest import run diff --git a/Lib/idlelib/tabbedpages.py b/Lib/idlelib/tabbedpages.py --- a/Lib/idlelib/tabbedpages.py +++ b/Lib/idlelib/tabbedpages.py @@ -467,31 +467,29 @@ self._tab_set.set_selected_tab(page_name) -def _tabbed_pages(parent): - # test dialog - root=Tk() +def _tabbed_pages(parent): # htest # + import re + top=Toplevel(parent) width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - root.geometry("+%d+%d"%(x, y + 175)) - root.title("Test tabbed pages") - tabPage=TabbedPageSet(root, page_names=['Foobar','Baz'], n_rows=0, + top.geometry("+%d+%d"%(x, y + 175)) + top.title("Test tabbed pages") + tabPage=TabbedPageSet(top, page_names=['Foobar','Baz'], n_rows=0, expand_tabs=False, ) tabPage.pack(side=TOP, expand=TRUE, fill=BOTH) Label(tabPage.pages['Foobar'].frame, text='Foo', pady=20).pack() Label(tabPage.pages['Foobar'].frame, text='Bar', pady=20).pack() Label(tabPage.pages['Baz'].frame, text='Baz').pack() - entryPgName=Entry(root) - buttonAdd=Button(root, text='Add Page', + entryPgName=Entry(top) + buttonAdd=Button(top, text='Add Page', command=lambda:tabPage.add_page(entryPgName.get())) - buttonRemove=Button(root, text='Remove Page', + buttonRemove=Button(top, text='Remove Page', command=lambda:tabPage.remove_page(entryPgName.get())) - labelPgName=Label(root, text='name of page to add/remove:') + labelPgName=Label(top, text='name of page to add/remove:') buttonAdd.pack(padx=5, pady=5) buttonRemove.pack(padx=5, pady=5) labelPgName.pack(padx=5) entryPgName.pack(padx=5) - root.mainloop() - if __name__ == '__main__': from idlelib.idle_test.htest import run diff --git a/Lib/idlelib/undo.py b/Lib/idlelib/undo.py --- a/Lib/idlelib/undo.py +++ b/Lib/idlelib/undo.py @@ -1,7 +1,7 @@ import string -from tkinter import * - from idlelib.delegator import Delegator +# tkintter import not needed because module does not create widgets, +# although many methods operate on text widget arguments. #$ event <> #$ win @@ -339,12 +339,12 @@ def _undo_delegator(parent): # htest # import re - import tkinter as tk + from tkinter import Toplevel, Text, Button from idlelib.percolator import Percolator - undowin = tk.Toplevel() + undowin = Toplevel(parent) undowin.title("Test UndoDelegator") width, height, x, y = list(map(int, re.split('[x+]', parent.geometry()))) - undowin.geometry("+%d+%d"%(x, y + 150)) + undowin.geometry("+%d+%d"%(x, y + 175)) text = Text(undowin, height=10) text.pack() @@ -362,7 +362,7 @@ if __name__ == "__main__": import unittest - unittest.main('idlelib.idle_test.test_undodelegator', verbosity=2, + unittest.main('idlelib.idle_test.test_undo', verbosity=2, exit=False) from idlelib.idle_test.htest import run run(_undo_delegator) diff --git a/Lib/test/test_idle.py b/Lib/test/test_idle.py --- a/Lib/test/test_idle.py +++ b/Lib/test/test_idle.py @@ -6,6 +6,7 @@ tk = import_module('tkinter') # imports _tkinter if tk.TkVersion < 8.5: raise unittest.SkipTest("IDLE requires tk 8.5 or later.") +tk.NoDefaultRoot() idletest = import_module('idlelib.idle_test') # Without test_main present, regrtest.runtest_inner (line1219) calls -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 21 20:49:26 2016 From: python-checkins at python.org (martin.panter) Date: Wed, 22 Jun 2016 00:49:26 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzIyNDYz?= =?utf-8?q?=3A_Backport_compiler_warning_fixes_and_workarounds?= Message-ID: <20160622004926.119817.60370.8CDEECCB@psf.io> https://hg.python.org/cpython/rev/0b63465a1796 changeset: 102118:0b63465a1796 branch: 2.7 parent: 102109:340a91cccac8 user: Martin Panter date: Tue Jun 21 23:58:05 2016 +0000 summary: Issue #22463: Backport compiler warning fixes and workarounds * Set but unused variable in Parser/pgen.c in non-debug builds. Patch by Christian Heimes. * Unused static function in Modules/readline.c. Patch by Georg Brandl. * main_window unused in Modules/tkappinit.c. Patch by Gregory P. Smith. * Dead assignment in Modules/_ctypes/cfield.c. Extracted from patch by Brett Cannon. * Expression result unused in PyObject_INIT macro expansions. Based on patches by Christian Heimes. * Load expat_config.h and therefore pyconfig.h before C stdlib headers are loaded. This silences pre-processor warnings including '_POSIX_C_SOURCE redefined'. Extracted from patch by Christian Heimes. files: Modules/_ctypes/cfield.c | 3 +-- Modules/datetimemodule.c | 4 ++-- Modules/expat/xmlparse.c | 12 ++++++------ Modules/readline.c | 5 ++++- Modules/tkappinit.c | 6 ++++++ Objects/classobject.c | 2 +- Objects/complexobject.c | 2 +- Objects/floatobject.c | 2 +- Objects/intobject.c | 4 ++-- Objects/methodobject.c | 2 +- Objects/stringobject.c | 8 ++++---- Objects/typeobject.c | 2 +- Objects/unicodeobject.c | 2 +- Parser/pgen.c | 1 + 14 files changed, 32 insertions(+), 23 deletions(-) diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c --- a/Modules/_ctypes/cfield.c +++ b/Modules/_ctypes/cfield.c @@ -48,7 +48,7 @@ { CFieldObject *self; PyObject *proto; - Py_ssize_t size, align, length; + Py_ssize_t size, align; SETFUNC setfunc = NULL; GETFUNC getfunc = NULL; StgDictObject *dict; @@ -102,7 +102,6 @@ } size = dict->size; - length = dict->length; proto = desc; /* Field descriptors for 'c_char * n' are be scpecial cased to diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c --- a/Modules/datetimemodule.c +++ b/Modules/datetimemodule.c @@ -613,7 +613,7 @@ sizeof(_PyDateTime_BaseTime)); if (self == NULL) return (PyObject *)PyErr_NoMemory(); - PyObject_INIT(self, type); + (void)PyObject_INIT(self, type); return self; } @@ -628,7 +628,7 @@ sizeof(_PyDateTime_BaseDateTime)); if (self == NULL) return (PyObject *)PyErr_NoMemory(); - PyObject_INIT(self, type); + (void)PyObject_INIT(self, type); return self; } diff --git a/Modules/expat/xmlparse.c b/Modules/expat/xmlparse.c --- a/Modules/expat/xmlparse.c +++ b/Modules/expat/xmlparse.c @@ -2,12 +2,6 @@ See the file COPYING for copying permission. */ -#include -#include /* memset(), memcpy() */ -#include -#include /* UINT_MAX */ -#include /* time() */ - #define XML_BUILDING_EXPAT 1 #ifdef COMPILED_FROM_DSP @@ -22,6 +16,12 @@ #include #endif /* ndef COMPILED_FROM_DSP */ +#include +#include /* memset(), memcpy() */ +#include +#include /* UINT_MAX */ +#include /* time() */ + #include "ascii.h" #include "expat.h" diff --git a/Modules/readline.c b/Modules/readline.c --- a/Modules/readline.c +++ b/Modules/readline.c @@ -66,10 +66,11 @@ static int libedit_history_start = 0; #endif /* __APPLE__ */ +#ifdef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK static void on_completion_display_matches_hook(char **matches, int num_matches, int max_length); - +#endif /* Memory allocated for rl_completer_word_break_characters (see issue #17289 for the motivation). */ @@ -774,6 +775,7 @@ /* C function to call the Python completion_display_matches */ +#ifdef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK static void on_completion_display_matches_hook(char **matches, int num_matches, int max_length) @@ -874,6 +876,7 @@ } return result; } +#endif /* A more flexible constructor that saves the "begidx" and "endidx" diff --git a/Modules/tkappinit.c b/Modules/tkappinit.c --- a/Modules/tkappinit.c +++ b/Modules/tkappinit.c @@ -26,7 +26,9 @@ int Tcl_AppInit(Tcl_Interp *interp) { +#ifdef WITH_MOREBUTTONS Tk_Window main_window; +#endif const char *_tkinter_skip_tk_init; #ifdef TKINTER_PROTECT_LOADTK const char *_tkinter_tk_failed; @@ -111,7 +113,11 @@ return TCL_ERROR; } +#ifdef WITH_MOREBUTTONS main_window = Tk_MainWindow(interp); +#else + Tk_MainWindow(interp); +#endif #ifdef TK_AQUA TkMacOSXInitAppleEvents(interp); diff --git a/Objects/classobject.c b/Objects/classobject.c --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -2256,7 +2256,7 @@ im = free_list; if (im != NULL) { free_list = (PyMethodObject *)(im->im_self); - PyObject_INIT(im, &PyMethod_Type); + (void)PyObject_INIT(im, &PyMethod_Type); numfree--; } else { diff --git a/Objects/complexobject.c b/Objects/complexobject.c --- a/Objects/complexobject.c +++ b/Objects/complexobject.c @@ -239,7 +239,7 @@ op = (PyComplexObject *) PyObject_MALLOC(sizeof(PyComplexObject)); if (op == NULL) return PyErr_NoMemory(); - PyObject_INIT(op, &PyComplex_Type); + (void)PyObject_INIT(op, &PyComplex_Type); op->cval = cval; return (PyObject *) op; } diff --git a/Objects/floatobject.c b/Objects/floatobject.c --- a/Objects/floatobject.c +++ b/Objects/floatobject.c @@ -149,7 +149,7 @@ /* Inline PyObject_New */ op = free_list; free_list = (PyFloatObject *)Py_TYPE(op); - PyObject_INIT(op, &PyFloat_Type); + (void)PyObject_INIT(op, &PyFloat_Type); op->ob_fval = fval; return (PyObject *) op; } diff --git a/Objects/intobject.c b/Objects/intobject.c --- a/Objects/intobject.c +++ b/Objects/intobject.c @@ -107,7 +107,7 @@ /* Inline PyObject_New */ v = free_list; free_list = (PyIntObject *)Py_TYPE(v); - PyObject_INIT(v, &PyInt_Type); + (void)PyObject_INIT(v, &PyInt_Type); v->ob_ival = ival; return (PyObject *) v; } @@ -1466,7 +1466,7 @@ /* PyObject_New is inlined */ v = free_list; free_list = (PyIntObject *)Py_TYPE(v); - PyObject_INIT(v, &PyInt_Type); + (void)PyObject_INIT(v, &PyInt_Type); v->ob_ival = ival; small_ints[ival + NSMALLNEGINTS] = v; } diff --git a/Objects/methodobject.c b/Objects/methodobject.c --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -20,7 +20,7 @@ op = free_list; if (op != NULL) { free_list = (PyCFunctionObject *)(op->m_self); - PyObject_INIT(op, &PyCFunction_Type); + (void)PyObject_INIT(op, &PyCFunction_Type); numfree--; } else { diff --git a/Objects/stringobject.c b/Objects/stringobject.c --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -88,7 +88,7 @@ op = (PyStringObject *)PyObject_MALLOC(PyStringObject_SIZE + size); if (op == NULL) return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyString_Type, size); + (void)PyObject_INIT_VAR(op, &PyString_Type, size); op->ob_shash = -1; op->ob_sstate = SSTATE_NOT_INTERNED; if (str != NULL) @@ -143,7 +143,7 @@ op = (PyStringObject *)PyObject_MALLOC(PyStringObject_SIZE + size); if (op == NULL) return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyString_Type, size); + (void)PyObject_INIT_VAR(op, &PyString_Type, size); op->ob_shash = -1; op->ob_sstate = SSTATE_NOT_INTERNED; Py_MEMCPY(op->ob_sval, str, size+1); @@ -1061,7 +1061,7 @@ op = (PyStringObject *)PyObject_MALLOC(PyStringObject_SIZE + size); if (op == NULL) return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyString_Type, size); + (void)PyObject_INIT_VAR(op, &PyString_Type, size); op->ob_shash = -1; op->ob_sstate = SSTATE_NOT_INTERNED; Py_MEMCPY(op->ob_sval, a->ob_sval, Py_SIZE(a)); @@ -1103,7 +1103,7 @@ op = (PyStringObject *)PyObject_MALLOC(PyStringObject_SIZE + nbytes); if (op == NULL) return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyString_Type, size); + (void)PyObject_INIT_VAR(op, &PyString_Type, size); op->ob_shash = -1; op->ob_sstate = SSTATE_NOT_INTERNED; op->ob_sval[size] = '\0'; diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -791,7 +791,7 @@ Py_INCREF(type); if (type->tp_itemsize == 0) - PyObject_INIT(obj, type); + (void)PyObject_INIT(obj, type); else (void) PyObject_INIT_VAR((PyVarObject *)obj, type, nitems); diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -347,7 +347,7 @@ size_t new_size = sizeof(Py_UNICODE) * ((size_t)length + 1); unicode->str = (Py_UNICODE*) PyObject_MALLOC(new_size); } - PyObject_INIT(unicode, &PyUnicode_Type); + (void)PyObject_INIT(unicode, &PyUnicode_Type); } else { size_t new_size; diff --git a/Parser/pgen.c b/Parser/pgen.c --- a/Parser/pgen.c +++ b/Parser/pgen.c @@ -283,6 +283,7 @@ REQ(n, ATOM); i = n->n_nchildren; + (void)i; /* Don't warn about set but unused */ REQN(i, 1); n = n->n_child; if (n->n_type == LPAR) { -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 21 22:09:23 2016 From: python-checkins at python.org (martin.panter) Date: Wed, 22 Jun 2016 02:09:23 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzIyNDYz?= =?utf-8?q?=3A_Correct_=23endif_placement=3B_patch_by_Senthil_Kumaran?= Message-ID: <20160622020923.618.81778.74ACAE8E@psf.io> https://hg.python.org/cpython/rev/b1c1c297bead changeset: 102119:b1c1c297bead branch: 2.7 user: Martin Panter date: Wed Jun 22 02:04:38 2016 +0000 summary: Issue #22463: Correct #endif placement; patch by Senthil Kumaran files: Modules/readline.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/readline.c b/Modules/readline.c --- a/Modules/readline.c +++ b/Modules/readline.c @@ -818,6 +818,7 @@ #endif } +#endif #ifdef HAVE_RL_RESIZE_TERMINAL static volatile sig_atomic_t sigwinch_received; @@ -876,7 +877,6 @@ } return result; } -#endif /* A more flexible constructor that saves the "begidx" and "endidx" -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 21 22:49:57 2016 From: python-checkins at python.org (martin.panter) Date: Wed, 22 Jun 2016 02:49:57 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzIyNDYz?= =?utf-8?q?=3A_Cure_unused_function_warnings_on_AIX?= Message-ID: <20160622024957.22035.73418.8A6CA3B1@psf.io> https://hg.python.org/cpython/rev/ffe866aa86a8 changeset: 102120:ffe866aa86a8 branch: 2.7 user: Martin Panter date: Wed Jun 22 02:46:33 2016 +0000 summary: Issue #22463: Cure unused function warnings on AIX files: Modules/_ctypes/callproc.c | 4 +++- Modules/_ctypes/cfield.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -92,8 +92,10 @@ #define CTYPES_CAPSULE_ERROROBJ "_ctypes/callproc.c error object" CTYPES_CAPSULE_INSTANTIATE_DESTRUCTOR(CTYPES_CAPSULE_ERROROBJ) -#define CTYPES_CAPSULE_WCHAR_T "_ctypes/callproc.c wchar_t buffer from unicode" +#if defined(CTYPES_UNICODE) && !defined(HAVE_USABLE_WCHAR_T) +# define CTYPES_CAPSULE_WCHAR_T "_ctypes/callproc.c wchar_t buffer from unicode" CTYPES_CAPSULE_INSTANTIATE_DESTRUCTOR(CTYPES_CAPSULE_WCHAR_T) +#endif /* ctypes maintains thread-local storage that has space for two error numbers: diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c --- a/Modules/_ctypes/cfield.c +++ b/Modules/_ctypes/cfield.c @@ -12,8 +12,10 @@ #include "ctypes.h" -#define CTYPES_CAPSULE_WCHAR_T "_ctypes/cfield.c wchar_t buffer from unicode" +#if defined(CTYPES_UNICODE) && !defined(HAVE_USABLE_WCHAR_T) +# define CTYPES_CAPSULE_WCHAR_T "_ctypes/cfield.c wchar_t buffer from unicode" CTYPES_CAPSULE_INSTANTIATE_DESTRUCTOR(CTYPES_CAPSULE_WCHAR_T) +#endif /******************************************************************/ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 22 02:13:55 2016 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 22 Jun 2016 06:13:55 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI2OTMw?= =?utf-8?q?=3A_Update_Windows_build_to_OpenSSL_1=2E0=2E2h?= Message-ID: <20160622061353.129991.6815.1A0FCB7E@psf.io> https://hg.python.org/cpython/rev/ad037bba60bb changeset: 102121:ad037bba60bb branch: 2.7 parent: 101899:5811fcfe1043 user: Zachary Ware date: Wed Jun 15 17:12:38 2016 -0500 summary: Issue #26930: Update Windows build to OpenSSL 1.0.2h files: Misc/NEWS | 9 +++++++++ PC/VS9.0/pyproject.vsprops | 2 +- PC/VS9.0/readme.txt | 2 +- PCbuild/get_externals.bat | 2 +- PCbuild/python.props | 2 +- PCbuild/readme.txt | 2 +- 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,6 +2,15 @@ Python News +++++++++++ +What's New in Python 2.7.12? +============================ + +Build +----- + +- Issue #26930: Update Windows builds to use OpenSSL 1.0.2h. + + What's New in Python 2.7.12 release candidate 1? ================================================ diff --git a/PC/VS9.0/pyproject.vsprops b/PC/VS9.0/pyproject.vsprops --- a/PC/VS9.0/pyproject.vsprops +++ b/PC/VS9.0/pyproject.vsprops @@ -82,7 +82,7 @@ /> $(ExternalsDir)sqlite-3.8.11.0\ $(ExternalsDir)bzip2-1.0.6\ $(ExternalsDir)db-4.7.25.0 - $(ExternalsDir)openssl-1.0.2g\ + $(ExternalsDir)openssl-1.0.2h\ $(opensslDir)include32 $(opensslDir)include64 $(ExternalsDir)\nasm-2.11.06\ diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt --- a/PCbuild/readme.txt +++ b/PCbuild/readme.txt @@ -183,7 +183,7 @@ Homepage: http://www.bzip.org/ _ssl - Python wrapper for version 1.0.2g of the OpenSSL secure sockets + Python wrapper for version 1.0.2h of the OpenSSL secure sockets library, which is built by ssl.vcxproj Homepage: http://www.openssl.org/ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 22 02:13:55 2016 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 22 Jun 2016 06:13:55 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf-8?q?_merge_2=2E7=2E12_release_branch?= Message-ID: <20160622061354.17558.83940.93AC3362@psf.io> https://hg.python.org/cpython/rev/7d25a93c135f changeset: 102123:7d25a93c135f branch: 2.7 parent: 102120:ffe866aa86a8 parent: 102122:45d4cea97b04 user: Benjamin Peterson date: Tue Jun 21 23:13:33 2016 -0700 summary: merge 2.7.12 release branch files: Lib/idlelib/aboutDialog.py | 4 +- Lib/idlelib/idle_test/test_helpabout.py | 52 +++++++++++++ Lib/idlelib/textView.py | 4 + Misc/NEWS | 8 ++ 4 files changed, 67 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/aboutDialog.py b/Lib/idlelib/aboutDialog.py --- a/Lib/idlelib/aboutDialog.py +++ b/Lib/idlelib/aboutDialog.py @@ -129,7 +129,7 @@ self.display_file_text('About - Readme', 'README.txt', 'ascii') def ShowIDLENEWS(self): - self.display_file_text('About - NEWS', 'NEWS.txt', 'ascii') + self.display_file_text('About - NEWS', 'NEWS.txt', 'utf-8') def display_printer_text(self, title, printer): printer._Printer__setup() @@ -144,5 +144,7 @@ self.destroy() if __name__ == '__main__': + import unittest + unittest.main('idlelib.idle_test.test_helpabout', verbosity=2, exit=False) from idlelib.idle_test.htest import run run(AboutDialog) diff --git a/Lib/idlelib/idle_test/test_helpabout.py b/Lib/idlelib/idle_test/test_helpabout.py new file mode 100644 --- /dev/null +++ b/Lib/idlelib/idle_test/test_helpabout.py @@ -0,0 +1,52 @@ +'''Test idlelib.help_about. + +Coverage: +''' +from idlelib import aboutDialog as help_about +from idlelib import textView as textview +from idlelib.idle_test.mock_idle import Func +from idlelib.idle_test.mock_tk import Mbox +import unittest + +About = help_about.AboutDialog +class Dummy_about_dialog(): + # Dummy class for testing file display functions. + idle_credits = About.ShowIDLECredits.im_func + idle_readme = About.ShowIDLEAbout.im_func + idle_news = About.ShowIDLENEWS.im_func + # Called by the above + display_file_text = About.display_file_text.im_func + + +class DisplayFileTest(unittest.TestCase): + "Test that .txt files are found and properly decoded." + dialog = Dummy_about_dialog() + + @classmethod + def setUpClass(cls): + cls.orig_mbox = textview.tkMessageBox + cls.orig_view = textview.view_text + cls.mbox = Mbox() + cls.view = Func() + textview.tkMessageBox = cls.mbox + textview.view_text = cls.view + cls.About = Dummy_about_dialog() + + @classmethod + def tearDownClass(cls): + textview.tkMessageBox = cls.orig_mbox + textview.view_text = cls.orig_view.im_func + + def test_file_isplay(self): + for handler in (self.dialog.idle_credits, + self.dialog.idle_readme, + self.dialog.idle_news): + self.mbox.showerror.message = '' + self.view.called = False + handler() + self.assertEqual(self.mbox.showerror.message, '') + self.assertEqual(self.view.called, True) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/Lib/idlelib/textView.py b/Lib/idlelib/textView.py --- a/Lib/idlelib/textView.py +++ b/Lib/idlelib/textView.py @@ -79,6 +79,10 @@ tkMessageBox.showerror(title='File Load Error', message='Unable to load file %r .' % filename, parent=parent) + except UnicodeDecodeError as err: + showerror(title='Unicode Decode Error', + message=str(err), + parent=parent) else: return view_text(parent, title, textFile.read(), modal) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -35,11 +35,19 @@ resulting links to use lowercase. Patch by Sean Rodman, test by Kaushik Nadikuditi. +What's New in Python 2.7.12? +============================ + Build ----- - Issue #26930: Update Windows builds to use OpenSSL 1.0.2h. +IDLE +---- + +- Issue #27365: Fix about dialog. + What's New in Python 2.7.12 release candidate 1? ================================================ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 22 02:13:59 2016 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 22 Jun 2016 06:13:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_fix_idle_about?= =?utf-8?q?_dialog_=2327365?= Message-ID: <20160622061353.129546.41544.F0F237E1@psf.io> https://hg.python.org/cpython/rev/45d4cea97b04 changeset: 102122:45d4cea97b04 branch: 2.7 user: Benjamin Peterson date: Tue Jun 21 23:12:54 2016 -0700 summary: fix idle about dialog #27365 files: Lib/idlelib/aboutDialog.py | 4 +- Lib/idlelib/idle_test/test_helpabout.py | 52 +++++++++++++ Lib/idlelib/textView.py | 4 + Misc/NEWS | 5 + 4 files changed, 64 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/aboutDialog.py b/Lib/idlelib/aboutDialog.py --- a/Lib/idlelib/aboutDialog.py +++ b/Lib/idlelib/aboutDialog.py @@ -129,7 +129,7 @@ self.display_file_text('About - Readme', 'README.txt', 'ascii') def ShowIDLENEWS(self): - self.display_file_text('About - NEWS', 'NEWS.txt', 'ascii') + self.display_file_text('About - NEWS', 'NEWS.txt', 'utf-8') def display_printer_text(self, title, printer): printer._Printer__setup() @@ -144,5 +144,7 @@ self.destroy() if __name__ == '__main__': + import unittest + unittest.main('idlelib.idle_test.test_helpabout', verbosity=2, exit=False) from idlelib.idle_test.htest import run run(AboutDialog) diff --git a/Lib/idlelib/idle_test/test_helpabout.py b/Lib/idlelib/idle_test/test_helpabout.py new file mode 100644 --- /dev/null +++ b/Lib/idlelib/idle_test/test_helpabout.py @@ -0,0 +1,52 @@ +'''Test idlelib.help_about. + +Coverage: +''' +from idlelib import aboutDialog as help_about +from idlelib import textView as textview +from idlelib.idle_test.mock_idle import Func +from idlelib.idle_test.mock_tk import Mbox +import unittest + +About = help_about.AboutDialog +class Dummy_about_dialog(): + # Dummy class for testing file display functions. + idle_credits = About.ShowIDLECredits.im_func + idle_readme = About.ShowIDLEAbout.im_func + idle_news = About.ShowIDLENEWS.im_func + # Called by the above + display_file_text = About.display_file_text.im_func + + +class DisplayFileTest(unittest.TestCase): + "Test that .txt files are found and properly decoded." + dialog = Dummy_about_dialog() + + @classmethod + def setUpClass(cls): + cls.orig_mbox = textview.tkMessageBox + cls.orig_view = textview.view_text + cls.mbox = Mbox() + cls.view = Func() + textview.tkMessageBox = cls.mbox + textview.view_text = cls.view + cls.About = Dummy_about_dialog() + + @classmethod + def tearDownClass(cls): + textview.tkMessageBox = cls.orig_mbox + textview.view_text = cls.orig_view.im_func + + def test_file_isplay(self): + for handler in (self.dialog.idle_credits, + self.dialog.idle_readme, + self.dialog.idle_news): + self.mbox.showerror.message = '' + self.view.called = False + handler() + self.assertEqual(self.mbox.showerror.message, '') + self.assertEqual(self.view.called, True) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/Lib/idlelib/textView.py b/Lib/idlelib/textView.py --- a/Lib/idlelib/textView.py +++ b/Lib/idlelib/textView.py @@ -79,6 +79,10 @@ tkMessageBox.showerror(title='File Load Error', message='Unable to load file %r .' % filename, parent=parent) + except UnicodeDecodeError as err: + showerror(title='Unicode Decode Error', + message=str(err), + parent=parent) else: return view_text(parent, title, textFile.read(), modal) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,11 @@ - Issue #26930: Update Windows builds to use OpenSSL 1.0.2h. +IDLE +---- + +- Issue #27365: Fix about dialog. + What's New in Python 2.7.12 release candidate 1? ================================================ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 22 02:45:03 2016 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 22 Jun 2016 06:45:03 +0000 Subject: [Python-checkins] =?utf-8?q?release=3A_sphinx_upgrade?= Message-ID: <20160622064503.32534.97391.CD9A8512@psf.io> https://hg.python.org/release/rev/16acb5fdad36 changeset: 105:16acb5fdad36 user: Benjamin Peterson date: Tue Jun 21 23:44:54 2016 -0700 summary: sphinx upgrade files: release.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/release.py b/release.py --- a/release.py +++ b/release.py @@ -283,7 +283,7 @@ with tempfile.TemporaryDirectory() as venv: run_cmd(['python3', '-m', 'venv', venv]) pip = os.path.join(venv, 'bin', 'pip') - run_cmd([pip, 'install', 'Sphinx==1.3.3']) + run_cmd([pip, 'install', 'Sphinx==1.4.4']) # run_cmd([pip, 'install', 'Sphinx']) sphinx_build = os.path.join(venv, 'bin', 'sphinx-build') with changed_dir('Doc'): -- Repository URL: https://hg.python.org/release From python-checkins at python.org Wed Jun 22 02:47:33 2016 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 22 Jun 2016 06:47:33 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_alter_header?= =?utf-8?q?=3B_=27=25=27_really_throws_latex_through_a_loop?= Message-ID: <20160622064733.22167.95884.C676CA49@psf.io> https://hg.python.org/cpython/rev/cae0b7ffeb9f changeset: 102124:cae0b7ffeb9f branch: 3.5 parent: 102114:83d731f01dde user: Benjamin Peterson date: Tue Jun 21 23:47:16 2016 -0700 summary: alter header; '%' really throws latex through a loop files: Doc/whatsnew/3.5.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/3.5.rst b/Doc/whatsnew/3.5.rst --- a/Doc/whatsnew/3.5.rst +++ b/Doc/whatsnew/3.5.rst @@ -356,8 +356,8 @@ .. _whatsnew-pep-461: -PEP 461 - % formatting support for bytes and bytearray ------------------------------------------------------- +PEP 461 - percent formatting support for bytes and bytearray +------------------------------------------------------------ :pep:`461` adds support for the ``%`` :ref:`interpolation operator ` to :class:`bytes` -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 22 02:47:33 2016 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 22 Jun 2016 06:47:33 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogbWVyZ2UgMy41?= Message-ID: <20160622064733.129807.87685.50C03687@psf.io> https://hg.python.org/cpython/rev/75cf678bc78d changeset: 102125:75cf678bc78d parent: 102117:064b29dde096 parent: 102124:cae0b7ffeb9f user: Benjamin Peterson date: Tue Jun 21 23:47:24 2016 -0700 summary: merge 3.5 files: Doc/whatsnew/3.5.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/3.5.rst b/Doc/whatsnew/3.5.rst --- a/Doc/whatsnew/3.5.rst +++ b/Doc/whatsnew/3.5.rst @@ -356,8 +356,8 @@ .. _whatsnew-pep-461: -PEP 461 - % formatting support for bytes and bytearray ------------------------------------------------------- +PEP 461 - percent formatting support for bytes and bytearray +------------------------------------------------------------ :pep:`461` adds support for the ``%`` :ref:`interpolation operator ` to :class:`bytes` -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 22 03:19:00 2016 From: python-checkins at python.org (senthil.kumaran) Date: Wed, 22 Jun 2016 07:19:00 +0000 Subject: [Python-checkins] =?utf-8?q?test=3A_testing_hgtest=2E?= Message-ID: <20160622071847.6682.37891.4807DB2D@psf.io> https://hg.python.org/test/rev/7a80467cdf20 changeset: 233:7a80467cdf20 user: Senthil Kumaran date: Wed Jun 22 00:18:39 2016 -0700 summary: testing hgtest. files: quote | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/quote b/quote --- a/quote +++ b/quote @@ -13,3 +13,5 @@ There are only two kinds of languages: the ones people complain about and the ones nobody uses ? Bjarne Stroustrup +What I cannot create, I do not understand. +-- Richard P Feynman -- Repository URL: https://hg.python.org/test From python-checkins at python.org Wed Jun 22 03:56:31 2016 From: python-checkins at python.org (senthil.kumaran) Date: Wed, 22 Jun 2016 07:56:31 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Fix_the_urllib?= =?utf-8?q?=2Eparse=2Eurljoin_docs=2E_Reported_by_Bo_Bayles_in_docs_list?= =?utf-8?q?=2E?= Message-ID: <20160622075628.22059.90494.DB3B8215@psf.io> https://hg.python.org/cpython/rev/5cecd68851e8 changeset: 102126:5cecd68851e8 branch: 2.7 parent: 102123:7d25a93c135f user: Senthil Kumaran date: Wed Jun 22 00:56:22 2016 -0700 summary: Fix the urllib.parse.urljoin docs. Reported by Bo Bayles in docs list. files: Doc/library/urlparse.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/urlparse.rst b/Doc/library/urlparse.rst --- a/Doc/library/urlparse.rst +++ b/Doc/library/urlparse.rst @@ -258,7 +258,7 @@ .. doctest:: - >>> urljoin('https://www.cwi.nl/%7Eguido/Python.html', + >>> urljoin('http://www.cwi.nl/%7Eguido/Python.html', ... '//www.python.org/%7Eguido') 'http://www.python.org/%7Eguido' -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 22 03:57:54 2016 From: python-checkins at python.org (terry.reedy) Date: Wed, 22 Jun 2016 07:57:54 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MzY1?= =?utf-8?q?=3A_Allow_non-ascii_in_idlelib/NEWS=2Etxt_-_minimal_part_for_3?= =?utf-8?b?LjUuMi4=?= Message-ID: <20160622075753.7800.17802.604FAD64@psf.io> https://hg.python.org/cpython/rev/783dfd77e4c1 changeset: 102127:783dfd77e4c1 branch: 3.5 parent: 102124:cae0b7ffeb9f user: Terry Jan Reedy date: Wed Jun 22 03:55:20 2016 -0400 summary: Issue #27365: Allow non-ascii in idlelib/NEWS.txt - minimal part for 3.5.2. files: Lib/idlelib/NEWS.txt | 4 ++-- Lib/idlelib/aboutDialog.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -30,7 +30,7 @@ Original patch by Saimadhav Heblikar. - Issue #18410: Add test for IDLE's search dialog. - Original patch by Westley Mart?nez. + Original patch by Westley Mart??nez. - Issue #21703: Add test for undo delegator. Original patch by Saimadhav Heblikar . @@ -48,7 +48,7 @@ - Issue #25507: fix incorrect change in IOBinding that prevented printing. Augment IOBinding htest to include all major IOBinding functions. -- Issue #25905: Revert unwanted conversion of ' to ? RIGHT SINGLE QUOTATION +- Issue #25905: Revert unwanted conversion of ' to ??? RIGHT SINGLE QUOTATION MARK in README.txt and open this and NEWS.txt with 'ascii'. Re-encode CREDITS.txt to utf-8 and open it with 'utf-8'. diff --git a/Lib/idlelib/aboutDialog.py b/Lib/idlelib/aboutDialog.py --- a/Lib/idlelib/aboutDialog.py +++ b/Lib/idlelib/aboutDialog.py @@ -130,7 +130,7 @@ self.display_file_text('About - Readme', 'README.txt', 'ascii') def ShowIDLENEWS(self): - self.display_file_text('About - NEWS', 'NEWS.txt', 'ascii') + self.display_file_text('About - NEWS', 'NEWS.txt', 'utf-8') def display_printer_text(self, title, printer): printer._Printer__setup() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 22 03:57:57 2016 From: python-checkins at python.org (terry.reedy) Date: Wed, 22 Jun 2016 07:57:57 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327365=3A__Merge_minimal_part=2E?= Message-ID: <20160622075753.3805.34153.5908F21C@psf.io> https://hg.python.org/cpython/rev/b8926908d2a0 changeset: 102128:b8926908d2a0 parent: 102125:75cf678bc78d parent: 102127:783dfd77e4c1 user: Terry Jan Reedy date: Wed Jun 22 03:57:32 2016 -0400 summary: Issue #27365: Merge minimal part. files: Lib/idlelib/NEWS.txt | 4 ++-- Lib/idlelib/help_about.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -58,7 +58,7 @@ Original patch by Saimadhav Heblikar. - Issue #18410: Add test for IDLE's search dialog. - Original patch by Westley Mart?nez. + Original patch by Westley Mart??nez. - Issue #21703: Add test for undo delegator. Patch mostly by Saimadhav Heblikar . @@ -76,7 +76,7 @@ - Issue #25507: fix incorrect change in IOBinding that prevented printing. Augment IOBinding htest to include all major IOBinding functions. -- Issue #25905: Revert unwanted conversion of ' to ? RIGHT SINGLE QUOTATION +- Issue #25905: Revert unwanted conversion of ' to ??? RIGHT SINGLE QUOTATION MARK in README.txt and open this and NEWS.txt with 'ascii'. Re-encode CREDITS.txt to utf-8 and open it with 'utf-8'. diff --git a/Lib/idlelib/help_about.py b/Lib/idlelib/help_about.py --- a/Lib/idlelib/help_about.py +++ b/Lib/idlelib/help_about.py @@ -130,7 +130,7 @@ self.display_file_text('About - Readme', 'README.txt', 'ascii') def ShowIDLENEWS(self): - self.display_file_text('About - NEWS', 'NEWS.txt', 'ascii') + self.display_file_text('About - NEWS', 'NEWS.txt', 'utf-8') def display_printer_text(self, title, printer): printer._Printer__setup() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 22 04:25:02 2016 From: python-checkins at python.org (terry.reedy) Date: Wed, 22 Jun 2016 08:25:02 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327365=3A_temporar?= =?utf-8?q?y_rename?= Message-ID: <20160622082500.17595.82927.5C1A89E3@psf.io> https://hg.python.org/cpython/rev/e7ecad98a785 changeset: 102130:e7ecad98a785 parent: 102128:b8926908d2a0 user: Terry Jan Reedy date: Wed Jun 22 04:21:22 2016 -0400 summary: Issue #27365: temporary rename files: Lib/idlelib/textView.py | 0 1 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/textview.py b/Lib/idlelib/textView.py rename from Lib/idlelib/textview.py rename to Lib/idlelib/textView.py -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 22 04:25:20 2016 From: python-checkins at python.org (terry.reedy) Date: Wed, 22 Jun 2016 08:25:20 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MzY1?= =?utf-8?q?=3A_Allow_non-ascii_in_idlelib/NEWS=2Etxt=2C_for_contributor_na?= =?utf-8?q?mes=2E?= Message-ID: <20160622082449.572.22425.A77C9C1E@psf.io> https://hg.python.org/cpython/rev/d5ee1e5c1ac0 changeset: 102129:d5ee1e5c1ac0 branch: 3.5 parent: 102127:783dfd77e4c1 user: Terry Jan Reedy date: Wed Jun 22 04:17:28 2016 -0400 summary: Issue #27365: Allow non-ascii in idlelib/NEWS.txt, for contributor names. Rest of patch that should not be cherry picked into 3.5.2 final. files: Lib/idlelib/aboutDialog.py | 2 + Lib/idlelib/idle_test/test_help_about.py | 52 ++++++++++++ Lib/idlelib/textView.py | 4 + 3 files changed, 58 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/aboutDialog.py b/Lib/idlelib/aboutDialog.py --- a/Lib/idlelib/aboutDialog.py +++ b/Lib/idlelib/aboutDialog.py @@ -145,5 +145,7 @@ self.destroy() if __name__ == '__main__': + import unittest + unittest.main('idlelib.idle_test.test_helpabout', verbosity=2, exit=False) from idlelib.idle_test.htest import run run(AboutDialog) diff --git a/Lib/idlelib/idle_test/test_help_about.py b/Lib/idlelib/idle_test/test_help_about.py new file mode 100644 --- /dev/null +++ b/Lib/idlelib/idle_test/test_help_about.py @@ -0,0 +1,52 @@ +'''Test idlelib.help_about. + +Coverage: +''' +from idlelib import aboutDialog as help_about +from idlelib import textView as textview +from idlelib.idle_test.mock_idle import Func +from idlelib.idle_test.mock_tk import Mbox +import unittest + +About = help_about.AboutDialog +class Dummy_about_dialog(): + # Dummy class for testing file display functions. + idle_credits = About.ShowIDLECredits + idle_readme = About.ShowIDLEAbout + idle_news = About.ShowIDLENEWS + # Called by the above + display_file_text = About.display_file_text + + +class DisplayFileTest(unittest.TestCase): + "Test that .txt files are found and properly decoded." + dialog = Dummy_about_dialog() + + @classmethod + def setUpClass(cls): + cls.orig_mbox = textview.tkMessageBox + cls.orig_view = textview.view_text + cls.mbox = Mbox() + cls.view = Func() + textview.tkMessageBox = cls.mbox + textview.view_text = cls.view + cls.About = Dummy_about_dialog() + + @classmethod + def tearDownClass(cls): + textview.tkMessageBox = cls.orig_mbox + textview.view_text = cls.orig_view + + def test_file_isplay(self): + for handler in (self.dialog.idle_credits, + self.dialog.idle_readme, + self.dialog.idle_news): + self.mbox.showerror.message = '' + self.view.called = False + handler() + self.assertEqual(self.mbox.showerror.message, '') + self.assertEqual(self.view.called, True) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/Lib/idlelib/textView.py b/Lib/idlelib/textView.py --- a/Lib/idlelib/textView.py +++ b/Lib/idlelib/textView.py @@ -76,6 +76,10 @@ tkMessageBox.showerror(title='File Load Error', message='Unable to load file %r .' % filename, parent=parent) + except UnicodeDecodeError as err: + tkMessageBox.showerror(title='Unicode Decode Error', + message=str(err), + parent=parent) else: return view_text(parent, title, contents, modal) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 22 04:25:22 2016 From: python-checkins at python.org (terry.reedy) Date: Wed, 22 Jun 2016 08:25:22 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327365=3A_partial_merge?= Message-ID: <20160622082500.22436.10807.EF773637@psf.io> https://hg.python.org/cpython/rev/a4aa45859b5c changeset: 102131:a4aa45859b5c parent: 102130:e7ecad98a785 parent: 102129:d5ee1e5c1ac0 user: Terry Jan Reedy date: Wed Jun 22 04:24:27 2016 -0400 summary: Issue #27365: partial merge files: Lib/idlelib/idle_test/test_help_about.py | 52 ++++++++++++ Lib/idlelib/idle_test/test_textview.py | 16 +- Lib/idlelib/textView.py | 4 + 3 files changed, 64 insertions(+), 8 deletions(-) diff --git a/Lib/idlelib/idle_test/test_help_about.py b/Lib/idlelib/idle_test/test_help_about.py new file mode 100644 --- /dev/null +++ b/Lib/idlelib/idle_test/test_help_about.py @@ -0,0 +1,52 @@ +'''Test idlelib.help_about. + +Coverage: +''' +from idlelib import aboutDialog as help_about +from idlelib import textView as textview +from idlelib.idle_test.mock_idle import Func +from idlelib.idle_test.mock_tk import Mbox +import unittest + +About = help_about.AboutDialog +class Dummy_about_dialog(): + # Dummy class for testing file display functions. + idle_credits = About.ShowIDLECredits + idle_readme = About.ShowIDLEAbout + idle_news = About.ShowIDLENEWS + # Called by the above + display_file_text = About.display_file_text + + +class DisplayFileTest(unittest.TestCase): + "Test that .txt files are found and properly decoded." + dialog = Dummy_about_dialog() + + @classmethod + def setUpClass(cls): + cls.orig_mbox = textview.tkMessageBox + cls.orig_view = textview.view_text + cls.mbox = Mbox() + cls.view = Func() + textview.tkMessageBox = cls.mbox + textview.view_text = cls.view + cls.About = Dummy_about_dialog() + + @classmethod + def tearDownClass(cls): + textview.tkMessageBox = cls.orig_mbox + textview.view_text = cls.orig_view + + def test_file_isplay(self): + for handler in (self.dialog.idle_credits, + self.dialog.idle_readme, + self.dialog.idle_news): + self.mbox.showerror.message = '' + self.view.called = False + handler() + self.assertEqual(self.mbox.showerror.message, '') + self.assertEqual(self.view.called, True) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/Lib/idlelib/idle_test/test_textview.py b/Lib/idlelib/idle_test/test_textview.py --- a/Lib/idlelib/idle_test/test_textview.py +++ b/Lib/idlelib/idle_test/test_textview.py @@ -5,7 +5,7 @@ Using mock Text would not change this. Other mocks are used to retrieve information about calls. -The coverage is essentially 100%. +Coverage: 94%. ''' from idlelib import textview as tv from test.support import requires @@ -15,7 +15,7 @@ import os from tkinter import Tk from idlelib.idle_test.mock_idle import Func -from idlelib.idle_test.mock_tk import Mbox +from idlelib.idle_test.mock_tk import Mbox_func def setUpModule(): global root @@ -64,17 +64,17 @@ view.destroy -class textviewTest(unittest.TestCase): +class ViewFunctionTest(unittest.TestCase): @classmethod def setUpClass(cls): - cls.orig_mbox = tv.tkMessageBox - tv.tkMessageBox = Mbox + cls.orig_error = tv.showerror + tv.showerror = Mbox_func() @classmethod def tearDownClass(cls): - tv.tkMessageBox = cls.orig_mbox - del cls.orig_mbox + tv.showerror = cls.orig_error + del cls.orig_error def test_view_text(self): # If modal True, tkinter will error with 'can't invoke "event" command' @@ -89,7 +89,7 @@ self.assertIn('Test', view.textView.get('1.0', '1.end')) view.Ok() - # Mock messagebox will be used and view_file will not return anything + # Mock showerror will be used and view_file will return None testfile = os.path.join(test_dir, '../notthere.py') view = tv.view_file(root, 'Title', testfile, modal=False) self.assertIsNone(view) diff --git a/Lib/idlelib/textView.py b/Lib/idlelib/textView.py --- a/Lib/idlelib/textView.py +++ b/Lib/idlelib/textView.py @@ -77,6 +77,10 @@ tkMessageBox.showerror(title='File Load Error', message='Unable to load file %r .' % filename, parent=parent) + except UnicodeDecodeError as err: + tkMessageBox.showerror(title='Unicode Decode Error', + message=str(err), + parent=parent) else: return view_text(parent, title, contents, modal) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 22 04:51:10 2016 From: python-checkins at python.org (terry.reedy) Date: Wed, 22 Jun 2016 08:51:10 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327365=3A_revert__?= =?utf-8?q?temporary_rename?= Message-ID: <20160622085105.22035.88256.61C1DBFA@psf.io> https://hg.python.org/cpython/rev/54dde0cb10f9 changeset: 102132:54dde0cb10f9 user: Terry Jan Reedy date: Wed Jun 22 04:32:06 2016 -0400 summary: Issue #27365: revert temporary rename files: Lib/idlelib/textView.py | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/Lib/idlelib/textView.py b/Lib/idlelib/textView.py --- a/Lib/idlelib/textView.py +++ b/Lib/idlelib/textView.py @@ -77,10 +77,6 @@ tkMessageBox.showerror(title='File Load Error', message='Unable to load file %r .' % filename, parent=parent) - except UnicodeDecodeError as err: - tkMessageBox.showerror(title='Unicode Decode Error', - message=str(err), - parent=parent) else: return view_text(parent, title, contents, modal) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 22 04:51:09 2016 From: python-checkins at python.org (terry.reedy) Date: Wed, 22 Jun 2016 08:51:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327365=3A_add_chun?= =?utf-8?q?k?= Message-ID: <20160622085105.389.69415.375B3207@psf.io> https://hg.python.org/cpython/rev/be0dec826982 changeset: 102133:be0dec826982 user: Terry Jan Reedy date: Wed Jun 22 04:50:16 2016 -0400 summary: Issue #27365: add chunk files: Lib/idlelib/help_about.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/help_about.py b/Lib/idlelib/help_about.py --- a/Lib/idlelib/help_about.py +++ b/Lib/idlelib/help_about.py @@ -145,5 +145,7 @@ self.destroy() if __name__ == '__main__': + import unittest + unittest.main('idlelib.idle_test.test_helpabout', verbosity=2, exit=False) from idlelib.idle_test.htest import run run(AboutDialog) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 22 04:54:47 2016 From: python-checkins at python.org (terry.reedy) Date: Wed, 22 Jun 2016 08:54:47 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327365=3A_add_chun?= =?utf-8?q?k?= Message-ID: <20160622085438.367.34342.09B5BDFB@psf.io> https://hg.python.org/cpython/rev/3a122d0e4187 changeset: 102134:3a122d0e4187 user: Terry Jan Reedy date: Wed Jun 22 04:54:18 2016 -0400 summary: Issue #27365: add chunk files: Lib/idlelib/textView.py | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Lib/idlelib/textView.py b/Lib/idlelib/textView.py --- a/Lib/idlelib/textView.py +++ b/Lib/idlelib/textView.py @@ -4,7 +4,7 @@ from tkinter import * from tkinter.ttk import Scrollbar -import tkinter.messagebox as tkMessageBox +from tkinter.messagebox import showerror class TextViewer(Toplevel): """A simple text viewer dialog for IDLE @@ -73,10 +73,14 @@ try: with open(filename, 'r', encoding=encoding) as file: contents = file.read() - except IOError: - tkMessageBox.showerror(title='File Load Error', - message='Unable to load file %r .' % filename, - parent=parent) + except OSError: + showerror(title='File Load Error', + message='Unable to load file %r .' % filename, + parent=parent) + except UnicodeDecodeError as err: + showerror(title='Unicode Decode Error', + message=str(err), + parent=parent) else: return view_text(parent, title, contents, modal) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 22 04:57:56 2016 From: python-checkins at python.org (terry.reedy) Date: Wed, 22 Jun 2016 08:57:56 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327365=3A_revert__?= =?utf-8?q?temporary_rename?= Message-ID: <20160622085745.309.5220.9E9EB04A@psf.io> https://hg.python.org/cpython/rev/49323bb44229 changeset: 102135:49323bb44229 user: Terry Jan Reedy date: Wed Jun 22 04:57:23 2016 -0400 summary: Issue #27365: revert temporary rename files: Lib/idlelib/textview.py | 0 1 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/textView.py b/Lib/idlelib/textview.py rename from Lib/idlelib/textView.py rename to Lib/idlelib/textview.py -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 22 05:50:11 2016 From: python-checkins at python.org (terry.reedy) Date: Wed, 22 Jun 2016 09:50:11 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327365=3A_Finish_m?= =?utf-8?q?erge_so_tests_pass=2E?= Message-ID: <20160622094949.129788.12340.75250378@psf.io> https://hg.python.org/cpython/rev/33769ce40b47 changeset: 102136:33769ce40b47 user: Terry Jan Reedy date: Wed Jun 22 05:49:15 2016 -0400 summary: Issue #27365: Finish merge so tests pass. files: Lib/idlelib/help_about.py | 2 +- Lib/idlelib/idle_test/test_help_about.py | 24 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Lib/idlelib/help_about.py b/Lib/idlelib/help_about.py --- a/Lib/idlelib/help_about.py +++ b/Lib/idlelib/help_about.py @@ -146,6 +146,6 @@ if __name__ == '__main__': import unittest - unittest.main('idlelib.idle_test.test_helpabout', verbosity=2, exit=False) + unittest.main('idlelib.idle_test.test_help_about', verbosity=2, exit=False) from idlelib.idle_test.htest import run run(AboutDialog) diff --git a/Lib/idlelib/idle_test/test_help_about.py b/Lib/idlelib/idle_test/test_help_about.py --- a/Lib/idlelib/idle_test/test_help_about.py +++ b/Lib/idlelib/idle_test/test_help_about.py @@ -2,10 +2,10 @@ Coverage: ''' -from idlelib import aboutDialog as help_about -from idlelib import textView as textview +from idlelib import help_about +from idlelib import textview from idlelib.idle_test.mock_idle import Func -from idlelib.idle_test.mock_tk import Mbox +from idlelib.idle_test.mock_tk import Mbox_func import unittest About = help_about.AboutDialog @@ -19,33 +19,33 @@ class DisplayFileTest(unittest.TestCase): - "Test that .txt files are found and properly decoded." dialog = Dummy_about_dialog() @classmethod def setUpClass(cls): - cls.orig_mbox = textview.tkMessageBox + cls.orig_error = textview.showerror cls.orig_view = textview.view_text - cls.mbox = Mbox() + cls.error = Mbox_func() cls.view = Func() - textview.tkMessageBox = cls.mbox + textview.showerror = cls.error textview.view_text = cls.view cls.About = Dummy_about_dialog() @classmethod def tearDownClass(cls): - textview.tkMessageBox = cls.orig_mbox + textview.showerror = cls.orig_error textview.view_text = cls.orig_view def test_file_isplay(self): for handler in (self.dialog.idle_credits, self.dialog.idle_readme, self.dialog.idle_news): - self.mbox.showerror.message = '' + self.error.message = '' self.view.called = False - handler() - self.assertEqual(self.mbox.showerror.message, '') - self.assertEqual(self.view.called, True) + with self.subTest(handler=handler): + handler() + self.assertEqual(self.error.message, '') + self.assertEqual(self.view.called, True) if __name__ == '__main__': -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Wed Jun 22 06:00:15 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 22 Jun 2016 10:00:15 +0000 Subject: [Python-checkins] Daily reference leaks (064b29dde096): sum=5 Message-ID: <20160622100014.22331.74233.DAFC0825@psf.io> results for 064b29dde096 on branch "default" -------------------------------------------- test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [2, 0, -1] memory blocks, sum=1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflog71X3Nl', '--timeout', '7200'] From lp_benchmark_robot at intel.com Wed Jun 22 12:08:40 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 22 Jun 2016 17:08:40 +0100 Subject: [Python-checkins] BAD Benchmark Results for Python Default 2016-06-22 Message-ID: Results for project Python default, build date 2016-06-22 02:02:44 +0000 commit: 064b29dde096 previous commit: 703d9066c459 revision date: 2016-06-21 22:41:38 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.24% -3.20% 8.41% 17.71% :-| pybench 0.14% -0.07% 1.34% 7.00% :-| regex_v8 2.72% -0.12% -1.85% 2.82% :-| nbody 0.26% -0.23% -0.88% 9.43% :-( json_dump_v2 0.38% -1.56% -2.86% 13.17% :-| normal_startup 0.86% -0.26% 1.42% 5.80% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/bad-benchmark-results-for-python-default-2016-06-22/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Wed Jun 22 12:09:11 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 22 Jun 2016 17:09:11 +0100 Subject: [Python-checkins] BAD Benchmark Results for Python 2.7 2016-06-22 Message-ID: <39df8628-3066-4740-809d-e108f74c0860@irsmsx101.ger.corp.intel.com> Results for project Python 2.7, build date 2016-06-22 02:46:56 +0000 commit: b1c1c297bead previous commit: 340a91cccac8 revision date: 2016-06-22 02:04:38 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.18% -1.33% 3.64% 6.34% :-) pybench 0.15% -0.10% 5.63% 5.12% :-( regex_v8 0.50% -0.09% -2.54% 10.77% :-) nbody 0.05% -0.02% 8.96% 3.26% :-) json_dump_v2 0.42% 0.05% 2.25% 11.14% :-( normal_startup 1.84% -0.38% -5.91% 2.10% :-| ssbench 0.11% -0.72% 1.24% 2.24% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/bad-benchmark-results-for-python-2-7-2016-06-22/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Wed Jun 22 21:08:33 2016 From: python-checkins at python.org (martin.panter) Date: Thu, 23 Jun 2016 01:08:33 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI3Mzcw?= =?utf-8?q?=3A_Use_t_for_an_iterable_in_mutable_sequence_ops?= Message-ID: <20160623005754.102406.68298.D58AC087@psf.io> https://hg.python.org/cpython/rev/c91007ab3fda changeset: 102137:c91007ab3fda branch: 2.7 parent: 102126:5cecd68851e8 user: Martin Panter date: Thu Jun 23 00:53:05 2016 +0000 summary: Issue #27370: Use t for an iterable in mutable sequence ops 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 @@ -1670,8 +1670,8 @@ | ``s.append(x)`` | same as ``s[len(s):len(s)] = | \(2) | | | [x]`` | | +------------------------------+--------------------------------+---------------------+ -| ``s.extend(x)`` or | for the most part the same as | \(3) | -| ``s += t`` | ``s[len(s):len(s)] = x`` | | +| ``s.extend(t)`` or | for the most part the same as | \(3) | +| ``s += t`` | ``s[len(s):len(s)] = t`` | | +------------------------------+--------------------------------+---------------------+ | ``s *= n`` | updates *s* with its contents | \(11) | | | repeated *n* times | | @@ -1708,7 +1708,7 @@ this misfeature has been deprecated since Python 1.4. (3) - *x* can be any iterable object. + *t* can be any iterable object. (4) Raises :exc:`ValueError` when *x* is not found in *s*. When a negative index is -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 22 22:47:13 2016 From: python-checkins at python.org (terry.reedy) Date: Thu, 23 Jun 2016 02:47:13 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_with_3=2E5?= Message-ID: <20160623024713.10086.63266.621D3B0E@psf.io> https://hg.python.org/cpython/rev/f6b8b1e5d24d changeset: 102139:f6b8b1e5d24d parent: 102136:33769ce40b47 parent: 102138:e3b4033e0ea7 user: Terry Jan Reedy date: Wed Jun 22 22:46:51 2016 -0400 summary: Merge with 3.5 files: Doc/library/dbm.rst | 10 ++++++++++ Doc/library/importlib.rst | 14 ++++++++++++++ Doc/library/json.rst | 8 +++++++- 3 files changed, 31 insertions(+), 1 deletions(-) diff --git a/Doc/library/dbm.rst b/Doc/library/dbm.rst --- a/Doc/library/dbm.rst +++ b/Doc/library/dbm.rst @@ -128,6 +128,9 @@ :platform: Unix :synopsis: GNU's reinterpretation of dbm. +**Source code:** :source:`Lib/dbm/gnu.py` + +-------------- This module is quite similar to the :mod:`dbm` module, but uses the GNU library ``gdbm`` instead to provide some additional functionality. Please note that the @@ -237,6 +240,9 @@ :platform: Unix :synopsis: The standard "database" interface, based on ndbm. +**Source code:** :source:`Lib/dbm/ndbm.py` + +-------------- The :mod:`dbm.ndbm` module provides an interface to the Unix "(n)dbm" library. Dbm objects behave like mappings (dictionaries), except that keys and values are @@ -299,6 +305,8 @@ .. module:: dbm.dumb :synopsis: Portable implementation of the simple DBM interface. +**Source code:** :source:`Lib/dbm/dumb.py` + .. index:: single: databases .. note:: @@ -308,6 +316,8 @@ module is not written for speed and is not nearly as heavily used as the other database modules. +-------------- + The :mod:`dbm.dumb` module provides a persistent dictionary-like interface which is written entirely in Python. Unlike other modules such as :mod:`dbm.gnu` no external library is required. As with other persistent mappings, the keys and diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -211,6 +211,11 @@ .. module:: importlib.abc :synopsis: Abstract base classes related to import +**Source code:** :source:`Lib/importlib/abc.py` + +-------------- + + The :mod:`importlib.abc` module contains all of the core abstract base classes used by :keyword:`import`. Some subclasses of the core abstract base classes are also provided to help in implementing the core ABCs. @@ -700,6 +705,10 @@ .. module:: importlib.machinery :synopsis: Importers and path hooks +**Source code:** :source:`Lib/importlib/machinery.py` + +-------------- + This module contains the various objects that help :keyword:`import` find and load modules. @@ -1090,6 +1099,11 @@ .. module:: importlib.util :synopsis: Utility code for importers + +**Source code:** :source:`Lib/importlib/util.py` + +-------------- + This module contains the various objects that help in the construction of an :term:`importer`. diff --git a/Doc/library/json.rst b/Doc/library/json.rst --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -641,13 +641,19 @@ :class:`decimal.Decimal`. .. highlight:: bash -.. module:: json.tool .. _json-commandline: Command Line Interface ---------------------- +.. module:: json.tool + :synopsis: A command line to validate and pretty-print JSON. + +**Source code:** :source:`Lib/json/tool.py` + +-------------- + The :mod:`json.tool` module provides a simple command line interface to validate and pretty-print JSON objects. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 22 22:47:13 2016 From: python-checkins at python.org (terry.reedy) Date: Thu, 23 Jun 2016 02:47:13 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MzA0?= =?utf-8?q?=3A_Source_code_links_for_sub-packages_in_the_same_file=2E?= Message-ID: <20160623024713.3805.34482.EE91C4F3@psf.io> https://hg.python.org/cpython/rev/e3b4033e0ea7 changeset: 102138:e3b4033e0ea7 branch: 3.5 parent: 102129:d5ee1e5c1ac0 user: Terry Jan Reedy date: Wed Jun 22 22:46:34 2016 -0400 summary: Issue #27304: Source code links for sub-packages in the same file. Patch by Yoni Lavi files: Doc/library/dbm.rst | 10 ++++++++++ Doc/library/importlib.rst | 14 ++++++++++++++ Doc/library/json.rst | 8 +++++++- 3 files changed, 31 insertions(+), 1 deletions(-) diff --git a/Doc/library/dbm.rst b/Doc/library/dbm.rst --- a/Doc/library/dbm.rst +++ b/Doc/library/dbm.rst @@ -128,6 +128,9 @@ :platform: Unix :synopsis: GNU's reinterpretation of dbm. +**Source code:** :source:`Lib/dbm/gnu.py` + +-------------- This module is quite similar to the :mod:`dbm` module, but uses the GNU library ``gdbm`` instead to provide some additional functionality. Please note that the @@ -237,6 +240,9 @@ :platform: Unix :synopsis: The standard "database" interface, based on ndbm. +**Source code:** :source:`Lib/dbm/ndbm.py` + +-------------- The :mod:`dbm.ndbm` module provides an interface to the Unix "(n)dbm" library. Dbm objects behave like mappings (dictionaries), except that keys and values are @@ -299,6 +305,8 @@ .. module:: dbm.dumb :synopsis: Portable implementation of the simple DBM interface. +**Source code:** :source:`Lib/dbm/dumb.py` + .. index:: single: databases .. note:: @@ -308,6 +316,8 @@ module is not written for speed and is not nearly as heavily used as the other database modules. +-------------- + The :mod:`dbm.dumb` module provides a persistent dictionary-like interface which is written entirely in Python. Unlike other modules such as :mod:`dbm.gnu` no external library is required. As with other persistent mappings, the keys and diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -211,6 +211,11 @@ .. module:: importlib.abc :synopsis: Abstract base classes related to import +**Source code:** :source:`Lib/importlib/abc.py` + +-------------- + + The :mod:`importlib.abc` module contains all of the core abstract base classes used by :keyword:`import`. Some subclasses of the core abstract base classes are also provided to help in implementing the core ABCs. @@ -700,6 +705,10 @@ .. module:: importlib.machinery :synopsis: Importers and path hooks +**Source code:** :source:`Lib/importlib/machinery.py` + +-------------- + This module contains the various objects that help :keyword:`import` find and load modules. @@ -1082,6 +1091,11 @@ .. module:: importlib.util :synopsis: Utility code for importers + +**Source code:** :source:`Lib/importlib/util.py` + +-------------- + This module contains the various objects that help in the construction of an :term:`importer`. diff --git a/Doc/library/json.rst b/Doc/library/json.rst --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -629,13 +629,19 @@ :class:`decimal.Decimal`. .. highlight:: bash -.. module:: json.tool .. _json-commandline: Command Line Interface ---------------------- +.. module:: json.tool + :synopsis: A command line to validate and pretty-print JSON. + +**Source code:** :source:`Lib/json/tool.py` + +-------------- + The :mod:`json.tool` module provides a simple command line interface to validate and pretty-print JSON objects. -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Thu Jun 23 04:46:35 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 23 Jun 2016 08:46:35 +0000 Subject: [Python-checkins] Daily reference leaks (f6b8b1e5d24d): sum=4 Message-ID: <20160623084635.22212.4448.E72A676B@psf.io> results for f6b8b1e5d24d on branch "default" -------------------------------------------- test_collections leaked [0, 4, -4] memory blocks, sum=0 test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogET7cyB', '--timeout', '7200'] From lp_benchmark_robot at intel.com Thu Jun 23 12:29:38 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 23 Jun 2016 17:29:38 +0100 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python Default 2016-06-23 Message-ID: Results for project Python default, build date 2016-06-23 02:02:33 +0000 commit: 33769ce40b47 previous commit: 064b29dde096 revision date: 2016-06-22 09:49:15 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.19% 0.42% 8.80% 17.35% :-| pybench 0.20% 0.03% 1.37% 8.05% :-| regex_v8 2.71% 0.14% -1.71% 2.62% :-| nbody 0.17% 0.32% -0.56% 10.16% :-( json_dump_v2 0.34% -0.60% -3.48% 14.43% :-| normal_startup 0.98% 0.01% 1.20% 5.08% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-default-2016-06-23/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Thu Jun 23 12:30:16 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 23 Jun 2016 17:30:16 +0100 Subject: [Python-checkins] GOOD Benchmark Results for Python 2.7 2016-06-23 Message-ID: <69b4a8ae-49b7-4ac6-9eb6-15085caccf76@irsmsx103.ger.corp.intel.com> Results for project Python 2.7, build date 2016-06-23 02:49:01 +0000 commit: c91007ab3fda previous commit: b1c1c297bead revision date: 2016-06-23 00:53:05 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.15% 1.16% 4.76% 6.70% :-) pybench 0.18% 0.09% 5.71% 4.71% :-( regex_v8 0.48% 0.18% -2.35% 10.86% :-) nbody 0.06% -0.33% 8.66% 4.08% :-) json_dump_v2 0.46% 0.51% 2.75% 12.11% :-( normal_startup 1.64% 0.15% -5.76% 1.99% :-) ssbench 0.21% 0.76% 2.00% 1.80% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-2-7-2016-06-23/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Thu Jun 23 17:01:04 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 23 Jun 2016 21:01:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Fixed_integer_overflow_in_array=2Ebuffer=5Finfo=28=29=2E?= Message-ID: <20160623210104.4183.3506.E80EFDB2@psf.io> https://hg.python.org/cpython/rev/8955d8aaf351 changeset: 102141:8955d8aaf351 parent: 102139:f6b8b1e5d24d parent: 102140:b8cd52d18fbb user: Serhiy Storchaka date: Thu Jun 23 23:56:46 2016 +0300 summary: Fixed integer overflow in array.buffer_info(). files: Modules/arraymodule.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -1268,7 +1268,7 @@ } PyTuple_SET_ITEM(retval, 0, v); - v = PyLong_FromLong((long)(Py_SIZE(self))); + v = PyLong_FromSsize_t(Py_SIZE(self)); if (v == NULL) { Py_DECREF(retval); return NULL; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 23 17:01:04 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 23 Jun 2016 21:01:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Fixed_integer_?= =?utf-8?q?overflow_in_array=2Ebuffer=5Finfo=28=29=2E?= Message-ID: <20160623210104.22167.53928.BA84190D@psf.io> https://hg.python.org/cpython/rev/b8cd52d18fbb changeset: 102140:b8cd52d18fbb branch: 3.5 parent: 102138:e3b4033e0ea7 user: Serhiy Storchaka date: Thu Jun 23 23:55:34 2016 +0300 summary: Fixed integer overflow in array.buffer_info(). files: Modules/arraymodule.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -1268,7 +1268,7 @@ } PyTuple_SET_ITEM(retval, 0, v); - v = PyLong_FromLong((long)(Py_SIZE(self))); + v = PyLong_FromSsize_t(Py_SIZE(self)); if (v == NULL) { Py_DECREF(retval); return NULL; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 23 17:01:04 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 23 Jun 2016 21:01:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Fixed_integer_?= =?utf-8?q?overflow_and_handled_MemoryError_in_array=2Ebuffer=5Finfo=28=29?= =?utf-8?q?=2E?= Message-ID: <20160623210104.760.37342.8170A557@psf.io> https://hg.python.org/cpython/rev/14a905f6b6c6 changeset: 102142:14a905f6b6c6 branch: 2.7 parent: 102137:c91007ab3fda user: Serhiy Storchaka date: Fri Jun 24 00:00:32 2016 +0300 summary: Fixed integer overflow and handled MemoryError in array.buffer_info(). files: Modules/arraymodule.c | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -1067,13 +1067,25 @@ static PyObject * array_buffer_info(arrayobject *self, PyObject *unused) { - PyObject* retval = NULL; + PyObject *retval = NULL, *v; + retval = PyTuple_New(2); if (!retval) return NULL; - PyTuple_SET_ITEM(retval, 0, PyLong_FromVoidPtr(self->ob_item)); - PyTuple_SET_ITEM(retval, 1, PyInt_FromLong((long)(Py_SIZE(self)))); + v = PyLong_FromVoidPtr(self->ob_item); + if (v == NULL) { + Py_DECREF(retval); + return NULL; + } + PyTuple_SET_ITEM(retval, 0, v); + + v = PyLong_FromSsize_t(Py_SIZE(self)); + if (v == NULL) { + Py_DECREF(retval); + return NULL; + } + PyTuple_SET_ITEM(retval, 1, v); return retval; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 23 18:07:59 2016 From: python-checkins at python.org (terry.reedy) Date: Thu, 23 Jun 2016 22:07:59 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI3MzY1?= =?utf-8?q?=3A_Add_blank_lines=2E_to_2=2E7_test=5Feditmenu?= Message-ID: <20160623220759.10149.99932.B81798F4@psf.io> https://hg.python.org/cpython/rev/cbc6407fa393 changeset: 102143:cbc6407fa393 branch: 2.7 user: Terry Jan Reedy date: Thu Jun 23 18:07:46 2016 -0400 summary: Issue #27365: Add blank lines. to 2.7 test_editmenu files: Lib/idlelib/idle_test/test_editmenu.py | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/idle_test/test_editmenu.py b/Lib/idlelib/idle_test/test_editmenu.py --- a/Lib/idlelib/idle_test/test_editmenu.py +++ b/Lib/idlelib/idle_test/test_editmenu.py @@ -7,11 +7,13 @@ import unittest from idlelib import PyShell + class PasteTest(unittest.TestCase): '''Test pasting into widgets that allow pasting. On X11, replacing selections requires tk fix. ''' + @classmethod def setUpClass(cls): requires('gui') -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 24 01:39:25 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Fri, 24 Jun 2016 05:39:25 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogYXJyYXkuYnVmZmVy?= =?utf-8?q?=5Finfo=28=29_should_return_a_length_as_int=2C_not_long=2C_for_?= =?utf-8?q?compatibility=2E?= Message-ID: <20160624053925.10300.21472.3F22A603@psf.io> https://hg.python.org/cpython/rev/c3a3ac173bb7 changeset: 102144:c3a3ac173bb7 branch: 2.7 user: Serhiy Storchaka date: Fri Jun 24 08:38:59 2016 +0300 summary: array.buffer_info() should return a length as int, not long, for compatibility. files: Modules/arraymodule.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -1080,7 +1080,7 @@ } PyTuple_SET_ITEM(retval, 0, v); - v = PyLong_FromSsize_t(Py_SIZE(self)); + v = PyInt_FromSsize_t(Py_SIZE(self)); if (v == NULL) { Py_DECREF(retval); return NULL; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 24 01:47:31 2016 From: python-checkins at python.org (berker.peksag) Date: Fri, 24 Jun 2016 05:47:31 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Make_PyPIRCCom?= =?utf-8?q?mandTestCase_derive_from_a_base_class?= Message-ID: <20160624054731.102406.83443.AF0D62A9@psf.io> https://hg.python.org/cpython/rev/4be806b230ef changeset: 102145:4be806b230ef branch: 3.5 parent: 102140:b8cd52d18fbb user: Berker Peksag date: Fri Jun 24 08:48:27 2016 +0300 summary: Make PyPIRCCommandTestCase derive from a base class Several test cases in distutils use PyPIRCCommandTestCase as their base class and as a result of that the following tests were ran more than once: * test_server_registration * test_server_empty_registration * test_config_interpolation This commit moves the infrastructure used by other tests into a new BasePyPIRCCommandTestCase class. files: Lib/distutils/tests/test_config.py | 9 ++++++--- Lib/distutils/tests/test_register.py | 4 ++-- Lib/distutils/tests/test_sdist.py | 4 ++-- Lib/distutils/tests/test_upload.py | 4 ++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Lib/distutils/tests/test_config.py b/Lib/distutils/tests/test_config.py --- a/Lib/distutils/tests/test_config.py +++ b/Lib/distutils/tests/test_config.py @@ -52,14 +52,14 @@ """ -class PyPIRCCommandTestCase(support.TempdirManager, +class BasePyPIRCCommandTestCase(support.TempdirManager, support.LoggingSilencer, support.EnvironGuard, unittest.TestCase): def setUp(self): """Patches the environment.""" - super(PyPIRCCommandTestCase, self).setUp() + super(BasePyPIRCCommandTestCase, self).setUp() self.tmp_dir = self.mkdtemp() os.environ['HOME'] = self.tmp_dir self.rc = os.path.join(self.tmp_dir, '.pypirc') @@ -78,7 +78,10 @@ def tearDown(self): """Removes the patch.""" set_threshold(self.old_threshold) - super(PyPIRCCommandTestCase, self).tearDown() + super(BasePyPIRCCommandTestCase, self).tearDown() + + +class PyPIRCCommandTestCase(BasePyPIRCCommandTestCase): def test_server_registration(self): # This test makes sure PyPIRCCommand knows how to: diff --git a/Lib/distutils/tests/test_register.py b/Lib/distutils/tests/test_register.py --- a/Lib/distutils/tests/test_register.py +++ b/Lib/distutils/tests/test_register.py @@ -12,7 +12,7 @@ from distutils.errors import DistutilsSetupError from distutils.log import INFO -from distutils.tests.test_config import PyPIRCCommandTestCase +from distutils.tests.test_config import BasePyPIRCCommandTestCase try: import docutils @@ -72,7 +72,7 @@ }.get(name.lower(), default) -class RegisterTestCase(PyPIRCCommandTestCase): +class RegisterTestCase(BasePyPIRCCommandTestCase): def setUp(self): super(RegisterTestCase, self).setUp() diff --git a/Lib/distutils/tests/test_sdist.py b/Lib/distutils/tests/test_sdist.py --- a/Lib/distutils/tests/test_sdist.py +++ b/Lib/distutils/tests/test_sdist.py @@ -23,7 +23,7 @@ from distutils.command.sdist import sdist, show_formats from distutils.core import Distribution -from distutils.tests.test_config import PyPIRCCommandTestCase +from distutils.tests.test_config import BasePyPIRCCommandTestCase from distutils.errors import DistutilsOptionError from distutils.spawn import find_executable from distutils.log import WARN @@ -52,7 +52,7 @@ somecode%(sep)sdoc.txt """ -class SDistTestCase(PyPIRCCommandTestCase): +class SDistTestCase(BasePyPIRCCommandTestCase): def setUp(self): # PyPIRCCommandTestCase creates a temp dir already diff --git a/Lib/distutils/tests/test_upload.py b/Lib/distutils/tests/test_upload.py --- a/Lib/distutils/tests/test_upload.py +++ b/Lib/distutils/tests/test_upload.py @@ -12,7 +12,7 @@ from distutils.errors import DistutilsError from distutils.log import ERROR, INFO -from distutils.tests.test_config import PYPIRC, PyPIRCCommandTestCase +from distutils.tests.test_config import PYPIRC, BasePyPIRCCommandTestCase PYPIRC_LONG_PASSWORD = """\ [distutils] @@ -66,7 +66,7 @@ return self.code -class uploadTestCase(PyPIRCCommandTestCase): +class uploadTestCase(BasePyPIRCCommandTestCase): def setUp(self): super(uploadTestCase, self).setUp() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 24 01:47:31 2016 From: python-checkins at python.org (berker.peksag) Date: Fri, 24 Jun 2016 05:47:31 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5?= Message-ID: <20160624054731.3880.76482.04F4ADB2@psf.io> https://hg.python.org/cpython/rev/b4abc30a590a changeset: 102146:b4abc30a590a parent: 102141:8955d8aaf351 parent: 102145:4be806b230ef user: Berker Peksag date: Fri Jun 24 08:48:46 2016 +0300 summary: Merge from 3.5 files: Lib/distutils/tests/test_config.py | 9 ++++++--- Lib/distutils/tests/test_register.py | 4 ++-- Lib/distutils/tests/test_sdist.py | 4 ++-- Lib/distutils/tests/test_upload.py | 4 ++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Lib/distutils/tests/test_config.py b/Lib/distutils/tests/test_config.py --- a/Lib/distutils/tests/test_config.py +++ b/Lib/distutils/tests/test_config.py @@ -50,14 +50,14 @@ """ -class PyPIRCCommandTestCase(support.TempdirManager, +class BasePyPIRCCommandTestCase(support.TempdirManager, support.LoggingSilencer, support.EnvironGuard, unittest.TestCase): def setUp(self): """Patches the environment.""" - super(PyPIRCCommandTestCase, self).setUp() + super(BasePyPIRCCommandTestCase, self).setUp() self.tmp_dir = self.mkdtemp() os.environ['HOME'] = self.tmp_dir self.rc = os.path.join(self.tmp_dir, '.pypirc') @@ -76,7 +76,10 @@ def tearDown(self): """Removes the patch.""" set_threshold(self.old_threshold) - super(PyPIRCCommandTestCase, self).tearDown() + super(BasePyPIRCCommandTestCase, self).tearDown() + + +class PyPIRCCommandTestCase(BasePyPIRCCommandTestCase): def test_server_registration(self): # This test makes sure PyPIRCCommand knows how to: diff --git a/Lib/distutils/tests/test_register.py b/Lib/distutils/tests/test_register.py --- a/Lib/distutils/tests/test_register.py +++ b/Lib/distutils/tests/test_register.py @@ -12,7 +12,7 @@ from distutils.errors import DistutilsSetupError from distutils.log import INFO -from distutils.tests.test_config import PyPIRCCommandTestCase +from distutils.tests.test_config import BasePyPIRCCommandTestCase try: import docutils @@ -72,7 +72,7 @@ }.get(name.lower(), default) -class RegisterTestCase(PyPIRCCommandTestCase): +class RegisterTestCase(BasePyPIRCCommandTestCase): def setUp(self): super(RegisterTestCase, self).setUp() diff --git a/Lib/distutils/tests/test_sdist.py b/Lib/distutils/tests/test_sdist.py --- a/Lib/distutils/tests/test_sdist.py +++ b/Lib/distutils/tests/test_sdist.py @@ -23,7 +23,7 @@ from distutils.command.sdist import sdist, show_formats from distutils.core import Distribution -from distutils.tests.test_config import PyPIRCCommandTestCase +from distutils.tests.test_config import BasePyPIRCCommandTestCase from distutils.errors import DistutilsOptionError from distutils.spawn import find_executable from distutils.log import WARN @@ -52,7 +52,7 @@ somecode%(sep)sdoc.txt """ -class SDistTestCase(PyPIRCCommandTestCase): +class SDistTestCase(BasePyPIRCCommandTestCase): def setUp(self): # PyPIRCCommandTestCase creates a temp dir already diff --git a/Lib/distutils/tests/test_upload.py b/Lib/distutils/tests/test_upload.py --- a/Lib/distutils/tests/test_upload.py +++ b/Lib/distutils/tests/test_upload.py @@ -12,7 +12,7 @@ from distutils.errors import DistutilsError from distutils.log import ERROR, INFO -from distutils.tests.test_config import PYPIRC, PyPIRCCommandTestCase +from distutils.tests.test_config import PYPIRC, BasePyPIRCCommandTestCase PYPIRC_LONG_PASSWORD = """\ [distutils] @@ -66,7 +66,7 @@ return self.code -class uploadTestCase(PyPIRCCommandTestCase): +class uploadTestCase(BasePyPIRCCommandTestCase): def setUp(self): super(uploadTestCase, self).setUp() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 24 01:53:48 2016 From: python-checkins at python.org (berker.peksag) Date: Fri, 24 Jun 2016 05:53:48 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327378=3A_Merge_from_3=2E5?= Message-ID: <20160624055348.4089.51351.4E742B23@psf.io> https://hg.python.org/cpython/rev/21cb299a9626 changeset: 102148:21cb299a9626 parent: 102146:b4abc30a590a parent: 102147:23182404a85c user: Berker Peksag date: Fri Jun 24 08:55:06 2016 +0300 summary: Issue #27378: Merge from 3.5 files: Doc/howto/regex.rst | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/Doc/howto/regex.rst b/Doc/howto/regex.rst --- a/Doc/howto/regex.rst +++ b/Doc/howto/regex.rst @@ -374,9 +374,7 @@ :source:`Tools/demo/redemo.py`, a demonstration program included with the Python distribution. It allows you to enter REs and strings, and displays whether the RE matches or fails. :file:`redemo.py` can be quite useful when -trying to debug a complicated RE. Phil Schwartz's `Kodos -`_ is also an interactive tool for developing and -testing RE patterns. +trying to debug a complicated RE. This HOWTO uses the standard Python interpreter for its examples. First, run the Python interpreter, import the :mod:`re` module, and compile a RE:: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 24 01:53:48 2016 From: python-checkins at python.org (berker.peksag) Date: Fri, 24 Jun 2016 05:53:48 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3Mzc4?= =?utf-8?q?=3A_Remove_an_outdated_reference_from_regex_HOWTO?= Message-ID: <20160624055348.119573.9701.DDD52760@psf.io> https://hg.python.org/cpython/rev/23182404a85c changeset: 102147:23182404a85c branch: 3.5 parent: 102145:4be806b230ef user: Berker Peksag date: Fri Jun 24 08:54:43 2016 +0300 summary: Issue #27378: Remove an outdated reference from regex HOWTO Patch by Matt Morrison. files: Doc/howto/regex.rst | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/Doc/howto/regex.rst b/Doc/howto/regex.rst --- a/Doc/howto/regex.rst +++ b/Doc/howto/regex.rst @@ -374,9 +374,7 @@ :source:`Tools/demo/redemo.py`, a demonstration program included with the Python distribution. It allows you to enter REs and strings, and displays whether the RE matches or fails. :file:`redemo.py` can be quite useful when -trying to debug a complicated RE. Phil Schwartz's `Kodos -`_ is also an interactive tool for developing and -testing RE patterns. +trying to debug a complicated RE. This HOWTO uses the standard Python interpreter for its examples. First, run the Python interpreter, import the :mod:`re` module, and compile a RE:: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 24 02:11:01 2016 From: python-checkins at python.org (berker.peksag) Date: Fri, 24 Jun 2016 06:11:01 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI2NTQ3?= =?utf-8?q?=3A_Remove_outdated_term_dictproxy_from_vars=28=29_documentatio?= =?utf-8?q?n?= Message-ID: <20160624061101.3945.72193.2EF28BB7@psf.io> https://hg.python.org/cpython/rev/79e4593ce746 changeset: 102149:79e4593ce746 branch: 3.5 parent: 102147:23182404a85c user: Berker Peksag date: Fri Jun 24 09:12:01 2016 +0300 summary: Issue #26547: Remove outdated term dictproxy from vars() documentation dictproxy was used in Python 2 and it was renamed to mappingproxy in Python 3.3. Patch by Julien. files: Doc/library/functions.rst | 2 +- 1 files changed, 1 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 @@ -1469,7 +1469,7 @@ Objects such as modules and instances have an updateable :attr:`~object.__dict__` attribute; however, other objects may have write restrictions on their :attr:`~object.__dict__` attributes (for example, classes use a - dictproxy to prevent direct dictionary updates). + :class:`types.MappingProxyType` to prevent direct dictionary updates). Without an argument, :func:`vars` acts like :func:`locals`. Note, the locals dictionary is only useful for reads since updates to the locals -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 24 02:11:09 2016 From: python-checkins at python.org (berker.peksag) Date: Fri, 24 Jun 2016 06:11:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2326547=3A_Merge_from_3=2E5?= Message-ID: <20160624061106.102545.34281.E98F968F@psf.io> https://hg.python.org/cpython/rev/45544b868f7b changeset: 102150:45544b868f7b parent: 102148:21cb299a9626 parent: 102149:79e4593ce746 user: Berker Peksag date: Fri Jun 24 09:12:20 2016 +0300 summary: Issue #26547: Merge from 3.5 files: Doc/library/functions.rst | 2 +- 1 files changed, 1 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 @@ -1472,7 +1472,7 @@ Objects such as modules and instances have an updateable :attr:`~object.__dict__` attribute; however, other objects may have write restrictions on their :attr:`~object.__dict__` attributes (for example, classes use a - dictproxy to prevent direct dictionary updates). + :class:`types.MappingProxyType` to prevent direct dictionary updates). Without an argument, :func:`vars` acts like :func:`locals`. Note, the locals dictionary is only useful for reads since updates to the locals -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 24 02:28:04 2016 From: python-checkins at python.org (berker.peksag) Date: Fri, 24 Jun 2016 06:28:04 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzE4MzAw?= =?utf-8?q?=3A_Set_TERM=3D=27=27_by_default_in_assert=5Fpython=5F*?= Message-ID: <20160624062803.10234.2661.D25BF12B@psf.io> https://hg.python.org/cpython/rev/983fe8f96b08 changeset: 102151:983fe8f96b08 branch: 3.5 parent: 102149:79e4593ce746 user: Berker Peksag date: Fri Jun 24 09:28:50 2016 +0300 summary: Issue #18300: Set TERM='' by default in assert_python_* files: Lib/test/support/script_helper.py | 4 +++ Lib/test/test_doctest.py | 24 +++++++----------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Lib/test/support/script_helper.py b/Lib/test/support/script_helper.py --- a/Lib/test/support/script_helper.py +++ b/Lib/test/support/script_helper.py @@ -73,6 +73,10 @@ # Need to preserve the original environment, for in-place testing of # shared library builds. env = os.environ.copy() + # set TERM='' unless the TERM environment variable is passed explicitly + # see issues #11390 and #18300 + if 'TERM' not in env_vars: + env['TERM'] = '' # But a special flag that can be set to override -- in this case, the # caller is responsible to pass the full environment. if env_vars.pop('__cleanenv', None): diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py --- a/Lib/test/test_doctest.py +++ b/Lib/test/test_doctest.py @@ -2719,12 +2719,6 @@ >>> def normalize(s): ... return '\n'.join(s.decode().splitlines()) -Note: we also pass TERM='' to all the assert_python calls to avoid a bug -in the readline library that is triggered in these tests because we are -running them in a new python process. See: - - http://lists.gnu.org/archive/html/bug-readline/2013-06/msg00000.html - With those preliminaries out of the way, we'll start with a file with two simple tests and no errors. We'll run both the unadorned doctest command, and the verbose version, and then check the output: @@ -2741,9 +2735,9 @@ ... _ = f.write('\n') ... _ = f.write('And that is it.\n') ... rc1, out1, err1 = script_helper.assert_python_ok( - ... '-m', 'doctest', fn, TERM='') + ... '-m', 'doctest', fn) ... rc2, out2, err2 = script_helper.assert_python_ok( - ... '-m', 'doctest', '-v', fn, TERM='') + ... '-m', 'doctest', '-v', fn) With no arguments and passing tests, we should get no output: @@ -2806,17 +2800,17 @@ ... _ = f.write(' \"\"\"\n') ... import shutil ... rc1, out1, err1 = script_helper.assert_python_failure( - ... '-m', 'doctest', fn, fn2, TERM='') + ... '-m', 'doctest', fn, fn2) ... rc2, out2, err2 = script_helper.assert_python_ok( - ... '-m', 'doctest', '-o', 'ELLIPSIS', fn, TERM='') + ... '-m', 'doctest', '-o', 'ELLIPSIS', fn) ... rc3, out3, err3 = script_helper.assert_python_ok( ... '-m', 'doctest', '-o', 'ELLIPSIS', - ... '-o', 'NORMALIZE_WHITESPACE', fn, fn2, TERM='') + ... '-o', 'NORMALIZE_WHITESPACE', fn, fn2) ... rc4, out4, err4 = script_helper.assert_python_failure( - ... '-m', 'doctest', '-f', fn, fn2, TERM='') + ... '-m', 'doctest', '-f', fn, fn2) ... rc5, out5, err5 = script_helper.assert_python_ok( ... '-m', 'doctest', '-v', '-o', 'ELLIPSIS', - ... '-o', 'NORMALIZE_WHITESPACE', fn, fn2, TERM='') + ... '-o', 'NORMALIZE_WHITESPACE', fn, fn2) Our first test run will show the errors from the first file (doctest stops if a file has errors). Note that doctest test-run error output appears on stdout, @@ -2922,7 +2916,7 @@ Invalid file name: >>> rc, out, err = script_helper.assert_python_failure( - ... '-m', 'doctest', 'nosuchfile', TERM='') + ... '-m', 'doctest', 'nosuchfile') >>> rc, out (1, b'') >>> print(normalize(err)) # doctest: +ELLIPSIS @@ -2933,7 +2927,7 @@ Invalid doctest option: >>> rc, out, err = script_helper.assert_python_failure( - ... '-m', 'doctest', '-o', 'nosuchoption', TERM='') + ... '-m', 'doctest', '-o', 'nosuchoption') >>> rc, out (2, b'') >>> print(normalize(err)) # doctest: +ELLIPSIS -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 24 02:28:05 2016 From: python-checkins at python.org (berker.peksag) Date: Fri, 24 Jun 2016 06:28:05 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2318300=3A_Merge_from_3=2E5?= Message-ID: <20160624062804.6281.91385.C8299DAA@psf.io> https://hg.python.org/cpython/rev/1c49cf82d115 changeset: 102152:1c49cf82d115 parent: 102150:45544b868f7b parent: 102151:983fe8f96b08 user: Berker Peksag date: Fri Jun 24 09:29:21 2016 +0300 summary: Issue #18300: Merge from 3.5 files: Lib/test/support/script_helper.py | 4 +++ Lib/test/test_doctest.py | 24 +++++++----------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Lib/test/support/script_helper.py b/Lib/test/support/script_helper.py --- a/Lib/test/support/script_helper.py +++ b/Lib/test/support/script_helper.py @@ -73,6 +73,10 @@ # Need to preserve the original environment, for in-place testing of # shared library builds. env = os.environ.copy() + # set TERM='' unless the TERM environment variable is passed explicitly + # see issues #11390 and #18300 + if 'TERM' not in env_vars: + env['TERM'] = '' # But a special flag that can be set to override -- in this case, the # caller is responsible to pass the full environment. if env_vars.pop('__cleanenv', None): diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py --- a/Lib/test/test_doctest.py +++ b/Lib/test/test_doctest.py @@ -2718,12 +2718,6 @@ >>> def normalize(s): ... return '\n'.join(s.decode().splitlines()) -Note: we also pass TERM='' to all the assert_python calls to avoid a bug -in the readline library that is triggered in these tests because we are -running them in a new python process. See: - - http://lists.gnu.org/archive/html/bug-readline/2013-06/msg00000.html - With those preliminaries out of the way, we'll start with a file with two simple tests and no errors. We'll run both the unadorned doctest command, and the verbose version, and then check the output: @@ -2740,9 +2734,9 @@ ... _ = f.write('\n') ... _ = f.write('And that is it.\n') ... rc1, out1, err1 = script_helper.assert_python_ok( - ... '-m', 'doctest', fn, TERM='') + ... '-m', 'doctest', fn) ... rc2, out2, err2 = script_helper.assert_python_ok( - ... '-m', 'doctest', '-v', fn, TERM='') + ... '-m', 'doctest', '-v', fn) With no arguments and passing tests, we should get no output: @@ -2804,17 +2798,17 @@ ... _ = f.write("\n") ... _ = f.write(' \"\"\"\n') ... rc1, out1, err1 = script_helper.assert_python_failure( - ... '-m', 'doctest', fn, fn2, TERM='') + ... '-m', 'doctest', fn, fn2) ... rc2, out2, err2 = script_helper.assert_python_ok( - ... '-m', 'doctest', '-o', 'ELLIPSIS', fn, TERM='') + ... '-m', 'doctest', '-o', 'ELLIPSIS', fn) ... rc3, out3, err3 = script_helper.assert_python_ok( ... '-m', 'doctest', '-o', 'ELLIPSIS', - ... '-o', 'NORMALIZE_WHITESPACE', fn, fn2, TERM='') + ... '-o', 'NORMALIZE_WHITESPACE', fn, fn2) ... rc4, out4, err4 = script_helper.assert_python_failure( - ... '-m', 'doctest', '-f', fn, fn2, TERM='') + ... '-m', 'doctest', '-f', fn, fn2) ... rc5, out5, err5 = script_helper.assert_python_ok( ... '-m', 'doctest', '-v', '-o', 'ELLIPSIS', - ... '-o', 'NORMALIZE_WHITESPACE', fn, fn2, TERM='') + ... '-o', 'NORMALIZE_WHITESPACE', fn, fn2) Our first test run will show the errors from the first file (doctest stops if a file has errors). Note that doctest test-run error output appears on stdout, @@ -2920,7 +2914,7 @@ Invalid file name: >>> rc, out, err = script_helper.assert_python_failure( - ... '-m', 'doctest', 'nosuchfile', TERM='') + ... '-m', 'doctest', 'nosuchfile') >>> rc, out (1, b'') >>> print(normalize(err)) # doctest: +ELLIPSIS @@ -2931,7 +2925,7 @@ Invalid doctest option: >>> rc, out, err = script_helper.assert_python_failure( - ... '-m', 'doctest', '-o', 'nosuchoption', TERM='') + ... '-m', 'doctest', '-o', 'nosuchoption') >>> rc, out (2, b'') >>> print(normalize(err)) # doctest: +ELLIPSIS -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Fri Jun 24 05:46:15 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 24 Jun 2016 09:46:15 +0000 Subject: [Python-checkins] Daily reference leaks (8955d8aaf351): sum=4 Message-ID: <20160624094615.21996.30717.260626B8@psf.io> results for 8955d8aaf351 on branch "default" -------------------------------------------- test_collections leaked [-4, 0, 4] memory blocks, sum=0 test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/refloghZyZ93', '--timeout', '7200'] From python-checkins at python.org Fri Jun 24 05:55:59 2016 From: python-checkins at python.org (berker.peksag) Date: Fri, 24 Jun 2016 09:55:59 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3Mzgx?= =?utf-8?q?=3A_Remove_superfluous_paren_in_zipfile_documentation?= Message-ID: <20160624095559.119817.25932.9B7580D9@psf.io> https://hg.python.org/cpython/rev/be435520e493 changeset: 102153:be435520e493 branch: 3.5 parent: 102151:983fe8f96b08 user: Berker Peksag date: Fri Jun 24 12:56:50 2016 +0300 summary: Issue #27381: Remove superfluous paren in zipfile documentation files: Doc/library/zipfile.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -250,7 +250,7 @@ .. method:: ZipFile.extract(member, path=None, pwd=None) Extract a member from the archive to the current working directory; *member* - must be its full name or a :class:`ZipInfo` object). Its file information is + must be its full name or a :class:`ZipInfo` object. Its file information is extracted as accurately as possible. *path* specifies a different directory to extract to. *member* can be a filename or a :class:`ZipInfo` object. *pwd* is the password used for encrypted files. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 24 05:55:59 2016 From: python-checkins at python.org (berker.peksag) Date: Fri, 24 Jun 2016 09:55:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327381=3A_Merge_from_3=2E5?= Message-ID: <20160624095559.6538.17700.FB30B99E@psf.io> https://hg.python.org/cpython/rev/f859380d4708 changeset: 102154:f859380d4708 parent: 102152:1c49cf82d115 parent: 102153:be435520e493 user: Berker Peksag date: Fri Jun 24 12:57:18 2016 +0300 summary: Issue #27381: Merge from 3.5 files: Doc/library/zipfile.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -255,7 +255,7 @@ .. method:: ZipFile.extract(member, path=None, pwd=None) Extract a member from the archive to the current working directory; *member* - must be its full name or a :class:`ZipInfo` object). Its file information is + must be its full name or a :class:`ZipInfo` object. Its file information is extracted as accurately as possible. *path* specifies a different directory to extract to. *member* can be a filename or a :class:`ZipInfo` object. *pwd* is the password used for encrypted files. -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Fri Jun 24 06:59:02 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 24 Jun 2016 11:59:02 +0100 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python Default 2016-06-24 Message-ID: Results for project Python default, build date 2016-06-24 02:02:32 +0000 commit: 8955d8aaf351 previous commit: 33769ce40b47 revision date: 2016-06-23 20:56:46 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.22% 0.98% 9.70% 15.47% :-| pybench 0.18% 0.03% 1.40% 7.39% :-| regex_v8 2.72% 0.03% -1.68% 2.59% :-| nbody 0.21% -0.14% -0.70% 10.68% :-( json_dump_v2 0.37% 0.23% -3.24% 13.89% :-| normal_startup 0.77% 0.28% 1.92% 5.50% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-default-2016-06-24/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Fri Jun 24 07:00:07 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 24 Jun 2016 12:00:07 +0100 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2016-06-24 Message-ID: <06413a74-7698-4e31-bdea-29d544d2eeec@irsmsx103.ger.corp.intel.com> Results for project Python 2.7, build date 2016-06-24 02:46:14 +0000 commit: cbc6407fa393 previous commit: c91007ab3fda revision date: 2016-06-23 22:07:46 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.20% -0.56% 4.23% 4.96% :-) pybench 0.24% -0.01% 5.71% 4.57% :-( regex_v8 0.51% -0.08% -2.43% 10.44% :-) nbody 0.14% 0.13% 8.77% 1.52% :-) json_dump_v2 0.49% -0.69% 2.08% 11.08% :-( normal_startup 1.58% 0.67% -5.05% 1.20% :-) ssbench 0.21% 0.42% 2.43% 1.44% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-2-7-2016-06-24/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Fri Jun 24 13:33:09 2016 From: python-checkins at python.org (steve.dower) Date: Fri, 24 Jun 2016 17:33:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Adds_scripts_f?= =?utf-8?q?or_producing_Nuget_packages=2E?= Message-ID: <20160624173309.760.31830.38A73793@psf.io> https://hg.python.org/cpython/rev/4d92949a2080 changeset: 102155:4d92949a2080 branch: 3.5 parent: 102153:be435520e493 user: Steve Dower date: Fri Jun 24 10:32:15 2016 -0700 summary: Adds scripts for producing Nuget packages. files: Tools/msi/make_zip.py | 28 +++++++----- Tools/nuget/make_pkg.proj | 51 ++++++++++++++++++++++++ Tools/nuget/python.nuspec | 18 ++++++++ Tools/nuget/pythonx86.nuspec | 18 ++++++++ 4 files changed, 103 insertions(+), 12 deletions(-) diff --git a/Tools/msi/make_zip.py b/Tools/msi/make_zip.py --- a/Tools/msi/make_zip.py +++ b/Tools/msi/make_zip.py @@ -75,10 +75,12 @@ return p.suffix.lower() in {'.py', '.pyw', '.txt'} FULL_LAYOUT = [ - ('/', 'PCBuild/$arch', 'python*.exe', is_not_debug), - ('/', 'PCBuild/$arch', 'python*.dll', is_not_debug), + ('/', 'PCBuild/$arch', 'python.exe', is_not_debug), + ('/', 'PCBuild/$arch', 'pythonw.exe', is_not_debug), + ('/', 'PCBuild/$arch', 'python{0.major}.dll'.format(sys.version_info), is_not_debug), + ('/', 'PCBuild/$arch', 'python{0.major}{0.minor}.dll'.format(sys.version_info), is_not_debug), ('DLLs/', 'PCBuild/$arch', '*.pyd', is_not_debug), - ('DLLs/', 'PCBuild/$arch', '*.dll', is_not_debug), + ('DLLs/', 'PCBuild/$arch', '*.dll', is_not_debug_or_python), ('include/', 'include', '*.h', None), ('include/', 'PC', 'pyconfig.h', None), ('Lib/', 'Lib', '**/*', include_in_lib), @@ -150,17 +152,17 @@ def main(): parser = argparse.ArgumentParser() parser.add_argument('-s', '--source', metavar='dir', help='The directory containing the repository root', type=Path) - parser.add_argument('-o', '--out', metavar='file', help='The name of the output self-extracting archive', type=Path, required=True) + parser.add_argument('-o', '--out', metavar='file', help='The name of the output self-extracting archive', type=Path, default=None) parser.add_argument('-t', '--temp', metavar='dir', help='A directory to temporarily extract files into', type=Path, default=None) parser.add_argument('-e', '--embed', help='Create an embedding layout', action='store_true', default=False) parser.add_argument('-a', '--arch', help='Specify the architecture to use (win32/amd64)', type=str, default="win32") ns = parser.parse_args() - source = ns.source or (Path(__file__).parent.parent.parent) + source = ns.source or (Path(__file__).resolve().parent.parent.parent) out = ns.out arch = ns.arch assert isinstance(source, Path) - assert isinstance(out, Path) + assert not out or isinstance(out, Path) assert isinstance(arch, str) if ns.temp: @@ -170,10 +172,11 @@ temp = Path(tempfile.mkdtemp()) delete_temp = True - try: - out.parent.mkdir(parents=True) - except FileExistsError: - pass + if out: + try: + out.parent.mkdir(parents=True) + except FileExistsError: + pass try: temp.mkdir(parents=True) except FileExistsError: @@ -190,8 +193,9 @@ with open(str(temp / 'pyvenv.cfg'), 'w') as f: print('applocal = true', file=f) - total = copy_to_layout(out, rglob(temp, '*', None)) - print('Wrote {} files to {}'.format(total, out)) + if out: + total = copy_to_layout(out, rglob(temp, '**/*', None)) + print('Wrote {} files to {}'.format(total, out)) finally: if delete_temp: shutil.rmtree(temp, True) diff --git a/Tools/nuget/make_pkg.proj b/Tools/nuget/make_pkg.proj new file mode 100644 --- /dev/null +++ b/Tools/nuget/make_pkg.proj @@ -0,0 +1,51 @@ + + + + {10487945-15D1-4092-A214-338395C4116B} + python + $(OutputName)x86 + + false + + + + + + $(ExternalsDir)\windows-installer\nuget\nuget.exe + $(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber) + false + $(OutputName).$(NuspecVersion) + .nupkg + $(OutputPath)\en-us\$(TargetName)$(TargetExt) + $(IntermediateOutputPath)\nuget_$(ArchName) + + rmdir /q/s "$(IntermediateOutputPath)" + + "$(PythonExe)" "$(MSBuildThisFileDirectory)\..\msi\make_zip.py" + $(PythonArguments) -t "$(IntermediateOutputPath)" -a $(ArchName) + + "$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).nuspec" + $(NugetArguments) -BasePath "$(IntermediateOutputPath)" + $(NugetArguments) -OutputDirectory "$(OutputPath)\en-us" + $(NugetArguments) -Version "$(NuspecVersion)" + $(NugetArguments) -NoPackageAnalysis -NonInteractive + + setlocal +set DOC_FILENAME=python$(PythonVersion).chm +set VCREDIST_PATH=$(VS140COMNTOOLS)\..\..\VC\redist\$(Platform)\Microsoft.VC140.CRT + + + + + + + + + + + + + + diff --git a/Tools/nuget/python.nuspec b/Tools/nuget/python.nuspec new file mode 100644 --- /dev/null +++ b/Tools/nuget/python.nuspec @@ -0,0 +1,18 @@ + + + + python + Python + 0.0.0.0 + Python Software Foundation + https://docs.python.org/3/license.html + https://www.python.org/ + false + Installs 64-bit Python for use in build scenarios. + https://www.python.org/static/favicon.ico + python + + + + + diff --git a/Tools/nuget/pythonx86.nuspec b/Tools/nuget/pythonx86.nuspec new file mode 100644 --- /dev/null +++ b/Tools/nuget/pythonx86.nuspec @@ -0,0 +1,18 @@ + + + + pythonx86 + Python (32-bit) + Python Software Foundation + 0.0.0.0 + https://docs.python.org/3/license.html + https://www.python.org/ + false + Installs 32-bit Python for use in build scenarios. + https://www.python.org/static/favicon.ico + python + + + + + -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 24 13:33:10 2016 From: python-checkins at python.org (steve.dower) Date: Fri, 24 Jun 2016 17:33:10 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5?= Message-ID: <20160624173309.6245.24442.0BFB4D2F@psf.io> https://hg.python.org/cpython/rev/a06606fb154a changeset: 102156:a06606fb154a parent: 102154:f859380d4708 parent: 102155:4d92949a2080 user: Steve Dower date: Fri Jun 24 10:32:54 2016 -0700 summary: Merge from 3.5 files: Tools/msi/make_zip.py | 28 +++++++----- Tools/nuget/make_pkg.proj | 51 ++++++++++++++++++++++++ Tools/nuget/python.nuspec | 18 ++++++++ Tools/nuget/pythonx86.nuspec | 18 ++++++++ 4 files changed, 103 insertions(+), 12 deletions(-) diff --git a/Tools/msi/make_zip.py b/Tools/msi/make_zip.py --- a/Tools/msi/make_zip.py +++ b/Tools/msi/make_zip.py @@ -75,10 +75,12 @@ return p.suffix.lower() in {'.py', '.pyw', '.txt'} FULL_LAYOUT = [ - ('/', 'PCBuild/$arch', 'python*.exe', is_not_debug), - ('/', 'PCBuild/$arch', 'python*.dll', is_not_debug), + ('/', 'PCBuild/$arch', 'python.exe', is_not_debug), + ('/', 'PCBuild/$arch', 'pythonw.exe', is_not_debug), + ('/', 'PCBuild/$arch', 'python{0.major}.dll'.format(sys.version_info), is_not_debug), + ('/', 'PCBuild/$arch', 'python{0.major}{0.minor}.dll'.format(sys.version_info), is_not_debug), ('DLLs/', 'PCBuild/$arch', '*.pyd', is_not_debug), - ('DLLs/', 'PCBuild/$arch', '*.dll', is_not_debug), + ('DLLs/', 'PCBuild/$arch', '*.dll', is_not_debug_or_python), ('include/', 'include', '*.h', None), ('include/', 'PC', 'pyconfig.h', None), ('Lib/', 'Lib', '**/*', include_in_lib), @@ -150,17 +152,17 @@ def main(): parser = argparse.ArgumentParser() parser.add_argument('-s', '--source', metavar='dir', help='The directory containing the repository root', type=Path) - parser.add_argument('-o', '--out', metavar='file', help='The name of the output self-extracting archive', type=Path, required=True) + parser.add_argument('-o', '--out', metavar='file', help='The name of the output self-extracting archive', type=Path, default=None) parser.add_argument('-t', '--temp', metavar='dir', help='A directory to temporarily extract files into', type=Path, default=None) parser.add_argument('-e', '--embed', help='Create an embedding layout', action='store_true', default=False) parser.add_argument('-a', '--arch', help='Specify the architecture to use (win32/amd64)', type=str, default="win32") ns = parser.parse_args() - source = ns.source or (Path(__file__).parent.parent.parent) + source = ns.source or (Path(__file__).resolve().parent.parent.parent) out = ns.out arch = ns.arch assert isinstance(source, Path) - assert isinstance(out, Path) + assert not out or isinstance(out, Path) assert isinstance(arch, str) if ns.temp: @@ -170,10 +172,11 @@ temp = Path(tempfile.mkdtemp()) delete_temp = True - try: - out.parent.mkdir(parents=True) - except FileExistsError: - pass + if out: + try: + out.parent.mkdir(parents=True) + except FileExistsError: + pass try: temp.mkdir(parents=True) except FileExistsError: @@ -190,8 +193,9 @@ with open(str(temp / 'pyvenv.cfg'), 'w') as f: print('applocal = true', file=f) - total = copy_to_layout(out, rglob(temp, '*', None)) - print('Wrote {} files to {}'.format(total, out)) + if out: + total = copy_to_layout(out, rglob(temp, '**/*', None)) + print('Wrote {} files to {}'.format(total, out)) finally: if delete_temp: shutil.rmtree(temp, True) diff --git a/Tools/nuget/make_pkg.proj b/Tools/nuget/make_pkg.proj new file mode 100644 --- /dev/null +++ b/Tools/nuget/make_pkg.proj @@ -0,0 +1,51 @@ + + + + {10487945-15D1-4092-A214-338395C4116B} + python + $(OutputName)x86 + + false + + + + + + $(ExternalsDir)\windows-installer\nuget\nuget.exe + $(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber) + false + $(OutputName).$(NuspecVersion) + .nupkg + $(OutputPath)\en-us\$(TargetName)$(TargetExt) + $(IntermediateOutputPath)\nuget_$(ArchName) + + rmdir /q/s "$(IntermediateOutputPath)" + + "$(PythonExe)" "$(MSBuildThisFileDirectory)\..\msi\make_zip.py" + $(PythonArguments) -t "$(IntermediateOutputPath)" -a $(ArchName) + + "$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).nuspec" + $(NugetArguments) -BasePath "$(IntermediateOutputPath)" + $(NugetArguments) -OutputDirectory "$(OutputPath)\en-us" + $(NugetArguments) -Version "$(NuspecVersion)" + $(NugetArguments) -NoPackageAnalysis -NonInteractive + + setlocal +set DOC_FILENAME=python$(PythonVersion).chm +set VCREDIST_PATH=$(VS140COMNTOOLS)\..\..\VC\redist\$(Platform)\Microsoft.VC140.CRT + + + + + + + + + + + + + + diff --git a/Tools/nuget/python.nuspec b/Tools/nuget/python.nuspec new file mode 100644 --- /dev/null +++ b/Tools/nuget/python.nuspec @@ -0,0 +1,18 @@ + + + + python + Python + 0.0.0.0 + Python Software Foundation + https://docs.python.org/3/license.html + https://www.python.org/ + false + Installs 64-bit Python for use in build scenarios. + https://www.python.org/static/favicon.ico + python + + + + + diff --git a/Tools/nuget/pythonx86.nuspec b/Tools/nuget/pythonx86.nuspec new file mode 100644 --- /dev/null +++ b/Tools/nuget/pythonx86.nuspec @@ -0,0 +1,18 @@ + + + + pythonx86 + Python (32-bit) + Python Software Foundation + 0.0.0.0 + https://docs.python.org/3/license.html + https://www.python.org/ + false + Installs 32-bit Python for use in build scenarios. + https://www.python.org/static/favicon.ico + python + + + + + -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 24 14:38:10 2016 From: python-checkins at python.org (steve.dower) Date: Fri, 24 Jun 2016 18:38:10 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Preinstalls_pi?= =?utf-8?q?p_into_the_nuget_package_so_that_pip=2Eexe_is_available_after?= Message-ID: <20160624183810.22420.44166.60640869@psf.io> https://hg.python.org/cpython/rev/41c3a0ca4f6a changeset: 102157:41c3a0ca4f6a branch: 3.5 parent: 102155:4d92949a2080 user: Steve Dower date: Fri Jun 24 11:37:50 2016 -0700 summary: Preinstalls pip into the nuget package so that pip.exe is available after installation. files: Tools/nuget/make_pkg.proj | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Tools/nuget/make_pkg.proj b/Tools/nuget/make_pkg.proj --- a/Tools/nuget/make_pkg.proj +++ b/Tools/nuget/make_pkg.proj @@ -24,6 +24,8 @@ "$(PythonExe)" "$(MSBuildThisFileDirectory)\..\msi\make_zip.py" $(PythonArguments) -t "$(IntermediateOutputPath)" -a $(ArchName) + "$(IntermediateOutputPath)\python.exe" -B -c "import sys; sys.path.append('$(PySourcePath)\Lib'); import ensurepip; ensurepip._main()" + "$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).nuspec" $(NugetArguments) -BasePath "$(IntermediateOutputPath)" $(NugetArguments) -OutputDirectory "$(OutputPath)\en-us" @@ -40,9 +42,10 @@ + + -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 24 14:38:11 2016 From: python-checkins at python.org (steve.dower) Date: Fri, 24 Jun 2016 18:38:11 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5?= Message-ID: <20160624183810.17829.41432.48C7349F@psf.io> https://hg.python.org/cpython/rev/7d5bc8a3c7fc changeset: 102158:7d5bc8a3c7fc parent: 102156:a06606fb154a parent: 102157:41c3a0ca4f6a user: Steve Dower date: Fri Jun 24 11:38:00 2016 -0700 summary: Merge from 3.5 files: Tools/nuget/make_pkg.proj | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Tools/nuget/make_pkg.proj b/Tools/nuget/make_pkg.proj --- a/Tools/nuget/make_pkg.proj +++ b/Tools/nuget/make_pkg.proj @@ -24,6 +24,8 @@ "$(PythonExe)" "$(MSBuildThisFileDirectory)\..\msi\make_zip.py" $(PythonArguments) -t "$(IntermediateOutputPath)" -a $(ArchName) + "$(IntermediateOutputPath)\python.exe" -B -c "import sys; sys.path.append('$(PySourcePath)\Lib'); import ensurepip; ensurepip._main()" + "$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).nuspec" $(NugetArguments) -BasePath "$(IntermediateOutputPath)" $(NugetArguments) -OutputDirectory "$(OutputPath)\en-us" @@ -40,9 +42,10 @@ + + -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 24 14:40:20 2016 From: python-checkins at python.org (steve.dower) Date: Fri, 24 Jun 2016 18:40:20 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Adds_scripts_f?= =?utf-8?q?or_building_nuget_packages=2E?= Message-ID: <20160624184019.32620.25193.11917B55@psf.io> https://hg.python.org/cpython/rev/1ed74994c3e3 changeset: 102159:1ed74994c3e3 branch: 2.7 parent: 102144:c3a3ac173bb7 user: Steve Dower date: Fri Jun 24 11:39:57 2016 -0700 summary: Adds scripts for building nuget packages. files: Tools/nuget/make_pkg.proj | 50 +++++ Tools/nuget/make_zip.py | 202 ++++++++++++++++++++++ Tools/nuget/python2.nuspec | 18 + Tools/nuget/python2x86.nuspec | 18 + 4 files changed, 288 insertions(+), 0 deletions(-) diff --git a/Tools/nuget/make_pkg.proj b/Tools/nuget/make_pkg.proj new file mode 100644 --- /dev/null +++ b/Tools/nuget/make_pkg.proj @@ -0,0 +1,50 @@ + + + + {6BA7092C-0093-47F0-9ED2-282AEE981E14} + python2 + $(OutputName)x86 + $(MSBuildThisFileDirectory) + + false + + + + + + $(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber) + false + $(OutputName).$(NuspecVersion) + .nupkg + $(OutputPath)\$(TargetName)$(TargetExt) + $(MSBuildThisFileDirectory)\obj_$(ArchName) + + rmdir /q/s "$(IntermediateOutputPath)" + + py + "$(Python)" "$(MSBuildThisFileDirectory)\make_zip.py" + $(PythonArguments) -s "$(PySourcePath.Trim('\'))" -t "$(IntermediateOutputPath)" -a $(ArchName) + + "$(IntermediateOutputPath)\python.exe" -B -c "import sys; sys.path.append(r'$(PySourcePath)\Lib'); import ensurepip; ensurepip._main()" + + "$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).nuspec" + $(NugetArguments) -BasePath "$(IntermediateOutputPath)" + $(NugetArguments) -OutputDirectory "$(OutputPath.Trim('\'))" + $(NugetArguments) -Version "$(NuspecVersion)" + $(NugetArguments) -NoPackageAnalysis -NonInteractive + + + + + + + + + + + + + + + + diff --git a/Tools/nuget/make_zip.py b/Tools/nuget/make_zip.py new file mode 100644 --- /dev/null +++ b/Tools/nuget/make_zip.py @@ -0,0 +1,202 @@ +#! /usr/bin/python3 + +import argparse +import py_compile +import re +import sys +import shutil +import stat +import os +import tempfile + +from pathlib import Path +from zipfile import ZipFile, ZIP_DEFLATED +import subprocess + +TKTCL_RE = re.compile(r'^(_?tk|tcl).+\.(pyd|dll)', re.IGNORECASE) +DEBUG_RE = re.compile(r'_d\.(pyd|dll|exe)$', re.IGNORECASE) +PYTHON_DLL_RE = re.compile(r'python\d\d?\.dll$', re.IGNORECASE) + +EXCLUDE_FROM_LIBRARY = { + '__pycache__', + 'ensurepip', + 'idlelib', + 'pydoc_data', + 'site-packages', + 'tkinter', + 'turtledemo', +} + +EXCLUDE_FILE_FROM_LIBRARY = { + 'bdist_wininst.py', +} + +def is_not_debug(p): + if DEBUG_RE.search(p.name): + return False + + if TKTCL_RE.search(p.name): + return False + + return p.name.lower() not in { + '_ctypes_test.pyd', + '_testbuffer.pyd', + '_testcapi.pyd', + '_testimportmultiple.pyd', + '_testmultiphase.pyd', + 'xxlimited.pyd', + } + +def is_not_debug_or_python(p): + return is_not_debug(p) and not PYTHON_DLL_RE.search(p.name) + +def include_in_lib(p): + name = p.name.lower() + if p.is_dir(): + if name in EXCLUDE_FROM_LIBRARY: + return False + if name.startswith('plat-'): + return False + if name == 'test' and p.parts[-2].lower() == 'lib': + return False + if name in {'test', 'tests'} and p.parts[-3].lower() == 'lib': + return False + return True + + if name in EXCLUDE_FILE_FROM_LIBRARY: + return False + + suffix = p.suffix.lower() + return suffix not in {'.pyc', '.pyo', '.exe'} + +def include_in_tools(p): + if p.is_dir() and p.name.lower() in {'scripts', 'i18n', 'pynche', 'demo', 'parser'}: + return True + + return p.suffix.lower() in {'.py', '.pyw', '.txt'} + +FULL_LAYOUT = [ + ('/', 'PCBuild/$arch', 'python.exe', is_not_debug), + ('/', 'PCBuild/$arch', 'pythonw.exe', is_not_debug), + ('/', 'PCBuild/$arch', 'python27.dll', None), + ('DLLs/', 'PCBuild/$arch', '*.pyd', is_not_debug), + ('DLLs/', 'PCBuild/$arch', '*.dll', is_not_debug_or_python), + ('include/', 'include', '*.h', None), + ('include/', 'PC', 'pyconfig.h', None), + ('Lib/', 'Lib', '**/*', include_in_lib), + ('Tools/', 'Tools', '**/*', include_in_tools), +] + +EMBED_LAYOUT = [ + ('/', 'PCBuild/$arch', 'python*.exe', is_not_debug), + ('/', 'PCBuild/$arch', '*.pyd', is_not_debug), + ('/', 'PCBuild/$arch', '*.dll', is_not_debug), + ('python{0.major}{0.minor}.zip'.format(sys.version_info), 'Lib', '**/*', include_in_lib), +] + +if os.getenv('DOC_FILENAME'): + FULL_LAYOUT.append(('Doc/', 'Doc/build/htmlhelp', os.getenv('DOC_FILENAME'), None)) +if os.getenv('VCREDIST_PATH'): + FULL_LAYOUT.append(('/', os.getenv('VCREDIST_PATH'), 'vcruntime*.dll', None)) + EMBED_LAYOUT.append(('/', os.getenv('VCREDIST_PATH'), 'vcruntime*.dll', None)) + +def copy_to_layout(target, rel_sources): + count = 0 + + if target.suffix.lower() == '.zip': + if target.exists(): + target.unlink() + + with ZipFile(str(target), 'w', ZIP_DEFLATED) as f: + with tempfile.TemporaryDirectory() as tmpdir: + for s, rel in rel_sources: + if rel.suffix.lower() == '.py': + pyc = Path(tmpdir) / rel.with_suffix('.pyc').name + try: + py_compile.compile(str(s), str(pyc), str(rel), doraise=True, optimize=2) + except py_compile.PyCompileError: + f.write(str(s), str(rel)) + else: + f.write(str(pyc), str(rel.with_suffix('.pyc'))) + else: + f.write(str(s), str(rel)) + count += 1 + + else: + for s, rel in rel_sources: + dest = target / rel + try: + dest.parent.mkdir(parents=True) + except FileExistsError: + pass + if dest.is_file(): + dest.chmod(stat.S_IWRITE) + shutil.copy(str(s), str(dest)) + if dest.is_file(): + dest.chmod(stat.S_IWRITE) + count += 1 + + return count + +def rglob(root, pattern, condition): + dirs = [root] + recurse = pattern[:3] in {'**/', '**\\'} + while dirs: + d = dirs.pop(0) + for f in d.glob(pattern[3:] if recurse else pattern): + if recurse and f.is_dir() and (not condition or condition(f)): + dirs.append(f) + elif f.is_file() and (not condition or condition(f)): + yield f, f.relative_to(root) + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('-s', '--source', metavar='dir', help='The directory containing the repository root', type=Path) + parser.add_argument('-o', '--out', metavar='file', help='The name of the output self-extracting archive', type=Path, default=None) + parser.add_argument('-t', '--temp', metavar='dir', help='A directory to temporarily extract files into', type=Path, default=None) + parser.add_argument('-e', '--embed', help='Create an embedding layout', action='store_true', default=False) + parser.add_argument('-a', '--arch', help='Specify the architecture to use (win32/amd64)', type=str, default="win32") + ns = parser.parse_args() + + source = ns.source or (Path(__file__).resolve().parent.parent.parent) + out = ns.out + arch = "" if ns.arch == "win32" else ns.arch + assert isinstance(source, Path) + assert not out or isinstance(out, Path) + assert isinstance(arch, str) + + if ns.temp: + temp = ns.temp + delete_temp = False + else: + temp = Path(tempfile.mkdtemp()) + delete_temp = True + + if out: + try: + out.parent.mkdir(parents=True) + except FileExistsError: + pass + try: + temp.mkdir(parents=True) + except FileExistsError: + pass + + layout = EMBED_LAYOUT if ns.embed else FULL_LAYOUT + + try: + for t, s, p, c in layout: + s = source / s.replace("$arch", arch) + copied = copy_to_layout(temp / t.rstrip('/'), rglob(s, p, c)) + print('Copied {} files'.format(copied)) + + if out: + total = copy_to_layout(out, rglob(temp, '**/*', None)) + print('Wrote {} files to {}'.format(total, out)) + finally: + if delete_temp: + shutil.rmtree(temp, True) + + +if __name__ == "__main__": + sys.exit(int(main() or 0)) diff --git a/Tools/nuget/python2.nuspec b/Tools/nuget/python2.nuspec new file mode 100644 --- /dev/null +++ b/Tools/nuget/python2.nuspec @@ -0,0 +1,18 @@ + + + + python2 + Python 2.7 + 0.0.0.0 + Python Software Foundation + https://docs.python.org/2.7/license.html + https://www.python.org/ + false + Installs 64-bit Python 2.7 for use in build scenarios. + https://www.python.org/static/favicon.ico + python + + + + + diff --git a/Tools/nuget/python2x86.nuspec b/Tools/nuget/python2x86.nuspec new file mode 100644 --- /dev/null +++ b/Tools/nuget/python2x86.nuspec @@ -0,0 +1,18 @@ + + + + python2x86 + Python 2.7 (32-bit) + Python Software Foundation + 0.0.0.0 + https://docs.python.org/2.7/license.html + https://www.python.org/ + false + Installs 32-bit Python 2.7 for use in build scenarios. + https://www.python.org/static/favicon.ico + python + + + + + -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 24 15:03:48 2016 From: python-checkins at python.org (brett.cannon) Date: Fri, 24 Jun 2016 19:03:48 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327186=3A_Update_o?= =?utf-8?q?s=2Efspath=28=29/PyOS=5FFSPath=28=29_to_check_the_return?= Message-ID: <20160624190348.389.31712.601913D7@psf.io> https://hg.python.org/cpython/rev/ea7b6a7827a4 changeset: 102160:ea7b6a7827a4 parent: 102158:7d5bc8a3c7fc user: Brett Cannon date: Fri Jun 24 12:03:43 2016 -0700 summary: Issue #27186: Update os.fspath()/PyOS_FSPath() to check the return type of __fspath__(). As part of this change, also make sure that the pure Python implementation of os.fspath() is tested. files: Doc/c-api/sys.rst | 5 +- Doc/library/os.rst | 14 +++-- Lib/os.py | 73 +++++++++++++++++------------- Lib/test/test_io.py | 2 +- Lib/test/test_os.py | 68 +++++++++++++++------------- Misc/NEWS | 3 + Modules/posixmodule.c | 13 ++++- 7 files changed, 104 insertions(+), 74 deletions(-) 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 @@ -10,8 +10,9 @@ Return the file system representation for *path*. If the object is a :class:`str` or :class:`bytes` object, then its reference count is incremented. If the object implements the :class:`os.PathLike` interface, - then ``type(path).__fspath__()`` is returned. Otherwise :exc:`TypeError` is - raised and ``NULL`` is returned. + then :meth:`~os.PathLike.__fspath__` is returned as long as it is a + :class:`str` or :class:`bytes` object. Otherwise :exc:`TypeError` is raised + and ``NULL`` is returned. .. versionadded:: 3.6 diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -179,7 +179,8 @@ .. versionadded:: 3.2 .. versionchanged:: 3.6 - Support added to accept objects implementing :class:`os.PathLike`. + Support added to accept objects implementing the :class:`os.PathLike` + interface. .. function:: fsdecode(filename) @@ -192,17 +193,18 @@ .. versionadded:: 3.2 .. versionchanged:: 3.6 - Support added to accept objects implementing :class:`os.PathLike`. + Support added to accept objects implementing the :class:`os.PathLike` + interface. .. function:: fspath(path) Return the file system representation of the path. - If :class:`str` or :class:`bytes` is passed in, it is returned unchanged; - otherwise, the result of calling ``type(path).__fspath__`` is returned - (which is represented by :class:`os.PathLike`). All other types raise a - :exc:`TypeError`. + If :class:`str` or :class:`bytes` is passed in, it is returned unchanged. + Otherwise :meth:`~os.PathLike.__fspath__` is called and its value is + returned as long as it is a :class:`str` or :class:`bytes` object. + In all other cases, :exc:`TypeError` is raised. .. versionadded:: 3.6 diff --git a/Lib/os.py b/Lib/os.py --- a/Lib/os.py +++ b/Lib/os.py @@ -881,14 +881,11 @@ On Windows, use 'strict' error handler if the file system encoding is 'mbcs' (which is the default encoding). """ - filename = fspath(filename) - if isinstance(filename, bytes): - return filename - elif isinstance(filename, str): + filename = fspath(filename) # Does type-checking of `filename`. + if isinstance(filename, str): return filename.encode(encoding, errors) else: - raise TypeError("expected str, bytes or os.PathLike object, not " - + type(filename).__name__) + return filename def fsdecode(filename): """Decode filename (an os.PathLike, bytes, or str) from the filesystem @@ -896,14 +893,11 @@ Windows, use 'strict' error handler if the file system encoding is 'mbcs' (which is the default encoding). """ - filename = fspath(filename) - if isinstance(filename, str): - return filename - elif isinstance(filename, bytes): + filename = fspath(filename) # Does type-checking of `filename`. + if isinstance(filename, bytes): return filename.decode(encoding, errors) else: - raise TypeError("expected str, bytes or os.PathLike object, not " - + type(filename).__name__) + return filename return fsencode, fsdecode @@ -1102,27 +1096,44 @@ import io return io.open(fd, *args, **kwargs) -# Supply os.fspath() if not defined in C + +# For testing purposes, make sure the function is available when the C +# implementation exists. +def _fspath(path): + """Return the path representation of a path-like object. + + If str or bytes is passed in, it is returned unchanged. Otherwise the + os.PathLike interface is used to get the path representation. If the + path representation is not str or bytes, TypeError is raised. If the + provided path is not str, bytes, or os.PathLike, TypeError is raised. + """ + if isinstance(path, (str, bytes)): + return path + + # Work from the object's type to match method resolution of other magic + # methods. + path_type = type(path) + try: + path_repr = path_type.__fspath__(path) + except AttributeError: + if hasattr(path_type, '__fspath__'): + raise + else: + raise TypeError("expected str, bytes or os.PathLike object, " + "not " + path_type.__name__) + if isinstance(path_repr, (str, bytes)): + return path_repr + else: + raise TypeError("expected {}.__fspath__() to return str or bytes, " + "not {}".format(path_type.__name__, + type(path_repr).__name__)) + +# If there is no C implementation, make the pure Python version the +# implementation as transparently as possible. if not _exists('fspath'): - def fspath(path): - """Return the string representation of the path. + fspath = _fspath + fspath.__name__ = "fspath" - If str or bytes is passed in, it is returned unchanged. - """ - if isinstance(path, (str, bytes)): - return path - - # Work from the object's type to match method resolution of other magic - # methods. - path_type = type(path) - try: - return path_type.__fspath__(path) - except AttributeError: - if hasattr(path_type, '__fspath__'): - raise - - raise TypeError("expected str, bytes or os.PathLike object, not " - + path_type.__name__) class PathLike(abc.ABC): 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 @@ -879,7 +879,7 @@ check_path_succeeds(PathLike(support.TESTFN.encode('utf-8'))) bad_path = PathLike(TypeError) - with self.assertRaisesRegex(TypeError, 'invalid file'): + with self.assertRaises(TypeError): self.open(bad_path, 'w') # ensure that refcounting is correct with some error conditions 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 @@ -3112,55 +3112,59 @@ class TestPEP519(unittest.TestCase): - "os.fspath()" + + # Abstracted so it can be overridden to test pure Python implementation + # if a C version is provided. + fspath = staticmethod(os.fspath) + + class PathLike: + def __init__(self, path=''): + self.path = path + def __fspath__(self): + return self.path def test_return_bytes(self): for b in b'hello', b'goodbye', b'some/path/and/file': - self.assertEqual(b, os.fspath(b)) + self.assertEqual(b, self.fspath(b)) def test_return_string(self): for s in 'hello', 'goodbye', 'some/path/and/file': - self.assertEqual(s, os.fspath(s)) - - def test_fsencode_fsdecode_return_pathlike(self): - class PathLike: - def __init__(self, path): - self.path = path - def __fspath__(self): - return self.path - + self.assertEqual(s, self.fspath(s)) + + def test_fsencode_fsdecode(self): for p in "path/like/object", b"path/like/object": - pathlike = PathLike(p) - - self.assertEqual(p, os.fspath(pathlike)) + pathlike = self.PathLike(p) + + self.assertEqual(p, self.fspath(pathlike)) self.assertEqual(b"path/like/object", os.fsencode(pathlike)) self.assertEqual("path/like/object", os.fsdecode(pathlike)) - def test_fspathlike(self): - class PathLike: - def __init__(self, path=''): - self.path = path - def __fspath__(self): - return self.path - - self.assertEqual('#feelthegil', os.fspath(PathLike('#feelthegil'))) - self.assertTrue(issubclass(PathLike, os.PathLike)) - self.assertTrue(isinstance(PathLike(), os.PathLike)) - - message = 'expected str, bytes or os.PathLike object, not' - for fn in (os.fsencode, os.fsdecode): - for obj in PathLike(None), None: - with self.assertRaisesRegex(TypeError, message): - fn(obj) + def test_pathlike(self): + self.assertEqual('#feelthegil', self.fspath(self.PathLike('#feelthegil'))) + self.assertTrue(issubclass(self.PathLike, os.PathLike)) + self.assertTrue(isinstance(self.PathLike(), os.PathLike)) + + with self.assertRaises(TypeError): + self.fspath(self.PathLike(42)) def test_garbage_in_exception_out(self): vapor = type('blah', (), {}) for o in int, type, os, vapor(): - self.assertRaises(TypeError, os.fspath, o) + self.assertRaises(TypeError, self.fspath, o) def test_argument_required(self): with self.assertRaises(TypeError): - os.fspath() + self.fspath() + + +# Only test if the C version is provided, otherwise TestPEP519 already tested +# the pure Python implementation. +if hasattr(os, "_fspath"): + class TestPEP519PurePython(TestPEP519): + + """Explicitly test the pure Python implementation of os.fspath().""" + + fspath = staticmethod(os._fspath) if __name__ == "__main__": diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Library ------- +- Issue #27186: Update os.fspath()/PyOS_FSPath() to check the return value of + __fspath__() to be either str or bytes. + - Issue #18726: All optional parameters of the dump(), dumps(), load() and loads() functions and JSONEncoder and JSONDecoder class constructors in the json module are now keyword-only. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -12317,12 +12317,21 @@ if (NULL == func) { return PyErr_Format(PyExc_TypeError, "expected str, bytes or os.PathLike object, " - "not %S", - path->ob_type); + "not %.200s", + Py_TYPE(path)->tp_name); } path_repr = PyObject_CallFunctionObjArgs(func, NULL); Py_DECREF(func); + if (!(PyUnicode_Check(path_repr) || PyBytes_Check(path_repr))) { + PyErr_Format(PyExc_TypeError, + "expected %.200s.__fspath__() to return str or bytes, " + "not %.200s", Py_TYPE(path)->tp_name, + Py_TYPE(path_repr)->tp_name); + Py_DECREF(path_repr); + return NULL; + } + return path_repr; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 24 15:21:52 2016 From: python-checkins at python.org (brett.cannon) Date: Fri, 24 Jun 2016 19:21:52 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327186=3A_Define_w?= =?utf-8?q?hat_a_=22path-like_object=22_is=2E?= Message-ID: <20160624192152.22059.38113.8218856B@psf.io> https://hg.python.org/cpython/rev/9c57178f13dc changeset: 102161:9c57178f13dc user: Brett Cannon date: Fri Jun 24 12:21:47 2016 -0700 summary: Issue #27186: Define what a "path-like object" is. Thanks to Dusty Phillips for the initial patch. files: Doc/glossary.rst | 10 ++++++++++ Doc/library/os.rst | 16 +++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Doc/glossary.rst b/Doc/glossary.rst --- a/Doc/glossary.rst +++ b/Doc/glossary.rst @@ -778,6 +778,16 @@ One of the default :term:`meta path finders ` which searches an :term:`import path` for modules. + path-like object + An object representing a file system path. A path-like object is either + a :class:`str` or :class:`bytes` object representing a path, or an object + implementing the :class:`os.PathLike` protocol. An object that supports + the :class:`os.PathLike` protocol can be converted to a :class:`str` or + :class:`bytes` file system path by calling the :func:`os.fspath` function; + :func:`os.fsdecode` and :func:`os.fsencode` can be used to guarantee a + :class:`str` or :class:`bytes` result instead, respectively. Introduced + by :pep:`519`. + portion A set of files in a single directory (possibly stored in a zip file) that contribute to a namespace package, as defined in :pep:`420`. diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -171,8 +171,9 @@ .. function:: fsencode(filename) - Encode *filename* to the filesystem encoding with ``'surrogateescape'`` - error handler, or ``'strict'`` on Windows; return :class:`bytes` unchanged. + Encode :term:`path-like ` *filename* to the filesystem + encoding with ``'surrogateescape'`` error handler, or ``'strict'`` on + Windows; return :class:`bytes` unchanged. :func:`fsdecode` is the reverse function. @@ -185,8 +186,9 @@ .. function:: fsdecode(filename) - Decode *filename* from the filesystem encoding with ``'surrogateescape'`` - error handler, or ``'strict'`` on Windows; return :class:`str` unchanged. + Decode the :term:`path-like ` *filename* from the + filesystem encoding with ``'surrogateescape'`` error handler, or ``'strict'`` + on Windows; return :class:`str` unchanged. :func:`fsencode` is the reverse function. @@ -2003,8 +2005,8 @@ control over errors, you can catch :exc:`OSError` when calling one of the ``DirEntry`` methods and handle as appropriate. - To be directly usable as a path-like object, ``DirEntry`` implements the - :class:`os.PathLike` interface. + To be directly usable as a :term:`path-like object`, ``DirEntry`` implements + the :class:`os.PathLike` interface. Attributes and methods on a ``DirEntry`` instance are as follows: @@ -2112,7 +2114,7 @@ Note that there is a nice correspondence between several attributes and methods of ``DirEntry`` and of :class:`pathlib.Path`. In - particular, the ``name`` and ``path`` attributes have the same + particular, the ``name`` attribute has the same meaning, as do the ``is_dir()``, ``is_file()``, ``is_symlink()`` and ``stat()`` methods. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 24 15:24:20 2016 From: python-checkins at python.org (brett.cannon) Date: Fri, 24 Jun 2016 19:24:20 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Remove_a_stale?= =?utf-8?q?_reference_to_pathlib=2EPurePath=2Epath?= Message-ID: <20160624192420.4015.92326.C623EE1B@psf.io> https://hg.python.org/cpython/rev/a9c21bc3c905 changeset: 102162:a9c21bc3c905 branch: 3.5 parent: 102157:41c3a0ca4f6a user: Brett Cannon date: Fri Jun 24 12:22:14 2016 -0700 summary: Remove a stale reference to pathlib.PurePath.path files: Doc/library/os.rst | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -2053,9 +2053,8 @@ Note that there is a nice correspondence between several attributes and methods of ``DirEntry`` and of :class:`pathlib.Path`. In - particular, the ``name`` and ``path`` attributes have the same - meaning, as do the ``is_dir()``, ``is_file()``, ``is_symlink()`` - and ``stat()`` methods. + particular, the ``name`` attribute has the same meaning, as do the + ``is_dir()``, ``is_file()``, ``is_symlink()`` and ``stat()`` methods. .. versionadded:: 3.5 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 24 15:24:20 2016 From: python-checkins at python.org (brett.cannon) Date: Fri, 24 Jun 2016 19:24:20 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5?= Message-ID: <20160624192420.7624.92716.753DC31A@psf.io> https://hg.python.org/cpython/rev/0e40091e9a24 changeset: 102163:0e40091e9a24 parent: 102161:9c57178f13dc parent: 102162:a9c21bc3c905 user: Brett Cannon date: Fri Jun 24 12:23:23 2016 -0700 summary: Merge from 3.5 files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 24 17:14:51 2016 From: python-checkins at python.org (brett.cannon) Date: Fri, 24 Jun 2016 21:14:51 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327038=3A_Expose_D?= =?utf-8?q?irEntry_as_os=2EDirEntry=2E?= Message-ID: <20160624211450.102210.43502.766EA5A2@psf.io> https://hg.python.org/cpython/rev/b841972ed0bd changeset: 102164:b841972ed0bd user: Brett Cannon date: Fri Jun 24 14:14:44 2016 -0700 summary: Issue #27038: Expose DirEntry as os.DirEntry. Thanks to Jelle Zijlstra for the code portion of the patch. files: Doc/library/os.rst | 56 ++++++++++++++++-------------- Lib/test/test_os.py | 1 + Misc/NEWS | 3 + Modules/posixmodule.c | 1 + 4 files changed, 34 insertions(+), 27 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1920,25 +1920,26 @@ .. function:: scandir(path='.') - Return an iterator of :class:`DirEntry` objects corresponding to the entries - in the directory given by *path*. The entries are yielded in arbitrary - order, and the special entries ``'.'`` and ``'..'`` are not included. + Return an iterator of :class:`os.DirEntry` objects corresponding to the + entries in the directory given by *path*. The entries are yielded in + arbitrary order, and the special entries ``'.'`` and ``'..'`` are not + included. Using :func:`scandir` instead of :func:`listdir` can significantly increase the performance of code that also needs file type or file - attribute information, because :class:`DirEntry` objects expose this + attribute information, because :class:`os.DirEntry` objects expose this information if the operating system provides it when scanning a directory. - All :class:`DirEntry` methods may perform a system call, but - :func:`~DirEntry.is_dir` and :func:`~DirEntry.is_file` usually only - require a system call for symbolic links; :func:`DirEntry.stat` + All :class:`os.DirEntry` methods may perform a system call, but + :func:`~os.DirEntry.is_dir` and :func:`~os.DirEntry.is_file` usually only + require a system call for symbolic links; :func:`os.DirEntry.stat` always requires a system call on Unix but only requires one for symbolic links on Windows. On Unix, *path* can be of type :class:`str` or :class:`bytes` (use :func:`~os.fsencode` and :func:`~os.fsdecode` to encode and decode :class:`bytes` paths). On Windows, *path* must be of type :class:`str`. - On both sytems, the type of the :attr:`~DirEntry.name` and - :attr:`~DirEntry.path` attributes of each :class:`DirEntry` will be of + On both sytems, the type of the :attr:`~os.DirEntry.name` and + :attr:`~os.DirEntry.path` attributes of each :class:`os.DirEntry` will be of the same type as *path*. The :func:`scandir` iterator supports the :term:`context manager` protocol @@ -1993,22 +1994,22 @@ :func:`scandir` will provide as much of this information as possible without making additional system calls. When a ``stat()`` or ``lstat()`` system call - is made, the ``DirEntry`` object will cache the result. - - ``DirEntry`` instances are not intended to be stored in long-lived data + is made, the ``os.DirEntry`` object will cache the result. + + ``os.DirEntry`` instances are not intended to be stored in long-lived data structures; if you know the file metadata has changed or if a long time has elapsed since calling :func:`scandir`, call ``os.stat(entry.path)`` to fetch up-to-date information. - Because the ``DirEntry`` methods can make operating system calls, they may + Because the ``os.DirEntry`` methods can make operating system calls, they may also raise :exc:`OSError`. If you need very fine-grained control over errors, you can catch :exc:`OSError` when calling one of the - ``DirEntry`` methods and handle as appropriate. - - To be directly usable as a :term:`path-like object`, ``DirEntry`` implements - the :class:`os.PathLike` interface. - - Attributes and methods on a ``DirEntry`` instance are as follows: + ``os.DirEntry`` methods and handle as appropriate. + + To be directly usable as a :term:`path-like object`, ``os.DirEntry`` + implements the :class:`os.PathLike` interface. + + Attributes and methods on a ``os.DirEntry`` instance are as follows: .. attribute:: name @@ -2034,8 +2035,9 @@ Return the inode number of the entry. - The result is cached on the ``DirEntry`` object. Use ``os.stat(entry.path, - follow_symlinks=False).st_ino`` to fetch up-to-date information. + The result is cached on the ``os.DirEntry`` object. Use + ``os.stat(entry.path, follow_symlinks=False).st_ino`` to fetch up-to-date + information. On the first, uncached call, a system call is required on Windows but not on Unix. @@ -2050,7 +2052,7 @@ is a directory (without following symlinks); return ``False`` if the entry is any other kind of file or if it doesn't exist anymore. - The result is cached on the ``DirEntry`` object, with a separate cache + The result is cached on the ``os.DirEntry`` object, with a separate cache for *follow_symlinks* ``True`` and ``False``. Call :func:`os.stat` along with :func:`stat.S_ISDIR` to fetch up-to-date information. @@ -2074,8 +2076,8 @@ is a file (without following symlinks); return ``False`` if the entry is a directory or other non-file entry, or if it doesn't exist anymore. - The result is cached on the ``DirEntry`` object. Caching, system calls - made, and exceptions raised are as per :func:`~DirEntry.is_dir`. + The result is cached on the ``os.DirEntry`` object. Caching, system calls + made, and exceptions raised are as per :func:`~os.DirEntry.is_dir`. .. method:: is_symlink() @@ -2083,7 +2085,7 @@ return ``False`` if the entry points to a directory or any kind of file, or if it doesn't exist anymore. - The result is cached on the ``DirEntry`` object. Call + The result is cached on the ``os.DirEntry`` object. Call :func:`os.path.islink` to fetch up-to-date information. On the first, uncached call, no system call is required in most cases. @@ -2108,12 +2110,12 @@ :class:`stat_result` are always set to zero. Call :func:`os.stat` to get these attributes. - The result is cached on the ``DirEntry`` object, with a separate cache + The result is cached on the ``os.DirEntry`` object, with a separate cache for *follow_symlinks* ``True`` and ``False``. Call :func:`os.stat` to fetch up-to-date information. Note that there is a nice correspondence between several attributes - and methods of ``DirEntry`` and of :class:`pathlib.Path`. In + and methods of ``os.DirEntry`` and of :class:`pathlib.Path`. In particular, the ``name`` attribute has the same meaning, as do the ``is_dir()``, ``is_file()``, ``is_symlink()`` and ``stat()`` methods. 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 @@ -2854,6 +2854,7 @@ self.assertEqual(stat1, stat2) def check_entry(self, entry, name, is_dir, is_file, is_symlink): + self.assertIsInstance(entry, os.DirEntry) self.assertEqual(entry.name, name) self.assertEqual(entry.path, os.path.join(self.path, name)) self.assertEqual(entry.inode(), diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Library ------- +- Issue #27038: Expose the DirEntry type as os.DirEntry. Code patch by + Jelle Zijlstra. + - Issue #27186: Update os.fspath()/PyOS_FSPath() to check the return value of __fspath__() to be either str or bytes. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -13320,6 +13320,7 @@ Py_DECREF(unicode); } PyModule_AddObject(m, "_have_functions", list); + PyModule_AddObject(m, "DirEntry", (PyObject *)&DirEntryType); initialized = 1; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 24 22:36:48 2016 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 25 Jun 2016 02:36:48 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Minor_beautification?= Message-ID: <20160625023648.3902.20916.6E8FE0E1@psf.io> https://hg.python.org/cpython/rev/82723e603a34 changeset: 102165:82723e603a34 user: Raymond Hettinger date: Sat Jun 25 05:36:42 2016 +0300 summary: Minor beautification files: Lib/random.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/random.py b/Lib/random.py --- a/Lib/random.py +++ b/Lib/random.py @@ -606,11 +606,11 @@ # This version due to Janne Sinkkonen, and matches all the std # texts (e.g., Knuth Vol 2 Ed 3 pg 134 "the beta distribution"). - y = self.gammavariate(alpha, 1.) + y = self.gammavariate(alpha, 1.0) if y == 0: return 0.0 else: - return y / (y + self.gammavariate(beta, 1.)) + return y / (y + self.gammavariate(beta, 1.0)) ## -------------------- Pareto -------------------- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Jun 24 23:35:52 2016 From: python-checkins at python.org (martin.panter) Date: Sat, 25 Jun 2016 03:35:52 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Remove_duplicate_AF=5FINET?= =?utf-8?q?6_addition?= Message-ID: <20160625033551.7624.89591.0C022192@psf.io> https://hg.python.org/cpython/rev/64ed56fbc5e7 changeset: 102166:64ed56fbc5e7 user: Martin Panter date: Sat Jun 25 03:06:58 2016 +0000 summary: Remove duplicate AF_INET6 addition files: Modules/socketmodule.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -6247,9 +6247,6 @@ PyModule_AddIntMacro(m, AF_UNSPEC); #endif PyModule_AddIntMacro(m, AF_INET); -#ifdef AF_INET6 - PyModule_AddIntMacro(m, AF_INET6); -#endif /* AF_INET6 */ #if defined(AF_UNIX) PyModule_AddIntMacro(m, AF_UNIX); #endif /* AF_UNIX */ -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Sat Jun 25 04:53:03 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 25 Jun 2016 08:53:03 +0000 Subject: [Python-checkins] Daily reference leaks (64ed56fbc5e7): sum=0 Message-ID: <20160625085303.10197.86732.1E1D4DAD@psf.io> results for 64ed56fbc5e7 on branch "default" -------------------------------------------- test_collections leaked [-4, 0, 0] memory blocks, sum=-4 test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogzoBoaT', '--timeout', '7200'] From python-checkins at python.org Sat Jun 25 13:50:29 2016 From: python-checkins at python.org (brett.cannon) Date: Sat, 25 Jun 2016 17:50:29 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5?= Message-ID: <20160625175029.10047.7943.3D9F6050@psf.io> https://hg.python.org/cpython/rev/e432ce85622f changeset: 102168:e432ce85622f parent: 102166:64ed56fbc5e7 parent: 102167:07a68800be99 user: Brett Cannon date: Sat Jun 25 10:50:24 2016 -0700 summary: Merge from 3.5 files: Lib/importlib/util.py | 2 +- Lib/test/test_importlib/test_lazy.py | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Lib/importlib/util.py b/Lib/importlib/util.py --- a/Lib/importlib/util.py +++ b/Lib/importlib/util.py @@ -241,7 +241,7 @@ if id(self) != id(sys.modules[original_name]): msg = ('module object for {!r} substituted in sys.modules ' 'during a lazy load') - raise ValueError(msg.format(original_name)) + raise ValueError(msg.format(original_name)) # Update after loading since that's what would happen in an eager # loading situation. self.__dict__.update(attrs_updated) diff --git a/Lib/test/test_importlib/test_lazy.py b/Lib/test/test_importlib/test_lazy.py --- a/Lib/test/test_importlib/test_lazy.py +++ b/Lib/test/test_importlib/test_lazy.py @@ -1,6 +1,8 @@ import importlib from importlib import abc from importlib import util +import sys +import types import unittest from . import util as test_util @@ -122,12 +124,20 @@ self.assertFalse(hasattr(module, '__name__')) def test_module_substitution_error(self): - source_code = 'import sys; sys.modules[__name__] = 42' - module = self.new_module(source_code) with test_util.uncache(TestingImporter.module_name): - with self.assertRaises(ValueError): + fresh_module = types.ModuleType(TestingImporter.module_name) + sys.modules[TestingImporter.module_name] = fresh_module + module = self.new_module() + with self.assertRaisesRegex(ValueError, "substituted"): module.__name__ + def test_module_already_in_sys(self): + with test_util.uncache(TestingImporter.module_name): + module = self.new_module() + sys.modules[TestingImporter.module_name] = module + # Force the load; just care that no exception is raised. + module.__name__ + if __name__ == '__main__': unittest.main() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 25 13:50:29 2016 From: python-checkins at python.org (brett.cannon) Date: Sat, 25 Jun 2016 17:50:29 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Fix_a_scoping_?= =?utf-8?q?issue_where_an_UnboundLocalError_was_triggered_if_a?= Message-ID: <20160625175029.32620.14125.3510A6D5@psf.io> https://hg.python.org/cpython/rev/07a68800be99 changeset: 102167:07a68800be99 branch: 3.5 parent: 102162:a9c21bc3c905 user: Brett Cannon date: Sat Jun 25 10:47:53 2016 -0700 summary: Fix a scoping issue where an UnboundLocalError was triggered if a lazy-loaded module was already in sys.modules. files: Lib/importlib/util.py | 2 +- Lib/test/test_importlib/test_lazy.py | 16 +++++++++++++--- Misc/NEWS | 4 ++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Lib/importlib/util.py b/Lib/importlib/util.py --- a/Lib/importlib/util.py +++ b/Lib/importlib/util.py @@ -241,7 +241,7 @@ if id(self) != id(sys.modules[original_name]): msg = ('module object for {!r} substituted in sys.modules ' 'during a lazy load') - raise ValueError(msg.format(original_name)) + raise ValueError(msg.format(original_name)) # Update after loading since that's what would happen in an eager # loading situation. self.__dict__.update(attrs_updated) diff --git a/Lib/test/test_importlib/test_lazy.py b/Lib/test/test_importlib/test_lazy.py --- a/Lib/test/test_importlib/test_lazy.py +++ b/Lib/test/test_importlib/test_lazy.py @@ -1,6 +1,8 @@ import importlib from importlib import abc from importlib import util +import sys +import types import unittest from . import util as test_util @@ -122,12 +124,20 @@ self.assertFalse(hasattr(module, '__name__')) def test_module_substitution_error(self): - source_code = 'import sys; sys.modules[__name__] = 42' - module = self.new_module(source_code) with test_util.uncache(TestingImporter.module_name): - with self.assertRaises(ValueError): + fresh_module = types.ModuleType(TestingImporter.module_name) + sys.modules[TestingImporter.module_name] = fresh_module + module = self.new_module() + with self.assertRaisesRegex(ValueError, "substituted"): module.__name__ + def test_module_already_in_sys(self): + with test_util.uncache(TestingImporter.module_name): + module = self.new_module() + sys.modules[TestingImporter.module_name] = module + # Force the load; just care that no exception is raised. + module.__name__ + if __name__ == '__main__': unittest.main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,10 @@ Library ------- +- Fix a scoping issue in importlib.util.LazyLoader which triggered an + UnboundLocalError when lazy-loading a module that was already put into + sys.modules. + - Issue #27079: Fixed curses.ascii functions isblank(), iscntrl() and ispunct(). - Issue #26754: Some functions (compile() etc) accepted a filename argument -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 25 13:58:21 2016 From: python-checkins at python.org (brett.cannon) Date: Sat, 25 Jun 2016 17:58:21 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2326186=3A_Remove_t?= =?utf-8?q?he_restriction_that_built-in_and_extension?= Message-ID: <20160625175821.10234.67275.CC3ECB6B@psf.io> https://hg.python.org/cpython/rev/7af4b3ad75b7 changeset: 102169:7af4b3ad75b7 user: Brett Cannon date: Sat Jun 25 10:58:17 2016 -0700 summary: Issue #26186: Remove the restriction that built-in and extension modules can't be lazily loaded. Thanks to Python 3.6 allowing for types.ModuleType to have its __class__ mutated, the restriction can be lifted by calling create_module() on the wrapped loader. files: Doc/library/importlib.rst | 38 ++++++++++----- Doc/whatsnew/3.6.rst | 13 +++++ Lib/importlib/util.py | 24 ++++----- Lib/test/test_importlib/test_lazy.py | 2 + 4 files changed, 50 insertions(+), 27 deletions(-) diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -379,10 +379,14 @@ An abstract method that executes the module in its own namespace when a module is imported or reloaded. The module should already - be initialized when exec_module() is called. + be initialized when ``exec_module()`` is called. When this method exists, + :meth:`~importlib.abc.Loader.create_module` must be defined. .. versionadded:: 3.4 + .. versionchanged:: 3.6 + :meth:`~importlib.abc.Loader.create_module` must also be defined. + .. method:: load_module(fullname) A legacy method for loading a module. If the module cannot be @@ -1200,12 +1204,13 @@ .. function:: module_from_spec(spec) - Create a new module based on **spec** and ``spec.loader.create_module()``. + Create a new module based on **spec** and + :meth:`spec.loader.create_module `. - If ``spec.loader.create_module()`` does not return ``None``, then any - pre-existing attributes will not be reset. Also, no :exc:`AttributeError` - will be raised if triggered while accessing **spec** or setting an attribute - on the module. + If :meth:`spec.loader.create_module ` + does not return ``None``, then any pre-existing attributes will not be reset. + Also, no :exc:`AttributeError` will be raised if triggered while accessing + **spec** or setting an attribute on the module. This function is preferred over using :class:`types.ModuleType` to create a new module as **spec** is used to set as many import-controlled attributes on @@ -1267,7 +1272,8 @@ .. decorator:: set_package - A :term:`decorator` for :meth:`importlib.abc.Loader.load_module` to set the :attr:`__package__` attribute on the returned module. If :attr:`__package__` + A :term:`decorator` for :meth:`importlib.abc.Loader.load_module` to set the + :attr:`__package__` attribute on the returned module. If :attr:`__package__` is set and has a value other than ``None`` it will not be changed. .. deprecated:: 3.4 @@ -1300,13 +1306,12 @@ This class **only** works with loaders that define :meth:`~importlib.abc.Loader.exec_module` as control over what module type is used for the module is required. For those same reasons, the loader's - :meth:`~importlib.abc.Loader.create_module` method will be ignored (i.e., the - loader's method should only return ``None``; this excludes - :class:`BuiltinImporter` and :class:`ExtensionFileLoader`). Finally, - modules which substitute the object placed into :attr:`sys.modules` will - not work as there is no way to properly replace the module references - throughout the interpreter safely; :exc:`ValueError` is raised if such a - substitution is detected. + :meth:`~importlib.abc.Loader.create_module` method must return ``None`` or a + type for which its ``__class__`` attribute can be mutated along with not + using :term:`slots <__slots__>`. Finally, modules which substitute the object + placed into :attr:`sys.modules` will not work as there is no way to properly + replace the module references throughout the interpreter safely; + :exc:`ValueError` is raised if such a substitution is detected. .. note:: For projects where startup time is critical, this class allows for @@ -1317,6 +1322,11 @@ .. versionadded:: 3.5 + .. versionchanged:: 3.6 + Began calling :meth:`~importlib.abc.Loader.create_module`, removing the + compatibility warning for :class:`importlib.machinery.BuiltinImporter` and + :class:`importlib.machinery.ExtensionFileLoader`. + .. classmethod:: factory(loader) A static method which returns a callable that creates a lazy loader. This diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -291,6 +291,16 @@ In compensation, the eventual result with be that some idlelib classes will be easier to use, with better APIs and docstrings explaining them. Additional useful information will be added to idlelib when available. +importlib +--------- + +:class:`importlib.util.LazyLoader` now calls +:meth:`~importlib.abc.Loader.create_module` on the wrapped loader, removing the +restriction that :class:`importlib.machinery.BuiltinImporter` and +:class:`importlib.machinery.ExtensionFileLoader` couldn't be used with +:class:`importlib.util.LazyLoader`. + + os -- @@ -620,6 +630,9 @@ Changes in the Python API ------------------------- +* When :meth:`importlib.abc.Loader.exec_module` is defined, + :meth:`importlib.abc.Loader.create_module` must also be defined. + * The format of the ``co_lnotab`` attribute of code objects changed to support negative line number delta. By default, Python does not emit bytecode with negative line number delta. Functions using ``frame.f_lineno``, diff --git a/Lib/importlib/util.py b/Lib/importlib/util.py --- a/Lib/importlib/util.py +++ b/Lib/importlib/util.py @@ -204,11 +204,6 @@ return module_for_loader_wrapper -class _Module(types.ModuleType): - - """A subclass of the module type to allow __class__ manipulation.""" - - class _LazyModule(types.ModuleType): """A subclass of the module type which triggers loading upon attribute access.""" @@ -218,13 +213,14 @@ # All module metadata must be garnered from __spec__ in order to avoid # using mutated values. # Stop triggering this method. - self.__class__ = _Module + self.__class__ = types.ModuleType # Get the original name to make sure no object substitution occurred # in sys.modules. original_name = self.__spec__.name # Figure out exactly what attributes were mutated between the creation # of the module and now. - attrs_then = self.__spec__.loader_state + attrs_then = self.__spec__.loader_state['__dict__'] + original_type = self.__spec__.loader_state['__class__'] attrs_now = self.__dict__ attrs_updated = {} for key, value in attrs_now.items(): @@ -239,9 +235,9 @@ # object was put into sys.modules. if original_name in sys.modules: if id(self) != id(sys.modules[original_name]): - msg = ('module object for {!r} substituted in sys.modules ' - 'during a lazy load') - raise ValueError(msg.format(original_name)) + raise ValueError(f"module object for {original_name!r} " + "substituted in sys.modules during a lazy " + "load") # Update after loading since that's what would happen in an eager # loading situation. self.__dict__.update(attrs_updated) @@ -275,8 +271,7 @@ self.loader = loader def create_module(self, spec): - """Create a module which can have its __class__ manipulated.""" - return _Module(spec.name) + return self.loader.create_module(spec) def exec_module(self, module): """Make the module load lazily.""" @@ -286,5 +281,8 @@ # on an object would have triggered the load, # e.g. ``module.__spec__.loader = None`` would trigger a load from # trying to access module.__spec__. - module.__spec__.loader_state = module.__dict__.copy() + loader_state = {} + loader_state['__dict__'] = module.__dict__.copy() + loader_state['__class__'] = module.__class__ + module.__spec__.loader_state = loader_state module.__class__ = _LazyModule diff --git a/Lib/test/test_importlib/test_lazy.py b/Lib/test/test_importlib/test_lazy.py --- a/Lib/test/test_importlib/test_lazy.py +++ b/Lib/test/test_importlib/test_lazy.py @@ -66,6 +66,8 @@ spec = util.spec_from_loader(TestingImporter.module_name, util.LazyLoader(loader)) module = spec.loader.create_module(spec) + if module is None: + module = types.ModuleType(TestingImporter.module_name) module.__spec__ = spec module.__loader__ = spec.loader spec.loader.exec_module(module) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 25 15:43:23 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 25 Jun 2016 19:43:23 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2326243=3A_Only_the?= =?utf-8?q?_level_argument_to_zlib=2Ecompress=28=29_is_keyword_argument?= Message-ID: <20160625194323.6640.77109.657D5EE3@psf.io> https://hg.python.org/cpython/rev/01f82a7a1250 changeset: 102170:01f82a7a1250 user: Serhiy Storchaka date: Sat Jun 25 22:43:05 2016 +0300 summary: Issue #26243: Only the level argument to zlib.compress() is keyword argument now. The first argument is positional-only. files: Doc/library/zlib.rst | 2 +- Lib/test/test_zlib.py | 4 +++- Misc/NEWS | 3 +++ Modules/clinic/zlibmodule.c.h | 6 +++--- Modules/zlibmodule.c | 3 ++- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Doc/library/zlib.rst b/Doc/library/zlib.rst --- a/Doc/library/zlib.rst +++ b/Doc/library/zlib.rst @@ -58,7 +58,7 @@ Raises the :exc:`error` exception if any error occurs. .. versionchanged:: 3.6 - Keyword arguments are now supported. + *level* is now supported as keyword arguments. .. function:: compressobj(level=-1, method=DEFLATED, wbits=15, memLevel=8, strategy=Z_DEFAULT_STRATEGY[, zdict]) 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 @@ -163,8 +163,10 @@ self.assertEqual(zlib.decompress(x), HAMLET_SCENE) def test_keywords(self): - x = zlib.compress(data=HAMLET_SCENE, level=3) + x = zlib.compress(HAMLET_SCENE, level=3) self.assertEqual(zlib.decompress(x), HAMLET_SCENE) + with self.assertRaises(TypeError): + zlib.compress(data=HAMLET_SCENE, level=3) def test_speech128(self): # compress more data diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Library ------- +- Issue #26243: Only the level argument to zlib.compress() is keyword argument + now. The first argument is positional-only. + - Issue #27038: Expose the DirEntry type as os.DirEntry. Code patch by Jelle Zijlstra. diff --git a/Modules/clinic/zlibmodule.c.h b/Modules/clinic/zlibmodule.c.h --- a/Modules/clinic/zlibmodule.c.h +++ b/Modules/clinic/zlibmodule.c.h @@ -3,7 +3,7 @@ [clinic start generated code]*/ PyDoc_STRVAR(zlib_compress__doc__, -"compress($module, /, data, level=Z_DEFAULT_COMPRESSION)\n" +"compress($module, data, /, level=Z_DEFAULT_COMPRESSION)\n" "--\n" "\n" "Returns a bytes object containing compressed data.\n" @@ -23,7 +23,7 @@ zlib_compress(PyModuleDef *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - static char *_keywords[] = {"data", "level", NULL}; + static char *_keywords[] = {"", "level", NULL}; Py_buffer data = {NULL, NULL}; int level = Z_DEFAULT_COMPRESSION; @@ -460,4 +460,4 @@ #ifndef ZLIB_COMPRESS_COPY_METHODDEF #define ZLIB_COMPRESS_COPY_METHODDEF #endif /* !defined(ZLIB_COMPRESS_COPY_METHODDEF) */ -/*[clinic end generated code: output=9bd8a093baa653b2 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=ba904dec30cc1a1a input=a9049054013a1b77]*/ diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -143,6 +143,7 @@ data: Py_buffer Binary data to be compressed. + / level: int(c_default="Z_DEFAULT_COMPRESSION") = Z_DEFAULT_COMPRESSION Compression level, in 0-9 or -1. @@ -151,7 +152,7 @@ static PyObject * zlib_compress_impl(PyModuleDef *module, Py_buffer *data, int level) -/*[clinic end generated code: output=1b97589132b203b4 input=abed30f4fa14e213]*/ +/*[clinic end generated code: output=1b97589132b203b4 input=638d54b6315dbed3]*/ { PyObject *ReturnVal = NULL; Byte *input, *output = NULL; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 25 15:47:24 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 25 Jun 2016 19:47:24 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2326243=3A_Correct_?= =?utf-8?q?a_wording_in_docs=2E?= Message-ID: <20160625194724.572.33032.5C76374B@psf.io> https://hg.python.org/cpython/rev/ab2e7e51869d changeset: 102171:ab2e7e51869d user: Serhiy Storchaka date: Sat Jun 25 22:47:04 2016 +0300 summary: Issue #26243: Correct a wording in docs. Thanks Berker. files: Doc/library/zlib.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/zlib.rst b/Doc/library/zlib.rst --- a/Doc/library/zlib.rst +++ b/Doc/library/zlib.rst @@ -58,7 +58,7 @@ Raises the :exc:`error` exception if any error occurs. .. versionchanged:: 3.6 - *level* is now supported as keyword arguments. + *level* can now be used as a keyword parameter. .. function:: compressobj(level=-1, method=DEFLATED, wbits=15, memLevel=8, strategy=Z_DEFAULT_STRATEGY[, zdict]) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 25 16:53:13 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 25 Jun 2016 20:53:13 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2324137=3A_Fixed_ID?= =?utf-8?q?LE_on_Linux_with_tkinter_default_root_disabled=2E?= Message-ID: <20160625205313.367.30304.9899E23A@psf.io> https://hg.python.org/cpython/rev/a8d611eb6173 changeset: 102172:a8d611eb6173 user: Serhiy Storchaka date: Sat Jun 25 23:52:51 2016 +0300 summary: Issue #24137: Fixed IDLE on Linux with tkinter default root disabled. files: Lib/idlelib/pyshell.py | 3 ++- 1 files changed, 2 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 @@ -1562,7 +1562,8 @@ ext = '.png' if TkVersion >= 8.6 else '.gif' iconfiles = [os.path.join(icondir, 'idle_%d%s' % (size, ext)) for size in (16, 32, 48)] - icons = [PhotoImage(file=iconfile) for iconfile in iconfiles] + icons = [PhotoImage(master=root, file=iconfile) + for iconfile in iconfiles] root.wm_iconphoto(True, *icons) # start editor and/or shell windows: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 25 17:04:54 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 25 Jun 2016 21:04:54 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Added_tag_v2?= =?utf-8?q?=2E7=2E12_for_changeset_d33e0cf91556?= Message-ID: <20160625210454.119835.9010.28B59F3E@psf.io> https://hg.python.org/cpython/rev/82579a698756 changeset: 102174:82579a698756 branch: 2.7 user: Benjamin Peterson date: Sat Jun 25 14:03:27 2016 -0700 summary: Added tag v2.7.12 for changeset d33e0cf91556 files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -173,3 +173,4 @@ 82dd9545bd93d6e7a9821e1dabc7b25508d0fa3a v2.7.11rc1 6d1b6a68f775fada9877d295e62958bafa1ca11e v2.7.11 13912cd1e7e8fc6986f42822f5439ae1f2bc0d7d v2.7.12rc1 +d33e0cf91556723fb8cebefdad1f3bce43b2244d v2.7.12 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 25 17:04:54 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 25 Jun 2016 21:04:54 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogMi43LjEyIGZpbmFs?= Message-ID: <20160625210453.32761.23411.E3598C72@psf.io> https://hg.python.org/cpython/rev/d33e0cf91556 changeset: 102173:d33e0cf91556 branch: 2.7 tag: v2.7.12 parent: 102122:45d4cea97b04 user: Benjamin Peterson date: Sat Jun 25 14:03:21 2016 -0700 summary: 2.7.12 final files: Include/patchlevel.h | 6 +++--- Misc/NEWS | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -23,11 +23,11 @@ #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 7 #define PY_MICRO_VERSION 12 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 1 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "2.7.12rc1" +#define PY_VERSION "2.7.12" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository). Empty diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -5,6 +5,8 @@ What's New in Python 2.7.12? ============================ +*Release date: 2016-06-25* + Build ----- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 25 17:04:54 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 25 Jun 2016 21:04:54 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMi43IC0+IDIuNyk6?= =?utf-8?q?_merge_2=2E7=2E12_release_branch?= Message-ID: <20160625210454.22313.82085.F5F0D2DC@psf.io> https://hg.python.org/cpython/rev/b97d1ec156f9 changeset: 102175:b97d1ec156f9 branch: 2.7 parent: 102159:1ed74994c3e3 parent: 102174:82579a698756 user: Benjamin Peterson date: Sat Jun 25 14:04:11 2016 -0700 summary: merge 2.7.12 release branch files: .hgtags | 1 + Include/patchlevel.h | 6 +++--- Misc/NEWS | 2 ++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -173,3 +173,4 @@ 82dd9545bd93d6e7a9821e1dabc7b25508d0fa3a v2.7.11rc1 6d1b6a68f775fada9877d295e62958bafa1ca11e v2.7.11 13912cd1e7e8fc6986f42822f5439ae1f2bc0d7d v2.7.12rc1 +d33e0cf91556723fb8cebefdad1f3bce43b2244d v2.7.12 diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -23,11 +23,11 @@ #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 7 #define PY_MICRO_VERSION 12 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 1 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "2.7.12rc1+" +#define PY_VERSION "2.7.12" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository). Empty diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -38,6 +38,8 @@ What's New in Python 2.7.12? ============================ +*Release date: 2016-06-25* + Build ----- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 25 17:04:59 2016 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 25 Jun 2016 21:04:59 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogcG9zdCAyLjcuMTIg?= =?utf-8?q?version?= Message-ID: <20160625210459.3805.27600.E65E8200@psf.io> https://hg.python.org/cpython/rev/7a8c8538bdb8 changeset: 102176:7a8c8538bdb8 branch: 2.7 user: Benjamin Peterson date: Sat Jun 25 14:04:38 2016 -0700 summary: post 2.7.12 version files: Include/patchlevel.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -27,7 +27,7 @@ #define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "2.7.12" +#define PY_VERSION "2.7.12+" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository). Empty -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 25 17:09:42 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 25 Jun 2016 21:09:42 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2320350=2E_tkapp=2E?= =?utf-8?q?splitlist=28=29_is_now_always_used_instead_of_unreliable?= Message-ID: <20160625210942.10066.1545.8C21879A@psf.io> https://hg.python.org/cpython/rev/8d78cd7c4a9e changeset: 102177:8d78cd7c4a9e parent: 102172:a8d611eb6173 user: Serhiy Storchaka date: Sun Jun 26 00:09:19 2016 +0300 summary: Issue #20350. tkapp.splitlist() is now always used instead of unreliable tkapp.split() in the tkinter package. files: Lib/tkinter/__init__.py | 16 +++++++--------- Lib/tkinter/tix.py | 11 +++++------ 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -383,7 +383,7 @@ pass def trace_vinfo(self): """Return all trace callback information.""" - return [self._tk.split(x) for x in self._tk.splitlist( + return [self._tk.splitlist(x) for x in self._tk.splitlist( self._tk.call("trace", "vinfo", self._name))] def __eq__(self, other): """Comparison for equality (==). @@ -1043,18 +1043,16 @@ def winfo_visualid(self): """Return the X identifier for the visual for this widget.""" return self.tk.call('winfo', 'visualid', self._w) - def winfo_visualsavailable(self, includeids=0): + def winfo_visualsavailable(self, includeids=False): """Return a list of all visuals available for the screen of this widget. Each item in the list consists of a visual name (see winfo_visual), a - depth and if INCLUDEIDS=1 is given also the X identifier.""" - data = self.tk.split( - self.tk.call('winfo', 'visualsavailable', self._w, - includeids and 'includeids' or None)) - if isinstance(data, str): - data = [self.tk.split(data)] - return [self.__winfo_parseitem(x) for x in data] + depth and if includeids is true is given also the X identifier.""" + data = self.tk.call('winfo', 'visualsavailable', self._w, + 'includeids' if includeids else None) + data = [self.tk.splitlist(x) for x in self.tk.splitlist(data)] + return [self.__winfo_parseitem(x) for x in data] def __winfo_parseitem(self, t): """Internal function.""" return t[:1] + tuple(map(self.__winfo_getint, t[1:])) diff --git a/Lib/tkinter/tix.py b/Lib/tkinter/tix.py --- a/Lib/tkinter/tix.py +++ b/Lib/tkinter/tix.py @@ -1106,7 +1106,7 @@ def pages(self): # Can't call subwidgets_all directly because we don't want .nbframe - names = self.tk.split(self.tk.call(self._w, 'pages')) + names = self.tk.splitlist(self.tk.call(self._w, 'pages')) ret = [] for x in names: ret.append(self.subwidget(x)) @@ -1152,7 +1152,7 @@ def pages(self): # Can't call subwidgets_all directly because we don't want .nbframe - names = self.tk.split(self.tk.call(self._w, 'pages')) + names = self.tk.splitlist(self.tk.call(self._w, 'pages')) ret = [] for x in names: ret.append(self.subwidget(x)) @@ -1575,8 +1575,7 @@ '''Returns a list of items whose status matches status. If status is not specified, the list of items in the "on" status will be returned. Mode can be on, off, default''' - c = self.tk.split(self.tk.call(self._w, 'getselection', mode)) - return self.tk.splitlist(c) + return self.tk.splitlist(self.tk.call(self._w, 'getselection', mode)) def getstatus(self, entrypath): '''Returns the current status of entryPath.''' @@ -1897,7 +1896,7 @@ or a real number following by the word chars (e.g. 3.4chars) that sets the width of the column to the given number of characters.""" - return self.tk.split(self.tk.call(self._w, 'size', 'column', index, + return self.tk.splitlist(self.tk.call(self._w, 'size', 'column', index, *self._options({}, kw))) def size_row(self, index, **kw): @@ -1922,7 +1921,7 @@ or a real number following by the word chars (e.g. 3.4chars) that sets the height of the row to the given number of characters.""" - return self.tk.split(self.tk.call( + return self.tk.splitlist(self.tk.call( self, 'size', 'row', index, *self._options({}, kw))) def unset(self, x, y): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 25 19:43:47 2016 From: python-checkins at python.org (steve.dower) Date: Sat, 25 Jun 2016 23:43:47 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Simplifies_nug?= =?utf-8?q?et_build_with_better_parameters=2E?= Message-ID: <20160625234347.32761.51845.EE661D11@psf.io> https://hg.python.org/cpython/rev/b76e23fb3c71 changeset: 102178:b76e23fb3c71 branch: 3.5 parent: 102167:07a68800be99 user: Steve Dower date: Sat Jun 25 16:13:30 2016 -0700 summary: Simplifies nuget build with better parameters. files: Tools/nuget/make_pkg.proj | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Tools/nuget/make_pkg.proj b/Tools/nuget/make_pkg.proj --- a/Tools/nuget/make_pkg.proj +++ b/Tools/nuget/make_pkg.proj @@ -6,6 +6,7 @@ $(OutputName)x86 false + true @@ -24,7 +25,7 @@ "$(PythonExe)" "$(MSBuildThisFileDirectory)\..\msi\make_zip.py" $(PythonArguments) -t "$(IntermediateOutputPath)" -a $(ArchName) - "$(IntermediateOutputPath)\python.exe" -B -c "import sys; sys.path.append('$(PySourcePath)\Lib'); import ensurepip; ensurepip._main()" + "$(IntermediateOutputPath)\python.exe" -B -c "import sys; sys.path.append(r'$(PySourcePath)\Lib'); import ensurepip; ensurepip._main()" "$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).nuspec" $(NugetArguments) -BasePath "$(IntermediateOutputPath)" -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Jun 25 19:43:48 2016 From: python-checkins at python.org (steve.dower) Date: Sat, 25 Jun 2016 23:43:48 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5?= Message-ID: <20160625234347.86800.52020.A5DE58F4@psf.io> https://hg.python.org/cpython/rev/dbdc95931fa7 changeset: 102179:dbdc95931fa7 parent: 102177:8d78cd7c4a9e parent: 102178:b76e23fb3c71 user: Steve Dower date: Sat Jun 25 16:43:26 2016 -0700 summary: Merge from 3.5 files: Tools/nuget/make_pkg.proj | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Tools/nuget/make_pkg.proj b/Tools/nuget/make_pkg.proj --- a/Tools/nuget/make_pkg.proj +++ b/Tools/nuget/make_pkg.proj @@ -6,6 +6,7 @@ $(OutputName)x86 false + true @@ -24,7 +25,7 @@ "$(PythonExe)" "$(MSBuildThisFileDirectory)\..\msi\make_zip.py" $(PythonArguments) -t "$(IntermediateOutputPath)" -a $(ArchName) - "$(IntermediateOutputPath)\python.exe" -B -c "import sys; sys.path.append('$(PySourcePath)\Lib'); import ensurepip; ensurepip._main()" + "$(IntermediateOutputPath)\python.exe" -B -c "import sys; sys.path.append(r'$(PySourcePath)\Lib'); import ensurepip; ensurepip._main()" "$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).nuspec" $(NugetArguments) -BasePath "$(IntermediateOutputPath)" -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 01:59:47 2016 From: python-checkins at python.org (berker.peksag) Date: Sun, 26 Jun 2016 05:59:47 +0000 Subject: [Python-checkins] =?utf-8?q?devguide=3A_Update_pythondotorg_link?= Message-ID: <20160626055947.15827.12777.F166D69A@psf.io> https://hg.python.org/devguide/rev/128b45caba5b changeset: 811:128b45caba5b user: Berker Peksag date: Sun Jun 26 09:01:18 2016 +0300 summary: Update pythondotorg link files: index.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/index.rst b/index.rst --- a/index.rst +++ b/index.rst @@ -281,7 +281,7 @@ .. _Firefox search engine plug-in: http://www.python.org/dev/searchplugin/ .. _Misc directory: https://hg.python.org/cpython/file/default/Misc .. _PEPs: http://www.python.org/dev/peps/ -.. _python.org maintenance: http://python.org/dev/pydotorg/ +.. _python.org maintenance: https://pythondotorg.readthedocs.io/ .. _Python: http://www.python.org/ .. _Python Mentors: http://pythonmentors.com/ .. _PyPy: http://www.pypy.org/ -- Repository URL: https://hg.python.org/devguide From python-checkins at python.org Sun Jun 26 02:47:20 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 26 Jun 2016 06:47:20 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2322115=3A_Added_me?= =?utf-8?q?thods_trace=5Fadd=2C_trace=5Fremove_and_trace=5Finfo_in_the?= Message-ID: <20160626064720.16172.47485.4CF82D67@psf.io> https://hg.python.org/cpython/rev/a201180c0f77 changeset: 102180:a201180c0f77 user: Serhiy Storchaka date: Sun Jun 26 09:46:57 2016 +0300 summary: Issue #22115: Added methods trace_add, trace_remove and trace_info in the tkinter.Variable class. They replace old methods trace_variable, trace, trace_vdelete and trace_vinfo that use obsolete Tcl commands and might not work in future versions of Tcl. files: Doc/whatsnew/3.6.rst | 13 + Lib/idlelib/configdialog.py | 38 +- Lib/tkinter/__init__.py | 99 ++++++++- Lib/tkinter/test/test_tkinter/test_variables.py | 101 +++++++++- Misc/NEWS | 5 + 5 files changed, 220 insertions(+), 36 deletions(-) diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -391,6 +391,19 @@ St?phane Wirtel in :issue:`25485`). +tkinter +------- + +Added methods :meth:`~tkinter.Variable.trace_add`, +:meth:`~tkinter.Variable.trace_remove` and :meth:`~tkinter.Variable.trace_info` +in the :class:`tkinter.Variable` class. They replace old methods +:meth:`~tkinter.Variable.trace_variable`, :meth:`~tkinter.Variable.trace`, +:meth:`~tkinter.Variable.trace_vdelete` and +:meth:`~tkinter.Variable.trace_vinfo` that use obsolete Tcl commands and might +not work in future versions of Tcl. +(Contributed by Serhiy Storchaka in :issue:`22115`). + + typing ------ diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -465,24 +465,24 @@ return frame def AttachVarCallbacks(self): - self.fontSize.trace_variable('w', self.VarChanged_font) - self.fontName.trace_variable('w', self.VarChanged_font) - self.fontBold.trace_variable('w', self.VarChanged_font) - self.spaceNum.trace_variable('w', self.VarChanged_spaceNum) - self.colour.trace_variable('w', self.VarChanged_colour) - self.builtinTheme.trace_variable('w', self.VarChanged_builtinTheme) - self.customTheme.trace_variable('w', self.VarChanged_customTheme) - self.themeIsBuiltin.trace_variable('w', self.VarChanged_themeIsBuiltin) - self.highlightTarget.trace_variable('w', self.VarChanged_highlightTarget) - self.keyBinding.trace_variable('w', self.VarChanged_keyBinding) - self.builtinKeys.trace_variable('w', self.VarChanged_builtinKeys) - self.customKeys.trace_variable('w', self.VarChanged_customKeys) - self.keysAreBuiltin.trace_variable('w', self.VarChanged_keysAreBuiltin) - self.winWidth.trace_variable('w', self.VarChanged_winWidth) - self.winHeight.trace_variable('w', self.VarChanged_winHeight) - self.startupEdit.trace_variable('w', self.VarChanged_startupEdit) - self.autoSave.trace_variable('w', self.VarChanged_autoSave) - self.encoding.trace_variable('w', self.VarChanged_encoding) + self.fontSize.trace_add('write', self.VarChanged_font) + self.fontName.trace_add('write', self.VarChanged_font) + self.fontBold.trace_add('write', self.VarChanged_font) + self.spaceNum.trace_add('write', self.VarChanged_spaceNum) + self.colour.trace_add('write', self.VarChanged_colour) + self.builtinTheme.trace_add('write', self.VarChanged_builtinTheme) + self.customTheme.trace_add('write', self.VarChanged_customTheme) + self.themeIsBuiltin.trace_add('write', self.VarChanged_themeIsBuiltin) + self.highlightTarget.trace_add('write', self.VarChanged_highlightTarget) + self.keyBinding.trace_add('write', self.VarChanged_keyBinding) + self.builtinKeys.trace_add('write', self.VarChanged_builtinKeys) + self.customKeys.trace_add('write', self.VarChanged_customKeys) + self.keysAreBuiltin.trace_add('write', self.VarChanged_keysAreBuiltin) + self.winWidth.trace_add('write', self.VarChanged_winWidth) + self.winHeight.trace_add('write', self.VarChanged_winHeight) + self.startupEdit.trace_add('write', self.VarChanged_startupEdit) + self.autoSave.trace_add('write', self.VarChanged_autoSave) + self.encoding.trace_add('write', self.VarChanged_encoding) def remove_var_callbacks(self): "Remove callbacks to prevent memory leaks." @@ -493,7 +493,7 @@ self.keyBinding, self.builtinKeys, self.customKeys, self.keysAreBuiltin, self.winWidth, self.winHeight, self.startupEdit, self.autoSave, self.encoding,): - var.trace_vdelete('w', var.trace_vinfo()[0][1]) + var.trace_remove('write', var.trace_info()[0][1]) def VarChanged_font(self, *params): '''When one font attribute changes, save them all, as they are diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -343,16 +343,9 @@ def get(self): """Return value of variable.""" return self._tk.globalgetvar(self._name) - def trace_variable(self, mode, callback): - """Define a trace callback for the variable. - - MODE is one of "r", "w", "u" for read, write, undefine. - CALLBACK must be a function which is called when - the variable is read, written or undefined. - - Return the name of the callback. - """ - f = CallWrapper(callback, None, self).__call__ + + def _register(self, callback): + f = CallWrapper(callback, None, self._root).__call__ cbname = repr(id(f)) try: callback = callback.__func__ @@ -366,25 +359,99 @@ if self._tclCommands is None: self._tclCommands = [] self._tclCommands.append(cbname) + return cbname + + def trace_add(self, mode, callback): + """Define a trace callback for the variable. + + Mode is one of "read", "write", "unset", or a list or tuple of + such strings. + Callback must be a function which is called when the variable is + read, written or unset. + + Return the name of the callback. + """ + cbname = self._register(callback) + self._tk.call('trace', 'add', 'variable', + self._name, mode, (cbname,)) + return cbname + + def trace_remove(self, mode, cbname): + """Delete the trace callback for a variable. + + Mode is one of "read", "write", "unset" or a list or tuple of + such strings. Must be same as were specified in trace_add(). + cbname is the name of the callback returned from trace_add(). + """ + self._tk.call('trace', 'remove', 'variable', + self._name, mode, cbname) + for m, ca in self.trace_info(): + if self._tk.splitlist(ca)[0] == cbname: + break + else: + self._tk.deletecommand(cbname) + try: + self._tclCommands.remove(cbname) + except ValueError: + pass + + def trace_info(self): + """Return all trace callback information.""" + splitlist = self._tk.splitlist + return [(splitlist(k), v) for k, v in map(splitlist, + splitlist(self._tk.call('trace', 'info', 'variable', self._name)))] + + def trace_variable(self, mode, callback): + """Define a trace callback for the variable. + + MODE is one of "r", "w", "u" for read, write, undefine. + CALLBACK must be a function which is called when + the variable is read, written or undefined. + + Return the name of the callback. + + This deprecated method wraps a deprecated Tcl method that will + likely be removed in the future. Use trace_add() instead. + """ + # TODO: Add deprecation warning + cbname = self._register(callback) self._tk.call("trace", "variable", self._name, mode, cbname) return cbname + trace = trace_variable + def trace_vdelete(self, mode, cbname): """Delete the trace callback for a variable. MODE is one of "r", "w", "u" for read, write, undefine. CBNAME is the name of the callback returned from trace_variable or trace. + + This deprecated method wraps a deprecated Tcl method that will + likely be removed in the future. Use trace_remove() instead. """ + # TODO: Add deprecation warning self._tk.call("trace", "vdelete", self._name, mode, cbname) - self._tk.deletecommand(cbname) - try: - self._tclCommands.remove(cbname) - except ValueError: - pass + cbname = self._tk.splitlist(cbname)[0] + for m, ca in self.trace_info(): + if self._tk.splitlist(ca)[0] == cbname: + break + else: + self._tk.deletecommand(cbname) + try: + self._tclCommands.remove(cbname) + except ValueError: + pass + def trace_vinfo(self): - """Return all trace callback information.""" + """Return all trace callback information. + + This deprecated method wraps a deprecated Tcl method that will + likely be removed in the future. Use trace_info() instead. + """ + # TODO: Add deprecation warning return [self._tk.splitlist(x) for x in self._tk.splitlist( self._tk.call("trace", "vinfo", self._name))] + def __eq__(self, other): """Comparison for equality (==). diff --git a/Lib/tkinter/test/test_tkinter/test_variables.py b/Lib/tkinter/test/test_tkinter/test_variables.py --- a/Lib/tkinter/test/test_tkinter/test_variables.py +++ b/Lib/tkinter/test/test_tkinter/test_variables.py @@ -1,5 +1,5 @@ import unittest - +import gc from tkinter import (Variable, StringVar, IntVar, DoubleVar, BooleanVar, Tcl, TclError) @@ -87,6 +87,105 @@ v.set("value") self.assertTrue(v.side_effect) + def test_trace_old(self): + # Old interface + v = Var(self.root) + vname = str(v) + trace = [] + def read_tracer(*args): + trace.append(('read',) + args) + def write_tracer(*args): + trace.append(('write',) + args) + cb1 = v.trace_variable('r', read_tracer) + cb2 = v.trace_variable('wu', write_tracer) + self.assertEqual(sorted(v.trace_vinfo()), [('r', cb1), ('wu', cb2)]) + self.assertEqual(trace, []) + + v.set('spam') + self.assertEqual(trace, [('write', vname, '', 'w')]) + + trace = [] + v.get() + self.assertEqual(trace, [('read', vname, '', 'r')]) + + trace = [] + info = sorted(v.trace_vinfo()) + v.trace_vdelete('w', cb1) # Wrong mode + self.assertEqual(sorted(v.trace_vinfo()), info) + with self.assertRaises(TclError): + v.trace_vdelete('r', 'spam') # Wrong command name + self.assertEqual(sorted(v.trace_vinfo()), info) + v.trace_vdelete('r', (cb1, 43)) # Wrong arguments + self.assertEqual(sorted(v.trace_vinfo()), info) + v.get() + self.assertEqual(trace, [('read', vname, '', 'r')]) + + trace = [] + v.trace_vdelete('r', cb1) + self.assertEqual(v.trace_vinfo(), [('wu', cb2)]) + v.get() + self.assertEqual(trace, []) + + trace = [] + del write_tracer + gc.collect() + v.set('eggs') + self.assertEqual(trace, [('write', vname, '', 'w')]) + + trace = [] + del v + gc.collect() + self.assertEqual(trace, [('write', vname, '', 'u')]) + + def test_trace(self): + v = Var(self.root) + vname = str(v) + trace = [] + def read_tracer(*args): + trace.append(('read',) + args) + def write_tracer(*args): + trace.append(('write',) + args) + tr1 = v.trace_add('read', read_tracer) + tr2 = v.trace_add(['write', 'unset'], write_tracer) + self.assertEqual(sorted(v.trace_info()), [ + (('read',), tr1), + (('write', 'unset'), tr2)]) + self.assertEqual(trace, []) + + v.set('spam') + self.assertEqual(trace, [('write', vname, '', 'write')]) + + trace = [] + v.get() + self.assertEqual(trace, [('read', vname, '', 'read')]) + + trace = [] + info = sorted(v.trace_info()) + v.trace_remove('write', tr1) # Wrong mode + self.assertEqual(sorted(v.trace_info()), info) + with self.assertRaises(TclError): + v.trace_remove('read', 'spam') # Wrong command name + self.assertEqual(sorted(v.trace_info()), info) + v.get() + self.assertEqual(trace, [('read', vname, '', 'read')]) + + trace = [] + v.trace_remove('read', tr1) + self.assertEqual(v.trace_info(), [(('write', 'unset'), tr2)]) + v.get() + self.assertEqual(trace, []) + + trace = [] + del write_tracer + gc.collect() + v.set('eggs') + self.assertEqual(trace, [('write', vname, '', 'write')]) + + trace = [] + del v + gc.collect() + self.assertEqual(trace, [('write', vname, '', 'unset')]) + class TestStringVar(TestBase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,11 @@ Library ------- +- Issue #22115: Added methods trace_add, trace_remove and trace_info in the + tkinter.Variable class. They replace old methods trace_variable, trace, + trace_vdelete and trace_vinfo that use obsolete Tcl commands and might + not work in future versions of Tcl. + - Issue #26243: Only the level argument to zlib.compress() is keyword argument now. The first argument is positional-only. -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Sun Jun 26 04:52:10 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 26 Jun 2016 08:52:10 +0000 Subject: [Python-checkins] Daily reference leaks (dbdc95931fa7): sum=5 Message-ID: <20160626085208.26828.13249.8CB56B41@psf.io> results for dbdc95931fa7 on branch "default" -------------------------------------------- test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_spawn leaked [0, -1, 2] memory blocks, sum=1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogXAJCYe', '--timeout', '7200'] From python-checkins at python.org Sun Jun 26 10:48:13 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 26 Jun 2016 14:48:13 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2322115=3A_Updated_Misc/NEWS=2E?= Message-ID: <20160626144813.36039.52880.E88DDB16@psf.io> https://hg.python.org/cpython/rev/c4839c36a71f changeset: 102183:c4839c36a71f parent: 102180:a201180c0f77 parent: 102182:293ec9547334 user: Serhiy Storchaka date: Sun Jun 26 17:47:46 2016 +0300 summary: Issue #22115: Updated Misc/NEWS. files: Lib/tkinter/test/test_tkinter/test_variables.py | 4 ++-- Misc/NEWS | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Lib/tkinter/test/test_tkinter/test_variables.py b/Lib/tkinter/test/test_tkinter/test_variables.py --- a/Lib/tkinter/test/test_tkinter/test_variables.py +++ b/Lib/tkinter/test/test_tkinter/test_variables.py @@ -89,7 +89,7 @@ def test_trace_old(self): # Old interface - v = Var(self.root) + v = Variable(self.root) vname = str(v) trace = [] def read_tracer(*args): @@ -138,7 +138,7 @@ self.assertEqual(trace, [('write', vname, '', 'u')]) def test_trace(self): - v = Var(self.root) + v = Variable(self.root) vname = str(v) trace = [] def read_tracer(*args): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,7 +13,9 @@ - Issue #22115: Added methods trace_add, trace_remove and trace_info in the tkinter.Variable class. They replace old methods trace_variable, trace, trace_vdelete and trace_vinfo that use obsolete Tcl commands and might - not work in future versions of Tcl. + not work in future versions of Tcl. Fixed old tracing methods: + trace_vdelete() with wrong mode no longer break tracing, trace_vinfo() now + always returns a list of pairs of strings, tracing in the "u" mode now works. - Issue #26243: Only the level argument to zlib.compress() is keyword argument now. The first argument is positional-only. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 10:48:13 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 26 Jun 2016 14:48:13 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzIyMTE1?= =?utf-8?q?=3A_Fixed_tracing_Tkinter_variables=3A?= Message-ID: <20160626144813.27096.92955.D386188E@psf.io> https://hg.python.org/cpython/rev/293ec9547334 changeset: 102182:293ec9547334 branch: 3.5 parent: 102178:b76e23fb3c71 user: Serhiy Storchaka date: Sun Jun 26 17:42:23 2016 +0300 summary: Issue #22115: Fixed tracing Tkinter variables: * tracing in the "u" mode now works * trace_vdelete() with wrong mode no longer break tracing * trace_vinfo() now always returns a list of pairs of strings files: Lib/tkinter/__init__.py | 19 ++- Lib/tkinter/test/test_tkinter/test_variables.py | 51 +++++++++- Misc/NEWS | 4 + 3 files changed, 66 insertions(+), 8 deletions(-) diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -271,7 +271,7 @@ Return the name of the callback. """ - f = CallWrapper(callback, None, self).__call__ + f = CallWrapper(callback, None, self._root).__call__ cbname = repr(id(f)) try: callback = callback.__func__ @@ -295,14 +295,19 @@ CBNAME is the name of the callback returned from trace_variable or trace. """ self._tk.call("trace", "vdelete", self._name, mode, cbname) - self._tk.deletecommand(cbname) - try: - self._tclCommands.remove(cbname) - except ValueError: - pass + cbname = self._tk.splitlist(cbname)[0] + for m, ca in self.trace_vinfo(): + if self._tk.splitlist(ca)[0] == cbname: + break + else: + self._tk.deletecommand(cbname) + try: + self._tclCommands.remove(cbname) + except ValueError: + pass def trace_vinfo(self): """Return all trace callback information.""" - return [self._tk.split(x) for x in self._tk.splitlist( + return [self._tk.splitlist(x) for x in self._tk.splitlist( self._tk.call("trace", "vinfo", self._name))] def __eq__(self, other): """Comparison for equality (==). diff --git a/Lib/tkinter/test/test_tkinter/test_variables.py b/Lib/tkinter/test/test_tkinter/test_variables.py --- a/Lib/tkinter/test/test_tkinter/test_variables.py +++ b/Lib/tkinter/test/test_tkinter/test_variables.py @@ -1,5 +1,5 @@ import unittest - +import gc from tkinter import (Variable, StringVar, IntVar, DoubleVar, BooleanVar, Tcl, TclError) @@ -87,6 +87,55 @@ v.set("value") self.assertTrue(v.side_effect) + def test_trace(self): + v = Variable(self.root) + vname = str(v) + trace = [] + def read_tracer(*args): + trace.append(('read',) + args) + def write_tracer(*args): + trace.append(('write',) + args) + cb1 = v.trace_variable('r', read_tracer) + cb2 = v.trace_variable('wu', write_tracer) + self.assertEqual(sorted(v.trace_vinfo()), [('r', cb1), ('wu', cb2)]) + self.assertEqual(trace, []) + + v.set('spam') + self.assertEqual(trace, [('write', vname, '', 'w')]) + + trace = [] + v.get() + self.assertEqual(trace, [('read', vname, '', 'r')]) + + trace = [] + info = sorted(v.trace_vinfo()) + v.trace_vdelete('w', cb1) # Wrong mode + self.assertEqual(sorted(v.trace_vinfo()), info) + with self.assertRaises(TclError): + v.trace_vdelete('r', 'spam') # Wrong command name + self.assertEqual(sorted(v.trace_vinfo()), info) + v.trace_vdelete('r', (cb1, 43)) # Wrong arguments + self.assertEqual(sorted(v.trace_vinfo()), info) + v.get() + self.assertEqual(trace, [('read', vname, '', 'r')]) + + trace = [] + v.trace_vdelete('r', cb1) + self.assertEqual(v.trace_vinfo(), [('wu', cb2)]) + v.get() + self.assertEqual(trace, []) + + trace = [] + del write_tracer + gc.collect() + v.set('eggs') + self.assertEqual(trace, [('write', vname, '', 'w')]) + + trace = [] + del v + gc.collect() + self.assertEqual(trace, [('write', vname, '', 'u')]) + class TestStringVar(TestBase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,10 @@ Library ------- +- Issue #22115: Fixed tracing Tkinter variables: trace_vdelete() with wrong + mode no longer break tracing, trace_vinfo() now always returns a list of + pairs of strings, tracing in the "u" mode now works. + - Fix a scoping issue in importlib.util.LazyLoader which triggered an UnboundLocalError when lazy-loading a module that was already put into sys.modules. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 10:48:13 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 26 Jun 2016 14:48:13 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzIyMTE1?= =?utf-8?q?=3A_Fixed_tracing_Tkinter_variables=2E?= Message-ID: <20160626144813.23093.57926.557A98BF@psf.io> https://hg.python.org/cpython/rev/77378dce6bcf changeset: 102181:77378dce6bcf branch: 2.7 parent: 102176:7a8c8538bdb8 user: Serhiy Storchaka date: Sun Jun 26 17:41:14 2016 +0300 summary: Issue #22115: Fixed tracing Tkinter variables. * trace_vdelete() with wrong mode no longer break tracing * trace_vinfo() now always returns a list of pairs of strings files: Lib/lib-tk/Tkinter.py | 17 ++- Lib/lib-tk/test/test_tkinter/test_variables.py | 51 +++++++++- Misc/NEWS | 4 + 3 files changed, 65 insertions(+), 7 deletions(-) diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -302,14 +302,19 @@ CBNAME is the name of the callback returned from trace_variable or trace. """ self._tk.call("trace", "vdelete", self._name, mode, cbname) - self._tk.deletecommand(cbname) - try: - self._tclCommands.remove(cbname) - except ValueError: - pass + cbname = self._tk.splitlist(cbname)[0] + for m, ca in self.trace_vinfo(): + if self._tk.splitlist(ca)[0] == cbname: + break + else: + self._tk.deletecommand(cbname) + try: + self._tclCommands.remove(cbname) + except ValueError: + pass def trace_vinfo(self): """Return all trace callback information.""" - return map(self._tk.split, self._tk.splitlist( + return map(self._tk.splitlist, self._tk.splitlist( self._tk.call("trace", "vinfo", self._name))) def __eq__(self, other): """Comparison for equality (==). diff --git a/Lib/lib-tk/test/test_tkinter/test_variables.py b/Lib/lib-tk/test/test_tkinter/test_variables.py --- a/Lib/lib-tk/test/test_tkinter/test_variables.py +++ b/Lib/lib-tk/test/test_tkinter/test_variables.py @@ -1,5 +1,5 @@ import unittest - +import gc from Tkinter import (Variable, StringVar, IntVar, DoubleVar, BooleanVar, Tcl, TclError) @@ -67,6 +67,55 @@ with self.assertRaises(ValueError): self.root.setvar('var\x00name', "value") + def test_trace(self): + v = Variable(self.root) + vname = str(v) + trace = [] + def read_tracer(*args): + trace.append(('read',) + args) + def write_tracer(*args): + trace.append(('write',) + args) + cb1 = v.trace_variable('r', read_tracer) + cb2 = v.trace_variable('wu', write_tracer) + self.assertEqual(sorted(v.trace_vinfo()), [('r', cb1), ('wu', cb2)]) + self.assertEqual(trace, []) + + v.set('spam') + self.assertEqual(trace, [('write', vname, '', 'w')]) + + trace = [] + v.get() + self.assertEqual(trace, [('read', vname, '', 'r')]) + + trace = [] + info = sorted(v.trace_vinfo()) + v.trace_vdelete('w', cb1) # Wrong mode + self.assertEqual(sorted(v.trace_vinfo()), info) + with self.assertRaises(TclError): + v.trace_vdelete('r', 'spam') # Wrong command name + self.assertEqual(sorted(v.trace_vinfo()), info) + v.trace_vdelete('r', (cb1, 43)) # Wrong arguments + self.assertEqual(sorted(v.trace_vinfo()), info) + v.get() + self.assertEqual(trace, [('read', vname, '', 'r')]) + + trace = [] + v.trace_vdelete('r', cb1) + self.assertEqual(v.trace_vinfo(), [('wu', cb2)]) + v.get() + self.assertEqual(trace, []) + + trace = [] + del write_tracer + gc.collect() + v.set('eggs') + self.assertEqual(trace, [('write', vname, '', 'w')]) + + #trace = [] + #del v + #gc.collect() + #self.assertEqual(trace, [('write', vname, '', 'u')]) + class TestStringVar(TestBase): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,10 @@ Library ------- +- Issue #22115: Fixed tracing Tkinter variables: trace_vdelete() with wrong + mode no longer break tracing, trace_vinfo() now always returns a list of + pairs of strings. + - Issue #27079: Fixed curses.ascii functions isblank(), iscntrl() and ispunct(). - Issue #22636: Avoid shell injection problems with -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 17:48:16 2016 From: python-checkins at python.org (terry.reedy) Date: Sun, 26 Jun 2016 21:48:16 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_27372=3A_Stop_test?= =?utf-8?q?=5Fidle_from_changing_locale=2C_so_test_passes=2E?= Message-ID: <20160626214816.52896.41669.CDF2A713@psf.io> https://hg.python.org/cpython/rev/3ffdb9277054 changeset: 102184:3ffdb9277054 user: Terry Jan Reedy date: Sun Jun 26 17:48:02 2016 -0400 summary: Issue 27372: Stop test_idle from changing locale, so test passes. In 3.6, the warning is now called an error, making it harder to ignore. files: Lib/idlelib/__init__.py | 1 + Lib/idlelib/editor.py | 8 +- Lib/idlelib/iomenu.py | 88 +++++++++++++++------------- Lib/test/test_idle.py | 15 ++- 4 files changed, 63 insertions(+), 49 deletions(-) diff --git a/Lib/idlelib/__init__.py b/Lib/idlelib/__init__.py --- a/Lib/idlelib/__init__.py +++ b/Lib/idlelib/__init__.py @@ -7,3 +7,4 @@ The other files are private implementations. Their details are subject to change. See PEP 434 for more. Import them at your own risk. """ +testing = False # Set True by test.test_idle. diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py --- a/Lib/idlelib/editor.py +++ b/Lib/idlelib/editor.py @@ -26,8 +26,8 @@ # The default tab setting for a Text widget, in average-width characters. TK_TABWIDTH_DEFAULT = 8 +_py_version = ' (%s)' % platform.python_version() -_py_version = ' (%s)' % platform.python_version() def _sphinx_version(): "Format sys.version_info to produce the Sphinx version string used to install the chm docs" @@ -45,11 +45,12 @@ from idlelib.percolator import Percolator from idlelib.colorizer import ColorDelegator, color_config from idlelib.undo import UndoDelegator - from idlelib.iomenu import IOBinding, filesystemencoding, encoding + from idlelib.iomenu import IOBinding, encoding from idlelib import mainmenu from tkinter import Toplevel from idlelib.statusbar import MultiStatusBar + filesystemencoding = sys.getfilesystemencoding() # for file names help_url = None def __init__(self, flist=None, filename=None, key=None, root=None): @@ -1649,5 +1650,8 @@ # edit.text.bind("<>", edit.close_event) if __name__ == '__main__': + import unittest + unittest.main('idlelib.idle_test.test_editor', verbosity=2, exit=False) + from idlelib.idle_test.htest import run run(_editor_window) diff --git a/Lib/idlelib/iomenu.py b/Lib/idlelib/iomenu.py --- a/Lib/idlelib/iomenu.py +++ b/Lib/idlelib/iomenu.py @@ -10,57 +10,60 @@ import tkinter.messagebox as tkMessageBox from tkinter.simpledialog import askstring +import idlelib from idlelib.config import idleConf +if idlelib.testing: # Set True by test.test_idle to avoid setlocale. + encoding = 'utf-8' +else: + # Try setting the locale, so that we can find out + # what encoding to use + try: + import locale + locale.setlocale(locale.LC_CTYPE, "") + except (ImportError, locale.Error): + pass -# Try setting the locale, so that we can find out -# what encoding to use -try: - import locale - locale.setlocale(locale.LC_CTYPE, "") -except (ImportError, locale.Error): - pass - -# Encoding for file names -filesystemencoding = sys.getfilesystemencoding() ### currently unused - -locale_encoding = 'ascii' -if sys.platform == 'win32': - # On Windows, we could use "mbcs". However, to give the user - # a portable encoding name, we need to find the code page - try: - locale_encoding = locale.getdefaultlocale()[1] - codecs.lookup(locale_encoding) - except LookupError: - pass -else: - try: - # Different things can fail here: the locale module may not be - # loaded, it may not offer nl_langinfo, or CODESET, or the - # resulting codeset may be unknown to Python. We ignore all - # these problems, falling back to ASCII - locale_encoding = locale.nl_langinfo(locale.CODESET) - if locale_encoding is None or locale_encoding is '': - # situation occurs on Mac OS X - locale_encoding = 'ascii' - codecs.lookup(locale_encoding) - except (NameError, AttributeError, LookupError): - # Try getdefaultlocale: it parses environment variables, - # which may give a clue. Unfortunately, getdefaultlocale has - # bugs that can cause ValueError. + locale_decode = 'ascii' + if sys.platform == 'win32': + # On Windows, we could use "mbcs". However, to give the user + # a portable encoding name, we need to find the code page try: locale_encoding = locale.getdefaultlocale()[1] + codecs.lookup(locale_encoding) + except LookupError: + pass + else: + try: + # Different things can fail here: the locale module may not be + # loaded, it may not offer nl_langinfo, or CODESET, or the + # resulting codeset may be unknown to Python. We ignore all + # these problems, falling back to ASCII + locale_encoding = locale.nl_langinfo(locale.CODESET) if locale_encoding is None or locale_encoding is '': # situation occurs on Mac OS X locale_encoding = 'ascii' codecs.lookup(locale_encoding) - except (ValueError, LookupError): - pass + except (NameError, AttributeError, LookupError): + # Try getdefaultlocale: it parses environment variables, + # which may give a clue. Unfortunately, getdefaultlocale has + # bugs that can cause ValueError. + try: + locale_encoding = locale.getdefaultlocale()[1] + if locale_encoding is None or locale_encoding is '': + # situation occurs on Mac OS X + locale_encoding = 'ascii' + codecs.lookup(locale_encoding) + except (ValueError, LookupError): + pass -locale_encoding = locale_encoding.lower() + locale_encoding = locale_encoding.lower() -encoding = locale_encoding ### KBK 07Sep07 This is used all over IDLE, check! - ### 'encoding' is used below in encode(), check! + encoding = locale_encoding + # Encoding is used in multiple files; locale_encoding nowhere. + # The only use of 'encoding' below is in _decode as initial value + # of deprecated block asking user for encoding. + # Perhaps use elsewhere should be reviewed. coding_re = re.compile(r'^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)', re.ASCII) blank_re = re.compile(r'^[ \t\f]*(?:[#\r\n]|$)', re.ASCII) @@ -304,7 +307,7 @@ "The file's encoding is invalid for Python 3.x.\n" "IDLE will convert it to UTF-8.\n" "What is the current encoding of the file?", - initialvalue = locale_encoding, + initialvalue = encoding, parent = self.editwin.text) if enc: @@ -564,5 +567,8 @@ IOBinding(editwin) if __name__ == "__main__": + import unittest + unittest.main('idlelib.idle_test.test_iomenu', verbosity=2, exit=False) + from idlelib.idle_test.htest import run run(_io_binding) diff --git a/Lib/test/test_idle.py b/Lib/test/test_idle.py --- a/Lib/test/test_idle.py +++ b/Lib/test/test_idle.py @@ -1,18 +1,21 @@ import unittest from test.support import import_module -# Skip test if _thread or _tkinter wasn't built or idlelib was deleted. +# Skip test if _thread or _tkinter wasn't built, or idlelib is missing, +# or if tcl/tk version before 8.5, which is needed for ttk widgets. + import_module('threading') # imported by PyShell, imports _thread tk = import_module('tkinter') # imports _tkinter if tk.TkVersion < 8.5: raise unittest.SkipTest("IDLE requires tk 8.5 or later.") tk.NoDefaultRoot() -idletest = import_module('idlelib.idle_test') +idlelib = import_module('idlelib') +idlelib.testing = True # Avoid locale-changed test error -# Without test_main present, regrtest.runtest_inner (line1219) calls -# unittest.TestLoader().loadTestsFromModule(this_module) which calls -# load_tests() if it finds it. (Unittest.main does the same.) -load_tests = idletest.load_tests +# Without test_main present, test.libregrtest.runtest.runtest_inner +# calls (line 173) unittest.TestLoader().loadTestsFromModule(module) +# which calls load_tests() if it finds it. (Unittest.main does the same.) +from idlelib.idle_test import load_tests if __name__ == '__main__': unittest.main(verbosity=2, exit=False) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 18:22:49 2016 From: python-checkins at python.org (terry.reedy) Date: Sun, 26 Jun 2016 22:22:49 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Update_NEWS_an?= =?utf-8?q?d_idlelib_NEWS=2Etext=2E?= Message-ID: <20160626222249.15788.49571.08560D40@psf.io> https://hg.python.org/cpython/rev/e2d0d921d526 changeset: 102185:e2d0d921d526 branch: 2.7 parent: 102181:77378dce6bcf user: Terry Jan Reedy date: Sun Jun 26 18:20:14 2016 -0400 summary: Update NEWS and idlelib NEWS.text. files: Lib/idlelib/NEWS.txt | 13 ++++++++++++- Misc/NEWS | 9 +++++++++ 2 files changed, 21 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -1,6 +1,17 @@ +What's New in IDLE 2.7.13? +========================== +*Release date: 2017-01-01?* + +- Issue #27365: Allow non-ascii chars in IDLE NEWS.txt, for contributor names. + +- Issue #27245: IDLE: Cleanly delete custom themes and key bindings. + Previously, when IDLE was started from a console or by import, a cascade + of warnings was emitted. Patch by Serhiy Storchaka. + + What's New in IDLE 2.7.12? ========================== -*Release date: 2015-06-30?* +*Release date: 2015-06-25* - Issue #5124: Paste with text selected now replaces the selection on X11. This matches how paste works on Windows, Mac, most modern Linux apps, diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -32,6 +32,15 @@ - Issue #25455: Fixed a crash in repr of cElementTree.Element with recursive tag. +IDLE +---- + +- Issue #27365: Allow non-ascii chars in IDLE NEWS.txt, for contributor names. + +- Issue #27245: IDLE: Cleanly delete custom themes and key bindings. + Previously, when IDLE was started from a console or by import, a cascade + of warnings was emitted. Patch by Serhiy Storchaka. + Documentation ------------- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 18:22:49 2016 From: python-checkins at python.org (terry.reedy) Date: Sun, 26 Jun 2016 22:22:49 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Update_NEWS_an?= =?utf-8?q?d_idlelib_NEWS=2Etext=2E?= Message-ID: <20160626222249.15765.41697.E835123B@psf.io> https://hg.python.org/cpython/rev/31a2a278dc85 changeset: 102186:31a2a278dc85 branch: 3.5 parent: 102182:293ec9547334 user: Terry Jan Reedy date: Sun Jun 26 18:20:20 2016 -0400 summary: Update NEWS and idlelib NEWS.text. files: Lib/idlelib/NEWS.txt | 13 ++++++++++++- Misc/NEWS | 9 +++++++++ 2 files changed, 21 insertions(+), 1 deletions(-) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -1,6 +1,17 @@ +What's New in IDLE 3.5.3? +========================= +*Release date: 2017-01-01?* + +- Issue #27365: Allow non-ascii chars in IDLE NEWS.txt, for contributor names. + +- Issue #27245: IDLE: Cleanly delete custom themes and key bindings. + Previously, when IDLE was started from a console or by import, a cascade + of warnings was emitted. Patch by Serhiy Storchaka. + + What's New in IDLE 3.5.2? ========================= -*Release date: 2016-06-30?* +*Release date: 2016-06-26* - Issue #5124: Paste with text selected now replaces the selection on X11. This matches how paste works on Windows, Mac, most modern Linux apps, diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -57,6 +57,15 @@ - Issue #26930: Update Windows builds to use OpenSSL 1.0.2h. +IDLE +---- + +- Issue #27365: Allow non-ascii chars in IDLE NEWS.txt, for contributor names. + +- Issue #27245: IDLE: Cleanly delete custom themes and key bindings. + Previously, when IDLE was started from a console or by import, a cascade + of warnings was emitted. Patch by Serhiy Storchaka. + C API ----- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 18:22:49 2016 From: python-checkins at python.org (terry.reedy) Date: Sun, 26 Jun 2016 22:22:49 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_Update_NEWS_and_idlelib_NEWS=2Etext=2E?= Message-ID: <20160626222249.126949.33945.A7476BE2@psf.io> https://hg.python.org/cpython/rev/447c20169c92 changeset: 102187:447c20169c92 parent: 102184:3ffdb9277054 parent: 102186:31a2a278dc85 user: Terry Jan Reedy date: Sun Jun 26 18:22:32 2016 -0400 summary: Merge Update NEWS and idlelib NEWS.text. files: Lib/idlelib/NEWS.txt | 14 ++++++++++++++ Misc/NEWS | 12 ++++++++++++ 2 files changed, 26 insertions(+), 0 deletions(-) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -2,6 +2,20 @@ =========================== *Release date: 2016-09-??* +- Issue #27372: Test_idle no longer changes the locale. + +- Issue #27365: Allow non-ascii chars in IDLE NEWS.txt, for contributor names. + +- Issue #27245: IDLE: Cleanly delete custom themes and key bindings. + Previously, when IDLE was started from a console or by import, a cascade + of warnings was emitted. Patch by Serhiy Storchaka. + +- Issue #24137: Run IDLE, test_idle, and htest with tkinter default root disabled. + Fix code and tests that fail with this restriction. + Fix htests to not create a second and redundant root and mainloop. + +- Issue #27310: Fix IDLE.app failure to launch on OS X due to vestigial import. + - Issue #5124: Paste with text selected now replaces the selection on X11. This matches how paste works on Windows, Mac, most modern Linux apps, and ttk widgets. Original patch by Serhiy Storchaka. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -87,6 +87,18 @@ IDLE ---- +- Issue #27372: Test_idle no longer changes the locale. + +- Issue #27365: Allow non-ascii chars in IDLE NEWS.txt, for contributor names. + +- Issue #27245: IDLE: Cleanly delete custom themes and key bindings. + Previously, when IDLE was started from a console or by import, a cascade + of warnings was emitted. Patch by Serhiy Storchaka. + +- Issue #24137: Run IDLE, test_idle, and htest with tkinter default root disabled. + Fix code and tests that fail with this restriction. + Fix htests to not create a second and redundant root and mainloop. + - Issue #27310: Fix IDLE.app failure to launch on OS X due to vestigial import. C API -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 22:05:24 2016 From: python-checkins at python.org (terry.reedy) Date: Mon, 27 Jun 2016 02:05:24 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327380=3A_IDLE=3A_?= =?utf-8?q?add_base_Query_dialog=2C_with_ttk_widgets_and_subclass?= Message-ID: <20160627020523.106547.62174.8EB06DDE@psf.io> https://hg.python.org/cpython/rev/4796d7fb00c5 changeset: 102188:4796d7fb00c5 user: Terry Jan Reedy date: Sun Jun 26 22:05:10 2016 -0400 summary: Issue #27380: IDLE: add base Query dialog, with ttk widgets and subclass SectionName. These split class GetCfgSectionNameDialog from configSectionNameDialog.py, temporarily renamed config_sec.py in 3.7.9a2. More Query subclasses are planned. files: Lib/idlelib/configdialog.py | 6 +- Lib/idlelib/idle_test/htest.py | 23 +- Lib/idlelib/idle_test/test_query.py | 193 +++++++++++---- Lib/idlelib/query.py | 160 ++++++++---- 4 files changed, 260 insertions(+), 122 deletions(-) diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py --- a/Lib/idlelib/configdialog.py +++ b/Lib/idlelib/configdialog.py @@ -18,7 +18,7 @@ from idlelib.config import idleConf from idlelib.dynoption import DynOptionMenu from idlelib.config_key import GetKeysDialog -from idlelib.config_sec import GetCfgSectionNameDialog +from idlelib.query import SectionName from idlelib.config_help import GetHelpSourceDialog from idlelib.tabbedpages import TabbedPageSet from idlelib.textview import view_text @@ -684,7 +684,7 @@ def GetNewKeysName(self, message): usedNames = (idleConf.GetSectionList('user', 'keys') + idleConf.GetSectionList('default', 'keys')) - newKeySet = GetCfgSectionNameDialog( + newKeySet = SectionName( self, 'New Custom Key Set', message, usedNames).result return newKeySet @@ -837,7 +837,7 @@ def GetNewThemeName(self, message): usedNames = (idleConf.GetSectionList('user', 'highlight') + idleConf.GetSectionList('default', 'highlight')) - newTheme = GetCfgSectionNameDialog( + newTheme = SectionName( self, 'New Custom Theme', message, usedNames).result return newTheme diff --git a/Lib/idlelib/idle_test/htest.py b/Lib/idlelib/idle_test/htest.py --- a/Lib/idlelib/idle_test/htest.py +++ b/Lib/idlelib/idle_test/htest.py @@ -137,18 +137,6 @@ "Best to close editor first." } -GetCfgSectionNameDialog_spec = { - 'file': 'config_sec', - 'kwds': {'title':'Get Name', - 'message':'Enter something', - 'used_names': {'abc'}, - '_htest': True}, - 'msg': "After the text entered with [Ok] is stripped, , " - "'abc', or more that 30 chars are errors.\n" - "Close 'Get Name' with a valid entry (printed to Shell), " - "[Cancel], or [X]", - } - GetHelpSourceDialog_spec = { 'file': 'config_help', 'kwds': {'title': 'Get helpsource', @@ -245,6 +233,17 @@ "Test for actions like text entry, and removal." } +Query_spec = { + 'file': 'query', + 'kwds': {'title':'Query', + 'message':'Enter something', + '_htest': True}, + 'msg': "Enter with or [Ok]. Print valid entry to Shell\n" + "Blank line, after stripping, is ignored\n" + "Close dialog with valid entry, [Cancel] or [X]", + } + + _replace_dialog_spec = { 'file': 'replace', 'kwds': {}, diff --git a/Lib/idlelib/idle_test/test_config_sec.py b/Lib/idlelib/idle_test/test_query.py rename from Lib/idlelib/idle_test/test_config_sec.py rename to Lib/idlelib/idle_test/test_query.py --- a/Lib/idlelib/idle_test/test_config_sec.py +++ b/Lib/idlelib/idle_test/test_query.py @@ -1,74 +1,163 @@ -"""Unit tests for idlelib.config_sec""" +"""Test idlelib.query. + +Coverage: 100%. +""" +from test.support import requires +from tkinter import Tk import unittest -from idlelib.idle_test.mock_tk import Var, Mbox -from idlelib import config_sec as name_dialog_module +from unittest import mock +from idlelib.idle_test.mock_tk import Var, Mbox_func +from idlelib import query +Query, SectionName = query.Query, query.SectionName -name_dialog = name_dialog_module.GetCfgSectionNameDialog - -class Dummy_name_dialog: - # Mock for testing the following methods of name_dialog - name_ok = name_dialog.name_ok - Ok = name_dialog.Ok - Cancel = name_dialog.Cancel +class Dummy_Query: + # Mock for testing the following methods Query + entry_ok = Query.entry_ok + ok = Query.ok + cancel = Query.cancel # Attributes, constant or variable, needed for tests - used_names = ['used'] - name = Var() + entry = Var() result = None destroyed = False def destroy(self): self.destroyed = True -# name_ok calls Mbox.showerror if name is not ok -orig_mbox = name_dialog_module.tkMessageBox -showerror = Mbox.showerror +# entry_ok calls modal messagebox.showerror if entry is not ok. +# Mock showerrer returns, so don't need to click to continue. +orig_showerror = query.showerror +showerror = Mbox_func() # Instance has __call__ method. -class ConfigNameTest(unittest.TestCase): - dialog = Dummy_name_dialog() +def setUpModule(): + query.showerror = showerror + +def tearDownModule(): + query.showerror = orig_showerror + + +class QueryTest(unittest.TestCase): + dialog = Dummy_Query() + + def setUp(self): + showerror.title = None + self.dialog.result = None + self.dialog.destroyed = False + + def test_blank_entry(self): + dialog = self.dialog + Equal = self.assertEqual + dialog.entry.set(' ') + Equal(dialog.entry_ok(), '') + Equal((dialog.result, dialog.destroyed), (None, False)) + Equal(showerror.title, 'Entry Error') + self.assertIn('Blank', showerror.message) + + def test_good_entry(self): + dialog = self.dialog + Equal = self.assertEqual + dialog.entry.set(' good ') + Equal(dialog.entry_ok(), 'good') + Equal((dialog.result, dialog.destroyed), (None, False)) + Equal(showerror.title, None) + + def test_ok(self): + dialog = self.dialog + Equal = self.assertEqual + dialog.entry.set('good') + Equal(dialog.ok(), None) + Equal((dialog.result, dialog.destroyed), ('good', True)) + + def test_cancel(self): + dialog = self.dialog + Equal = self.assertEqual + Equal(self.dialog.cancel(), None) + Equal((dialog.result, dialog.destroyed), (None, True)) + + +class Dummy_SectionName: + # Mock for testing the following method of Section_Name + entry_ok = SectionName.entry_ok + # Attributes, constant or variable, needed for tests + used_names = ['used'] + entry = Var() + +class SectionNameTest(unittest.TestCase): + dialog = Dummy_SectionName() + + + def setUp(self): + showerror.title = None + + def test_blank_name(self): + dialog = self.dialog + Equal = self.assertEqual + dialog.entry.set(' ') + Equal(dialog.entry_ok(), '') + Equal(showerror.title, 'Name Error') + self.assertIn('No', showerror.message) + + def test_used_name(self): + dialog = self.dialog + Equal = self.assertEqual + dialog.entry.set('used') + Equal(self.dialog.entry_ok(), '') + Equal(showerror.title, 'Name Error') + self.assertIn('use', showerror.message) + + def test_long_name(self): + dialog = self.dialog + Equal = self.assertEqual + dialog.entry.set('good'*8) + Equal(self.dialog.entry_ok(), '') + Equal(showerror.title, 'Name Error') + self.assertIn('too long', showerror.message) + + def test_good_entry(self): + dialog = self.dialog + Equal = self.assertEqual + dialog.entry.set(' good ') + Equal(dialog.entry_ok(), 'good') + Equal(showerror.title, None) + + +class QueryGuiTest(unittest.TestCase): @classmethod def setUpClass(cls): - name_dialog_module.tkMessageBox = Mbox + requires('gui') + cls.root = Tk() + cls.dialog = Query(cls.root, 'TEST', 'test', _utest=True) + cls.dialog.destroy = mock.Mock() @classmethod def tearDownClass(cls): - name_dialog_module.tkMessageBox = orig_mbox + del cls.dialog + cls.root.destroy() + del cls.root - def test_blank_name(self): - self.dialog.name.set(' ') - self.assertEqual(self.dialog.name_ok(), '') - self.assertEqual(showerror.title, 'Name Error') - self.assertIn('No', showerror.message) + def setUp(self): + self.dialog.entry.delete(0, 'end') + self.dialog.result = None + self.dialog.destroy.reset_mock() - def test_used_name(self): - self.dialog.name.set('used') - self.assertEqual(self.dialog.name_ok(), '') - self.assertEqual(showerror.title, 'Name Error') - self.assertIn('use', showerror.message) + def test_click_ok(self): + dialog = self.dialog + dialog.entry.insert(0, 'abc') + dialog.button_ok.invoke() + self.assertEqual(dialog.result, 'abc') + self.assertTrue(dialog.destroy.called) - def test_long_name(self): - self.dialog.name.set('good'*8) - self.assertEqual(self.dialog.name_ok(), '') - self.assertEqual(showerror.title, 'Name Error') - self.assertIn('too long', showerror.message) + def test_click_blank(self): + dialog = self.dialog + dialog.button_ok.invoke() + self.assertEqual(dialog.result, None) + self.assertFalse(dialog.destroy.called) - def test_good_name(self): - self.dialog.name.set(' good ') - showerror.title = 'No Error' # should not be called - self.assertEqual(self.dialog.name_ok(), 'good') - self.assertEqual(showerror.title, 'No Error') - - def test_ok(self): - self.dialog.destroyed = False - self.dialog.name.set('good') - self.dialog.Ok() - self.assertEqual(self.dialog.result, 'good') - self.assertTrue(self.dialog.destroyed) - - def test_cancel(self): - self.dialog.destroyed = False - self.dialog.Cancel() - self.assertEqual(self.dialog.result, '') - self.assertTrue(self.dialog.destroyed) + def test_click_cancel(self): + dialog = self.dialog + dialog.entry.insert(0, 'abc') + dialog.button_cancel.invoke() + self.assertEqual(dialog.result, None) + self.assertTrue(dialog.destroy.called) if __name__ == '__main__': diff --git a/Lib/idlelib/config_sec.py b/Lib/idlelib/query.py rename from Lib/idlelib/config_sec.py rename to Lib/idlelib/query.py --- a/Lib/idlelib/config_sec.py +++ b/Lib/idlelib/query.py @@ -1,18 +1,39 @@ """ -Dialog that allows user to specify a new config file section name. -Used to get new highlight theme and keybinding set names. -The 'return value' for the dialog, used two placed in configdialog.py, -is the .result attribute set in the Ok and Cancel methods. +Dialogs that query users and verify the answer before accepting. +Use ttk widgets, limiting use to tcl/tk 8.5+, as in IDLE 3.6+. + +Query is the generic base class for a popup dialog. +The user must either enter a valid answer or close the dialog. +Entries are validated when is entered or [Ok] is clicked. +Entries are ignored when [Cancel] or [X] are clicked. +The 'return value' is .result set to either a valid answer or None. + +Subclass SectionName gets a name for a new config file section. +Configdialog uses it for new highlight theme and keybinding set names. """ -from tkinter import * -import tkinter.messagebox as tkMessageBox +# Query and Section name result from splitting GetCfgSectionNameDialog +# of configSectionNameDialog.py (temporarily config_sec.py) into +# generic and specific parts. -class GetCfgSectionNameDialog(Toplevel): - def __init__(self, parent, title, message, used_names, _htest=False): - """ +from tkinter import FALSE, TRUE, Toplevel +from tkinter.messagebox import showerror +from tkinter.ttk import Frame, Button, Entry, Label + +class Query(Toplevel): + """Base class for getting verified answer from a user. + + For this base class, accept any non-blank string. + """ + def __init__(self, parent, title, message, + *, _htest=False, _utest=False): # Call from override. + """Create popup, do not return until tk widget destroyed. + + Additional subclass init must be done before calling this. + + title - string, title of popup dialog message - string, informational message to display - used_names - string collection, names already in use for validity check _htest - bool, change box location when running htest + _utest - bool, leave window hidden and not modal """ Toplevel.__init__(self, parent) self.configure(borderwidth=5) @@ -20,79 +41,108 @@ self.title(title) self.transient(parent) self.grab_set() - self.protocol("WM_DELETE_WINDOW", self.Cancel) + self.bind('', self.ok) + self.protocol("WM_DELETE_WINDOW", self.cancel) self.parent = parent self.message = message - self.used_names = used_names self.create_widgets() - self.withdraw() #hide while setting geometry self.update_idletasks() #needs to be done here so that the winfo_reqwidth is valid - self.messageInfo.config(width=self.frameMain.winfo_reqwidth()) + self.withdraw() # Hide while configuring, especially geometry. self.geometry( "+%d+%d" % ( parent.winfo_rootx() + (parent.winfo_width()/2 - self.winfo_reqwidth()/2), parent.winfo_rooty() + ((parent.winfo_height()/2 - self.winfo_reqheight()/2) - if not _htest else 100) + if not _htest else 150) ) ) #centre dialog over parent (or below htest box) - self.deiconify() #geometry set, unhide - self.wait_window() + if not _utest: + self.deiconify() #geometry set, unhide + self.wait_window() - def create_widgets(self): - self.name = StringVar(self.parent) - self.fontSize = StringVar(self.parent) - self.frameMain = Frame(self, borderwidth=2, relief=SUNKEN) - self.frameMain.pack(side=TOP, expand=TRUE, fill=BOTH) - self.messageInfo = Message(self.frameMain, anchor=W, justify=LEFT, - padx=5, pady=5, text=self.message) #,aspect=200) - entryName = Entry(self.frameMain, textvariable=self.name, width=30) - entryName.focus_set() - self.messageInfo.pack(padx=5, pady=5) #, expand=TRUE, fill=BOTH) - entryName.pack(padx=5, pady=5) + def create_widgets(self): # Call from override, if any. + frame = Frame(self, borderwidth=2, relief='sunken', ) + label = Label(frame, anchor='w', justify='left', + text=self.message) + self.entry = Entry(frame, width=30) # Bind name for entry_ok. + self.entry.focus_set() - frameButtons = Frame(self, pady=2) - frameButtons.pack(side=BOTTOM) - self.buttonOk = Button(frameButtons, text='Ok', - width=8, command=self.Ok) - self.buttonOk.pack(side=LEFT, padx=5) - self.buttonCancel = Button(frameButtons, text='Cancel', - width=8, command=self.Cancel) - self.buttonCancel.pack(side=RIGHT, padx=5) + buttons = Frame(self) # Bind buttons for invoke in unittest. + self.button_ok = Button(buttons, text='Ok', + width=8, command=self.ok) + self.button_cancel = Button(buttons, text='Cancel', + width=8, command=self.cancel) - def name_ok(self): - ''' After stripping entered name, check that it is a sensible + frame.pack(side='top', expand=TRUE, fill='both') + label.pack(padx=5, pady=5) + self.entry.pack(padx=5, pady=5) + buttons.pack(side='bottom') + self.button_ok.pack(side='left', padx=5) + self.button_cancel.pack(side='right', padx=5) + + def entry_ok(self): # Usually replace. + "Check that entry not blank." + entry = self.entry.get().strip() + if not entry: + showerror(title='Entry Error', + message='Blank line.', parent=self) + return entry + + def ok(self, event=None): # Do not replace. + '''If entry is valid, bind it to 'result' and destroy tk widget. + + Otherwise leave dialog open for user to correct entry or cancel. + ''' + entry = self.entry_ok() + if entry: + self.result = entry + self.destroy() + else: + # [Ok] (but not ) moves focus. Move it back. + self.entry.focus_set() + + def cancel(self, event=None): # Do not replace. + "Set dialog result to None and destroy tk widget." + self.result = None + self.destroy() + + +class SectionName(Query): + "Get a name for a config file section name." + + def __init__(self, parent, title, message, used_names, + *, _htest=False, _utest=False): + "used_names - collection of strings already in use" + + self.used_names = used_names + Query.__init__(self, parent, title, message, + _htest=_htest, _utest=_utest) + # This call does ot return until tk widget is destroyed. + + def entry_ok(self): + '''Stripping entered name, check that it is a sensible ConfigParser file section name. Return it if it is, '' if not. ''' - name = self.name.get().strip() - if not name: #no name specified - tkMessageBox.showerror(title='Name Error', + name = self.entry.get().strip() + if not name: + showerror(title='Name Error', message='No name specified.', parent=self) - elif len(name)>30: #name too long - tkMessageBox.showerror(title='Name Error', + elif len(name)>30: + showerror(title='Name Error', message='Name too long. It should be no more than '+ '30 characters.', parent=self) name = '' elif name in self.used_names: - tkMessageBox.showerror(title='Name Error', + showerror(title='Name Error', message='This name is already in use.', parent=self) name = '' return name - def Ok(self, event=None): - name = self.name_ok() - if name: - self.result = name - self.destroy() - - def Cancel(self, event=None): - self.result = '' - self.destroy() if __name__ == '__main__': import unittest - unittest.main('idlelib.idle_test.test_config_name', verbosity=2, exit=False) + unittest.main('idlelib.idle_test.test_query', verbosity=2, exit=False) from idlelib.idle_test.htest import run - run(GetCfgSectionNameDialog) + run(Query) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 23:02:10 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 27 Jun 2016 03:02:10 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_alter_header?= =?utf-8?q?=3B_=27=25=27_really_throws_latex_through_a_loop?= Message-ID: <20160627030210.16165.7627.BCD59433@psf.io> https://hg.python.org/cpython/rev/36cd79252be0 changeset: 102191:36cd79252be0 branch: 3.5 user: Benjamin Peterson date: Tue Jun 21 23:47:16 2016 -0700 summary: alter header; '%' really throws latex through a loop files: Doc/whatsnew/3.5.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/3.5.rst b/Doc/whatsnew/3.5.rst --- a/Doc/whatsnew/3.5.rst +++ b/Doc/whatsnew/3.5.rst @@ -356,8 +356,8 @@ .. _whatsnew-pep-461: -PEP 461 - % formatting support for bytes and bytearray ------------------------------------------------------- +PEP 461 - percent formatting support for bytes and bytearray +------------------------------------------------------------ :pep:`461` adds support for the ``%`` :ref:`interpolation operator ` to :class:`bytes` -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 23:02:10 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 27 Jun 2016 03:02:10 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI2OTMw?= =?utf-8?q?=3A_Update_Windows_build_to_OpenSSL_1=2E0=2E2h?= Message-ID: <20160627030210.3166.82878.50106FFD@psf.io> https://hg.python.org/cpython/rev/e1e5691d02d8 changeset: 102190:e1e5691d02d8 branch: 3.5 user: Zachary Ware date: Wed Jun 15 17:13:28 2016 -0500 summary: Issue #26930: Update Windows build to OpenSSL 1.0.2h files: Misc/NEWS | 13 +++++++++++-- PCbuild/get_externals.bat | 2 +- PCbuild/python.props | 2 +- PCbuild/readme.txt | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,8 +10,17 @@ Core and Builtins ----------------- -Library -------- +- Issue #26930: Update Windows builds to use OpenSSL 1.0.2h. + +Tests +----- + +- Issue #26867: Ubuntu's openssl OP_NO_SSLv3 is forced on by default; fix test. + +IDLE +---- + +- Issue #27365: Allow non-ascii in idlelib/NEWS.txt - minimal part for 3.5.2. What's New in Python 3.5.2 release candidate 1? diff --git a/PCbuild/get_externals.bat b/PCbuild/get_externals.bat --- a/PCbuild/get_externals.bat +++ b/PCbuild/get_externals.bat @@ -54,7 +54,7 @@ set libraries= set libraries=%libraries% bzip2-1.0.6 if NOT "%IncludeSSL%"=="false" set libraries=%libraries% nasm-2.11.06 -if NOT "%IncludeSSL%"=="false" set libraries=%libraries% openssl-1.0.2g +if NOT "%IncludeSSL%"=="false" set libraries=%libraries% openssl-1.0.2h set libraries=%libraries% sqlite-3.8.11.0 if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tcl-core-8.6.4.2 if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tk-8.6.4.2 diff --git a/PCbuild/python.props b/PCbuild/python.props --- a/PCbuild/python.props +++ b/PCbuild/python.props @@ -41,7 +41,7 @@ $(ExternalsDir)sqlite-3.8.11.0\ $(ExternalsDir)bzip2-1.0.6\ $(ExternalsDir)xz-5.0.5\ - $(ExternalsDir)openssl-1.0.2g\ + $(ExternalsDir)openssl-1.0.2h\ $(opensslDir)include32 $(opensslDir)include64 $(ExternalsDir)\nasm-2.11.06\ diff --git a/PCbuild/readme.txt b/PCbuild/readme.txt --- a/PCbuild/readme.txt +++ b/PCbuild/readme.txt @@ -169,7 +169,7 @@ Homepage: http://tukaani.org/xz/ _ssl - Python wrapper for version 1.0.2g of the OpenSSL secure sockets + Python wrapper for version 1.0.2h of the OpenSSL secure sockets library, which is built by ssl.vcxproj Homepage: http://www.openssl.org/ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 23:02:10 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 27 Jun 2016 03:02:10 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI2ODY3?= =?utf-8?q?=3A_Ubuntu=27s_openssl_OP=5FNO=5FSSLv3_is_forced_on_by_default?= =?utf-8?q?=3B_fix_test=2E?= Message-ID: <20160627030210.52859.62815.F9A4FA22@psf.io> https://hg.python.org/cpython/rev/4d04aca4afb0 changeset: 102189:4d04aca4afb0 branch: 3.5 parent: 101966:3428e51f47aa user: Matthias Klose date: Sun Jun 12 23:40:00 2016 -0700 summary: Issue #26867: Ubuntu's openssl OP_NO_SSLv3 is forced on by default; fix test. files: Lib/test/test_ssl.py | 3 ++- 1 files changed, 2 insertions(+), 1 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 @@ -821,7 +821,8 @@ self.assertEqual(ssl.OP_ALL | ssl.OP_NO_TLSv1 | ssl.OP_NO_SSLv3, ctx.options) ctx.options = 0 - self.assertEqual(0, ctx.options) + # Ubuntu has OP_NO_SSLv3 forced on by default + self.assertEqual(0, ctx.options & ~ssl.OP_NO_SSLv3) else: with self.assertRaises(ValueError): ctx.options = 0 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 23:02:10 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 27 Jun 2016 03:02:10 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3MzY1?= =?utf-8?q?=3A_Allow_non-ascii_in_idlelib/NEWS=2Etxt_-_minimal_part_for_3?= =?utf-8?b?LjUuMi4=?= Message-ID: <20160627030210.106462.60557.EA11699B@psf.io> https://hg.python.org/cpython/rev/30e563e2702e changeset: 102192:30e563e2702e branch: 3.5 user: Terry Jan Reedy date: Wed Jun 22 03:55:20 2016 -0400 summary: Issue #27365: Allow non-ascii in idlelib/NEWS.txt - minimal part for 3.5.2. files: Lib/idlelib/NEWS.txt | 4 ++-- Lib/idlelib/aboutDialog.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -30,7 +30,7 @@ Original patch by Saimadhav Heblikar. - Issue #18410: Add test for IDLE's search dialog. - Original patch by Westley Mart?nez. + Original patch by Westley Mart??nez. - Issue #21703: Add test for undo delegator. Original patch by Saimadhav Heblikar . @@ -48,7 +48,7 @@ - Issue #25507: fix incorrect change in IOBinding that prevented printing. Augment IOBinding htest to include all major IOBinding functions. -- Issue #25905: Revert unwanted conversion of ' to ? RIGHT SINGLE QUOTATION +- Issue #25905: Revert unwanted conversion of ' to ??? RIGHT SINGLE QUOTATION MARK in README.txt and open this and NEWS.txt with 'ascii'. Re-encode CREDITS.txt to utf-8 and open it with 'utf-8'. diff --git a/Lib/idlelib/aboutDialog.py b/Lib/idlelib/aboutDialog.py --- a/Lib/idlelib/aboutDialog.py +++ b/Lib/idlelib/aboutDialog.py @@ -130,7 +130,7 @@ self.display_file_text('About - Readme', 'README.txt', 'ascii') def ShowIDLENEWS(self): - self.display_file_text('About - NEWS', 'NEWS.txt', 'ascii') + self.display_file_text('About - NEWS', 'NEWS.txt', 'utf-8') def display_printer_text(self, title, printer): printer._Printer__setup() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 23:02:15 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 27 Jun 2016 03:02:15 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Update_pydoc_t?= =?utf-8?q?opics_for_3=2E5=2E2_final=2E?= Message-ID: <20160627030215.8052.48698.E722B2EE@psf.io> https://hg.python.org/cpython/rev/6d179b43cd6f changeset: 102193:6d179b43cd6f branch: 3.5 user: Larry Hastings date: Sat Jun 25 14:09:37 2016 -0700 summary: Update pydoc topics for 3.5.2 final. files: Lib/pydoc_data/topics.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Sat Jun 11 20:39:59 2016 +# Autogenerated by Sphinx on Sat Jun 25 14:08:44 2016 topics = {'assert': u'\nThe "assert" statement\n**********************\n\nAssert statements are a convenient way to insert debugging assertions\ninto a program:\n\n assert_stmt ::= "assert" expression ["," expression]\n\nThe simple form, "assert expression", is equivalent to\n\n if __debug__:\n if not expression: raise AssertionError\n\nThe extended form, "assert expression1, expression2", is equivalent to\n\n if __debug__:\n if not expression1: raise AssertionError(expression2)\n\nThese equivalences assume that "__debug__" and "AssertionError" refer\nto the built-in variables with those names. In the current\nimplementation, the built-in variable "__debug__" is "True" under\nnormal circumstances, "False" when optimization is requested (command\nline option -O). The current code generator emits no code for an\nassert statement when optimization is requested at compile time. Note\nthat it is unnecessary to include the source code for the expression\nthat failed in the error message; it will be displayed as part of the\nstack trace.\n\nAssignments to "__debug__" are illegal. The value for the built-in\nvariable is determined when the interpreter starts.\n', 'assignment': u'\nAssignment statements\n*********************\n\nAssignment statements are used to (re)bind names to values and to\nmodify attributes or items of mutable objects:\n\n assignment_stmt ::= (target_list "=")+ (starred_expression | yield_expression)\n target_list ::= target ("," target)* [","]\n target ::= identifier\n | "(" target_list ")"\n | "[" [target_list] "]"\n | attributeref\n | subscription\n | slicing\n | "*" target\n\n(See section *Primaries* for the syntax definitions for\n*attributeref*, *subscription*, and *slicing*.)\n\nAn assignment statement evaluates the expression list (remember that\nthis can be a single expression or a comma-separated list, the latter\nyielding a tuple) and assigns the single resulting object to each of\nthe target lists, from left to right.\n\nAssignment is defined recursively depending on the form of the target\n(list). When a target is part of a mutable object (an attribute\nreference, subscription or slicing), the mutable object must\nultimately perform the assignment and decide about its validity, and\nmay raise an exception if the assignment is unacceptable. The rules\nobserved by various types and the exceptions raised are given with the\ndefinition of the object types (see section *The standard type\nhierarchy*).\n\nAssignment of an object to a target list, optionally enclosed in\nparentheses or square brackets, is recursively defined as follows.\n\n* If the target list is empty: The object must also be an empty\n iterable.\n\n* If the target list is a single target in parentheses: The object\n is assigned to that target.\n\n* If the target list is a comma-separated list of targets, or a\n single target in square brackets: The object must be an iterable\n with the same number of items as there are targets in the target\n list, and the items are assigned, from left to right, to the\n corresponding targets.\n\n * If the target list contains one target prefixed with an\n asterisk, called a "starred" target: The object must be an\n iterable with at least as many items as there are targets in the\n target list, minus one. The first items of the iterable are\n assigned, from left to right, to the targets before the starred\n target. The final items of the iterable are assigned to the\n targets after the starred target. A list of the remaining items\n in the iterable is then assigned to the starred target (the list\n can be empty).\n\n * Else: The object must be an iterable with the same number of\n items as there are targets in the target list, and the items are\n assigned, from left to right, to the corresponding targets.\n\nAssignment of an object to a single target is recursively defined as\nfollows.\n\n* If the target is an identifier (name):\n\n * If the name does not occur in a "global" or "nonlocal" statement\n in the current code block: the name is bound to the object in the\n current local namespace.\n\n * Otherwise: the name is bound to the object in the global\n namespace or the outer namespace determined by "nonlocal",\n respectively.\n\n The name is rebound if it was already bound. This may cause the\n reference count for the object previously bound to the name to reach\n zero, causing the object to be deallocated and its destructor (if it\n has one) to be called.\n\n* If the target is an attribute reference: The primary expression in\n the reference is evaluated. It should yield an object with\n assignable attributes; if this is not the case, "TypeError" is\n raised. That object is then asked to assign the assigned object to\n the given attribute; if it cannot perform the assignment, it raises\n an exception (usually but not necessarily "AttributeError").\n\n Note: If the object is a class instance and the attribute reference\n occurs on both sides of the assignment operator, the RHS expression,\n "a.x" can access either an instance attribute or (if no instance\n attribute exists) a class attribute. The LHS target "a.x" is always\n set as an instance attribute, creating it if necessary. Thus, the\n two occurrences of "a.x" do not necessarily refer to the same\n attribute: if the RHS expression refers to a class attribute, the\n LHS creates a new instance attribute as the target of the\n assignment:\n\n class Cls:\n x = 3 # class variable\n inst = Cls()\n inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x as 3\n\n This description does not necessarily apply to descriptor\n attributes, such as properties created with "property()".\n\n* If the target is a subscription: The primary expression in the\n reference is evaluated. It should yield either a mutable sequence\n object (such as a list) or a mapping object (such as a dictionary).\n Next, the subscript expression is evaluated.\n\n If the primary is a mutable sequence object (such as a list), the\n subscript must yield an integer. If it is negative, the sequence\'s\n length is added to it. The resulting value must be a nonnegative\n integer less than the sequence\'s length, and the sequence is asked\n to assign the assigned object to its item with that index. If the\n index is out of range, "IndexError" is raised (assignment to a\n subscripted sequence cannot add new items to a list).\n\n If the primary is a mapping object (such as a dictionary), the\n subscript must have a type compatible with the mapping\'s key type,\n and the mapping is then asked to create a key/datum pair which maps\n the subscript to the assigned object. This can either replace an\n existing key/value pair with the same key value, or insert a new\n key/value pair (if no key with the same value existed).\n\n For user-defined objects, the "__setitem__()" method is called with\n appropriate arguments.\n\n* If the target is a slicing: The primary expression in the\n reference is evaluated. It should yield a mutable sequence object\n (such as a list). The assigned object should be a sequence object\n of the same type. Next, the lower and upper bound expressions are\n evaluated, insofar they are present; defaults are zero and the\n sequence\'s length. The bounds should evaluate to integers. If\n either bound is negative, the sequence\'s length is added to it. The\n resulting bounds are clipped to lie between zero and the sequence\'s\n length, inclusive. Finally, the sequence object is asked to replace\n the slice with the items of the assigned sequence. The length of\n the slice may be different from the length of the assigned sequence,\n thus changing the length of the target sequence, if the target\n sequence allows it.\n\n**CPython implementation detail:** In the current implementation, the\nsyntax for targets is taken to be the same as for expressions, and\ninvalid syntax is rejected during the code generation phase, causing\nless detailed error messages.\n\nAlthough the definition of assignment implies that overlaps between\nthe left-hand side and the right-hand side are \'simultaneous\' (for\nexample "a, b = b, a" swaps two variables), overlaps *within* the\ncollection of assigned-to variables occur left-to-right, sometimes\nresulting in confusion. For instance, the following program prints\n"[0, 2]":\n\n x = [0, 1]\n i = 0\n i, x[i] = 1, 2 # i is updated, then x[i] is updated\n print(x)\n\nSee also: **PEP 3132** - Extended Iterable Unpacking\n\n The specification for the "*target" feature.\n\n\nAugmented assignment statements\n===============================\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n augtarget ::= identifier | attributeref | subscription | slicing\n augop ::= "+=" | "-=" | "*=" | "@=" | "/=" | "//=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section *Primaries* for the syntax definitions of the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like "x += 1" can be rewritten as\n"x = x + 1" to achieve a similar, but not exactly equal effect. In the\naugmented version, "x" is only evaluated once. Also, when possible,\nthe actual operation is performed *in-place*, meaning that rather than\ncreating a new object and assigning that to the target, the old object\nis modified instead.\n\nUnlike normal assignments, augmented assignments evaluate the left-\nhand side *before* evaluating the right-hand side. For example, "a[i]\n+= f(x)" first looks-up "a[i]", then it evaluates "f(x)" and performs\nthe addition, and lastly, it writes the result back to "a[i]".\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same *caveat about\nclass and instance attributes* applies as for regular assignments.\n', 'atom-identifiers': u'\nIdentifiers (Names)\n*******************\n\nAn identifier occurring as an atom is a name. See section\n*Identifiers and keywords* for lexical definition and section *Naming\nand binding* for documentation of naming and binding.\n\nWhen the name is bound to an object, evaluation of the atom yields\nthat object. When a name is not bound, an attempt to evaluate it\nraises a "NameError" exception.\n\n**Private name mangling:** When an identifier that textually occurs in\na class definition begins with two or more underscore characters and\ndoes not end in two or more underscores, it is considered a *private\nname* of that class. Private names are transformed to a longer form\nbefore code is generated for them. The transformation inserts the\nclass name, with leading underscores removed and a single underscore\ninserted, in front of the name. For example, the identifier "__spam"\noccurring in a class named "Ham" will be transformed to "_Ham__spam".\nThis transformation is independent of the syntactical context in which\nthe identifier is used. If the transformed name is extremely long\n(longer than 255 characters), implementation defined truncation may\nhappen. If the class name consists only of underscores, no\ntransformation is done.\n', -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 23:02:15 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 27 Jun 2016 03:02:15 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Version_number?= =?utf-8?q?_bump_for_3=2E5=2E2_final=2E?= Message-ID: <20160627030215.106162.30401.2D460403@psf.io> https://hg.python.org/cpython/rev/4def2a2901a5 changeset: 102194:4def2a2901a5 branch: 3.5 tag: v3.5.2 user: Larry Hastings date: Sat Jun 25 14:11:09 2016 -0700 summary: Version number bump for 3.5.2 final. files: Include/patchlevel.h | 6 +++--- README | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -19,11 +19,11 @@ #define PY_MAJOR_VERSION 3 #define PY_MINOR_VERSION 5 #define PY_MICRO_VERSION 2 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 1 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "3.5.2rc1+" +#define PY_VERSION "3.5.2" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/README b/README --- a/README +++ b/README @@ -1,5 +1,5 @@ -This is Python version 3.5.2 release candidate 1 -================================================ +This is Python version 3.5.2 +============================ Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Python Software Foundation. All rights reserved. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 23:02:16 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 27 Jun 2016 03:02:16 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Post-release_f?= =?utf-8?q?ixups_for_Python_3=2E5=2E2=2E?= Message-ID: <20160627030216.8033.68394.AB5EC7D3@psf.io> https://hg.python.org/cpython/rev/a8631b745809 changeset: 102196:a8631b745809 branch: 3.5 user: Larry Hastings date: Sun Jun 26 19:47:22 2016 -0700 summary: Post-release fixups for Python 3.5.2. files: Include/patchlevel.h | 2 +- Misc/NEWS | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -23,7 +23,7 @@ #define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "3.5.2" +#define PY_VERSION "3.5.2+" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,8 +2,20 @@ Python News +++++++++++ -What's New in Python 3.5.2 final? -================================= +What's New in Python 3.5.3rc1? +============================== + +Release date: TBA + +Core and Builtins +----------------- + +Library +------- + + +What's New in Python 3.5.2? +=========================== Release date: 2016-06-26 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 23:02:16 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 27 Jun 2016 03:02:16 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Added_tag_v3?= =?utf-8?q?=2E5=2E2_for_changeset_4def2a2901a5?= Message-ID: <20160627030216.106829.9236.F563D8D0@psf.io> https://hg.python.org/cpython/rev/e4fd29ae669a changeset: 102195:e4fd29ae669a branch: 3.5 user: Larry Hastings date: Sat Jun 25 14:11:29 2016 -0700 summary: Added tag v3.5.2 for changeset 4def2a2901a5 files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -162,3 +162,4 @@ 948ef16a69513ba1ff15c9d7d0b012b949df4c80 v3.5.1rc1 37a07cee5969e6d3672583187a73cf636ff28e1b v3.5.1 68feec6488b26327a85a634605dd28eca4daa5f1 v3.5.2rc1 +4def2a2901a5618ea45bcc8f2a1411ef33af18ad v3.5.2 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 23:02:17 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 27 Jun 2016 03:02:17 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy40KTogSXNzdWUgIzI2ODY3?= =?utf-8?q?=3A_Ubuntu=27s_openssl_OP=5FNO=5FSSLv3_is_forced_on_by_default?= =?utf-8?q?=3B_fix_test=2E?= Message-ID: <20160627030217.8072.91250.F98F4474@psf.io> https://hg.python.org/cpython/rev/8f028d04df11 changeset: 102198:8f028d04df11 branch: 3.4 parent: 101970:ca24b5b2d7fe user: Matthias Klose date: Sun Jun 12 23:40:00 2016 -0700 summary: Issue #26867: Ubuntu's openssl OP_NO_SSLv3 is forced on by default; fix test. files: Lib/test/test_ssl.py | 3 ++- 1 files changed, 2 insertions(+), 1 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 @@ -686,7 +686,8 @@ self.assertEqual(ssl.OP_ALL | ssl.OP_NO_TLSv1 | ssl.OP_NO_SSLv3, ctx.options) ctx.options = 0 - self.assertEqual(0, ctx.options) + # Ubuntu has OP_NO_SSLv3 forced on by default + self.assertEqual(0, ctx.options & ~ssl.OP_NO_SSLv3) else: with self.assertRaises(ValueError): ctx.options = 0 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 23:02:17 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 27 Jun 2016 03:02:17 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E4=29=3A_Regenerate_pyd?= =?utf-8?q?oc_topics_for_3=2E4=2E5_final=2E?= Message-ID: <20160627030217.3099.59398.39477A92@psf.io> https://hg.python.org/cpython/rev/81fbce36d24f changeset: 102199:81fbce36d24f branch: 3.4 user: Larry Hastings date: Sat Jun 25 14:42:04 2016 -0700 summary: Regenerate pydoc topics for 3.4.5 final. files: Lib/pydoc_data/topics.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Sat Jun 11 22:20:49 2016 +# Autogenerated by Sphinx on Sat Jun 25 14:40:57 2016 topics = {'assert': u'\nThe "assert" statement\n**********************\n\nAssert statements are a convenient way to insert debugging assertions\ninto a program:\n\n assert_stmt ::= "assert" expression ["," expression]\n\nThe simple form, "assert expression", is equivalent to\n\n if __debug__:\n if not expression: raise AssertionError\n\nThe extended form, "assert expression1, expression2", is equivalent to\n\n if __debug__:\n if not expression1: raise AssertionError(expression2)\n\nThese equivalences assume that "__debug__" and "AssertionError" refer\nto the built-in variables with those names. In the current\nimplementation, the built-in variable "__debug__" is "True" under\nnormal circumstances, "False" when optimization is requested (command\nline option -O). The current code generator emits no code for an\nassert statement when optimization is requested at compile time. Note\nthat it is unnecessary to include the source code for the expression\nthat failed in the error message; it will be displayed as part of the\nstack trace.\n\nAssignments to "__debug__" are illegal. The value for the built-in\nvariable is determined when the interpreter starts.\n', 'assignment': u'\nAssignment statements\n*********************\n\nAssignment statements are used to (re)bind names to values and to\nmodify attributes or items of mutable objects:\n\n assignment_stmt ::= (target_list "=")+ (expression_list | yield_expression)\n target_list ::= target ("," target)* [","]\n target ::= identifier\n | "(" target_list ")"\n | "[" target_list "]"\n | attributeref\n | subscription\n | slicing\n | "*" target\n\n(See section *Primaries* for the syntax definitions for\n*attributeref*, *subscription*, and *slicing*.)\n\nAn assignment statement evaluates the expression list (remember that\nthis can be a single expression or a comma-separated list, the latter\nyielding a tuple) and assigns the single resulting object to each of\nthe target lists, from left to right.\n\nAssignment is defined recursively depending on the form of the target\n(list). When a target is part of a mutable object (an attribute\nreference, subscription or slicing), the mutable object must\nultimately perform the assignment and decide about its validity, and\nmay raise an exception if the assignment is unacceptable. The rules\nobserved by various types and the exceptions raised are given with the\ndefinition of the object types (see section *The standard type\nhierarchy*).\n\nAssignment of an object to a target list, optionally enclosed in\nparentheses or square brackets, is recursively defined as follows.\n\n* If the target list is a single target: The object is assigned to\n that target.\n\n* If the target list is a comma-separated list of targets: The\n object must be an iterable with the same number of items as there\n are targets in the target list, and the items are assigned, from\n left to right, to the corresponding targets.\n\n * If the target list contains one target prefixed with an\n asterisk, called a "starred" target: The object must be a sequence\n with at least as many items as there are targets in the target\n list, minus one. The first items of the sequence are assigned,\n from left to right, to the targets before the starred target. The\n final items of the sequence are assigned to the targets after the\n starred target. A list of the remaining items in the sequence is\n then assigned to the starred target (the list can be empty).\n\n * Else: The object must be a sequence with the same number of\n items as there are targets in the target list, and the items are\n assigned, from left to right, to the corresponding targets.\n\nAssignment of an object to a single target is recursively defined as\nfollows.\n\n* If the target is an identifier (name):\n\n * If the name does not occur in a "global" or "nonlocal" statement\n in the current code block: the name is bound to the object in the\n current local namespace.\n\n * Otherwise: the name is bound to the object in the global\n namespace or the outer namespace determined by "nonlocal",\n respectively.\n\n The name is rebound if it was already bound. This may cause the\n reference count for the object previously bound to the name to reach\n zero, causing the object to be deallocated and its destructor (if it\n has one) to be called.\n\n* If the target is a target list enclosed in parentheses or in\n square brackets: The object must be an iterable with the same number\n of items as there are targets in the target list, and its items are\n assigned, from left to right, to the corresponding targets.\n\n* If the target is an attribute reference: The primary expression in\n the reference is evaluated. It should yield an object with\n assignable attributes; if this is not the case, "TypeError" is\n raised. That object is then asked to assign the assigned object to\n the given attribute; if it cannot perform the assignment, it raises\n an exception (usually but not necessarily "AttributeError").\n\n Note: If the object is a class instance and the attribute reference\n occurs on both sides of the assignment operator, the RHS expression,\n "a.x" can access either an instance attribute or (if no instance\n attribute exists) a class attribute. The LHS target "a.x" is always\n set as an instance attribute, creating it if necessary. Thus, the\n two occurrences of "a.x" do not necessarily refer to the same\n attribute: if the RHS expression refers to a class attribute, the\n LHS creates a new instance attribute as the target of the\n assignment:\n\n class Cls:\n x = 3 # class variable\n inst = Cls()\n inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x as 3\n\n This description does not necessarily apply to descriptor\n attributes, such as properties created with "property()".\n\n* If the target is a subscription: The primary expression in the\n reference is evaluated. It should yield either a mutable sequence\n object (such as a list) or a mapping object (such as a dictionary).\n Next, the subscript expression is evaluated.\n\n If the primary is a mutable sequence object (such as a list), the\n subscript must yield an integer. If it is negative, the sequence\'s\n length is added to it. The resulting value must be a nonnegative\n integer less than the sequence\'s length, and the sequence is asked\n to assign the assigned object to its item with that index. If the\n index is out of range, "IndexError" is raised (assignment to a\n subscripted sequence cannot add new items to a list).\n\n If the primary is a mapping object (such as a dictionary), the\n subscript must have a type compatible with the mapping\'s key type,\n and the mapping is then asked to create a key/datum pair which maps\n the subscript to the assigned object. This can either replace an\n existing key/value pair with the same key value, or insert a new\n key/value pair (if no key with the same value existed).\n\n For user-defined objects, the "__setitem__()" method is called with\n appropriate arguments.\n\n* If the target is a slicing: The primary expression in the\n reference is evaluated. It should yield a mutable sequence object\n (such as a list). The assigned object should be a sequence object\n of the same type. Next, the lower and upper bound expressions are\n evaluated, insofar they are present; defaults are zero and the\n sequence\'s length. The bounds should evaluate to integers. If\n either bound is negative, the sequence\'s length is added to it. The\n resulting bounds are clipped to lie between zero and the sequence\'s\n length, inclusive. Finally, the sequence object is asked to replace\n the slice with the items of the assigned sequence. The length of\n the slice may be different from the length of the assigned sequence,\n thus changing the length of the target sequence, if the target\n sequence allows it.\n\n**CPython implementation detail:** In the current implementation, the\nsyntax for targets is taken to be the same as for expressions, and\ninvalid syntax is rejected during the code generation phase, causing\nless detailed error messages.\n\nAlthough the definition of assignment implies that overlaps between\nthe left-hand side and the right-hand side are \'simultanenous\' (for\nexample "a, b = b, a" swaps two variables), overlaps *within* the\ncollection of assigned-to variables occur left-to-right, sometimes\nresulting in confusion. For instance, the following program prints\n"[0, 2]":\n\n x = [0, 1]\n i = 0\n i, x[i] = 1, 2 # i is updated, then x[i] is updated\n print(x)\n\nSee also: **PEP 3132** - Extended Iterable Unpacking\n\n The specification for the "*target" feature.\n\n\nAugmented assignment statements\n===============================\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n augtarget ::= identifier | attributeref | subscription | slicing\n augop ::= "+=" | "-=" | "*=" | "/=" | "//=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section *Primaries* for the syntax definitions of the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like "x += 1" can be rewritten as\n"x = x + 1" to achieve a similar, but not exactly equal effect. In the\naugmented version, "x" is only evaluated once. Also, when possible,\nthe actual operation is performed *in-place*, meaning that rather than\ncreating a new object and assigning that to the target, the old object\nis modified instead.\n\nUnlike normal assignments, augmented assignments evaluate the left-\nhand side *before* evaluating the right-hand side. For example, "a[i]\n+= f(x)" first looks-up "a[i]", then it evaluates "f(x)" and performs\nthe addition, and lastly, it writes the result back to "a[i]".\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same *caveat about\nclass and instance attributes* applies as for regular assignments.\n', 'atom-identifiers': u'\nIdentifiers (Names)\n*******************\n\nAn identifier occurring as an atom is a name. See section\n*Identifiers and keywords* for lexical definition and section *Naming\nand binding* for documentation of naming and binding.\n\nWhen the name is bound to an object, evaluation of the atom yields\nthat object. When a name is not bound, an attempt to evaluate it\nraises a "NameError" exception.\n\n**Private name mangling:** When an identifier that textually occurs in\na class definition begins with two or more underscore characters and\ndoes not end in two or more underscores, it is considered a *private\nname* of that class. Private names are transformed to a longer form\nbefore code is generated for them. The transformation inserts the\nclass name, with leading underscores removed and a single underscore\ninserted, in front of the name. For example, the identifier "__spam"\noccurring in a class named "Ham" will be transformed to "_Ham__spam".\nThis transformation is independent of the syntactical context in which\nthe identifier is used. If the transformed name is extremely long\n(longer than 255 characters), implementation defined truncation may\nhappen. If the class name consists only of underscores, no\ntransformation is done.\n', -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 23:02:17 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 27 Jun 2016 03:02:17 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E4=29=3A_Version_bump_f?= =?utf-8?b?b3IgMy40LjUgZmluYWwu?= Message-ID: <20160627030217.52765.90056.F9814426@psf.io> https://hg.python.org/cpython/rev/619b61e505d0 changeset: 102200:619b61e505d0 branch: 3.4 tag: v3.4.5 user: Larry Hastings date: Sat Jun 25 14:44:30 2016 -0700 summary: Version bump for 3.4.5 final. files: Include/patchlevel.h | 6 +++--- Misc/NEWS | 11 +++++++++++ README | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -19,11 +19,11 @@ #define PY_MAJOR_VERSION 3 #define PY_MINOR_VERSION 4 #define PY_MICRO_VERSION 5 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 1 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "3.4.5rc1" +#define PY_VERSION "3.4.5" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,6 +2,17 @@ Python News +++++++++++ +What's New in Python 3.4.5? +=========================== + +Release date: 2016-06-26 + +Tests +----- + +- Issue #26867: Ubuntu's openssl OP_NO_SSLv3 is forced on by default; fix test. + + What's New in Python 3.4.5rc1? ============================== diff --git a/README b/README --- a/README +++ b/README @@ -1,5 +1,5 @@ -This is Python version 3.4.5 release candidate 1 -================================================ +This is Python version 3.4.5 +============================ Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Python Software Foundation. All rights reserved. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 23:02:17 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 27 Jun 2016 03:02:17 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E4=29=3A_Added_tag_v3?= =?utf-8?q?=2E4=2E5_for_changeset_619b61e505d0?= Message-ID: <20160627030217.3504.44676.B60791F5@psf.io> https://hg.python.org/cpython/rev/f121a48b8967 changeset: 102201:f121a48b8967 branch: 3.4 user: Larry Hastings date: Sat Jun 25 14:44:49 2016 -0700 summary: Added tag v3.4.5 for changeset 619b61e505d0 files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -147,3 +147,4 @@ 04f3f725896c6961212c3a12e8ac25be6958f4fa v3.4.4rc1 737efcadf5a678b184e0fa431aae11276bf06648 v3.4.4 3631bb4a2490292ebf81d3e947ae36da145da564 v3.4.5rc1 +619b61e505d0e2ccc8516b366e4ddd1971b46a6f v3.4.5 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 23:02:18 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 27 Jun 2016 03:02:18 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgZnJvbSAzLjUu?= Message-ID: <20160627030218.126809.1876.158140A9@psf.io> https://hg.python.org/cpython/rev/9a9817458bc8 changeset: 102205:9a9817458bc8 parent: 102188:4796d7fb00c5 parent: 102204:0b3a6ca3f923 user: Larry Hastings date: Sun Jun 26 20:00:51 2016 -0700 summary: Merge from 3.5. files: .hgtags | 3 +++ Lib/test/test_ssl.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -147,6 +147,8 @@ 04f3f725896c6961212c3a12e8ac25be6958f4fa v3.4.4rc1 737efcadf5a678b184e0fa431aae11276bf06648 v3.4.4 3631bb4a2490292ebf81d3e947ae36da145da564 v3.4.5rc1 +619b61e505d0e2ccc8516b366e4ddd1971b46a6f v3.4.5 +3631bb4a2490292ebf81d3e947ae36da145da564 v3.4.5rc1 5d4b6a57d5fd7564bf73f3db0e46fe5eeb00bcd8 v3.5.0a1 0337bd7ebcb6559d69679bc7025059ad1ce4f432 v3.5.0a2 82656e28b5e5c4ae48d8dd8b5f0d7968908a82b6 v3.5.0a3 @@ -163,5 +165,6 @@ 948ef16a69513ba1ff15c9d7d0b012b949df4c80 v3.5.1rc1 37a07cee5969e6d3672583187a73cf636ff28e1b v3.5.1 68feec6488b26327a85a634605dd28eca4daa5f1 v3.5.2rc1 +4def2a2901a5618ea45bcc8f2a1411ef33af18ad v3.5.2 5896da372fb044e38595fb74495de1e1e7c8fb3c v3.6.0a1 37889342355223e2fc1438de3dc7ffcd625c60f7 v3.6.0a2 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 @@ -844,7 +844,8 @@ self.assertEqual(ssl.OP_ALL | ssl.OP_NO_TLSv1 | ssl.OP_NO_SSLv3, ctx.options) ctx.options = 0 - self.assertEqual(0, ctx.options) + # Ubuntu has OP_NO_SSLv3 forced on by default + self.assertEqual(0, ctx.options & ~ssl.OP_NO_SSLv3) else: with self.assertRaises(ValueError): ctx.options = 0 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 23:02:17 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 27 Jun 2016 03:02:17 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E4=29=3A_Post-release_f?= =?utf-8?q?ixups_for_Python_3=2E4=2E5=2E?= Message-ID: <20160627030217.25253.25572.699416C0@psf.io> https://hg.python.org/cpython/rev/2dac6cd4238f changeset: 102202:2dac6cd4238f branch: 3.4 user: Larry Hastings date: Sun Jun 26 19:41:21 2016 -0700 summary: Post-release fixups for Python 3.4.5. files: Include/patchlevel.h | 2 +- Misc/NEWS | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletions(-) diff --git a/Include/patchlevel.h b/Include/patchlevel.h --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -23,7 +23,7 @@ #define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "3.4.5" +#define PY_VERSION "3.4.5+" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,6 +2,18 @@ Python News +++++++++++ +What's New in Python 3.4.6rc1? +============================== + +Release date: TBA + +Core and Builtins +----------------- + +Library +------- + + What's New in Python 3.4.5? =========================== -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 23:02:17 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 27 Jun 2016 03:02:17 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy40IC0+IDMuNCk6?= =?utf-8?q?_Merge=2E?= Message-ID: <20160627030217.25432.88878.6DEDA0D3@psf.io> https://hg.python.org/cpython/rev/a2787831ac08 changeset: 102203:a2787831ac08 branch: 3.4 parent: 102202:2dac6cd4238f parent: 102048:dfc57c66a670 user: Larry Hastings date: Sun Jun 26 19:43:00 2016 -0700 summary: Merge. files: Doc/Makefile | 8 +++++++- Modules/expat/xmlrole.c | 4 ++-- Modules/expat/xmltok.c | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Doc/Makefile b/Doc/Makefile --- a/Doc/Makefile +++ b/Doc/Makefile @@ -161,7 +161,7 @@ -make suspicious # for quick rebuilds (HTML only) -autobuild-html: +autobuild-dev-html: make html SPHINXOPTS='-A daily=1 -A versionswitcher=1' # for stable releases: only build if not in pre-release stage (alpha, beta) @@ -173,3 +173,9 @@ esac @make autobuild-dev +autobuild-stable-html: + @case $(DISTVERSION) in *[ab]*) \ + echo "Not building; $(DISTVERSION) is not a release version."; \ + exit 1;; \ + esac + @make autobuild-dev-html diff --git a/Modules/expat/xmlrole.c b/Modules/expat/xmlrole.c --- a/Modules/expat/xmlrole.c +++ b/Modules/expat/xmlrole.c @@ -2,6 +2,8 @@ See the file COPYING for copying permission. */ +#include + #ifdef COMPILED_FROM_DSP #include "winconfig.h" #elif defined(MACOS_CLASSIC) @@ -16,8 +18,6 @@ #endif #endif /* ndef COMPILED_FROM_DSP */ -#include - #include "expat_external.h" #include "internal.h" #include "xmlrole.h" diff --git a/Modules/expat/xmltok.c b/Modules/expat/xmltok.c --- a/Modules/expat/xmltok.c +++ b/Modules/expat/xmltok.c @@ -2,6 +2,8 @@ See the file COPYING for copying permission. */ +#include + #ifdef COMPILED_FROM_DSP #include "winconfig.h" #elif defined(MACOS_CLASSIC) @@ -16,8 +18,6 @@ #endif #endif /* ndef COMPILED_FROM_DSP */ -#include - #include "expat_external.h" #include "internal.h" #include "xmltok.h" -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 23:02:17 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 27 Jun 2016 03:02:17 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy40IC0+IDMuNSk6?= =?utf-8?q?_Null_merge_from_3=2E4_=28well=2C_except=2C_pull_in_the_tag_for?= =?utf-8?b?IDMuNC41Lik=?= Message-ID: <20160627030217.15832.56959.1BF115B4@psf.io> https://hg.python.org/cpython/rev/0b3a6ca3f923 changeset: 102204:0b3a6ca3f923 branch: 3.5 parent: 102197:1f8938164809 parent: 102203:a2787831ac08 user: Larry Hastings date: Sun Jun 26 19:57:48 2016 -0700 summary: Null merge from 3.4 (well, except, pull in the tag for 3.4.5.) files: .hgtags | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -147,6 +147,7 @@ 04f3f725896c6961212c3a12e8ac25be6958f4fa v3.4.4rc1 737efcadf5a678b184e0fa431aae11276bf06648 v3.4.4 3631bb4a2490292ebf81d3e947ae36da145da564 v3.4.5rc1 +619b61e505d0e2ccc8516b366e4ddd1971b46a6f v3.4.5 5d4b6a57d5fd7564bf73f3db0e46fe5eeb00bcd8 v3.5.0a1 0337bd7ebcb6559d69679bc7025059ad1ce4f432 v3.5.0a2 82656e28b5e5c4ae48d8dd8b5f0d7968908a82b6 v3.5.0a3 -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Jun 26 23:02:17 2016 From: python-checkins at python.org (larry.hastings) Date: Mon, 27 Jun 2016 03:02:17 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNSk6?= =?utf-8?q?_Merge=2E?= Message-ID: <20160627030217.127057.74069.06EF14CC@psf.io> https://hg.python.org/cpython/rev/1f8938164809 changeset: 102197:1f8938164809 branch: 3.5 parent: 102196:a8631b745809 parent: 102186:31a2a278dc85 user: Larry Hastings date: Sun Jun 26 19:53:18 2016 -0700 summary: Merge. files: .hgtags | 1 + Doc/Makefile | 9 +- Doc/c-api/module.rst | 4 +- Doc/c-api/structures.rst | 5 +- Doc/c-api/typeobj.rst | 4 +- Doc/faq/general.rst | 2 +- Doc/howto/regex.rst | 4 +- Doc/library/builtins.rst | 2 +- Doc/library/curses.ascii.rst | 4 +- Doc/library/dbm.rst | 10 + Doc/library/enum.rst | 2 +- Doc/library/functions.rst | 12 +- Doc/library/functools.rst | 2 +- Doc/library/importlib.rst | 14 + Doc/library/inspect.rst | 9 +- Doc/library/json.rst | 8 +- Doc/library/multiprocessing.rst | 9 +- Doc/library/os.rst | 11 +- Doc/library/re.rst | 2 +- Doc/library/readline.rst | 7 +- Doc/library/sqlite3.rst | 41 +- Doc/library/stdtypes.rst | 23 +- Doc/library/tarfile.rst | 14 +- Doc/library/zipfile.rst | 6 +- Doc/reference/datamodel.rst | 51 +- Doc/tools/extensions/suspicious.py | 2 +- Doc/tutorial/classes.rst | 4 +- Doc/whatsnew/2.0.rst | 2 +- Doc/whatsnew/2.1.rst | 4 +- Doc/whatsnew/2.2.rst | 14 +- Doc/whatsnew/2.3.rst | 8 +- Doc/whatsnew/3.0.rst | 4 +- Lib/contextlib.py | 3 + Lib/ctypes/test/test_find.py | 7 +- Lib/ctypes/test/test_structures.py | 6 +- Lib/ctypes/util.py | 131 ++++- Lib/curses/ascii.py | 6 +- Lib/distutils/_msvccompiler.py | 6 +- Lib/distutils/command/upload.py | 2 +- Lib/distutils/tests/test_config.py | 28 +- Lib/distutils/tests/test_msvccompiler.py | 18 + Lib/distutils/tests/test_register.py | 4 +- Lib/distutils/tests/test_sdist.py | 4 +- Lib/distutils/tests/test_upload.py | 7 +- Lib/idlelib/NEWS.txt | 13 +- Lib/idlelib/aboutDialog.py | 2 + Lib/idlelib/configDialog.py | 8 +- Lib/idlelib/idle_test/test_help_about.py | 52 ++ Lib/idlelib/textView.py | 4 + Lib/importlib/_bootstrap_external.py | 3 +- Lib/importlib/util.py | 2 +- Lib/lib2to3/tests/test_refactor.py | 5 +- Lib/pydoc.py | 5 +- Lib/sqlite3/test/dbapi.py | 205 ++------- Lib/sqlite3/test/hooks.py | 38 +- Lib/sqlite3/test/regression.py | 37 +- Lib/sqlite3/test/transactions.py | 33 +- Lib/sqlite3/test/types.py | 20 +- Lib/sqlite3/test/userfunctions.py | 62 +-- Lib/test/support/__init__.py | 3 +- Lib/test/support/script_helper.py | 4 + Lib/test/test_asyncio/test_base_events.py | 8 +- Lib/test/test_compile.py | 7 + Lib/test/test_contextlib.py | 34 + Lib/test/test_coroutines.py | 2 +- Lib/test/test_curses.py | 54 ++ Lib/test/test_decimal.py | 5 +- Lib/test/test_doctest.py | 24 +- Lib/test/test_extcall.py | 4 + Lib/test/test_functools.py | 61 ++ Lib/test/test_importlib/test_lazy.py | 16 +- Lib/test/test_parser.py | 16 + Lib/test/test_pydoc.py | 2 +- Lib/test/test_readline.py | 161 +++++++- Lib/test/test_symtable.py | 6 + Lib/test/test_unpack_ex.py | 5 + Lib/test/test_xml_etree.py | 8 +- Lib/test/test_zipimport.py | 15 + Lib/tkinter/__init__.py | 19 +- Lib/tkinter/test/test_tkinter/test_variables.py | 51 ++- Lib/tkinter/test/test_ttk/test_widgets.py | 51 ++ Lib/tkinter/ttk.py | 4 +- Lib/turtle.py | 18 +- Lib/unittest/mock.py | 1 + Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py | 2 - Misc/ACKS | 1 + Misc/NEWS | 63 ++- Modules/_ctypes/_ctypes.c | 42 +- Modules/_ctypes/callproc.c | 8 +- Modules/_ctypes/cfield.c | 20 +- Modules/_decimal/_decimal.c | 10 +- Modules/_elementtree.c | 19 +- Modules/_functoolsmodule.c | 39 +- Modules/_sqlite/connection.c | 4 + Modules/_sqlite/module.h | 2 +- Modules/arraymodule.c | 2 +- Modules/expat/xmlrole.c | 4 +- Modules/expat/xmltok.c | 4 +- Modules/readline.c | 132 ++++- Objects/abstract.c | 4 +- Objects/unicodeobject.c | 8 +- PC/launcher.c | 2 +- Python/compile.c | 38 +- Python/importlib_external.h | 208 +++++----- Python/random.c | 6 +- README | 4 +- Tools/msi/make_zip.py | 28 +- Tools/nuget/make_pkg.proj | 55 ++ Tools/nuget/python.nuspec | 18 + Tools/nuget/pythonx86.nuspec | 18 + 110 files changed, 1527 insertions(+), 798 deletions(-) diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -146,6 +146,7 @@ b4cbecbc0781e89a309d03b60a1f75f8499250e6 v3.4.3 04f3f725896c6961212c3a12e8ac25be6958f4fa v3.4.4rc1 737efcadf5a678b184e0fa431aae11276bf06648 v3.4.4 +3631bb4a2490292ebf81d3e947ae36da145da564 v3.4.5rc1 5d4b6a57d5fd7564bf73f3db0e46fe5eeb00bcd8 v3.5.0a1 0337bd7ebcb6559d69679bc7025059ad1ce4f432 v3.5.0a2 82656e28b5e5c4ae48d8dd8b5f0d7968908a82b6 v3.5.0a3 diff --git a/Doc/Makefile b/Doc/Makefile --- a/Doc/Makefile +++ b/Doc/Makefile @@ -166,7 +166,7 @@ -make suspicious # for quick rebuilds (HTML only) -autobuild-html: +autobuild-dev-html: make html SPHINXOPTS='-A daily=1 -A versionswitcher=1' # for stable releases: only build if not in pre-release stage (alpha, beta) @@ -177,3 +177,10 @@ exit 1;; \ esac @make autobuild-dev + +autobuild-stable-html: + @case $(DISTVERSION) in *[ab]*) \ + echo "Not building; $(DISTVERSION) is not a release version."; \ + exit 1;; \ + esac + @make autobuild-dev-html 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 @@ -59,10 +59,10 @@ .. 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 + is the same as the :attr:`~object.__dict__` attribute of the module object. This function never fails. It is recommended extensions use other :c:func:`PyModule_\*` and :c:func:`PyObject_\*` functions rather than directly - manipulate a module's :attr:`__dict__`. + manipulate a module's :attr:`~object.__dict__`. .. c:function:: PyObject* PyModule_GetNameObject(PyObject *module) 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 @@ -150,9 +150,8 @@ The :attr:`ml_flags` field is a bitfield which can include the following flags. The individual flags indicate either a calling convention or a binding convention. Of the calling convention flags, only :const:`METH_VARARGS` and -:const:`METH_KEYWORDS` can be combined (but note that :const:`METH_KEYWORDS` -alone is equivalent to ``METH_VARARGS | METH_KEYWORDS``). Any of the calling -convention flags can be combined with a binding flag. +:const:`METH_KEYWORDS` can be combined. Any of the calling convention flags +can be combined with a binding flag. .. data:: METH_VARARGS 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 @@ -111,10 +111,10 @@ For statically allocated type objects, the tp_name field should contain a dot. Everything before the last dot is made accessible as the :attr:`__module__` attribute, and everything after the last dot is made accessible as the - :attr:`__name__` attribute. + :attr:`~definition.__name__` attribute. If no dot is present, the entire :c:member:`~PyTypeObject.tp_name` field is made accessible as the - :attr:`__name__` attribute, and the :attr:`__module__` attribute is undefined + :attr:`~definition.__name__` attribute, and the :attr:`__module__` attribute is undefined (unless explicitly set in the dictionary, as explained above). This means your type will be impossible to pickle. diff --git a/Doc/faq/general.rst b/Doc/faq/general.rst --- a/Doc/faq/general.rst +++ b/Doc/faq/general.rst @@ -438,7 +438,7 @@ >>> L [1] -With the interpreter, documentation is never far from the student as he's +With the interpreter, documentation is never far from the student as they are programming. There are also good IDEs for Python. IDLE is a cross-platform IDE for Python diff --git a/Doc/howto/regex.rst b/Doc/howto/regex.rst --- a/Doc/howto/regex.rst +++ b/Doc/howto/regex.rst @@ -374,9 +374,7 @@ :source:`Tools/demo/redemo.py`, a demonstration program included with the Python distribution. It allows you to enter REs and strings, and displays whether the RE matches or fails. :file:`redemo.py` can be quite useful when -trying to debug a complicated RE. Phil Schwartz's `Kodos -`_ is also an interactive tool for developing and -testing RE patterns. +trying to debug a complicated RE. This HOWTO uses the standard Python interpreter for its examples. First, run the Python interpreter, import the :mod:`re` module, and compile a RE:: diff --git a/Doc/library/builtins.rst b/Doc/library/builtins.rst --- a/Doc/library/builtins.rst +++ b/Doc/library/builtins.rst @@ -37,6 +37,6 @@ As an implementation detail, most modules have the name ``__builtins__`` made available as part of their globals. The value of ``__builtins__`` is normally -either this module or the value of this module's :attr:`__dict__` attribute. +either this module or the value of this module's :attr:`~object.__dict__` attribute. Since this is an implementation detail, it may not be used by alternate implementations of Python. diff --git a/Doc/library/curses.ascii.rst b/Doc/library/curses.ascii.rst --- a/Doc/library/curses.ascii.rst +++ b/Doc/library/curses.ascii.rst @@ -115,12 +115,12 @@ .. function:: isblank(c) - Checks for an ASCII whitespace character. + Checks for an ASCII whitespace character; space or horizontal tab. .. function:: iscntrl(c) - Checks for an ASCII control character (in the range 0x00 to 0x1f). + Checks for an ASCII control character (in the range 0x00 to 0x1f or 0x7f). .. function:: isdigit(c) diff --git a/Doc/library/dbm.rst b/Doc/library/dbm.rst --- a/Doc/library/dbm.rst +++ b/Doc/library/dbm.rst @@ -128,6 +128,9 @@ :platform: Unix :synopsis: GNU's reinterpretation of dbm. +**Source code:** :source:`Lib/dbm/gnu.py` + +-------------- This module is quite similar to the :mod:`dbm` module, but uses the GNU library ``gdbm`` instead to provide some additional functionality. Please note that the @@ -237,6 +240,9 @@ :platform: Unix :synopsis: The standard "database" interface, based on ndbm. +**Source code:** :source:`Lib/dbm/ndbm.py` + +-------------- The :mod:`dbm.ndbm` module provides an interface to the Unix "(n)dbm" library. Dbm objects behave like mappings (dictionaries), except that keys and values are @@ -299,6 +305,8 @@ .. module:: dbm.dumb :synopsis: Portable implementation of the simple DBM interface. +**Source code:** :source:`Lib/dbm/dumb.py` + .. index:: single: databases .. note:: @@ -308,6 +316,8 @@ module is not written for speed and is not nearly as heavily used as the other database modules. +-------------- + The :mod:`dbm.dumb` module provides a persistent dictionary-like interface which is written entirely in Python. Unlike other modules such as :mod:`dbm.gnu` no external library is required. As with other persistent mappings, the keys and diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst --- a/Doc/library/enum.rst +++ b/Doc/library/enum.rst @@ -431,7 +431,7 @@ the source, pickling will be disabled. The new pickle protocol 4 also, in some circumstances, relies on -:attr:`__qualname__` being set to the location where pickle will be able +:attr:`~definition.__qualname__` being set to the location where pickle will be able to find the class. For example, if the class was made available in class SomeData in the global scope:: diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -304,7 +304,7 @@ :func:`dir` reports their attributes. If the object does not provide :meth:`__dir__`, the function tries its best to - gather information from the object's :attr:`__dict__` attribute, if defined, and + gather information from the object's :attr:`~object.__dict__` attribute, if defined, and from its type object. The resulting list is not necessarily complete, and may be inaccurate when the object has a custom :func:`__getattr__`. @@ -1446,7 +1446,7 @@ With three arguments, return a new type object. This is essentially a dynamic form of the :keyword:`class` statement. The *name* string is the - class name and becomes the :attr:`~class.__name__` attribute; the *bases* + class name and becomes the :attr:`~definition.__name__` attribute; the *bases* tuple itemizes the base classes and becomes the :attr:`~class.__bases__` attribute; and the *dict* dictionary is the namespace containing definitions for class body and is copied to a standard dictionary to become the @@ -1464,12 +1464,12 @@ .. function:: vars([object]) Return the :attr:`~object.__dict__` attribute for a module, class, instance, - or any other object with a :attr:`__dict__` attribute. + or any other object with a :attr:`~object.__dict__` attribute. - Objects such as modules and instances have an updateable :attr:`__dict__` + Objects such as modules and instances have an updateable :attr:`~object.__dict__` attribute; however, other objects may have write restrictions on their - :attr:`__dict__` attributes (for example, classes use a - dictproxy to prevent direct dictionary updates). + :attr:`~object.__dict__` attributes (for example, classes use a + :class:`types.MappingProxyType` to prevent direct dictionary updates). Without an argument, :func:`vars` acts like :func:`locals`. Note, the locals dictionary is only useful for reads since updates to the locals diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -474,7 +474,7 @@ :class:`partial` objects are like :class:`function` objects in that they are callable, weak referencable, and can have attributes. There are some important -differences. For instance, the :attr:`__name__` and :attr:`__doc__` attributes +differences. For instance, the :attr:`~definition.__name__` and :attr:`__doc__` attributes are not created automatically. Also, :class:`partial` objects defined in classes behave like static methods and do not transform into bound methods during instance attribute look-up. diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst --- a/Doc/library/importlib.rst +++ b/Doc/library/importlib.rst @@ -211,6 +211,11 @@ .. module:: importlib.abc :synopsis: Abstract base classes related to import +**Source code:** :source:`Lib/importlib/abc.py` + +-------------- + + The :mod:`importlib.abc` module contains all of the core abstract base classes used by :keyword:`import`. Some subclasses of the core abstract base classes are also provided to help in implementing the core ABCs. @@ -700,6 +705,10 @@ .. module:: importlib.machinery :synopsis: Importers and path hooks +**Source code:** :source:`Lib/importlib/machinery.py` + +-------------- + This module contains the various objects that help :keyword:`import` find and load modules. @@ -1082,6 +1091,11 @@ .. module:: importlib.util :synopsis: Utility code for importers + +**Source code:** :source:`Lib/importlib/util.py` + +-------------- + This module contains the various objects that help in the construction of an :term:`importer`. diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -374,8 +374,9 @@ are true. This, for example, is true of ``int.__add__``. An object passing this test - has a :attr:`__get__` attribute but not a :attr:`__set__` attribute, but - beyond that the set of attributes varies. :attr:`__name__` is usually + has a :meth:`~object.__get__` method but not a :meth:`~object.__set__` + method, but beyond that the set of attributes varies. A + :attr:`~definition.__name__` attribute is usually sensible, and :attr:`__doc__` often is. Methods implemented via descriptors that also pass one of the other tests @@ -388,11 +389,11 @@ Return true if the object is a data descriptor. - Data descriptors have both a :attr:`__get__` and a :attr:`__set__` attribute. + Data descriptors have both a :attr:`~object.__get__` and a :attr:`~object.__set__` method. Examples are properties (defined in Python), getsets, and members. The latter two are defined in C and there are more specific tests available for those types, which is robust across Python implementations. Typically, data - descriptors will also have :attr:`__name__` and :attr:`__doc__` attributes + descriptors will also have :attr:`~definition.__name__` and :attr:`__doc__` attributes (properties, getsets, and members have both of these attributes), but this is not guaranteed. diff --git a/Doc/library/json.rst b/Doc/library/json.rst --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -629,13 +629,19 @@ :class:`decimal.Decimal`. .. highlight:: bash -.. module:: json.tool .. _json-commandline: Command Line Interface ---------------------- +.. module:: json.tool + :synopsis: A command line to validate and pretty-print JSON. + +**Source code:** :source:`Lib/json/tool.py` + +-------------- + The :mod:`json.tool` module provides a simple command line interface to validate and pretty-print JSON objects. diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -1010,7 +1010,7 @@ using :meth:`recv`. The object must be picklable. Very large pickles (approximately 32 MB+, - though it depends on the OS) may raise a ValueError exception. + though it depends on the OS) may raise a :exc:`ValueError` exception. .. method:: recv() @@ -2723,12 +2723,7 @@ More picklability - Ensure that all arguments to :meth:`Process.__init__` are - picklable. This means, in particular, that bound or unbound - methods cannot be used directly as the ``target`` (unless you use - the *fork* start method) --- just define a function and use that - instead. - + Ensure that all arguments to :meth:`Process.__init__` are picklable. Also, if you subclass :class:`~multiprocessing.Process` then make sure that instances will be picklable when the :meth:`Process.start ` method is called. diff --git a/Doc/library/os.rst b/Doc/library/os.rst --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1195,7 +1195,11 @@ .. function:: writev(fd, buffers) Write the contents of *buffers* to file descriptor *fd*. *buffers* must be a - sequence of :term:`bytes-like objects `. + sequence of :term:`bytes-like objects `. Buffers are + processed in array order. Entire contents of first buffer is written before + proceeding to second, and so on. The operating system may set a limit + (sysconf() value SC_IOV_MAX) on the number of buffers that can be used. + :func:`~os.writev` writes the contents of each object to the file descriptor and returns the total number of bytes written. @@ -2049,9 +2053,8 @@ Note that there is a nice correspondence between several attributes and methods of ``DirEntry`` and of :class:`pathlib.Path`. In - particular, the ``name`` and ``path`` attributes have the same - meaning, as do the ``is_dir()``, ``is_file()``, ``is_symlink()`` - and ``stat()`` methods. + particular, the ``name`` attribute has the same meaning, as do the + ``is_dir()``, ``is_file()``, ``is_symlink()`` and ``stat()`` methods. .. versionadded:: 3.5 diff --git a/Doc/library/re.rst b/Doc/library/re.rst --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -443,7 +443,7 @@ The ``'\u'`` and ``'\U'`` escape sequences have been added. .. deprecated-removed:: 3.5 3.6 - Unknown escapes consist of ``'\'`` and ASCII letter now raise a + Unknown escapes consisting of ``'\'`` and ASCII letter now raise a deprecation warning and will be forbidden in Python 3.6. diff --git a/Doc/library/readline.rst b/Doc/library/readline.rst --- a/Doc/library/readline.rst +++ b/Doc/library/readline.rst @@ -104,7 +104,9 @@ Append the last *nelements* items of history to a file. The default filename is :file:`~/.history`. The file must already exist. This calls - :c:func:`append_history` in the underlying library. + :c:func:`append_history` in the underlying library. This function + only exists if Python was compiled for a version of the library + that supports it. .. versionadded:: 3.5 @@ -185,7 +187,8 @@ be used as the new hook function; if omitted or ``None``, any function already installed is removed. The hook is called with no arguments after the first prompt has been printed and just before - readline starts reading input characters. + readline starts reading input characters. This function only exists + if Python was compiled for a version of the library that supports it. Completion diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -309,25 +309,26 @@ call :meth:`commit`. If you just close your database connection without calling :meth:`commit` first, your changes will be lost! - .. method:: execute(sql, [parameters]) + .. method:: execute(sql[, parameters]) - This is a nonstandard shortcut that creates an intermediate cursor object by - calling the cursor method, then calls the cursor's :meth:`execute - ` method with the parameters given. + This is a nonstandard shortcut that creates a cursor object by calling + the :meth:`~Connection.cursor` method, calls the cursor's + :meth:`~Cursor.execute` method with the *parameters* given, and returns + the cursor. + .. method:: executemany(sql[, parameters]) - .. method:: executemany(sql, [parameters]) - - This is a nonstandard shortcut that creates an intermediate cursor object by - calling the cursor method, then calls the cursor's :meth:`executemany - ` method with the parameters given. + This is a nonstandard shortcut that creates a cursor object by + calling the :meth:`~Connection.cursor` method, calls the cursor's + :meth:`~Cursor.executemany` method with the *parameters* given, and + returns the cursor. .. method:: executescript(sql_script) - This is a nonstandard shortcut that creates an intermediate cursor object by - calling the cursor method, then calls the cursor's :meth:`executescript - ` method with the parameters given. - + This is a nonstandard shortcut that creates a cursor object by + calling the :meth:`~Connection.cursor` method, calls the cursor's + :meth:`~Cursor.executescript` method with the given *sql_script*, and + returns the cursor. .. method:: create_function(name, num_params, func) @@ -488,10 +489,6 @@ :mod:`sqlite3` module will return Unicode objects for ``TEXT``. If you want to return bytestrings instead, you can set it to :class:`bytes`. - For efficiency reasons, there's also a way to return :class:`str` objects - only for non-ASCII data, and :class:`bytes` otherwise. To activate it, set - this attribute to :const:`sqlite3.OptimizedUnicode`. - You can also set it to any other callable that accepts a single bytestring parameter and returns the resulting object. @@ -533,7 +530,7 @@ A :class:`Cursor` instance has the following attributes and methods. - .. method:: execute(sql, [parameters]) + .. method:: execute(sql[, parameters]) Executes an SQL statement. The SQL statement may be parameterized (i. e. placeholders instead of SQL literals). The :mod:`sqlite3` module supports two @@ -545,7 +542,7 @@ .. literalinclude:: ../includes/sqlite3/execute_1.py :meth:`execute` will only execute a single SQL statement. If you try to execute - more than one statement with it, it will raise a Warning. Use + more than one statement with it, it will raise an ``sqlite3.Warning``. Use :meth:`executescript` if you want to execute multiple SQL statements with one call. @@ -553,8 +550,8 @@ .. method:: executemany(sql, seq_of_parameters) Executes an SQL command against all parameter sequences or mappings found in - the sequence *sql*. The :mod:`sqlite3` module also allows using an - :term:`iterator` yielding parameters instead of a sequence. + the sequence *seq_of_parameters*. The :mod:`sqlite3` module also allows + using an :term:`iterator` yielding parameters instead of a sequence. .. literalinclude:: ../includes/sqlite3/executemany_1.py @@ -569,7 +566,7 @@ at once. It issues a ``COMMIT`` statement first, then executes the SQL script it gets as a parameter. - *sql_script* can be an instance of :class:`str` or :class:`bytes`. + *sql_script* can be an instance of :class:`str`. Example: diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -4360,9 +4360,10 @@ A special attribute of every module is :attr:`~object.__dict__`. This is the dictionary containing the module's symbol table. Modifying this dictionary will actually change the module's symbol table, but direct assignment to the -:attr:`__dict__` attribute is not possible (you can write +:attr:`~object.__dict__` attribute is not possible (you can write ``m.__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but you can't write -``m.__dict__ = {}``). Modifying :attr:`__dict__` directly is not recommended. +``m.__dict__ = {}``). Modifying :attr:`~object.__dict__` directly is +not recommended. Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ``>> class C(object): @@ -383,7 +383,7 @@ AttributeError: 'C' object has no attribute 'newattr' Note how you get an :exc:`AttributeError` on the attempt to assign to an -attribute not listed in :attr:`__slots__`. +attribute not listed in :attr:`~object.__slots__`. .. _sect-rellinks: 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 @@ -1111,10 +1111,10 @@ * One of the noted incompatibilities between old- and new-style classes has been - removed: you can now assign to the :attr:`__name__` and :attr:`__bases__` + removed: you can now assign to the :attr:`~definition.__name__` and :attr:`~class.__bases__` attributes of new-style classes. There are some restrictions on what can be - assigned to :attr:`__bases__` along the lines of those relating to assigning to - an instance's :attr:`__class__` attribute. + assigned to :attr:`~class.__bases__` along the lines of those relating to assigning to + an instance's :attr:`~instance.__class__` attribute. .. ====================================================================== @@ -1920,7 +1920,7 @@ * If you dynamically allocate type objects in your extension, you should be aware of a change in the rules relating to the :attr:`__module__` and - :attr:`__name__` attributes. In summary, you will want to ensure the type's + :attr:`~definition.__name__` attributes. In summary, you will want to ensure the type's dictionary contains a ``'__module__'`` key; making the module name the part of the type name leading up to the final period will no longer have the desired effect. For more detail, read the API reference documentation or the source. diff --git a/Doc/whatsnew/3.0.rst b/Doc/whatsnew/3.0.rst --- a/Doc/whatsnew/3.0.rst +++ b/Doc/whatsnew/3.0.rst @@ -783,8 +783,8 @@ :attr:`func_closure`, :attr:`func_code`, :attr:`func_defaults`, :attr:`func_dict`, :attr:`func_doc`, :attr:`func_globals`, :attr:`func_name` were renamed to :attr:`__closure__`, - :attr:`__code__`, :attr:`__defaults__`, :attr:`__dict__`, - :attr:`__doc__`, :attr:`__globals__`, :attr:`__name__`, + :attr:`__code__`, :attr:`__defaults__`, :attr:`~object.__dict__`, + :attr:`__doc__`, :attr:`__globals__`, :attr:`~definition.__name__`, respectively. * :meth:`__nonzero__` is now :meth:`__bool__`. diff --git a/Lib/contextlib.py b/Lib/contextlib.py --- a/Lib/contextlib.py +++ b/Lib/contextlib.py @@ -82,6 +82,9 @@ # raised inside the "with" statement from being suppressed. return exc is not value except RuntimeError as exc: + # Don't re-raise the passed in exception. (issue27112) + if exc is value: + return False # Likewise, avoid suppressing if a StopIteration exception # was passed to throw() and later wrapped into a RuntimeError # (see PEP 479). diff --git a/Lib/ctypes/test/test_find.py b/Lib/ctypes/test/test_find.py --- a/Lib/ctypes/test/test_find.py +++ b/Lib/ctypes/test/test_find.py @@ -1,5 +1,5 @@ import unittest -import os +import os, os.path import sys import test.support from ctypes import * @@ -64,6 +64,11 @@ self.skipTest('lib_gle not available') self.gle.gleGetJoinStyle + def test_shell_injection(self): + result = find_library('; echo Hello shell > ' + test.support.TESTFN) + self.assertFalse(os.path.lexists(test.support.TESTFN)) + self.assertIsNone(result) + # On platforms where the default shared library suffix is '.so', # at least some libraries can be loaded as attributes of the cdll # object, since ctypes now tries loading the lib again diff --git a/Lib/ctypes/test/test_structures.py b/Lib/ctypes/test/test_structures.py --- a/Lib/ctypes/test/test_structures.py +++ b/Lib/ctypes/test/test_structures.py @@ -227,10 +227,10 @@ def test_conflicting_initializers(self): class POINT(Structure): - _fields_ = [("x", c_int), ("y", c_int)] + _fields_ = [("phi", c_float), ("rho", c_float)] # conflicting positional and keyword args - self.assertRaises(TypeError, POINT, 2, 3, x=4) - self.assertRaises(TypeError, POINT, 2, 3, y=4) + self.assertRaisesRegex(TypeError, "phi", POINT, 2, 3, phi=4) + self.assertRaisesRegex(TypeError, "rho", POINT, 2, 3, rho=4) # too many initializers self.assertRaises(TypeError, POINT, 2, 3, 4) diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py --- a/Lib/ctypes/util.py +++ b/Lib/ctypes/util.py @@ -1,6 +1,7 @@ -import sys, os -import contextlib +import os +import shutil import subprocess +import sys # find_library(name) returns the pathname of a library, or None. if os.name == "nt": @@ -94,28 +95,46 @@ import re, tempfile def _findLib_gcc(name): - expr = r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name) - fdout, ccout = tempfile.mkstemp() - os.close(fdout) - cmd = 'if type gcc >/dev/null 2>&1; then CC=gcc; elif type cc >/dev/null 2>&1; then CC=cc;else exit 10; fi;' \ - 'LANG=C LC_ALL=C $CC -Wl,-t -o ' + ccout + ' 2>&1 -l' + name + # Run GCC's linker with the -t (aka --trace) option and examine the + # library name it prints out. The GCC command will fail because we + # haven't supplied a proper program with main(), but that does not + # matter. + expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)) + + c_compiler = shutil.which('gcc') + if not c_compiler: + c_compiler = shutil.which('cc') + if not c_compiler: + # No C compiler available, give up + return None + + temp = tempfile.NamedTemporaryFile() try: - f = os.popen(cmd) + args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name] + + env = dict(os.environ) + env['LC_ALL'] = 'C' + env['LANG'] = 'C' try: - trace = f.read() - finally: - rv = f.close() + proc = subprocess.Popen(args, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + env=env) + except OSError: # E.g. bad executable + return None + with proc: + trace = proc.stdout.read() finally: try: - os.unlink(ccout) + temp.close() except FileNotFoundError: + # Raised if the file was already removed, which is the normal + # behaviour of GCC if linking fails pass - if rv == 10: - raise OSError('gcc or cc command not found') res = re.search(expr, trace) if not res: return None - return res.group(0) + return os.fsdecode(res.group(0)) if sys.platform == "sunos5": @@ -123,55 +142,75 @@ def _get_soname(f): if not f: return None - cmd = "/usr/ccs/bin/dump -Lpv 2>/dev/null " + f - with contextlib.closing(os.popen(cmd)) as f: - data = f.read() - res = re.search(r'\[.*\]\sSONAME\s+([^\s]+)', data) + + try: + proc = subprocess.Popen(("/usr/ccs/bin/dump", "-Lpv", f), + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL) + except OSError: # E.g. command not found + return None + with proc: + data = proc.stdout.read() + res = re.search(br'\[.*\]\sSONAME\s+([^\s]+)', data) if not res: return None - return res.group(1) + return os.fsdecode(res.group(1)) else: def _get_soname(f): # assuming GNU binutils / ELF if not f: return None - cmd = 'if ! type objdump >/dev/null 2>&1; then exit 10; fi;' \ - "objdump -p -j .dynamic 2>/dev/null " + f - f = os.popen(cmd) + objdump = shutil.which('objdump') + if not objdump: + # objdump is not available, give up + return None + try: - dump = f.read() - finally: - rv = f.close() - if rv == 10: - raise OSError('objdump command not found') - res = re.search(r'\sSONAME\s+([^\s]+)', dump) + proc = subprocess.Popen((objdump, '-p', '-j', '.dynamic', f), + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL) + except OSError: # E.g. bad executable + return None + with proc: + dump = proc.stdout.read() + res = re.search(br'\sSONAME\s+([^\s]+)', dump) if not res: return None - return res.group(1) + return os.fsdecode(res.group(1)) if sys.platform.startswith(("freebsd", "openbsd", "dragonfly")): def _num_version(libname): # "libxyz.so.MAJOR.MINOR" => [ MAJOR, MINOR ] - parts = libname.split(".") + parts = libname.split(b".") nums = [] try: while parts: nums.insert(0, int(parts.pop())) except ValueError: pass - return nums or [ sys.maxsize ] + return nums or [sys.maxsize] def find_library(name): ename = re.escape(name) expr = r':-l%s\.\S+ => \S*/(lib%s\.\S+)' % (ename, ename) - with contextlib.closing(os.popen('/sbin/ldconfig -r 2>/dev/null')) as f: - data = f.read() + expr = os.fsencode(expr) + + try: + proc = subprocess.Popen(('/sbin/ldconfig', '-r'), + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL) + except OSError: # E.g. command not found + data = b'' + else: + with proc: + data = proc.stdout.read() + res = re.findall(expr, data) if not res: return _get_soname(_findLib_gcc(name)) res.sort(key=_num_version) - return res[-1] + return os.fsdecode(res[-1]) elif sys.platform == "sunos5": @@ -179,17 +218,27 @@ if not os.path.exists('/usr/bin/crle'): return None + env = dict(os.environ) + env['LC_ALL'] = 'C' + if is64: - cmd = 'env LC_ALL=C /usr/bin/crle -64 2>/dev/null' + args = ('/usr/bin/crle', '-64') else: - cmd = 'env LC_ALL=C /usr/bin/crle 2>/dev/null' + args = ('/usr/bin/crle',) paths = None - with contextlib.closing(os.popen(cmd)) as f: - for line in f.readlines(): + try: + proc = subprocess.Popen(args, + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL, + env=env) + except OSError: # E.g. bad executable + return None + with proc: + for line in proc.stdout: line = line.strip() - if line.startswith('Default Library Path (ELF):'): - paths = line.split()[4] + if line.startswith(b'Default Library Path (ELF):'): + paths = os.fsdecode(line).split()[4] if not paths: return None diff --git a/Lib/curses/ascii.py b/Lib/curses/ascii.py --- a/Lib/curses/ascii.py +++ b/Lib/curses/ascii.py @@ -54,13 +54,13 @@ def isalnum(c): return isalpha(c) or isdigit(c) def isalpha(c): return isupper(c) or islower(c) def isascii(c): return _ctoi(c) <= 127 # ? -def isblank(c): return _ctoi(c) in (8,32) -def iscntrl(c): return _ctoi(c) <= 31 +def isblank(c): return _ctoi(c) in (9, 32) +def iscntrl(c): return _ctoi(c) <= 31 or _ctoi(c) == 127 def isdigit(c): return _ctoi(c) >= 48 and _ctoi(c) <= 57 def isgraph(c): return _ctoi(c) >= 33 and _ctoi(c) <= 126 def islower(c): return _ctoi(c) >= 97 and _ctoi(c) <= 122 def isprint(c): return _ctoi(c) >= 32 and _ctoi(c) <= 126 -def ispunct(c): return _ctoi(c) != 32 and not isalnum(c) +def ispunct(c): return isgraph(c) and not isalnum(c) def isspace(c): return _ctoi(c) in (9, 10, 11, 12, 13, 32) def isupper(c): return _ctoi(c) >= 65 and _ctoi(c) <= 90 def isxdigit(c): return isdigit(c) or \ diff --git a/Lib/distutils/_msvccompiler.py b/Lib/distutils/_msvccompiler.py --- a/Lib/distutils/_msvccompiler.py +++ b/Lib/distutils/_msvccompiler.py @@ -86,11 +86,9 @@ try: out = subprocess.check_output( - '"{}" {} && set'.format(vcvarsall, plat_spec), - shell=True, + 'cmd /u /c "{}" {} && set'.format(vcvarsall, plat_spec), stderr=subprocess.STDOUT, - universal_newlines=True, - ) + ).decode('utf-16le', errors='replace') except subprocess.CalledProcessError as exc: log.error(exc.output) raise DistutilsPlatformError("Error executing {}" diff --git a/Lib/distutils/command/upload.py b/Lib/distutils/command/upload.py --- a/Lib/distutils/command/upload.py +++ b/Lib/distutils/command/upload.py @@ -91,7 +91,7 @@ data = { # action ':action': 'file_upload', - 'protcol_version': '1', + 'protocol_version': '1', # identify release 'name': meta.get_name(), diff --git a/Lib/distutils/tests/test_config.py b/Lib/distutils/tests/test_config.py --- a/Lib/distutils/tests/test_config.py +++ b/Lib/distutils/tests/test_config.py @@ -18,6 +18,7 @@ index-servers = server1 server2 + server3 [server1] username:me @@ -28,6 +29,10 @@ password: secret realm:acme repository:http://another.pypi/ + +[server3] +username:cbiggles +password:yh^%#rest-of-my-password """ PYPIRC_OLD = """\ @@ -47,14 +52,14 @@ """ -class PyPIRCCommandTestCase(support.TempdirManager, +class BasePyPIRCCommandTestCase(support.TempdirManager, support.LoggingSilencer, support.EnvironGuard, unittest.TestCase): def setUp(self): """Patches the environment.""" - super(PyPIRCCommandTestCase, self).setUp() + super(BasePyPIRCCommandTestCase, self).setUp() self.tmp_dir = self.mkdtemp() os.environ['HOME'] = self.tmp_dir self.rc = os.path.join(self.tmp_dir, '.pypirc') @@ -73,7 +78,10 @@ def tearDown(self): """Removes the patch.""" set_threshold(self.old_threshold) - super(PyPIRCCommandTestCase, self).tearDown() + super(BasePyPIRCCommandTestCase, self).tearDown() + + +class PyPIRCCommandTestCase(BasePyPIRCCommandTestCase): def test_server_registration(self): # This test makes sure PyPIRCCommand knows how to: @@ -113,6 +121,20 @@ finally: f.close() + def test_config_interpolation(self): + # using the % character in .pypirc should not raise an error (#20120) + self.write_file(self.rc, PYPIRC) + cmd = self._cmd(self.dist) + cmd.repository = 'server3' + config = cmd._read_pypirc() + + config = list(sorted(config.items())) + waited = [('password', 'yh^%#rest-of-my-password'), ('realm', 'pypi'), + ('repository', 'https://pypi.python.org/pypi'), + ('server', 'server3'), ('username', 'cbiggles')] + self.assertEqual(config, waited) + + def test_suite(): return unittest.makeSuite(PyPIRCCommandTestCase) diff --git a/Lib/distutils/tests/test_msvccompiler.py b/Lib/distutils/tests/test_msvccompiler.py --- a/Lib/distutils/tests/test_msvccompiler.py +++ b/Lib/distutils/tests/test_msvccompiler.py @@ -83,6 +83,24 @@ self.assertFalse(os.path.isfile(os.path.join( tempdir, os.path.basename(dll)))) + def test_get_vc_env_unicode(self): + import distutils._msvccompiler as _msvccompiler + + test_var = '????????????????????????' + test_value = '?????????' + + # Ensure we don't early exit from _get_vc_env + old_distutils_use_sdk = os.environ.pop('DISTUTILS_USE_SDK', None) + os.environ[test_var] = test_value + try: + env = _msvccompiler._get_vc_env('x86') + self.assertIn(test_var.lower(), env) + self.assertEqual(test_value, env[test_var.lower()]) + finally: + os.environ.pop(test_var) + if old_distutils_use_sdk: + os.environ['DISTUTILS_USE_SDK'] = old_distutils_use_sdk + def test_suite(): return unittest.makeSuite(msvccompilerTestCase) diff --git a/Lib/distutils/tests/test_register.py b/Lib/distutils/tests/test_register.py --- a/Lib/distutils/tests/test_register.py +++ b/Lib/distutils/tests/test_register.py @@ -12,7 +12,7 @@ from distutils.errors import DistutilsSetupError from distutils.log import INFO -from distutils.tests.test_config import PyPIRCCommandTestCase +from distutils.tests.test_config import BasePyPIRCCommandTestCase try: import docutils @@ -72,7 +72,7 @@ }.get(name.lower(), default) -class RegisterTestCase(PyPIRCCommandTestCase): +class RegisterTestCase(BasePyPIRCCommandTestCase): def setUp(self): super(RegisterTestCase, self).setUp() diff --git a/Lib/distutils/tests/test_sdist.py b/Lib/distutils/tests/test_sdist.py --- a/Lib/distutils/tests/test_sdist.py +++ b/Lib/distutils/tests/test_sdist.py @@ -23,7 +23,7 @@ from distutils.command.sdist import sdist, show_formats from distutils.core import Distribution -from distutils.tests.test_config import PyPIRCCommandTestCase +from distutils.tests.test_config import BasePyPIRCCommandTestCase from distutils.errors import DistutilsOptionError from distutils.spawn import find_executable from distutils.log import WARN @@ -52,7 +52,7 @@ somecode%(sep)sdoc.txt """ -class SDistTestCase(PyPIRCCommandTestCase): +class SDistTestCase(BasePyPIRCCommandTestCase): def setUp(self): # PyPIRCCommandTestCase creates a temp dir already diff --git a/Lib/distutils/tests/test_upload.py b/Lib/distutils/tests/test_upload.py --- a/Lib/distutils/tests/test_upload.py +++ b/Lib/distutils/tests/test_upload.py @@ -12,7 +12,7 @@ from distutils.errors import DistutilsError from distutils.log import ERROR, INFO -from distutils.tests.test_config import PYPIRC, PyPIRCCommandTestCase +from distutils.tests.test_config import PYPIRC, BasePyPIRCCommandTestCase PYPIRC_LONG_PASSWORD = """\ [distutils] @@ -66,7 +66,7 @@ return self.code -class uploadTestCase(PyPIRCCommandTestCase): +class uploadTestCase(BasePyPIRCCommandTestCase): def setUp(self): super(uploadTestCase, self).setUp() @@ -130,13 +130,14 @@ # what did we send ? headers = dict(self.last_open.req.headers) - self.assertEqual(headers['Content-length'], '2161') + self.assertEqual(headers['Content-length'], '2162') content_type = headers['Content-type'] self.assertTrue(content_type.startswith('multipart/form-data')) self.assertEqual(self.last_open.req.get_method(), 'POST') expected_url = 'https://pypi.python.org/pypi' self.assertEqual(self.last_open.req.get_full_url(), expected_url) self.assertTrue(b'xxx' in self.last_open.req.data) + self.assertIn(b'protocol_version', self.last_open.req.data) # The PyPI response body was echoed results = self.get_logs(INFO) diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt --- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -1,6 +1,17 @@ +What's New in IDLE 3.5.3? +========================= +*Release date: 2017-01-01?* + +- Issue #27365: Allow non-ascii chars in IDLE NEWS.txt, for contributor names. + +- Issue #27245: IDLE: Cleanly delete custom themes and key bindings. + Previously, when IDLE was started from a console or by import, a cascade + of warnings was emitted. Patch by Serhiy Storchaka. + + What's New in IDLE 3.5.2? ========================= -*Release date: 2016-06-30?* +*Release date: 2016-06-26* - Issue #5124: Paste with text selected now replaces the selection on X11. This matches how paste works on Windows, Mac, most modern Linux apps, diff --git a/Lib/idlelib/aboutDialog.py b/Lib/idlelib/aboutDialog.py --- a/Lib/idlelib/aboutDialog.py +++ b/Lib/idlelib/aboutDialog.py @@ -145,5 +145,7 @@ self.destroy() if __name__ == '__main__': + import unittest + unittest.main('idlelib.idle_test.test_helpabout', verbosity=2, exit=False) from idlelib.idle_test.htest import run run(AboutDialog) diff --git a/Lib/idlelib/configDialog.py b/Lib/idlelib/configDialog.py --- a/Lib/idlelib/configDialog.py +++ b/Lib/idlelib/configDialog.py @@ -751,6 +751,7 @@ if not tkMessageBox.askyesno( 'Delete Key Set', delmsg % keySetName, parent=self): return + self.DeactivateCurrentConfig() #remove key set from config idleConf.userCfg['keys'].remove_section(keySetName) if keySetName in self.changedItems['keys']: @@ -769,7 +770,8 @@ self.keysAreBuiltin.set(idleConf.defaultCfg['main'].Get('Keys', 'default')) self.builtinKeys.set(idleConf.defaultCfg['main'].Get('Keys', 'name')) #user can't back out of these changes, they must be applied now - self.Apply() + self.SaveAllChangedConfigs() + self.ActivateConfigChanges() self.SetKeysType() def DeleteCustomTheme(self): @@ -778,6 +780,7 @@ if not tkMessageBox.askyesno( 'Delete Theme', delmsg % themeName, parent=self): return + self.DeactivateCurrentConfig() #remove theme from config idleConf.userCfg['highlight'].remove_section(themeName) if themeName in self.changedItems['highlight']: @@ -796,7 +799,8 @@ self.themeIsBuiltin.set(idleConf.defaultCfg['main'].Get('Theme', 'default')) self.builtinTheme.set(idleConf.defaultCfg['main'].Get('Theme', 'name')) #user can't back out of these changes, they must be applied now - self.Apply() + self.SaveAllChangedConfigs() + self.ActivateConfigChanges() self.SetThemeType() def GetColour(self): diff --git a/Lib/idlelib/idle_test/test_help_about.py b/Lib/idlelib/idle_test/test_help_about.py new file mode 100644 --- /dev/null +++ b/Lib/idlelib/idle_test/test_help_about.py @@ -0,0 +1,52 @@ +'''Test idlelib.help_about. + +Coverage: +''' +from idlelib import aboutDialog as help_about +from idlelib import textView as textview +from idlelib.idle_test.mock_idle import Func +from idlelib.idle_test.mock_tk import Mbox +import unittest + +About = help_about.AboutDialog +class Dummy_about_dialog(): + # Dummy class for testing file display functions. + idle_credits = About.ShowIDLECredits + idle_readme = About.ShowIDLEAbout + idle_news = About.ShowIDLENEWS + # Called by the above + display_file_text = About.display_file_text + + +class DisplayFileTest(unittest.TestCase): + "Test that .txt files are found and properly decoded." + dialog = Dummy_about_dialog() + + @classmethod + def setUpClass(cls): + cls.orig_mbox = textview.tkMessageBox + cls.orig_view = textview.view_text + cls.mbox = Mbox() + cls.view = Func() + textview.tkMessageBox = cls.mbox + textview.view_text = cls.view + cls.About = Dummy_about_dialog() + + @classmethod + def tearDownClass(cls): + textview.tkMessageBox = cls.orig_mbox + textview.view_text = cls.orig_view + + def test_file_isplay(self): + for handler in (self.dialog.idle_credits, + self.dialog.idle_readme, + self.dialog.idle_news): + self.mbox.showerror.message = '' + self.view.called = False + handler() + self.assertEqual(self.mbox.showerror.message, '') + self.assertEqual(self.view.called, True) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/Lib/idlelib/textView.py b/Lib/idlelib/textView.py --- a/Lib/idlelib/textView.py +++ b/Lib/idlelib/textView.py @@ -76,6 +76,10 @@ tkMessageBox.showerror(title='File Load Error', message='Unable to load file %r .' % filename, parent=parent) + except UnicodeDecodeError as err: + tkMessageBox.showerror(title='Unicode Decode Error', + message=str(err), + parent=parent) else: return view_text(parent, title, contents, modal) diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -223,6 +223,7 @@ # Python 3.5b1 3330 (PEP 448: Additional Unpacking Generalizations) # Python 3.5b2 3340 (fix dictionary display evaluation order #11205) # Python 3.5b2 3350 (add GET_YIELD_FROM_ITER opcode #24400) +# Python 3.5.2 3351 (fix BUILD_MAP_UNPACK_WITH_CALL opcode #27286) # # MAGIC must change whenever the bytecode emitted by the compiler may no # longer be understood by older implementations of the eval loop (usually @@ -231,7 +232,7 @@ # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3350).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3351).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c _PYCACHE = '__pycache__' diff --git a/Lib/importlib/util.py b/Lib/importlib/util.py --- a/Lib/importlib/util.py +++ b/Lib/importlib/util.py @@ -241,7 +241,7 @@ if id(self) != id(sys.modules[original_name]): msg = ('module object for {!r} substituted in sys.modules ' 'during a lazy load') - raise ValueError(msg.format(original_name)) + raise ValueError(msg.format(original_name)) # Update after loading since that's what would happen in an eager # loading situation. self.__dict__.update(attrs_updated) diff --git a/Lib/lib2to3/tests/test_refactor.py b/Lib/lib2to3/tests/test_refactor.py --- a/Lib/lib2to3/tests/test_refactor.py +++ b/Lib/lib2to3/tests/test_refactor.py @@ -9,6 +9,7 @@ import codecs import operator import io +import re import tempfile import shutil import unittest @@ -226,8 +227,8 @@ actually_write=False) # Testing that it logged this message when write=False was passed is # sufficient to see that it did not bail early after "No changes". - message_regex = r"Not writing changes to .*%s%s" % ( - os.sep, os.path.basename(test_file)) + message_regex = r"Not writing changes to .*%s" % \ + re.escape(os.sep + os.path.basename(test_file)) for message in debug_messages: if "Not writing changes" in message: self.assertRegex(message, message_regex) diff --git a/Lib/pydoc.py b/Lib/pydoc.py --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -28,7 +28,7 @@ Module docs for core modules are assumed to be in - http://docs.python.org/X.Y/library/ + https://docs.python.org/X.Y/library/ This can be overridden by setting the PYTHONDOCS environment variable to a different URL or to a local directory containing the Library @@ -395,6 +395,7 @@ docloc = os.environ.get("PYTHONDOCS", self.PYTHONDOCS) + basedir = os.path.normcase(basedir) if (isinstance(object, type(os)) and (object.__name__ in ('errno', 'exceptions', 'gc', 'imp', 'marshal', 'posix', 'signal', 'sys', @@ -402,7 +403,7 @@ (file.startswith(basedir) and not file.startswith(os.path.join(basedir, 'site-packages')))) and object.__name__ not in ('xml.etree', 'test.pydoc_mod')): - if docloc.startswith("http://"): + if docloc.startswith(("http://", "https://")): docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__.lower()) else: docloc = os.path.join(docloc, object.__name__.lower() + ".html") diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py --- a/Lib/sqlite3/test/dbapi.py +++ b/Lib/sqlite3/test/dbapi.py @@ -122,11 +122,8 @@ def CheckFailedOpen(self): YOU_CANNOT_OPEN_THIS = "/foo/bar/bla/23534/mydb.db" - try: + with self.assertRaises(sqlite.OperationalError): con = sqlite.connect(YOU_CANNOT_OPEN_THIS) - except sqlite.OperationalError: - return - self.fail("should have raised an OperationalError") def CheckClose(self): self.cx.close() @@ -180,6 +177,12 @@ with self.assertRaises(sqlite.OperationalError): cx.execute('insert into test(id) values(1)') + @unittest.skipIf(sqlite.sqlite_version_info >= (3, 3, 1), + 'needs sqlite versions older than 3.3.1') + def CheckSameThreadErrorOnOldVersion(self): + with self.assertRaises(sqlite.NotSupportedError) as cm: + sqlite.connect(':memory:', check_same_thread=False) + self.assertEqual(str(cm.exception), 'shared connections not available') class CursorTests(unittest.TestCase): def setUp(self): @@ -196,22 +199,12 @@ self.cu.execute("delete from test") def CheckExecuteIllegalSql(self): - try: + with self.assertRaises(sqlite.OperationalError): self.cu.execute("select asdf") - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - return - except: - self.fail("raised wrong exception") def CheckExecuteTooMuchSql(self): - try: + with self.assertRaises(sqlite.Warning): self.cu.execute("select 5+4; select 4+5") - self.fail("should have raised a Warning") - except sqlite.Warning: - return - except: - self.fail("raised wrong exception") def CheckExecuteTooMuchSql2(self): self.cu.execute("select 5+4; -- foo bar") @@ -226,13 +219,8 @@ """) def CheckExecuteWrongSqlArg(self): - try: + with self.assertRaises(ValueError): self.cu.execute(42) - self.fail("should have raised a ValueError") - except ValueError: - return - except: - self.fail("raised wrong exception.") def CheckExecuteArgInt(self): self.cu.execute("insert into test(id) values (?)", (42,)) @@ -250,29 +238,25 @@ row = self.cu.fetchone() self.assertEqual(row[0], "Hu\x00go") + def CheckExecuteNonIterable(self): + with self.assertRaises(ValueError) as cm: + self.cu.execute("insert into test(id) values (?)", 42) + self.assertEqual(str(cm.exception), 'parameters are of unsupported type') + def CheckExecuteWrongNoOfArgs1(self): # too many parameters - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("insert into test(id) values (?)", (17, "Egon")) - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckExecuteWrongNoOfArgs2(self): # too little parameters - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("insert into test(id) values (?)") - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckExecuteWrongNoOfArgs3(self): # no parameters, parameters are needed - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("insert into test(id) values (?)") - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckExecuteParamList(self): self.cu.execute("insert into test(name) values ('foo')") @@ -311,27 +295,18 @@ def CheckExecuteDictMappingTooLittleArgs(self): self.cu.execute("insert into test(name) values ('foo')") - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("select name from test where name=:name and id=:id", {"name": "foo"}) - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckExecuteDictMappingNoArgs(self): self.cu.execute("insert into test(name) values ('foo')") - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("select name from test where name=:name") - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckExecuteDictMappingUnnamed(self): self.cu.execute("insert into test(name) values ('foo')") - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.execute("select name from test where name=?", {"name": "foo"}) - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass def CheckClose(self): self.cu.close() @@ -360,8 +335,7 @@ def CheckTotalChanges(self): self.cu.execute("insert into test(name) values ('foo')") self.cu.execute("insert into test(name) values ('foo')") - if self.cx.total_changes < 2: - self.fail("total changes reported wrong value") + self.assertLess(2, self.cx.total_changes, msg='total changes reported wrong value') # Checks for executemany: # Sequences are required by the DB-API, iterators @@ -392,32 +366,16 @@ self.cu.executemany("insert into test(income) values (?)", mygen()) def CheckExecuteManyWrongSqlArg(self): - try: + with self.assertRaises(ValueError): self.cu.executemany(42, [(3,)]) - self.fail("should have raised a ValueError") - except ValueError: - return - except: - self.fail("raised wrong exception.") def CheckExecuteManySelect(self): - try: + with self.assertRaises(sqlite.ProgrammingError): self.cu.executemany("select ?", [(3,)]) - self.fail("should have raised a ProgrammingError") - except sqlite.ProgrammingError: - return - except: - self.fail("raised wrong exception.") def CheckExecuteManyNotIterable(self): - try: + with self.assertRaises(TypeError): self.cu.executemany("insert into test(income) values (?)", 42) - self.fail("should have raised a TypeError") - except TypeError: - return - except Exception as e: - print("raised", e.__class__) - self.fail("raised wrong exception.") def CheckFetchIter(self): # Optional DB-API extension. @@ -494,22 +452,15 @@ self.assertEqual(self.cu.connection, self.cx) def CheckWrongCursorCallable(self): - try: + with self.assertRaises(TypeError): def f(): pass cur = self.cx.cursor(f) - self.fail("should have raised a TypeError") - except TypeError: - return - self.fail("should have raised a ValueError") def CheckCursorWrongClass(self): class Foo: pass foo = Foo() - try: + with self.assertRaises(TypeError): cur = sqlite.Cursor(foo) - self.fail("should have raised a ValueError") - except TypeError: - pass @unittest.skipUnless(threading, 'This test requires threading.') class ThreadTests(unittest.TestCase): @@ -708,22 +659,21 @@ def CheckScriptSyntaxError(self): con = sqlite.connect(":memory:") cur = con.cursor() - raised = False - try: + with self.assertRaises(sqlite.OperationalError): cur.executescript("create table test(x); asdf; create table test2(x)") - except sqlite.OperationalError: - raised = True - self.assertEqual(raised, True, "should have raised an exception") def CheckScriptErrorNormal(self): con = sqlite.connect(":memory:") cur = con.cursor() - raised = False - try: + with self.assertRaises(sqlite.OperationalError): cur.executescript("create table test(sadfsadfdsa); select foo from hurz;") - except sqlite.OperationalError: - raised = True - self.assertEqual(raised, True, "should have raised an exception") + + def CheckCursorExecutescriptAsBytes(self): + con = sqlite.connect(":memory:") + cur = con.cursor() + with self.assertRaises(ValueError) as cm: + cur.executescript(b"create table test(foo); insert into test(foo) values (5);") + self.assertEqual(str(cm.exception), 'script argument must be unicode.') def CheckConnectionExecute(self): con = sqlite.connect(":memory:") @@ -745,68 +695,37 @@ self.assertEqual(result, 5, "Basic test of Connection.executescript") class ClosedConTests(unittest.TestCase): - def setUp(self): - pass - - def tearDown(self): - pass - def CheckClosedConCursor(self): con = sqlite.connect(":memory:") con.close() - try: + with self.assertRaises(sqlite.ProgrammingError): cur = con.cursor() - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedConCommit(self): con = sqlite.connect(":memory:") con.close() - try: + with self.assertRaises(sqlite.ProgrammingError): con.commit() - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedConRollback(self): con = sqlite.connect(":memory:") con.close() - try: + with self.assertRaises(sqlite.ProgrammingError): con.rollback() - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedCurExecute(self): con = sqlite.connect(":memory:") cur = con.cursor() con.close() - try: + with self.assertRaises(sqlite.ProgrammingError): cur.execute("select 4") - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedCreateFunction(self): con = sqlite.connect(":memory:") con.close() def f(x): return 17 - try: + with self.assertRaises(sqlite.ProgrammingError): con.create_function("foo", 1, f) - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedCreateAggregate(self): con = sqlite.connect(":memory:") @@ -818,57 +737,31 @@ pass def finalize(self): return 17 - try: + with self.assertRaises(sqlite.ProgrammingError): con.create_aggregate("foo", 1, Agg) - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedSetAuthorizer(self): con = sqlite.connect(":memory:") con.close() def authorizer(*args): return sqlite.DENY - try: + with self.assertRaises(sqlite.ProgrammingError): con.set_authorizer(authorizer) - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedSetProgressCallback(self): con = sqlite.connect(":memory:") con.close() def progress(): pass - try: + with self.assertRaises(sqlite.ProgrammingError): con.set_progress_handler(progress, 100) - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") def CheckClosedCall(self): con = sqlite.connect(":memory:") con.close() - try: + with self.assertRaises(sqlite.ProgrammingError): con() - self.fail("Should have raised a ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError") class ClosedCurTests(unittest.TestCase): - def setUp(self): - pass - - def tearDown(self): - pass - def CheckClosed(self): con = sqlite.connect(":memory:") cur = con.cursor() @@ -882,15 +775,9 @@ else: params = [] - try: + with self.assertRaises(sqlite.ProgrammingError): method = getattr(cur, method_name) - method(*params) - self.fail("Should have raised a ProgrammingError: method " + method_name) - except sqlite.ProgrammingError: - pass - except: - self.fail("Should have raised a ProgrammingError: " + method_name) def suite(): module_suite = unittest.makeSuite(ModuleTests, "Check") diff --git a/Lib/sqlite3/test/hooks.py b/Lib/sqlite3/test/hooks.py --- a/Lib/sqlite3/test/hooks.py +++ b/Lib/sqlite3/test/hooks.py @@ -25,27 +25,16 @@ import sqlite3 as sqlite class CollationTests(unittest.TestCase): - def setUp(self): - pass - - def tearDown(self): - pass - def CheckCreateCollationNotCallable(self): con = sqlite.connect(":memory:") - try: + with self.assertRaises(TypeError) as cm: con.create_collation("X", 42) - self.fail("should have raised a TypeError") - except TypeError as e: - self.assertEqual(e.args[0], "parameter must be callable") + self.assertEqual(str(cm.exception), 'parameter must be callable') def CheckCreateCollationNotAscii(self): con = sqlite.connect(":memory:") - try: + with self.assertRaises(sqlite.ProgrammingError): con.create_collation("coll?", lambda x, y: (x > y) - (x < y)) - self.fail("should have raised a ProgrammingError") - except sqlite.ProgrammingError as e: - pass @unittest.skipIf(sqlite.sqlite_version_info < (3, 2, 1), 'old SQLite versions crash on this test') @@ -66,15 +55,13 @@ ) order by x collate mycoll """ result = con.execute(sql).fetchall() - if result[0][0] != "c" or result[1][0] != "b" or result[2][0] != "a": - self.fail("the expected order was not returned") + self.assertEqual(result, [('c',), ('b',), ('a',)], + msg='the expected order was not returned') con.create_collation("mycoll", None) - try: + with self.assertRaises(sqlite.OperationalError) as cm: result = con.execute(sql).fetchall() - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0].lower(), "no such collation sequence: mycoll") + self.assertEqual(str(cm.exception), 'no such collation sequence: mycoll') def CheckCollationReturnsLargeInteger(self): def mycoll(x, y): @@ -106,8 +93,8 @@ result = con.execute(""" select x from (select 'a' as x union select 'b' as x) order by x collate mycoll """).fetchall() - if result[0][0] != 'b' or result[1][0] != 'a': - self.fail("wrong collation function is used") + self.assertEqual(result[0][0], 'b') + self.assertEqual(result[1][0], 'a') def CheckDeregisterCollation(self): """ @@ -117,12 +104,9 @@ con = sqlite.connect(":memory:") con.create_collation("mycoll", lambda x, y: (x > y) - (x < y)) con.create_collation("mycoll", None) - try: + with self.assertRaises(sqlite.OperationalError) as cm: con.execute("select 'a' as x union select 'b' as x order by x collate mycoll") - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - if not e.args[0].startswith("no such collation sequence"): - self.fail("wrong OperationalError raised") + self.assertEqual(str(cm.exception), 'no such collation sequence: mycoll') class ProgressTests(unittest.TestCase): def CheckProgressHandlerUsed(self): diff --git a/Lib/sqlite3/test/regression.py b/Lib/sqlite3/test/regression.py --- a/Lib/sqlite3/test/regression.py +++ b/Lib/sqlite3/test/regression.py @@ -84,9 +84,8 @@ cur.execute("select 1 x union select " + str(i)) con.close() + @unittest.skipIf(sqlite.sqlite_version_info < (3, 2, 2), 'needs sqlite 3.2.2 or newer') def CheckOnConflictRollback(self): - if sqlite.sqlite_version_info < (3, 2, 2): - return con = sqlite.connect(":memory:") con.execute("create table foo(x, unique(x) on conflict rollback)") con.execute("insert into foo(x) values (1)") @@ -134,17 +133,11 @@ def CheckErrorMsgDecodeError(self): # When porting the module to Python 3.0, the error message about # decoding errors disappeared. This verifies they're back again. - failure = None - try: + with self.assertRaises(sqlite.OperationalError) as cm: self.con.execute("select 'xxx' || ? || 'yyy' colname", (bytes(bytearray([250])),)).fetchone() - failure = "should have raised an OperationalError with detailed description" - except sqlite.OperationalError as e: - msg = e.args[0] - if not msg.startswith("Could not decode to UTF-8 column 'colname' with text 'xxx"): - failure = "OperationalError did not have expected description text" - if failure: - self.fail(failure) + msg = "Could not decode to UTF-8 column 'colname' with text 'xxx" + self.assertIn(msg, str(cm.exception)) def CheckRegisterAdapter(self): """ @@ -170,14 +163,8 @@ con = sqlite.connect(":memory:") cur = Cursor(con) - try: + with self.assertRaises(sqlite.ProgrammingError): cur.execute("select 4+5").fetchall() - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("should have raised ProgrammingError") - def CheckStrSubclass(self): """ @@ -196,13 +183,8 @@ pass con = Connection(":memory:") - try: + with self.assertRaises(sqlite.ProgrammingError): cur = con.cursor() - self.fail("should have raised ProgrammingError") - except sqlite.ProgrammingError: - pass - except: - self.fail("should have raised ProgrammingError") def CheckCursorRegistration(self): """ @@ -223,13 +205,8 @@ cur.executemany("insert into foo(x) values (?)", [(3,), (4,), (5,)]) cur.execute("select x from foo") con.rollback() - try: + with self.assertRaises(sqlite.InterfaceError): cur.fetchall() - self.fail("should have raised InterfaceError") - except sqlite.InterfaceError: - pass - except: - self.fail("should have raised InterfaceError") def CheckAutoCommit(self): """ diff --git a/Lib/sqlite3/test/transactions.py b/Lib/sqlite3/test/transactions.py --- a/Lib/sqlite3/test/transactions.py +++ b/Lib/sqlite3/test/transactions.py @@ -111,39 +111,25 @@ res = self.cur2.fetchall() self.assertEqual(len(res), 1) + @unittest.skipIf(sqlite.sqlite_version_info < (3, 2, 2), + 'test hangs on sqlite versions older than 3.2.2') def CheckRaiseTimeout(self): - if sqlite.sqlite_version_info < (3, 2, 2): - # This will fail (hang) on earlier versions of sqlite. - # Determine exact version it was fixed. 3.2.1 hangs. - return self.cur1.execute("create table test(i)") self.cur1.execute("insert into test(i) values (5)") - try: + with self.assertRaises(sqlite.OperationalError): self.cur2.execute("insert into test(i) values (5)") - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - pass - except: - self.fail("should have raised an OperationalError") + @unittest.skipIf(sqlite.sqlite_version_info < (3, 2, 2), + 'test hangs on sqlite versions older than 3.2.2') def CheckLocking(self): """ This tests the improved concurrency with pysqlite 2.3.4. You needed to roll back con2 before you could commit con1. """ - if sqlite.sqlite_version_info < (3, 2, 2): - # This will fail (hang) on earlier versions of sqlite. - # Determine exact version it was fixed. 3.2.1 hangs. - return self.cur1.execute("create table test(i)") self.cur1.execute("insert into test(i) values (5)") - try: + with self.assertRaises(sqlite.OperationalError): self.cur2.execute("insert into test(i) values (5)") - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - pass - except: - self.fail("should have raised an OperationalError") # NO self.con2.rollback() HERE!!! self.con1.commit() @@ -159,13 +145,8 @@ cur.execute("select 1 union select 2 union select 3") con.rollback() - try: + with self.assertRaises(sqlite.InterfaceError): cur.fetchall() - self.fail("InterfaceError should have been raised") - except sqlite.InterfaceError as e: - pass - except: - self.fail("InterfaceError should have been raised") class SpecialCommandTests(unittest.TestCase): def setUp(self): diff --git a/Lib/sqlite3/test/types.py b/Lib/sqlite3/test/types.py --- a/Lib/sqlite3/test/types.py +++ b/Lib/sqlite3/test/types.py @@ -185,24 +185,14 @@ def CheckUnsupportedSeq(self): class Bar: pass val = Bar() - try: + with self.assertRaises(sqlite.InterfaceError): self.cur.execute("insert into test(f) values (?)", (val,)) - self.fail("should have raised an InterfaceError") - except sqlite.InterfaceError: - pass - except: - self.fail("should have raised an InterfaceError") def CheckUnsupportedDict(self): class Bar: pass val = Bar() - try: + with self.assertRaises(sqlite.InterfaceError): self.cur.execute("insert into test(f) values (:val)", {"val": val}) - self.fail("should have raised an InterfaceError") - except sqlite.InterfaceError: - pass - except: - self.fail("should have raised an InterfaceError") def CheckBlob(self): # default @@ -350,11 +340,9 @@ ts2 = self.cur.fetchone()[0] self.assertEqual(ts, ts2) + @unittest.skipIf(sqlite.sqlite_version_info < (3, 1), + 'the date functions are available on 3.1 or later') def CheckSqlTimestamp(self): - # The date functions are only available in SQLite version 3.1 or later - if sqlite.sqlite_version_info < (3, 1): - return - # SQLite's current_timestamp uses UTC time, while datetime.datetime.now() uses local time. now = datetime.datetime.now() self.cur.execute("insert into test(ts) values (current_timestamp)") diff --git a/Lib/sqlite3/test/userfunctions.py b/Lib/sqlite3/test/userfunctions.py --- a/Lib/sqlite3/test/userfunctions.py +++ b/Lib/sqlite3/test/userfunctions.py @@ -162,11 +162,8 @@ self.con.close() def CheckFuncErrorOnCreate(self): - try: + with self.assertRaises(sqlite.OperationalError): self.con.create_function("bla", -100, lambda x: 2*x) - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - pass def CheckFuncRefCount(self): def getfunc(): @@ -231,12 +228,10 @@ def CheckFuncException(self): cur = self.con.cursor() - try: + with self.assertRaises(sqlite.OperationalError) as cm: cur.execute("select raiseexception()") cur.fetchone() - self.fail("should have raised OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0], 'user-defined function raised exception') + self.assertEqual(str(cm.exception), 'user-defined function raised exception') def CheckParamString(self): cur = self.con.cursor() @@ -312,55 +307,42 @@ pass def CheckAggrErrorOnCreate(self): - try: + with self.assertRaises(sqlite.OperationalError): self.con.create_function("bla", -100, AggrSum) - self.fail("should have raised an OperationalError") - except sqlite.OperationalError: - pass def CheckAggrNoStep(self): cur = self.con.cursor() - try: + with self.assertRaises(AttributeError) as cm: cur.execute("select nostep(t) from test") - self.fail("should have raised an AttributeError") - except AttributeError as e: - self.assertEqual(e.args[0], "'AggrNoStep' object has no attribute 'step'") + self.assertEqual(str(cm.exception), "'AggrNoStep' object has no attribute 'step'") def CheckAggrNoFinalize(self): cur = self.con.cursor() - try: + with self.assertRaises(sqlite.OperationalError) as cm: cur.execute("select nofinalize(t) from test") val = cur.fetchone()[0] - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0], "user-defined aggregate's 'finalize' method raised error") + self.assertEqual(str(cm.exception), "user-defined aggregate's 'finalize' method raised error") def CheckAggrExceptionInInit(self): cur = self.con.cursor() - try: + with self.assertRaises(sqlite.OperationalError) as cm: cur.execute("select excInit(t) from test") val = cur.fetchone()[0] - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0], "user-defined aggregate's '__init__' method raised error") + self.assertEqual(str(cm.exception), "user-defined aggregate's '__init__' method raised error") def CheckAggrExceptionInStep(self): cur = self.con.cursor() - try: + with self.assertRaises(sqlite.OperationalError) as cm: cur.execute("select excStep(t) from test") val = cur.fetchone()[0] - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0], "user-defined aggregate's 'step' method raised error") + self.assertEqual(str(cm.exception), "user-defined aggregate's 'step' method raised error") def CheckAggrExceptionInFinalize(self): cur = self.con.cursor() - try: + with self.assertRaises(sqlite.OperationalError) as cm: cur.execute("select excFinalize(t) from test") val = cur.fetchone()[0] - self.fail("should have raised an OperationalError") - except sqlite.OperationalError as e: - self.assertEqual(e.args[0], "user-defined aggregate's 'finalize' method raised error") + self.assertEqual(str(cm.exception), "user-defined aggregate's 'finalize' method raised error") def CheckAggrCheckParamStr(self): cur = self.con.cursor() @@ -433,22 +415,14 @@ pass def test_table_access(self): - try: + with self.assertRaises(sqlite.DatabaseError) as cm: self.con.execute("select * from t2") - except sqlite.DatabaseError as e: - if not e.args[0].endswith("prohibited"): - self.fail("wrong exception text: %s" % e.args[0]) - return - self.fail("should have raised an exception due to missing privileges") + self.assertIn('prohibited', str(cm.exception)) def test_column_access(self): - try: + with self.assertRaises(sqlite.DatabaseError) as cm: self.con.execute("select c2 from t1") - except sqlite.DatabaseError as e: - if not e.args[0].endswith("prohibited"): - self.fail("wrong exception text: %s" % e.args[0]) - return - self.fail("should have raised an exception due to missing privileges") + self.assertIn('prohibited', str(cm.exception)) class AuthorizerRaiseExceptionTests(AuthorizerTests): @staticmethod diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -1349,7 +1349,8 @@ 500 <= err.code <= 599) or (isinstance(err, urllib.error.URLError) and (("ConnectionRefusedError" in err.reason) or - ("TimeoutError" in err.reason))) or + ("TimeoutError" in err.reason) or + ("EOFError" in err.reason))) or n in captured_errnos): if not verbose: sys.stderr.write(denied.args[0] + "\n") diff --git a/Lib/test/support/script_helper.py b/Lib/test/support/script_helper.py --- a/Lib/test/support/script_helper.py +++ b/Lib/test/support/script_helper.py @@ -73,6 +73,10 @@ # Need to preserve the original environment, for in-place testing of # shared library builds. env = os.environ.copy() + # set TERM='' unless the TERM environment variable is passed explicitly + # see issues #11390 and #18300 + if 'TERM' not in env_vars: + env['TERM'] = '' # But a special flag that can be set to override -- in this case, the # caller is responsible to pass the full environment. if env_vars.pop('__cleanenv', None): diff --git a/Lib/test/test_asyncio/test_base_events.py b/Lib/test/test_asyncio/test_base_events.py --- a/Lib/test/test_asyncio/test_base_events.py +++ b/Lib/test/test_asyncio/test_base_events.py @@ -1185,14 +1185,14 @@ test_utils.run_briefly(self.loop) # allow transport to close sock.family = socket.AF_INET6 - coro = self.loop.create_connection(asyncio.Protocol, '::2', 80) + coro = self.loop.create_connection(asyncio.Protocol, '::1', 80) t, p = self.loop.run_until_complete(coro) try: - # Without inet_pton we use getaddrinfo, which transforms ('::2', 80) - # to ('::0.0.0.2', 80, 0, 0). The last 0s are flow info, scope id. + # Without inet_pton we use getaddrinfo, which transforms ('::1', 80) + # to ('::1', 80, 0, 0). The last 0s are flow info, scope id. [address] = sock.connect.call_args[0] host, port = address[:2] - self.assertRegex(host, r'::(0\.)*2') + self.assertRegex(host, r'::(0\.)*1') self.assertEqual(port, 80) _, kwargs = m_socket.socket.call_args self.assertEqual(kwargs['family'], m_socket.AF_INET6) 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,13 @@ d = {f(): f(), f(): f()} self.assertEqual(d, {1: 2, 3: 4}) + def test_compile_filename(self): + for filename in ('file.py', b'file.py', + bytearray(b'file.py'), memoryview(b'file.py')): + code = compile('pass', filename, 'exec') + self.assertEqual(code.co_filename, 'file.py') + self.assertRaises(TypeError, compile, 'pass', list(b'file.py'), 'exec') + @support.cpython_only def test_same_filename_used(self): s = """def f(): pass\ndef g(): pass""" diff --git a/Lib/test/test_contextlib.py b/Lib/test/test_contextlib.py --- a/Lib/test/test_contextlib.py +++ b/Lib/test/test_contextlib.py @@ -762,6 +762,40 @@ stack.push(cm) self.assertIs(stack._exit_callbacks[-1], cm) + def test_dont_reraise_RuntimeError(self): + # https://bugs.python.org/issue27122 + class UniqueException(Exception): pass + class UniqueRuntimeError(RuntimeError): pass + + @contextmanager + def second(): + try: + yield 1 + except Exception as exc: + raise UniqueException("new exception") from exc + + @contextmanager + def first(): + try: + yield 1 + except Exception as exc: + raise exc + + # The UniqueRuntimeError should be caught by second()'s exception + # handler which chain raised a new UniqueException. + with self.assertRaises(UniqueException) as err_ctx: + with ExitStack() as es_ctx: + es_ctx.enter_context(second()) + es_ctx.enter_context(first()) + raise UniqueRuntimeError("please no infinite loop.") + + exc = err_ctx.exception + self.assertIsInstance(exc, UniqueException) + self.assertIsInstance(exc.__context__, UniqueRuntimeError) + self.assertIsNone(exc.__context__.__context__) + self.assertIsNone(exc.__context__.__cause__) + self.assertIs(exc.__cause__, exc.__context__) + class TestRedirectStream: diff --git a/Lib/test/test_coroutines.py b/Lib/test/test_coroutines.py --- a/Lib/test/test_coroutines.py +++ b/Lib/test/test_coroutines.py @@ -1423,7 +1423,7 @@ with warnings.catch_warnings(): warnings.simplefilter("error") - # Test that __aiter__ that returns an asyncronous iterator + # Test that __aiter__ that returns an asynchronous iterator # directly does not throw any warnings. run_async(main()) self.assertEqual(I, 111011) diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -10,6 +10,7 @@ # import os +import string import sys import tempfile import unittest @@ -399,6 +400,55 @@ class TestAscii(unittest.TestCase): + def test_controlnames(self): + for name in curses.ascii.controlnames: + self.assertTrue(hasattr(curses.ascii, name), name) + + def test_ctypes(self): + def check(func, expected): + with self.subTest(ch=c, func=func): + self.assertEqual(func(i), expected) + self.assertEqual(func(c), expected) + + for i in range(256): + c = chr(i) + b = bytes([i]) + check(curses.ascii.isalnum, b.isalnum()) + check(curses.ascii.isalpha, b.isalpha()) + check(curses.ascii.isdigit, b.isdigit()) + check(curses.ascii.islower, b.islower()) + check(curses.ascii.isspace, b.isspace()) + check(curses.ascii.isupper, b.isupper()) + + check(curses.ascii.isascii, i < 128) + check(curses.ascii.ismeta, i >= 128) + check(curses.ascii.isctrl, i < 32) + check(curses.ascii.iscntrl, i < 32 or i == 127) + check(curses.ascii.isblank, c in ' \t') + check(curses.ascii.isgraph, 32 < i <= 126) + check(curses.ascii.isprint, 32 <= i <= 126) + check(curses.ascii.ispunct, c in string.punctuation) + check(curses.ascii.isxdigit, c in string.hexdigits) + + def test_ascii(self): + ascii = curses.ascii.ascii + self.assertEqual(ascii('\xc1'), 'A') + self.assertEqual(ascii('A'), 'A') + self.assertEqual(ascii(ord('\xc1')), ord('A')) + + def test_ctrl(self): + ctrl = curses.ascii.ctrl + self.assertEqual(ctrl('J'), '\n') + self.assertEqual(ctrl('\n'), '\n') + self.assertEqual(ctrl('@'), '\0') + self.assertEqual(ctrl(ord('J')), ord('\n')) + + def test_alt(self): + alt = curses.ascii.alt + self.assertEqual(alt('\n'), '\x8a') + self.assertEqual(alt('A'), '\xc1') + self.assertEqual(alt(ord('A')), 0xc1) + def test_unctrl(self): unctrl = curses.ascii.unctrl self.assertEqual(unctrl('a'), 'a') @@ -408,9 +458,13 @@ self.assertEqual(unctrl('\x7f'), '^?') self.assertEqual(unctrl('\n'), '^J') self.assertEqual(unctrl('\0'), '^@') + self.assertEqual(unctrl(ord('A')), 'A') + self.assertEqual(unctrl(ord('\n')), '^J') # Meta-bit characters self.assertEqual(unctrl('\x8a'), '!^J') self.assertEqual(unctrl('\xc1'), '!A') + self.assertEqual(unctrl(ord('\x8a')), '!^J') + self.assertEqual(unctrl(ord('\xc1')), '!A') if __name__ == '__main__': diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -2491,7 +2491,8 @@ Decimal = self.decimal.Decimal class MyDecimal(Decimal): - pass + def __init__(self, _): + self.x = 'y' self.assertTrue(issubclass(MyDecimal, Decimal)) @@ -2499,6 +2500,8 @@ self.assertEqual(type(r), MyDecimal) self.assertEqual(str(r), '0.1000000000000000055511151231257827021181583404541015625') + self.assertEqual(r.x, 'y') + bigint = 12345678901234567890123456789 self.assertEqual(MyDecimal.from_float(bigint), MyDecimal(bigint)) self.assertTrue(MyDecimal.from_float(float('nan')).is_qnan()) diff --git a/Lib/test/test_doctest.py b/Lib/test/test_doctest.py --- a/Lib/test/test_doctest.py +++ b/Lib/test/test_doctest.py @@ -2719,12 +2719,6 @@ >>> def normalize(s): ... return '\n'.join(s.decode().splitlines()) -Note: we also pass TERM='' to all the assert_python calls to avoid a bug -in the readline library that is triggered in these tests because we are -running them in a new python process. See: - - http://lists.gnu.org/archive/html/bug-readline/2013-06/msg00000.html - With those preliminaries out of the way, we'll start with a file with two simple tests and no errors. We'll run both the unadorned doctest command, and the verbose version, and then check the output: @@ -2741,9 +2735,9 @@ ... _ = f.write('\n') ... _ = f.write('And that is it.\n') ... rc1, out1, err1 = script_helper.assert_python_ok( - ... '-m', 'doctest', fn, TERM='') + ... '-m', 'doctest', fn) ... rc2, out2, err2 = script_helper.assert_python_ok( - ... '-m', 'doctest', '-v', fn, TERM='') + ... '-m', 'doctest', '-v', fn) With no arguments and passing tests, we should get no output: @@ -2806,17 +2800,17 @@ ... _ = f.write(' \"\"\"\n') ... import shutil ... rc1, out1, err1 = script_helper.assert_python_failure( - ... '-m', 'doctest', fn, fn2, TERM='') + ... '-m', 'doctest', fn, fn2) ... rc2, out2, err2 = script_helper.assert_python_ok( - ... '-m', 'doctest', '-o', 'ELLIPSIS', fn, TERM='') + ... '-m', 'doctest', '-o', 'ELLIPSIS', fn) ... rc3, out3, err3 = script_helper.assert_python_ok( ... '-m', 'doctest', '-o', 'ELLIPSIS', - ... '-o', 'NORMALIZE_WHITESPACE', fn, fn2, TERM='') + ... '-o', 'NORMALIZE_WHITESPACE', fn, fn2) ... rc4, out4, err4 = script_helper.assert_python_failure( - ... '-m', 'doctest', '-f', fn, fn2, TERM='') + ... '-m', 'doctest', '-f', fn, fn2) ... rc5, out5, err5 = script_helper.assert_python_ok( ... '-m', 'doctest', '-v', '-o', 'ELLIPSIS', - ... '-o', 'NORMALIZE_WHITESPACE', fn, fn2, TERM='') + ... '-o', 'NORMALIZE_WHITESPACE', fn, fn2) Our first test run will show the errors from the first file (doctest stops if a file has errors). Note that doctest test-run error output appears on stdout, @@ -2922,7 +2916,7 @@ Invalid file name: >>> rc, out, err = script_helper.assert_python_failure( - ... '-m', 'doctest', 'nosuchfile', TERM='') + ... '-m', 'doctest', 'nosuchfile') >>> rc, out (1, b'') >>> print(normalize(err)) # doctest: +ELLIPSIS @@ -2933,7 +2927,7 @@ Invalid doctest option: >>> rc, out, err = script_helper.assert_python_failure( - ... '-m', 'doctest', '-o', 'nosuchoption', TERM='') + ... '-m', 'doctest', '-o', 'nosuchoption') >>> rc, out (2, b'') >>> print(normalize(err)) # doctest: +ELLIPSIS diff --git a/Lib/test/test_extcall.py b/Lib/test/test_extcall.py --- a/Lib/test/test_extcall.py +++ b/Lib/test/test_extcall.py @@ -57,6 +57,10 @@ Traceback (most recent call last): ... TypeError: f() got multiple values for keyword argument 'a' + >>> f(1, 2, a=3, **{'a': 4}, **{'a': 5}) + Traceback (most recent call last): + ... + TypeError: f() got multiple values for keyword argument 'a' >>> f(1, 2, 3, *[4, 5], **{'a':6, 'b':7}) (1, 2, 3, 4, 5) {'a': 6, 'b': 7} >>> f(1, 2, 3, x=4, y=5, *(6, 7), **{'a':8, 'b': 9}) diff --git a/Lib/test/test_functools.py b/Lib/test/test_functools.py --- a/Lib/test/test_functools.py +++ b/Lib/test/test_functools.py @@ -217,6 +217,33 @@ ['{}({!r}, {}, {})'.format(name, capture, args_repr, kwargs_repr) for kwargs_repr in kwargs_reprs]) + def test_recursive_repr(self): + if self.partial is c_functools.partial: + name = 'functools.partial' + else: + name = self.partial.__name__ + + f = self.partial(capture) + f.__setstate__((f, (), {}, {})) + try: + self.assertEqual(repr(f), '%s(%s(...))' % (name, name)) + finally: + f.__setstate__((capture, (), {}, {})) + + f = self.partial(capture) + f.__setstate__((capture, (f,), {}, {})) + try: + self.assertEqual(repr(f), '%s(%r, %s(...))' % (name, capture, name)) + finally: + f.__setstate__((capture, (), {}, {})) + + f = self.partial(capture) + f.__setstate__((capture, (), {'a': f}, {})) + try: + self.assertEqual(repr(f), '%s(%r, a=%s(...))' % (name, capture, name)) + finally: + f.__setstate__((capture, (), {}, {})) + def test_pickle(self): f = self.partial(signature, ['asdf'], bar=[True]) f.attr = [] @@ -297,6 +324,40 @@ self.assertEqual(r, ((1, 2), {})) self.assertIs(type(r[0]), tuple) + def test_recursive_pickle(self): + f = self.partial(capture) + f.__setstate__((f, (), {}, {})) + try: + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + with self.assertRaises(RecursionError): + pickle.dumps(f, proto) + finally: + f.__setstate__((capture, (), {}, {})) + + f = self.partial(capture) + f.__setstate__((capture, (f,), {}, {})) + try: + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + f_copy = pickle.loads(pickle.dumps(f, proto)) + try: + self.assertIs(f_copy.args[0], f_copy) + finally: + f_copy.__setstate__((capture, (), {}, {})) + finally: + f.__setstate__((capture, (), {}, {})) + + f = self.partial(capture) + f.__setstate__((capture, (), {'a': f}, {})) + try: + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + f_copy = pickle.loads(pickle.dumps(f, proto)) + try: + self.assertIs(f_copy.keywords['a'], f_copy) + finally: + f_copy.__setstate__((capture, (), {}, {})) + finally: + f.__setstate__((capture, (), {}, {})) + # Issue 6083: Reference counting bug def test_setstate_refcount(self): class BadSequence: diff --git a/Lib/test/test_importlib/test_lazy.py b/Lib/test/test_importlib/test_lazy.py --- a/Lib/test/test_importlib/test_lazy.py +++ b/Lib/test/test_importlib/test_lazy.py @@ -1,6 +1,8 @@ import importlib from importlib import abc from importlib import util +import sys +import types import unittest from . import util as test_util @@ -122,12 +124,20 @@ self.assertFalse(hasattr(module, '__name__')) def test_module_substitution_error(self): - source_code = 'import sys; sys.modules[__name__] = 42' - module = self.new_module(source_code) with test_util.uncache(TestingImporter.module_name): - with self.assertRaises(ValueError): + fresh_module = types.ModuleType(TestingImporter.module_name) + sys.modules[TestingImporter.module_name] = fresh_module + module = self.new_module() + with self.assertRaisesRegex(ValueError, "substituted"): module.__name__ + def test_module_already_in_sys(self): + with test_util.uncache(TestingImporter.module_name): + module = self.new_module() + sys.modules[TestingImporter.module_name] = module + # Force the load; just care that no exception is raised. + module.__name__ + if __name__ == '__main__': unittest.main() 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 @@ -627,6 +627,22 @@ code2 = parser.compilest(st) self.assertEqual(eval(code2), -3) + def test_compile_filename(self): + st = parser.expr('a + 5') + code = parser.compilest(st) + self.assertEqual(code.co_filename, '') + code = st.compile() + self.assertEqual(code.co_filename, '') + for filename in ('file.py', b'file.py', + bytearray(b'file.py'), memoryview(b'file.py')): + code = parser.compilest(st, filename) + self.assertEqual(code.co_filename, 'file.py') + code = st.compile(filename) + self.assertEqual(code.co_filename, 'file.py') + self.assertRaises(TypeError, parser.compilest, st, list(b'file.py')) + self.assertRaises(TypeError, st.compile, list(b'file.py')) + + class ParserStackLimitTestCase(unittest.TestCase): """try to push the parser to/over its limits. see http://bugs.python.org/issue1881 for a discussion diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -356,7 +356,7 @@ def get_pydoc_link(module): "Returns a documentation web link of a module" dirname = os.path.dirname - basedir = os.path.join(dirname(dirname(__file__))) + basedir = dirname(dirname(__file__)) doc = pydoc.TextDoc() loc = doc.getdocloc(module, basedir=basedir) return loc diff --git a/Lib/test/test_readline.py b/Lib/test/test_readline.py --- a/Lib/test/test_readline.py +++ b/Lib/test/test_readline.py @@ -1,15 +1,25 @@ """ Very minimal unittests for parts of the readline module. """ +from contextlib import ExitStack +from errno import EIO import os +import selectors +import subprocess +import sys import tempfile import unittest -from test.support import import_module, unlink +from test.support import import_module, unlink, TESTFN from test.support.script_helper import assert_python_ok # Skip tests if there is no readline module readline = import_module('readline') +is_editline = readline.__doc__ and "libedit" in readline.__doc__ + + at unittest.skipUnless(hasattr(readline, "clear_history"), + "The history update test cannot be run because the " + "clear_history method is not available.") class TestHistoryManipulation (unittest.TestCase): """ These tests were added to check that the libedit emulation on OSX and the @@ -17,9 +27,6 @@ why the tests cover only a small subset of the interface. """ - @unittest.skipUnless(hasattr(readline, "clear_history"), - "The history update test cannot be run because the " - "clear_history method is not available.") def testHistoryUpdates(self): readline.clear_history() @@ -82,11 +89,29 @@ # write_history_file can create the target readline.write_history_file(hfilename) + def test_nonascii_history(self): + readline.clear_history() + try: + readline.add_history("entr??e 1") + except UnicodeEncodeError as err: + self.skipTest("Locale cannot encode test data: " + format(err)) + readline.add_history("entr??e 2") + readline.replace_history_item(1, "entr??e 22") + readline.write_history_file(TESTFN) + self.addCleanup(os.remove, TESTFN) + readline.clear_history() + readline.read_history_file(TESTFN) + if is_editline: + # An add_history() call seems to be required for get_history_ + # item() to register items from the file + readline.add_history("dummy") + self.assertEqual(readline.get_history_item(1), "entr??e 1") + self.assertEqual(readline.get_history_item(2), "entr??e 22") + class TestReadline(unittest.TestCase): - @unittest.skipIf(readline._READLINE_VERSION < 0x0600 - and "libedit" not in readline.__doc__, + @unittest.skipIf(readline._READLINE_VERSION < 0x0600 and not is_editline, "not supported in this library version") def test_init(self): # Issue #19884: Ensure that the ANSI sequence "\033[1034h" is not @@ -96,6 +121,130 @@ TERM='xterm-256color') self.assertEqual(stdout, b'') + def test_nonascii(self): + try: + readline.add_history("\xEB\xEF") + except UnicodeEncodeError as err: + self.skipTest("Locale cannot encode test data: " + format(err)) + + script = r"""import readline + +is_editline = readline.__doc__ and "libedit" in readline.__doc__ +inserted = "[\xEFnserted]" +macro = "|t\xEB[after]" +set_pre_input_hook = getattr(readline, "set_pre_input_hook", None) +if is_editline or not set_pre_input_hook: + # The insert_line() call via pre_input_hook() does nothing with Editline, + # so include the extra text that would have been inserted here + macro = inserted + macro + +if is_editline: + readline.parse_and_bind(r'bind ^B ed-prev-char') + readline.parse_and_bind(r'bind "\t" rl_complete') + readline.parse_and_bind(r'bind -s ^A "{}"'.format(macro)) +else: + readline.parse_and_bind(r'Control-b: backward-char') + readline.parse_and_bind(r'"\t": complete') + readline.parse_and_bind(r'set disable-completion off') + readline.parse_and_bind(r'set show-all-if-ambiguous off') + readline.parse_and_bind(r'set show-all-if-unmodified off') + readline.parse_and_bind(r'Control-a: "{}"'.format(macro)) + +def pre_input_hook(): + readline.insert_text(inserted) + readline.redisplay() +if set_pre_input_hook: + set_pre_input_hook(pre_input_hook) + +def completer(text, state): + if text == "t\xEB": + if state == 0: + print("text", ascii(text)) + print("line", ascii(readline.get_line_buffer())) + print("indexes", readline.get_begidx(), readline.get_endidx()) + return "t\xEBnt" + if state == 1: + return "t\xEBxt" + if text == "t\xEBx" and state == 0: + return "t\xEBxt" + return None +readline.set_completer(completer) + +def display(substitution, matches, longest_match_length): + print("substitution", ascii(substitution)) + print("matches", ascii(matches)) +readline.set_completion_display_matches_hook(display) + +print("result", ascii(input())) +print("history", ascii(readline.get_history_item(1))) +""" + + input = b"\x01" # Ctrl-A, expands to "|t\xEB[after]" + input += b"\x02" * len("[after]") # Move cursor back + input += b"\t\t" # Display possible completions + input += b"x\t" # Complete "t\xEBx" -> "t\xEBxt" + input += b"\r" + output = run_pty(script, input) + self.assertIn(b"text 't\\xeb'\r\n", output) + self.assertIn(b"line '[\\xefnserted]|t\\xeb[after]'\r\n", output) + self.assertIn(b"indexes 11 13\r\n", output) + if not is_editline and hasattr(readline, "set_pre_input_hook"): + self.assertIn(b"substitution 't\\xeb'\r\n", output) + self.assertIn(b"matches ['t\\xebnt', 't\\xebxt']\r\n", output) + expected = br"'[\xefnserted]|t\xebxt[after]'" + self.assertIn(b"result " + expected + b"\r\n", output) + self.assertIn(b"history " + expected + b"\r\n", output) + + +def run_pty(script, input=b"dummy input\r"): + pty = import_module('pty') + output = bytearray() + [master, slave] = pty.openpty() + args = (sys.executable, '-c', script) + proc = subprocess.Popen(args, stdin=slave, stdout=slave, stderr=slave) + os.close(slave) + with ExitStack() as cleanup: + cleanup.enter_context(proc) + def terminate(proc): + try: + proc.terminate() + except ProcessLookupError: + # Workaround for Open/Net BSD bug (Issue 16762) + pass + cleanup.callback(terminate, proc) + cleanup.callback(os.close, master) + # Avoid using DefaultSelector and PollSelector. Kqueue() does not + # work with pseudo-terminals on OS X < 10.9 (Issue 20365) and Open + # BSD (Issue 20667). Poll() does not work with OS X 10.6 or 10.4 + # either (Issue 20472). Hopefully the file descriptor is low enough + # to use with select(). + sel = cleanup.enter_context(selectors.SelectSelector()) + sel.register(master, selectors.EVENT_READ | selectors.EVENT_WRITE) + os.set_blocking(master, False) + while True: + for [_, events] in sel.select(): + if events & selectors.EVENT_READ: + try: + chunk = os.read(master, 0x10000) + except OSError as err: + # Linux raises EIO when slave is closed (Issue 5380) + if err.errno != EIO: + raise + chunk = b"" + if not chunk: + return output + output.extend(chunk) + if events & selectors.EVENT_WRITE: + try: + input = input[os.write(master, input):] + except OSError as err: + # Apparently EIO means the slave was closed + if err.errno != EIO: + raise + input = b"" # Stop writing + if not input: + sel.modify(master, selectors.EVENT_READ) + if __name__ == "__main__": unittest.main() 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 @@ -157,6 +157,12 @@ self.fail("no SyntaxError for %r" % (brokencode,)) checkfilename("def f(x): foo)(") # parse-time checkfilename("def f(x): global x") # symtable-build-time + symtable.symtable("pass", b"spam", "exec") + with self.assertRaises(TypeError): + symtable.symtable("pass", bytearray(b"spam"), "exec") + symtable.symtable("pass", memoryview(b"spam"), "exec") + with self.assertRaises(TypeError): + symtable.symtable("pass", list(b"spam"), "exec") def test_eval(self): symbols = symtable.symtable("42", "?", "eval") diff --git a/Lib/test/test_unpack_ex.py b/Lib/test/test_unpack_ex.py --- a/Lib/test/test_unpack_ex.py +++ b/Lib/test/test_unpack_ex.py @@ -248,6 +248,11 @@ ... TypeError: f() got multiple values for keyword argument 'x' + >>> f(x=5, **{'x': 3}, **{'x': 2}) + Traceback (most recent call last): + ... + TypeError: f() got multiple values for keyword argument 'x' + >>> f(**{1: 3}, **{1: 5}) Traceback (most recent call last): ... diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -18,7 +18,7 @@ from itertools import product from test import support -from test.support import TESTFN, findfile, import_fresh_module, gc_collect +from test.support import TESTFN, findfile, import_fresh_module, gc_collect, swap_attr # pyET is the pure-Python implementation. # @@ -1860,6 +1860,12 @@ e.extend([ET.Element('bar')]) self.assertRaises(ValueError, e.remove, X('baz')) + def test_recursive_repr(self): + # Issue #25455 + e = ET.Element('foo') + with swap_attr(e, 'tag', e): + with self.assertRaises(RuntimeError): + repr(e) # Should not crash class MutatingElementPath(str): def __new__(cls, elem, *args): 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 @@ -600,6 +600,19 @@ finally: os.remove(filename) + def testBytesPath(self): + filename = support.TESTFN + ".zip" + self.addCleanup(support.unlink, filename) + with ZipFile(filename, "w") as z: + zinfo = ZipInfo(TESTMOD + ".py", time.localtime(NOW)) + zinfo.compress_type = self.compression + z.writestr(zinfo, test_src) + + zipimport.zipimporter(filename) + zipimport.zipimporter(os.fsencode(filename)) + zipimport.zipimporter(bytearray(os.fsencode(filename))) + zipimport.zipimporter(memoryview(os.fsencode(filename))) + @support.requires_zlib class CompressedZipImportTestCase(UncompressedZipImportTestCase): @@ -620,6 +633,8 @@ def testBadArgs(self): self.assertRaises(TypeError, zipimport.zipimporter, None) self.assertRaises(TypeError, zipimport.zipimporter, TESTMOD, kwd=None) + self.assertRaises(TypeError, zipimport.zipimporter, + list(os.fsencode(TESTMOD))) def testFilenameTooLong(self): self.assertZipFailure('A' * 33000) diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -271,7 +271,7 @@ Return the name of the callback. """ - f = CallWrapper(callback, None, self).__call__ + f = CallWrapper(callback, None, self._root).__call__ cbname = repr(id(f)) try: callback = callback.__func__ @@ -295,14 +295,19 @@ CBNAME is the name of the callback returned from trace_variable or trace. """ self._tk.call("trace", "vdelete", self._name, mode, cbname) - self._tk.deletecommand(cbname) - try: - self._tclCommands.remove(cbname) - except ValueError: - pass + cbname = self._tk.splitlist(cbname)[0] + for m, ca in self.trace_vinfo(): + if self._tk.splitlist(ca)[0] == cbname: + break + else: + self._tk.deletecommand(cbname) + try: + self._tclCommands.remove(cbname) + except ValueError: + pass def trace_vinfo(self): """Return all trace callback information.""" - return [self._tk.split(x) for x in self._tk.splitlist( + return [self._tk.splitlist(x) for x in self._tk.splitlist( self._tk.call("trace", "vinfo", self._name))] def __eq__(self, other): """Comparison for equality (==). diff --git a/Lib/tkinter/test/test_tkinter/test_variables.py b/Lib/tkinter/test/test_tkinter/test_variables.py --- a/Lib/tkinter/test/test_tkinter/test_variables.py +++ b/Lib/tkinter/test/test_tkinter/test_variables.py @@ -1,5 +1,5 @@ import unittest - +import gc from tkinter import (Variable, StringVar, IntVar, DoubleVar, BooleanVar, Tcl, TclError) @@ -87,6 +87,55 @@ v.set("value") self.assertTrue(v.side_effect) + def test_trace(self): + v = Variable(self.root) + vname = str(v) + trace = [] + def read_tracer(*args): + trace.append(('read',) + args) + def write_tracer(*args): + trace.append(('write',) + args) + cb1 = v.trace_variable('r', read_tracer) + cb2 = v.trace_variable('wu', write_tracer) + self.assertEqual(sorted(v.trace_vinfo()), [('r', cb1), ('wu', cb2)]) + self.assertEqual(trace, []) + + v.set('spam') + self.assertEqual(trace, [('write', vname, '', 'w')]) + + trace = [] + v.get() + self.assertEqual(trace, [('read', vname, '', 'r')]) + + trace = [] + info = sorted(v.trace_vinfo()) + v.trace_vdelete('w', cb1) # Wrong mode + self.assertEqual(sorted(v.trace_vinfo()), info) + with self.assertRaises(TclError): + v.trace_vdelete('r', 'spam') # Wrong command name + self.assertEqual(sorted(v.trace_vinfo()), info) + v.trace_vdelete('r', (cb1, 43)) # Wrong arguments + self.assertEqual(sorted(v.trace_vinfo()), info) + v.get() + self.assertEqual(trace, [('read', vname, '', 'r')]) + + trace = [] + v.trace_vdelete('r', cb1) + self.assertEqual(v.trace_vinfo(), [('wu', cb2)]) + v.get() + self.assertEqual(trace, []) + + trace = [] + del write_tracer + gc.collect() + v.set('eggs') + self.assertEqual(trace, [('write', vname, '', 'w')]) + + trace = [] + del v + gc.collect() + self.assertEqual(trace, [('write', vname, '', 'u')]) + class TestStringVar(TestBase): diff --git a/Lib/tkinter/test/test_ttk/test_widgets.py b/Lib/tkinter/test/test_ttk/test_widgets.py --- a/Lib/tkinter/test/test_ttk/test_widgets.py +++ b/Lib/tkinter/test/test_ttk/test_widgets.py @@ -1486,6 +1486,57 @@ value) + def test_selection(self): + # item 'none' doesn't exist + self.assertRaises(tkinter.TclError, self.tv.selection_set, 'none') + self.assertRaises(tkinter.TclError, self.tv.selection_add, 'none') + self.assertRaises(tkinter.TclError, self.tv.selection_remove, 'none') + self.assertRaises(tkinter.TclError, self.tv.selection_toggle, 'none') + + item1 = self.tv.insert('', 'end') + item2 = self.tv.insert('', 'end') + c1 = self.tv.insert(item1, 'end') + c2 = self.tv.insert(item1, 'end') + c3 = self.tv.insert(item1, 'end') + self.assertEqual(self.tv.selection(), ()) + + self.tv.selection_set((c1, item2)) + self.assertEqual(self.tv.selection(), (c1, item2)) + self.tv.selection_set(c2) + self.assertEqual(self.tv.selection(), (c2,)) + + self.tv.selection_add((c1, item2)) + self.assertEqual(self.tv.selection(), (c1, c2, item2)) + self.tv.selection_add(item1) + self.assertEqual(self.tv.selection(), (item1, c1, c2, item2)) + + self.tv.selection_remove((item1, c3)) + self.assertEqual(self.tv.selection(), (c1, c2, item2)) + self.tv.selection_remove(c2) + self.assertEqual(self.tv.selection(), (c1, item2)) + + self.tv.selection_toggle((c1, c3)) + self.assertEqual(self.tv.selection(), (c3, item2)) + self.tv.selection_toggle(item2) + self.assertEqual(self.tv.selection(), (c3,)) + + self.tv.insert('', 'end', id='with spaces') + self.tv.selection_set('with spaces') + self.assertEqual(self.tv.selection(), ('with spaces',)) + + self.tv.insert('', 'end', id='{brace') + self.tv.selection_set('{brace') + self.assertEqual(self.tv.selection(), ('{brace',)) + + self.tv.insert('', 'end', id='unicode\u20ac') + self.tv.selection_set('unicode\u20ac') + self.assertEqual(self.tv.selection(), ('unicode\u20ac',)) + + self.tv.insert('', 'end', id=b'bytes\xe2\x82\xac') + self.tv.selection_set(b'bytes\xe2\x82\xac') + self.assertEqual(self.tv.selection(), ('bytes\xe2\x82\xac',)) + + def test_set(self): self.tv['columns'] = ['A', 'B'] item = self.tv.insert('', 'end', values=['a', 'b']) diff --git a/Lib/tkinter/ttk.py b/Lib/tkinter/ttk.py --- a/Lib/tkinter/ttk.py +++ b/Lib/tkinter/ttk.py @@ -1392,7 +1392,9 @@ def selection(self, selop=None, items=None): """If selop is not specified, returns selected items.""" - return self.tk.call(self._w, "selection", selop, items) + if isinstance(items, (str, bytes)): + items = (items,) + return self.tk.splitlist(self.tk.call(self._w, "selection", selop, items)) def selection_set(self, items): diff --git a/Lib/turtle.py b/Lib/turtle.py --- a/Lib/turtle.py +++ b/Lib/turtle.py @@ -179,7 +179,7 @@ continue try: key, value = line.split("=") - except: + except ValueError: print("Bad line in config-file %s:\n%s" % (filename,line)) continue key = key.strip() @@ -192,7 +192,7 @@ value = float(value) else: value = int(value) - except: + except ValueError: pass # value need not be converted cfgdict[key] = value return cfgdict @@ -220,7 +220,7 @@ try: head, tail = split(__file__) cfg_file2 = join(head, default_cfg) - except: + except Exception: cfg_file2 = "" if isfile(cfg_file2): cfgdict2 = config_dict(cfg_file2) @@ -229,7 +229,7 @@ try: readconfig(_CFG) -except: +except Exception: print ("No configfile read, reason unknown") @@ -653,7 +653,7 @@ x, y = (self.cv.canvasx(event.x)/self.xscale, -self.cv.canvasy(event.y)/self.yscale) fun(x, y) - except: + except Exception: pass self.cv.tag_bind(item, "" % num, eventfun, add) @@ -1158,7 +1158,7 @@ raise TurtleGraphicsError("bad color string: %s" % str(color)) try: r, g, b = color - except: + except (TypeError, ValueError): raise TurtleGraphicsError("bad color arguments: %s" % str(color)) if self._colormode == 1.0: r, g, b = [round(255.0*x) for x in (r, g, b)] @@ -2702,7 +2702,7 @@ return args try: r, g, b = args - except: + except (TypeError, ValueError): raise TurtleGraphicsError("bad color arguments: %s" % str(args)) if self.screen._colormode == 1.0: r, g, b = [round(255.0*x) for x in (r, g, b)] @@ -3865,7 +3865,7 @@ try: # eval(key).im_func.__doc__ = docsdict[key] eval(key).__doc__ = docsdict[key] - except: + except Exception: print("Bad docstring-entry: %s" % key) _LANGUAGE = _CFG["language"] @@ -3875,7 +3875,7 @@ read_docstrings(_LANGUAGE) except ImportError: print("Cannot find docsdict for", _LANGUAGE) -except: +except Exception: print ("Unknown Error when trying to import %s-docstring-dictionary" % _LANGUAGE) diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -1694,6 +1694,7 @@ '__reduce__', '__reduce_ex__', '__getinitargs__', '__getnewargs__', '__getstate__', '__setstate__', '__getformat__', '__setformat__', '__repr__', '__dir__', '__subclasses__', '__format__', + '__getnewargs_ex__', } diff --git a/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py b/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py --- a/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py +++ b/Mac/IDLE/IDLE.app/Contents/Resources/idlemain.py @@ -68,8 +68,6 @@ break # Now it is safe to import idlelib. -from idlelib import macosxSupport -macosxSupport._appbundle = True from idlelib.PyShell import main if __name__ == '__main__': main() diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -1655,6 +1655,7 @@ Cheng Zhang Kai Zhu Tarek Ziad?? +Jelle Zijlstra Gennadiy Zlobin Doug Zongker Peter ??strand diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -2,8 +2,8 @@ Python News +++++++++++ -What's New in Python 3.5.3rc1? -============================== +What's New in Python 3.5.3 release candidate 1? +=============================================== Release date: TBA @@ -13,6 +13,65 @@ Library ------- +- Issue #22115: Fixed tracing Tkinter variables: trace_vdelete() with wrong + mode no longer break tracing, trace_vinfo() now always returns a list of + pairs of strings, tracing in the "u" mode now works. + +- Fix a scoping issue in importlib.util.LazyLoader which triggered an + UnboundLocalError when lazy-loading a module that was already put into + sys.modules. + +- Issue #27079: Fixed curses.ascii functions isblank(), iscntrl() and ispunct(). + +- Issue #26754: Some functions (compile() etc) accepted a filename argument + encoded as an iterable of integers. Now only strings and byte-like objects + are accepted. + +- Issue #27048: Prevents distutils failing on Windows when environment + variables contain non-ASCII characters + +- Issue #27330: Fixed possible leaks in the ctypes module. + +- Issue #27238: Got rid of bare excepts in the turtle module. Original patch + by Jelle Zijlstra. + +- Issue #27122: When an exception is raised within the context being managed + by a contextlib.ExitStack() and one of the exit stack generators + catches and raises it in a chain, do not re-raise the original exception + when exiting, let the new chained one through. This avoids the PEP 479 + bug described in issue25782. + +- Issue #27278: Fix os.urandom() implementation using getrandom() on Linux. + Truncate size to INT_MAX and loop until we collected enough random bytes, + instead of casting a directly Py_ssize_t to int. + +- Issue #26386: Fixed ttk.TreeView selection operations with item id's + containing spaces. + +- Issue #22636: Avoid shell injection problems with + ctypes.util.find_library(). + +- Issue #16182: Fix various functions in the "readline" module to use the + locale encoding, and fix get_begidx() and get_endidx() to return code point + indexes. + +- Issue #26930: Update Windows builds to use OpenSSL 1.0.2h. + +IDLE +---- + +- Issue #27365: Allow non-ascii chars in IDLE NEWS.txt, for contributor names. + +- Issue #27245: IDLE: Cleanly delete custom themes and key bindings. + Previously, when IDLE was started from a console or by import, a cascade + of warnings was emitted. Patch by Serhiy Storchaka. + +C API +----- + +- Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded as + an iterable of integers. Now only strings and bytes-like objects are accepted. + What's New in Python 3.5.2? =========================== diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c --- a/Modules/_ctypes/_ctypes.c +++ b/Modules/_ctypes/_ctypes.c @@ -1124,7 +1124,7 @@ static PyObject * CharArray_get_value(CDataObject *self) { - int i; + Py_ssize_t i; char *ptr = self->b_ptr; for (i = 0; i < self->b_size; ++i) if (*ptr++ == '\0') @@ -1180,9 +1180,9 @@ static PyObject * WCharArray_get_value(CDataObject *self) { - unsigned int i; + Py_ssize_t i; wchar_t *ptr = (wchar_t *)self->b_ptr; - for (i = 0; i < self->b_size/sizeof(wchar_t); ++i) + for (i = 0; i < self->b_size/(Py_ssize_t)sizeof(wchar_t); ++i) if (*ptr++ == (wchar_t)0) break; return PyUnicode_FromWideChar((wchar_t *)self->b_ptr, i); @@ -1211,7 +1211,7 @@ wstr = PyUnicode_AsUnicodeAndSize(value, &len); if (wstr == NULL) return -1; - if ((unsigned)len > self->b_size/sizeof(wchar_t)) { + if ((size_t)len > self->b_size/sizeof(wchar_t)) { PyErr_SetString(PyExc_ValueError, "string too long"); result = -1; @@ -1252,8 +1252,10 @@ descr = PyDescr_NewMethod(type, meth); if (descr == NULL) return -1; - if (PyDict_SetItemString(dict,meth->ml_name, descr) < 0) + if (PyDict_SetItemString(dict, meth->ml_name, descr) < 0) { + Py_DECREF(descr); return -1; + } Py_DECREF(descr); } return 0; @@ -1268,8 +1270,10 @@ descr = PyDescr_NewMember(type, memb); if (descr == NULL) return -1; - if (PyDict_SetItemString(dict, memb->name, descr) < 0) + if (PyDict_SetItemString(dict, memb->name, descr) < 0) { + Py_DECREF(descr); return -1; + } Py_DECREF(descr); } return 0; @@ -1285,8 +1289,10 @@ descr = PyDescr_NewGetSet(type, gsp); if (descr == NULL) return -1; - if (PyDict_SetItemString(dict, gsp->name, descr) < 0) + if (PyDict_SetItemString(dict, gsp->name, descr) < 0) { + Py_DECREF(descr); return -1; + } Py_DECREF(descr); } return 0; @@ -1778,6 +1784,7 @@ newname = PyUnicode_Concat(name, suffix); if (newname == NULL) { + Py_DECREF(swapped_args); return NULL; } @@ -1797,8 +1804,10 @@ stgdict = (StgDictObject *)PyObject_CallObject( (PyObject *)&PyCStgDict_Type, NULL); - if (!stgdict) /* XXX leaks result! */ + if (!stgdict) { + Py_DECREF(result); return NULL; + } stgdict->ffi_type_pointer = *fmt->pffi_type; stgdict->align = fmt->pffi_type->alignment; @@ -1978,8 +1987,10 @@ PyObject *meth; int x; meth = PyDescr_NewClassMethod(result, ml); - if (!meth) + if (!meth) { + Py_DECREF(result); return NULL; + } x = PyDict_SetItemString(result->tp_dict, ml->ml_name, meth); @@ -2159,8 +2170,10 @@ nArgs = PyTuple_GET_SIZE(ob); converters = PyTuple_New(nArgs); - if (!converters) + if (!converters) { + Py_DECREF(ob); return NULL; + } /* I have to check if this is correct. Using c_char, which has a size of 1, will be assumed to be pushed as only one byte! @@ -4052,14 +4065,9 @@ } val = PyTuple_GET_ITEM(args, i + index); if (kwds && PyDict_GetItem(kwds, name)) { - char *field = PyBytes_AsString(name); - if (field == NULL) { - PyErr_Clear(); - field = "???"; - } PyErr_Format(PyExc_TypeError, - "duplicate values for field '%s'", - field); + "duplicate values for field %R", + name); Py_DECREF(pair); Py_DECREF(name); return -1; diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -157,8 +157,10 @@ return NULL; memset(space, 0, sizeof(int) * 2); errobj = PyCapsule_New(space, CTYPES_CAPSULE_NAME_PYMEM, pymem_destructor); - if (errobj == NULL) + if (errobj == NULL) { + PyMem_Free(space); return NULL; + } if (-1 == PyDict_SetItem(dict, error_object_name, errobj)) { Py_DECREF(errobj); @@ -1681,6 +1683,10 @@ if (result == NULL) return result; key = PyLong_FromVoidPtr(result); + if (key == NULL) { + Py_DECREF(result); + return NULL; + } } else if (PyType_Check(cls)) { typ = (PyTypeObject *)cls; buf = PyMem_Malloc(strlen(typ->tp_name) + 3 + 1); diff --git a/Modules/_ctypes/cfield.c b/Modules/_ctypes/cfield.c --- a/Modules/_ctypes/cfield.c +++ b/Modules/_ctypes/cfield.c @@ -1246,8 +1246,7 @@ "unicode string expected instead of %s instance", value->ob_type->tp_name); return NULL; - } else - Py_INCREF(value); + } wstr = PyUnicode_AsUnicodeAndSize(value, &size); if (wstr == NULL) @@ -1256,7 +1255,6 @@ PyErr_Format(PyExc_ValueError, "string too long (%zd, maximum length %zd)", size, length); - Py_DECREF(value); return NULL; } else if (size < length-1) /* copy terminating NUL character if there is space */ @@ -1266,6 +1264,7 @@ return NULL; } + Py_INCREF(value); return value; } @@ -1292,9 +1291,7 @@ char *data; Py_ssize_t size; - if(PyBytes_Check(value)) { - Py_INCREF(value); - } else { + if(!PyBytes_Check(value)) { PyErr_Format(PyExc_TypeError, "expected bytes, %s found", value->ob_type->tp_name); @@ -1302,11 +1299,9 @@ } data = PyBytes_AS_STRING(value); - if (!data) - return NULL; size = strlen(data); /* XXX Why not Py_SIZE(value)? */ if (size < length) { - /* This will copy the leading NUL character + /* This will copy the terminating NUL character * if there is space for it. */ ++size; @@ -1314,13 +1309,11 @@ PyErr_Format(PyExc_ValueError, "bytes too long (%zd, maximum length %zd)", size, length); - Py_DECREF(value); return NULL; } /* Also copy the terminating NUL character if there is space */ memcpy((char *)ptr, data, size); - Py_DECREF(value); _RET(value); } @@ -1428,9 +1421,7 @@ /* convert value into a PyUnicodeObject or NULL */ if (Py_None == value) { value = NULL; - } else if (PyUnicode_Check(value)) { - Py_INCREF(value); /* for the descref below */ - } else { + } else if (!PyUnicode_Check(value)) { PyErr_Format(PyExc_TypeError, "unicode string expected instead of %s instance", value->ob_type->tp_name); @@ -1449,7 +1440,6 @@ return NULL; } bstr = SysAllocStringLen(wvalue, (unsigned)wsize); - Py_DECREF(value); } else bstr = NULL; diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c --- a/Modules/_decimal/_decimal.c +++ b/Modules/_decimal/_decimal.c @@ -2630,12 +2630,18 @@ /* class method */ static PyObject * -dec_from_float(PyObject *dec, PyObject *pyfloat) +dec_from_float(PyObject *type, PyObject *pyfloat) { PyObject *context; + PyObject *result; CURRENT_CONTEXT(context); - return PyDecType_FromFloatExact((PyTypeObject *)dec, pyfloat, context); + result = PyDecType_FromFloatExact(&PyDec_Type, pyfloat, context); + if (type != (PyObject *)&PyDec_Type && result != NULL) { + Py_SETREF(result, PyObject_CallFunctionObjArgs(type, result, NULL)); + } + + return result; } /* create_decimal_from_float */ diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -1582,10 +1582,23 @@ static PyObject* element_repr(ElementObject* self) { - if (self->tag) - return PyUnicode_FromFormat("", self->tag, self); - else + int status; + + if (self->tag == NULL) return PyUnicode_FromFormat("", self); + + status = Py_ReprEnter((PyObject *)self); + if (status == 0) { + PyObject *res; + res = PyUnicode_FromFormat("", self->tag, self); + Py_ReprLeave((PyObject *)self); + return res; + } + if (status > 0) + PyErr_Format(PyExc_RuntimeError, + "reentrant call inside %s.__repr__", + Py_TYPE(self)->tp_name); + return NULL; } /*[clinic input] diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c --- a/Modules/_functoolsmodule.c +++ b/Modules/_functoolsmodule.c @@ -203,40 +203,45 @@ static PyObject * partial_repr(partialobject *pto) { - PyObject *result; + PyObject *result = NULL; PyObject *arglist; - PyObject *tmp; Py_ssize_t i, n; PyObject *key, *value; + int status; + + status = Py_ReprEnter((PyObject *)pto); + if (status != 0) { + if (status < 0) + return NULL; + return PyUnicode_FromFormat("%s(...)", Py_TYPE(pto)->tp_name); + } arglist = PyUnicode_FromString(""); - if (arglist == NULL) { - return NULL; - } + if (arglist == NULL) + goto done; /* Pack positional arguments */ assert (PyTuple_Check(pto->args)); n = PyTuple_GET_SIZE(pto->args); for (i = 0; i < n; i++) { - tmp = PyUnicode_FromFormat("%U, %R", arglist, - PyTuple_GET_ITEM(pto->args, i)); - Py_DECREF(arglist); - if (tmp == NULL) - return NULL; - arglist = tmp; + Py_SETREF(arglist, PyUnicode_FromFormat("%U, %R", arglist, + PyTuple_GET_ITEM(pto->args, i))); + if (arglist == NULL) + goto done; } /* Pack keyword arguments */ assert (PyDict_Check(pto->kw)); for (i = 0; PyDict_Next(pto->kw, &i, &key, &value);) { - tmp = PyUnicode_FromFormat("%U, %U=%R", arglist, - key, value); - Py_DECREF(arglist); - if (tmp == NULL) - return NULL; - arglist = tmp; + Py_SETREF(arglist, PyUnicode_FromFormat("%U, %U=%R", arglist, + key, value)); + if (arglist == NULL) + goto done; } result = PyUnicode_FromFormat("%s(%R%U)", Py_TYPE(pto)->tp_name, pto->fn, arglist); Py_DECREF(arglist); + + done: + Py_ReprLeave((PyObject *)pto); return result; } diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c --- a/Modules/_sqlite/connection.c +++ b/Modules/_sqlite/connection.c @@ -164,6 +164,10 @@ #ifdef WITH_THREAD self->thread_ident = PyThread_get_thread_ident(); #endif + if (!check_same_thread && sqlite3_libversion_number() < 3003001) { + PyErr_SetString(pysqlite_NotSupportedError, "shared connections not available"); + return -1; + } self->check_same_thread = check_same_thread; self->function_pinboard = PyDict_New(); diff --git a/Modules/_sqlite/module.h b/Modules/_sqlite/module.h --- a/Modules/_sqlite/module.h +++ b/Modules/_sqlite/module.h @@ -42,7 +42,7 @@ extern PyObject* time_time; extern PyObject* time_sleep; -/* A dictionary, mapping colum types (INTEGER, VARCHAR, etc.) to converter +/* A dictionary, mapping column types (INTEGER, VARCHAR, etc.) to converter * functions, that convert the SQL value to the appropriate Python value. * The key is uppercase. */ diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c --- a/Modules/arraymodule.c +++ b/Modules/arraymodule.c @@ -1268,7 +1268,7 @@ } PyTuple_SET_ITEM(retval, 0, v); - v = PyLong_FromLong((long)(Py_SIZE(self))); + v = PyLong_FromSsize_t(Py_SIZE(self)); if (v == NULL) { Py_DECREF(retval); return NULL; diff --git a/Modules/expat/xmlrole.c b/Modules/expat/xmlrole.c --- a/Modules/expat/xmlrole.c +++ b/Modules/expat/xmlrole.c @@ -2,6 +2,8 @@ See the file COPYING for copying permission. */ +#include + #ifdef COMPILED_FROM_DSP #include "winconfig.h" #elif defined(MACOS_CLASSIC) @@ -16,8 +18,6 @@ #endif #endif /* ndef COMPILED_FROM_DSP */ -#include - #include "expat_external.h" #include "internal.h" #include "xmlrole.h" diff --git a/Modules/expat/xmltok.c b/Modules/expat/xmltok.c --- a/Modules/expat/xmltok.c +++ b/Modules/expat/xmltok.c @@ -2,6 +2,8 @@ See the file COPYING for copying permission. */ +#include + #ifdef COMPILED_FROM_DSP #include "winconfig.h" #elif defined(MACOS_CLASSIC) @@ -16,8 +18,6 @@ #endif #endif /* ndef COMPILED_FROM_DSP */ -#include - #include "expat_external.h" #include "internal.h" #include "xmltok.h" diff --git a/Modules/readline.c b/Modules/readline.c --- a/Modules/readline.c +++ b/Modules/readline.c @@ -128,20 +128,40 @@ #define readlinestate_global ((readlinestate *)PyModule_GetState(PyState_FindModule(&readlinemodule))) +/* Convert to/from multibyte C strings */ + +static PyObject * +encode(PyObject *b) +{ + return PyUnicode_EncodeLocale(b, "surrogateescape"); +} + +static PyObject * +decode(const char *s) +{ + return PyUnicode_DecodeLocale(s, "surrogateescape"); +} + + /* Exported function to send one line to readline's init file parser */ static PyObject * -parse_and_bind(PyObject *self, PyObject *args) +parse_and_bind(PyObject *self, PyObject *string) { - char *s, *copy; - if (!PyArg_ParseTuple(args, "s:parse_and_bind", &s)) + char *copy; + PyObject *encoded = encode(string); + if (encoded == NULL) { return NULL; + } /* Make a copy -- rl_parse_and_bind() modifies its argument */ /* Bernard Herzog */ - copy = PyMem_Malloc(1 + strlen(s)); - if (copy == NULL) + copy = PyMem_Malloc(1 + PyBytes_GET_SIZE(encoded)); + if (copy == NULL) { + Py_DECREF(encoded); return PyErr_NoMemory(); - strcpy(copy, s); + } + strcpy(copy, PyBytes_AS_STRING(encoded)); + Py_DECREF(encoded); rl_parse_and_bind(copy); PyMem_Free(copy); /* Free the copy */ Py_RETURN_NONE; @@ -441,17 +461,18 @@ /* Set the tab-completion word-delimiters that readline uses */ static PyObject * -set_completer_delims(PyObject *self, PyObject *args) +set_completer_delims(PyObject *self, PyObject *string) { char *break_chars; - - if (!PyArg_ParseTuple(args, "s:set_completer_delims", &break_chars)) { + PyObject *encoded = encode(string); + if (encoded == NULL) { return NULL; } /* Keep a reference to the allocated memory in the module state in case some other module modifies rl_completer_word_break_characters (see issue #17289). */ - break_chars = strdup(break_chars); + break_chars = strdup(PyBytes_AS_STRING(encoded)); + Py_DECREF(encoded); if (break_chars) { free(completer_word_break_characters); completer_word_break_characters = break_chars; @@ -531,10 +552,11 @@ py_replace_history(PyObject *self, PyObject *args) { int entry_number; - char *line; + PyObject *line; + PyObject *encoded; HIST_ENTRY *old_entry; - if (!PyArg_ParseTuple(args, "is:replace_history_item", &entry_number, + if (!PyArg_ParseTuple(args, "iU:replace_history_item", &entry_number, &line)) { return NULL; } @@ -543,7 +565,12 @@ "History index cannot be negative"); return NULL; } - old_entry = replace_history_entry(entry_number, line, (void *)NULL); + encoded = encode(line); + if (encoded == NULL) { + return NULL; + } + old_entry = replace_history_entry(entry_number, PyBytes_AS_STRING(encoded), (void *)NULL); + Py_DECREF(encoded); if (!old_entry) { PyErr_Format(PyExc_ValueError, "No history item at position %d", @@ -562,14 +589,14 @@ /* Add a line to the history buffer */ static PyObject * -py_add_history(PyObject *self, PyObject *args) +py_add_history(PyObject *self, PyObject *string) { - char *line; - - if(!PyArg_ParseTuple(args, "s:add_history", &line)) { + PyObject *encoded = encode(string); + if (encoded == NULL) { return NULL; } - add_history(line); + add_history(PyBytes_AS_STRING(encoded)); + Py_DECREF(encoded); Py_RETURN_NONE; } @@ -583,7 +610,7 @@ static PyObject * get_completer_delims(PyObject *self, PyObject *noarg) { - return PyUnicode_FromString(rl_completer_word_break_characters); + return decode(rl_completer_word_break_characters); } PyDoc_STRVAR(doc_get_completer_delims, @@ -673,7 +700,7 @@ } #endif /* __APPLE__ */ if ((hist_ent = history_get(idx))) - return PyUnicode_FromString(hist_ent->line); + return decode(hist_ent->line); else { Py_RETURN_NONE; } @@ -702,7 +729,7 @@ static PyObject * get_line_buffer(PyObject *self, PyObject *noarg) { - return PyUnicode_FromString(rl_line_buffer); + return decode(rl_line_buffer); } PyDoc_STRVAR(doc_get_line_buffer, @@ -730,12 +757,14 @@ /* Exported function to insert text into the line buffer */ static PyObject * -insert_text(PyObject *self, PyObject *args) +insert_text(PyObject *self, PyObject *string) { - char *s; - if (!PyArg_ParseTuple(args, "s:insert_text", &s)) + PyObject *encoded = encode(string); + if (encoded == NULL) { return NULL; - rl_insert_text(s); + } + rl_insert_text(PyBytes_AS_STRING(encoded)); + Py_DECREF(encoded); Py_RETURN_NONE; } @@ -763,9 +792,9 @@ static struct PyMethodDef readline_methods[] = { - {"parse_and_bind", parse_and_bind, METH_VARARGS, doc_parse_and_bind}, + {"parse_and_bind", parse_and_bind, METH_O, doc_parse_and_bind}, {"get_line_buffer", get_line_buffer, METH_NOARGS, doc_get_line_buffer}, - {"insert_text", insert_text, METH_VARARGS, doc_insert_text}, + {"insert_text", insert_text, METH_O, doc_insert_text}, {"redisplay", redisplay, METH_NOARGS, doc_redisplay}, {"read_init_file", read_init_file, METH_VARARGS, doc_read_init_file}, {"read_history_file", read_history_file, @@ -792,8 +821,8 @@ {"get_endidx", get_endidx, METH_NOARGS, doc_get_endidx}, {"set_completer_delims", set_completer_delims, - METH_VARARGS, doc_set_completer_delims}, - {"add_history", py_add_history, METH_VARARGS, doc_add_history}, + METH_O, doc_set_completer_delims}, + {"add_history", py_add_history, METH_O, doc_add_history}, {"remove_history_item", py_remove_history, METH_VARARGS, doc_remove_history}, {"replace_history_item", py_replace_history, METH_VARARGS, doc_replace_history}, {"get_completer_delims", get_completer_delims, @@ -890,7 +919,7 @@ int num_matches, int max_length) { int i; - PyObject *m=NULL, *s=NULL, *r=NULL; + PyObject *sub, *m=NULL, *s=NULL, *r=NULL; #ifdef WITH_THREAD PyGILState_STATE gilstate = PyGILState_Ensure(); #endif @@ -898,16 +927,17 @@ if (m == NULL) goto error; for (i = 0; i < num_matches; i++) { - s = PyUnicode_FromString(matches[i+1]); + s = decode(matches[i+1]); if (s == NULL) goto error; if (PyList_SetItem(m, i, s) == -1) goto error; } + sub = decode(matches[0]); r = PyObject_CallFunction(readlinestate_global->completion_display_matches_hook, - "sOi", matches[0], m, max_length); + "NNi", sub, m, max_length); - Py_DECREF(m); m=NULL; + m=NULL; if (r == NULL || (r != Py_None && PyLong_AsLong(r) == -1 && PyErr_Occurred())) { @@ -955,22 +985,24 @@ { char *result = NULL; if (readlinestate_global->completer != NULL) { - PyObject *r; + PyObject *r = NULL, *t; #ifdef WITH_THREAD PyGILState_STATE gilstate = PyGILState_Ensure(); #endif rl_attempted_completion_over = 1; - r = PyObject_CallFunction(readlinestate_global->completer, "si", text, state); + t = decode(text); + r = PyObject_CallFunction(readlinestate_global->completer, "Ni", t, state); if (r == NULL) goto error; if (r == Py_None) { result = NULL; } else { - char *s = _PyUnicode_AsString(r); - if (s == NULL) + PyObject *encoded = encode(r); + if (encoded == NULL) goto error; - result = strdup(s); + result = strdup(PyBytes_AS_STRING(encoded)); + Py_DECREF(encoded); } Py_DECREF(r); goto done; @@ -994,6 +1026,9 @@ flex_complete(const char *text, int start, int end) { char **result; + char saved; + size_t start_size, end_size; + wchar_t *s; #ifdef WITH_THREAD PyGILState_STATE gilstate = PyGILState_Ensure(); #endif @@ -1003,6 +1038,27 @@ #ifdef HAVE_RL_COMPLETION_SUPPRESS_APPEND rl_completion_suppress_append = 0; #endif + + saved = rl_line_buffer[start]; + rl_line_buffer[start] = 0; + s = Py_DecodeLocale(rl_line_buffer, &start_size); + rl_line_buffer[start] = saved; + if (s == NULL) { + goto done; + } + PyMem_RawFree(s); + saved = rl_line_buffer[end]; + rl_line_buffer[end] = 0; + s = Py_DecodeLocale(rl_line_buffer + start, &end_size); + rl_line_buffer[end] = saved; + if (s == NULL) { + goto done; + } + PyMem_RawFree(s); + start = (int)start_size; + end = start + (int)end_size; + +done: Py_XDECREF(readlinestate_global->begidx); Py_XDECREF(readlinestate_global->endidx); readlinestate_global->begidx = PyLong_FromLong((long) start); diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2109,7 +2109,7 @@ "%s returned NULL without setting an error", where); #ifdef Py_DEBUG - /* Ensure that the bug is catched in debug mode */ + /* Ensure that the bug is caught in debug mode */ Py_FatalError("a function returned NULL without setting an error"); #endif return NULL; @@ -2132,7 +2132,7 @@ where); _PyErr_ChainExceptions(exc, val, tb); #ifdef Py_DEBUG - /* Ensure that the bug is catched in debug mode */ + /* Ensure that the bug is caught in debug mode */ Py_FatalError("a function returned a result with an error set"); #endif return NULL; diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -3666,7 +3666,7 @@ output = arg; Py_INCREF(output); } - else { + else if (PyObject_CheckBuffer(arg)) { arg = PyBytes_FromObject(arg); if (!arg) return 0; @@ -3681,6 +3681,12 @@ return 0; } } + else { + PyErr_Format(PyExc_TypeError, + "path should be string or bytes, not %.200s", + Py_TYPE(arg)->tp_name); + return 0; + } if (PyUnicode_READY(output) == -1) { Py_DECREF(output); return 0; diff --git a/PC/launcher.c b/PC/launcher.c --- a/PC/launcher.c +++ b/PC/launcher.c @@ -1081,7 +1081,7 @@ { 3160, 3180, L"3.2" }, { 3190, 3230, L"3.3" }, { 3250, 3310, L"3.4" }, - { 3320, 3350, L"3.5" }, + { 3320, 3351, L"3.5" }, { 3360, 3361, L"3.6" }, { 0 } }; diff --git a/Python/compile.c b/Python/compile.c --- a/Python/compile.c +++ b/Python/compile.c @@ -1494,6 +1494,9 @@ compiler_visit_kwonlydefaults(struct compiler *c, asdl_seq *kwonlyargs, asdl_seq *kw_defaults) { + /* Return the number of defaults + 1. + Returns 0 on error. + */ int i, default_count = 0; for (i = 0; i < asdl_seq_LEN(kwonlyargs); i++) { arg_ty arg = asdl_seq_GET(kwonlyargs, i); @@ -1501,16 +1504,16 @@ if (default_) { PyObject *mangled = _Py_Mangle(c->u->u_private, arg->arg); if (!mangled) - return -1; + return 0; ADDOP_O(c, LOAD_CONST, mangled, consts); Py_DECREF(mangled); if (!compiler_visit_expr(c, default_)) { - return -1; + return 0; } default_count++; } } - return default_count; + return default_count + 1; } static int @@ -1554,17 +1557,17 @@ expr_ty returns) { /* Push arg annotations and a list of the argument names. Return the # - of items pushed. The expressions are evaluated out-of-order wrt the + of items pushed + 1. The expressions are evaluated out-of-order wrt the source code. - More than 2^16-1 annotations is a SyntaxError. Returns -1 on error. + More than 2^16-1 annotations is a SyntaxError. Returns 0 on error. */ static identifier return_str; PyObject *names; Py_ssize_t len; names = PyList_New(0); if (!names) - return -1; + return 0; if (!compiler_visit_argannotations(c, args->args, names)) goto error; @@ -1614,11 +1617,11 @@ Py_DECREF(names); /* We just checked that len <= 65535, see above */ - return Py_SAFE_DOWNCAST(len, Py_ssize_t, int); + return Py_SAFE_DOWNCAST(len + 1, Py_ssize_t, int); error: Py_DECREF(names); - return -1; + return 0; } static int @@ -1667,13 +1670,14 @@ if (args->kwonlyargs) { int res = compiler_visit_kwonlydefaults(c, args->kwonlyargs, args->kw_defaults); - if (res < 0) + if (res == 0) return 0; - kw_default_count = res; + kw_default_count = res - 1; } num_annotations = compiler_visit_annotations(c, args, returns); - if (num_annotations < 0) + if (num_annotations == 0) return 0; + num_annotations--; assert((num_annotations & 0xFFFF) == num_annotations); if (!compiler_enter_scope(c, name, @@ -1889,8 +1893,8 @@ if (args->kwonlyargs) { int res = compiler_visit_kwonlydefaults(c, args->kwonlyargs, args->kw_defaults); - if (res < 0) return 0; - kw_default_count = res; + if (res == 0) return 0; + kw_default_count = res - 1; } if (!compiler_enter_scope(c, name, COMPILER_SCOPE_LAMBDA, (void *)e, e->lineno)) @@ -2403,7 +2407,7 @@ Py_ssize_t dot = PyUnicode_FindChar(name, '.', 0, PyUnicode_GET_LENGTH(name), 1); if (dot == -2) - return -1; + return 0; if (dot != -1) { /* Consume the base module name to get the first attribute */ Py_ssize_t pos = dot + 1; @@ -2412,12 +2416,12 @@ dot = PyUnicode_FindChar(name, '.', pos, PyUnicode_GET_LENGTH(name), 1); if (dot == -2) - return -1; + return 0; attr = PyUnicode_Substring(name, pos, (dot != -1) ? dot : PyUnicode_GET_LENGTH(name)); if (!attr) - return -1; + return 0; ADDOP_O(c, LOAD_ATTR, attr, names); Py_DECREF(attr); pos = dot + 1; @@ -3262,7 +3266,7 @@ code |= 2; if (nsubkwargs > 1) { /* Pack it all up */ - int function_pos = n + (code & 1) + nkw + 1; + int function_pos = n + (code & 1) + 2 * nkw + 1; ADDOP_I(c, BUILD_MAP_UNPACK_WITH_CALL, nsubkwargs | (function_pos << 8)); } } diff --git a/Python/importlib_external.h b/Python/importlib_external.h --- a/Python/importlib_external.h +++ b/Python/importlib_external.h @@ -259,7 +259,7 @@ 0,0,114,5,0,0,0,218,13,95,119,114,105,116,101,95, 97,116,111,109,105,99,99,0,0,0,115,26,0,0,0,0, 5,24,1,9,1,33,1,3,3,21,1,20,1,20,1,13, - 1,3,1,17,1,13,1,5,1,114,55,0,0,0,105,22, + 1,3,1,17,1,13,1,5,1,114,55,0,0,0,105,23, 13,0,0,233,2,0,0,0,114,13,0,0,0,115,2,0, 0,0,13,10,90,11,95,95,112,121,99,97,99,104,101,95, 95,122,4,111,112,116,45,122,3,46,112,121,122,4,46,112, @@ -369,7 +369,7 @@ 116,97,103,90,15,97,108,109,111,115,116,95,102,105,108,101, 110,97,109,101,114,4,0,0,0,114,4,0,0,0,114,5, 0,0,0,218,17,99,97,99,104,101,95,102,114,111,109,95, - 115,111,117,114,99,101,246,0,0,0,115,46,0,0,0,0, + 115,111,117,114,99,101,247,0,0,0,115,46,0,0,0,0, 18,12,1,9,1,7,1,12,1,6,1,12,1,18,1,18, 1,24,1,12,1,12,1,12,1,36,1,12,1,18,1,9, 2,12,1,12,1,12,1,12,1,21,1,21,1,114,79,0, @@ -448,7 +448,7 @@ 95,108,101,118,101,108,90,13,98,97,115,101,95,102,105,108, 101,110,97,109,101,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,17,115,111,117,114,99,101,95,102,114,111, - 109,95,99,97,99,104,101,34,1,0,0,115,44,0,0,0, + 109,95,99,97,99,104,101,35,1,0,0,115,44,0,0,0, 0,9,18,1,12,1,18,1,18,1,12,1,9,1,15,1, 15,1,12,1,9,1,15,1,12,1,22,1,15,1,9,1, 12,1,22,1,12,1,9,1,12,1,19,1,114,85,0,0, @@ -486,7 +486,7 @@ 115,105,111,110,218,11,115,111,117,114,99,101,95,112,97,116, 104,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, 218,15,95,103,101,116,95,115,111,117,114,99,101,102,105,108, - 101,67,1,0,0,115,20,0,0,0,0,7,18,1,4,1, + 101,68,1,0,0,115,20,0,0,0,0,7,18,1,4,1, 24,1,35,1,4,1,3,1,16,1,19,1,21,1,114,91, 0,0,0,99,1,0,0,0,0,0,0,0,1,0,0,0, 11,0,0,0,67,0,0,0,115,92,0,0,0,124,0,0, @@ -500,7 +500,7 @@ 84,0,0,0,114,79,0,0,0,114,66,0,0,0,114,74, 0,0,0,41,1,218,8,102,105,108,101,110,97,109,101,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,11, - 95,103,101,116,95,99,97,99,104,101,100,86,1,0,0,115, + 95,103,101,116,95,99,97,99,104,101,100,87,1,0,0,115, 16,0,0,0,0,1,21,1,3,1,14,1,13,1,8,1, 21,1,4,2,114,95,0,0,0,99,1,0,0,0,0,0, 0,0,2,0,0,0,11,0,0,0,67,0,0,0,115,60, @@ -515,7 +515,7 @@ 41,3,114,39,0,0,0,114,41,0,0,0,114,40,0,0, 0,41,2,114,35,0,0,0,114,42,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,218,10,95,99, - 97,108,99,95,109,111,100,101,98,1,0,0,115,12,0,0, + 97,108,99,95,109,111,100,101,99,1,0,0,115,12,0,0, 0,0,2,3,1,19,1,13,1,11,3,10,1,114,97,0, 0,0,218,9,118,101,114,98,111,115,105,116,121,114,29,0, 0,0,99,1,0,0,0,1,0,0,0,3,0,0,0,4, @@ -536,7 +536,7 @@ 218,6,115,116,100,101,114,114,41,3,114,75,0,0,0,114, 98,0,0,0,218,4,97,114,103,115,114,4,0,0,0,114, 4,0,0,0,114,5,0,0,0,218,16,95,118,101,114,98, - 111,115,101,95,109,101,115,115,97,103,101,110,1,0,0,115, + 111,115,101,95,109,101,115,115,97,103,101,111,1,0,0,115, 8,0,0,0,0,2,18,1,15,1,10,1,114,105,0,0, 0,99,1,0,0,0,0,0,0,0,3,0,0,0,11,0, 0,0,3,0,0,0,115,84,0,0,0,100,1,0,135,0, @@ -576,7 +576,7 @@ 0,0,90,6,107,119,97,114,103,115,41,1,218,6,109,101, 116,104,111,100,114,4,0,0,0,114,5,0,0,0,218,19, 95,99,104,101,99,107,95,110,97,109,101,95,119,114,97,112, - 112,101,114,126,1,0,0,115,12,0,0,0,0,1,12,1, + 112,101,114,127,1,0,0,115,12,0,0,0,0,1,12,1, 12,1,15,1,6,1,25,1,122,40,95,99,104,101,99,107, 95,110,97,109,101,46,60,108,111,99,97,108,115,62,46,95, 99,104,101,99,107,95,110,97,109,101,95,119,114,97,112,112, @@ -595,7 +595,7 @@ 116,97,116,116,114,218,8,95,95,100,105,99,116,95,95,218, 6,117,112,100,97,116,101,41,3,90,3,110,101,119,90,3, 111,108,100,114,52,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,218,5,95,119,114,97,112,137,1, + 0,0,114,5,0,0,0,218,5,95,119,114,97,112,138,1, 0,0,115,8,0,0,0,0,1,25,1,15,1,29,1,122, 26,95,99,104,101,99,107,95,110,97,109,101,46,60,108,111, 99,97,108,115,62,46,95,119,114,97,112,41,3,218,10,95, @@ -603,7 +603,7 @@ 78,97,109,101,69,114,114,111,114,41,3,114,109,0,0,0, 114,110,0,0,0,114,120,0,0,0,114,4,0,0,0,41, 1,114,109,0,0,0,114,5,0,0,0,218,11,95,99,104, - 101,99,107,95,110,97,109,101,118,1,0,0,115,14,0,0, + 101,99,107,95,110,97,109,101,119,1,0,0,115,14,0,0, 0,0,8,21,7,3,1,13,1,13,2,17,5,13,1,114, 123,0,0,0,99,2,0,0,0,0,0,0,0,5,0,0, 0,4,0,0,0,67,0,0,0,115,84,0,0,0,124,0, @@ -633,7 +633,7 @@ 218,8,112,111,114,116,105,111,110,115,218,3,109,115,103,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,17, 95,102,105,110,100,95,109,111,100,117,108,101,95,115,104,105, - 109,146,1,0,0,115,10,0,0,0,0,10,21,1,24,1, + 109,147,1,0,0,115,10,0,0,0,0,10,21,1,24,1, 6,1,29,1,114,130,0,0,0,99,4,0,0,0,0,0, 0,0,11,0,0,0,19,0,0,0,67,0,0,0,115,240, 1,0,0,105,0,0,125,4,0,124,2,0,100,1,0,107, @@ -718,7 +718,7 @@ 109,101,218,11,115,111,117,114,99,101,95,115,105,122,101,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,25, 95,118,97,108,105,100,97,116,101,95,98,121,116,101,99,111, - 100,101,95,104,101,97,100,101,114,163,1,0,0,115,76,0, + 100,101,95,104,101,97,100,101,114,164,1,0,0,115,76,0, 0,0,0,11,6,1,12,1,13,3,6,1,12,1,10,1, 16,1,16,1,16,1,12,1,18,1,13,1,18,1,18,1, 15,1,13,1,15,1,18,1,15,1,13,1,12,1,12,1, @@ -749,7 +749,7 @@ 114,106,0,0,0,114,89,0,0,0,114,90,0,0,0,218, 4,99,111,100,101,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,17,95,99,111,109,112,105,108,101,95,98, - 121,116,101,99,111,100,101,218,1,0,0,115,16,0,0,0, + 121,116,101,99,111,100,101,219,1,0,0,115,16,0,0,0, 0,2,15,1,15,1,13,1,12,1,16,1,4,2,18,1, 114,147,0,0,0,114,59,0,0,0,99,3,0,0,0,0, 0,0,0,4,0,0,0,3,0,0,0,67,0,0,0,115, @@ -769,7 +769,7 @@ 4,114,146,0,0,0,114,133,0,0,0,114,140,0,0,0, 114,53,0,0,0,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,17,95,99,111,100,101,95,116,111,95,98, - 121,116,101,99,111,100,101,230,1,0,0,115,10,0,0,0, + 121,116,101,99,111,100,101,231,1,0,0,115,10,0,0,0, 0,3,12,1,19,1,19,1,22,1,114,150,0,0,0,99, 1,0,0,0,0,0,0,0,5,0,0,0,4,0,0,0, 67,0,0,0,115,89,0,0,0,100,1,0,100,2,0,108, @@ -798,7 +798,7 @@ 100,105,110,103,90,15,110,101,119,108,105,110,101,95,100,101, 99,111,100,101,114,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,13,100,101,99,111,100,101,95,115,111,117, - 114,99,101,240,1,0,0,115,10,0,0,0,0,5,12,1, + 114,99,101,241,1,0,0,115,10,0,0,0,0,5,12,1, 18,1,15,1,18,1,114,155,0,0,0,114,127,0,0,0, 218,26,115,117,98,109,111,100,117,108,101,95,115,101,97,114, 99,104,95,108,111,99,97,116,105,111,110,115,99,2,0,0, @@ -863,7 +863,7 @@ 159,0,0,0,90,7,100,105,114,110,97,109,101,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,218,23,115,112, 101,99,95,102,114,111,109,95,102,105,108,101,95,108,111,99, - 97,116,105,111,110,1,2,0,0,115,60,0,0,0,0,12, + 97,116,105,111,110,2,2,0,0,115,60,0,0,0,0,12, 12,4,6,1,15,2,3,1,19,1,13,1,5,8,24,1, 9,3,12,1,22,1,21,1,15,1,9,1,5,2,4,3, 12,2,15,1,3,1,19,1,13,1,5,2,6,1,12,2, @@ -903,7 +903,7 @@ 79,67,65,76,95,77,65,67,72,73,78,69,41,2,218,3, 99,108,115,218,3,107,101,121,114,4,0,0,0,114,4,0, 0,0,114,5,0,0,0,218,14,95,111,112,101,110,95,114, - 101,103,105,115,116,114,121,79,2,0,0,115,8,0,0,0, + 101,103,105,115,116,114,121,80,2,0,0,115,8,0,0,0, 0,2,3,1,23,1,13,1,122,36,87,105,110,100,111,119, 115,82,101,103,105,115,116,114,121,70,105,110,100,101,114,46, 95,111,112,101,110,95,114,101,103,105,115,116,114,121,99,2, @@ -930,7 +930,7 @@ 171,0,0,0,90,4,104,107,101,121,218,8,102,105,108,101, 112,97,116,104,114,4,0,0,0,114,4,0,0,0,114,5, 0,0,0,218,16,95,115,101,97,114,99,104,95,114,101,103, - 105,115,116,114,121,86,2,0,0,115,22,0,0,0,0,2, + 105,115,116,114,121,87,2,0,0,115,22,0,0,0,0,2, 9,1,12,2,9,1,15,1,22,1,3,1,18,1,29,1, 13,1,9,1,122,38,87,105,110,100,111,119,115,82,101,103, 105,115,116,114,121,70,105,110,100,101,114,46,95,115,101,97, @@ -954,7 +954,7 @@ 114,35,0,0,0,218,6,116,97,114,103,101,116,114,177,0, 0,0,114,127,0,0,0,114,166,0,0,0,114,164,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 218,9,102,105,110,100,95,115,112,101,99,101,2,0,0,115, + 218,9,102,105,110,100,95,115,112,101,99,102,2,0,0,115, 26,0,0,0,0,2,15,1,12,1,4,1,3,1,14,1, 13,1,9,1,22,1,21,1,9,1,15,1,9,1,122,31, 87,105,110,100,111,119,115,82,101,103,105,115,116,114,121,70, @@ -974,7 +974,7 @@ 0,0,0,41,4,114,170,0,0,0,114,126,0,0,0,114, 35,0,0,0,114,164,0,0,0,114,4,0,0,0,114,4, 0,0,0,114,5,0,0,0,218,11,102,105,110,100,95,109, - 111,100,117,108,101,117,2,0,0,115,8,0,0,0,0,7, + 111,100,117,108,101,118,2,0,0,115,8,0,0,0,0,7, 18,1,12,1,7,2,122,33,87,105,110,100,111,119,115,82, 101,103,105,115,116,114,121,70,105,110,100,101,114,46,102,105, 110,100,95,109,111,100,117,108,101,41,12,114,112,0,0,0, @@ -983,7 +983,7 @@ 99,108,97,115,115,109,101,116,104,111,100,114,172,0,0,0, 114,178,0,0,0,114,181,0,0,0,114,182,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,168,0,0,0,67,2,0,0,115,20,0,0, + 0,0,0,114,168,0,0,0,68,2,0,0,115,20,0,0, 0,12,2,6,3,6,3,6,2,6,2,18,7,18,15,3, 1,21,15,3,1,114,168,0,0,0,99,0,0,0,0,0, 0,0,0,0,0,0,0,2,0,0,0,64,0,0,0,115, @@ -1021,7 +1021,7 @@ 0,0,0,114,94,0,0,0,90,13,102,105,108,101,110,97, 109,101,95,98,97,115,101,90,9,116,97,105,108,95,110,97, 109,101,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,159,0,0,0,136,2,0,0,115,8,0,0,0,0, + 0,114,159,0,0,0,137,2,0,0,115,8,0,0,0,0, 3,25,1,22,1,19,1,122,24,95,76,111,97,100,101,114, 66,97,115,105,99,115,46,105,115,95,112,97,99,107,97,103, 101,99,2,0,0,0,0,0,0,0,2,0,0,0,1,0, @@ -1031,7 +1031,7 @@ 117,108,101,32,99,114,101,97,116,105,111,110,46,78,114,4, 0,0,0,41,2,114,108,0,0,0,114,164,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,13, - 99,114,101,97,116,101,95,109,111,100,117,108,101,144,2,0, + 99,114,101,97,116,101,95,109,111,100,117,108,101,145,2,0, 0,115,0,0,0,0,122,27,95,76,111,97,100,101,114,66, 97,115,105,99,115,46,99,114,101,97,116,101,95,109,111,100, 117,108,101,99,2,0,0,0,0,0,0,0,3,0,0,0, @@ -1053,7 +1053,7 @@ 0,41,3,114,108,0,0,0,218,6,109,111,100,117,108,101, 114,146,0,0,0,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,11,101,120,101,99,95,109,111,100,117,108, - 101,147,2,0,0,115,10,0,0,0,0,2,18,1,12,1, + 101,148,2,0,0,115,10,0,0,0,0,2,18,1,12,1, 9,1,15,1,122,25,95,76,111,97,100,101,114,66,97,115, 105,99,115,46,101,120,101,99,95,109,111,100,117,108,101,99, 2,0,0,0,0,0,0,0,2,0,0,0,3,0,0,0, @@ -1062,14 +1062,14 @@ 0,0,0,218,17,95,108,111,97,100,95,109,111,100,117,108, 101,95,115,104,105,109,41,2,114,108,0,0,0,114,126,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,218,11,108,111,97,100,95,109,111,100,117,108,101,155,2, + 0,218,11,108,111,97,100,95,109,111,100,117,108,101,156,2, 0,0,115,2,0,0,0,0,1,122,25,95,76,111,97,100, 101,114,66,97,115,105,99,115,46,108,111,97,100,95,109,111, 100,117,108,101,78,41,8,114,112,0,0,0,114,111,0,0, 0,114,113,0,0,0,114,114,0,0,0,114,159,0,0,0, 114,186,0,0,0,114,191,0,0,0,114,193,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,184,0,0,0,131,2,0,0,115,10,0,0, + 0,0,0,114,184,0,0,0,132,2,0,0,115,10,0,0, 0,12,3,6,2,12,8,12,3,12,8,114,184,0,0,0, 99,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0, 0,64,0,0,0,115,106,0,0,0,101,0,0,90,1,0, @@ -1097,7 +1097,7 @@ 1,218,7,73,79,69,114,114,111,114,41,2,114,108,0,0, 0,114,35,0,0,0,114,4,0,0,0,114,4,0,0,0, 114,5,0,0,0,218,10,112,97,116,104,95,109,116,105,109, - 101,161,2,0,0,115,2,0,0,0,0,6,122,23,83,111, + 101,162,2,0,0,115,2,0,0,0,0,6,122,23,83,111, 117,114,99,101,76,111,97,100,101,114,46,112,97,116,104,95, 109,116,105,109,101,99,2,0,0,0,0,0,0,0,2,0, 0,0,3,0,0,0,67,0,0,0,115,19,0,0,0,100, @@ -1132,7 +1132,7 @@ 32,32,32,114,133,0,0,0,41,1,114,196,0,0,0,41, 2,114,108,0,0,0,114,35,0,0,0,114,4,0,0,0, 114,4,0,0,0,114,5,0,0,0,218,10,112,97,116,104, - 95,115,116,97,116,115,169,2,0,0,115,2,0,0,0,0, + 95,115,116,97,116,115,170,2,0,0,115,2,0,0,0,0, 11,122,23,83,111,117,114,99,101,76,111,97,100,101,114,46, 112,97,116,104,95,115,116,97,116,115,99,4,0,0,0,0, 0,0,0,4,0,0,0,3,0,0,0,67,0,0,0,115, @@ -1156,7 +1156,7 @@ 90,0,0,0,90,10,99,97,99,104,101,95,112,97,116,104, 114,53,0,0,0,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,15,95,99,97,99,104,101,95,98,121,116, - 101,99,111,100,101,182,2,0,0,115,2,0,0,0,0,8, + 101,99,111,100,101,183,2,0,0,115,2,0,0,0,0,8, 122,28,83,111,117,114,99,101,76,111,97,100,101,114,46,95, 99,97,99,104,101,95,98,121,116,101,99,111,100,101,99,3, 0,0,0,0,0,0,0,3,0,0,0,1,0,0,0,67, @@ -1173,7 +1173,7 @@ 32,32,32,32,32,32,78,114,4,0,0,0,41,3,114,108, 0,0,0,114,35,0,0,0,114,53,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,114,198,0,0, - 0,192,2,0,0,115,0,0,0,0,122,21,83,111,117,114, + 0,193,2,0,0,115,0,0,0,0,122,21,83,111,117,114, 99,101,76,111,97,100,101,114,46,115,101,116,95,100,97,116, 97,99,2,0,0,0,0,0,0,0,5,0,0,0,16,0, 0,0,67,0,0,0,115,105,0,0,0,124,0,0,106,0, @@ -1195,7 +1195,7 @@ 0,0,114,126,0,0,0,114,35,0,0,0,114,153,0,0, 0,218,3,101,120,99,114,4,0,0,0,114,4,0,0,0, 114,5,0,0,0,218,10,103,101,116,95,115,111,117,114,99, - 101,199,2,0,0,115,14,0,0,0,0,2,15,1,3,1, + 101,200,2,0,0,115,14,0,0,0,0,2,15,1,3,1, 19,1,18,1,9,1,31,1,122,23,83,111,117,114,99,101, 76,111,97,100,101,114,46,103,101,116,95,115,111,117,114,99, 101,218,9,95,111,112,116,105,109,105,122,101,114,29,0,0, @@ -1217,7 +1217,7 @@ 101,41,4,114,108,0,0,0,114,53,0,0,0,114,35,0, 0,0,114,203,0,0,0,114,4,0,0,0,114,4,0,0, 0,114,5,0,0,0,218,14,115,111,117,114,99,101,95,116, - 111,95,99,111,100,101,209,2,0,0,115,4,0,0,0,0, + 111,95,99,111,100,101,210,2,0,0,115,4,0,0,0,0, 5,21,1,122,27,83,111,117,114,99,101,76,111,97,100,101, 114,46,115,111,117,114,99,101,95,116,111,95,99,111,100,101, 99,2,0,0,0,0,0,0,0,10,0,0,0,43,0,0, @@ -1278,7 +1278,7 @@ 98,121,116,101,115,95,100,97,116,97,114,153,0,0,0,90, 11,99,111,100,101,95,111,98,106,101,99,116,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,114,187,0,0,0, - 217,2,0,0,115,78,0,0,0,0,7,15,1,6,1,3, + 218,2,0,0,115,78,0,0,0,0,7,15,1,6,1,3, 1,16,1,13,1,11,2,3,1,19,1,13,1,5,2,16, 1,3,1,19,1,13,1,5,2,3,1,9,1,12,1,13, 1,19,1,5,2,9,1,7,1,15,1,6,1,7,1,15, @@ -1290,7 +1290,7 @@ 199,0,0,0,114,198,0,0,0,114,202,0,0,0,114,206, 0,0,0,114,187,0,0,0,114,4,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,114,194,0,0, - 0,159,2,0,0,115,14,0,0,0,12,2,12,8,12,13, + 0,160,2,0,0,115,14,0,0,0,12,2,12,8,12,13, 12,10,12,7,12,10,18,8,114,194,0,0,0,99,0,0, 0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0, 0,0,115,112,0,0,0,101,0,0,90,1,0,100,0,0, @@ -1318,7 +1318,7 @@ 32,32,32,32,32,32,102,105,110,100,101,114,46,78,41,2, 114,106,0,0,0,114,35,0,0,0,41,3,114,108,0,0, 0,114,126,0,0,0,114,35,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,185,0,0,0,18, + 114,4,0,0,0,114,5,0,0,0,114,185,0,0,0,19, 3,0,0,115,4,0,0,0,0,3,9,1,122,19,70,105, 108,101,76,111,97,100,101,114,46,95,95,105,110,105,116,95, 95,99,2,0,0,0,0,0,0,0,2,0,0,0,2,0, @@ -1328,7 +1328,7 @@ 41,2,218,9,95,95,99,108,97,115,115,95,95,114,118,0, 0,0,41,2,114,108,0,0,0,218,5,111,116,104,101,114, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,218, - 6,95,95,101,113,95,95,24,3,0,0,115,4,0,0,0, + 6,95,95,101,113,95,95,25,3,0,0,115,4,0,0,0, 0,1,18,1,122,17,70,105,108,101,76,111,97,100,101,114, 46,95,95,101,113,95,95,99,1,0,0,0,0,0,0,0, 1,0,0,0,3,0,0,0,67,0,0,0,115,26,0,0, @@ -1337,7 +1337,7 @@ 218,4,104,97,115,104,114,106,0,0,0,114,35,0,0,0, 41,1,114,108,0,0,0,114,4,0,0,0,114,4,0,0, 0,114,5,0,0,0,218,8,95,95,104,97,115,104,95,95, - 28,3,0,0,115,2,0,0,0,0,1,122,19,70,105,108, + 29,3,0,0,115,2,0,0,0,0,1,122,19,70,105,108, 101,76,111,97,100,101,114,46,95,95,104,97,115,104,95,95, 99,2,0,0,0,0,0,0,0,2,0,0,0,3,0,0, 0,3,0,0,0,115,22,0,0,0,116,0,0,116,1,0, @@ -1351,7 +1351,7 @@ 32,32,32,32,32,32,32,32,41,3,218,5,115,117,112,101, 114,114,210,0,0,0,114,193,0,0,0,41,2,114,108,0, 0,0,114,126,0,0,0,41,1,114,211,0,0,0,114,4, - 0,0,0,114,5,0,0,0,114,193,0,0,0,31,3,0, + 0,0,0,114,5,0,0,0,114,193,0,0,0,32,3,0, 0,115,2,0,0,0,0,10,122,22,70,105,108,101,76,111, 97,100,101,114,46,108,111,97,100,95,109,111,100,117,108,101, 99,2,0,0,0,0,0,0,0,2,0,0,0,1,0,0, @@ -1362,7 +1362,7 @@ 32,98,121,32,116,104,101,32,102,105,110,100,101,114,46,41, 1,114,35,0,0,0,41,2,114,108,0,0,0,114,126,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,157,0,0,0,43,3,0,0,115,2,0,0,0,0, + 0,114,157,0,0,0,44,3,0,0,115,2,0,0,0,0, 3,122,23,70,105,108,101,76,111,97,100,101,114,46,103,101, 116,95,102,105,108,101,110,97,109,101,99,2,0,0,0,0, 0,0,0,3,0,0,0,9,0,0,0,67,0,0,0,115, @@ -1375,14 +1375,14 @@ 49,0,0,0,114,50,0,0,0,90,4,114,101,97,100,41, 3,114,108,0,0,0,114,35,0,0,0,114,54,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 200,0,0,0,48,3,0,0,115,4,0,0,0,0,2,21, + 200,0,0,0,49,3,0,0,115,4,0,0,0,0,2,21, 1,122,19,70,105,108,101,76,111,97,100,101,114,46,103,101, 116,95,100,97,116,97,41,11,114,112,0,0,0,114,111,0, 0,0,114,113,0,0,0,114,114,0,0,0,114,185,0,0, 0,114,213,0,0,0,114,215,0,0,0,114,123,0,0,0, 114,193,0,0,0,114,157,0,0,0,114,200,0,0,0,114, 4,0,0,0,114,4,0,0,0,41,1,114,211,0,0,0, - 114,5,0,0,0,114,210,0,0,0,13,3,0,0,115,14, + 114,5,0,0,0,114,210,0,0,0,14,3,0,0,115,14, 0,0,0,12,3,6,2,12,6,12,4,12,3,24,12,18, 5,114,210,0,0,0,99,0,0,0,0,0,0,0,0,0, 0,0,0,4,0,0,0,64,0,0,0,115,64,0,0,0, @@ -1405,7 +1405,7 @@ 3,114,39,0,0,0,218,8,115,116,95,109,116,105,109,101, 90,7,115,116,95,115,105,122,101,41,3,114,108,0,0,0, 114,35,0,0,0,114,208,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,197,0,0,0,58,3, + 4,0,0,0,114,5,0,0,0,114,197,0,0,0,59,3, 0,0,115,4,0,0,0,0,2,12,1,122,27,83,111,117, 114,99,101,70,105,108,101,76,111,97,100,101,114,46,112,97, 116,104,95,115,116,97,116,115,99,4,0,0,0,0,0,0, @@ -1416,7 +1416,7 @@ 114,97,0,0,0,114,198,0,0,0,41,5,114,108,0,0, 0,114,90,0,0,0,114,89,0,0,0,114,53,0,0,0, 114,42,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,199,0,0,0,63,3,0,0,115,4,0, + 5,0,0,0,114,199,0,0,0,64,3,0,0,115,4,0, 0,0,0,2,12,1,122,32,83,111,117,114,99,101,70,105, 108,101,76,111,97,100,101,114,46,95,99,97,99,104,101,95, 98,121,116,101,99,111,100,101,114,220,0,0,0,105,182,1, @@ -1454,7 +1454,7 @@ 53,0,0,0,114,220,0,0,0,218,6,112,97,114,101,110, 116,114,94,0,0,0,114,27,0,0,0,114,23,0,0,0, 114,201,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,198,0,0,0,68,3,0,0,115,38,0, + 5,0,0,0,114,198,0,0,0,69,3,0,0,115,38,0, 0,0,0,2,18,1,6,2,22,1,18,1,17,2,19,1, 15,1,3,1,17,1,13,2,7,1,18,3,16,1,27,1, 3,1,16,1,17,1,18,2,122,25,83,111,117,114,99,101, @@ -1463,7 +1463,7 @@ 114,113,0,0,0,114,114,0,0,0,114,197,0,0,0,114, 199,0,0,0,114,198,0,0,0,114,4,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,218,0, - 0,0,54,3,0,0,115,8,0,0,0,12,2,6,2,12, + 0,0,55,3,0,0,115,8,0,0,0,12,2,6,2,12, 5,12,5,114,218,0,0,0,99,0,0,0,0,0,0,0, 0,0,0,0,0,2,0,0,0,64,0,0,0,115,46,0, 0,0,101,0,0,90,1,0,100,0,0,90,2,0,100,1, @@ -1485,7 +1485,7 @@ 114,147,0,0,0,41,5,114,108,0,0,0,114,126,0,0, 0,114,35,0,0,0,114,53,0,0,0,114,209,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 187,0,0,0,101,3,0,0,115,8,0,0,0,0,1,15, + 187,0,0,0,102,3,0,0,115,8,0,0,0,0,1,15, 1,15,1,24,1,122,29,83,111,117,114,99,101,108,101,115, 115,70,105,108,101,76,111,97,100,101,114,46,103,101,116,95, 99,111,100,101,99,2,0,0,0,0,0,0,0,2,0,0, @@ -1495,13 +1495,13 @@ 32,115,111,117,114,99,101,32,99,111,100,101,46,78,114,4, 0,0,0,41,2,114,108,0,0,0,114,126,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,202, - 0,0,0,107,3,0,0,115,2,0,0,0,0,2,122,31, + 0,0,0,108,3,0,0,115,2,0,0,0,0,2,122,31, 83,111,117,114,99,101,108,101,115,115,70,105,108,101,76,111, 97,100,101,114,46,103,101,116,95,115,111,117,114,99,101,78, 41,6,114,112,0,0,0,114,111,0,0,0,114,113,0,0, 0,114,114,0,0,0,114,187,0,0,0,114,202,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,223,0,0,0,97,3,0,0,115,6,0, + 5,0,0,0,114,223,0,0,0,98,3,0,0,115,6,0, 0,0,12,2,6,2,12,6,114,223,0,0,0,99,0,0, 0,0,0,0,0,0,0,0,0,0,3,0,0,0,64,0, 0,0,115,136,0,0,0,101,0,0,90,1,0,100,0,0, @@ -1526,7 +1526,7 @@ 0,100,0,0,83,41,1,78,41,2,114,106,0,0,0,114, 35,0,0,0,41,3,114,108,0,0,0,114,106,0,0,0, 114,35,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,185,0,0,0,124,3,0,0,115,4,0, + 5,0,0,0,114,185,0,0,0,125,3,0,0,115,4,0, 0,0,0,1,9,1,122,28,69,120,116,101,110,115,105,111, 110,70,105,108,101,76,111,97,100,101,114,46,95,95,105,110, 105,116,95,95,99,2,0,0,0,0,0,0,0,2,0,0, @@ -1535,7 +1535,7 @@ 124,0,0,106,1,0,124,1,0,106,1,0,107,2,0,83, 41,1,78,41,2,114,211,0,0,0,114,118,0,0,0,41, 2,114,108,0,0,0,114,212,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,213,0,0,0,128, + 114,4,0,0,0,114,5,0,0,0,114,213,0,0,0,129, 3,0,0,115,4,0,0,0,0,1,18,1,122,26,69,120, 116,101,110,115,105,111,110,70,105,108,101,76,111,97,100,101, 114,46,95,95,101,113,95,95,99,1,0,0,0,0,0,0, @@ -1544,7 +1544,7 @@ 0,124,0,0,106,2,0,131,1,0,65,83,41,1,78,41, 3,114,214,0,0,0,114,106,0,0,0,114,35,0,0,0, 41,1,114,108,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,5,0,0,0,114,215,0,0,0,132,3,0,0,115, + 0,114,5,0,0,0,114,215,0,0,0,133,3,0,0,115, 2,0,0,0,0,1,122,28,69,120,116,101,110,115,105,111, 110,70,105,108,101,76,111,97,100,101,114,46,95,95,104,97, 115,104,95,95,99,2,0,0,0,0,0,0,0,3,0,0, @@ -1562,7 +1562,7 @@ 114,105,0,0,0,114,106,0,0,0,114,35,0,0,0,41, 3,114,108,0,0,0,114,164,0,0,0,114,190,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 186,0,0,0,135,3,0,0,115,10,0,0,0,0,2,6, + 186,0,0,0,136,3,0,0,115,10,0,0,0,0,2,6, 1,15,1,6,1,16,1,122,33,69,120,116,101,110,115,105, 111,110,70,105,108,101,76,111,97,100,101,114,46,99,114,101, 97,116,101,95,109,111,100,117,108,101,99,2,0,0,0,0, @@ -1579,7 +1579,7 @@ 12,101,120,101,99,95,100,121,110,97,109,105,99,114,105,0, 0,0,114,106,0,0,0,114,35,0,0,0,41,2,114,108, 0,0,0,114,190,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,114,191,0,0,0,143,3,0,0, + 0,0,114,5,0,0,0,114,191,0,0,0,144,3,0,0, 115,6,0,0,0,0,2,19,1,6,1,122,31,69,120,116, 101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,114, 46,101,120,101,99,95,109,111,100,117,108,101,99,2,0,0, @@ -1598,7 +1598,7 @@ 78,114,4,0,0,0,41,2,114,22,0,0,0,218,6,115, 117,102,102,105,120,41,1,218,9,102,105,108,101,95,110,97, 109,101,114,4,0,0,0,114,5,0,0,0,250,9,60,103, - 101,110,101,120,112,114,62,152,3,0,0,115,2,0,0,0, + 101,110,101,120,112,114,62,153,3,0,0,115,2,0,0,0, 6,1,122,49,69,120,116,101,110,115,105,111,110,70,105,108, 101,76,111,97,100,101,114,46,105,115,95,112,97,99,107,97, 103,101,46,60,108,111,99,97,108,115,62,46,60,103,101,110, @@ -1606,7 +1606,7 @@ 0,218,3,97,110,121,218,18,69,88,84,69,78,83,73,79, 78,95,83,85,70,70,73,88,69,83,41,2,114,108,0,0, 0,114,126,0,0,0,114,4,0,0,0,41,1,114,226,0, - 0,0,114,5,0,0,0,114,159,0,0,0,149,3,0,0, + 0,0,114,5,0,0,0,114,159,0,0,0,150,3,0,0, 115,6,0,0,0,0,2,19,1,18,1,122,30,69,120,116, 101,110,115,105,111,110,70,105,108,101,76,111,97,100,101,114, 46,105,115,95,112,97,99,107,97,103,101,99,2,0,0,0, @@ -1618,7 +1618,7 @@ 99,111,100,101,32,111,98,106,101,99,116,46,78,114,4,0, 0,0,41,2,114,108,0,0,0,114,126,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,187,0, - 0,0,155,3,0,0,115,2,0,0,0,0,2,122,28,69, + 0,0,156,3,0,0,115,2,0,0,0,0,2,122,28,69, 120,116,101,110,115,105,111,110,70,105,108,101,76,111,97,100, 101,114,46,103,101,116,95,99,111,100,101,99,2,0,0,0, 0,0,0,0,2,0,0,0,1,0,0,0,67,0,0,0, @@ -1628,7 +1628,7 @@ 118,101,32,110,111,32,115,111,117,114,99,101,32,99,111,100, 101,46,78,114,4,0,0,0,41,2,114,108,0,0,0,114, 126,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,202,0,0,0,159,3,0,0,115,2,0,0, + 0,0,0,114,202,0,0,0,160,3,0,0,115,2,0,0, 0,0,2,122,30,69,120,116,101,110,115,105,111,110,70,105, 108,101,76,111,97,100,101,114,46,103,101,116,95,115,111,117, 114,99,101,99,2,0,0,0,0,0,0,0,2,0,0,0, @@ -1639,7 +1639,7 @@ 117,110,100,32,98,121,32,116,104,101,32,102,105,110,100,101, 114,46,41,1,114,35,0,0,0,41,2,114,108,0,0,0, 114,126,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,157,0,0,0,163,3,0,0,115,2,0, + 5,0,0,0,114,157,0,0,0,164,3,0,0,115,2,0, 0,0,0,3,122,32,69,120,116,101,110,115,105,111,110,70, 105,108,101,76,111,97,100,101,114,46,103,101,116,95,102,105, 108,101,110,97,109,101,78,41,14,114,112,0,0,0,114,111, @@ -1648,7 +1648,7 @@ 0,114,191,0,0,0,114,159,0,0,0,114,187,0,0,0, 114,202,0,0,0,114,123,0,0,0,114,157,0,0,0,114, 4,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,224,0,0,0,116,3,0,0,115,20,0,0, + 0,0,0,114,224,0,0,0,117,3,0,0,115,20,0,0, 0,12,6,6,2,12,4,12,4,12,3,12,8,12,6,12, 6,12,4,12,4,114,224,0,0,0,99,0,0,0,0,0, 0,0,0,0,0,0,0,2,0,0,0,64,0,0,0,115, @@ -1692,7 +1692,7 @@ 95,112,97,116,104,95,102,105,110,100,101,114,41,4,114,108, 0,0,0,114,106,0,0,0,114,35,0,0,0,218,11,112, 97,116,104,95,102,105,110,100,101,114,114,4,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,185,0,0,0,176,3, + 4,0,0,0,114,5,0,0,0,114,185,0,0,0,177,3, 0,0,115,8,0,0,0,0,1,9,1,9,1,21,1,122, 23,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46, 95,95,105,110,105,116,95,95,99,1,0,0,0,0,0,0, @@ -1711,7 +1711,7 @@ 41,4,114,108,0,0,0,114,222,0,0,0,218,3,100,111, 116,90,2,109,101,114,4,0,0,0,114,4,0,0,0,114, 5,0,0,0,218,23,95,102,105,110,100,95,112,97,114,101, - 110,116,95,112,97,116,104,95,110,97,109,101,115,182,3,0, + 110,116,95,112,97,116,104,95,110,97,109,101,115,183,3,0, 0,115,8,0,0,0,0,2,27,1,12,2,4,3,122,38, 95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95, 102,105,110,100,95,112,97,114,101,110,116,95,112,97,116,104, @@ -1725,7 +1725,7 @@ 110,116,95,109,111,100,117,108,101,95,110,97,109,101,90,14, 112,97,116,104,95,97,116,116,114,95,110,97,109,101,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,233,0, - 0,0,192,3,0,0,115,4,0,0,0,0,1,18,1,122, + 0,0,193,3,0,0,115,4,0,0,0,0,1,18,1,122, 31,95,78,97,109,101,115,112,97,99,101,80,97,116,104,46, 95,103,101,116,95,112,97,114,101,110,116,95,112,97,116,104, 99,1,0,0,0,0,0,0,0,3,0,0,0,3,0,0, @@ -1743,7 +1743,7 @@ 108,0,0,0,90,11,112,97,114,101,110,116,95,112,97,116, 104,114,164,0,0,0,114,4,0,0,0,114,4,0,0,0, 114,5,0,0,0,218,12,95,114,101,99,97,108,99,117,108, - 97,116,101,196,3,0,0,115,16,0,0,0,0,2,18,1, + 97,116,101,197,3,0,0,115,16,0,0,0,0,2,18,1, 15,1,21,3,27,1,9,1,12,1,9,1,122,27,95,78, 97,109,101,115,112,97,99,101,80,97,116,104,46,95,114,101, 99,97,108,99,117,108,97,116,101,99,1,0,0,0,0,0, @@ -1752,14 +1752,14 @@ 1,0,83,41,1,78,41,2,218,4,105,116,101,114,114,240, 0,0,0,41,1,114,108,0,0,0,114,4,0,0,0,114, 4,0,0,0,114,5,0,0,0,218,8,95,95,105,116,101, - 114,95,95,209,3,0,0,115,2,0,0,0,0,1,122,23, + 114,95,95,210,3,0,0,115,2,0,0,0,0,1,122,23, 95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95, 95,105,116,101,114,95,95,99,1,0,0,0,0,0,0,0, 1,0,0,0,2,0,0,0,67,0,0,0,115,16,0,0, 0,116,0,0,124,0,0,106,1,0,131,0,0,131,1,0, 83,41,1,78,41,2,114,31,0,0,0,114,240,0,0,0, 41,1,114,108,0,0,0,114,4,0,0,0,114,4,0,0, - 0,114,5,0,0,0,218,7,95,95,108,101,110,95,95,212, + 0,114,5,0,0,0,218,7,95,95,108,101,110,95,95,213, 3,0,0,115,2,0,0,0,0,1,122,22,95,78,97,109, 101,115,112,97,99,101,80,97,116,104,46,95,95,108,101,110, 95,95,99,1,0,0,0,0,0,0,0,1,0,0,0,2, @@ -1769,7 +1769,7 @@ 123,33,114,125,41,41,2,114,47,0,0,0,114,232,0,0, 0,41,1,114,108,0,0,0,114,4,0,0,0,114,4,0, 0,0,114,5,0,0,0,218,8,95,95,114,101,112,114,95, - 95,215,3,0,0,115,2,0,0,0,0,1,122,23,95,78, + 95,216,3,0,0,115,2,0,0,0,0,1,122,23,95,78, 97,109,101,115,112,97,99,101,80,97,116,104,46,95,95,114, 101,112,114,95,95,99,2,0,0,0,0,0,0,0,2,0, 0,0,2,0,0,0,67,0,0,0,115,16,0,0,0,124, @@ -1777,7 +1777,7 @@ 1,78,41,1,114,240,0,0,0,41,2,114,108,0,0,0, 218,4,105,116,101,109,114,4,0,0,0,114,4,0,0,0, 114,5,0,0,0,218,12,95,95,99,111,110,116,97,105,110, - 115,95,95,218,3,0,0,115,2,0,0,0,0,1,122,27, + 115,95,95,219,3,0,0,115,2,0,0,0,0,1,122,27, 95,78,97,109,101,115,112,97,99,101,80,97,116,104,46,95, 95,99,111,110,116,97,105,110,115,95,95,99,2,0,0,0, 0,0,0,0,2,0,0,0,2,0,0,0,67,0,0,0, @@ -1785,7 +1785,7 @@ 0,131,1,0,1,100,0,0,83,41,1,78,41,2,114,232, 0,0,0,114,163,0,0,0,41,2,114,108,0,0,0,114, 245,0,0,0,114,4,0,0,0,114,4,0,0,0,114,5, - 0,0,0,114,163,0,0,0,221,3,0,0,115,2,0,0, + 0,0,0,114,163,0,0,0,222,3,0,0,115,2,0,0, 0,0,1,122,21,95,78,97,109,101,115,112,97,99,101,80, 97,116,104,46,97,112,112,101,110,100,78,41,13,114,112,0, 0,0,114,111,0,0,0,114,113,0,0,0,114,114,0,0, @@ -1793,7 +1793,7 @@ 114,240,0,0,0,114,242,0,0,0,114,243,0,0,0,114, 244,0,0,0,114,246,0,0,0,114,163,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,114,230,0,0,0,169,3,0,0,115,20,0,0,0, + 0,0,114,230,0,0,0,170,3,0,0,115,20,0,0,0, 12,5,6,2,12,6,12,10,12,4,12,13,12,3,12,3, 12,3,12,3,114,230,0,0,0,99,0,0,0,0,0,0, 0,0,0,0,0,0,3,0,0,0,64,0,0,0,115,118, @@ -1812,7 +1812,7 @@ 41,1,78,41,2,114,230,0,0,0,114,232,0,0,0,41, 4,114,108,0,0,0,114,106,0,0,0,114,35,0,0,0, 114,236,0,0,0,114,4,0,0,0,114,4,0,0,0,114, - 5,0,0,0,114,185,0,0,0,227,3,0,0,115,2,0, + 5,0,0,0,114,185,0,0,0,228,3,0,0,115,2,0, 0,0,0,1,122,25,95,78,97,109,101,115,112,97,99,101, 76,111,97,100,101,114,46,95,95,105,110,105,116,95,95,99, 2,0,0,0,0,0,0,0,2,0,0,0,2,0,0,0, @@ -1829,14 +1829,14 @@ 110,97,109,101,115,112,97,99,101,41,62,41,2,114,47,0, 0,0,114,112,0,0,0,41,2,114,170,0,0,0,114,190, 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,218,11,109,111,100,117,108,101,95,114,101,112,114,230, + 0,0,218,11,109,111,100,117,108,101,95,114,101,112,114,231, 3,0,0,115,2,0,0,0,0,7,122,28,95,78,97,109, 101,115,112,97,99,101,76,111,97,100,101,114,46,109,111,100, 117,108,101,95,114,101,112,114,99,2,0,0,0,0,0,0, 0,2,0,0,0,1,0,0,0,67,0,0,0,115,4,0, 0,0,100,1,0,83,41,2,78,84,114,4,0,0,0,41, 2,114,108,0,0,0,114,126,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,159,0,0,0,239, + 114,4,0,0,0,114,5,0,0,0,114,159,0,0,0,240, 3,0,0,115,2,0,0,0,0,1,122,27,95,78,97,109, 101,115,112,97,99,101,76,111,97,100,101,114,46,105,115,95, 112,97,99,107,97,103,101,99,2,0,0,0,0,0,0,0, @@ -1844,7 +1844,7 @@ 0,100,1,0,83,41,2,78,114,30,0,0,0,114,4,0, 0,0,41,2,114,108,0,0,0,114,126,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,202,0, - 0,0,242,3,0,0,115,2,0,0,0,0,1,122,27,95, + 0,0,243,3,0,0,115,2,0,0,0,0,1,122,27,95, 78,97,109,101,115,112,97,99,101,76,111,97,100,101,114,46, 103,101,116,95,115,111,117,114,99,101,99,2,0,0,0,0, 0,0,0,2,0,0,0,6,0,0,0,67,0,0,0,115, @@ -1853,7 +1853,7 @@ 0,0,122,8,60,115,116,114,105,110,103,62,114,189,0,0, 0,114,204,0,0,0,84,41,1,114,205,0,0,0,41,2, 114,108,0,0,0,114,126,0,0,0,114,4,0,0,0,114, - 4,0,0,0,114,5,0,0,0,114,187,0,0,0,245,3, + 4,0,0,0,114,5,0,0,0,114,187,0,0,0,246,3, 0,0,115,2,0,0,0,0,1,122,25,95,78,97,109,101, 115,112,97,99,101,76,111,97,100,101,114,46,103,101,116,95, 99,111,100,101,99,2,0,0,0,0,0,0,0,2,0,0, @@ -1863,14 +1863,14 @@ 109,111,100,117,108,101,32,99,114,101,97,116,105,111,110,46, 78,114,4,0,0,0,41,2,114,108,0,0,0,114,164,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,186,0,0,0,248,3,0,0,115,0,0,0,0,122, + 0,114,186,0,0,0,249,3,0,0,115,0,0,0,0,122, 30,95,78,97,109,101,115,112,97,99,101,76,111,97,100,101, 114,46,99,114,101,97,116,101,95,109,111,100,117,108,101,99, 2,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0, 67,0,0,0,115,4,0,0,0,100,0,0,83,41,1,78, 114,4,0,0,0,41,2,114,108,0,0,0,114,190,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,191,0,0,0,251,3,0,0,115,2,0,0,0,0,1, + 114,191,0,0,0,252,3,0,0,115,2,0,0,0,0,1, 122,28,95,78,97,109,101,115,112,97,99,101,76,111,97,100, 101,114,46,101,120,101,99,95,109,111,100,117,108,101,99,2, 0,0,0,0,0,0,0,2,0,0,0,3,0,0,0,67, @@ -1888,7 +1888,7 @@ 104,32,123,33,114,125,41,4,114,105,0,0,0,114,232,0, 0,0,114,121,0,0,0,114,192,0,0,0,41,2,114,108, 0,0,0,114,126,0,0,0,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,114,193,0,0,0,254,3,0,0, + 0,0,114,5,0,0,0,114,193,0,0,0,255,3,0,0, 115,4,0,0,0,0,7,16,1,122,28,95,78,97,109,101, 115,112,97,99,101,76,111,97,100,101,114,46,108,111,97,100, 95,109,111,100,117,108,101,78,41,12,114,112,0,0,0,114, @@ -1896,7 +1896,7 @@ 0,0,0,114,248,0,0,0,114,159,0,0,0,114,202,0, 0,0,114,187,0,0,0,114,186,0,0,0,114,191,0,0, 0,114,193,0,0,0,114,4,0,0,0,114,4,0,0,0, - 114,4,0,0,0,114,5,0,0,0,114,247,0,0,0,226, + 114,4,0,0,0,114,5,0,0,0,114,247,0,0,0,227, 3,0,0,115,16,0,0,0,12,1,12,3,18,9,12,3, 12,3,12,3,12,3,12,3,114,247,0,0,0,99,0,0, 0,0,0,0,0,0,0,0,0,0,5,0,0,0,64,0, @@ -1934,7 +1934,7 @@ 114,95,99,97,99,104,101,218,6,118,97,108,117,101,115,114, 115,0,0,0,114,250,0,0,0,41,2,114,170,0,0,0, 218,6,102,105,110,100,101,114,114,4,0,0,0,114,4,0, - 0,0,114,5,0,0,0,114,250,0,0,0,15,4,0,0, + 0,0,114,5,0,0,0,114,250,0,0,0,16,4,0,0, 115,6,0,0,0,0,4,22,1,15,1,122,28,80,97,116, 104,70,105,110,100,101,114,46,105,110,118,97,108,105,100,97, 116,101,95,99,97,99,104,101,115,99,2,0,0,0,0,0, @@ -1960,7 +1960,7 @@ 107,0,0,0,41,3,114,170,0,0,0,114,35,0,0,0, 90,4,104,111,111,107,114,4,0,0,0,114,4,0,0,0, 114,5,0,0,0,218,11,95,112,97,116,104,95,104,111,111, - 107,115,23,4,0,0,115,16,0,0,0,0,7,25,1,16, + 107,115,24,4,0,0,115,16,0,0,0,0,7,25,1,16, 1,16,1,3,1,14,1,13,1,12,2,122,22,80,97,116, 104,70,105,110,100,101,114,46,95,112,97,116,104,95,104,111, 111,107,115,99,2,0,0,0,0,0,0,0,3,0,0,0, @@ -1992,7 +1992,7 @@ 0,0,114,255,0,0,0,41,3,114,170,0,0,0,114,35, 0,0,0,114,253,0,0,0,114,4,0,0,0,114,4,0, 0,0,114,5,0,0,0,218,20,95,112,97,116,104,95,105, - 109,112,111,114,116,101,114,95,99,97,99,104,101,40,4,0, + 109,112,111,114,116,101,114,95,99,97,99,104,101,41,4,0, 0,115,22,0,0,0,0,8,12,1,3,1,16,1,13,3, 9,1,3,1,17,1,13,1,15,1,18,1,122,31,80,97, 116,104,70,105,110,100,101,114,46,95,112,97,116,104,95,105, @@ -2012,7 +2012,7 @@ 0,0,114,126,0,0,0,114,253,0,0,0,114,127,0,0, 0,114,128,0,0,0,114,164,0,0,0,114,4,0,0,0, 114,4,0,0,0,114,5,0,0,0,218,16,95,108,101,103, - 97,99,121,95,103,101,116,95,115,112,101,99,62,4,0,0, + 97,99,121,95,103,101,116,95,115,112,101,99,63,4,0,0, 115,18,0,0,0,0,4,15,1,24,2,15,1,6,1,12, 1,16,1,18,1,9,1,122,27,80,97,116,104,70,105,110, 100,101,114,46,95,108,101,103,97,99,121,95,103,101,116,95, @@ -2048,7 +2048,7 @@ 101,115,112,97,99,101,95,112,97,116,104,90,5,101,110,116, 114,121,114,253,0,0,0,114,164,0,0,0,114,128,0,0, 0,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 218,9,95,103,101,116,95,115,112,101,99,77,4,0,0,115, + 218,9,95,103,101,116,95,115,112,101,99,78,4,0,0,115, 40,0,0,0,0,5,6,1,13,1,21,1,3,1,15,1, 12,1,15,1,21,2,18,1,12,1,3,1,15,1,4,1, 9,1,12,1,12,5,17,2,18,1,9,1,122,20,80,97, @@ -2076,7 +2076,7 @@ 6,114,170,0,0,0,114,126,0,0,0,114,35,0,0,0, 114,180,0,0,0,114,164,0,0,0,114,4,1,0,0,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,114,181, - 0,0,0,109,4,0,0,115,26,0,0,0,0,4,12,1, + 0,0,0,110,4,0,0,115,26,0,0,0,0,4,12,1, 9,1,21,1,12,1,4,1,15,1,9,1,6,3,9,1, 24,1,4,2,7,2,122,20,80,97,116,104,70,105,110,100, 101,114,46,102,105,110,100,95,115,112,101,99,99,3,0,0, @@ -2098,7 +2098,7 @@ 114,181,0,0,0,114,127,0,0,0,41,4,114,170,0,0, 0,114,126,0,0,0,114,35,0,0,0,114,164,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 182,0,0,0,131,4,0,0,115,8,0,0,0,0,8,18, + 182,0,0,0,132,4,0,0,115,8,0,0,0,0,8,18, 1,12,1,4,1,122,22,80,97,116,104,70,105,110,100,101, 114,46,102,105,110,100,95,109,111,100,117,108,101,41,12,114, 112,0,0,0,114,111,0,0,0,114,113,0,0,0,114,114, @@ -2106,7 +2106,7 @@ 0,0,114,1,1,0,0,114,2,1,0,0,114,5,1,0, 0,114,181,0,0,0,114,182,0,0,0,114,4,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 249,0,0,0,11,4,0,0,115,22,0,0,0,12,2,6, + 249,0,0,0,12,4,0,0,115,22,0,0,0,12,2,6, 2,18,8,18,17,18,22,18,15,3,1,18,31,3,1,21, 21,3,1,114,249,0,0,0,99,0,0,0,0,0,0,0, 0,0,0,0,0,3,0,0,0,64,0,0,0,115,133,0, @@ -2155,7 +2155,7 @@ 0,86,1,113,3,0,100,0,0,83,41,1,78,114,4,0, 0,0,41,2,114,22,0,0,0,114,225,0,0,0,41,1, 114,127,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 227,0,0,0,160,4,0,0,115,2,0,0,0,6,0,122, + 227,0,0,0,161,4,0,0,115,2,0,0,0,6,0,122, 38,70,105,108,101,70,105,110,100,101,114,46,95,95,105,110, 105,116,95,95,46,60,108,111,99,97,108,115,62,46,60,103, 101,110,101,120,112,114,62,114,58,0,0,0,114,29,0,0, @@ -2168,7 +2168,7 @@ 111,97,100,101,114,95,100,101,116,97,105,108,115,90,7,108, 111,97,100,101,114,115,114,166,0,0,0,114,4,0,0,0, 41,1,114,127,0,0,0,114,5,0,0,0,114,185,0,0, - 0,154,4,0,0,115,16,0,0,0,0,4,6,1,19,1, + 0,155,4,0,0,115,16,0,0,0,0,4,6,1,19,1, 36,1,9,2,15,1,9,1,12,1,122,19,70,105,108,101, 70,105,110,100,101,114,46,95,95,105,110,105,116,95,95,99, 1,0,0,0,0,0,0,0,1,0,0,0,2,0,0,0, @@ -2178,7 +2178,7 @@ 114,121,32,109,116,105,109,101,46,114,29,0,0,0,78,114, 87,0,0,0,41,1,114,8,1,0,0,41,1,114,108,0, 0,0,114,4,0,0,0,114,4,0,0,0,114,5,0,0, - 0,114,250,0,0,0,168,4,0,0,115,2,0,0,0,0, + 0,114,250,0,0,0,169,4,0,0,115,2,0,0,0,0, 2,122,28,70,105,108,101,70,105,110,100,101,114,46,105,110, 118,97,108,105,100,97,116,101,95,99,97,99,104,101,115,99, 2,0,0,0,0,0,0,0,3,0,0,0,2,0,0,0, @@ -2202,7 +2202,7 @@ 114,181,0,0,0,114,127,0,0,0,114,156,0,0,0,41, 3,114,108,0,0,0,114,126,0,0,0,114,164,0,0,0, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,114, - 124,0,0,0,174,4,0,0,115,8,0,0,0,0,7,15, + 124,0,0,0,175,4,0,0,115,8,0,0,0,0,7,15, 1,12,1,10,1,122,22,70,105,108,101,70,105,110,100,101, 114,46,102,105,110,100,95,108,111,97,100,101,114,99,6,0, 0,0,0,0,0,0,7,0,0,0,7,0,0,0,67,0, @@ -2213,7 +2213,7 @@ 0,0,0,41,7,114,108,0,0,0,114,165,0,0,0,114, 126,0,0,0,114,35,0,0,0,90,4,115,109,115,108,114, 180,0,0,0,114,127,0,0,0,114,4,0,0,0,114,4, - 0,0,0,114,5,0,0,0,114,5,1,0,0,186,4,0, + 0,0,0,114,5,0,0,0,114,5,1,0,0,187,4,0, 0,115,6,0,0,0,0,1,15,1,18,1,122,20,70,105, 108,101,70,105,110,100,101,114,46,95,103,101,116,95,115,112, 101,99,78,99,3,0,0,0,0,0,0,0,14,0,0,0, @@ -2276,7 +2276,7 @@ 13,105,110,105,116,95,102,105,108,101,110,97,109,101,90,9, 102,117,108,108,95,112,97,116,104,114,164,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,5,0,0,0,114,181,0, - 0,0,191,4,0,0,115,68,0,0,0,0,3,6,1,19, + 0,0,192,4,0,0,115,68,0,0,0,0,3,6,1,19, 1,3,1,34,1,13,1,11,1,15,1,10,1,9,2,9, 1,9,1,15,2,9,1,6,2,12,1,18,1,22,1,10, 1,15,1,12,1,32,4,12,2,22,1,22,1,25,1,16, @@ -2312,7 +2312,7 @@ 0,0,146,2,0,113,6,0,83,114,4,0,0,0,41,1, 114,88,0,0,0,41,2,114,22,0,0,0,90,2,102,110, 114,4,0,0,0,114,4,0,0,0,114,5,0,0,0,250, - 9,60,115,101,116,99,111,109,112,62,9,5,0,0,115,2, + 9,60,115,101,116,99,111,109,112,62,10,5,0,0,115,2, 0,0,0,9,0,122,41,70,105,108,101,70,105,110,100,101, 114,46,95,102,105,108,108,95,99,97,99,104,101,46,60,108, 111,99,97,108,115,62,46,60,115,101,116,99,111,109,112,62, @@ -2329,7 +2329,7 @@ 95,99,111,110,116,101,110,116,115,114,245,0,0,0,114,106, 0,0,0,114,237,0,0,0,114,225,0,0,0,90,8,110, 101,119,95,110,97,109,101,114,4,0,0,0,114,4,0,0, - 0,114,5,0,0,0,114,13,1,0,0,236,4,0,0,115, + 0,114,5,0,0,0,114,13,1,0,0,237,4,0,0,115, 34,0,0,0,0,2,9,1,3,1,31,1,22,3,11,3, 18,1,18,7,9,1,13,1,24,1,6,1,27,2,6,1, 17,1,9,1,18,1,122,22,70,105,108,101,70,105,110,100, @@ -2368,7 +2368,7 @@ 0,0,0,41,1,114,35,0,0,0,41,2,114,170,0,0, 0,114,12,1,0,0,114,4,0,0,0,114,5,0,0,0, 218,24,112,97,116,104,95,104,111,111,107,95,102,111,114,95, - 70,105,108,101,70,105,110,100,101,114,21,5,0,0,115,6, + 70,105,108,101,70,105,110,100,101,114,22,5,0,0,115,6, 0,0,0,0,2,12,1,18,1,122,54,70,105,108,101,70, 105,110,100,101,114,46,112,97,116,104,95,104,111,111,107,46, 60,108,111,99,97,108,115,62,46,112,97,116,104,95,104,111, @@ -2376,7 +2376,7 @@ 114,114,4,0,0,0,41,3,114,170,0,0,0,114,12,1, 0,0,114,18,1,0,0,114,4,0,0,0,41,2,114,170, 0,0,0,114,12,1,0,0,114,5,0,0,0,218,9,112, - 97,116,104,95,104,111,111,107,11,5,0,0,115,4,0,0, + 97,116,104,95,104,111,111,107,12,5,0,0,115,4,0,0, 0,0,10,21,6,122,20,70,105,108,101,70,105,110,100,101, 114,46,112,97,116,104,95,104,111,111,107,99,1,0,0,0, 0,0,0,0,1,0,0,0,2,0,0,0,67,0,0,0, @@ -2385,7 +2385,7 @@ 110,100,101,114,40,123,33,114,125,41,41,2,114,47,0,0, 0,114,35,0,0,0,41,1,114,108,0,0,0,114,4,0, 0,0,114,4,0,0,0,114,5,0,0,0,114,244,0,0, - 0,29,5,0,0,115,2,0,0,0,0,1,122,19,70,105, + 0,30,5,0,0,115,2,0,0,0,0,1,122,19,70,105, 108,101,70,105,110,100,101,114,46,95,95,114,101,112,114,95, 95,41,15,114,112,0,0,0,114,111,0,0,0,114,113,0, 0,0,114,114,0,0,0,114,185,0,0,0,114,250,0,0, @@ -2393,7 +2393,7 @@ 114,5,1,0,0,114,181,0,0,0,114,13,1,0,0,114, 183,0,0,0,114,19,1,0,0,114,244,0,0,0,114,4, 0,0,0,114,4,0,0,0,114,4,0,0,0,114,5,0, - 0,0,114,6,1,0,0,145,4,0,0,115,20,0,0,0, + 0,0,114,6,1,0,0,146,4,0,0,115,20,0,0,0, 12,7,6,2,12,14,12,4,6,2,12,12,12,5,15,45, 12,31,18,18,114,6,1,0,0,99,4,0,0,0,0,0, 0,0,6,0,0,0,11,0,0,0,67,0,0,0,115,195, @@ -2419,7 +2419,7 @@ 104,110,97,109,101,90,9,99,112,97,116,104,110,97,109,101, 114,127,0,0,0,114,164,0,0,0,114,4,0,0,0,114, 4,0,0,0,114,5,0,0,0,218,14,95,102,105,120,95, - 117,112,95,109,111,100,117,108,101,35,5,0,0,115,34,0, + 117,112,95,109,111,100,117,108,101,36,5,0,0,115,34,0, 0,0,0,2,15,1,15,1,6,1,6,1,12,1,12,1, 18,2,15,1,6,1,21,1,3,1,10,1,10,1,10,1, 14,1,13,2,114,24,1,0,0,99,0,0,0,0,0,0, @@ -2440,7 +2440,7 @@ 0,41,3,90,10,101,120,116,101,110,115,105,111,110,115,90, 6,115,111,117,114,99,101,90,8,98,121,116,101,99,111,100, 101,114,4,0,0,0,114,4,0,0,0,114,5,0,0,0, - 114,161,0,0,0,58,5,0,0,115,8,0,0,0,0,5, + 114,161,0,0,0,59,5,0,0,115,8,0,0,0,0,5, 18,1,12,1,12,1,114,161,0,0,0,99,1,0,0,0, 0,0,0,0,12,0,0,0,12,0,0,0,67,0,0,0, 115,70,2,0,0,124,0,0,97,0,0,116,0,0,106,1, @@ -2502,7 +2502,7 @@ 83,41,2,114,29,0,0,0,78,41,1,114,31,0,0,0, 41,2,114,22,0,0,0,114,77,0,0,0,114,4,0,0, 0,114,4,0,0,0,114,5,0,0,0,114,227,0,0,0, - 94,5,0,0,115,2,0,0,0,6,0,122,25,95,115,101, + 95,5,0,0,115,2,0,0,0,6,0,122,25,95,115,101, 116,117,112,46,60,108,111,99,97,108,115,62,46,60,103,101, 110,101,120,112,114,62,114,59,0,0,0,122,30,105,109,112, 111,114,116,108,105,98,32,114,101,113,117,105,114,101,115,32, @@ -2532,7 +2532,7 @@ 90,14,119,101,97,107,114,101,102,95,109,111,100,117,108,101, 90,13,119,105,110,114,101,103,95,109,111,100,117,108,101,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,6, - 95,115,101,116,117,112,69,5,0,0,115,82,0,0,0,0, + 95,115,101,116,117,112,70,5,0,0,115,82,0,0,0,0, 8,6,1,9,1,9,3,13,1,13,1,15,1,18,2,13, 1,20,3,33,1,19,2,31,1,10,1,15,1,13,1,4, 2,3,1,15,1,5,1,13,1,12,2,12,1,16,1,16, @@ -2558,7 +2558,7 @@ 114,218,0,0,0,41,2,114,32,1,0,0,90,17,115,117, 112,112,111,114,116,101,100,95,108,111,97,100,101,114,115,114, 4,0,0,0,114,4,0,0,0,114,5,0,0,0,218,8, - 95,105,110,115,116,97,108,108,137,5,0,0,115,16,0,0, + 95,105,110,115,116,97,108,108,138,5,0,0,115,16,0,0, 0,0,2,10,1,9,1,28,1,15,1,16,1,16,4,9, 1,114,35,1,0,0,41,3,122,3,119,105,110,114,1,0, 0,0,114,2,0,0,0,41,57,114,114,0,0,0,114,10, @@ -2587,7 +2587,7 @@ 0,0,0,114,4,0,0,0,114,5,0,0,0,218,8,60, 109,111,100,117,108,101,62,8,0,0,0,115,100,0,0,0, 6,17,6,3,12,12,12,5,12,5,12,6,12,12,12,10, - 12,9,12,5,12,7,15,22,15,113,22,1,18,2,6,1, + 12,9,12,5,12,7,15,22,15,114,22,1,18,2,6,1, 6,2,9,2,9,2,10,2,21,44,12,33,12,19,12,12, 12,12,18,8,12,28,12,17,21,55,21,12,18,10,12,14, 9,3,12,1,15,65,19,64,19,28,22,110,19,41,25,43, diff --git a/Python/random.c b/Python/random.c --- a/Python/random.c +++ b/Python/random.c @@ -132,7 +132,7 @@ * see https://bugs.python.org/issue26839. To avoid this, use the * GRND_NONBLOCK flag. */ const int flags = GRND_NONBLOCK; - int n; + long n; if (!getrandom_works) return 0; @@ -143,7 +143,7 @@ to 1024 bytes */ n = Py_MIN(size, 1024); #else - n = size; + n = Py_MIN(size, LONG_MAX); #endif errno = 0; @@ -251,7 +251,7 @@ break; } buffer += n; - size -= (Py_ssize_t)n; + size -= n; } close(fd); } diff --git a/README b/README --- a/README +++ b/README @@ -1,5 +1,5 @@ -This is Python version 3.5.2 -============================ +This is Python version 3.5.3 release candidate 1 +================================================ Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Python Software Foundation. All rights reserved. diff --git a/Tools/msi/make_zip.py b/Tools/msi/make_zip.py --- a/Tools/msi/make_zip.py +++ b/Tools/msi/make_zip.py @@ -75,10 +75,12 @@ return p.suffix.lower() in {'.py', '.pyw', '.txt'} FULL_LAYOUT = [ - ('/', 'PCBuild/$arch', 'python*.exe', is_not_debug), - ('/', 'PCBuild/$arch', 'python*.dll', is_not_debug), + ('/', 'PCBuild/$arch', 'python.exe', is_not_debug), + ('/', 'PCBuild/$arch', 'pythonw.exe', is_not_debug), + ('/', 'PCBuild/$arch', 'python{0.major}.dll'.format(sys.version_info), is_not_debug), + ('/', 'PCBuild/$arch', 'python{0.major}{0.minor}.dll'.format(sys.version_info), is_not_debug), ('DLLs/', 'PCBuild/$arch', '*.pyd', is_not_debug), - ('DLLs/', 'PCBuild/$arch', '*.dll', is_not_debug), + ('DLLs/', 'PCBuild/$arch', '*.dll', is_not_debug_or_python), ('include/', 'include', '*.h', None), ('include/', 'PC', 'pyconfig.h', None), ('Lib/', 'Lib', '**/*', include_in_lib), @@ -150,17 +152,17 @@ def main(): parser = argparse.ArgumentParser() parser.add_argument('-s', '--source', metavar='dir', help='The directory containing the repository root', type=Path) - parser.add_argument('-o', '--out', metavar='file', help='The name of the output self-extracting archive', type=Path, required=True) + parser.add_argument('-o', '--out', metavar='file', help='The name of the output self-extracting archive', type=Path, default=None) parser.add_argument('-t', '--temp', metavar='dir', help='A directory to temporarily extract files into', type=Path, default=None) parser.add_argument('-e', '--embed', help='Create an embedding layout', action='store_true', default=False) parser.add_argument('-a', '--arch', help='Specify the architecture to use (win32/amd64)', type=str, default="win32") ns = parser.parse_args() - source = ns.source or (Path(__file__).parent.parent.parent) + source = ns.source or (Path(__file__).resolve().parent.parent.parent) out = ns.out arch = ns.arch assert isinstance(source, Path) - assert isinstance(out, Path) + assert not out or isinstance(out, Path) assert isinstance(arch, str) if ns.temp: @@ -170,10 +172,11 @@ temp = Path(tempfile.mkdtemp()) delete_temp = True - try: - out.parent.mkdir(parents=True) - except FileExistsError: - pass + if out: + try: + out.parent.mkdir(parents=True) + except FileExistsError: + pass try: temp.mkdir(parents=True) except FileExistsError: @@ -190,8 +193,9 @@ with open(str(temp / 'pyvenv.cfg'), 'w') as f: print('applocal = true', file=f) - total = copy_to_layout(out, rglob(temp, '*', None)) - print('Wrote {} files to {}'.format(total, out)) + if out: + total = copy_to_layout(out, rglob(temp, '**/*', None)) + print('Wrote {} files to {}'.format(total, out)) finally: if delete_temp: shutil.rmtree(temp, True) diff --git a/Tools/nuget/make_pkg.proj b/Tools/nuget/make_pkg.proj new file mode 100644 --- /dev/null +++ b/Tools/nuget/make_pkg.proj @@ -0,0 +1,55 @@ + + + + {10487945-15D1-4092-A214-338395C4116B} + python + $(OutputName)x86 + + false + true + + + + + + $(ExternalsDir)\windows-installer\nuget\nuget.exe + $(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber) + false + $(OutputName).$(NuspecVersion) + .nupkg + $(OutputPath)\en-us\$(TargetName)$(TargetExt) + $(IntermediateOutputPath)\nuget_$(ArchName) + + rmdir /q/s "$(IntermediateOutputPath)" + + "$(PythonExe)" "$(MSBuildThisFileDirectory)\..\msi\make_zip.py" + $(PythonArguments) -t "$(IntermediateOutputPath)" -a $(ArchName) + + "$(IntermediateOutputPath)\python.exe" -B -c "import sys; sys.path.append(r'$(PySourcePath)\Lib'); import ensurepip; ensurepip._main()" + + "$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).nuspec" + $(NugetArguments) -BasePath "$(IntermediateOutputPath)" + $(NugetArguments) -OutputDirectory "$(OutputPath)\en-us" + $(NugetArguments) -Version "$(NuspecVersion)" + $(NugetArguments) -NoPackageAnalysis -NonInteractive + + setlocal +set DOC_FILENAME=python$(PythonVersion).chm +set VCREDIST_PATH=$(VS140COMNTOOLS)\..\..\VC\redist\$(Platform)\Microsoft.VC140.CRT + + + + + + + + + + + + + + + + diff --git a/Tools/nuget/python.nuspec b/Tools/nuget/python.nuspec new file mode 100644 --- /dev/null +++ b/Tools/nuget/python.nuspec @@ -0,0 +1,18 @@ + + + + python + Python + 0.0.0.0 + Python Software Foundation + https://docs.python.org/3/license.html + https://www.python.org/ + false + Installs 64-bit Python for use in build scenarios. + https://www.python.org/static/favicon.ico + python + + + + + diff --git a/Tools/nuget/pythonx86.nuspec b/Tools/nuget/pythonx86.nuspec new file mode 100644 --- /dev/null +++ b/Tools/nuget/pythonx86.nuspec @@ -0,0 +1,18 @@ + + + + pythonx86 + Python (32-bit) + Python Software Foundation + 0.0.0.0 + https://docs.python.org/3/license.html + https://www.python.org/ + false + Installs 32-bit Python for use in build scenarios. + https://www.python.org/static/favicon.ico + python + + + + + -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 27 02:50:32 2016 From: python-checkins at python.org (berker.peksag) Date: Mon, 27 Jun 2016 06:50:32 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3Mzkz?= =?utf-8?q?=3A_Fix_escaping_of_venv_activate_commands_on_Windows?= Message-ID: <20160627065032.3297.33702.5D71D84E@psf.io> https://hg.python.org/cpython/rev/fd1236294b88 changeset: 102206:fd1236294b88 branch: 3.5 parent: 102204:0b3a6ca3f923 user: Berker Peksag date: Mon Jun 27 09:51:40 2016 +0300 summary: Issue #27393: Fix escaping of venv activate commands on Windows Patch by Manuel Kaufmann. files: Doc/using/venv-create.inc | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/using/venv-create.inc b/Doc/using/venv-create.inc --- a/Doc/using/venv-create.inc +++ b/Doc/using/venv-create.inc @@ -89,9 +89,9 @@ +-------------+-----------------+-----------------------------------------+ | | csh/tcsh | $ source /bin/activate.csh | +-------------+-----------------+-----------------------------------------+ -| Windows | cmd.exe | C:\> \Scripts\activate.bat | +| Windows | cmd.exe | C:\> \\Scripts\\activate.bat | +-------------+-----------------+-----------------------------------------+ -| | PowerShell | PS C:\> \Scripts\Activate.ps1 | +| | PowerShell | PS C:\> \\Scripts\\Activate.ps1 | +-------------+-----------------+-----------------------------------------+ You don't specifically *need* to activate an environment; activation just -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 27 02:50:32 2016 From: python-checkins at python.org (berker.peksag) Date: Mon, 27 Jun 2016 06:50:32 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327393=3A_Merge_from_3=2E5?= Message-ID: <20160627065032.8346.83655.1826A8BF@psf.io> https://hg.python.org/cpython/rev/cf560010e6f8 changeset: 102207:cf560010e6f8 parent: 102205:9a9817458bc8 parent: 102206:fd1236294b88 user: Berker Peksag date: Mon Jun 27 09:52:07 2016 +0300 summary: Issue #27393: Merge from 3.5 files: Doc/using/venv-create.inc | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/using/venv-create.inc b/Doc/using/venv-create.inc --- a/Doc/using/venv-create.inc +++ b/Doc/using/venv-create.inc @@ -89,9 +89,9 @@ +-------------+-----------------+-----------------------------------------+ | | csh/tcsh | $ source /bin/activate.csh | +-------------+-----------------+-----------------------------------------+ -| Windows | cmd.exe | C:\> \Scripts\activate.bat | +| Windows | cmd.exe | C:\> \\Scripts\\activate.bat | +-------------+-----------------+-----------------------------------------+ -| | PowerShell | PS C:\> \Scripts\Activate.ps1 | +| | PowerShell | PS C:\> \\Scripts\\Activate.ps1 | +-------------+-----------------+-----------------------------------------+ You don't specifically *need* to activate an environment; activation just -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Mon Jun 27 04:46:22 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 27 Jun 2016 08:46:22 +0000 Subject: [Python-checkins] Daily reference leaks (9a9817458bc8): sum=4 Message-ID: <20160627084621.106716.25158.C1C90B4D@psf.io> results for 9a9817458bc8 on branch "default" -------------------------------------------- test_collections leaked [4, 0, -4] memory blocks, sum=0 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [-2, 2, 0] memory blocks, sum=0 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogn_FMOP', '--timeout', '7200'] From python-checkins at python.org Mon Jun 27 06:09:40 2016 From: python-checkins at python.org (berker.peksag) Date: Mon, 27 Jun 2016 10:09:40 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327393=3A_Merge_from_3=2E5?= Message-ID: <20160627100940.16165.91021.5D1C6EF8@psf.io> https://hg.python.org/cpython/rev/e1a0582896d6 changeset: 102209:e1a0582896d6 parent: 102207:cf560010e6f8 parent: 102208:b82149953a8c user: Berker Peksag date: Mon Jun 27 13:11:16 2016 +0300 summary: Issue #27393: Merge from 3.5 files: Doc/using/venv-create.inc | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/using/venv-create.inc b/Doc/using/venv-create.inc --- a/Doc/using/venv-create.inc +++ b/Doc/using/venv-create.inc @@ -89,9 +89,9 @@ +-------------+-----------------+-----------------------------------------+ | | csh/tcsh | $ source /bin/activate.csh | +-------------+-----------------+-----------------------------------------+ -| Windows | cmd.exe | C:\> \\Scripts\\activate.bat | +| Windows | cmd.exe | C:\\> \\Scripts\\activate.bat | +-------------+-----------------+-----------------------------------------+ -| | PowerShell | PS C:\> \\Scripts\\Activate.ps1 | +| | PowerShell | PS C:\\> \\Scripts\\Activate.ps1 | +-------------+-----------------+-----------------------------------------+ You don't specifically *need* to activate an environment; activation just -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 27 06:09:40 2016 From: python-checkins at python.org (berker.peksag) Date: Mon, 27 Jun 2016 10:09:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3Mzkz?= =?utf-8?q?=3A_Fix_escaping_of_C=3A=5C_too?= Message-ID: <20160627100940.8397.31945.26443DF6@psf.io> https://hg.python.org/cpython/rev/b82149953a8c changeset: 102208:b82149953a8c branch: 3.5 parent: 102206:fd1236294b88 user: Berker Peksag date: Mon Jun 27 13:10:47 2016 +0300 summary: Issue #27393: Fix escaping of C:\ too files: Doc/using/venv-create.inc | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/using/venv-create.inc b/Doc/using/venv-create.inc --- a/Doc/using/venv-create.inc +++ b/Doc/using/venv-create.inc @@ -89,9 +89,9 @@ +-------------+-----------------+-----------------------------------------+ | | csh/tcsh | $ source /bin/activate.csh | +-------------+-----------------+-----------------------------------------+ -| Windows | cmd.exe | C:\> \\Scripts\\activate.bat | +| Windows | cmd.exe | C:\\> \\Scripts\\activate.bat | +-------------+-----------------+-----------------------------------------+ -| | PowerShell | PS C:\> \\Scripts\\Activate.ps1 | +| | PowerShell | PS C:\\> \\Scripts\\Activate.ps1 | +-------------+-----------------+-----------------------------------------+ You don't specifically *need* to activate an environment; activation just -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Mon Jun 27 08:48:37 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Mon, 27 Jun 2016 13:48:37 +0100 Subject: [Python-checkins] GOOD Benchmark Results for Python Default 2016-06-27 Message-ID: Results for project Python default, build date 2016-06-27 02:06:56 +0000 commit: 447c20169c92 previous commit: 8955d8aaf351 revision date: 2016-06-26 22:22:32 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.22% 2.27% 11.75% 13.95% :-| pybench 0.08% -0.11% 1.29% 7.94% :-( regex_v8 2.63% -0.87% -2.57% 7.76% :-| nbody 0.17% 0.70% 0.01% 8.16% :-( json_dump_v2 0.35% 1.08% -2.12% 11.06% :-| normal_startup 0.87% -0.19% 1.32% 5.75% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-default-2016-06-27/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Mon Jun 27 08:51:06 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Mon, 27 Jun 2016 13:51:06 +0100 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2016-06-27 Message-ID: <7aad24d4-6b3a-4d58-bc6c-3927b3acf020@irsmsx151.ger.corp.intel.com> Results for project Python 2.7, build date 2016-06-27 02:50:50 +0000 commit: e2d0d921d526 previous commit: cbc6407fa393 revision date: 2016-06-26 22:20:14 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.16% 0.37% 4.58% 5.63% :-) pybench 0.17% 0.06% 5.76% 4.65% :-( regex_v8 0.53% 0.00% -2.43% 11.46% :-) nbody 0.07% 0.17% 8.93% 2.97% :-| json_dump_v2 0.51% -0.41% 1.68% 12.73% :-( normal_startup 1.82% -0.87% -5.96% 3.01% :-| ssbench 0.15% -0.49% 1.92% 1.62% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-2-7-2016-06-27/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Mon Jun 27 11:59:16 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Mon, 27 Jun 2016 15:59:16 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327255=3A_Added_mo?= =?utf-8?q?re_predictions_in_ceval=2Ec=2E?= Message-ID: <20160627155916.15832.79434.0B4A9642@psf.io> https://hg.python.org/cpython/rev/f19c2b28710e changeset: 102210:f19c2b28710e user: Serhiy Storchaka date: Mon Jun 27 18:58:57 2016 +0300 summary: Issue #27255: Added more predictions in ceval.c. files: Python/ceval.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1000,8 +1000,7 @@ /* OpCode prediction macros Some opcodes tend to come in pairs thus making it possible to predict the second code when the first is run. For example, - COMPARE_OP is often followed by JUMP_IF_FALSE or JUMP_IF_TRUE. And, - those opcodes are often followed by a POP_TOP. + COMPARE_OP is often followed by POP_JUMP_IF_FALSE or POP_JUMP_IF_TRUE. Verifying the prediction costs a single high-speed test of a register variable against a constant. If the pairing was good, then the @@ -1379,6 +1378,7 @@ FAST_DISPATCH(); } + PREDICTED(LOAD_CONST); TARGET(LOAD_CONST) { PyObject *value = GETITEM(consts, oparg); Py_INCREF(value); @@ -2008,6 +2008,7 @@ } SET_TOP(awaitable); + PREDICT(LOAD_CONST); DISPATCH(); } @@ -2050,9 +2051,11 @@ Py_DECREF(next_iter); PUSH(awaitable); + PREDICT(LOAD_CONST); DISPATCH(); } + PREDICTED(GET_AWAITABLE); TARGET(GET_AWAITABLE) { PyObject *iterable = TOP(); PyObject *iter = _PyCoro_GetAwaitableIter(iterable); @@ -2080,6 +2083,7 @@ goto error; } + PREDICT(LOAD_CONST); DISPATCH(); } @@ -2135,6 +2139,7 @@ DISPATCH(); } + PREDICTED(POP_BLOCK); TARGET(POP_BLOCK) { PyTryBlock *b = PyFrame_BlockPop(f); UNWIND_BLOCK(b); @@ -3015,6 +3020,7 @@ if (iter == NULL) goto error; PREDICT(FOR_ITER); + PREDICT(CALL_FUNCTION); DISPATCH(); } @@ -3043,6 +3049,7 @@ if (iter == NULL) goto error; } + PREDICT(LOAD_CONST); DISPATCH(); } @@ -3068,6 +3075,7 @@ STACKADJ(-1); Py_DECREF(iter); JUMPBY(oparg); + PREDICT(POP_BLOCK); DISPATCH(); } @@ -3117,6 +3125,7 @@ if (res == NULL) goto error; PUSH(res); + PREDICT(GET_AWAITABLE); DISPATCH(); } @@ -3265,6 +3274,7 @@ DISPATCH(); } + PREDICTED(CALL_FUNCTION); TARGET(CALL_FUNCTION) { PyObject **sp, *res; PCALL(PCALL_ALL); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 27 12:36:03 2016 From: python-checkins at python.org (steve.dower) Date: Mon, 27 Jun 2016 16:36:03 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Include_libs_f?= =?utf-8?q?older_in_nuget_package_and_allow_preinstalling_packages?= Message-ID: <20160627163603.25273.19134.2083F3FB@psf.io> https://hg.python.org/cpython/rev/ac03015d69d5 changeset: 102211:ac03015d69d5 branch: 3.5 parent: 102208:b82149953a8c user: Steve Dower date: Mon Jun 27 09:34:18 2016 -0700 summary: Include libs folder in nuget package and allow preinstalling packages files: Tools/msi/make_zip.py | 34 +++++++++++++++++++------- Tools/nuget/make_pkg.proj | 6 +++- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/Tools/msi/make_zip.py b/Tools/msi/make_zip.py --- a/Tools/msi/make_zip.py +++ b/Tools/msi/make_zip.py @@ -12,9 +12,19 @@ import subprocess TKTCL_RE = re.compile(r'^(_?tk|tcl).+\.(pyd|dll)', re.IGNORECASE) -DEBUG_RE = re.compile(r'_d\.(pyd|dll|exe)$', re.IGNORECASE) +DEBUG_RE = re.compile(r'_d\.(pyd|dll|exe|pdb|lib)$', re.IGNORECASE) PYTHON_DLL_RE = re.compile(r'python\d\d?\.dll$', re.IGNORECASE) +DEBUG_FILES = { + '_ctypes_test', + '_testbuffer', + '_testcapi', + '_testimportmultiple', + '_testmultiphase', + 'xxlimited', + 'python3_dstub', +} + EXCLUDE_FROM_LIBRARY = { '__pycache__', 'ensurepip', @@ -30,6 +40,12 @@ 'bdist_wininst.py', } +EXCLUDE_FILE_FROM_LIBS = { + 'ssleay', + 'libeay', + 'python3stub', +} + def is_not_debug(p): if DEBUG_RE.search(p.name): return False @@ -37,14 +53,7 @@ if TKTCL_RE.search(p.name): return False - return p.name.lower() not in { - '_ctypes_test.pyd', - '_testbuffer.pyd', - '_testcapi.pyd', - '_testimportmultiple.pyd', - '_testmultiphase.pyd', - 'xxlimited.pyd', - } + return p.stem.lower() not in DEBUG_FILES def is_not_debug_or_python(p): return is_not_debug(p) and not PYTHON_DLL_RE.search(p.name) @@ -68,6 +77,12 @@ suffix = p.suffix.lower() return suffix not in {'.pyc', '.pyo', '.exe'} +def include_in_libs(p): + if not is_not_debug(p): + return False + + return p.stem.lower() not in EXCLUDE_FILE_FROM_LIBS + def include_in_tools(p): if p.is_dir() and p.name.lower() in {'scripts', 'i18n', 'pynche', 'demo', 'parser'}: return True @@ -84,6 +99,7 @@ ('include/', 'include', '*.h', None), ('include/', 'PC', 'pyconfig.h', None), ('Lib/', 'Lib', '**/*', include_in_lib), + ('libs/', 'PCBuild/$arch', '*.lib', include_in_libs), ('Tools/', 'Tools', '**/*', include_in_tools), ] diff --git a/Tools/nuget/make_pkg.proj b/Tools/nuget/make_pkg.proj --- a/Tools/nuget/make_pkg.proj +++ b/Tools/nuget/make_pkg.proj @@ -17,7 +17,7 @@ false $(OutputName).$(NuspecVersion) .nupkg - $(OutputPath)\en-us\$(TargetName)$(TargetExt) + $(OutputPath)\$(TargetName)$(TargetExt) $(IntermediateOutputPath)\nuget_$(ArchName) rmdir /q/s "$(IntermediateOutputPath)" @@ -26,10 +26,11 @@ $(PythonArguments) -t "$(IntermediateOutputPath)" -a $(ArchName) "$(IntermediateOutputPath)\python.exe" -B -c "import sys; sys.path.append(r'$(PySourcePath)\Lib'); import ensurepip; ensurepip._main()" + "$(IntermediateOutputPath)\python.exe" -B -m pip install -U $(Packages) "$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).nuspec" $(NugetArguments) -BasePath "$(IntermediateOutputPath)" - $(NugetArguments) -OutputDirectory "$(OutputPath)\en-us" + $(NugetArguments) -OutputDirectory "$(OutputPath.Trim(`\`))" $(NugetArguments) -Version "$(NuspecVersion)" $(NugetArguments) -NoPackageAnalysis -NonInteractive @@ -47,6 +48,7 @@ + -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 27 12:36:04 2016 From: python-checkins at python.org (steve.dower) Date: Mon, 27 Jun 2016 16:36:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5?= Message-ID: <20160627163603.52940.72868.451E011E@psf.io> https://hg.python.org/cpython/rev/a14f425e1c4a changeset: 102212:a14f425e1c4a parent: 102210:f19c2b28710e parent: 102211:ac03015d69d5 user: Steve Dower date: Mon Jun 27 09:35:32 2016 -0700 summary: Merge from 3.5 files: Tools/msi/make_zip.py | 34 +++++++++++++++++++------- Tools/nuget/make_pkg.proj | 6 +++- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/Tools/msi/make_zip.py b/Tools/msi/make_zip.py --- a/Tools/msi/make_zip.py +++ b/Tools/msi/make_zip.py @@ -12,9 +12,19 @@ import subprocess TKTCL_RE = re.compile(r'^(_?tk|tcl).+\.(pyd|dll)', re.IGNORECASE) -DEBUG_RE = re.compile(r'_d\.(pyd|dll|exe)$', re.IGNORECASE) +DEBUG_RE = re.compile(r'_d\.(pyd|dll|exe|pdb|lib)$', re.IGNORECASE) PYTHON_DLL_RE = re.compile(r'python\d\d?\.dll$', re.IGNORECASE) +DEBUG_FILES = { + '_ctypes_test', + '_testbuffer', + '_testcapi', + '_testimportmultiple', + '_testmultiphase', + 'xxlimited', + 'python3_dstub', +} + EXCLUDE_FROM_LIBRARY = { '__pycache__', 'ensurepip', @@ -30,6 +40,12 @@ 'bdist_wininst.py', } +EXCLUDE_FILE_FROM_LIBS = { + 'ssleay', + 'libeay', + 'python3stub', +} + def is_not_debug(p): if DEBUG_RE.search(p.name): return False @@ -37,14 +53,7 @@ if TKTCL_RE.search(p.name): return False - return p.name.lower() not in { - '_ctypes_test.pyd', - '_testbuffer.pyd', - '_testcapi.pyd', - '_testimportmultiple.pyd', - '_testmultiphase.pyd', - 'xxlimited.pyd', - } + return p.stem.lower() not in DEBUG_FILES def is_not_debug_or_python(p): return is_not_debug(p) and not PYTHON_DLL_RE.search(p.name) @@ -68,6 +77,12 @@ suffix = p.suffix.lower() return suffix not in {'.pyc', '.pyo', '.exe'} +def include_in_libs(p): + if not is_not_debug(p): + return False + + return p.stem.lower() not in EXCLUDE_FILE_FROM_LIBS + def include_in_tools(p): if p.is_dir() and p.name.lower() in {'scripts', 'i18n', 'pynche', 'demo', 'parser'}: return True @@ -84,6 +99,7 @@ ('include/', 'include', '*.h', None), ('include/', 'PC', 'pyconfig.h', None), ('Lib/', 'Lib', '**/*', include_in_lib), + ('libs/', 'PCBuild/$arch', '*.lib', include_in_libs), ('Tools/', 'Tools', '**/*', include_in_tools), ] diff --git a/Tools/nuget/make_pkg.proj b/Tools/nuget/make_pkg.proj --- a/Tools/nuget/make_pkg.proj +++ b/Tools/nuget/make_pkg.proj @@ -17,7 +17,7 @@ false $(OutputName).$(NuspecVersion) .nupkg - $(OutputPath)\en-us\$(TargetName)$(TargetExt) + $(OutputPath)\$(TargetName)$(TargetExt) $(IntermediateOutputPath)\nuget_$(ArchName) rmdir /q/s "$(IntermediateOutputPath)" @@ -26,10 +26,11 @@ $(PythonArguments) -t "$(IntermediateOutputPath)" -a $(ArchName) "$(IntermediateOutputPath)\python.exe" -B -c "import sys; sys.path.append(r'$(PySourcePath)\Lib'); import ensurepip; ensurepip._main()" + "$(IntermediateOutputPath)\python.exe" -B -m pip install -U $(Packages) "$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).nuspec" $(NugetArguments) -BasePath "$(IntermediateOutputPath)" - $(NugetArguments) -OutputDirectory "$(OutputPath)\en-us" + $(NugetArguments) -OutputDirectory "$(OutputPath.Trim(`\`))" $(NugetArguments) -Version "$(NuspecVersion)" $(NugetArguments) -NoPackageAnalysis -NonInteractive @@ -47,6 +48,7 @@ + -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 27 12:43:40 2016 From: python-checkins at python.org (steve.dower) Date: Mon, 27 Jun 2016 16:43:40 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Adds_batch_fil?= =?utf-8?q?e_to_build_nuget_packages=2E?= Message-ID: <20160627164339.52334.31491.A06FF180@psf.io> https://hg.python.org/cpython/rev/2210765a2770 changeset: 102213:2210765a2770 branch: 3.5 parent: 102211:ac03015d69d5 user: Steve Dower date: Mon Jun 27 09:43:17 2016 -0700 summary: Adds batch file to build nuget packages. files: Tools/nuget/build.bat | 55 +++++++++++++++++++++++++++++++ 1 files changed, 55 insertions(+), 0 deletions(-) diff --git a/Tools/nuget/build.bat b/Tools/nuget/build.bat new file mode 100644 --- /dev/null +++ b/Tools/nuget/build.bat @@ -0,0 +1,55 @@ + at echo off +setlocal +set D=%~dp0 +set PCBUILD=%D%..\..\PCBuild\ + +set BUILDX86= +set BUILDX64= +set REBUILD= +set OUTPUT= +set PACKAGES= + +:CheckOpts +if "%~1" EQU "-h" goto Help +if "%~1" EQU "-x86" (set BUILDX86=1) && shift && goto CheckOpts +if "%~1" EQU "-x64" (set BUILDX64=1) && shift && goto CheckOpts +if "%~1" EQU "-r" (set REBUILD=-r) && shift && goto CheckOpts +if "%~1" EQU "-o" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts +if "%~1" EQU "--out" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts +if "%~1" EQU "-p" (set PACKAGES=%PACKAGES% %~2) && shift && shift && goto CheckOpts + +if not defined BUILDX86 if not defined BUILDX64 (set BUILDX86=1) && (set BUILDX64=1) + +call "%D%..\msi\get_externals.bat" +call "%PCBUILD%env.bat" x86 + +if defined PACKAGES set PACKAGES="/p:Packages=%PACKAGES%" + +if defined BUILDX86 ( + if defined REBUILD ( call "%PCBUILD%build.bat" -e -r + ) else if not exist "%PCBUILD%win32\python.exe" call "%PCBUILD%build.bat" -e + if errorlevel 1 goto :eof + + msbuild "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x86 %OUTPUT% %PACKAGES% + if errorlevel 1 goto :eof +) + +if defined BUILDX64 ( + if defined REBUILD ( call "%PCBUILD%build.bat" -p x64 -e -r + ) else if not exist "%PCBUILD%amd64\python.exe" call "%PCBUILD%build.bat" -p x64 -e + if errorlevel 1 goto :eof + + msbuild "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x64 %OUTPUT% %PACKAGES% + if errorlevel 1 goto :eof +) + +exit /B 0 + +:Help +echo build.bat [-x86] [-x64] [--out DIR] [-r] [-h] +echo. +echo -x86 Build x86 installers +echo -x64 Build x64 installers +echo -r Rebuild rather than incremental build +echo --out [DIR] Override output directory +echo -h Show usage -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 27 12:43:40 2016 From: python-checkins at python.org (steve.dower) Date: Mon, 27 Jun 2016 16:43:40 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5?= Message-ID: <20160627164339.52566.32142.16548EE3@psf.io> https://hg.python.org/cpython/rev/aa1e1f7e17cc changeset: 102214:aa1e1f7e17cc parent: 102212:a14f425e1c4a parent: 102213:2210765a2770 user: Steve Dower date: Mon Jun 27 09:43:27 2016 -0700 summary: Merge from 3.5 files: Tools/nuget/build.bat | 55 +++++++++++++++++++++++++++++++ 1 files changed, 55 insertions(+), 0 deletions(-) diff --git a/Tools/nuget/build.bat b/Tools/nuget/build.bat new file mode 100644 --- /dev/null +++ b/Tools/nuget/build.bat @@ -0,0 +1,55 @@ + at echo off +setlocal +set D=%~dp0 +set PCBUILD=%D%..\..\PCBuild\ + +set BUILDX86= +set BUILDX64= +set REBUILD= +set OUTPUT= +set PACKAGES= + +:CheckOpts +if "%~1" EQU "-h" goto Help +if "%~1" EQU "-x86" (set BUILDX86=1) && shift && goto CheckOpts +if "%~1" EQU "-x64" (set BUILDX64=1) && shift && goto CheckOpts +if "%~1" EQU "-r" (set REBUILD=-r) && shift && goto CheckOpts +if "%~1" EQU "-o" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts +if "%~1" EQU "--out" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts +if "%~1" EQU "-p" (set PACKAGES=%PACKAGES% %~2) && shift && shift && goto CheckOpts + +if not defined BUILDX86 if not defined BUILDX64 (set BUILDX86=1) && (set BUILDX64=1) + +call "%D%..\msi\get_externals.bat" +call "%PCBUILD%env.bat" x86 + +if defined PACKAGES set PACKAGES="/p:Packages=%PACKAGES%" + +if defined BUILDX86 ( + if defined REBUILD ( call "%PCBUILD%build.bat" -e -r + ) else if not exist "%PCBUILD%win32\python.exe" call "%PCBUILD%build.bat" -e + if errorlevel 1 goto :eof + + msbuild "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x86 %OUTPUT% %PACKAGES% + if errorlevel 1 goto :eof +) + +if defined BUILDX64 ( + if defined REBUILD ( call "%PCBUILD%build.bat" -p x64 -e -r + ) else if not exist "%PCBUILD%amd64\python.exe" call "%PCBUILD%build.bat" -p x64 -e + if errorlevel 1 goto :eof + + msbuild "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x64 %OUTPUT% %PACKAGES% + if errorlevel 1 goto :eof +) + +exit /B 0 + +:Help +echo build.bat [-x86] [-x64] [--out DIR] [-r] [-h] +echo. +echo -x86 Build x86 installers +echo -x64 Build x64 installers +echo -r Rebuild rather than incremental build +echo --out [DIR] Override output directory +echo -h Show usage -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 27 12:54:24 2016 From: python-checkins at python.org (steve.dower) Date: Mon, 27 Jun 2016 16:54:24 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Adds_batch_fil?= =?utf-8?q?e_for_building_nuget_package=2C_and_includes_libs_folder?= Message-ID: <20160627165423.52818.9807.519379DF@psf.io> https://hg.python.org/cpython/rev/ccec979392d7 changeset: 102215:ccec979392d7 branch: 2.7 parent: 102185:e2d0d921d526 user: Steve Dower date: Mon Jun 27 09:54:03 2016 -0700 summary: Adds batch file for building nuget package, and includes libs folder files: Tools/nuget/build.bat | 63 +++++++++++++++++++++++++++ Tools/nuget/make_pkg.proj | 5 +- Tools/nuget/make_zip.py | 37 +++++++++++---- 3 files changed, 94 insertions(+), 11 deletions(-) diff --git a/Tools/nuget/build.bat b/Tools/nuget/build.bat new file mode 100644 --- /dev/null +++ b/Tools/nuget/build.bat @@ -0,0 +1,63 @@ + at echo off +setlocal +set D=%~dp0 +set PCBUILD=%D%..\..\PCBuild\ + +set BUILDX86= +set BUILDX64= +set REBUILD= +set OUTPUT= +set PACKAGES= + +:CheckOpts +if "%~1" EQU "-h" goto Help +if "%~1" EQU "-x86" (set BUILDX86=1) && shift && goto CheckOpts +if "%~1" EQU "-x64" (set BUILDX64=1) && shift && goto CheckOpts +if "%~1" EQU "-r" (set REBUILD=-r) && shift && goto CheckOpts +if "%~1" EQU "-o" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts +if "%~1" EQU "--out" (set OUTPUT="/p:OutputPath=%~2") && shift && shift && goto CheckOpts +if "%~1" EQU "-p" (set PACKAGES=%PACKAGES% %~2) && shift && shift && goto CheckOpts + +if not defined BUILDX86 if not defined BUILDX64 (set BUILDX86=1) && (set BUILDX64=1) + +if not defined NUGET where nuget -q || echo Cannot find nuget.exe on PATH and NUGET is not set. && exit /B 1 +if not defined PYTHON set PYTHON=py -3 + +@%PYTHON% -c "" >nul 2>nul + at if errorlevel 1 ( + %NUGET% install python -OutputDirectory "%D%obj" -ExcludeVersion -NonInteractive + set PYTHON="%D%obj\python\tools\python.exe" +) + +call "%PCBUILD%env.bat" x86 + +if defined PACKAGES set PACKAGES="/p:Packages=%PACKAGES%" + +if defined BUILDX86 ( + if defined REBUILD ( call "%PCBUILD%build.bat" -e -r + ) else if not exist "%PCBUILD%python.exe" call "%PCBUILD%build.bat" -e + if errorlevel 1 goto :eof + + msbuild "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x86 %OUTPUT% %PACKAGES% + if errorlevel 1 goto :eof +) + +if defined BUILDX64 ( + if defined REBUILD ( call "%PCBUILD%build.bat" -p x64 -e -r + ) else if not exist "%PCBUILD%amd64\python.exe" call "%PCBUILD%build.bat" -p x64 -e + if errorlevel 1 goto :eof + + msbuild "%D%make_pkg.proj" /p:Configuration=Release /p:Platform=x64 %OUTPUT% %PACKAGES% + if errorlevel 1 goto :eof +) + +exit /B 0 + +:Help +echo build.bat [-x86] [-x64] [--out DIR] [-r] [-h] +echo. +echo -x86 Build x86 installers +echo -x64 Build x64 installers +echo -r Rebuild rather than incremental build +echo --out [DIR] Override output directory +echo -h Show usage diff --git a/Tools/nuget/make_pkg.proj b/Tools/nuget/make_pkg.proj --- a/Tools/nuget/make_pkg.proj +++ b/Tools/nuget/make_pkg.proj @@ -7,6 +7,7 @@ $(MSBuildThisFileDirectory) false + true @@ -26,10 +27,11 @@ $(PythonArguments) -s "$(PySourcePath.Trim('\'))" -t "$(IntermediateOutputPath)" -a $(ArchName) "$(IntermediateOutputPath)\python.exe" -B -c "import sys; sys.path.append(r'$(PySourcePath)\Lib'); import ensurepip; ensurepip._main()" + "$(IntermediateOutputPath)\python.exe" -B -m pip install -U $(Packages) "$(Nuget)" pack "$(MSBuildThisFileDirectory)\$(OutputName).nuspec" $(NugetArguments) -BasePath "$(IntermediateOutputPath)" - $(NugetArguments) -OutputDirectory "$(OutputPath.Trim('\'))" + $(NugetArguments) -OutputDirectory "$(OutputPath.Trim(`\`))" $(NugetArguments) -Version "$(NuspecVersion)" $(NugetArguments) -NoPackageAnalysis -NonInteractive @@ -42,6 +44,7 @@ + diff --git a/Tools/nuget/make_zip.py b/Tools/nuget/make_zip.py --- a/Tools/nuget/make_zip.py +++ b/Tools/nuget/make_zip.py @@ -14,9 +14,19 @@ import subprocess TKTCL_RE = re.compile(r'^(_?tk|tcl).+\.(pyd|dll)', re.IGNORECASE) -DEBUG_RE = re.compile(r'_d\.(pyd|dll|exe)$', re.IGNORECASE) +DEBUG_RE = re.compile(r'_d\.(pyd|dll|exe|pdb|lib)$', re.IGNORECASE) PYTHON_DLL_RE = re.compile(r'python\d\d?\.dll$', re.IGNORECASE) +DEBUG_FILES = { + '_ctypes_test', + '_testbuffer', + '_testcapi', + '_testimportmultiple', + '_testmultiphase', + 'xxlimited', + 'python3_dstub', +} + EXCLUDE_FROM_LIBRARY = { '__pycache__', 'ensurepip', @@ -25,12 +35,19 @@ 'site-packages', 'tkinter', 'turtledemo', + 'venv', } EXCLUDE_FILE_FROM_LIBRARY = { 'bdist_wininst.py', } +EXCLUDE_FILE_FROM_LIBS = { + 'ssleay', + 'libeay', + 'python3stub', +} + def is_not_debug(p): if DEBUG_RE.search(p.name): return False @@ -38,14 +55,7 @@ if TKTCL_RE.search(p.name): return False - return p.name.lower() not in { - '_ctypes_test.pyd', - '_testbuffer.pyd', - '_testcapi.pyd', - '_testimportmultiple.pyd', - '_testmultiphase.pyd', - 'xxlimited.pyd', - } + return p.stem.lower() not in DEBUG_FILES def is_not_debug_or_python(p): return is_not_debug(p) and not PYTHON_DLL_RE.search(p.name) @@ -69,6 +79,12 @@ suffix = p.suffix.lower() return suffix not in {'.pyc', '.pyo', '.exe'} +def include_in_libs(p): + if not is_not_debug(p): + return False + + return p.stem.lower() not in EXCLUDE_FILE_FROM_LIBS + def include_in_tools(p): if p.is_dir() and p.name.lower() in {'scripts', 'i18n', 'pynche', 'demo', 'parser'}: return True @@ -84,6 +100,7 @@ ('include/', 'include', '*.h', None), ('include/', 'PC', 'pyconfig.h', None), ('Lib/', 'Lib', '**/*', include_in_lib), + ('libs/', 'PCBuild/$arch', '*.lib', include_in_libs), ('Tools/', 'Tools', '**/*', include_in_tools), ] @@ -160,7 +177,7 @@ source = ns.source or (Path(__file__).resolve().parent.parent.parent) out = ns.out - arch = "" if ns.arch == "win32" else ns.arch + arch = '' if ns.arch == 'win32' else ns.arch assert isinstance(source, Path) assert not out or isinstance(out, Path) assert isinstance(arch, str) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 27 14:39:36 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Mon, 27 Jun 2016 18:39:36 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327352=3A_Correct_?= =?utf-8?q?the_validation_of_the_ImportFrom_AST_node_and_simplify?= Message-ID: <20160627183935.15809.46437.6717F786@psf.io> https://hg.python.org/cpython/rev/e3164c9edb0b changeset: 102216:e3164c9edb0b parent: 102214:aa1e1f7e17cc user: Serhiy Storchaka date: Mon Jun 27 21:39:12 2016 +0300 summary: Issue #27352: Correct the validation of the ImportFrom AST node and simplify the implementation of the IMPORT_NAME opcode. files: Python/ast.c | 4 ++-- Python/ceval.c | 10 +--------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Python/ast.c b/Python/ast.c --- a/Python/ast.c +++ b/Python/ast.c @@ -475,8 +475,8 @@ case Import_kind: return validate_nonempty_seq(stmt->v.Import.names, "names", "Import"); case ImportFrom_kind: - if (stmt->v.ImportFrom.level < -1) { - PyErr_SetString(PyExc_ValueError, "ImportFrom level less than -1"); + if (stmt->v.ImportFrom.level < 0) { + PyErr_SetString(PyExc_ValueError, "Negative ImportFrom level"); return 0; } return validate_nonempty_seq(stmt->v.ImportFrom.names, "names", "ImportFrom"); diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2820,21 +2820,13 @@ Py_INCREF(func); from = POP(); level = TOP(); - if (PyLong_AsLong(level) != -1 || PyErr_Occurred()) - args = PyTuple_Pack(5, + args = PyTuple_Pack(5, name, f->f_globals, f->f_locals == NULL ? Py_None : f->f_locals, from, level); - else - args = PyTuple_Pack(4, - name, - f->f_globals, - f->f_locals == NULL ? - Py_None : f->f_locals, - from); Py_DECREF(level); Py_DECREF(from); if (args == NULL) { -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 27 15:31:14 2016 From: python-checkins at python.org (steve.dower) Date: Mon, 27 Jun 2016 19:31:14 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Adds_script_fo?= =?utf-8?q?r_purging_the_caching_server_for_downloads_on_python=2Eorg=2E?= Message-ID: <20160627193112.126878.41936.22760749@psf.io> https://hg.python.org/cpython/rev/87440b63349b changeset: 102217:87440b63349b branch: 3.5 parent: 102213:2210765a2770 user: Steve Dower date: Mon Jun 27 12:30:48 2016 -0700 summary: Adds script for purging the caching server for downloads on python.org. files: Tools/msi/purge.py | 74 ++++++++++++++++++++++++++++++++++ 1 files changed, 74 insertions(+), 0 deletions(-) diff --git a/Tools/msi/purge.py b/Tools/msi/purge.py new file mode 100644 --- /dev/null +++ b/Tools/msi/purge.py @@ -0,0 +1,74 @@ +# Purges the Fastly cache for Windows download files +# +# Usage: +# py -3 purge.py 3.5.1rc1 +# + +__author__ = 'Steve Dower ' +__version__ = '1.0.0' + +import re +import sys + +from urllib.request import * + +VERSION_RE = re.compile(r'(\d+\.\d+\.\d+)(\w+\d+)?$') + +try: + m = VERSION_RE.match(sys.argv[1]) + if not m: + print('Invalid version:', sys.argv[1]) + print('Expected something like "3.5.1rc1"') + sys.exit(1) +except LookupError: + print('Missing version argument. Expected something like "3.5.1rc1"') + sys.exit(1) + +URL = "https://www.python.org/ftp/python/{}/".format(m.group(1)) + + +FILES = [ + "core.msi", + "core_d.msi", + "core_pdb.msi", + "dev.msi", + "dev_d.msi", + "doc.msi", + "exe.msi", + "exe_d.msi", + "exe_pdb.msi", + "launcher.msi", + "lib.msi", + "lib_d.msi", + "lib_pdb.msi", + "path.msi", + "pip.msi", + "tcltk.msi", + "tcltk_d.msi", + "tcltk_pdb.msi", + "test.msi", + "test_d.msi", + "test_pdb.msi", + "tools.msi", + "Windows6.0-KB2999226-x64.msu", + "Windows6.0-KB2999226-x86.msu", + "Windows6.1-KB2999226-x64.msu", + "Windows6.1-KB2999226-x86.msu", + "Windows8.1-KB2999226-x64.msu", + "Windows8.1-KB2999226-x86.msu", + "Windows8-RT-KB2999226-x64.msu", + "Windows8-RT-KB2999226-x86.msu", +] +PATHS = [ + "python-{}.exe".format(m.group(0)), + "python-{}-webinstall.exe".format(m.group(0)), + "python-{}-amd64.exe".format(m.group(0)), + "python-{}-amd64-webinstall.exe".format(m.group(0)), +] + ["win32{}/{}".format(m.group(2), f) for f in FILES] + ["amd64{}/{}".format(m.group(2), f) for f in FILES] + +print('Purged:') +for n in PATHS: + u = URL + n + with urlopen(Request(u, method='PURGE', headers={'Fastly-Soft-Purge': 1})) as r: + r.read() + print(' ', u) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 27 15:31:14 2016 From: python-checkins at python.org (steve.dower) Date: Mon, 27 Jun 2016 19:31:14 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5?= Message-ID: <20160627193113.52374.18753.652CB924@psf.io> https://hg.python.org/cpython/rev/2adb8af9fffd changeset: 102218:2adb8af9fffd parent: 102216:e3164c9edb0b parent: 102217:87440b63349b user: Steve Dower date: Mon Jun 27 12:31:00 2016 -0700 summary: Merge from 3.5 files: Tools/msi/purge.py | 74 ++++++++++++++++++++++++++++++++++ 1 files changed, 74 insertions(+), 0 deletions(-) diff --git a/Tools/msi/purge.py b/Tools/msi/purge.py new file mode 100644 --- /dev/null +++ b/Tools/msi/purge.py @@ -0,0 +1,74 @@ +# Purges the Fastly cache for Windows download files +# +# Usage: +# py -3 purge.py 3.5.1rc1 +# + +__author__ = 'Steve Dower ' +__version__ = '1.0.0' + +import re +import sys + +from urllib.request import * + +VERSION_RE = re.compile(r'(\d+\.\d+\.\d+)(\w+\d+)?$') + +try: + m = VERSION_RE.match(sys.argv[1]) + if not m: + print('Invalid version:', sys.argv[1]) + print('Expected something like "3.5.1rc1"') + sys.exit(1) +except LookupError: + print('Missing version argument. Expected something like "3.5.1rc1"') + sys.exit(1) + +URL = "https://www.python.org/ftp/python/{}/".format(m.group(1)) + + +FILES = [ + "core.msi", + "core_d.msi", + "core_pdb.msi", + "dev.msi", + "dev_d.msi", + "doc.msi", + "exe.msi", + "exe_d.msi", + "exe_pdb.msi", + "launcher.msi", + "lib.msi", + "lib_d.msi", + "lib_pdb.msi", + "path.msi", + "pip.msi", + "tcltk.msi", + "tcltk_d.msi", + "tcltk_pdb.msi", + "test.msi", + "test_d.msi", + "test_pdb.msi", + "tools.msi", + "Windows6.0-KB2999226-x64.msu", + "Windows6.0-KB2999226-x86.msu", + "Windows6.1-KB2999226-x64.msu", + "Windows6.1-KB2999226-x86.msu", + "Windows8.1-KB2999226-x64.msu", + "Windows8.1-KB2999226-x86.msu", + "Windows8-RT-KB2999226-x64.msu", + "Windows8-RT-KB2999226-x86.msu", +] +PATHS = [ + "python-{}.exe".format(m.group(0)), + "python-{}-webinstall.exe".format(m.group(0)), + "python-{}-amd64.exe".format(m.group(0)), + "python-{}-amd64-webinstall.exe".format(m.group(0)), +] + ["win32{}/{}".format(m.group(2), f) for f in FILES] + ["amd64{}/{}".format(m.group(2), f) for f in FILES] + +print('Purged:') +for n in PATHS: + u = URL + n + with urlopen(Request(u, method='PURGE', headers={'Fastly-Soft-Purge': 1})) as r: + r.read() + print(' ', u) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Jun 27 16:41:00 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Mon, 27 Jun 2016 20:41:00 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2327352=3A_Fixed_an?= =?utf-8?q?_error_message_in_a_test=2E?= Message-ID: <20160627204059.25604.84791.EC337F51@psf.io> https://hg.python.org/cpython/rev/e5063a82f490 changeset: 102219:e5063a82f490 user: Serhiy Storchaka date: Mon Jun 27 23:40:43 2016 +0300 summary: Issue #27352: Fixed an error message in a test. files: Lib/test/test_ast.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) 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 @@ -754,7 +754,7 @@ def test_importfrom(self): imp = ast.ImportFrom(None, [ast.alias("x", None)], -42) - self.stmt(imp, "level less than -1") + self.stmt(imp, "Negative ImportFrom level") self.stmt(ast.ImportFrom(None, [], 0), "empty names on ImportFrom") def test_global(self): -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Tue Jun 28 04:49:48 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 28 Jun 2016 09:49:48 +0100 Subject: [Python-checkins] BAD Benchmark Results for Python Default 2016-06-28 Message-ID: <16ba542c-31c7-4aaa-924c-cb4498d572d5@irsmsx101.ger.corp.intel.com> Results for project Python default, build date 2016-06-28 02:02:44 +0000 commit: e5063a82f490 previous commit: 447c20169c92 revision date: 2016-06-27 20:40:43 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.14% -2.85% 9.23% 18.09% :-| pybench 0.08% 0.21% 1.50% 8.33% :-( regex_v8 2.64% 0.12% -2.44% 3.55% :-| nbody 0.10% -0.43% -0.42% 11.03% :-( json_dump_v2 0.29% 0.09% -2.03% 11.58% :-| normal_startup 1.00% -0.12% 1.22% 5.98% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/bad-benchmark-results-for-python-default-2016-06-28/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Tue Jun 28 04:50:26 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 28 Jun 2016 09:50:26 +0100 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2016-06-28 Message-ID: <9e05c4a0-2d24-4230-ba47-393073618243@irsmsx101.ger.corp.intel.com> Results for project Python 2.7, build date 2016-06-28 02:46:41 +0000 commit: ccec979392d7 previous commit: e2d0d921d526 revision date: 2016-06-27 16:54:03 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.14% 0.11% 4.69% 3.86% :-) pybench 0.20% 0.10% 5.85% 4.18% :-( regex_v8 0.48% 0.01% -2.41% 11.07% :-) nbody 0.05% 0.03% 8.96% 3.00% :-) json_dump_v2 0.42% 0.81% 2.48% 11.78% :-( normal_startup 1.96% 0.23% -5.72% 1.43% :-| ssbench 0.17% 0.07% 2.00% 1.96% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-2-7-2016-06-28/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From solipsis at pitrou.net Tue Jun 28 04:51:41 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 28 Jun 2016 08:51:41 +0000 Subject: [Python-checkins] Daily reference leaks (e5063a82f490): sum=0 Message-ID: <20160628085141.28782.1598.7D66CF7D@psf.io> results for e5063a82f490 on branch "default" -------------------------------------------- test_collections leaked [0, -4, 0] memory blocks, sum=-4 test_functools leaked [0, 3, 1] memory blocks, sum=4 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogULT0eC', '--timeout', '7200'] From python-checkins at python.org Tue Jun 28 10:55:53 2016 From: python-checkins at python.org (yury.selivanov) Date: Tue, 28 Jun 2016 14:55:53 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_3=2E5_=28asyncio=29?= Message-ID: <20160628145553.110484.42434.D342F228@psf.io> https://hg.python.org/cpython/rev/a9b4da316283 changeset: 102221:a9b4da316283 parent: 102219:e5063a82f490 parent: 102220:100cf3f268ca user: Yury Selivanov date: Tue Jun 28 10:55:49 2016 -0400 summary: Merge 3.5 (asyncio) files: Lib/asyncio/sslproto.py | 1 + Lib/test/test_asyncio/test_sslproto.py | 16 ++++++++++++++ 2 files changed, 17 insertions(+), 0 deletions(-) diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py --- a/Lib/asyncio/sslproto.py +++ b/Lib/asyncio/sslproto.py @@ -5,6 +5,7 @@ except ImportError: # pragma: no cover ssl = None +from . import base_events from . import compat from . import protocols from . import transports diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py --- a/Lib/test/test_asyncio/test_sslproto.py +++ b/Lib/test/test_asyncio/test_sslproto.py @@ -1,5 +1,6 @@ """Tests for asyncio/sslproto.py.""" +import logging import unittest from unittest import mock try: @@ -8,6 +9,7 @@ ssl = None import asyncio +from asyncio import log from asyncio import sslproto from asyncio import test_utils @@ -66,6 +68,20 @@ test_utils.run_briefly(self.loop) self.assertIsInstance(waiter.exception(), ConnectionResetError) + def test_fatal_error_no_name_error(self): + # From issue #363. + # _fatal_error() generates a NameError if sslproto.py + # does not import base_events. + waiter = asyncio.Future(loop=self.loop) + ssl_proto = self.ssl_protocol(waiter) + # Temporarily turn off error logging so as not to spoil test output. + log_level = log.logger.getEffectiveLevel() + log.logger.setLevel(logging.FATAL) + try: + ssl_proto._fatal_error(None) + finally: + # Restore error logging. + log.logger.setLevel(log_level) if __name__ == '__main__': unittest.main() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 28 10:55:53 2016 From: python-checkins at python.org (yury.selivanov) Date: Tue, 28 Jun 2016 14:55:53 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogYXN5bmNpbzogRml4?= =?utf-8?q?_NameError_in_sslproto_=5Ffatal=5Ferror=28=29?= Message-ID: <20160628145552.116651.61502.194C1785@psf.io> https://hg.python.org/cpython/rev/100cf3f268ca changeset: 102220:100cf3f268ca branch: 3.5 parent: 102217:87440b63349b user: Yury Selivanov date: Tue Jun 28 10:55:36 2016 -0400 summary: asyncio: Fix NameError in sslproto _fatal_error() Patch by Richard Walker. files: Lib/asyncio/sslproto.py | 1 + Lib/test/test_asyncio/test_sslproto.py | 16 ++++++++++++++ 2 files changed, 17 insertions(+), 0 deletions(-) diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py --- a/Lib/asyncio/sslproto.py +++ b/Lib/asyncio/sslproto.py @@ -5,6 +5,7 @@ except ImportError: # pragma: no cover ssl = None +from . import base_events from . import compat from . import protocols from . import transports diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py --- a/Lib/test/test_asyncio/test_sslproto.py +++ b/Lib/test/test_asyncio/test_sslproto.py @@ -1,5 +1,6 @@ """Tests for asyncio/sslproto.py.""" +import logging import unittest from unittest import mock try: @@ -8,6 +9,7 @@ ssl = None import asyncio +from asyncio import log from asyncio import sslproto from asyncio import test_utils @@ -66,6 +68,20 @@ test_utils.run_briefly(self.loop) self.assertIsInstance(waiter.exception(), ConnectionResetError) + def test_fatal_error_no_name_error(self): + # From issue #363. + # _fatal_error() generates a NameError if sslproto.py + # does not import base_events. + waiter = asyncio.Future(loop=self.loop) + ssl_proto = self.ssl_protocol(waiter) + # Temporarily turn off error logging so as not to spoil test output. + log_level = log.logger.getEffectiveLevel() + log.logger.setLevel(logging.FATAL) + try: + ssl_proto._fatal_error(None) + finally: + # Restore error logging. + log.logger.setLevel(log_level) if __name__ == '__main__': unittest.main() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 28 11:01:46 2016 From: python-checkins at python.org (yury.selivanov) Date: Tue, 28 Jun 2016 15:01:46 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogYXN5bmNpbzogVXNl?= =?utf-8?q?_socket_specs_for_getaddrinfo=28=29_in_sock=5Fconnect=28=29?= Message-ID: <20160628150044.29019.33189.257A2935@psf.io> https://hg.python.org/cpython/rev/e6525c6ad789 changeset: 102222:e6525c6ad789 branch: 3.5 parent: 102220:100cf3f268ca user: Yury Selivanov date: Tue Jun 28 11:00:22 2016 -0400 summary: asyncio: Use socket specs for getaddrinfo() in sock_connect() Patch by Martin Richard. GH PR #365. files: Lib/asyncio/selector_events.py | 3 +- Lib/test/test_asyncio/test_selector_events.py | 11 ++++++++++ 2 files changed, 13 insertions(+), 1 deletions(-) diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -394,7 +394,8 @@ if hasattr(socket, 'AF_UNIX') and sock.family == socket.AF_UNIX: self._sock_connect(fut, sock, address) else: - resolved = base_events._ensure_resolved(address, loop=self) + resolved = base_events._ensure_resolved( + address, family=sock.family, proto=sock.proto, loop=self) resolved.add_done_callback( lambda resolved: self._on_resolved(fut, sock, resolved)) diff --git a/Lib/test/test_asyncio/test_selector_events.py b/Lib/test/test_asyncio/test_selector_events.py --- a/Lib/test/test_asyncio/test_selector_events.py +++ b/Lib/test/test_asyncio/test_selector_events.py @@ -373,6 +373,17 @@ self.loop.run_until_complete(fut) self.assertTrue(self.loop.remove_writer.called) + def test_sock_connect_resolve_using_socket_params(self): + addr = ('need-resolution.com', 8080) + sock = test_utils.mock_nonblocking_socket() + self.loop.getaddrinfo = mock.Mock() + self.loop.sock_connect(sock, addr) + while not self.loop.getaddrinfo.called: + self.loop._run_once() + self.loop.getaddrinfo.assert_called_with( + *addr, type=sock.type, family=sock.family, proto=sock.proto, + flags=0) + def test__sock_connect(self): f = asyncio.Future(loop=self.loop) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 28 11:01:46 2016 From: python-checkins at python.org (yury.selivanov) Date: Tue, 28 Jun 2016 15:01:46 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_3=2E5_=28asyncio=29?= Message-ID: <20160628150044.28980.94364.C73936BD@psf.io> https://hg.python.org/cpython/rev/d96c8b1154da changeset: 102223:d96c8b1154da parent: 102221:a9b4da316283 parent: 102222:e6525c6ad789 user: Yury Selivanov date: Tue Jun 28 11:00:39 2016 -0400 summary: Merge 3.5 (asyncio) files: Lib/asyncio/selector_events.py | 3 +- Lib/test/test_asyncio/test_selector_events.py | 11 ++++++++++ 2 files changed, 13 insertions(+), 1 deletions(-) diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -394,7 +394,8 @@ if hasattr(socket, 'AF_UNIX') and sock.family == socket.AF_UNIX: self._sock_connect(fut, sock, address) else: - resolved = base_events._ensure_resolved(address, loop=self) + resolved = base_events._ensure_resolved( + address, family=sock.family, proto=sock.proto, loop=self) resolved.add_done_callback( lambda resolved: self._on_resolved(fut, sock, resolved)) diff --git a/Lib/test/test_asyncio/test_selector_events.py b/Lib/test/test_asyncio/test_selector_events.py --- a/Lib/test/test_asyncio/test_selector_events.py +++ b/Lib/test/test_asyncio/test_selector_events.py @@ -373,6 +373,17 @@ self.loop.run_until_complete(fut) self.assertTrue(self.loop.remove_writer.called) + def test_sock_connect_resolve_using_socket_params(self): + addr = ('need-resolution.com', 8080) + sock = test_utils.mock_nonblocking_socket() + self.loop.getaddrinfo = mock.Mock() + self.loop.sock_connect(sock, addr) + while not self.loop.getaddrinfo.called: + self.loop._run_once() + self.loop.getaddrinfo.assert_called_with( + *addr, type=sock.type, family=sock.family, proto=sock.proto, + flags=0) + def test__sock_connect(self): f = asyncio.Future(loop=self.loop) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 28 13:13:11 2016 From: python-checkins at python.org (guido.van.rossum) Date: Tue, 28 Jun 2016 17:13:11 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Fix_issue_=2327402=3A_example_for_typing_did_not_type-ch?= =?utf-8?b?ZWNrLiAoTWVyZ2UgMy41LT4zLjYp?= Message-ID: <20160628171309.31474.46646.792BB8A6@psf.io> https://hg.python.org/cpython/rev/57f3514564f6 changeset: 102225:57f3514564f6 parent: 102223:d96c8b1154da parent: 102224:0aec17c8f434 user: Guido van Rossum date: Tue Jun 28 10:12:22 2016 -0700 summary: Fix issue #27402: example for typing did not type-check. (Merge 3.5->3.6) files: Doc/library/typing.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -427,8 +427,8 @@ def vec2(x: T, y: T) -> List[T]: return [x, y] - def slice__to_4(vector: Sequence[T]) -> List[T]: - return vector[0:4] + def keep_positives(vector: Sequence[T]) -> List[T]: + return [item for item in vector if item > 0] .. class:: Set(set, MutableSet[T]) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Jun 28 13:13:11 2016 From: python-checkins at python.org (guido.van.rossum) Date: Tue, 28 Jun 2016 17:13:11 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogRml4IGlzc3VlICMy?= =?utf-8?q?7402=3A_example_for_typing_did_not_type-check=2E?= Message-ID: <20160628171309.28729.68218.F68ADF73@psf.io> https://hg.python.org/cpython/rev/0aec17c8f434 changeset: 102224:0aec17c8f434 branch: 3.5 parent: 102222:e6525c6ad789 user: Guido van Rossum date: Tue Jun 28 10:08:17 2016 -0700 summary: Fix issue #27402: example for typing did not type-check. files: Doc/library/typing.rst | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -428,8 +428,8 @@ def vec2(x: T, y: T) -> List[T]: return [x, y] - def slice__to_4(vector: Sequence[T]) -> List[T]: - return vector[0:4] + def keep_positives(vector: Sequence[T]) -> List[T]: + return [item for item in vector if item > 0] .. class:: Set(set, MutableSet[T]) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Jun 29 06:36:48 2016 From: python-checkins at python.org (martin.panter) Date: Wed, 29 Jun 2016 10:36:48 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2326721=3A_Change_S?= =?utf-8?q?treamRequestHandler=2Ewfile_to_BufferedIOBase?= Message-ID: <20160629103648.14383.78499.1F969F18@psf.io> https://hg.python.org/cpython/rev/4ea79767ff75 changeset: 102226:4ea79767ff75 user: Martin Panter date: Wed Jun 29 10:12:22 2016 +0000 summary: Issue #26721: Change StreamRequestHandler.wfile to BufferedIOBase files: Doc/library/http.server.rst | 7 +- Doc/library/socketserver.rst | 9 ++ Doc/whatsnew/3.6.rst | 6 + Lib/socketserver.py | 24 ++++++- Lib/test/test_socketserver.py | 79 +++++++++++++++++++++++ Lib/wsgiref/simple_server.py | 17 +--- Misc/NEWS | 4 + 7 files changed, 131 insertions(+), 15 deletions(-) diff --git a/Doc/library/http.server.rst b/Doc/library/http.server.rst --- a/Doc/library/http.server.rst +++ b/Doc/library/http.server.rst @@ -98,8 +98,8 @@ .. attribute:: rfile - Contains an input stream, positioned at the start of the optional input - data. + An :class:`io.BufferedIOBase` input stream, ready to read from + the start of the optional input data. .. attribute:: wfile @@ -107,6 +107,9 @@ client. Proper adherence to the HTTP protocol must be used when writing to this stream. + .. versionchanged:: 3.6 + This is an :class:`io.BufferedIOBase` stream. + :class:`BaseHTTPRequestHandler` has the following attributes: .. attribute:: server_version diff --git a/Doc/library/socketserver.rst b/Doc/library/socketserver.rst --- a/Doc/library/socketserver.rst +++ b/Doc/library/socketserver.rst @@ -409,6 +409,15 @@ read or written, respectively, to get the request data or return data to the client. + The :attr:`rfile` attributes of both classes support the + :class:`io.BufferedIOBase` readable interface, and + :attr:`DatagramRequestHandler.wfile` supports the + :class:`io.BufferedIOBase` writable interface. + + .. versionchanged:: 3.6 + :attr:`StreamRequestHandler.wfile` also supports the + :class:`io.BufferedIOBase` writable interface. + Examples -------- diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst --- a/Doc/whatsnew/3.6.rst +++ b/Doc/whatsnew/3.6.rst @@ -373,6 +373,12 @@ protocol. (Contributed by Aviv Palivoda in :issue:`26404`.) +The :attr:`~socketserver.StreamRequestHandler.wfile` attribute of +:class:`~socketserver.StreamRequestHandler` classes now implements +the :class:`io.BufferedIOBase` writable interface. In particular, +calling :meth:`~io.BufferedIOBase.write` is now guaranteed to send the +data in full. (Contributed by Martin Panter in :issue:`26721`.) + subprocess ---------- diff --git a/Lib/socketserver.py b/Lib/socketserver.py --- a/Lib/socketserver.py +++ b/Lib/socketserver.py @@ -132,6 +132,7 @@ import threading except ImportError: import dummy_threading as threading +from io import BufferedIOBase from time import monotonic as time __all__ = ["BaseServer", "TCPServer", "UDPServer", @@ -743,7 +744,10 @@ self.connection.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, True) self.rfile = self.connection.makefile('rb', self.rbufsize) - self.wfile = self.connection.makefile('wb', self.wbufsize) + if self.wbufsize == 0: + self.wfile = _SocketWriter(self.connection) + else: + self.wfile = self.connection.makefile('wb', self.wbufsize) def finish(self): if not self.wfile.closed: @@ -756,6 +760,24 @@ self.wfile.close() self.rfile.close() +class _SocketWriter(BufferedIOBase): + """Simple writable BufferedIOBase implementation for a socket + + Does not hold data in a buffer, avoiding any need to call flush().""" + + def __init__(self, sock): + self._sock = sock + + def writable(self): + return True + + def write(self, b): + self._sock.sendall(b) + with memoryview(b) as view: + return view.nbytes + + def fileno(self): + return self._sock.fileno() class DatagramRequestHandler(BaseRequestHandler): diff --git a/Lib/test/test_socketserver.py b/Lib/test/test_socketserver.py --- a/Lib/test/test_socketserver.py +++ b/Lib/test/test_socketserver.py @@ -3,6 +3,7 @@ """ import contextlib +import io import os import select import signal @@ -376,6 +377,84 @@ self.active_children.clear() +class SocketWriterTest(unittest.TestCase): + def test_basics(self): + class Handler(socketserver.StreamRequestHandler): + def handle(self): + self.server.wfile = self.wfile + self.server.wfile_fileno = self.wfile.fileno() + self.server.request_fileno = self.request.fileno() + + server = socketserver.TCPServer((HOST, 0), Handler) + self.addCleanup(server.server_close) + s = socket.socket( + server.address_family, socket.SOCK_STREAM, socket.IPPROTO_TCP) + with s: + s.connect(server.server_address) + server.handle_request() + self.assertIsInstance(server.wfile, io.BufferedIOBase) + self.assertEqual(server.wfile_fileno, server.request_fileno) + + @unittest.skipUnless(threading, 'Threading required for this test.') + def test_write(self): + # Test that wfile.write() sends data immediately, and that it does + # not truncate sends when interrupted by a Unix signal + pthread_kill = test.support.get_attribute(signal, 'pthread_kill') + + class Handler(socketserver.StreamRequestHandler): + def handle(self): + self.server.sent1 = self.wfile.write(b'write data\n') + # Should be sent immediately, without requiring flush() + self.server.received = self.rfile.readline() + big_chunk = bytes(test.support.SOCK_MAX_SIZE) + self.server.sent2 = self.wfile.write(big_chunk) + + server = socketserver.TCPServer((HOST, 0), Handler) + self.addCleanup(server.server_close) + interrupted = threading.Event() + + def signal_handler(signum, frame): + interrupted.set() + + original = signal.signal(signal.SIGUSR1, signal_handler) + self.addCleanup(signal.signal, signal.SIGUSR1, original) + response1 = None + received2 = None + main_thread = threading.get_ident() + + def run_client(): + s = socket.socket(server.address_family, socket.SOCK_STREAM, + socket.IPPROTO_TCP) + with s, s.makefile('rb') as reader: + s.connect(server.server_address) + nonlocal response1 + response1 = reader.readline() + s.sendall(b'client response\n') + + reader.read(100) + # The main thread should now be blocking in a send() syscall. + # But in theory, it could get interrupted by other signals, + # and then retried. So keep sending the signal in a loop, in + # case an earlier signal happens to be delivered at an + # inconvenient moment. + while True: + pthread_kill(main_thread, signal.SIGUSR1) + if interrupted.wait(timeout=float(1)): + break + nonlocal received2 + received2 = len(reader.read()) + + background = threading.Thread(target=run_client) + background.start() + server.handle_request() + background.join() + self.assertEqual(server.sent1, len(response1)) + self.assertEqual(response1, b'write data\n') + self.assertEqual(server.received, b'client response\n') + self.assertEqual(server.sent2, test.support.SOCK_MAX_SIZE) + self.assertEqual(received2, test.support.SOCK_MAX_SIZE - 100) + + class MiscTestCase(unittest.TestCase): def test_all(self): diff --git a/Lib/wsgiref/simple_server.py b/Lib/wsgiref/simple_server.py --- a/Lib/wsgiref/simple_server.py +++ b/Lib/wsgiref/simple_server.py @@ -11,7 +11,6 @@ """ from http.server import BaseHTTPRequestHandler, HTTPServer -from io import BufferedWriter import sys import urllib.parse from wsgiref.handlers import SimpleHandler @@ -127,17 +126,11 @@ if not self.parse_request(): # An error code has been sent, just exit return - # Avoid passing the raw file object wfile, which can do partial - # writes (Issue 24291) - stdout = BufferedWriter(self.wfile) - try: - handler = ServerHandler( - self.rfile, stdout, self.get_stderr(), self.get_environ() - ) - handler.request_handler = self # backpointer for logging - handler.run(self.server.get_app()) - finally: - stdout.detach() + handler = ServerHandler( + self.rfile, self.wfile, self.get_stderr(), self.get_environ() + ) + handler.request_handler = self # backpointer for logging + handler.run(self.server.get_app()) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,10 @@ Library ------- +- Issue #26721: Change the socketserver.StreamRequestHandler.wfile attribute + to implement BufferedIOBase. In particular, the write() method no longer + does partial writes. + - Issue #22115: Added methods trace_add, trace_remove and trace_info in the tkinter.Variable class. They replace old methods trace_variable, trace, trace_vdelete and trace_vinfo that use obsolete Tcl commands and might -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Wed Jun 29 08:28:47 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 29 Jun 2016 13:28:47 +0100 Subject: [Python-checkins] GOOD Benchmark Results for Python Default 2016-06-29 Message-ID: <9b57fe1b-6a29-4a13-af8d-9ee1ce30a374@irsmsx151.ger.corp.intel.com> Results for project Python default, build date 2016-06-29 02:02:48 +0000 commit: 57f3514564f6 previous commit: e5063a82f490 revision date: 2016-06-28 17:12:22 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.22% 2.81% 11.78% 14.88% :-| pybench 0.08% 0.03% 1.53% 8.85% :-( regex_v8 2.66% -0.13% -2.58% 3.61% :-| nbody 0.09% -0.02% -0.44% 12.00% :-| json_dump_v2 0.32% 0.55% -1.48% 11.23% :-| normal_startup 0.73% 0.15% 1.60% 5.66% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/good-benchmark-results-for-python-default-2016-06-29/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Wed Jun 29 08:30:28 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 29 Jun 2016 13:30:28 +0100 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2016-06-29 Message-ID: <89fd9528-8b12-47d2-887e-c40cadeb71fd@irsmsx151.ger.corp.intel.com> No new revisions. Here are the previous results: Results for project Python 2.7, build date 2016-06-29 02:46:25 +0000 commit: ccec979392d7 previous commit: e2d0d921d526 revision date: 2016-06-27 16:54:03 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.14% 0.11% 4.69% 3.86% :-) pybench 0.20% 0.10% 5.85% 4.18% :-( regex_v8 0.48% 0.01% -2.41% 11.07% :-) nbody 0.05% 0.03% 8.96% 3.00% :-) json_dump_v2 0.42% 0.81% 2.48% 11.78% :-( normal_startup 1.96% 0.23% -5.72% 1.43% :-| ssbench 0.17% 0.07% 2.00% 1.96% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-2-7-2016-06-29/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Thu Jun 30 03:35:08 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 30 Jun 2016 07:35:08 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3NDE4?= =?utf-8?q?=3A_Fixed_Tools/importbench/importbench=2Epy=2E?= Message-ID: <20160630073508.13842.17070.88D66850@psf.io> https://hg.python.org/cpython/rev/ba4548916f05 changeset: 102227:ba4548916f05 branch: 3.5 parent: 102224:0aec17c8f434 user: Serhiy Storchaka date: Thu Jun 30 10:33:17 2016 +0300 summary: Issue #27418: Fixed Tools/importbench/importbench.py. files: Misc/NEWS | 5 +++++ Tools/importbench/importbench.py | 13 ++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -72,6 +72,11 @@ - Issue #26754: PyUnicode_FSDecoder() accepted a filename argument encoded as an iterable of integers. Now only strings and bytes-like objects are accepted. +Tools/Demos +----------- + +- Issue #27418: Fixed Tools/importbench/importbench.py. + What's New in Python 3.5.2? =========================== diff --git a/Tools/importbench/importbench.py b/Tools/importbench/importbench.py --- a/Tools/importbench/importbench.py +++ b/Tools/importbench/importbench.py @@ -5,7 +5,6 @@ """ from test.test_importlib import util -from test.test_importlib.source import util as source_util import decimal import imp import importlib @@ -65,11 +64,11 @@ try: name = '__importlib_test_benchmark__' # Clears out sys.modules and puts an entry at the front of sys.path. - with source_util.create_modules(name) as mapping: + with util.create_modules(name) as mapping: assert not os.path.exists(imp.cache_from_source(mapping[name])) sys.meta_path.append(importlib.machinery.PathFinder) loader = (importlib.machinery.SourceFileLoader, - importlib.machinery.SOURCE_SUFFIXES, True) + importlib.machinery.SOURCE_SUFFIXES) sys.path_hooks.append(importlib.machinery.FileFinder.path_hook(loader)) yield from bench(name, lambda: sys.modules.pop(name), repeat=repeat, seconds=seconds) @@ -102,10 +101,10 @@ """Source writing bytecode: small""" assert not sys.dont_write_bytecode name = '__importlib_test_benchmark__' - with source_util.create_modules(name) as mapping: + with util.create_modules(name) as mapping: sys.meta_path.append(importlib.machinery.PathFinder) loader = (importlib.machinery.SourceFileLoader, - importlib.machinery.SOURCE_SUFFIXES, True) + importlib.machinery.SOURCE_SUFFIXES) sys.path_hooks.append(importlib.machinery.FileFinder.path_hook(loader)) def cleanup(): sys.modules.pop(name) @@ -136,10 +135,10 @@ def source_using_bytecode(seconds, repeat): """Source w/ bytecode: small""" name = '__importlib_test_benchmark__' - with source_util.create_modules(name) as mapping: + with util.create_modules(name) as mapping: sys.meta_path.append(importlib.machinery.PathFinder) loader = (importlib.machinery.SourceFileLoader, - importlib.machinery.SOURCE_SUFFIXES, True) + importlib.machinery.SOURCE_SUFFIXES) sys.path_hooks.append(importlib.machinery.FileFinder.path_hook(loader)) py_compile.compile(mapping[name]) assert os.path.exists(imp.cache_from_source(mapping[name])) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 30 03:35:08 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 30 Jun 2016 07:35:08 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327418=3A_Fixed_Tools/importbench/importbench=2E?= =?utf-8?b?cHku?= Message-ID: <20160630073508.90902.11595.C3A5F7F7@psf.io> https://hg.python.org/cpython/rev/c2e898813409 changeset: 102228:c2e898813409 parent: 102226:4ea79767ff75 parent: 102227:ba4548916f05 user: Serhiy Storchaka date: Thu Jun 30 10:34:52 2016 +0300 summary: Issue #27418: Fixed Tools/importbench/importbench.py. files: Misc/NEWS | 5 +++++ Tools/importbench/importbench.py | 13 ++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -125,6 +125,11 @@ - Don't use largefile support for GNU/Hurd. +Tools/Demos +----------- + +- Issue #27418: Fixed Tools/importbench/importbench.py. + What's New in Python 3.6.0 alpha 2 ================================== diff --git a/Tools/importbench/importbench.py b/Tools/importbench/importbench.py --- a/Tools/importbench/importbench.py +++ b/Tools/importbench/importbench.py @@ -5,7 +5,6 @@ """ from test.test_importlib import util -from test.test_importlib.source import util as source_util import decimal import imp import importlib @@ -65,11 +64,11 @@ try: name = '__importlib_test_benchmark__' # Clears out sys.modules and puts an entry at the front of sys.path. - with source_util.create_modules(name) as mapping: + with util.create_modules(name) as mapping: assert not os.path.exists(imp.cache_from_source(mapping[name])) sys.meta_path.append(importlib.machinery.PathFinder) loader = (importlib.machinery.SourceFileLoader, - importlib.machinery.SOURCE_SUFFIXES, True) + importlib.machinery.SOURCE_SUFFIXES) sys.path_hooks.append(importlib.machinery.FileFinder.path_hook(loader)) yield from bench(name, lambda: sys.modules.pop(name), repeat=repeat, seconds=seconds) @@ -102,10 +101,10 @@ """Source writing bytecode: small""" assert not sys.dont_write_bytecode name = '__importlib_test_benchmark__' - with source_util.create_modules(name) as mapping: + with util.create_modules(name) as mapping: sys.meta_path.append(importlib.machinery.PathFinder) loader = (importlib.machinery.SourceFileLoader, - importlib.machinery.SOURCE_SUFFIXES, True) + importlib.machinery.SOURCE_SUFFIXES) sys.path_hooks.append(importlib.machinery.FileFinder.path_hook(loader)) def cleanup(): sys.modules.pop(name) @@ -136,10 +135,10 @@ def source_using_bytecode(seconds, repeat): """Source w/ bytecode: small""" name = '__importlib_test_benchmark__' - with source_util.create_modules(name) as mapping: + with util.create_modules(name) as mapping: sys.meta_path.append(importlib.machinery.PathFinder) loader = (importlib.machinery.SourceFileLoader, - importlib.machinery.SOURCE_SUFFIXES, True) + importlib.machinery.SOURCE_SUFFIXES) sys.path_hooks.append(importlib.machinery.FileFinder.path_hook(loader)) py_compile.compile(mapping[name]) assert os.path.exists(imp.cache_from_source(mapping[name])) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 30 05:51:06 2016 From: python-checkins at python.org (victor.stinner) Date: Thu, 30 Jun 2016 09:51:06 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI3NDE2?= =?utf-8?q?=3A_clarify_copy_doc?= Message-ID: <20160630095105.7636.74880.51E10017@psf.io> https://hg.python.org/cpython/rev/9efe0e718914 changeset: 102229:9efe0e718914 branch: 2.7 parent: 102215:ccec979392d7 user: Victor Stinner date: Thu Jun 30 11:50:23 2016 +0200 summary: Issue #27416: clarify copy doc Patch written by R. David Murray. files: Doc/library/copy.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/copy.rst b/Doc/library/copy.rst --- a/Doc/library/copy.rst +++ b/Doc/library/copy.rst @@ -44,7 +44,7 @@ reference to themselves) may cause a recursive loop. * Because deep copy copies *everything* it may copy too much, e.g., - administrative data structures that should be shared even between copies. + even administrative data structures that should be shared even between copies. The :func:`deepcopy` function avoids these problems by: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 30 05:51:06 2016 From: python-checkins at python.org (victor.stinner) Date: Thu, 30 Jun 2016 09:51:06 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy41IChjb3B5IGRvYyk=?= Message-ID: <20160630095106.17702.29040.29DBE291@psf.io> https://hg.python.org/cpython/rev/8fdf6804614e changeset: 102231:8fdf6804614e parent: 102228:c2e898813409 parent: 102230:54e9ca0a1639 user: Victor Stinner date: Thu Jun 30 11:50:59 2016 +0200 summary: Merge 3.5 (copy doc) files: Doc/library/copy.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/copy.rst b/Doc/library/copy.rst --- a/Doc/library/copy.rst +++ b/Doc/library/copy.rst @@ -48,7 +48,7 @@ reference to themselves) may cause a recursive loop. * Because deep copy copies *everything* it may copy too much, e.g., - administrative data structures that should be shared even between copies. + even administrative data structures that should be shared even between copies. The :func:`deepcopy` function avoids these problems by: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 30 05:51:09 2016 From: python-checkins at python.org (victor.stinner) Date: Thu, 30 Jun 2016 09:51:09 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3NDE2?= =?utf-8?q?=3A_clarify_copy_doc?= Message-ID: <20160630095106.90801.20360.87528EC4@psf.io> https://hg.python.org/cpython/rev/54e9ca0a1639 changeset: 102230:54e9ca0a1639 branch: 3.5 parent: 102227:ba4548916f05 user: Victor Stinner date: Thu Jun 30 11:50:23 2016 +0200 summary: Issue #27416: clarify copy doc Patch written by R. David Murray. files: Doc/library/copy.rst | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Doc/library/copy.rst b/Doc/library/copy.rst --- a/Doc/library/copy.rst +++ b/Doc/library/copy.rst @@ -48,7 +48,7 @@ reference to themselves) may cause a recursive loop. * Because deep copy copies *everything* it may copy too much, e.g., - administrative data structures that should be shared even between copies. + even administrative data structures that should be shared even between copies. The :func:`deepcopy` function avoids these problems by: -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Thu Jun 30 05:59:45 2016 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 30 Jun 2016 09:59:45 +0000 Subject: [Python-checkins] Daily reference leaks (4ea79767ff75): sum=3 Message-ID: <20160630095945.21831.78621.1D378389@psf.io> results for 4ea79767ff75 on branch "default" -------------------------------------------- test_collections leaked [-4, 0, 4] memory blocks, sum=0 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [1, 0, -2] memory blocks, sum=-1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogzLIrQ2', '--timeout', '7200'] From python-checkins at python.org Thu Jun 30 07:03:42 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 30 Jun 2016 11:03:42 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Issue_=234945=3A_Improved_the_documenting_of_boolean_arg?= =?utf-8?q?uments_in_the_json_module=2E?= Message-ID: <20160630110341.7553.36952.8B228B5F@psf.io> https://hg.python.org/cpython/rev/f2d1dba10a0e changeset: 102234:f2d1dba10a0e parent: 102231:8fdf6804614e parent: 102233:324b061ce220 user: Serhiy Storchaka date: Thu Jun 30 14:03:21 2016 +0300 summary: Issue #4945: Improved the documenting of boolean arguments in the json module. Based on patch by Gabriel Genellina. files: Doc/library/json.rst | 48 +++++++++++++++++-------------- Lib/json/__init__.py | 4 +- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/Doc/library/json.rst b/Doc/library/json.rst --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -102,7 +102,7 @@ .. highlight:: bash -Using json.tool from the shell to validate and pretty-print:: +Using :mod:`json.tool` from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -m json.tool { @@ -135,7 +135,7 @@ :term:`file-like object`) using this :ref:`conversion table `. - If *skipkeys* is ``True`` (default: ``False``), then dict keys that are not + If *skipkeys* is true (default: ``False``), then dict keys that are not of a basic type (:class:`str`, :class:`int`, :class:`float`, :class:`bool`, ``None``) will be skipped instead of raising a :exc:`TypeError`. @@ -143,18 +143,19 @@ :class:`bytes` objects. Therefore, ``fp.write()`` must support :class:`str` input. - If *ensure_ascii* is ``True`` (the default), the output is guaranteed to + If *ensure_ascii* is true (the default), the output is guaranteed to have all incoming non-ASCII characters escaped. If *ensure_ascii* is - ``False``, these characters will be output as-is. + false, these characters will be output as-is. - If *check_circular* is ``False`` (default: ``True``), then the circular + If *check_circular* is false (default: ``True``), then the circular reference check for container types will be skipped and a circular reference will result in an :exc:`OverflowError` (or worse). - If *allow_nan* is ``False`` (default: ``True``), then it will be a + If *allow_nan* is false (default: ``True``), then it will be a :exc:`ValueError` to serialize out of range :class:`float` values (``nan``, - ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of - using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). + ``inf``, ``-inf``) in strict compliance of the JSON specification. + If *allow_nan* is true, their JavaScript equivalents (``NaN``, + ``Infinity``, ``-Infinity``) will be used. If *indent* is a non-negative integer or string, then JSON array elements and object members will be pretty-printed with that indent level. An indent level @@ -174,10 +175,12 @@ .. versionchanged:: 3.4 Use ``(',', ': ')`` as default if *indent* is not ``None``. - *default(obj)* is a function that should return a serializable version of - *obj* or raise :exc:`TypeError`. The default simply raises :exc:`TypeError`. + If specified, *default* should be a function that gets called for objects that + can't otherwise be serialized. It should return a JSON encodable version of + the object or raise a :exc:`TypeError`. If not specified, :exc:`TypeError` + is raised. - If *sort_keys* is ``True`` (default: ``False``), then the output of + If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom :class:`JSONEncoder` subclass (e.g. one that overrides the @@ -339,7 +342,7 @@ ``'false'``. This can be used to raise an exception if invalid JSON numbers are encountered. - If *strict* is ``False`` (``True`` is the default), then control characters + If *strict* is false (``True`` is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ``'\t'`` (tab), ``'\n'``, ``'\r'`` and ``'\0'``. @@ -402,26 +405,26 @@ for ``o`` if possible, otherwise it should call the superclass implementation (to raise :exc:`TypeError`). - If *skipkeys* is ``False`` (the default), then it is a :exc:`TypeError` to + If *skipkeys* is false (the default), then it is a :exc:`TypeError` to attempt encoding of keys that are not str, int, float or None. If - *skipkeys* is ``True``, such items are simply skipped. + *skipkeys* is true, such items are simply skipped. - If *ensure_ascii* is ``True`` (the default), the output is guaranteed to + If *ensure_ascii* is true (the default), the output is guaranteed to have all incoming non-ASCII characters escaped. If *ensure_ascii* is - ``False``, these characters will be output as-is. + false, these characters will be output as-is. - If *check_circular* is ``True`` (the default), then lists, dicts, and custom + If *check_circular* is true (the default), then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an :exc:`OverflowError`). Otherwise, no such check takes place. - If *allow_nan* is ``True`` (the default), then ``NaN``, ``Infinity``, and + If *allow_nan* is true (the default), then ``NaN``, ``Infinity``, and ``-Infinity`` will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a :exc:`ValueError` to encode such floats. - If *sort_keys* is ``True`` (default ``False``), then the output of dictionaries + If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. @@ -443,9 +446,10 @@ .. versionchanged:: 3.4 Use ``(',', ': ')`` as default if *indent* is not ``None``. - If specified, *default* is a function that gets called for objects that can't - otherwise be serialized. It should return a JSON encodable version of the - object or raise a :exc:`TypeError`. + If specified, *default* should be a function that gets called for objects that + can't otherwise be serialized. It should return a JSON encodable version of + the object or raise a :exc:`TypeError`. If not specified, :exc:`TypeError` + is raised. .. versionchanged:: 3.6 All parameters are now :ref:`keyword-only `. diff --git a/Lib/json/__init__.py b/Lib/json/__init__.py --- a/Lib/json/__init__.py +++ b/Lib/json/__init__.py @@ -152,7 +152,7 @@ ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. - If *sort_keys* is ``True`` (default: ``False``), then the output of + If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the @@ -214,7 +214,7 @@ ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. - If *sort_keys* is ``True`` (default: ``False``), then the output of + If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 30 07:03:42 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 30 Jun 2016 11:03:42 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzQ5NDU6?= =?utf-8?q?_Improved_the_documenting_of_boolean_arguments_in_the_json_modu?= =?utf-8?b?bGUu?= Message-ID: <20160630110341.18012.88163.47E7A556@psf.io> https://hg.python.org/cpython/rev/8f1d3ebdbc56 changeset: 102232:8f1d3ebdbc56 branch: 2.7 parent: 102229:9efe0e718914 user: Serhiy Storchaka date: Thu Jun 30 13:58:58 2016 +0300 summary: Issue #4945: Improved the documenting of boolean arguments in the json module. Based on patch by Gabriel Genellina. files: Doc/library/json.rst | 60 +++++++++++++++++-------------- Lib/json/__init__.py | 6 +- 2 files changed, 35 insertions(+), 31 deletions(-) diff --git a/Doc/library/json.rst b/Doc/library/json.rst --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -99,9 +99,9 @@ .. highlight:: none -Using json.tool from the shell to validate and pretty-print:: +Using :mod:`json.tool` from the shell to validate and pretty-print:: - $ echo '{"json":"obj"}' | python -mjson.tool + $ echo '{"json":"obj"}' | python -m json.tool { "json": "obj" } @@ -130,28 +130,29 @@ :term:`file-like object`) using this :ref:`conversion table `. - If *skipkeys* is ``True`` (default: ``False``), then dict keys that are not + If *skipkeys* is true (default: ``False``), then dict keys that are not of a basic type (:class:`str`, :class:`unicode`, :class:`int`, :class:`long`, :class:`float`, :class:`bool`, ``None``) will be skipped instead of raising a :exc:`TypeError`. - If *ensure_ascii* is ``True`` (the default), all non-ASCII characters in the + If *ensure_ascii* is true (the default), all non-ASCII characters in the output are escaped with ``\uXXXX`` sequences, and the result is a :class:`str` instance consisting of ASCII characters only. If - *ensure_ascii* is ``False``, some chunks written to *fp* may be + *ensure_ascii* is false, some chunks written to *fp* may be :class:`unicode` instances. This usually happens because the input contains unicode strings or the *encoding* parameter is used. Unless ``fp.write()`` explicitly understands :class:`unicode` (as in :func:`codecs.getwriter`) this is likely to cause an error. - If *check_circular* is ``False`` (default: ``True``), then the circular + If *check_circular* is false (default: ``True``), then the circular reference check for container types will be skipped and a circular reference will result in an :exc:`OverflowError` (or worse). - If *allow_nan* is ``False`` (default: ``True``), then it will be a + If *allow_nan* is false (default: ``True``), then it will be a :exc:`ValueError` to serialize out of range :class:`float` values (``nan``, - ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of - using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). + ``inf``, ``-inf``) in strict compliance of the JSON specification. + If *allow_nan* is true, their JavaScript equivalents (``NaN``, + ``Infinity``, ``-Infinity``) will be used. If *indent* is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0, @@ -164,16 +165,18 @@ trailing whitespace when *indent* is specified. You can use ``separators=(',', ': ')`` to avoid this. - If *separators* is an ``(item_separator, dict_separator)`` tuple, then it - will be used instead of the default ``(', ', ': ')`` separators. ``(',', - ':')`` is the most compact JSON representation. + If specified, *separators* should be an ``(item_separator, key_separator)`` + tuple. By default, ``(', ', ': ')`` are used. To get the most compact JSON + representation, you should specify ``(',', ':')`` to eliminate whitespace. *encoding* is the character encoding for str instances, default is UTF-8. - *default(obj)* is a function that should return a serializable version of - *obj* or raise :exc:`TypeError`. The default simply raises :exc:`TypeError`. + If specified, *default* should be a function that gets called for objects that + can't otherwise be serialized. It should return a JSON encodable version of + the object or raise a :exc:`TypeError`. If not specified, :exc:`TypeError` + is raised. - If *sort_keys* is ``True`` (default: ``False``), then the output of + If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom :class:`JSONEncoder` subclass (e.g. one that overrides the @@ -192,7 +195,7 @@ default=None, sort_keys=False, **kw) Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion - table `. If *ensure_ascii* is ``False``, the result may + table `. If *ensure_ascii* is false, the result may contain non-ASCII characters and the return value may be a :class:`unicode` instance. @@ -345,7 +348,7 @@ ``'false'``. This can be used to raise an exception if invalid JSON numbers are encountered. - If *strict* is ``False`` (``True`` is the default), then control characters + If *strict* is false (``True`` is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ``'\t'`` (tab), ``'\n'``, ``'\r'`` and ``'\0'``. @@ -399,29 +402,29 @@ for ``o`` if possible, otherwise it should call the superclass implementation (to raise :exc:`TypeError`). - If *skipkeys* is ``False`` (the default), then it is a :exc:`TypeError` to + If *skipkeys* is false (the default), then it is a :exc:`TypeError` to attempt encoding of keys that are not str, int, long, float or None. If - *skipkeys* is ``True``, such items are simply skipped. + *skipkeys* is true, such items are simply skipped. - If *ensure_ascii* is ``True`` (the default), all non-ASCII characters in the + If *ensure_ascii* is true (the default), all non-ASCII characters in the output are escaped with ``\uXXXX`` sequences, and the results are :class:`str` instances consisting of ASCII characters only. If - *ensure_ascii* is ``False``, a result may be a :class:`unicode` + *ensure_ascii* is false, a result may be a :class:`unicode` instance. This usually happens if the input contains unicode strings or the *encoding* parameter is used. - If *check_circular* is ``True`` (the default), then lists, dicts, and custom + If *check_circular* is true (the default), then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an :exc:`OverflowError`). Otherwise, no such check takes place. - If *allow_nan* is ``True`` (the default), then ``NaN``, ``Infinity``, and + If *allow_nan* is true (the default), then ``NaN``, ``Infinity``, and ``-Infinity`` will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a :exc:`ValueError` to encode such floats. - If *sort_keys* is ``True`` (default ``False``), then the output of dictionaries + If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. @@ -437,12 +440,13 @@ ``separators=(',', ': ')`` to avoid this. If specified, *separators* should be an ``(item_separator, key_separator)`` - tuple. The default is ``(', ', ': ')``. To get the most compact JSON + tuple. By default, ``(', ', ': ')`` are used. To get the most compact JSON representation, you should specify ``(',', ':')`` to eliminate whitespace. - If specified, *default* is a function that gets called for objects that can't - otherwise be serialized. It should return a JSON encodable version of the - object or raise a :exc:`TypeError`. + If specified, *default* should be a function that gets called for objects that + can't otherwise be serialized. It should return a JSON encodable version of + the object or raise a :exc:`TypeError`. If not specified, :exc:`TypeError` + is raised. If *encoding* is not ``None``, then all input strings will be transformed into unicode using that encoding prior to JSON-encoding. The default is diff --git a/Lib/json/__init__.py b/Lib/json/__init__.py --- a/Lib/json/__init__.py +++ b/Lib/json/__init__.py @@ -132,7 +132,7 @@ If ``ensure_ascii`` is true (the default), all non-ASCII characters in the output are escaped with ``\uXXXX`` sequences, and the result is a ``str`` instance consisting of ASCII characters only. If ``ensure_ascii`` is - ``False``, some chunks written to ``fp`` may be ``unicode`` instances. + false, some chunks written to ``fp`` may be ``unicode`` instances. This usually happens because the input contains unicode strings or the ``encoding`` parameter is used. Unless ``fp.write()`` explicitly understands ``unicode`` (as in ``codecs.getwriter``) this is likely to @@ -163,7 +163,7 @@ ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. - If *sort_keys* is ``True`` (default: ``False``), then the output of + If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the @@ -228,7 +228,7 @@ ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. - If *sort_keys* is ``True`` (default: ``False``), then the output of + If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 30 07:03:47 2016 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 30 Jun 2016 11:03:47 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzQ5NDU6?= =?utf-8?q?_Improved_the_documenting_of_boolean_arguments_in_the_json_modu?= =?utf-8?b?bGUu?= Message-ID: <20160630110341.124399.57505.8ED880BA@psf.io> https://hg.python.org/cpython/rev/324b061ce220 changeset: 102233:324b061ce220 branch: 3.5 parent: 102230:54e9ca0a1639 user: Serhiy Storchaka date: Thu Jun 30 13:59:12 2016 +0300 summary: Issue #4945: Improved the documenting of boolean arguments in the json module. Based on patch by Gabriel Genellina. files: Doc/library/json.rst | 48 +++++++++++++++++-------------- Lib/json/__init__.py | 4 +- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/Doc/library/json.rst b/Doc/library/json.rst --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -102,7 +102,7 @@ .. highlight:: bash -Using json.tool from the shell to validate and pretty-print:: +Using :mod:`json.tool` from the shell to validate and pretty-print:: $ echo '{"json":"obj"}' | python -m json.tool { @@ -135,7 +135,7 @@ :term:`file-like object`) using this :ref:`conversion table `. - If *skipkeys* is ``True`` (default: ``False``), then dict keys that are not + If *skipkeys* is true (default: ``False``), then dict keys that are not of a basic type (:class:`str`, :class:`int`, :class:`float`, :class:`bool`, ``None``) will be skipped instead of raising a :exc:`TypeError`. @@ -143,18 +143,19 @@ :class:`bytes` objects. Therefore, ``fp.write()`` must support :class:`str` input. - If *ensure_ascii* is ``True`` (the default), the output is guaranteed to + If *ensure_ascii* is true (the default), the output is guaranteed to have all incoming non-ASCII characters escaped. If *ensure_ascii* is - ``False``, these characters will be output as-is. + false, these characters will be output as-is. - If *check_circular* is ``False`` (default: ``True``), then the circular + If *check_circular* is false (default: ``True``), then the circular reference check for container types will be skipped and a circular reference will result in an :exc:`OverflowError` (or worse). - If *allow_nan* is ``False`` (default: ``True``), then it will be a + If *allow_nan* is false (default: ``True``), then it will be a :exc:`ValueError` to serialize out of range :class:`float` values (``nan``, - ``inf``, ``-inf``) in strict compliance of the JSON specification, instead of - using the JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). + ``inf``, ``-inf``) in strict compliance of the JSON specification. + If *allow_nan* is true, their JavaScript equivalents (``NaN``, + ``Infinity``, ``-Infinity``) will be used. If *indent* is a non-negative integer or string, then JSON array elements and object members will be pretty-printed with that indent level. An indent level @@ -174,10 +175,12 @@ .. versionchanged:: 3.4 Use ``(',', ': ')`` as default if *indent* is not ``None``. - *default(obj)* is a function that should return a serializable version of - *obj* or raise :exc:`TypeError`. The default simply raises :exc:`TypeError`. + If specified, *default* should be a function that gets called for objects that + can't otherwise be serialized. It should return a JSON encodable version of + the object or raise a :exc:`TypeError`. If not specified, :exc:`TypeError` + is raised. - If *sort_keys* is ``True`` (default: ``False``), then the output of + If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom :class:`JSONEncoder` subclass (e.g. one that overrides the @@ -333,7 +336,7 @@ ``'false'``. This can be used to raise an exception if invalid JSON numbers are encountered. - If *strict* is ``False`` (``True`` is the default), then control characters + If *strict* is false (``True`` is the default), then control characters will be allowed inside strings. Control characters in this context are those with character codes in the 0-31 range, including ``'\t'`` (tab), ``'\n'``, ``'\r'`` and ``'\0'``. @@ -393,26 +396,26 @@ for ``o`` if possible, otherwise it should call the superclass implementation (to raise :exc:`TypeError`). - If *skipkeys* is ``False`` (the default), then it is a :exc:`TypeError` to + If *skipkeys* is false (the default), then it is a :exc:`TypeError` to attempt encoding of keys that are not str, int, float or None. If - *skipkeys* is ``True``, such items are simply skipped. + *skipkeys* is true, such items are simply skipped. - If *ensure_ascii* is ``True`` (the default), the output is guaranteed to + If *ensure_ascii* is true (the default), the output is guaranteed to have all incoming non-ASCII characters escaped. If *ensure_ascii* is - ``False``, these characters will be output as-is. + false, these characters will be output as-is. - If *check_circular* is ``True`` (the default), then lists, dicts, and custom + If *check_circular* is true (the default), then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an :exc:`OverflowError`). Otherwise, no such check takes place. - If *allow_nan* is ``True`` (the default), then ``NaN``, ``Infinity``, and + If *allow_nan* is true (the default), then ``NaN``, ``Infinity``, and ``-Infinity`` will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a :exc:`ValueError` to encode such floats. - If *sort_keys* is ``True`` (default ``False``), then the output of dictionaries + If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. @@ -434,9 +437,10 @@ .. versionchanged:: 3.4 Use ``(',', ': ')`` as default if *indent* is not ``None``. - If specified, *default* is a function that gets called for objects that can't - otherwise be serialized. It should return a JSON encodable version of the - object or raise a :exc:`TypeError`. + If specified, *default* should be a function that gets called for objects that + can't otherwise be serialized. It should return a JSON encodable version of + the object or raise a :exc:`TypeError`. If not specified, :exc:`TypeError` + is raised. .. method:: default(o) diff --git a/Lib/json/__init__.py b/Lib/json/__init__.py --- a/Lib/json/__init__.py +++ b/Lib/json/__init__.py @@ -152,7 +152,7 @@ ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. - If *sort_keys* is ``True`` (default: ``False``), then the output of + If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the @@ -214,7 +214,7 @@ ``default(obj)`` is a function that should return a serializable version of obj or raise TypeError. The default simply raises TypeError. - If *sort_keys* is ``True`` (default: ``False``), then the output of + If *sort_keys* is true (default: ``False``), then the output of dictionaries will be sorted by key. To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Thu Jun 30 09:24:42 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 30 Jun 2016 14:24:42 +0100 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python Default 2016-06-30 Message-ID: <3fa39d22-9fd5-4b3a-8606-950b0c33f199@irsmsx153.ger.corp.intel.com> Results for project Python default, build date 2016-06-30 02:03:04 +0000 commit: 4ea79767ff75 previous commit: 57f3514564f6 revision date: 2016-06-29 10:12:22 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v3.4.3, with hash b4cbecbc0781 from 2015-02-25 12:15:33+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.15% -0.97% 10.93% 14.83% :-| pybench 0.17% 0.00% 1.53% 8.23% :-( regex_v8 2.65% 0.08% -2.50% 3.59% :-| nbody 0.10% -0.44% -0.89% 8.77% :-| json_dump_v2 0.43% 0.00% -1.47% 11.13% :-| normal_startup 0.91% -0.16% 1.56% 5.88% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-default-2016-06-30/ Note: Benchmark results are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From lp_benchmark_robot at intel.com Thu Jun 30 09:25:06 2016 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 30 Jun 2016 14:25:06 +0100 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2016-06-30 Message-ID: <6e0f4acb-7a9b-4321-9034-0389cb9a44ef@irsmsx153.ger.corp.intel.com> No new revisions. Here are the previous results: Results for project Python 2.7, build date 2016-06-30 02:47:12 +0000 commit: ccec979392d7 previous commit: e2d0d921d526 revision date: 2016-06-27 16:54:03 +0000 environment: Haswell-EP cpu: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz 2x18 cores, stepping 2, LLC 45 MB mem: 128 GB os: CentOS 7.1 kernel: Linux 3.10.0-229.4.2.el7.x86_64 Baseline results were generated using release v2.7.10, with hash 15c95b7d81dc from 2015-05-23 16:02:14+00:00 ---------------------------------------------------------------------------------- benchmark relative change since change since current rev run std_dev* last run baseline with PGO ---------------------------------------------------------------------------------- :-) django_v2 0.14% 0.11% 4.69% 3.86% :-) pybench 0.20% 0.10% 5.85% 4.18% :-( regex_v8 0.48% 0.01% -2.41% 11.07% :-) nbody 0.05% 0.03% 8.96% 3.00% :-) json_dump_v2 0.42% 0.81% 2.48% 11.78% :-( normal_startup 1.96% 0.23% -5.72% 1.43% :-| ssbench 0.17% 0.07% 2.00% 1.96% ---------------------------------------------------------------------------------- * Relative Standard Deviation (Standard Deviation/Average) If this is not displayed properly please visit our results page here: http://languagesperformance.intel.com/neutral-benchmark-results-for-python-2-7-2016-06-30/ Note: Benchmark results for ssbench are measured in requests/second while all other are measured in seconds. Subject Label Legend: Attributes are determined based on the performance evolution of the workloads compared to the previous measurement iteration. NEUTRAL: performance did not change by more than 1% for any workload GOOD: performance improved by more than 1% for at least one workload and there is no regression greater than 1% BAD: performance dropped by more than 1% for at least one workload and there is no improvement greater than 1% UGLY: performance improved by more than 1% for at least one workload and also dropped by more than 1% for at least one workload Our lab does a nightly source pull and build of the Python project and measures performance changes against the previous stable version and the previous nightly measurement. This is provided as a service to the community so that quality issues with current hardware can be identified quickly. Intel technologies' features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. From python-checkins at python.org Thu Jun 30 14:43:31 2016 From: python-checkins at python.org (brett.cannon) Date: Thu, 30 Jun 2016 18:43:31 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E5_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E5_for_issue_=2326664?= Message-ID: <20160630184331.63004.99262.FD3BD19E@psf.io> https://hg.python.org/cpython/rev/8d7bde14d7a4 changeset: 102236:8d7bde14d7a4 parent: 102234:f2d1dba10a0e parent: 102235:4fc0154ec84a user: Brett Cannon date: Thu Jun 30 11:43:19 2016 -0700 summary: Merge from 3.5 for issue #26664 files: Lib/venv/scripts/posix/activate.fish | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/venv/scripts/posix/activate.fish b/Lib/venv/scripts/posix/activate.fish --- a/Lib/venv/scripts/posix/activate.fish +++ b/Lib/venv/scripts/posix/activate.fish @@ -55,8 +55,8 @@ # with the original prompt function renamed, we can override with our own. function fish_prompt # Prompt override? - if test -n "$__VENV_PROMPT__" - printf "%s%s%s" "$__VENV_PROMPT__" (set_color normal) (_old_fish_prompt) + if test -n "__VENV_PROMPT__" + printf "%s%s%s" "__VENV_PROMPT__" (set_color normal) (_old_fish_prompt) return end # ...Otherwise, prepend env -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Jun 30 14:43:31 2016 From: python-checkins at python.org (brett.cannon) Date: Thu, 30 Jun 2016 18:43:31 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI2NjY1?= =?utf-8?q?=3A_Remove_mis-use_of_=60=60=24=60=60_in_activate=2Efish=2E?= Message-ID: <20160630184331.24426.6675.481FCAF7@psf.io> https://hg.python.org/cpython/rev/4fc0154ec84a changeset: 102235:4fc0154ec84a branch: 3.5 parent: 102233:324b061ce220 user: Brett Cannon date: Thu Jun 30 11:41:55 2016 -0700 summary: Issue #26665: Remove mis-use of ``$`` in activate.fish. This is a revertion of cfc66e37eb8e. Thanks to ??? for the bug report. Thanks to Tin Tvrtkovi?, Xiang Zhang, and Dan McCombs for diagnosing the issue. files: Lib/venv/scripts/posix/activate.fish | 4 ++-- Misc/NEWS | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Lib/venv/scripts/posix/activate.fish b/Lib/venv/scripts/posix/activate.fish --- a/Lib/venv/scripts/posix/activate.fish +++ b/Lib/venv/scripts/posix/activate.fish @@ -55,8 +55,8 @@ # with the original prompt function renamed, we can override with our own. function fish_prompt # Prompt override? - if test -n "$__VENV_PROMPT__" - printf "%s%s%s" "$__VENV_PROMPT__" (set_color normal) (_old_fish_prompt) + if test -n "__VENV_PROMPT__" + printf "%s%s%s" "__VENV_PROMPT__" (set_color normal) (_old_fish_prompt) return end # ...Otherwise, prepend env diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -13,6 +13,8 @@ Library ------- +- Issue #26664: Fix activate.fish by removing mis-use of ``$``. + - Issue #22115: Fixed tracing Tkinter variables: trace_vdelete() with wrong mode no longer break tracing, trace_vinfo() now always returns a list of pairs of strings, tracing in the "u" mode now works. -- Repository URL: https://hg.python.org/cpython