From python-checkins at python.org Wed Feb 1 02:31:29 2017 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 01 Feb 2017 07:31:29 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogbWVyZ2UgMy42ICgjMjkzOTgp?= Message-ID: <20170201073128.8335.26718.626442FA@psf.io> https://hg.python.org/cpython/rev/0e8c13da4f32 changeset: 106358:0e8c13da4f32 parent: 106355:19c4528f53b0 parent: 106357:b0463c5073fc user: Benjamin Peterson date: Tue Jan 31 23:31:20 2017 -0800 summary: merge 3.6 (#29398) files: Modules/xxlimited.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/xxlimited.c b/Modules/xxlimited.c --- a/Modules/xxlimited.c +++ b/Modules/xxlimited.c @@ -31,7 +31,7 @@ newXxoObject(PyObject *arg) { XxoObject *self; - self = PyObject_New(XxoObject, (PyTypeObject*)Xxo_Type); + self = PyObject_GC_New(XxoObject, (PyTypeObject*)Xxo_Type); if (self == NULL) return NULL; self->x_attr = NULL; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Feb 1 02:31:29 2017 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 01 Feb 2017 07:31:29 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_gc_types_needs?= =?utf-8?q?_to_be_allocated_as_such_=28closes_=2329398=29?= Message-ID: <20170201073128.127873.74828.ED93F207@psf.io> https://hg.python.org/cpython/rev/167beb21b527 changeset: 106356:167beb21b527 branch: 3.5 parent: 106351:c8c1f08428cb user: Benjamin Peterson date: Tue Jan 31 23:31:02 2017 -0800 summary: gc types needs to be allocated as such (closes #29398) files: Modules/xxlimited.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/xxlimited.c b/Modules/xxlimited.c --- a/Modules/xxlimited.c +++ b/Modules/xxlimited.c @@ -31,7 +31,7 @@ newXxoObject(PyObject *arg) { XxoObject *self; - self = PyObject_New(XxoObject, (PyTypeObject*)Xxo_Type); + self = PyObject_GC_New(XxoObject, (PyTypeObject*)Xxo_Type); if (self == NULL) return NULL; self->x_attr = NULL; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Feb 1 02:31:29 2017 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 01 Feb 2017 07:31:29 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_merge_3=2E5_=28=2329398=29?= Message-ID: <20170201073128.96227.43923.8D16348C@psf.io> https://hg.python.org/cpython/rev/b0463c5073fc changeset: 106357:b0463c5073fc branch: 3.6 parent: 106352:ccbd5c11c7fd parent: 106356:167beb21b527 user: Benjamin Peterson date: Tue Jan 31 23:31:10 2017 -0800 summary: merge 3.5 (#29398) files: Modules/xxlimited.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/xxlimited.c b/Modules/xxlimited.c --- a/Modules/xxlimited.c +++ b/Modules/xxlimited.c @@ -31,7 +31,7 @@ newXxoObject(PyObject *arg) { XxoObject *self; - self = PyObject_New(XxoObject, (PyTypeObject*)Xxo_Type); + self = PyObject_GC_New(XxoObject, (PyTypeObject*)Xxo_Type); if (self == NULL) return NULL; self->x_attr = NULL; -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Wed Feb 1 04:29:58 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 01 Feb 2017 09:29:58 +0000 Subject: [Python-checkins] Daily reference leaks (19c4528f53b0): sum=7 Message-ID: <20170201092958.128105.18782.A15C4131@psf.io> results for 19c4528f53b0 on branch "default" -------------------------------------------- test_asyncio leaked [0, 3, 0] memory blocks, sum=3 test_collections leaked [0, 7, -7] 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/reflogGbS1_0', '--timeout', '7200'] From python-checkins at python.org Wed Feb 1 07:02:28 2017 From: python-checkins at python.org (matthias.klose) Date: Wed, 01 Feb 2017 12:02:28 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Merge_3=2E5?= Message-ID: <20170201120228.15872.73143.473F6053@psf.io> https://hg.python.org/cpython/rev/a19ce80e9fa3 changeset: 106360:a19ce80e9fa3 branch: 3.6 parent: 106357:b0463c5073fc parent: 106359:7b279c263708 user: doko at ubuntu.com date: Wed Feb 01 13:01:54 2017 +0100 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 @@ -50,7 +50,7 @@ Extension Modules ----------------- -- Issue #29169: Update zlib to 1.2.10. +- Issue #29169: Update zlib to 1.2.11. Library ------- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Feb 1 07:02:28 2017 From: python-checkins at python.org (matthias.klose) Date: Wed, 01 Feb 2017 12:02:28 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MTY5?= =?utf-8?q?=3A_Fix_NEWS_entry=2E?= Message-ID: <20170201120227.110531.16617.C14EA325@psf.io> https://hg.python.org/cpython/rev/7b279c263708 changeset: 106359:7b279c263708 branch: 3.5 parent: 106356:167beb21b527 user: doko at ubuntu.com date: Wed Feb 01 13:01:17 2017 +0100 summary: Issue #29169: Fix 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 @@ -16,7 +16,7 @@ Extension Modules ----------------- -- Issue #29169: Update zlib to 1.2.10. +- Issue #29169: Update zlib to 1.2.11. Library ------- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Feb 1 07:02:28 2017 From: python-checkins at python.org (matthias.klose) Date: Wed, 01 Feb 2017 12:02:28 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy42?= Message-ID: <20170201120228.128501.88868.61C941F8@psf.io> https://hg.python.org/cpython/rev/59e193171472 changeset: 106361:59e193171472 parent: 106358:0e8c13da4f32 parent: 106360:a19ce80e9fa3 user: doko at ubuntu.com date: Wed Feb 01 13:02:16 2017 +0100 summary: Merge 3.6 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 @@ -218,7 +218,7 @@ Extension Modules ----------------- -- Issue #29169: Update zlib to 1.2.10. +- Issue #29169: Update zlib to 1.2.11. Library ------- -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Feb 1 10:30:08 2017 From: python-checkins at python.org (victor.stinner) Date: Wed, 01 Feb 2017 15:30:08 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_python-gdb=2Epy_supports_m?= =?utf-8?q?ethod-wrapper?= Message-ID: <20170201153006.25393.59811.BD6A6ADB@psf.io> https://hg.python.org/cpython/rev/54fa95b19fae changeset: 106362:54fa95b19fae user: Victor Stinner date: Wed Feb 01 16:29:54 2017 +0100 summary: python-gdb.py supports method-wrapper Issue #29367: python-gdb.py now supports also method-wrapper (wrapperobject) objects. files: Lib/test/test_gdb.py | 21 +++++++++++- Misc/NEWS | 3 + Tools/gdb/libpython.py | 53 +++++++++++++++++++++++++++-- 3 files changed, 71 insertions(+), 6 deletions(-) diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py --- a/Lib/test/test_gdb.py +++ b/Lib/test/test_gdb.py @@ -3,13 +3,14 @@ # The code for testing gdb was adapted from similar work in Unladen Swallow's # Lib/test/test_jit_gdb.py +import locale import os import re import subprocess import sys import sysconfig +import textwrap import unittest -import locale # Is this Python configured to support threads? try: @@ -847,6 +848,24 @@ ) self.assertIn('#1 ' + + def safe_tp_name(self): + try: + return self.field('self')['ob_type']['tp_name'].string() + except (NullPyObjectPtr, RuntimeError): + return '' + + def safe_self_addresss(self): + try: + address = long(self.field('self')) + return '%#x' % address + except (NullPyObjectPtr, RuntimeError): + return '' + + def proxyval(self, visited): + name = self.safe_name() + tp_name = self.safe_tp_name() + self_address = self.safe_self_addresss() + return ("" + % (name, tp_name, self_address)) + + def write_repr(self, out, visited): + proxy = self.proxyval(visited) + out.write(proxy) def int_from_int(gdbval): @@ -1364,11 +1398,13 @@ def pretty_printer_lookup(gdbval): type = gdbval.type.unqualified() - if type.code == gdb.TYPE_CODE_PTR: - type = type.target().unqualified() - t = str(type) - if t in ("PyObject", "PyFrameObject", "PyUnicodeObject"): - return PyObjectPtrPrinter(gdbval) + if type.code != gdb.TYPE_CODE_PTR: + return None + + type = type.target().unqualified() + t = str(type) + if t in ("PyObject", "PyFrameObject", "PyUnicodeObject", "wrapperobject"): + return PyObjectPtrPrinter(gdbval) """ During development, I've been manually invoking the code in this way: @@ -1520,6 +1556,13 @@ except RuntimeError: return 'PyCFunction invocation (unable to read %s)' % arg_name + if caller == 'wrapper_call': + try: + func = frame.read_var('wp') + return str(func) + except RuntimeError: + return '' + # This frame isn't worth reporting: return False -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Feb 1 11:00:54 2017 From: python-checkins at python.org (victor.stinner) Date: Wed, 01 Feb 2017 16:00:54 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Make_test=5Fgdb=2Etest=5Fw?= =?utf-8?q?rapper=5Fcall=28=29_make_reliable?= Message-ID: <20170201160051.26437.95528.3A4A541A@psf.io> https://hg.python.org/cpython/rev/ffd2e5f9256a changeset: 106363:ffd2e5f9256a user: Victor Stinner date: Wed Feb 01 17:00:32 2017 +0100 summary: Make test_gdb.test_wrapper_call() make reliable Issue #29367. Use two break points to prevent breakpoint during Python initialization. files: Lib/test/test_gdb.py | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py --- a/Lib/test/test_gdb.py +++ b/Lib/test/test_gdb.py @@ -856,13 +856,12 @@ def __init__(self): super().__init__() # wrapper_call() + id("first break point") l = MyList() ''') # Verify with "py-bt": gdb_output = self.get_stack_trace(cmd, - breakpoint='wrapper_call', - cmds_after_breakpoint=['py-bt'], - ) + cmds_after_breakpoint=['break wrapper_call', 'continue', 'py-bt']) self.assertIn(" https://hg.python.org/cpython/rev/fcba9c9d987b changeset: 106364:fcba9c9d987b user: Victor Stinner date: Wed Feb 01 17:04:52 2017 +0100 summary: Document that _PyFunction_FastCallDict() must copy kwargs Issue #29318: Caller and callee functions must not share the dictionary: kwargs must be copied. files: Python/ceval.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -5039,6 +5039,8 @@ if (nk != 0) { Py_ssize_t pos, i; + /* Issue #29318: Caller and callee functions must not share the + dictionary: kwargs must be copied. */ kwtuple = PyTuple_New(2 * nk); if (kwtuple == NULL) { return NULL; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Feb 1 11:42:51 2017 From: python-checkins at python.org (victor.stinner) Date: Wed, 01 Feb 2017 16:42:51 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2329286=3A_Rename_p?= =?utf-8?q?rivate_PyArg=5FUnpackStack=5Fimpl=28=29_to_unpack=5Fstack=28=29?= Message-ID: <20170201164251.16582.71131.0830FB76@psf.io> https://hg.python.org/cpython/rev/758674087b12 changeset: 106365:758674087b12 user: Victor Stinner date: Wed Feb 01 17:42:18 2017 +0100 summary: Issue #29286: Rename private PyArg_UnpackStack_impl() to unpack_stack() Rename also "l" argument to "nargs". files: Python/getargs.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Python/getargs.c b/Python/getargs.c --- a/Python/getargs.c +++ b/Python/getargs.c @@ -2352,8 +2352,8 @@ static int -PyArg_UnpackStack_impl(PyObject **args, Py_ssize_t l, const char *name, - Py_ssize_t min, Py_ssize_t max, va_list vargs) +unpack_stack(PyObject **args, Py_ssize_t nargs, const char *name, + Py_ssize_t min, Py_ssize_t max, va_list vargs) { Py_ssize_t i; PyObject **o; @@ -2361,41 +2361,41 @@ assert(min >= 0); assert(min <= max); - if (l < min) { + if (nargs < min) { if (name != NULL) PyErr_Format( PyExc_TypeError, "%s expected %s%zd arguments, got %zd", - name, (min == max ? "" : "at least "), min, l); + name, (min == max ? "" : "at least "), min, nargs); else PyErr_Format( PyExc_TypeError, "unpacked tuple should have %s%zd elements," " but has %zd", - (min == max ? "" : "at least "), min, l); + (min == max ? "" : "at least "), min, nargs); return 0; } - if (l == 0) { + if (nargs == 0) { return 1; } - if (l > max) { + if (nargs > max) { if (name != NULL) PyErr_Format( PyExc_TypeError, "%s expected %s%zd arguments, got %zd", - name, (min == max ? "" : "at most "), max, l); + name, (min == max ? "" : "at most "), max, nargs); else PyErr_Format( PyExc_TypeError, "unpacked tuple should have %s%zd elements," " but has %zd", - (min == max ? "" : "at most "), max, l); + (min == max ? "" : "at most "), max, nargs); return 0; } - for (i = 0; i < l; i++) { + for (i = 0; i < nargs; i++) { o = va_arg(vargs, PyObject **); *o = args[i]; } @@ -2423,7 +2423,7 @@ #else va_start(vargs); #endif - retval = PyArg_UnpackStack_impl(stack, nargs, name, min, max, vargs); + retval = unpack_stack(stack, nargs, name, min, max, vargs); va_end(vargs); return retval; } @@ -2440,7 +2440,7 @@ #else va_start(vargs); #endif - retval = PyArg_UnpackStack_impl(args, nargs, name, min, max, vargs); + retval = unpack_stack(args, nargs, name, min, max, vargs); va_end(vargs); return retval; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Feb 1 12:26:53 2017 From: python-checkins at python.org (victor.stinner) Date: Wed, 01 Feb 2017 17:26:53 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fix_test=5Fgdb=2Etest=5Fwr?= =?utf-8?q?apper=5Fcall=28=29_on_Python_2?= Message-ID: <20170201172649.110161.49960.A12DCFEE@psf.io> https://hg.python.org/cpython/rev/efaf32ac89ec changeset: 106366:efaf32ac89ec user: Victor Stinner date: Wed Feb 01 18:26:14 2017 +0100 summary: Fix test_gdb.test_wrapper_call() on Python 2 Issue #29367. On Python 2, __init__ name is render as u'__init__'. files: Lib/test/test_gdb.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py --- a/Lib/test/test_gdb.py +++ b/Lib/test/test_gdb.py @@ -862,8 +862,8 @@ # Verify with "py-bt": gdb_output = self.get_stack_trace(cmd, cmds_after_breakpoint=['break wrapper_call', 'continue', 'py-bt']) - self.assertIn(" https://hg.python.org/test/rev/7d222e3424b8 changeset: 240:7d222e3424b8 user: Mariatta Wijaya date: Wed Feb 01 10:36:19 2017 -0800 summary: works? files: mw.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/mw.py b/mw.py --- a/mw.py +++ b/mw.py @@ -1,2 +1,2 @@ print("foobar") -print("booya") +#print("booya") -- Repository URL: https://hg.python.org/test From python-checkins at python.org Wed Feb 1 14:05:57 2017 From: python-checkins at python.org (guido.van.rossum) Date: Wed, 01 Feb 2017 19:05:57 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2329377=3A_Add_thre?= =?utf-8?q?e_new_wrappers_to_types=2Epy_=28Manuel_Krebber=29=2E?= Message-ID: <20170201190557.25874.20040.7BC8A915@psf.io> https://hg.python.org/cpython/rev/3db1959c2c53 changeset: 106367:3db1959c2c53 user: Guido van Rossum date: Wed Feb 01 10:55:58 2017 -0800 summary: Issue #29377: Add three new wrappers to types.py (Manuel Krebber). files: Doc/library/types.rst | 23 +++++++++++++++++++++++ Lib/test/test_types.py | 18 ++++++++++++++++++ Lib/types.py | 4 ++++ Misc/NEWS | 4 ++++ 4 files changed, 49 insertions(+), 0 deletions(-) diff --git a/Doc/library/types.rst b/Doc/library/types.rst --- a/Doc/library/types.rst +++ b/Doc/library/types.rst @@ -132,6 +132,29 @@ C".) +.. data:: SlotWrapperType + + The type of methods of some built-in data types and base classes such as + :meth:`object.__init__` or :meth:`object.__lt__`. + + .. versionadded:: 3.7 + + +.. data:: MethodWrapperType + + The type of *bound* methods of some built-in data types and base classes. + For example it is the type of :code:`object().__str__`. + + .. versionadded:: 3.7 + + +.. data:: MethodDescriptorType + + The type of methods of some built-in data types such as :meth:`str.join`. + + .. versionadded:: 3.7 + + .. class:: ModuleType(name, doc=None) The type of :term:`modules `. Constructor takes the name of the diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py --- a/Lib/test/test_types.py +++ b/Lib/test/test_types.py @@ -576,6 +576,24 @@ self.assertGreater(object.__basicsize__, 0) self.assertGreater(tuple.__itemsize__, 0) + def test_slot_wrapper_types(self): + self.assertIsInstance(object.__init__, types.SlotWrapperType) + self.assertIsInstance(object.__str__, types.SlotWrapperType) + self.assertIsInstance(object.__lt__, types.SlotWrapperType) + self.assertIsInstance(int.__lt__, types.SlotWrapperType) + + def test_method_wrapper_types(self): + self.assertIsInstance(object().__init__, types.MethodWrapperType) + self.assertIsInstance(object().__str__, types.MethodWrapperType) + self.assertIsInstance(object().__lt__, types.MethodWrapperType) + self.assertIsInstance((42).__lt__, types.MethodWrapperType) + + def test_method_descriptor_types(self): + self.assertIsInstance(str.join, types.MethodDescriptorType) + self.assertIsInstance(list.append, types.MethodDescriptorType) + self.assertIsInstance(''.join, types.BuiltinMethodType) + self.assertIsInstance([].append, types.BuiltinMethodType) + class MappingProxyTests(unittest.TestCase): mappingproxy = types.MappingProxyType diff --git a/Lib/types.py b/Lib/types.py --- a/Lib/types.py +++ b/Lib/types.py @@ -36,6 +36,10 @@ BuiltinFunctionType = type(len) BuiltinMethodType = type([].append) # Same as BuiltinFunctionType +SlotWrapperType = type(object.__init__) +MethodWrapperType = type(object().__str__) +MethodDescriptorType = type(str.join) + ModuleType = type(sys) try: diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -223,6 +223,10 @@ Library ------- +- Issue #29377: Add SlotWrapperType, MethodWrapperType, and + MethodDescriptorType built-in types to types module. + Original patch by Manuel Krebber. + - Issue #29218: Unused install_misc command is now removed. It has been documented as unused since 2000. Patch by Eric N. Vander Weele. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Feb 1 14:33:22 2017 From: python-checkins at python.org (berker.peksag) Date: Wed, 01 Feb 2017 19:33:22 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5NDA3?= =?utf-8?q?=3A_Remove_redundant_ensure=5Ffuture=28=29_calls_in_factorial_e?= =?utf-8?q?xample?= Message-ID: <20170201193322.96659.93825.46F685D0@psf.io> https://hg.python.org/cpython/rev/e4f6874abda6 changeset: 106368:e4f6874abda6 branch: 3.5 parent: 106359:7b279c263708 user: Berker Peksag date: Wed Feb 01 22:37:16 2017 +0300 summary: Issue #29407: Remove redundant ensure_future() calls in factorial example files: Doc/library/asyncio-task.rst | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 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 @@ -472,21 +472,20 @@ import asyncio - @asyncio.coroutine - def factorial(name, number): + async def factorial(name, number): f = 1 for i in range(2, number+1): print("Task %s: Compute factorial(%s)..." % (name, i)) - yield from asyncio.sleep(1) + await asyncio.sleep(1) f *= i print("Task %s: factorial(%s) = %s" % (name, number, f)) loop = asyncio.get_event_loop() - tasks = [ - asyncio.ensure_future(factorial("A", 2)), - asyncio.ensure_future(factorial("B", 3)), - asyncio.ensure_future(factorial("C", 4))] - loop.run_until_complete(asyncio.gather(*tasks)) + loop.run_until_complete(asyncio.gather( + factorial("A", 2), + factorial("B", 3), + factorial("C", 4), + )) loop.close() Output:: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Feb 1 14:33:23 2017 From: python-checkins at python.org (berker.peksag) Date: Wed, 01 Feb 2017 19:33:23 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329407=3A_Merge_from_3=2E5?= Message-ID: <20170201193322.7901.18006.6FC33030@psf.io> https://hg.python.org/cpython/rev/7196ab02b7ce changeset: 106369:7196ab02b7ce branch: 3.6 parent: 106360:a19ce80e9fa3 parent: 106368:e4f6874abda6 user: Berker Peksag date: Wed Feb 01 22:37:49 2017 +0300 summary: Issue #29407: Merge from 3.5 files: Doc/library/asyncio-task.rst | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 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 @@ -472,21 +472,20 @@ import asyncio - @asyncio.coroutine - def factorial(name, number): + async def factorial(name, number): f = 1 for i in range(2, number+1): print("Task %s: Compute factorial(%s)..." % (name, i)) - yield from asyncio.sleep(1) + await asyncio.sleep(1) f *= i print("Task %s: factorial(%s) = %s" % (name, number, f)) loop = asyncio.get_event_loop() - tasks = [ - asyncio.ensure_future(factorial("A", 2)), - asyncio.ensure_future(factorial("B", 3)), - asyncio.ensure_future(factorial("C", 4))] - loop.run_until_complete(asyncio.gather(*tasks)) + loop.run_until_complete(asyncio.gather( + factorial("A", 2), + factorial("B", 3), + factorial("C", 4), + )) loop.close() Output:: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Feb 1 14:33:23 2017 From: python-checkins at python.org (berker.peksag) Date: Wed, 01 Feb 2017 19:33:23 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2329407=3A_Merge_from_3=2E6?= Message-ID: <20170201193322.7901.71635.79B59A01@psf.io> https://hg.python.org/cpython/rev/0990a071751f changeset: 106370:0990a071751f parent: 106367:3db1959c2c53 parent: 106369:7196ab02b7ce user: Berker Peksag date: Wed Feb 01 22:38:12 2017 +0300 summary: Issue #29407: Merge from 3.6 files: Doc/library/asyncio-task.rst | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 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 @@ -472,21 +472,20 @@ import asyncio - @asyncio.coroutine - def factorial(name, number): + async def factorial(name, number): f = 1 for i in range(2, number+1): print("Task %s: Compute factorial(%s)..." % (name, i)) - yield from asyncio.sleep(1) + await asyncio.sleep(1) f *= i print("Task %s: factorial(%s) = %s" % (name, number, f)) loop = asyncio.get_event_loop() - tasks = [ - asyncio.ensure_future(factorial("A", 2)), - asyncio.ensure_future(factorial("B", 3)), - asyncio.ensure_future(factorial("C", 4))] - loop.run_until_complete(asyncio.gather(*tasks)) + loop.run_until_complete(asyncio.gather( + factorial("A", 2), + factorial("B", 3), + factorial("C", 4), + )) loop.close() Output:: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Feb 1 15:54:52 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 01 Feb 2017 20:54:52 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI5MDI4?= =?utf-8?q?=3A_Fixed_possible_use-after-free_bugs_in_the_subscription_of_t?= =?utf-8?q?he?= Message-ID: <20170201205451.110885.39439.3821331B@psf.io> https://hg.python.org/cpython/rev/8cfa6d3065b3 changeset: 106371:8cfa6d3065b3 branch: 2.7 parent: 106354:51e7c9b54f56 user: Serhiy Storchaka date: Wed Feb 01 22:47:44 2017 +0200 summary: Issue #29028: Fixed possible use-after-free bugs in the subscription of the buffer object with custom index object. files: Misc/NEWS | 3 + Objects/bufferobject.c | 77 ++++++++++++++++++----------- 2 files changed, 51 insertions(+), 29 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #29028: Fixed possible use-after-free bugs in the subscription of the + buffer object with custom index object. + - Issue #29145: Fix overflow checks in string, bytearray and unicode. Patch by jan matejek and Xiang Zhang. diff --git a/Objects/bufferobject.c b/Objects/bufferobject.c --- a/Objects/bufferobject.c +++ b/Objects/bufferobject.c @@ -462,17 +462,23 @@ } static PyObject * +buffer_item_impl(void *ptr, Py_ssize_t size, Py_ssize_t idx) +{ + if ( idx < 0 || idx >= size ) { + PyErr_SetString(PyExc_IndexError, "buffer index out of range"); + return NULL; + } + return PyString_FromStringAndSize((char *)ptr + idx, 1); +} + +static PyObject * buffer_item(PyBufferObject *self, Py_ssize_t idx) { void *ptr; Py_ssize_t size; if (!get_buf(self, &ptr, &size, ANY_BUFFER)) return NULL; - if ( idx < 0 || idx >= size ) { - PyErr_SetString(PyExc_IndexError, "buffer index out of range"); - return NULL; - } - return PyString_FromStringAndSize((char *)ptr + idx, 1); + return buffer_item_impl(ptr, size, idx); } static PyObject * @@ -500,24 +506,27 @@ void *p; Py_ssize_t size; - if (!get_buf(self, &p, &size, ANY_BUFFER)) - return NULL; if (PyIndex_Check(item)) { Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError); if (i == -1 && PyErr_Occurred()) return NULL; - if (i < 0) + if (!get_buf(self, &p, &size, ANY_BUFFER)) + return NULL; + + if (i < 0) { i += size; - return buffer_item(self, i); + } + return buffer_item_impl(p, size, i); } else if (PySlice_Check(item)) { Py_ssize_t start, stop, step, slicelength, cur, i; - if (PySlice_GetIndicesEx((PySliceObject*)item, size, - &start, &stop, &step, &slicelength) < 0) { + if (_PySlice_Unpack(item, &start, &stop, &step) < 0) return NULL; - } + if (!get_buf(self, &p, &size, ANY_BUFFER)) + return NULL; + slicelength = _PySlice_AdjustIndices(size, &start, &stop, step); if (slicelength <= 0) return PyString_FromStringAndSize("", 0); else if (step == 1) @@ -550,22 +559,12 @@ } static int -buffer_ass_item(PyBufferObject *self, Py_ssize_t idx, PyObject *other) +buffer_ass_item_impl(void *ptr1, Py_ssize_t size, Py_ssize_t idx, PyObject *other) { PyBufferProcs *pb; - void *ptr1, *ptr2; - Py_ssize_t size; + void *ptr2; Py_ssize_t count; - if ( self->b_readonly ) { - PyErr_SetString(PyExc_TypeError, - "buffer is read-only"); - return -1; - } - - if (!get_buf(self, &ptr1, &size, ANY_BUFFER)) - return -1; - if (idx < 0 || idx >= size) { PyErr_SetString(PyExc_IndexError, "buffer assignment index out of range"); @@ -601,6 +600,23 @@ } static int +buffer_ass_item(PyBufferObject *self, Py_ssize_t idx, PyObject *other) +{ + void *ptr1; + Py_ssize_t size; + + if ( self->b_readonly ) { + PyErr_SetString(PyExc_TypeError, + "buffer is read-only"); + return -1; + } + + if (!get_buf(self, &ptr1, &size, ANY_BUFFER)) + return -1; + return buffer_ass_item_impl(ptr1, size, idx, other); +} + +static int buffer_ass_slice(PyBufferObject *self, Py_ssize_t left, Py_ssize_t right, PyObject *other) { PyBufferProcs *pb; @@ -687,23 +703,26 @@ "single-segment buffer object expected"); return -1; } - if (!get_buf(self, &ptr1, &selfsize, ANY_BUFFER)) - return -1; if (PyIndex_Check(item)) { Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError); if (i == -1 && PyErr_Occurred()) return -1; + if (!get_buf(self, &ptr1, &selfsize, ANY_BUFFER)) + return -1; + if (i < 0) i += selfsize; - return buffer_ass_item(self, i, value); + return buffer_ass_item_impl(ptr1, selfsize, i, value); } else if (PySlice_Check(item)) { Py_ssize_t start, stop, step, slicelength; - if (PySlice_GetIndicesEx((PySliceObject *)item, selfsize, - &start, &stop, &step, &slicelength) < 0) + if (_PySlice_Unpack(item, &start, &stop, &step) < 0) + return -1; + if (!get_buf(self, &ptr1, &selfsize, ANY_BUFFER)) return -1; + slicelength = _PySlice_AdjustIndices(selfsize, &start, &stop, step); if ((othersize = (*pb->bf_getreadbuffer)(value, 0, &ptr2)) < 0) return -1; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Feb 1 15:54:52 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 01 Feb 2017 20:54:52 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI5MzU0?= =?utf-8?q?=3A_Fixed_inspect=2Egetargs=28=29_for_parameters_which_are_cell?= Message-ID: <20170201205452.128575.94434.0A92FBA2@psf.io> https://hg.python.org/cpython/rev/a889c5524520 changeset: 106372:a889c5524520 branch: 2.7 user: Serhiy Storchaka date: Wed Feb 01 22:53:03 2017 +0200 summary: Issue #29354: Fixed inspect.getargs() for parameters which are cell variables. files: Lib/inspect.py | 7 +++- Lib/test/test_inspect.py | 36 ++++++++++++++++++++++++++- Misc/NEWS | 3 ++ 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/Lib/inspect.py b/Lib/inspect.py --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -769,8 +769,11 @@ if opname in ('UNPACK_TUPLE', 'UNPACK_SEQUENCE'): remain.append(value) count.append(value) - elif opname == 'STORE_FAST': - stack.append(names[value]) + elif opname in ('STORE_FAST', 'STORE_DEREF'): + if opname == 'STORE_FAST': + stack.append(names[value]) + else: + stack.append(co.co_cellvars[value]) # Special case for sublists of length 1: def foo((bar)) # doesn't generate the UNPACK_TUPLE bytecode, so if 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 @@ -502,6 +502,15 @@ 'g', 'h', (3, (4, (5,))), '(a, b, c, d=3, (e, (f,))=(4, (5,)), *g, **h)') + def spam_deref(a, b, c, d=3, (e, (f,))=(4, (5,)), *g, **h): + def eggs(): + return a + b + c + d + e + f + g + h + return eggs + self.assertArgSpecEquals(spam_deref, + ['a', 'b', 'c', 'd', ['e', ['f']]], + 'g', 'h', (3, (4, (5,))), + '(a, b, c, d=3, (e, (f,))=(4, (5,)), *g, **h)') + def test_getargspec_method(self): class A(object): def m(self): @@ -515,9 +524,15 @@ exec 'def sublistOfOne((foo,)): return 1' self.assertArgSpecEquals(sublistOfOne, [['foo']]) + exec 'def sublistOfOne((foo,)): return (lambda: foo)' + self.assertArgSpecEquals(sublistOfOne, [['foo']]) + exec 'def fakeSublistOfOne((foo)): return 1' self.assertArgSpecEquals(fakeSublistOfOne, ['foo']) + exec 'def sublistOfOne((foo)): return (lambda: foo)' + self.assertArgSpecEquals(sublistOfOne, ['foo']) + def _classify_test(self, newstyle): """Helper for testing that classify_class_attrs finds a bunch of @@ -820,6 +835,23 @@ self.assertEqualException(f3, '1, 2') self.assertEqualException(f3, '1, 2, a=1, b=2') + +class TestGetcallargsFunctionsCellVars(TestGetcallargsFunctions): + + def makeCallable(self, signature): + """Create a function that returns its locals(), excluding the + autogenerated '.1', '.2', etc. tuple param names (if any).""" + with check_py3k_warnings( + ("tuple parameter unpacking has been removed", SyntaxWarning), + quiet=True): + code = """lambda %s: ( + (lambda: a+b+c+d+d+e+f+g+h), # make parameters cell vars + dict(i for i in locals().items() + if not is_tuplename(i[0])) + )[1]""" + return eval(code % signature, {'is_tuplename' : self.is_tuplename}) + + class TestGetcallargsMethods(TestGetcallargsFunctions): def setUp(self): @@ -857,8 +889,8 @@ run_unittest( TestDecorators, TestRetrievingSourceCode, TestOneliners, TestBuggyCases, TestInterpreterStack, TestClassesAndFunctions, TestPredicates, - TestGetcallargsFunctions, TestGetcallargsMethods, - TestGetcallargsUnboundMethods) + TestGetcallargsFunctions, TestGetcallargsFunctionsCellVars, + TestGetcallargsMethods, TestGetcallargsUnboundMethods) if __name__ == "__main__": test_main() diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -26,6 +26,9 @@ Library ------- +- Issue #29354: Fixed inspect.getargs() for parameters which are cell + variables. + - Issue #29335: Fix subprocess.Popen.wait() when the child process has exited to a stopped instead of terminated state (ex: when under ptrace). -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Feb 1 16:12:43 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Wed, 01 Feb 2017 21:12:43 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2320185=3A_Converte?= =?utf-8?q?d_the_int_class_to_Argument_Clinic=2E?= Message-ID: <20170201211242.25540.75640.ED75EA81@psf.io> https://hg.python.org/cpython/rev/aa7ac93d23b2 changeset: 106373:aa7ac93d23b2 parent: 106370:0990a071751f user: Serhiy Storchaka date: Wed Feb 01 23:12:20 2017 +0200 summary: Issue #20185: Converted the int class to Argument Clinic. Based on patch by Vajrasky Kok. files: Objects/clinic/longobject.c.h | 192 ++++++++++++++++ Objects/longobject.c | 252 +++++++++------------ 2 files changed, 306 insertions(+), 138 deletions(-) diff --git a/Objects/clinic/longobject.c.h b/Objects/clinic/longobject.c.h new file mode 100644 --- /dev/null +++ b/Objects/clinic/longobject.c.h @@ -0,0 +1,192 @@ +/*[clinic input] +preserve +[clinic start generated code]*/ + +PyDoc_STRVAR(int___getnewargs____doc__, +"__getnewargs__($self, /)\n" +"--\n" +"\n"); + +#define INT___GETNEWARGS___METHODDEF \ + {"__getnewargs__", (PyCFunction)int___getnewargs__, METH_NOARGS, int___getnewargs____doc__}, + +static PyObject * +int___getnewargs___impl(PyObject *self); + +static PyObject * +int___getnewargs__(PyObject *self, PyObject *Py_UNUSED(ignored)) +{ + return int___getnewargs___impl(self); +} + +PyDoc_STRVAR(int___format____doc__, +"__format__($self, format_spec, /)\n" +"--\n" +"\n"); + +#define INT___FORMAT___METHODDEF \ + {"__format__", (PyCFunction)int___format__, METH_O, int___format____doc__}, + +static PyObject * +int___format___impl(PyObject *self, PyObject *format_spec); + +static PyObject * +int___format__(PyObject *self, PyObject *arg) +{ + PyObject *return_value = NULL; + PyObject *format_spec; + + if (!PyArg_Parse(arg, "U:__format__", &format_spec)) { + goto exit; + } + return_value = int___format___impl(self, format_spec); + +exit: + return return_value; +} + +PyDoc_STRVAR(int___sizeof____doc__, +"__sizeof__($self, /)\n" +"--\n" +"\n" +"Returns size in memory, in bytes."); + +#define INT___SIZEOF___METHODDEF \ + {"__sizeof__", (PyCFunction)int___sizeof__, METH_NOARGS, int___sizeof____doc__}, + +static Py_ssize_t +int___sizeof___impl(PyObject *self); + +static PyObject * +int___sizeof__(PyObject *self, PyObject *Py_UNUSED(ignored)) +{ + PyObject *return_value = NULL; + Py_ssize_t _return_value; + + _return_value = int___sizeof___impl(self); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyLong_FromSsize_t(_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(int_bit_length__doc__, +"bit_length($self, /)\n" +"--\n" +"\n" +"Number of bits necessary to represent self in binary.\n" +"\n" +">>> bin(37)\n" +"\'0b100101\'\n" +">>> (37).bit_length()\n" +"6"); + +#define INT_BIT_LENGTH_METHODDEF \ + {"bit_length", (PyCFunction)int_bit_length, METH_NOARGS, int_bit_length__doc__}, + +static PyObject * +int_bit_length_impl(PyObject *self); + +static PyObject * +int_bit_length(PyObject *self, PyObject *Py_UNUSED(ignored)) +{ + return int_bit_length_impl(self); +} + +PyDoc_STRVAR(int_to_bytes__doc__, +"to_bytes($self, /, length, byteorder, *, signed=False)\n" +"--\n" +"\n" +"Return an array of bytes representing an integer.\n" +"\n" +" length\n" +" Length of bytes object to use. An OverflowError is raised if the\n" +" integer is not representable with the given number of bytes.\n" +" byteorder\n" +" The byte order used to represent the integer. If byteorder is \'big\',\n" +" the most significant byte is at the beginning of the byte array. If\n" +" byteorder is \'little\', the most significant byte is at the end of the\n" +" byte array. To request the native byte order of the host system, use\n" +" `sys.byteorder\' as the byte order value.\n" +" signed\n" +" Determines whether two\'s complement is used to represent the integer.\n" +" If signed is False and a negative integer is given, an OverflowError\n" +" is raised."); + +#define INT_TO_BYTES_METHODDEF \ + {"to_bytes", (PyCFunction)int_to_bytes, METH_FASTCALL, int_to_bytes__doc__}, + +static PyObject * +int_to_bytes_impl(PyObject *self, Py_ssize_t length, PyObject *byteorder, + int is_signed); + +static PyObject * +int_to_bytes(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"length", "byteorder", "signed", NULL}; + static _PyArg_Parser _parser = {"nU|$p:to_bytes", _keywords, 0}; + Py_ssize_t length; + PyObject *byteorder; + int is_signed = 0; + + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &length, &byteorder, &is_signed)) { + goto exit; + } + return_value = int_to_bytes_impl(self, length, byteorder, is_signed); + +exit: + return return_value; +} + +PyDoc_STRVAR(int_from_bytes__doc__, +"from_bytes($type, /, bytes, byteorder, *, signed=False)\n" +"--\n" +"\n" +"Return the integer represented by the given array of bytes.\n" +"\n" +" bytes\n" +" Holds the array of bytes to convert. The argument must either\n" +" support the buffer protocol or be an iterable object producing bytes.\n" +" Bytes and bytearray are examples of built-in objects that support the\n" +" buffer protocol.\n" +" byteorder\n" +" The byte order used to represent the integer. If byteorder is \'big\',\n" +" the most significant byte is at the beginning of the byte array. If\n" +" byteorder is \'little\', the most significant byte is at the end of the\n" +" byte array. To request the native byte order of the host system, use\n" +" `sys.byteorder\' as the byte order value.\n" +" signed\n" +" Indicates whether two\'s complement is used to represent the integer."); + +#define INT_FROM_BYTES_METHODDEF \ + {"from_bytes", (PyCFunction)int_from_bytes, METH_FASTCALL|METH_CLASS, int_from_bytes__doc__}, + +static PyObject * +int_from_bytes_impl(PyTypeObject *type, PyObject *bytes_obj, + PyObject *byteorder, int is_signed); + +static PyObject * +int_from_bytes(PyTypeObject *type, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"bytes", "byteorder", "signed", NULL}; + static _PyArg_Parser _parser = {"OU|$p:from_bytes", _keywords, 0}; + PyObject *bytes_obj; + PyObject *byteorder; + int is_signed = 0; + + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &bytes_obj, &byteorder, &is_signed)) { + goto exit; + } + return_value = int_from_bytes_impl(type, bytes_obj, byteorder, is_signed); + +exit: + return return_value; +} +/*[clinic end generated code: output=a9bae2fd016e7b85 input=a9049054013a1b77]*/ diff --git a/Objects/longobject.c b/Objects/longobject.c --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -9,6 +9,12 @@ #include #include +#include "clinic/longobject.c.h" +/*[clinic input] +class int "PyObject *" "&PyLong_Type" +[clinic start generated code]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=ec0275e3422a36e3]*/ + #ifndef NSMALLPOSINTS #define NSMALLPOSINTS 257 #endif @@ -4863,10 +4869,15 @@ return (PyObject *)newobj; } +/*[clinic input] +int.__getnewargs__ +[clinic start generated code]*/ + static PyObject * -long_getnewargs(PyLongObject *v) +int___getnewargs___impl(PyObject *self) +/*[clinic end generated code: output=839a49de3f00b61b input=5904770ab1fb8c75]*/ { - return Py_BuildValue("(N)", _PyLong_Copy(v)); + return Py_BuildValue("(N)", _PyLong_Copy((PyLongObject *)self)); } static PyObject * @@ -4879,16 +4890,20 @@ return PyLong_FromLong(1L); } +/*[clinic input] +int.__format__ + + format_spec: unicode + / +[clinic start generated code]*/ + static PyObject * -long__format__(PyObject *self, PyObject *args) +int___format___impl(PyObject *self, PyObject *format_spec) +/*[clinic end generated code: output=b4929dee9ae18689 input=e31944a9b3e428b7]*/ { - PyObject *format_spec; _PyUnicodeWriter writer; int ret; - if (!PyArg_ParseTuple(args, "U:__format__", &format_spec)) - return NULL; - _PyUnicodeWriter_Init(&writer); ret = _PyLong_FormatAdvancedWriter( &writer, @@ -5066,31 +5081,50 @@ return result; } -static PyObject * -long_sizeof(PyLongObject *v) +/*[clinic input] +int.__sizeof__ -> Py_ssize_t + +Returns size in memory, in bytes. +[clinic start generated code]*/ + +static Py_ssize_t +int___sizeof___impl(PyObject *self) +/*[clinic end generated code: output=3303f008eaa6a0a5 input=9b51620c76fc4507]*/ { Py_ssize_t res; - res = offsetof(PyLongObject, ob_digit) + Py_ABS(Py_SIZE(v))*sizeof(digit); - return PyLong_FromSsize_t(res); + res = offsetof(PyLongObject, ob_digit) + Py_ABS(Py_SIZE(self))*sizeof(digit); + return res; } +/*[clinic input] +int.bit_length + +Number of bits necessary to represent self in binary. + +>>> bin(37) +'0b100101' +>>> (37).bit_length() +6 +[clinic start generated code]*/ + static PyObject * -long_bit_length(PyLongObject *v) +int_bit_length_impl(PyObject *self) +/*[clinic end generated code: output=fc1977c9353d6a59 input=e4eb7a587e849a32]*/ { PyLongObject *result, *x, *y; Py_ssize_t ndigits; int msd_bits; digit msd; - assert(v != NULL); - assert(PyLong_Check(v)); - - ndigits = Py_ABS(Py_SIZE(v)); + assert(self != NULL); + assert(PyLong_Check(self)); + + ndigits = Py_ABS(Py_SIZE(self)); if (ndigits == 0) return PyLong_FromLong(0); - msd = v->ob_digit[ndigits-1]; + msd = ((PyLongObject *)self)->ob_digit[ndigits-1]; msd_bits = bits_in_digit(msd); if (ndigits <= PY_SSIZE_T_MAX/PyLong_SHIFT) @@ -5127,15 +5161,6 @@ return NULL; } -PyDoc_STRVAR(long_bit_length_doc, -"int.bit_length() -> int\n\ -\n\ -Number of bits necessary to represent self in binary.\n\ ->>> bin(37)\n\ -'0b100101'\n\ ->>> (37).bit_length()\n\ -6"); - #if 0 static PyObject * long_is_finite(PyObject *v) @@ -5144,32 +5169,38 @@ } #endif +/*[clinic input] +int.to_bytes + + length: Py_ssize_t + Length of bytes object to use. An OverflowError is raised if the + integer is not representable with the given number of bytes. + byteorder: unicode + The byte order used to represent the integer. If byteorder is 'big', + the most significant byte is at the beginning of the byte array. If + byteorder is 'little', the most significant byte is at the end of the + byte array. To request the native byte order of the host system, use + `sys.byteorder' as the byte order value. + * + signed as is_signed: bool = False + Determines whether two's complement is used to represent the integer. + If signed is False and a negative integer is given, an OverflowError + is raised. + +Return an array of bytes representing an integer. +[clinic start generated code]*/ static PyObject * -long_to_bytes(PyLongObject *v, PyObject *args, PyObject *kwds) +int_to_bytes_impl(PyObject *self, Py_ssize_t length, PyObject *byteorder, + int is_signed) +/*[clinic end generated code: output=89c801df114050a3 input=ddac63f4c7bf414c]*/ { - PyObject *byteorder_str; - PyObject *is_signed_obj = NULL; - Py_ssize_t length; int little_endian; - int is_signed; PyObject *bytes; - static char *kwlist[] = {"length", "byteorder", "signed", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "nU|O:to_bytes", kwlist, - &length, &byteorder_str, - &is_signed_obj)) - return NULL; - - if (args != NULL && Py_SIZE(args) > 2) { - PyErr_SetString(PyExc_TypeError, - "'signed' is a keyword-only argument"); - return NULL; - } - - if (_PyUnicode_EqualToASCIIString(byteorder_str, "little")) + + if (_PyUnicode_EqualToASCIIString(byteorder, "little")) little_endian = 1; - else if (_PyUnicode_EqualToASCIIString(byteorder_str, "big")) + else if (_PyUnicode_EqualToASCIIString(byteorder, "big")) little_endian = 0; else { PyErr_SetString(PyExc_ValueError, @@ -5177,18 +5208,6 @@ return NULL; } - if (is_signed_obj != NULL) { - int cmp = PyObject_IsTrue(is_signed_obj); - if (cmp < 0) - return NULL; - is_signed = cmp ? 1 : 0; - } - else { - /* If the signed argument was omitted, use False as the - default. */ - is_signed = 0; - } - if (length < 0) { PyErr_SetString(PyExc_ValueError, "length argument must be non-negative"); @@ -5199,7 +5218,8 @@ if (bytes == NULL) return NULL; - if (_PyLong_AsByteArray(v, (unsigned char *)PyBytes_AS_STRING(bytes), + if (_PyLong_AsByteArray((PyLongObject *)self, + (unsigned char *)PyBytes_AS_STRING(bytes), length, little_endian, is_signed) < 0) { Py_DECREF(bytes); return NULL; @@ -5208,51 +5228,39 @@ return bytes; } -PyDoc_STRVAR(long_to_bytes_doc, -"int.to_bytes(length, byteorder, *, signed=False) -> bytes\n\ -\n\ -Return an array of bytes representing an integer.\n\ -\n\ -The integer is represented using length bytes. An OverflowError is\n\ -raised if the integer is not representable with the given number of\n\ -bytes.\n\ -\n\ -The byteorder argument determines the byte order used to represent the\n\ -integer. If byteorder is 'big', the most significant byte is at the\n\ -beginning of the byte array. If byteorder is 'little', the most\n\ -significant byte is at the end of the byte array. To request the native\n\ -byte order of the host system, use `sys.byteorder' as the byte order value.\n\ -\n\ -The signed keyword-only argument determines whether two's complement is\n\ -used to represent the integer. If signed is False and a negative integer\n\ -is given, an OverflowError is raised."); +/*[clinic input] + at classmethod +int.from_bytes + + bytes as bytes_obj: object + Holds the array of bytes to convert. The argument must either + support the buffer protocol or be an iterable object producing bytes. + Bytes and bytearray are examples of built-in objects that support the + buffer protocol. + byteorder: unicode + The byte order used to represent the integer. If byteorder is 'big', + the most significant byte is at the beginning of the byte array. If + byteorder is 'little', the most significant byte is at the end of the + byte array. To request the native byte order of the host system, use + `sys.byteorder' as the byte order value. + * + signed as is_signed: bool = False + Indicates whether two's complement is used to represent the integer. + +Return the integer represented by the given array of bytes. +[clinic start generated code]*/ static PyObject * -long_from_bytes(PyTypeObject *type, PyObject *args, PyObject *kwds) +int_from_bytes_impl(PyTypeObject *type, PyObject *bytes_obj, + PyObject *byteorder, int is_signed) +/*[clinic end generated code: output=efc5d68e31f9314f input=cdf98332b6a821b0]*/ { - PyObject *byteorder_str; - PyObject *is_signed_obj = NULL; int little_endian; - int is_signed; - PyObject *obj; - PyObject *bytes; - PyObject *long_obj; - static char *kwlist[] = {"bytes", "byteorder", "signed", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "OU|O:from_bytes", kwlist, - &obj, &byteorder_str, - &is_signed_obj)) - return NULL; - - if (args != NULL && Py_SIZE(args) > 2) { - PyErr_SetString(PyExc_TypeError, - "'signed' is a keyword-only argument"); - return NULL; - } - - if (_PyUnicode_EqualToASCIIString(byteorder_str, "little")) + PyObject *long_obj, *bytes; + + if (_PyUnicode_EqualToASCIIString(byteorder, "little")) little_endian = 1; - else if (_PyUnicode_EqualToASCIIString(byteorder_str, "big")) + else if (_PyUnicode_EqualToASCIIString(byteorder, "big")) little_endian = 0; else { PyErr_SetString(PyExc_ValueError, @@ -5260,19 +5268,7 @@ return NULL; } - if (is_signed_obj != NULL) { - int cmp = PyObject_IsTrue(is_signed_obj); - if (cmp < 0) - return NULL; - is_signed = cmp ? 1 : 0; - } - else { - /* If the signed argument was omitted, use False as the - default. */ - is_signed = 0; - } - - bytes = PyObject_Bytes(obj); + bytes = PyObject_Bytes(bytes_obj); if (bytes == NULL) return NULL; @@ -5289,35 +5285,16 @@ return long_obj; } -PyDoc_STRVAR(long_from_bytes_doc, -"int.from_bytes(bytes, byteorder, *, signed=False) -> int\n\ -\n\ -Return the integer represented by the given array of bytes.\n\ -\n\ -The bytes argument must be a bytes-like object (e.g. bytes or bytearray).\n\ -\n\ -The byteorder argument determines the byte order used to represent the\n\ -integer. If byteorder is 'big', the most significant byte is at the\n\ -beginning of the byte array. If byteorder is 'little', the most\n\ -significant byte is at the end of the byte array. To request the native\n\ -byte order of the host system, use `sys.byteorder' as the byte order value.\n\ -\n\ -The signed keyword-only argument indicates whether two's complement is\n\ -used to represent the integer."); - static PyMethodDef long_methods[] = { {"conjugate", (PyCFunction)long_long, METH_NOARGS, "Returns self, the complex conjugate of any int."}, - {"bit_length", (PyCFunction)long_bit_length, METH_NOARGS, - long_bit_length_doc}, + INT_BIT_LENGTH_METHODDEF #if 0 {"is_finite", (PyCFunction)long_is_finite, METH_NOARGS, "Returns always True."}, #endif - {"to_bytes", (PyCFunction)long_to_bytes, - METH_VARARGS|METH_KEYWORDS, long_to_bytes_doc}, - {"from_bytes", (PyCFunction)long_from_bytes, - METH_VARARGS|METH_KEYWORDS|METH_CLASS, long_from_bytes_doc}, + INT_TO_BYTES_METHODDEF + INT_FROM_BYTES_METHODDEF {"__trunc__", (PyCFunction)long_long, METH_NOARGS, "Truncating an Integral returns itself."}, {"__floor__", (PyCFunction)long_long, METH_NOARGS, @@ -5327,10 +5304,9 @@ {"__round__", (PyCFunction)long_round, METH_VARARGS, "Rounding an Integral returns itself.\n" "Rounding with an ndigits argument also returns an integer."}, - {"__getnewargs__", (PyCFunction)long_getnewargs, METH_NOARGS}, - {"__format__", (PyCFunction)long__format__, METH_VARARGS}, - {"__sizeof__", (PyCFunction)long_sizeof, METH_NOARGS, - "Returns size in memory, in bytes"}, + INT___GETNEWARGS___METHODDEF + INT___FORMAT___METHODDEF + INT___SIZEOF___METHODDEF {NULL, NULL} /* sentinel */ }; -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Wed Feb 1 16:40:53 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 1 Feb 2017 13:40:53 -0800 Subject: [Python-checkins] BAD Benchmark Results for Python 2.7 2017-02-01 Message-ID: <6f4d7c35-8a0c-4b2d-a5fd-392b6a40e25a@orsmsx152.amr.corp.intel.com> Results for project Python 2.7, build date 2017-02-01 11:48:25 +0000 commit: 51e7c9b54f56 previous commit: 743ff7902879 revision date: 2017-01-31 12:56: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.15% -1.50% 3.15% 8.99% :-) pybench 0.16% -0.07% 7.57% 3.74% :-| regex_v8 0.78% 0.15% -0.09% 9.83% :-) nbody 0.34% -1.42% 10.02% 7.15% :-| json_dump_v2 0.24% -0.01% 0.48% 10.18% :-( normal_startup 2.02% 0.33% -2.13% 2.62% :-| ssbench 0.21% -0.16% -0.10% 3.02% ---------------------------------------------------------------------------------- * 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-2017-02-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 lp_benchmark_robot at intel.com Wed Feb 1 16:41:37 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 1 Feb 2017 13:41:37 -0800 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python Default 2017-02-01 Message-ID: Results for project Python default, build date 2017-02-01 11:04:12 +0000 commit: 19c4528f53b0 previous commit: 3d328ee18612 revision date: 2017-02-01 01:42: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.19% -0.99% 9.03% 15.45% :-) pybench 0.11% 0.02% 3.19% 5.36% :-| regex_v8 3.58% 0.14% -0.15% 4.72% :-) nbody 0.11% -0.00% 3.36% -1.22% :-) json_dump_v2 0.23% -0.80% 9.99% 8.19% :-| normal_startup 1.15% -0.04% 0.74% 6.48% ---------------------------------------------------------------------------------- * 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-2017-02-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 python-checkins at python.org Wed Feb 1 23:21:36 2017 From: python-checkins at python.org (mariatta.wijaya) Date: Thu, 02 Feb 2017 04:21:36 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI5Mzgx?= =?utf-8?q?=3A_Clarify_ordering_of_UNIX_shebang_line_as_source_encoding_li?= =?utf-8?q?ne?= Message-ID: <20170202042136.7642.5930.80C5EAF6@psf.io> https://hg.python.org/cpython/rev/3d712292f2fa changeset: 106374:3d712292f2fa branch: 3.6 parent: 106369:7196ab02b7ce user: Mariatta Wijaya date: Wed Feb 01 20:21:22 2017 -0800 summary: Issue #29381: Clarify ordering of UNIX shebang line as source encoding line files: Doc/tutorial/interpreter.rst | 29 +++++++++++------------ 1 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Doc/tutorial/interpreter.rst b/Doc/tutorial/interpreter.rst --- a/Doc/tutorial/interpreter.rst +++ b/Doc/tutorial/interpreter.rst @@ -10,13 +10,13 @@ Invoking the Interpreter ======================== -The Python interpreter is usually installed as :file:`/usr/local/bin/python3.6` +The Python interpreter is usually installed as :file:`/usr/local/bin/python3.7` on those machines where it is available; putting :file:`/usr/local/bin` in your Unix shell's search path makes it possible to start it by typing the command: .. code-block:: text - python3.6 + python3.7 to the shell. [#]_ Since the choice of the directory where the interpreter lives is an installation option, other places are possible; check with your local @@ -98,8 +98,8 @@ .. code-block:: shell-session - $ python3.6 - Python 3.6 (default, Sep 16 2015, 09:25:04) + $ python3.7 + Python 3.7 (default, Sep 16 2015, 09:25:04) [GCC 4.8.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> @@ -138,25 +138,24 @@ recognize that the file is UTF-8, and it must use a font that supports all the characters in the file. -It is also possible to specify a different encoding for source files. In order -to do this, put one more special comment line right after the ``#!`` line to -define the source file encoding:: +To declare an encoding other than the default one, a special comment line +should be added as the *first* line of the file. The syntax is as follows:: # -*- coding: encoding -*- -With that declaration, everything in the source file will be treated as having -the encoding *encoding* instead of UTF-8. The list of possible encodings can be -found in the Python Library Reference, in the section on :mod:`codecs`. +where *encoding* is one of the valid :mod:`codecs` supported by Python. -For example, if your editor of choice does not support UTF-8 encoded files and -insists on using some other encoding, say Windows-1252, you can write:: +For example, to declare that Windows-1252 encoding is to be used, the first +line of your source code file should be:: # -*- coding: cp-1252 -*- -and still use all characters in the Windows-1252 character set in the source -files. The special encoding comment must be in the *first or second* line -within the file. +One exception to the *first line* rule is when the source code starts with a +:ref:`UNIX "shebang" line `. In this case, the encoding +declaration should be added as the second line of the file. For example:: + #!/usr/bin/env python3 + # -*- coding: cp-1252 -*- .. rubric:: Footnotes -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Feb 1 23:43:57 2017 From: python-checkins at python.org (mariatta.wijaya) Date: Thu, 02 Feb 2017 04:43:57 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Backed_out_cha?= =?utf-8?q?ngeset_3d712292f2fa?= Message-ID: <20170202044357.97135.30823.29C1CEE6@psf.io> https://hg.python.org/cpython/rev/bea7af03ba19 changeset: 106375:bea7af03ba19 branch: 3.6 user: Mariatta Wijaya date: Wed Feb 01 20:38:55 2017 -0800 summary: Backed out changeset 3d712292f2fa files: Doc/tutorial/interpreter.rst | 29 ++++++++++++----------- 1 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Doc/tutorial/interpreter.rst b/Doc/tutorial/interpreter.rst --- a/Doc/tutorial/interpreter.rst +++ b/Doc/tutorial/interpreter.rst @@ -10,13 +10,13 @@ Invoking the Interpreter ======================== -The Python interpreter is usually installed as :file:`/usr/local/bin/python3.7` +The Python interpreter is usually installed as :file:`/usr/local/bin/python3.6` on those machines where it is available; putting :file:`/usr/local/bin` in your Unix shell's search path makes it possible to start it by typing the command: .. code-block:: text - python3.7 + python3.6 to the shell. [#]_ Since the choice of the directory where the interpreter lives is an installation option, other places are possible; check with your local @@ -98,8 +98,8 @@ .. code-block:: shell-session - $ python3.7 - Python 3.7 (default, Sep 16 2015, 09:25:04) + $ python3.6 + Python 3.6 (default, Sep 16 2015, 09:25:04) [GCC 4.8.2] on linux Type "help", "copyright", "credits" or "license" for more information. >>> @@ -138,24 +138,25 @@ recognize that the file is UTF-8, and it must use a font that supports all the characters in the file. -To declare an encoding other than the default one, a special comment line -should be added as the *first* line of the file. The syntax is as follows:: +It is also possible to specify a different encoding for source files. In order +to do this, put one more special comment line right after the ``#!`` line to +define the source file encoding:: # -*- coding: encoding -*- -where *encoding* is one of the valid :mod:`codecs` supported by Python. +With that declaration, everything in the source file will be treated as having +the encoding *encoding* instead of UTF-8. The list of possible encodings can be +found in the Python Library Reference, in the section on :mod:`codecs`. -For example, to declare that Windows-1252 encoding is to be used, the first -line of your source code file should be:: +For example, if your editor of choice does not support UTF-8 encoded files and +insists on using some other encoding, say Windows-1252, you can write:: # -*- coding: cp-1252 -*- -One exception to the *first line* rule is when the source code starts with a -:ref:`UNIX "shebang" line `. In this case, the encoding -declaration should be added as the second line of the file. For example:: +and still use all characters in the Windows-1252 character set in the source +files. The special encoding comment must be in the *first or second* line +within the file. - #!/usr/bin/env python3 - # -*- coding: cp-1252 -*- .. rubric:: Footnotes -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 2 00:03:59 2017 From: python-checkins at python.org (mariatta.wijaya) Date: Thu, 02 Feb 2017 05:03:59 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI5Mzgx?= =?utf-8?q?=3A_Clarify_ordering_of_UNIX_shebang_line_as_source_encoding_li?= =?utf-8?q?ne?= Message-ID: <20170202050359.110166.59120.571F0B01@psf.io> https://hg.python.org/cpython/rev/483d9133fd7e changeset: 106376:483d9133fd7e branch: 3.6 user: Mariatta Wijaya date: Wed Feb 01 20:55:47 2017 -0800 summary: Issue #29381: Clarify ordering of UNIX shebang line as source encoding line files: Doc/tutorial/interpreter.rst | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Doc/tutorial/interpreter.rst b/Doc/tutorial/interpreter.rst --- a/Doc/tutorial/interpreter.rst +++ b/Doc/tutorial/interpreter.rst @@ -138,25 +138,24 @@ recognize that the file is UTF-8, and it must use a font that supports all the characters in the file. -It is also possible to specify a different encoding for source files. In order -to do this, put one more special comment line right after the ``#!`` line to -define the source file encoding:: +To declare an encoding other than the default one, a special comment line +should be added as the *first* line of the file. The syntax is as follows:: # -*- coding: encoding -*- -With that declaration, everything in the source file will be treated as having -the encoding *encoding* instead of UTF-8. The list of possible encodings can be -found in the Python Library Reference, in the section on :mod:`codecs`. +where *encoding* is one of the valid :mod:`codecs` supported by Python. -For example, if your editor of choice does not support UTF-8 encoded files and -insists on using some other encoding, say Windows-1252, you can write:: +For example, to declare that Windows-1252 encoding is to be used, the first +line of your source code file should be:: # -*- coding: cp-1252 -*- -and still use all characters in the Windows-1252 character set in the source -files. The special encoding comment must be in the *first or second* line -within the file. +One exception to the *first line* rule is when the source code starts with a +:ref:`UNIX "shebang" line `. In this case, the encoding +declaration should be added as the second line of the file. For example:: + #!/usr/bin/env python3 + # -*- coding: cp-1252 -*- .. rubric:: Footnotes -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 2 00:04:00 2017 From: python-checkins at python.org (mariatta.wijaya) Date: Thu, 02 Feb 2017 05:04:00 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2329381=3A_merge_with_3=2E6?= Message-ID: <20170202050400.15845.31280.8F92850A@psf.io> https://hg.python.org/cpython/rev/762a93935afd changeset: 106377:762a93935afd parent: 106373:aa7ac93d23b2 parent: 106376:483d9133fd7e user: Mariatta Wijaya date: Wed Feb 01 21:03:48 2017 -0800 summary: Issue #29381: merge with 3.6 files: Doc/tutorial/interpreter.rst | 21 ++++++++++----------- 1 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Doc/tutorial/interpreter.rst b/Doc/tutorial/interpreter.rst --- a/Doc/tutorial/interpreter.rst +++ b/Doc/tutorial/interpreter.rst @@ -138,25 +138,24 @@ recognize that the file is UTF-8, and it must use a font that supports all the characters in the file. -It is also possible to specify a different encoding for source files. In order -to do this, put one more special comment line right after the ``#!`` line to -define the source file encoding:: +To declare an encoding other than the default one, a special comment line +should be added as the *first* line of the file. The syntax is as follows:: # -*- coding: encoding -*- -With that declaration, everything in the source file will be treated as having -the encoding *encoding* instead of UTF-8. The list of possible encodings can be -found in the Python Library Reference, in the section on :mod:`codecs`. +where *encoding* is one of the valid :mod:`codecs` supported by Python. -For example, if your editor of choice does not support UTF-8 encoded files and -insists on using some other encoding, say Windows-1252, you can write:: +For example, to declare that Windows-1252 encoding is to be used, the first +line of your source code file should be:: # -*- coding: cp-1252 -*- -and still use all characters in the Windows-1252 character set in the source -files. The special encoding comment must be in the *first or second* line -within the file. +One exception to the *first line* rule is when the source code starts with a +:ref:`UNIX "shebang" line `. In this case, the encoding +declaration should be added as the second line of the file. For example:: + #!/usr/bin/env python3 + # -*- coding: cp-1252 -*- .. rubric:: Footnotes -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 2 00:21:14 2017 From: python-checkins at python.org (mariatta.wijaya) Date: Thu, 02 Feb 2017 05:21:14 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI5Mzgx?= =?utf-8?q?=3A_Clarify_ordering_of_UNIX_shebang_line_as_source_encoding_li?= =?utf-8?q?ne?= Message-ID: <20170202052114.15872.61662.33712D08@psf.io> https://hg.python.org/cpython/rev/df356d3c916e changeset: 106378:df356d3c916e branch: 2.7 parent: 106372:a889c5524520 user: Mariatta Wijaya date: Wed Feb 01 21:14:47 2017 -0800 summary: Issue #29381: Clarify ordering of UNIX shebang line as source encoding line files: Doc/tutorial/interpreter.rst | 48 +++++++++-------------- 1 files changed, 19 insertions(+), 29 deletions(-) diff --git a/Doc/tutorial/interpreter.rst b/Doc/tutorial/interpreter.rst --- a/Doc/tutorial/interpreter.rst +++ b/Doc/tutorial/interpreter.rst @@ -126,40 +126,30 @@ Source Code Encoding -------------------- -It is possible to use encodings different than ASCII in Python source files. The -best way to do it is to put one more special comment line right after the ``#!`` -line to define the source file encoding:: +By default, Python source files are treated as encoded in UTF-8. In that +encoding, characters of most languages in the world can be used simultaneously +in string literals, identifiers and comments --- although the standard library +only uses ASCII characters for identifiers, a convention that any portable code +should follow. To display all these characters properly, your editor must +recognize that the file is UTF-8, and it must use a font that supports all the +characters in the file. + +To declare an encoding other than the default one, a special comment line +should be added as the *first* line of the file. The syntax is as follows:: # -*- coding: encoding -*- +where *encoding* is one of the valid :mod:`codecs` supported by Python. -With that declaration, all characters in the source file will be treated as -having the encoding *encoding*, and it will be possible to directly write -Unicode string literals in the selected encoding. The list of possible -encodings can be found in the Python Library Reference, in the section on -:mod:`codecs`. +For example, to declare that Windows-1252 encoding is to be used, the first +line of your source code file should be:: -For example, to write Unicode literals including the Euro currency symbol, the -ISO-8859-15 encoding can be used, with the Euro symbol having the ordinal value -164. This script, when saved in the ISO-8859-15 encoding, will print the value -8364 (the Unicode code point corresponding to the Euro symbol) and then exit:: + # -*- coding: cp-1252 -*- - # -*- coding: iso-8859-15 -*- +One exception to the *first line* rule is when the source code starts with a +:ref:`UNIX "shebang" line `. In this case, the encoding +declaration should be added as the second line of the file. For example:: - currency = u"?" - print ord(currency) + #!/usr/bin/env python + # -*- coding: cp-1252 -*- -If your editor supports saving files as ``UTF-8`` with a UTF-8 *byte order mark* -(aka BOM), you can use that instead of an encoding declaration. IDLE supports -this capability if ``Options/General/Default Source Encoding/UTF-8`` is set. -Notice that this signature is not understood in older Python releases (2.2 and -earlier), and also not understood by the operating system for script files with -``#!`` lines (only used on Unix systems). - -By using UTF-8 (either through the signature or an encoding declaration), -characters of most languages in the world can be used simultaneously in string -literals and comments. Using non-ASCII characters in identifiers is not -supported. To display all these characters properly, your editor must recognize -that the file is UTF-8, and it must use a font that supports all the characters -in the file. - -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 2 01:27:14 2017 From: python-checkins at python.org (mariatta.wijaya) Date: Thu, 02 Feb 2017 06:27:14 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI5MzI5?= =?utf-8?q?=3A_Improve_documentation_for_hex=28=29=2E_Patch_by_Ammar_Askar?= Message-ID: <20170202062713.7829.67218.375A3127@psf.io> https://hg.python.org/cpython/rev/d7804789368a changeset: 106379:d7804789368a branch: 2.7 user: Mariatta Wijaya date: Wed Feb 01 22:27:02 2017 -0800 summary: Issue #29329: Improve documentation for hex(). Patch by Ammar Askar 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 @@ -617,7 +617,7 @@ '0x1L' If x is not a Python :class:`int` or :class:`long` object, it has to - define an __index__() method that returns an integer. + define a __hex__() method that returns a string. See also :func:`int` for converting a hexadecimal string to an integer using a base of 16. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 2 04:13:13 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 02 Feb 2017 09:13:13 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2329368=3A_The_exte?= =?utf-8?q?nd=28=29_method_is_now_called_instead_of_the_append=28=29?= Message-ID: <20170202091313.7701.42755.44F0ED20@psf.io> https://hg.python.org/cpython/rev/94d630a02a81 changeset: 106380:94d630a02a81 parent: 106377:762a93935afd user: Serhiy Storchaka date: Thu Feb 02 11:12:47 2017 +0200 summary: Issue #29368: The extend() method is now called instead of the append() method when unpickle collections.deque and other list-like objects. This can speed up unpickling to 2 times. files: Lib/pickle.py | 17 +++++++-- Misc/NEWS | 4 ++ Modules/_pickle.c | 60 +++++++++++++++++++++++----------- 3 files changed, 57 insertions(+), 24 deletions(-) diff --git a/Lib/pickle.py b/Lib/pickle.py --- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -1464,12 +1464,19 @@ def load_appends(self): items = self.pop_mark() list_obj = self.stack[-1] - if isinstance(list_obj, list): - list_obj.extend(items) + try: + extend = list_obj.extend + except AttributeError: + pass else: - append = list_obj.append - for item in items: - append(item) + extend(items) + return + # Even if the PEP 307 requires extend() and append() methods, + # fall back on append() if the object has no extend() method + # for backward compatibility. + append = list_obj.append + for item in items: + append(item) dispatch[APPENDS[0]] = load_appends def load_setitem(self): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -230,6 +230,10 @@ - Issue #29218: Unused install_misc command is now removed. It has been documented as unused since 2000. Patch by Eric N. Vander Weele. +- Issue #29368: The extend() method is now called instead of the append() + method when unpickle collections.deque and other list-like objects. + This can speed up unpickling to 2 times. + - Issue #29338: The help of a builtin or extension class now includes the constructor signature if __text_signature__ is provided for the class. diff --git a/Modules/_pickle.c b/Modules/_pickle.c --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -5807,7 +5807,9 @@ do_append(UnpicklerObject *self, Py_ssize_t x) { PyObject *value; + PyObject *slice; PyObject *list; + PyObject *result; Py_ssize_t len, i; len = Py_SIZE(self->stack); @@ -5818,8 +5820,7 @@ list = self->stack->data[x - 1]; - if (PyList_Check(list)) { - PyObject *slice; + if (PyList_CheckExact(list)) { Py_ssize_t list_len; int ret; @@ -5832,27 +5833,48 @@ return ret; } else { - PyObject *append_func; - _Py_IDENTIFIER(append); - - append_func = _PyObject_GetAttrId(list, &PyId_append); - if (append_func == NULL) - return -1; - for (i = x; i < len; i++) { - PyObject *result; - - value = self->stack->data[i]; - result = _Pickle_FastCall(append_func, value); - if (result == NULL) { - Pdata_clear(self->stack, i + 1); - Py_SIZE(self->stack) = x; - Py_DECREF(append_func); + PyObject *extend_func; + _Py_IDENTIFIER(extend); + + extend_func = _PyObject_GetAttrId(list, &PyId_extend); + if (extend_func != NULL) { + slice = Pdata_poplist(self->stack, x); + if (!slice) { + Py_DECREF(extend_func); return -1; } + result = _Pickle_FastCall(extend_func, slice); + Py_DECREF(slice); + Py_DECREF(extend_func); + if (result == NULL) + return -1; Py_DECREF(result); } - Py_SIZE(self->stack) = x; - Py_DECREF(append_func); + else { + PyObject *append_func; + _Py_IDENTIFIER(append); + + /* Even if the PEP 307 requires extend() and append() methods, + fall back on append() if the object has no extend() method + for backward compatibility. */ + PyErr_Clear(); + append_func = _PyObject_GetAttrId(list, &PyId_append); + if (append_func == NULL) + return -1; + for (i = x; i < len; i++) { + value = self->stack->data[i]; + result = _Pickle_FastCall(append_func, value); + if (result == NULL) { + Pdata_clear(self->stack, i + 1); + Py_SIZE(self->stack) = x; + Py_DECREF(append_func); + return -1; + } + Py_DECREF(result); + } + Py_SIZE(self->stack) = x; + Py_DECREF(append_func); + } } return 0; -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Thu Feb 2 04:30:48 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 02 Feb 2017 09:30:48 +0000 Subject: [Python-checkins] Daily reference leaks (762a93935afd): sum=-2 Message-ID: <20170202093048.8335.86221.1B85CE28@psf.io> results for 762a93935afd on branch "default" -------------------------------------------- test_collections leaked [-7, 1, 0] memory blocks, sum=-6 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/reflogos0jBe', '--timeout', '7200'] From python-checkins at python.org Thu Feb 2 04:58:37 2017 From: python-checkins at python.org (victor.stinner) Date: Thu, 02 Feb 2017 09:58:37 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2329368=3A_Fix_=5FP?= =?utf-8?q?ickle=5FFastCall=28=29_usage_in_do=5Fappend=28=29?= Message-ID: <20170202095837.128068.27213.4D019240@psf.io> https://hg.python.org/cpython/rev/328147c0edc3 changeset: 106381:328147c0edc3 user: Victor Stinner date: Thu Feb 02 10:56:47 2017 +0100 summary: Issue #29368: Fix _Pickle_FastCall() usage in do_append() _Pickle_FastCall() has a surprising API: it decrements the reference counter of its second argument. files: Modules/_pickle.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/Modules/_pickle.c b/Modules/_pickle.c --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -5844,7 +5844,6 @@ return -1; } result = _Pickle_FastCall(extend_func, slice); - Py_DECREF(slice); Py_DECREF(extend_func); if (result == NULL) return -1; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 2 06:31:59 2017 From: python-checkins at python.org (victor.stinner) Date: Thu, 02 Feb 2017 11:31:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2329300=3A_Convert_?= =?utf-8?q?=5Fstruct_module_to_Argument_Clinic?= Message-ID: <20170202113158.16887.47283.2DAA3286@psf.io> https://hg.python.org/cpython/rev/f3ff4a3ce77c changeset: 106382:f3ff4a3ce77c user: Victor Stinner date: Thu Feb 02 12:09:30 2017 +0100 summary: Issue #29300: Convert _struct module to Argument Clinic * The struct module now requires contiguous buffers. * Convert most functions and methods of the _struct module to Argument Clinic * Use "Py_buffer" type for the "buffer" argument. Argument Clinic is responsible to create and release the Py_buffer object. * Use "PyStructObject *" type for self to avoid explicit conversions. * Add an unit test on the _struct.Struct.unpack_from() method to test passing arguments as keywords. * Rephrase docstrings. * Rename "fmt" argument to "format" in docstrings and the documentation. As a side effect, functions and methods which used METH_VARARGS calling convention like struct.pack() now use the METH_FASTCALL calling convention which avoids the creation of temporary tuple to pass positional arguments and so is faster. For example, struct.pack("i", 1) becomes 1.56x faster (-36%):: $ ./python -m perf timeit \ -s 'import struct; pack=struct.pack' 'pack("i", 1)' \ --compare-to=../default-ref/python Median +- std dev: 119 ns +- 1 ns -> 76.8 ns +- 0.4 ns: 1.56x faster (-36%) Significant (t=295.91) Patch co-written with Serhiy Storchaka. files: Doc/library/struct.rst | 27 +- Lib/test/test_struct.py | 4 + Modules/_struct.c | 472 +++++++++++++----------- Modules/clinic/_struct.c.h | 276 ++++++++++++++ 4 files changed, 540 insertions(+), 239 deletions(-) diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst --- a/Doc/library/struct.rst +++ b/Doc/library/struct.rst @@ -48,40 +48,40 @@ is wrong. -.. function:: pack(fmt, v1, v2, ...) +.. function:: pack(format, v1, v2, ...) Return a bytes object containing the values *v1*, *v2*, ... packed according - to the format string *fmt*. The arguments must match the values required by + to the format string *format*. The arguments must match the values required by the format exactly. -.. function:: pack_into(fmt, buffer, offset, v1, v2, ...) +.. function:: pack_into(format, buffer, offset, v1, v2, ...) - Pack the values *v1*, *v2*, ... according to the format string *fmt* and + Pack the values *v1*, *v2*, ... according to the format string *format* and write the packed bytes into the writable buffer *buffer* starting at position *offset*. Note that *offset* is a required argument. -.. function:: unpack(fmt, buffer) +.. function:: unpack(format, buffer) - Unpack from the buffer *buffer* (presumably packed by ``pack(fmt, ...)``) - according to the format string *fmt*. The result is a tuple even if it + Unpack from the buffer *buffer* (presumably packed by ``pack(format, ...)``) + according to the format string *format*. The result is a tuple even if it contains exactly one item. The buffer's size in bytes must match the size required by the format, as reflected by :func:`calcsize`. -.. function:: unpack_from(fmt, buffer, offset=0) +.. function:: unpack_from(format, buffer, offset=0) Unpack from *buffer* starting at position *offset*, according to the format - string *fmt*. The result is a tuple even if it contains exactly one + string *format*. The result is a tuple even if it contains exactly one item. The buffer's size in bytes, minus *offset*, must be at least the size required by the format, as reflected by :func:`calcsize`. -.. function:: iter_unpack(fmt, buffer) +.. function:: iter_unpack(format, buffer) Iteratively unpack from the buffer *buffer* according to the format - string *fmt*. This function returns an iterator which will read + string *format*. This function returns an iterator which will read equally-sized chunks from the buffer until all its contents have been consumed. The buffer's size in bytes must be a multiple of the size required by the format, as reflected by :func:`calcsize`. @@ -91,10 +91,11 @@ .. versionadded:: 3.4 -.. function:: calcsize(fmt) +.. function:: calcsize(format) Return the size of the struct (and hence of the bytes object produced by - ``pack(fmt, ...)``) corresponding to the format string *fmt*. + ``pack(format, ...)``) corresponding to the format string *format*. + .. _struct-format-strings: diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py --- a/Lib/test/test_struct.py +++ b/Lib/test/test_struct.py @@ -412,6 +412,10 @@ for i in range(6, len(test_string) + 1): self.assertRaises(struct.error, struct.unpack_from, fmt, data, i) + # keyword arguments + self.assertEqual(s.unpack_from(buffer=test_string, offset=2), + (b'cd01',)) + def test_pack_into(self): test_string = b'Reykjavik rocks, eow!' writable_buf = array.array('b', b' '*100) diff --git a/Modules/_struct.c b/Modules/_struct.c --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -9,6 +9,11 @@ #include "structmember.h" #include +/*[clinic input] +class Struct "PyStructObject *" "&PyStructType" +[clinic start generated code]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=9b032058a83ed7c3]*/ + static PyTypeObject PyStructType; /* The translation function for each format character is table driven */ @@ -80,6 +85,8 @@ #pragma options align=reset #endif +#include "clinic/_struct.c.h" + /* Helper for integer format codes: converts an arbitrary Python object to a PyLongObject if possible, otherwise fails. Caller should decref. */ @@ -1429,41 +1436,46 @@ return self; } +/*[clinic input] +Struct.__init__ + + format: object + +Create a compiled struct object. + +Return a new Struct object which writes and reads binary data according to +the format string. + +See help(struct) for more on format strings. +[clinic start generated code]*/ + static int -s_init(PyObject *self, PyObject *args, PyObject *kwds) +Struct___init___impl(PyStructObject *self, PyObject *format) +/*[clinic end generated code: output=b8e80862444e92d0 input=192a4575a3dde802]*/ { - PyStructObject *soself = (PyStructObject *)self; - PyObject *o_format = NULL; int ret = 0; - static char *kwlist[] = {"format", 0}; - assert(PyStruct_Check(self)); - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:Struct", kwlist, - &o_format)) - return -1; - - if (PyUnicode_Check(o_format)) { - o_format = PyUnicode_AsASCIIString(o_format); - if (o_format == NULL) + if (PyUnicode_Check(format)) { + format = PyUnicode_AsASCIIString(format); + if (format == NULL) return -1; } /* XXX support buffer interface, too */ else { - Py_INCREF(o_format); + Py_INCREF(format); } - if (!PyBytes_Check(o_format)) { - Py_DECREF(o_format); + if (!PyBytes_Check(format)) { + Py_DECREF(format); PyErr_Format(PyExc_TypeError, "Struct() argument 1 must be a bytes object, not %.200s", - Py_TYPE(o_format)->tp_name); + Py_TYPE(format)->tp_name); return -1; } - Py_XSETREF(soself->s_format, o_format); + Py_XSETREF(self->s_format, format); - ret = prepare_s(soself); + ret = prepare_s(self); return ret; } @@ -1517,78 +1529,69 @@ } -PyDoc_STRVAR(s_unpack__doc__, -"S.unpack(buffer) -> (v1, v2, ...)\n\ -\n\ -Return a tuple containing values unpacked according to the format\n\ -string S.format. The buffer's size in bytes must be S.size. See\n\ -help(struct) for more on format strings."); +/*[clinic input] +Struct.unpack + + buffer: Py_buffer + / + +Return a tuple containing unpacked values. + +Unpack according to the format string Struct.format. The buffer's size +in bytes must be Struct.size. + +See help(struct) for more on format strings. +[clinic start generated code]*/ static PyObject * -s_unpack(PyObject *self, PyObject *input) +Struct_unpack_impl(PyStructObject *self, Py_buffer *buffer) +/*[clinic end generated code: output=873a24faf02e848a input=3113f8e7038b2f6c]*/ { - Py_buffer vbuf; - PyObject *result; - PyStructObject *soself = (PyStructObject *)self; - - assert(PyStruct_Check(self)); - assert(soself->s_codes != NULL); - if (PyObject_GetBuffer(input, &vbuf, PyBUF_SIMPLE) < 0) - return NULL; - if (vbuf.len != soself->s_size) { + assert(self->s_codes != NULL); + if (buffer->len != self->s_size) { PyErr_Format(StructError, "unpack requires a bytes object of length %zd", - soself->s_size); - PyBuffer_Release(&vbuf); + self->s_size); return NULL; } - result = s_unpack_internal(soself, vbuf.buf); - PyBuffer_Release(&vbuf); - return result; + return s_unpack_internal(self, buffer->buf); } -PyDoc_STRVAR(s_unpack_from__doc__, -"S.unpack_from(buffer, offset=0) -> (v1, v2, ...)\n\ -\n\ -Return a tuple containing values unpacked according to the format\n\ -string S.format. The buffer's size in bytes, minus offset, must be at\n\ -least S.size. See help(struct) for more on format strings."); +/*[clinic input] +Struct.unpack_from + + buffer: Py_buffer + offset: Py_ssize_t = 0 + +Return a tuple containing unpacked values. + +Values are unpacked according to the format string Struct.format. + +The buffer's size in bytes, minus offset, must be at least Struct.size. + +See help(struct) for more on format strings. +[clinic start generated code]*/ static PyObject * -s_unpack_from(PyObject *self, PyObject *args, PyObject *kwds) +Struct_unpack_from_impl(PyStructObject *self, Py_buffer *buffer, + Py_ssize_t offset) +/*[clinic end generated code: output=57fac875e0977316 input=97ade52422f8962f]*/ { - static char *kwlist[] = {"buffer", "offset", 0}; + assert(self->s_codes != NULL); - PyObject *input; - Py_ssize_t offset = 0; - Py_buffer vbuf; - PyObject *result; - PyStructObject *soself = (PyStructObject *)self; - - assert(PyStruct_Check(self)); - assert(soself->s_codes != NULL); - - if (!PyArg_ParseTupleAndKeywords(args, kwds, - "O|n:unpack_from", kwlist, - &input, &offset)) - return NULL; - if (PyObject_GetBuffer(input, &vbuf, PyBUF_SIMPLE) < 0) - return NULL; if (offset < 0) - offset += vbuf.len; - if (offset < 0 || vbuf.len - offset < soself->s_size) { + offset += buffer->len; + if (offset < 0 || buffer->len - offset < self->s_size) { PyErr_Format(StructError, "unpack_from requires a buffer of at least %zd bytes", - soself->s_size); - PyBuffer_Release(&vbuf); + self->s_size); return NULL; } - result = s_unpack_internal(soself, (char*)vbuf.buf + offset); - PyBuffer_Release(&vbuf); - return result; + return s_unpack_internal(self, (char*)buffer->buf + offset); } + /* Unpack iterator type */ typedef struct { @@ -1680,48 +1683,54 @@ unpackiter_methods /* tp_methods */ }; -PyDoc_STRVAR(s_iter_unpack__doc__, -"S.iter_unpack(buffer) -> iterator(v1, v2, ...)\n\ -\n\ -Return an iterator yielding tuples unpacked from the given bytes\n\ -source, like a repeated invocation of unpack_from(). Requires\n\ -that the bytes length be a multiple of the struct size."); +/*[clinic input] +Struct.iter_unpack + + buffer: object + / + +Return an iterator yielding tuples. + +Tuples are unpacked from the given bytes source, like a repeated +invocation of unpack_from(). + +Requires that the bytes length be a multiple of the struct size. +[clinic start generated code]*/ static PyObject * -s_iter_unpack(PyObject *_so, PyObject *input) +Struct_iter_unpack(PyStructObject *self, PyObject *buffer) +/*[clinic end generated code: output=172d83d0cd15dbab input=6d65b3f3107dbc99]*/ { - PyStructObject *so = (PyStructObject *) _so; - unpackiterobject *self; + unpackiterobject *iter; - assert(PyStruct_Check(_so)); - assert(so->s_codes != NULL); + assert(self->s_codes != NULL); - if (so->s_size == 0) { + if (self->s_size == 0) { PyErr_Format(StructError, "cannot iteratively unpack with a struct of length 0"); return NULL; } - self = (unpackiterobject *) PyType_GenericAlloc(&unpackiter_type, 0); - if (self == NULL) + iter = (unpackiterobject *) PyType_GenericAlloc(&unpackiter_type, 0); + if (iter == NULL) return NULL; - if (PyObject_GetBuffer(input, &self->buf, PyBUF_SIMPLE) < 0) { - Py_DECREF(self); + if (PyObject_GetBuffer(buffer, &iter->buf, PyBUF_SIMPLE) < 0) { + Py_DECREF(iter); return NULL; } - if (self->buf.len % so->s_size != 0) { + if (iter->buf.len % self->s_size != 0) { PyErr_Format(StructError, "iterative unpacking requires a bytes length " "multiple of %zd", - so->s_size); - Py_DECREF(self); + self->s_size); + Py_DECREF(iter); return NULL; } - Py_INCREF(so); - self->so = so; - self->index = 0; - return (PyObject *) self; + Py_INCREF(self); + iter->so = self; + iter->index = 0; + return (PyObject *)iter; } @@ -1736,7 +1745,7 @@ * */ static int -s_pack_internal(PyStructObject *soself, PyObject *args, int offset, char* buf) +s_pack_internal(PyStructObject *soself, PyObject **args, int offset, char* buf) { formatcode *code; /* XXX(nnorwitz): why does i need to be a local? can we use @@ -1750,7 +1759,7 @@ char *res = buf + code->offset; Py_ssize_t j = code->repeat; while (j--) { - PyObject *v = PyTuple_GET_ITEM(args, i++); + PyObject *v = args[i++]; if (e->format == 's') { Py_ssize_t n; int isstring; @@ -1823,7 +1832,7 @@ strings."); static PyObject * -s_pack(PyObject *self, PyObject *args) +s_pack(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyStructObject *soself; PyObject *result; @@ -1832,10 +1841,13 @@ soself = (PyStructObject *)self; assert(PyStruct_Check(self)); assert(soself->s_codes != NULL); - if (PyTuple_GET_SIZE(args) != soself->s_len) + if (nargs != soself->s_len) { PyErr_Format(StructError, - "pack expected %zd items for packing (got %zd)", soself->s_len, PyTuple_GET_SIZE(args)); + "pack expected %zd items for packing (got %zd)", soself->s_len, nargs); + return NULL; + } + if (!_PyArg_NoStackKeywords("pack", kwnames)) { return NULL; } @@ -1862,7 +1874,7 @@ help(struct) for more on format strings."); static PyObject * -s_pack_into(PyObject *self, PyObject *args) +s_pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyStructObject *soself; Py_buffer buffer; @@ -1872,31 +1884,34 @@ soself = (PyStructObject *)self; assert(PyStruct_Check(self)); assert(soself->s_codes != NULL); - if (PyTuple_GET_SIZE(args) != (soself->s_len + 2)) + if (nargs != (soself->s_len + 2)) { - if (PyTuple_GET_SIZE(args) == 0) { + if (nargs == 0) { PyErr_Format(StructError, "pack_into expected buffer argument"); } - else if (PyTuple_GET_SIZE(args) == 1) { + else if (nargs == 1) { PyErr_Format(StructError, "pack_into expected offset argument"); } else { PyErr_Format(StructError, "pack_into expected %zd items for packing (got %zd)", - soself->s_len, (PyTuple_GET_SIZE(args) - 2)); + soself->s_len, (nargs - 2)); } return NULL; } + if (!_PyArg_NoStackKeywords("pack_into", kwnames)) { + return NULL; + } /* Extract a writable memory buffer from the first argument */ - if (!PyArg_Parse(PyTuple_GET_ITEM(args, 0), "w*", &buffer)) + if (!PyArg_Parse(args[0], "w*", &buffer)) return NULL; assert(buffer.len >= 0); /* Extract the offset from the first argument */ - offset = PyNumber_AsSsize_t(PyTuple_GET_ITEM(args, 1), PyExc_IndexError); + offset = PyNumber_AsSsize_t(args[1], PyExc_IndexError); if (offset == -1 && PyErr_Occurred()) { PyBuffer_Release(&buffer); return NULL; @@ -1956,22 +1971,15 @@ /* List of functions */ static struct PyMethodDef s_methods[] = { - {"iter_unpack", s_iter_unpack, METH_O, s_iter_unpack__doc__}, - {"pack", s_pack, METH_VARARGS, s_pack__doc__}, - {"pack_into", s_pack_into, METH_VARARGS, s_pack_into__doc__}, - {"unpack", s_unpack, METH_O, s_unpack__doc__}, - {"unpack_from", (PyCFunction)s_unpack_from, METH_VARARGS|METH_KEYWORDS, - s_unpack_from__doc__}, + STRUCT_ITER_UNPACK_METHODDEF + {"pack", (PyCFunction)s_pack, METH_FASTCALL, s_pack__doc__}, + {"pack_into", (PyCFunction)s_pack_into, METH_FASTCALL, s_pack_into__doc__}, + STRUCT_UNPACK_METHODDEF + STRUCT_UNPACK_FROM_METHODDEF {"__sizeof__", (PyCFunction)s_sizeof, METH_NOARGS, s_sizeof__doc__}, {NULL, NULL} /* sentinel */ }; -PyDoc_STRVAR(s__doc__, -"Struct(fmt) --> compiled struct object\n" -"\n" -"Return a new Struct object which writes and reads binary data according to\n" -"the format string fmt. See help(struct) for more on format strings."); - #define OFF(x) offsetof(PyStructObject, x) static PyGetSetDef s_getsetlist[] = { @@ -1998,29 +2006,29 @@ 0, /* tp_hash */ 0, /* tp_call */ 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - PyObject_GenericSetAttr, /* tp_setattro */ + PyObject_GenericGetAttr, /* tp_getattro */ + PyObject_GenericSetAttr, /* tp_setattro */ 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - s__doc__, /* tp_doc */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Struct___init____doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ offsetof(PyStructObject, weakreflist), /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - s_methods, /* tp_methods */ - NULL, /* tp_members */ - s_getsetlist, /* tp_getset */ + s_methods, /* tp_methods */ + NULL, /* tp_members */ + s_getsetlist, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ - s_init, /* tp_init */ - PyType_GenericAlloc,/* tp_alloc */ - s_new, /* tp_new */ - PyObject_Del, /* tp_free */ + Struct___init__, /* tp_init */ + PyType_GenericAlloc, /* tp_alloc */ + s_new, /* tp_new */ + PyObject_Del, /* tp_free */ }; @@ -2029,7 +2037,7 @@ #define MAXCACHE 100 static PyObject *cache = NULL; -static PyObject * +static PyStructObject * cache_struct(PyObject *fmt) { PyObject * s_object; @@ -2043,7 +2051,7 @@ s_object = PyDict_GetItem(cache, fmt); if (s_object != NULL) { Py_INCREF(s_object); - return s_object; + return (PyStructObject *)s_object; } s_object = PyObject_CallFunctionObjArgs((PyObject *)(&PyStructType), fmt, NULL); @@ -2054,191 +2062,203 @@ if (PyDict_SetItem(cache, fmt, s_object) == -1) PyErr_Clear(); } - return s_object; + return (PyStructObject *)s_object; } -PyDoc_STRVAR(clearcache_doc, -"Clear the internal cache."); +/*[clinic input] +_clearcache + +Clear the internal cache. +[clinic start generated code]*/ static PyObject * -clearcache(PyObject *self) +_clearcache_impl(PyObject *module) +/*[clinic end generated code: output=ce4fb8a7bf7cb523 input=463eaae04bab3211]*/ { Py_CLEAR(cache); Py_RETURN_NONE; } -PyDoc_STRVAR(calcsize_doc, -"calcsize(fmt) -> integer\n\ -\n\ -Return size in bytes of the struct described by the format string fmt."); + +/*[clinic input] +calcsize + + format: object + / + +Return size in bytes of the struct described by the format string. +[clinic start generated code]*/ static PyObject * -calcsize(PyObject *self, PyObject *fmt) +calcsize(PyObject *module, PyObject *format) +/*[clinic end generated code: output=90fbcf191fe9470a input=55488303a06777fa]*/ { Py_ssize_t n; - PyObject *s_object = cache_struct(fmt); + PyStructObject *s_object = cache_struct(format); if (s_object == NULL) return NULL; - n = ((PyStructObject *)s_object)->s_size; + n = s_object->s_size; Py_DECREF(s_object); return PyLong_FromSsize_t(n); } PyDoc_STRVAR(pack_doc, -"pack(fmt, v1, v2, ...) -> bytes\n\ +"pack(format, v1, v2, ...) -> bytes\n\ \n\ Return a bytes object containing the values v1, v2, ... packed according\n\ -to the format string fmt. See help(struct) for more on format strings."); +to the format string. See help(struct) for more on format strings."); static PyObject * -pack(PyObject *self, PyObject *args) +pack(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { - PyObject *s_object, *fmt, *newargs, *result; - Py_ssize_t n = PyTuple_GET_SIZE(args); + PyStructObject *s_object; + PyObject *format, *result; - if (n == 0) { + if (nargs == 0) { PyErr_SetString(PyExc_TypeError, "missing format argument"); return NULL; } - fmt = PyTuple_GET_ITEM(args, 0); - newargs = PyTuple_GetSlice(args, 1, n); - if (newargs == NULL) - return NULL; + format = args[0]; - s_object = cache_struct(fmt); + s_object = cache_struct(format); if (s_object == NULL) { - Py_DECREF(newargs); return NULL; } - result = s_pack(s_object, newargs); - Py_DECREF(newargs); + result = s_pack((PyObject *)s_object, args + 1, nargs - 1, kwnames); Py_DECREF(s_object); return result; } PyDoc_STRVAR(pack_into_doc, -"pack_into(fmt, buffer, offset, v1, v2, ...)\n\ +"pack_into(format, buffer, offset, v1, v2, ...)\n\ \n\ -Pack the values v1, v2, ... according to the format string fmt and write\n\ +Pack the values v1, v2, ... according to the format string and write\n\ the packed bytes into the writable buffer buf starting at offset. Note\n\ that the offset is a required argument. See help(struct) for more\n\ on format strings."); static PyObject * -pack_into(PyObject *self, PyObject *args) +pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { - PyObject *s_object, *fmt, *newargs, *result; - Py_ssize_t n = PyTuple_GET_SIZE(args); + PyStructObject *s_object; + PyObject *format, *result; - if (n == 0) { + if (nargs == 0) { PyErr_SetString(PyExc_TypeError, "missing format argument"); return NULL; } - fmt = PyTuple_GET_ITEM(args, 0); - newargs = PyTuple_GetSlice(args, 1, n); - if (newargs == NULL) - return NULL; + format = args[0]; - s_object = cache_struct(fmt); + s_object = cache_struct(format); if (s_object == NULL) { - Py_DECREF(newargs); return NULL; } - result = s_pack_into(s_object, newargs); - Py_DECREF(newargs); + result = s_pack_into((PyObject *)s_object, args + 1, nargs - 1, kwnames); Py_DECREF(s_object); return result; } -PyDoc_STRVAR(unpack_doc, -"unpack(fmt, buffer) -> (v1, v2, ...)\n\ -\n\ -Return a tuple containing values unpacked according to the format string\n\ -fmt. The buffer's size in bytes must be calcsize(fmt). See help(struct)\n\ -for more on format strings."); +/*[clinic input] +unpack + + format: object + inputstr: object + / + +Return a tuple containing values unpacked according to the format string. + +The buffer's size in bytes must be calcsize(format). + +See help(struct) for more on format strings. +[clinic start generated code]*/ static PyObject * -unpack(PyObject *self, PyObject *args) +unpack_impl(PyObject *module, PyObject *format, PyObject *inputstr) +/*[clinic end generated code: output=06951d66eae6d63b input=4b81d54988890f5e]*/ { - PyObject *s_object, *fmt, *inputstr, *result; + PyStructObject *s_object; + PyObject *result; - if (!PyArg_UnpackTuple(args, "unpack", 2, 2, &fmt, &inputstr)) - return NULL; - - s_object = cache_struct(fmt); + s_object = cache_struct(format); if (s_object == NULL) return NULL; - result = s_unpack(s_object, inputstr); + result = Struct_unpack(s_object, inputstr); Py_DECREF(s_object); return result; } -PyDoc_STRVAR(unpack_from_doc, -"unpack_from(fmt, buffer, offset=0) -> (v1, v2, ...)\n\ -\n\ -Return a tuple containing values unpacked according to the format string\n\ -fmt. The buffer's size, minus offset, must be at least calcsize(fmt).\n\ -See help(struct) for more on format strings."); +/*[clinic input] +unpack_from + + format: object + / + buffer: Py_buffer + offset: Py_ssize_t = 0 + +Return a tuple containing values unpacked according to the format string. + +The buffer's size, minus offset, must be at least calcsize(format). + +See help(struct) for more on format strings. +[clinic start generated code]*/ static PyObject * -unpack_from(PyObject *self, PyObject *args, PyObject *kwds) +unpack_from_impl(PyObject *module, PyObject *format, Py_buffer *buffer, + Py_ssize_t offset) +/*[clinic end generated code: output=2492f0c3a0b82577 input=9ead76c6ac7164f7]*/ { - PyObject *s_object, *fmt, *newargs, *result; - Py_ssize_t n = PyTuple_GET_SIZE(args); + PyStructObject *s_object; + PyObject *result; - if (n == 0) { - PyErr_SetString(PyExc_TypeError, "missing format argument"); + s_object = cache_struct(format); + if (s_object == NULL) { return NULL; } - fmt = PyTuple_GET_ITEM(args, 0); - newargs = PyTuple_GetSlice(args, 1, n); - if (newargs == NULL) - return NULL; + result = Struct_unpack_from_impl(s_object, buffer, offset); - s_object = cache_struct(fmt); - if (s_object == NULL) { - Py_DECREF(newargs); - return NULL; - } - result = s_unpack_from(s_object, newargs, kwds); - Py_DECREF(newargs); Py_DECREF(s_object); return result; } -PyDoc_STRVAR(iter_unpack_doc, -"iter_unpack(fmt, buffer) -> iterator(v1, v2, ...)\n\ -\n\ -Return an iterator yielding tuples unpacked from the given bytes\n\ -source according to the format string, like a repeated invocation of\n\ -unpack_from(). Requires that the bytes length be a multiple of the\n\ -format struct size."); +/*[clinic input] +iter_unpack + + format: object + buffer: object + / + +Return an iterator yielding tuples unpacked from the given bytes. + +The bytes are unpacked according to the format string, like +a repeated invocation of unpack_from(). + +Requires that the bytes length be a multiple of the format struct size. +[clinic start generated code]*/ static PyObject * -iter_unpack(PyObject *self, PyObject *args) +iter_unpack_impl(PyObject *module, PyObject *format, PyObject *buffer) +/*[clinic end generated code: output=b1291e97a6d4cf3c input=8674dfd2f0dae416]*/ { - PyObject *s_object, *fmt, *input, *result; + PyStructObject *s_object; + PyObject *result; - if (!PyArg_ParseTuple(args, "OO:iter_unpack", &fmt, &input)) + s_object = cache_struct(format); + if (s_object == NULL) return NULL; - s_object = cache_struct(fmt); - if (s_object == NULL) - return NULL; - result = s_iter_unpack(s_object, input); + result = Struct_iter_unpack(s_object, buffer); Py_DECREF(s_object); return result; } static struct PyMethodDef module_functions[] = { - {"_clearcache", (PyCFunction)clearcache, METH_NOARGS, clearcache_doc}, - {"calcsize", calcsize, METH_O, calcsize_doc}, - {"iter_unpack", iter_unpack, METH_VARARGS, iter_unpack_doc}, - {"pack", pack, METH_VARARGS, pack_doc}, - {"pack_into", pack_into, METH_VARARGS, pack_into_doc}, - {"unpack", unpack, METH_VARARGS, unpack_doc}, - {"unpack_from", (PyCFunction)unpack_from, - METH_VARARGS|METH_KEYWORDS, unpack_from_doc}, + _CLEARCACHE_METHODDEF + CALCSIZE_METHODDEF + ITER_UNPACK_METHODDEF + {"pack", (PyCFunction)pack, METH_FASTCALL, pack_doc}, + {"pack_into", (PyCFunction)pack_into, METH_FASTCALL, pack_into_doc}, + UNPACK_METHODDEF + UNPACK_FROM_METHODDEF {NULL, NULL} /* sentinel */ }; diff --git a/Modules/clinic/_struct.c.h b/Modules/clinic/_struct.c.h new file mode 100644 --- /dev/null +++ b/Modules/clinic/_struct.c.h @@ -0,0 +1,276 @@ +/*[clinic input] +preserve +[clinic start generated code]*/ + +PyDoc_STRVAR(Struct___init____doc__, +"Struct(format)\n" +"--\n" +"\n" +"Create a compiled struct object.\n" +"\n" +"Return a new Struct object which writes and reads binary data according to\n" +"the format string.\n" +"\n" +"See help(struct) for more on format strings."); + +static int +Struct___init___impl(PyStructObject *self, PyObject *format); + +static int +Struct___init__(PyObject *self, PyObject *args, PyObject *kwargs) +{ + int return_value = -1; + static const char * const _keywords[] = {"format", NULL}; + static _PyArg_Parser _parser = {"O:Struct", _keywords, 0}; + PyObject *format; + + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &format)) { + goto exit; + } + return_value = Struct___init___impl((PyStructObject *)self, format); + +exit: + return return_value; +} + +PyDoc_STRVAR(Struct_unpack__doc__, +"unpack($self, buffer, /)\n" +"--\n" +"\n" +"Return a tuple containing unpacked values.\n" +"\n" +"Unpack according to the format string Struct.format. The buffer\'s size\n" +"in bytes must be Struct.size.\n" +"\n" +"See help(struct) for more on format strings."); + +#define STRUCT_UNPACK_METHODDEF \ + {"unpack", (PyCFunction)Struct_unpack, METH_O, Struct_unpack__doc__}, + +static PyObject * +Struct_unpack_impl(PyStructObject *self, Py_buffer *buffer); + +static PyObject * +Struct_unpack(PyStructObject *self, PyObject *arg) +{ + PyObject *return_value = NULL; + Py_buffer buffer = {NULL, NULL}; + + if (!PyArg_Parse(arg, "y*:unpack", &buffer)) { + goto exit; + } + return_value = Struct_unpack_impl(self, &buffer); + +exit: + /* Cleanup for buffer */ + if (buffer.obj) { + PyBuffer_Release(&buffer); + } + + return return_value; +} + +PyDoc_STRVAR(Struct_unpack_from__doc__, +"unpack_from($self, /, buffer, offset=0)\n" +"--\n" +"\n" +"Return a tuple containing unpacked values.\n" +"\n" +"Values are unpacked according to the format string Struct.format.\n" +"\n" +"The buffer\'s size in bytes, minus offset, must be at least Struct.size.\n" +"\n" +"See help(struct) for more on format strings."); + +#define STRUCT_UNPACK_FROM_METHODDEF \ + {"unpack_from", (PyCFunction)Struct_unpack_from, METH_FASTCALL, Struct_unpack_from__doc__}, + +static PyObject * +Struct_unpack_from_impl(PyStructObject *self, Py_buffer *buffer, + Py_ssize_t offset); + +static PyObject * +Struct_unpack_from(PyStructObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"buffer", "offset", NULL}; + static _PyArg_Parser _parser = {"y*|n:unpack_from", _keywords, 0}; + Py_buffer buffer = {NULL, NULL}; + Py_ssize_t offset = 0; + + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &buffer, &offset)) { + goto exit; + } + return_value = Struct_unpack_from_impl(self, &buffer, offset); + +exit: + /* Cleanup for buffer */ + if (buffer.obj) { + PyBuffer_Release(&buffer); + } + + return return_value; +} + +PyDoc_STRVAR(Struct_iter_unpack__doc__, +"iter_unpack($self, buffer, /)\n" +"--\n" +"\n" +"Return an iterator yielding tuples.\n" +"\n" +"Tuples are unpacked from the given bytes source, like a repeated\n" +"invocation of unpack_from().\n" +"\n" +"Requires that the bytes length be a multiple of the struct size."); + +#define STRUCT_ITER_UNPACK_METHODDEF \ + {"iter_unpack", (PyCFunction)Struct_iter_unpack, METH_O, Struct_iter_unpack__doc__}, + +PyDoc_STRVAR(_clearcache__doc__, +"_clearcache($module, /)\n" +"--\n" +"\n" +"Clear the internal cache."); + +#define _CLEARCACHE_METHODDEF \ + {"_clearcache", (PyCFunction)_clearcache, METH_NOARGS, _clearcache__doc__}, + +static PyObject * +_clearcache_impl(PyObject *module); + +static PyObject * +_clearcache(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return _clearcache_impl(module); +} + +PyDoc_STRVAR(calcsize__doc__, +"calcsize($module, format, /)\n" +"--\n" +"\n" +"Return size in bytes of the struct described by the format string."); + +#define CALCSIZE_METHODDEF \ + {"calcsize", (PyCFunction)calcsize, METH_O, calcsize__doc__}, + +PyDoc_STRVAR(unpack__doc__, +"unpack($module, format, inputstr, /)\n" +"--\n" +"\n" +"Return a tuple containing values unpacked according to the format string.\n" +"\n" +"The buffer\'s size in bytes must be calcsize(format).\n" +"\n" +"See help(struct) for more on format strings."); + +#define UNPACK_METHODDEF \ + {"unpack", (PyCFunction)unpack, METH_FASTCALL, unpack__doc__}, + +static PyObject * +unpack_impl(PyObject *module, PyObject *format, PyObject *inputstr); + +static PyObject * +unpack(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *format; + PyObject *inputstr; + + if (!_PyArg_UnpackStack(args, nargs, "unpack", + 2, 2, + &format, &inputstr)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("unpack", kwnames)) { + goto exit; + } + return_value = unpack_impl(module, format, inputstr); + +exit: + return return_value; +} + +PyDoc_STRVAR(unpack_from__doc__, +"unpack_from($module, format, /, buffer, offset=0)\n" +"--\n" +"\n" +"Return a tuple containing values unpacked according to the format string.\n" +"\n" +"The buffer\'s size, minus offset, must be at least calcsize(format).\n" +"\n" +"See help(struct) for more on format strings."); + +#define UNPACK_FROM_METHODDEF \ + {"unpack_from", (PyCFunction)unpack_from, METH_FASTCALL, unpack_from__doc__}, + +static PyObject * +unpack_from_impl(PyObject *module, PyObject *format, Py_buffer *buffer, + Py_ssize_t offset); + +static PyObject * +unpack_from(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"", "buffer", "offset", NULL}; + static _PyArg_Parser _parser = {"Oy*|n:unpack_from", _keywords, 0}; + PyObject *format; + Py_buffer buffer = {NULL, NULL}; + Py_ssize_t offset = 0; + + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &format, &buffer, &offset)) { + goto exit; + } + return_value = unpack_from_impl(module, format, &buffer, offset); + +exit: + /* Cleanup for buffer */ + if (buffer.obj) { + PyBuffer_Release(&buffer); + } + + return return_value; +} + +PyDoc_STRVAR(iter_unpack__doc__, +"iter_unpack($module, format, buffer, /)\n" +"--\n" +"\n" +"Return an iterator yielding tuples unpacked from the given bytes.\n" +"\n" +"The bytes are unpacked according to the format string, like\n" +"a repeated invocation of unpack_from().\n" +"\n" +"Requires that the bytes length be a multiple of the format struct size."); + +#define ITER_UNPACK_METHODDEF \ + {"iter_unpack", (PyCFunction)iter_unpack, METH_FASTCALL, iter_unpack__doc__}, + +static PyObject * +iter_unpack_impl(PyObject *module, PyObject *format, PyObject *buffer); + +static PyObject * +iter_unpack(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + PyObject *format; + PyObject *buffer; + + if (!_PyArg_UnpackStack(args, nargs, "iter_unpack", + 2, 2, + &format, &buffer)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("iter_unpack", kwnames)) { + goto exit; + } + return_value = iter_unpack_impl(module, format, buffer); + +exit: + return return_value; +} +/*[clinic end generated code: output=db8152ad222fa3d0 input=a9049054013a1b77]*/ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 2 08:19:47 2017 From: python-checkins at python.org (victor.stinner) Date: Thu, 02 Feb 2017 13:19:47 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Merge_3=2E5?= Message-ID: <20170202131946.26437.54221.953DC63F@psf.io> https://hg.python.org/cpython/rev/2470a5981f6a changeset: 106384:2470a5981f6a branch: 3.6 parent: 106376:483d9133fd7e parent: 106383:32380d41e788 user: Victor Stinner date: Thu Feb 02 14:18:43 2017 +0100 summary: Merge 3.5 files: Lib/test/test_struct.py | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py --- a/Lib/test/test_struct.py +++ b/Lib/test/test_struct.py @@ -412,6 +412,10 @@ for i in range(6, len(test_string) + 1): self.assertRaises(struct.error, struct.unpack_from, fmt, data, i) + # keyword arguments + self.assertEqual(s.unpack_from(buffer=test_string, offset=2), + (b'cd01',)) + def test_pack_into(self): test_string = b'Reykjavik rocks, eow!' writable_buf = array.array('b', b' '*100) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 2 08:19:47 2017 From: python-checkins at python.org (victor.stinner) Date: Thu, 02 Feb 2017 13:19:47 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Null_merge_3=2E6?= Message-ID: <20170202131946.128841.31204.BC5BDB80@psf.io> https://hg.python.org/cpython/rev/85acca4e78be changeset: 106385:85acca4e78be parent: 106382:f3ff4a3ce77c parent: 106384:2470a5981f6a user: Victor Stinner date: Thu Feb 02 14:19:26 2017 +0100 summary: Null merge 3.6 files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 2 08:19:47 2017 From: python-checkins at python.org (victor.stinner) Date: Thu, 02 Feb 2017 13:19:47 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MzAw?= =?utf-8?q?=3A_test=5Fstruct_tests_unpack=5Ffrom=28=29_with_keywords?= Message-ID: <20170202131945.128068.42305.F6A44E9B@psf.io> https://hg.python.org/cpython/rev/32380d41e788 changeset: 106383:32380d41e788 branch: 3.5 parent: 106368:e4f6874abda6 user: Victor Stinner date: Thu Feb 02 14:18:18 2017 +0100 summary: Issue #29300: test_struct tests unpack_from() with keywords Add an unit test on the _struct.Struct.unpack_from() method to test passing arguments as keywords. files: Lib/test/test_struct.py | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py --- a/Lib/test/test_struct.py +++ b/Lib/test/test_struct.py @@ -428,6 +428,10 @@ for i in range(6, len(test_string) + 1): self.assertRaises(struct.error, struct.unpack_from, fmt, data, i) + # keyword arguments + self.assertEqual(s.unpack_from(buffer=test_string, offset=2), + (b'cd01',)) + def test_pack_into(self): test_string = b'Reykjavik rocks, eow!' writable_buf = array.array('b', b' '*100) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 2 08:24:49 2017 From: python-checkins at python.org (victor.stinner) Date: Thu, 02 Feb 2017 13:24:49 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Rename_struct=2Eunpack=28?= =?utf-8?q?=29_2nd_parameter_to_=22buffer=22?= Message-ID: <20170202132449.128206.68612.378660F3@psf.io> https://hg.python.org/cpython/rev/faa1e4f4b156 changeset: 106386:faa1e4f4b156 user: Victor Stinner date: Thu Feb 02 14:24:16 2017 +0100 summary: Rename struct.unpack() 2nd parameter to "buffer" Issue #29300: Rename struct.unpack() second parameter from "inputstr" to "buffer", and use the Py_buffer type. Fix also unit tests on struct.unpack() which passed a Unicode string instead of a bytes string as struct.unpack() second parameter. The purpose of test_trailing_counter() is to test invalid format strings, not to test the buffer parameter. files: Lib/test/test_struct.py | 6 +++--- Modules/_struct.c | 8 ++++---- Modules/clinic/_struct.c.h | 20 ++++++++++++-------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Lib/test/test_struct.py b/Lib/test/test_struct.py --- a/Lib/test/test_struct.py +++ b/Lib/test/test_struct.py @@ -530,13 +530,13 @@ # format lists containing only count spec should result in an error self.assertRaises(struct.error, struct.pack, '12345') - self.assertRaises(struct.error, struct.unpack, '12345', '') + self.assertRaises(struct.error, struct.unpack, '12345', b'') self.assertRaises(struct.error, struct.pack_into, '12345', store, 0) self.assertRaises(struct.error, struct.unpack_from, '12345', store, 0) # Format lists with trailing count spec should result in an error self.assertRaises(struct.error, struct.pack, 'c12345', 'x') - self.assertRaises(struct.error, struct.unpack, 'c12345', 'x') + self.assertRaises(struct.error, struct.unpack, 'c12345', b'x') self.assertRaises(struct.error, struct.pack_into, 'c12345', store, 0, 'x') self.assertRaises(struct.error, struct.unpack_from, 'c12345', store, @@ -545,7 +545,7 @@ # Mixed format tests self.assertRaises(struct.error, struct.pack, '14s42', 'spam and eggs') self.assertRaises(struct.error, struct.unpack, '14s42', - 'spam and eggs') + b'spam and eggs') self.assertRaises(struct.error, struct.pack_into, '14s42', store, 0, 'spam and eggs') self.assertRaises(struct.error, struct.unpack_from, '14s42', store, 0) diff --git a/Modules/_struct.c b/Modules/_struct.c --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -2162,7 +2162,7 @@ unpack format: object - inputstr: object + buffer: Py_buffer / Return a tuple containing values unpacked according to the format string. @@ -2173,8 +2173,8 @@ [clinic start generated code]*/ static PyObject * -unpack_impl(PyObject *module, PyObject *format, PyObject *inputstr) -/*[clinic end generated code: output=06951d66eae6d63b input=4b81d54988890f5e]*/ +unpack_impl(PyObject *module, PyObject *format, Py_buffer *buffer) +/*[clinic end generated code: output=f75ada02aaa33b3b input=654078e6660c2df0]*/ { PyStructObject *s_object; PyObject *result; @@ -2182,7 +2182,7 @@ s_object = cache_struct(format); if (s_object == NULL) return NULL; - result = Struct_unpack(s_object, inputstr); + result = Struct_unpack_impl(s_object, buffer); Py_DECREF(s_object); return result; } diff --git a/Modules/clinic/_struct.c.h b/Modules/clinic/_struct.c.h --- a/Modules/clinic/_struct.c.h +++ b/Modules/clinic/_struct.c.h @@ -156,7 +156,7 @@ {"calcsize", (PyCFunction)calcsize, METH_O, calcsize__doc__}, PyDoc_STRVAR(unpack__doc__, -"unpack($module, format, inputstr, /)\n" +"unpack($module, format, buffer, /)\n" "--\n" "\n" "Return a tuple containing values unpacked according to the format string.\n" @@ -169,27 +169,31 @@ {"unpack", (PyCFunction)unpack, METH_FASTCALL, unpack__doc__}, static PyObject * -unpack_impl(PyObject *module, PyObject *format, PyObject *inputstr); +unpack_impl(PyObject *module, PyObject *format, Py_buffer *buffer); static PyObject * unpack(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; PyObject *format; - PyObject *inputstr; + Py_buffer buffer = {NULL, NULL}; - if (!_PyArg_UnpackStack(args, nargs, "unpack", - 2, 2, - &format, &inputstr)) { + if (!_PyArg_ParseStack(args, nargs, "Oy*:unpack", + &format, &buffer)) { goto exit; } if (!_PyArg_NoStackKeywords("unpack", kwnames)) { goto exit; } - return_value = unpack_impl(module, format, inputstr); + return_value = unpack_impl(module, format, &buffer); exit: + /* Cleanup for buffer */ + if (buffer.obj) { + PyBuffer_Release(&buffer); + } + return return_value; } @@ -273,4 +277,4 @@ exit: return return_value; } -/*[clinic end generated code: output=db8152ad222fa3d0 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=0714090a5d0ea8ce input=a9049054013a1b77]*/ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 2 09:55:18 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 02 Feb 2017 14:55:18 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2329421=3A_Make_int?= =?utf-8?q?=2Eto=5Fbytes=28=29_and_int=2Efrom=5Fbytes=28=29_slightly_faste?= =?utf-8?q?r?= Message-ID: <20170202145517.128178.59850.0A62B049@psf.io> https://hg.python.org/cpython/rev/52c51111a7c6 changeset: 106387:52c51111a7c6 user: Serhiy Storchaka date: Thu Feb 02 16:54:45 2017 +0200 summary: Issue #29421: Make int.to_bytes() and int.from_bytes() slightly faster (10-20% for small integers). files: Objects/longobject.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Objects/longobject.c b/Objects/longobject.c --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -22,6 +22,9 @@ #define NSMALLNEGINTS 5 #endif +_Py_IDENTIFIER(little); +_Py_IDENTIFIER(big); + /* convert a PyLong of size 1, 0 or -1 to an sdigit */ #define MEDIUM_VALUE(x) (assert(-1 <= Py_SIZE(x) && Py_SIZE(x) <= 1), \ Py_SIZE(x) < 0 ? -(sdigit)(x)->ob_digit[0] : \ @@ -5198,9 +5201,9 @@ int little_endian; PyObject *bytes; - if (_PyUnicode_EqualToASCIIString(byteorder, "little")) + if (_PyUnicode_EqualToASCIIId(byteorder, &PyId_little)) little_endian = 1; - else if (_PyUnicode_EqualToASCIIString(byteorder, "big")) + else if (_PyUnicode_EqualToASCIIId(byteorder, &PyId_big)) little_endian = 0; else { PyErr_SetString(PyExc_ValueError, @@ -5258,9 +5261,9 @@ int little_endian; PyObject *long_obj, *bytes; - if (_PyUnicode_EqualToASCIIString(byteorder, "little")) + if (_PyUnicode_EqualToASCIIId(byteorder, &PyId_little)) little_endian = 1; - else if (_PyUnicode_EqualToASCIIString(byteorder, "big")) + else if (_PyUnicode_EqualToASCIIId(byteorder, &PyId_big)) little_endian = 0; else { PyErr_SetString(PyExc_ValueError, -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 2 11:25:09 2017 From: python-checkins at python.org (raymond.hettinger) Date: Thu, 02 Feb 2017 16:25:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Remove_unnecessary_variabl?= =?utf-8?b?ZXMu?= Message-ID: <20170202162508.128206.82507.4C8A211A@psf.io> https://hg.python.org/cpython/rev/23b36814d999 changeset: 106388:23b36814d999 user: Raymond Hettinger date: Thu Feb 02 08:24:48 2017 -0800 summary: Remove unnecessary variables. * so->used never gets changed during a resize * so->filled only changes when dummies are present and being eliminated files: Objects/setobject.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Objects/setobject.c b/Objects/setobject.c --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -296,8 +296,6 @@ { Py_ssize_t newsize; setentry *oldtable, *newtable, *entry; - Py_ssize_t oldfill = so->fill; - Py_ssize_t oldused = so->used; Py_ssize_t oldmask = so->mask; size_t newmask; int is_oldtable_malloced; @@ -352,21 +350,20 @@ /* Make the set empty, using the new table. */ assert(newtable != oldtable); memset(newtable, 0, sizeof(setentry) * newsize); - so->fill = oldused; - so->used = oldused; so->mask = newsize - 1; so->table = newtable; /* Copy the data over; this is refcount-neutral for active entries; dummy entries aren't copied over, of course */ newmask = (size_t)so->mask; - if (oldfill == oldused) { + if (so->fill == so->used) { for (entry = oldtable; entry <= oldtable + oldmask; entry++) { if (entry->key != NULL) { set_insert_clean(newtable, newmask, entry->key, entry->hash); } } } else { + so->fill = so->used; for (entry = oldtable; entry <= oldtable + oldmask; entry++) { if (entry->key != NULL && entry->key != dummy) { set_insert_clean(newtable, newmask, entry->key, entry->hash); -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Thu Feb 2 13:30:56 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 2 Feb 2017 10:30:56 -0800 Subject: [Python-checkins] GOOD Benchmark Results for Python 2.7 2017-02-02 Message-ID: <51a17ec4-2daf-42ed-a64a-0df835c4ce41@orsmsx152.amr.corp.intel.com> Results for project Python 2.7, build date 2017-02-02 11:48:15 +0000 commit: a889c5524520 previous commit: 51e7c9b54f56 revision date: 2017-02-01 20:53: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.13% 0.27% 3.41% 8.50% :-) pybench 0.22% 0.09% 7.65% 3.12% :-| regex_v8 0.56% -0.12% -0.21% 10.72% :-) nbody 0.12% 2.09% 11.90% 4.29% :-| json_dump_v2 0.27% 0.08% 0.56% 9.47% :-| normal_startup 1.80% 0.26% -1.86% 1.82% :-| ssbench 0.23% 0.02% -0.08% 2.91% ---------------------------------------------------------------------------------- * 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-2017-02-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 lp_benchmark_robot at intel.com Thu Feb 2 13:31:36 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 2 Feb 2017 10:31:36 -0800 Subject: [Python-checkins] UGLY Benchmark Results for Python Default 2017-02-02 Message-ID: <67b70e05-66cf-4607-93aa-e6ca8aca7b5e@orsmsx152.amr.corp.intel.com> Results for project Python default, build date 2017-02-02 11:03:37 +0000 commit: aa7ac93d23b2 previous commit: 19c4528f53b0 revision date: 2017-02-01 21:12:20 +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.38% 9.38% 14.71% :-) pybench 0.22% 0.27% 3.46% 4.95% :-) regex_v8 3.70% 2.11% 1.96% 3.00% :-( nbody 0.59% -2.41% 1.03% 2.86% :-) json_dump_v2 0.40% 1.10% 10.97% 8.60% :-| normal_startup 1.10% 0.45% 1.55% 5.85% ---------------------------------------------------------------------------------- * 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-2017-02-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 python-checkins at python.org Thu Feb 2 14:18:01 2017 From: python-checkins at python.org (vinay.sajip) Date: Thu, 02 Feb 2017 19:18:01 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogRml4ZXMgIzI0ODc1?= =?utf-8?q?=3A_pip_can_now_be_installed_in_a_venv_with_--system-site-packa?= =?utf-8?q?ges=2E?= Message-ID: <20170202191800.26087.46403.C568F06F@psf.io> https://hg.python.org/cpython/rev/1bf1d36463b4 changeset: 106389:1bf1d36463b4 branch: 3.5 parent: 106383:32380d41e788 user: Vinay Sajip date: Thu Feb 02 19:05:19 2017 +0000 summary: Fixes #24875: pip can now be installed in a venv with --system-site-packages. files: Lib/test/test_venv.py | 25 ++++++++++++++++--------- Lib/venv/__init__.py | 9 +++++++++ 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py --- a/Lib/test/test_venv.py +++ b/Lib/test/test_venv.py @@ -328,13 +328,7 @@ with open(os.devnull, "rb") as f: self.assertEqual(f.read(), b"") - # Requesting pip fails without SSL (http://bugs.python.org/issue19744) - @unittest.skipIf(ssl is None, ensurepip._MISSING_SSL_MESSAGE) - @unittest.skipUnless(threading, 'some dependencies of pip import threading' - ' module unconditionally') - # Issue #26610: pip/pep425tags.py requires ctypes - @unittest.skipUnless(ctypes, 'pip requires ctypes') - def test_with_pip(self): + def do_test_with_pip(self, system_site_packages): rmtree(self.env_dir) with EnvironmentVarGuard() as envvars: # pip's cross-version compatibility may trigger deprecation @@ -368,6 +362,7 @@ # config in place to ensure we ignore it try: self.run_with_capture(venv.create, self.env_dir, + system_site_packages=system_site_packages, with_pip=True) except subprocess.CalledProcessError as exc: # The output this produces can be a little hard to read, @@ -417,9 +412,21 @@ out = out.decode("latin-1") # Force to text, prevent decoding errors self.assertIn("Successfully uninstalled pip", out) self.assertIn("Successfully uninstalled setuptools", out) - # Check pip is now gone from the virtual environment - self.assert_pip_not_installed() + # Check pip is now gone from the virtual environment. This only + # applies in the system_site_packages=False case, because in the + # other case, pip may still be available in the system site-packages + if not system_site_packages: + self.assert_pip_not_installed() + # Requesting pip fails without SSL (http://bugs.python.org/issue19744) + @unittest.skipIf(ssl is None, ensurepip._MISSING_SSL_MESSAGE) + @unittest.skipUnless(threading, 'some dependencies of pip import threading' + ' module unconditionally') + # Issue #26610: pip/pep425tags.py requires ctypes + @unittest.skipUnless(ctypes, 'pip requires ctypes') + def test_with_pip(self): + self.do_test_with_pip(False) + self.do_test_with_pip(True) if __name__ == "__main__": unittest.main() diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py --- a/Lib/venv/__init__.py +++ b/Lib/venv/__init__.py @@ -77,6 +77,10 @@ """ env_dir = os.path.abspath(env_dir) context = self.ensure_directories(env_dir) + # See issue 24875. We need system_site_packages to be False + # until after pip is installed. + true_system_site_packages = self.system_site_packages + self.system_site_packages = False self.create_configuration(context) self.setup_python(context) if self.with_pip: @@ -84,6 +88,11 @@ if not self.upgrade: self.setup_scripts(context) self.post_setup(context) + if true_system_site_packages: + # We had set it to False before, now + # restore it and rewrite the configuration + self.system_site_packages = True + self.create_configuration(context) def clear_directory(self, path): for fn in os.listdir(path): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 2 14:18:01 2017 From: python-checkins at python.org (vinay.sajip) Date: Thu, 02 Feb 2017 19:18:01 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Fixes_=2324875=3A_Merged_fix_from_3=2E5=2E?= Message-ID: <20170202191801.25929.37081.623B5554@psf.io> https://hg.python.org/cpython/rev/7d4701b4210f changeset: 106390:7d4701b4210f branch: 3.6 parent: 106384:2470a5981f6a parent: 106389:1bf1d36463b4 user: Vinay Sajip date: Thu Feb 02 19:17:02 2017 +0000 summary: Fixes #24875: Merged fix from 3.5. files: Lib/test/test_venv.py | 22 ++++++++++++++-------- Lib/venv/__init__.py | 9 +++++++++ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py --- a/Lib/test/test_venv.py +++ b/Lib/test/test_venv.py @@ -330,12 +330,7 @@ else: self.assertTrue(os.path.exists(os.devnull)) - - @unittest.skipUnless(threading, 'some dependencies of pip import threading' - ' module unconditionally') - # Issue #26610: pip/pep425tags.py requires ctypes - @unittest.skipUnless(ctypes, 'pip requires ctypes') - def test_with_pip(self): + def do_test_with_pip(self, system_site_packages): rmtree(self.env_dir) with EnvironmentVarGuard() as envvars: # pip's cross-version compatibility may trigger deprecation @@ -369,6 +364,7 @@ # config in place to ensure we ignore it try: self.run_with_capture(venv.create, self.env_dir, + system_site_packages=system_site_packages, with_pip=True) except subprocess.CalledProcessError as exc: # The output this produces can be a little hard to read, @@ -418,9 +414,19 @@ out = out.decode("latin-1") # Force to text, prevent decoding errors self.assertIn("Successfully uninstalled pip", out) self.assertIn("Successfully uninstalled setuptools", out) - # Check pip is now gone from the virtual environment - self.assert_pip_not_installed() + # Check pip is now gone from the virtual environment. This only + # applies in the system_site_packages=False case, because in the + # other case, pip may still be available in the system site-packages + if not system_site_packages: + self.assert_pip_not_installed() + @unittest.skipUnless(threading, 'some dependencies of pip import threading' + ' module unconditionally') + # Issue #26610: pip/pep425tags.py requires ctypes + @unittest.skipUnless(ctypes, 'pip requires ctypes') + def test_with_pip(self): + self.do_test_with_pip(False) + self.do_test_with_pip(True) if __name__ == "__main__": unittest.main() diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py --- a/Lib/venv/__init__.py +++ b/Lib/venv/__init__.py @@ -57,6 +57,10 @@ """ env_dir = os.path.abspath(env_dir) context = self.ensure_directories(env_dir) + # See issue 24875. We need system_site_packages to be False + # until after pip is installed. + true_system_site_packages = self.system_site_packages + self.system_site_packages = False self.create_configuration(context) self.setup_python(context) if self.with_pip: @@ -64,6 +68,11 @@ if not self.upgrade: self.setup_scripts(context) self.post_setup(context) + if true_system_site_packages: + # We had set it to False before, now + # restore it and rewrite the configuration + self.system_site_packages = True + self.create_configuration(context) def clear_directory(self, path): for fn in os.listdir(path): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 2 14:18:02 2017 From: python-checkins at python.org (vinay.sajip) Date: Thu, 02 Feb 2017 19:18:02 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Closes_=2324875=3A_Merged_fix_from_3=2E6=2E?= Message-ID: <20170202191801.128410.12301.F5F61281@psf.io> https://hg.python.org/cpython/rev/7fd931727764 changeset: 106391:7fd931727764 parent: 106388:23b36814d999 parent: 106390:7d4701b4210f user: Vinay Sajip date: Thu Feb 02 19:17:51 2017 +0000 summary: Closes #24875: Merged fix from 3.6. files: Lib/test/test_venv.py | 22 ++++++++++++++-------- Lib/venv/__init__.py | 9 +++++++++ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/Lib/test/test_venv.py b/Lib/test/test_venv.py --- a/Lib/test/test_venv.py +++ b/Lib/test/test_venv.py @@ -330,12 +330,7 @@ else: self.assertTrue(os.path.exists(os.devnull)) - - @unittest.skipUnless(threading, 'some dependencies of pip import threading' - ' module unconditionally') - # Issue #26610: pip/pep425tags.py requires ctypes - @unittest.skipUnless(ctypes, 'pip requires ctypes') - def test_with_pip(self): + def do_test_with_pip(self, system_site_packages): rmtree(self.env_dir) with EnvironmentVarGuard() as envvars: # pip's cross-version compatibility may trigger deprecation @@ -369,6 +364,7 @@ # config in place to ensure we ignore it try: self.run_with_capture(venv.create, self.env_dir, + system_site_packages=system_site_packages, with_pip=True) except subprocess.CalledProcessError as exc: # The output this produces can be a little hard to read, @@ -418,9 +414,19 @@ out = out.decode("latin-1") # Force to text, prevent decoding errors self.assertIn("Successfully uninstalled pip", out) self.assertIn("Successfully uninstalled setuptools", out) - # Check pip is now gone from the virtual environment - self.assert_pip_not_installed() + # Check pip is now gone from the virtual environment. This only + # applies in the system_site_packages=False case, because in the + # other case, pip may still be available in the system site-packages + if not system_site_packages: + self.assert_pip_not_installed() + @unittest.skipUnless(threading, 'some dependencies of pip import threading' + ' module unconditionally') + # Issue #26610: pip/pep425tags.py requires ctypes + @unittest.skipUnless(ctypes, 'pip requires ctypes') + def test_with_pip(self): + self.do_test_with_pip(False) + self.do_test_with_pip(True) if __name__ == "__main__": unittest.main() diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py --- a/Lib/venv/__init__.py +++ b/Lib/venv/__init__.py @@ -57,6 +57,10 @@ """ env_dir = os.path.abspath(env_dir) context = self.ensure_directories(env_dir) + # See issue 24875. We need system_site_packages to be False + # until after pip is installed. + true_system_site_packages = self.system_site_packages + self.system_site_packages = False self.create_configuration(context) self.setup_python(context) if self.with_pip: @@ -64,6 +68,11 @@ if not self.upgrade: self.setup_scripts(context) self.post_setup(context) + if true_system_site_packages: + # We had set it to False before, now + # restore it and rewrite the configuration + self.system_site_packages = True + self.create_configuration(context) def clear_directory(self, path): for fn in os.listdir(path): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 2 14:27:50 2017 From: python-checkins at python.org (vinay.sajip) Date: Thu, 02 Feb 2017 19:27:50 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Fixes_=2329213=3A_merged_fix_from_3=2E5=2E?= Message-ID: <20170202192749.128704.78593.0C60B3CF@psf.io> https://hg.python.org/cpython/rev/0f3ebeb389fe changeset: 106393:0f3ebeb389fe branch: 3.6 parent: 106390:7d4701b4210f parent: 106392:2b9e5cbdb0b1 user: Vinay Sajip date: Thu Feb 02 19:26:48 2017 +0000 summary: Fixes #29213: merged fix from 3.5. files: Lib/venv/__init__.py | 10 ++++------ Lib/venv/scripts/nt/Activate.ps1 | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py --- a/Lib/venv/__init__.py +++ b/Lib/venv/__init__.py @@ -320,19 +320,17 @@ dstfile = os.path.join(dstdir, f) with open(srcfile, 'rb') as f: data = f.read() - if srcfile.endswith('.exe'): - mode = 'wb' - else: - mode = 'w' + if not srcfile.endswith('.exe'): try: data = data.decode('utf-8') data = self.replace_variables(data, context) - except UnicodeDecodeError as e: + data = data.encode('utf-8') + except UnicodeError as e: data = None logger.warning('unable to copy script %r, ' 'may be binary: %s', srcfile, e) if data is not None: - with open(dstfile, mode) as f: + with open(dstfile, 'wb') as f: f.write(data) shutil.copymode(srcfile, dstfile) diff --git a/Lib/venv/scripts/nt/Activate.ps1 b/Lib/venv/scripts/nt/Activate.ps1 --- a/Lib/venv/scripts/nt/Activate.ps1 +++ b/Lib/venv/scripts/nt/Activate.ps1 @@ -26,7 +26,7 @@ } deactivate -nondestructive - + $env:VIRTUAL_ENV="__VENV_DIR__" if (! $env:VIRTUAL_ENV_DISABLE_PROMPT) { -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 2 14:27:50 2017 From: python-checkins at python.org (vinay.sajip) Date: Thu, 02 Feb 2017 19:27:50 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogRml4ZXMgIzI5MjEz?= =?utf-8?q?=3A_regularised_EOLs_of_venv_scripts=2E?= Message-ID: <20170202192748.110213.85916.478C8C44@psf.io> https://hg.python.org/cpython/rev/2b9e5cbdb0b1 changeset: 106392:2b9e5cbdb0b1 branch: 3.5 parent: 106389:1bf1d36463b4 user: Vinay Sajip date: Thu Feb 02 19:25:24 2017 +0000 summary: Fixes #29213: regularised EOLs of venv scripts. files: Lib/venv/__init__.py | 10 ++++------ Lib/venv/scripts/nt/Activate.ps1 | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py --- a/Lib/venv/__init__.py +++ b/Lib/venv/__init__.py @@ -339,19 +339,17 @@ dstfile = os.path.join(dstdir, f) with open(srcfile, 'rb') as f: data = f.read() - if srcfile.endswith('.exe'): - mode = 'wb' - else: - mode = 'w' + if not srcfile.endswith('.exe'): try: data = data.decode('utf-8') data = self.replace_variables(data, context) - except UnicodeDecodeError as e: + data = data.encode('utf-8') + except UnicodeError as e: data = None logger.warning('unable to copy script %r, ' 'may be binary: %s', srcfile, e) if data is not None: - with open(dstfile, mode) as f: + with open(dstfile, 'wb') as f: f.write(data) shutil.copymode(srcfile, dstfile) diff --git a/Lib/venv/scripts/nt/Activate.ps1 b/Lib/venv/scripts/nt/Activate.ps1 --- a/Lib/venv/scripts/nt/Activate.ps1 +++ b/Lib/venv/scripts/nt/Activate.ps1 @@ -26,7 +26,7 @@ } deactivate -nondestructive - + $env:VIRTUAL_ENV="__VENV_DIR__" if (! $env:VIRTUAL_ENV_DISABLE_PROMPT) { -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 2 14:32:10 2017 From: python-checkins at python.org (mark.dickinson) Date: Thu, 02 Feb 2017 19:32:10 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzE0Mzc2?= =?utf-8?q?=3A_sys=2Eexit_now_accepts_longs_as_well_as_ints=2E_Thanks_Gare?= =?utf-8?q?th_Rees=2E?= Message-ID: <20170202193209.128206.9243.7B4B1DD5@psf.io> https://hg.python.org/cpython/rev/14682d00b09a changeset: 106394:14682d00b09a branch: 2.7 parent: 106379:d7804789368a user: Mark Dickinson date: Thu Feb 02 19:31:53 2017 +0000 summary: Issue #14376: sys.exit now accepts longs as well as ints. Thanks Gareth Rees. files: Lib/test/test_sys.py | 11 +++++++++++ Misc/NEWS | 3 +++ Python/pythonrun.c | 2 +- 3 files changed, 15 insertions(+), 1 deletions(-) diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -164,6 +164,17 @@ self.assertEqual(out, b'') self.assertEqual(err, b'') + # test that the exit machinery handles long exit codes + rc, out, err = assert_python_failure('-c', 'raise SystemExit(47L)') + self.assertEqual(rc, 47) + self.assertEqual(out, b'') + self.assertEqual(err, b'') + + rc, out, err = assert_python_ok('-c', 'raise SystemExit(0L)') + self.assertEqual(rc, 0) + self.assertEqual(out, b'') + self.assertEqual(err, b'') + def check_exit_message(code, expected, **env_vars): rc, out, err = assert_python_failure('-c', code, **env_vars) self.assertEqual(rc, 1) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #14376: Allow sys.exit to accept longs as well as ints. Patch + by Gareth Rees. + - Issue #29028: Fixed possible use-after-free bugs in the subscription of the buffer object with custom index object. diff --git a/Python/pythonrun.c b/Python/pythonrun.c --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -1127,7 +1127,7 @@ /* If we failed to dig out the 'code' attribute, just let the else clause below print the error. */ } - if (PyInt_Check(value)) + if (PyInt_Check(value) || PyLong_Check(value)) exitcode = (int)PyInt_AsLong(value); else { PyObject *sys_stderr = PySys_GetObject("stderr"); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 2 14:33:49 2017 From: python-checkins at python.org (vinay.sajip) Date: Thu, 02 Feb 2017 19:33:49 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Closes_=2329213=3A_Merged_?= =?utf-8?q?fix_from_3=2E6=2E?= Message-ID: <20170202193349.96359.5320.0332D0A4@psf.io> https://hg.python.org/cpython/rev/c23224ebc9e5 changeset: 106395:c23224ebc9e5 parent: 106391:7fd931727764 user: Vinay Sajip date: Thu Feb 02 19:33:43 2017 +0000 summary: Closes #29213: Merged fix from 3.6. files: Lib/venv/__init__.py | 10 ++++------ Lib/venv/scripts/nt/Activate.ps1 | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py --- a/Lib/venv/__init__.py +++ b/Lib/venv/__init__.py @@ -320,19 +320,17 @@ dstfile = os.path.join(dstdir, f) with open(srcfile, 'rb') as f: data = f.read() - if srcfile.endswith('.exe'): - mode = 'wb' - else: - mode = 'w' + if not srcfile.endswith('.exe'): try: data = data.decode('utf-8') data = self.replace_variables(data, context) - except UnicodeDecodeError as e: + data = data.encode('utf-8') + except UnicodeError as e: data = None logger.warning('unable to copy script %r, ' 'may be binary: %s', srcfile, e) if data is not None: - with open(dstfile, mode) as f: + with open(dstfile, 'wb') as f: f.write(data) shutil.copymode(srcfile, dstfile) diff --git a/Lib/venv/scripts/nt/Activate.ps1 b/Lib/venv/scripts/nt/Activate.ps1 --- a/Lib/venv/scripts/nt/Activate.ps1 +++ b/Lib/venv/scripts/nt/Activate.ps1 @@ -26,7 +26,7 @@ } deactivate -nondestructive - + $env:VIRTUAL_ENV="__VENV_DIR__" if (! $env:VIRTUAL_ENV_DISABLE_PROMPT) { -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 2 17:43:17 2017 From: python-checkins at python.org (inada.naoki) Date: Thu, 02 Feb 2017 22:43:17 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2329263=3A_LOAD=5FM?= =?utf-8?q?ETHOD_support_for_C_methods?= Message-ID: <20170202224311.111010.30231.60FFBE82@psf.io> https://hg.python.org/cpython/rev/135a9a0c09f9 changeset: 106396:135a9a0c09f9 user: INADA Naoki date: Fri Feb 03 07:43:03 2017 +0900 summary: Issue #29263: LOAD_METHOD support for C methods Calling builtin method is at most 10% faster. files: Include/descrobject.h | 3 + Include/methodobject.h | 7 +++ Lib/test/test_gdb.py | 2 +- Objects/descrobject.c | 38 +++++++++++++++++++++ Objects/methodobject.c | 53 ++++++++++++++++------------- Objects/object.c | 4 +- Python/ceval.c | 12 +++--- Tools/gdb/libpython.py | 5 +-- 8 files changed, 88 insertions(+), 36 deletions(-) diff --git a/Include/descrobject.h b/Include/descrobject.h --- a/Include/descrobject.h +++ b/Include/descrobject.h @@ -90,6 +90,9 @@ PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *, struct PyGetSetDef *); #ifndef Py_LIMITED_API + +PyAPI_FUNC(PyObject *) _PyMethodDescr_FastCallKeywords( + PyObject *descrobj, PyObject **stack, Py_ssize_t nargs, PyObject *kwnames); PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *, struct wrapperbase *, void *); #define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL) diff --git a/Include/methodobject.h b/Include/methodobject.h --- a/Include/methodobject.h +++ b/Include/methodobject.h @@ -102,6 +102,13 @@ PyObject **args, Py_ssize_t nargs, PyObject *kwargs); + +PyAPI_FUNC(PyObject *) _PyMethodDef_RawFastCallKeywords( + PyMethodDef *method, + PyObject *self, + PyObject **args, + Py_ssize_t nargs, + PyObject *kwnames); #endif PyAPI_FUNC(int) PyCFunction_ClearFreeList(void); diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py --- a/Lib/test/test_gdb.py +++ b/Lib/test/test_gdb.py @@ -846,7 +846,7 @@ breakpoint='time_gmtime', cmds_after_breakpoint=['py-bt-full'], ) - self.assertIn('#1 tp_name); + return NULL; + } + self = args[0]; + if (!_PyObject_RealIsSubclass((PyObject *)Py_TYPE(self), + (PyObject *)PyDescr_TYPE(descr))) { + PyErr_Format(PyExc_TypeError, + "descriptor '%V' " + "requires a '%.100s' object " + "but received a '%.100s'", + descr_name((PyDescrObject *)descr), "?", + PyDescr_TYPE(descr)->tp_name, + self->ob_type->tp_name); + return NULL; + } + + result = _PyMethodDef_RawFastCallKeywords(descr->d_method, self, + args+1, nargs-1, kwnames); + result = _Py_CheckFunctionResult((PyObject *)descr, result, NULL); + return result; +} + static PyObject * classmethoddescr_call(PyMethodDescrObject *descr, PyObject *args, PyObject *kwds) diff --git a/Objects/methodobject.c b/Objects/methodobject.c --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -215,32 +215,24 @@ } PyObject * -_PyCFunction_FastCallKeywords(PyObject *func_obj, PyObject **args, - Py_ssize_t nargs, PyObject *kwnames) +_PyMethodDef_RawFastCallKeywords(PyMethodDef *method, PyObject *self, PyObject **args, + Py_ssize_t nargs, PyObject *kwnames) { - PyCFunctionObject *func; - PyCFunction meth; - PyObject *self, *result; - Py_ssize_t nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames); - int flags; + /* _PyMethodDef_RawFastCallKeywords() must not be called with an exception set, + because it can clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); - assert(func_obj != NULL); - assert(PyCFunction_Check(func_obj)); + assert(method != NULL); assert(nargs >= 0); assert(kwnames == NULL || PyTuple_CheckExact(kwnames)); - assert((nargs == 0 && nkwargs == 0) || args != NULL); /* kwnames must only contains str strings, no subclass, and all keys must be unique */ - /* _PyCFunction_FastCallKeywords() must not be called with an exception - set, because it can clear it (directly or indirectly) and so the caller - loses its exception */ - assert(!PyErr_Occurred()); - - func = (PyCFunctionObject*)func_obj; - meth = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - flags = PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST); + PyCFunction meth = method->ml_meth; + int flags = method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST); + Py_ssize_t nkwargs = kwnames == NULL ? 0 : PyTuple_Size(kwnames); + PyObject *result; switch (flags) { @@ -248,7 +240,7 @@ if (nargs != 0) { PyErr_Format(PyExc_TypeError, "%.200s() takes no arguments (%zd given)", - func->m_ml->ml_name, nargs); + method->ml_name, nargs); return NULL; } @@ -263,7 +255,7 @@ if (nargs != 1) { PyErr_Format(PyExc_TypeError, "%.200s() takes exactly one argument (%zd given)", - func->m_ml->ml_name, nargs); + method->ml_name, nargs); return NULL; } @@ -326,16 +318,31 @@ return NULL; } - result = _Py_CheckFunctionResult(func_obj, result, NULL); return result; no_keyword_error: PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", - func->m_ml->ml_name); + method->ml_name); return NULL; } +PyObject * +_PyCFunction_FastCallKeywords(PyObject *func, PyObject **args, + Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *result; + + assert(func != NULL); + assert(PyCFunction_Check(func)); + + result = _PyMethodDef_RawFastCallKeywords(((PyCFunctionObject*)func)->m_ml, + PyCFunction_GET_SELF(func), + args, nargs, kwnames); + result = _Py_CheckFunctionResult(func, result, NULL); + return result; +} + /* Methods (the standard built-in methods, that is) */ static void diff --git a/Objects/object.c b/Objects/object.c --- a/Objects/object.c +++ b/Objects/object.c @@ -1060,8 +1060,8 @@ descr = _PyType_Lookup(tp, name); if (descr != NULL) { Py_INCREF(descr); - if (PyFunction_Check(descr)) { - /* A python method. */ + if (PyFunction_Check(descr) || + (Py_TYPE(descr) == &PyMethodDescr_Type)) { meth_found = 1; } else { f = descr->ob_type->tp_descr_get; diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -4832,17 +4832,19 @@ PyObject *x, *w; Py_ssize_t nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames); Py_ssize_t nargs = oparg - nkwargs; - PyObject **stack; + PyObject **stack = (*pp_stack) - nargs - nkwargs; /* Always dispatch PyCFunction first, because these are presumed to be the most frequent callable object. */ if (PyCFunction_Check(func)) { PyThreadState *tstate = PyThreadState_GET(); - - stack = (*pp_stack) - nargs - nkwargs; C_TRACE(x, _PyCFunction_FastCallKeywords(func, stack, nargs, kwnames)); } + else if (Py_TYPE(func) == &PyMethodDescr_Type) { + PyThreadState *tstate = PyThreadState_GET(); + C_TRACE(x, _PyMethodDescr_FastCallKeywords(func, stack, nargs, kwnames)); + } else { if (PyMethod_Check(func) && PyMethod_GET_SELF(func) != NULL) { /* Optimize access to bound methods. Reuse the Python stack @@ -4856,20 +4858,18 @@ Py_INCREF(func); Py_SETREF(*pfunc, self); nargs++; + stack--; } else { Py_INCREF(func); } - stack = (*pp_stack) - nargs - nkwargs; - if (PyFunction_Check(func)) { x = fast_function(func, stack, nargs, kwnames); } else { x = _PyObject_FastCallKeywords(func, stack, nargs, kwnames); } - Py_DECREF(func); } diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py --- a/Tools/gdb/libpython.py +++ b/Tools/gdb/libpython.py @@ -1540,10 +1540,7 @@ if caller in ('_PyCFunction_FastCallDict', '_PyCFunction_FastCallKeywords'): - if caller == '_PyCFunction_FastCallKeywords': - arg_name = 'func_obj' - else: - arg_name = 'func' + arg_name = 'func' # Within that frame: # "func" is the local containing the PyObject* of the # PyCFunctionObject instance -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 2 22:14:21 2017 From: python-checkins at python.org (xiang.zhang) Date: Fri, 03 Feb 2017 03:14:21 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_null_merge?= Message-ID: <20170203031421.25929.95905.8DE4879C@psf.io> https://hg.python.org/cpython/rev/b382206aeb2b changeset: 106397:b382206aeb2b parent: 106396:135a9a0c09f9 parent: 106393:0f3ebeb389fe user: Xiang Zhang date: Fri Feb 03 11:08:45 2017 +0800 summary: null merge files: -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Fri Feb 3 04:31:53 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 03 Feb 2017 09:31:53 +0000 Subject: [Python-checkins] Daily reference leaks (b382206aeb2b): sum=4 Message-ID: <20170203093153.7440.69639.F335DA79@psf.io> results for b382206aeb2b on branch "default" -------------------------------------------- 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/reflogwL83M8', '--timeout', '7200'] From lp_benchmark_robot at intel.com Fri Feb 3 14:06:00 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 3 Feb 2017 11:06:00 -0800 Subject: [Python-checkins] GOOD Benchmark Results for Python 2.7 2017-02-03 Message-ID: <14275201-02ba-4ad9-809c-1abafa621233@orsmsx108.amr.corp.intel.com> Results for project Python 2.7, build date 2017-02-03 11:47:46 +0000 commit: 14682d00b09a previous commit: a889c5524520 revision date: 2017-02-02 19:31:53 +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.11% 1.40% 4.76% 6.01% :-) pybench 0.23% 0.09% 7.73% 2.76% :-| regex_v8 0.56% 0.02% -0.18% 9.93% :-) nbody 0.10% 0.12% 12.01% 1.62% :-| json_dump_v2 0.29% -0.10% 0.45% 10.23% :-( normal_startup 1.81% -0.77% -2.64% 3.19% :-| ssbench 0.14% 0.20% 0.12% 2.33% ---------------------------------------------------------------------------------- * 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-2017-02-03/ 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 Fri Feb 3 14:11:38 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 3 Feb 2017 11:11:38 -0800 Subject: [Python-checkins] UGLY Benchmark Results for Python Default 2017-02-03 Message-ID: <97061803-1ea5-4e25-94a8-3e5669d5cfac@orsmsx108.amr.corp.intel.com> Results for project Python default, build date 2017-02-03 11:03:40 +0000 commit: 135a9a0c09f9 previous commit: aa7ac93d23b2 revision date: 2017-02-02 22:43: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 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% 3.18% 12.26% 13.23% :-) pybench 0.17% 0.50% 3.94% 5.40% :-| regex_v8 3.69% -0.06% 1.90% -5.52% :-( nbody 0.09% -2.89% -1.83% 3.60% :-) json_dump_v2 0.31% 0.05% 11.02% 8.02% :-| normal_startup 1.01% -0.18% 1.20% 6.35% ---------------------------------------------------------------------------------- * 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-2017-02-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 Sat Feb 4 01:05:31 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Feb 2017 06:05:31 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2329311=3A_Regenera?= =?utf-8?q?te_Argument_Clinic=2E?= Message-ID: <20170204060529.25929.27545.88BC190E@psf.io> https://hg.python.org/cpython/rev/222b9392a83b changeset: 106398:222b9392a83b user: Serhiy Storchaka date: Sat Feb 04 08:05:07 2017 +0200 summary: Issue #29311: Regenerate Argument Clinic. files: Objects/clinic/dictobject.c.h | 4 ++-- Objects/dictobject.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 @@ -40,7 +40,7 @@ "__contains__($self, key, /)\n" "--\n" "\n" -"True if the dictionary has a specified key, else False."); +"True if the dictionary has the specified key, else False."); #define DICT___CONTAINS___METHODDEF \ {"__contains__", (PyCFunction)dict___contains__, METH_O|METH_COEXIST, dict___contains____doc__}, @@ -115,4 +115,4 @@ exit: return return_value; } -/*[clinic end generated code: output=91aa6a9f3c402b1b input=a9049054013a1b77]*/ +/*[clinic end generated code: output=4d57df133cf66e53 input=a9049054013a1b77]*/ diff --git a/Objects/dictobject.c b/Objects/dictobject.c --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -2769,7 +2769,7 @@ static PyObject * dict___contains__(PyDictObject *self, PyObject *key) -/*[clinic end generated code: output=a3d03db709ed6e6b input=f39613886bf975b7]*/ +/*[clinic end generated code: output=a3d03db709ed6e6b input=fe1cb42ad831e820]*/ { register PyDictObject *mp = self; Py_hash_t hash; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 01:13:55 2017 From: python-checkins at python.org (berker.peksag) Date: Sat, 04 Feb 2017 06:13:55 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329198=3A_Merge_from_3=2E5?= Message-ID: <20170204061355.96018.19987.CB060EF7@psf.io> https://hg.python.org/cpython/rev/b475b076cc1f changeset: 106400:b475b076cc1f branch: 3.6 parent: 106393:0f3ebeb389fe parent: 106399:fe29826af634 user: Berker Peksag date: Sat Feb 04 09:18:42 2017 +0300 summary: Issue #29198: Merge from 3.5 files: Doc/library/typing.rst | 33 ++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -689,6 +689,39 @@ yield start start += 1 +.. class:: AsyncGenerator(AsyncIterator[T_co], Generic[T_co, T_contra]) + + An async generator can be annotated by the generic type + ``AsyncGenerator[YieldType, SendType]``. For example:: + + async def echo_round() -> AsyncGenerator[int, float]: + sent = yield 0 + while sent >= 0.0: + rounded = await round(sent) + sent = yield rounded + + Unlike normal generators, async generators cannot return a value, so there + is no ``ReturnType`` type parameter. As with :class:`Generator`, the + ``SendType`` behaves contravariantly. + + If your generator will only yield values, set the ``SendType`` to + ``None``:: + + async def infinite_stream(start: int) -> AsyncGenerator[int, None]: + while True: + yield start + start = await increment(start) + + Alternatively, annotate your generator as having a return type of + either ``AsyncIterable[YieldType]`` or ``AsyncIterator[YieldType]``:: + + async def infinite_stream(start: int) -> AsyncIterator[int]: + while True: + yield start + start = await increment(start) + + .. versionadded:: 3.5.4 + .. class:: Text ``Text`` is an alias for ``str``. It is provided to supply a forward -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 01:13:55 2017 From: python-checkins at python.org (berker.peksag) Date: Sat, 04 Feb 2017 06:13:55 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MTk4?= =?utf-8?q?=3A_Document_typing=2EAsyncGenerator?= Message-ID: <20170204061355.8213.69081.150ADC4B@psf.io> https://hg.python.org/cpython/rev/fe29826af634 changeset: 106399:fe29826af634 branch: 3.5 parent: 106392:2b9e5cbdb0b1 user: Berker Peksag date: Sat Feb 04 09:18:11 2017 +0300 summary: Issue #29198: Document typing.AsyncGenerator Patch by Jelle Zijlstra. files: Doc/library/typing.rst | 33 ++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -670,6 +670,39 @@ yield start start += 1 +.. class:: AsyncGenerator(AsyncIterator[T_co], Generic[T_co, T_contra]) + + An async generator can be annotated by the generic type + ``AsyncGenerator[YieldType, SendType]``. For example:: + + async def echo_round() -> AsyncGenerator[int, float]: + sent = yield 0 + while sent >= 0.0: + rounded = await round(sent) + sent = yield rounded + + Unlike normal generators, async generators cannot return a value, so there + is no ``ReturnType`` type parameter. As with :class:`Generator`, the + ``SendType`` behaves contravariantly. + + If your generator will only yield values, set the ``SendType`` to + ``None``:: + + async def infinite_stream(start: int) -> AsyncGenerator[int, None]: + while True: + yield start + start = await increment(start) + + Alternatively, annotate your generator as having a return type of + either ``AsyncIterable[YieldType]`` or ``AsyncIterator[YieldType]``:: + + async def infinite_stream(start: int) -> AsyncIterator[int]: + while True: + yield start + start = await increment(start) + + .. versionadded:: 3.5.4 + .. class:: Text ``Text`` is an alias for ``str``. It is provided to supply a forward -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 01:13:57 2017 From: python-checkins at python.org (berker.peksag) Date: Sat, 04 Feb 2017 06:13:57 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2329198=3A_Merge_from_3=2E6?= Message-ID: <20170204061356.26197.25027.187AC5EC@psf.io> https://hg.python.org/cpython/rev/2b55b18bf151 changeset: 106401:2b55b18bf151 parent: 106398:222b9392a83b parent: 106400:b475b076cc1f user: Berker Peksag date: Sat Feb 04 09:19:04 2017 +0300 summary: Issue #29198: Merge from 3.6 files: Doc/library/typing.rst | 33 ++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -689,6 +689,39 @@ yield start start += 1 +.. class:: AsyncGenerator(AsyncIterator[T_co], Generic[T_co, T_contra]) + + An async generator can be annotated by the generic type + ``AsyncGenerator[YieldType, SendType]``. For example:: + + async def echo_round() -> AsyncGenerator[int, float]: + sent = yield 0 + while sent >= 0.0: + rounded = await round(sent) + sent = yield rounded + + Unlike normal generators, async generators cannot return a value, so there + is no ``ReturnType`` type parameter. As with :class:`Generator`, the + ``SendType`` behaves contravariantly. + + If your generator will only yield values, set the ``SendType`` to + ``None``:: + + async def infinite_stream(start: int) -> AsyncGenerator[int, None]: + while True: + yield start + start = await increment(start) + + Alternatively, annotate your generator as having a return type of + either ``AsyncIterable[YieldType]`` or ``AsyncIterator[YieldType]``:: + + async def infinite_stream(start: int) -> AsyncIterator[int]: + while True: + yield start + start = await increment(start) + + .. versionadded:: 3.5.4 + .. class:: Text ``Text`` is an alias for ``str``. It is provided to supply a forward -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 01:29:59 2017 From: python-checkins at python.org (berker.peksag) Date: Sat, 04 Feb 2017 06:29:59 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329198=3A_Merge_from_3=2E5?= Message-ID: <20170204062959.96094.77354.DF85801D@psf.io> https://hg.python.org/cpython/rev/f49b6c35d1e3 changeset: 106403:f49b6c35d1e3 branch: 3.6 parent: 106400:b475b076cc1f parent: 106402:d7eb9526c4f4 user: Berker Peksag date: Sat Feb 04 09:34:48 2017 +0300 summary: Issue #29198: Merge from 3.5 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 @@ -306,7 +306,7 @@ The :data:`Any` type ---------------------- +-------------------- A special kind of type is :data:`Any`. A static type checker will treat every type as being compatible with :data:`Any` and :data:`Any` as being @@ -638,7 +638,7 @@ .. class:: AsyncIterator(AsyncIterable[T_co]) - A generic version of :class:`collections.abc.AsyncIterator`. + A generic version of :class:`collections.abc.AsyncIterator`. .. class:: ContextManager(Generic[T_co]) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 01:29:59 2017 From: python-checkins at python.org (berker.peksag) Date: Sat, 04 Feb 2017 06:29:59 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2329198=3A_Merge_from_3=2E6?= Message-ID: <20170204062959.96094.78634.E2C10187@psf.io> https://hg.python.org/cpython/rev/8a898cfd089a changeset: 106404:8a898cfd089a parent: 106401:2b55b18bf151 parent: 106403:f49b6c35d1e3 user: Berker Peksag date: Sat Feb 04 09:35:10 2017 +0300 summary: Issue #29198: Merge from 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 @@ -306,7 +306,7 @@ The :data:`Any` type ---------------------- +-------------------- A special kind of type is :data:`Any`. A static type checker will treat every type as being compatible with :data:`Any` and :data:`Any` as being @@ -638,7 +638,7 @@ .. class:: AsyncIterator(AsyncIterable[T_co]) - A generic version of :class:`collections.abc.AsyncIterator`. + A generic version of :class:`collections.abc.AsyncIterator`. .. class:: ContextManager(Generic[T_co]) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 01:29:59 2017 From: python-checkins at python.org (berker.peksag) Date: Sat, 04 Feb 2017 06:29:59 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MTk4?= =?utf-8?q?=3A_Fix_indentation_and_markup_in_typing=2Erst?= Message-ID: <20170204062959.128501.6619.801F674C@psf.io> https://hg.python.org/cpython/rev/d7eb9526c4f4 changeset: 106402:d7eb9526c4f4 branch: 3.5 parent: 106399:fe29826af634 user: Berker Peksag date: Sat Feb 04 09:34:16 2017 +0300 summary: Issue #29198: Fix indentation and markup in typing.rst Patch by Jelle Zijlstra. 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 @@ -299,7 +299,7 @@ The :data:`Any` type ---------------------- +-------------------- A special kind of type is :data:`Any`. A static type checker will treat every type as being compatible with :data:`Any` and :data:`Any` as being @@ -625,7 +625,7 @@ .. class:: AsyncIterator(AsyncIterable[T_co]) - A generic version of :class:`collections.abc.AsyncIterator`. + A generic version of :class:`collections.abc.AsyncIterator`. .. class:: Dict(dict, MutableMapping[KT, VT]) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 04:08:28 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Feb 2017 09:08:28 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI3ODY3?= =?utf-8?q?=3A_Silenced_may-be-used-uninitialized_warnings_after?= Message-ID: <20170204090828.7642.3349.7E7B6DC2@psf.io> https://hg.python.org/cpython/rev/d7b637af5a7e changeset: 106405:d7b637af5a7e branch: 3.5 parent: 106402:d7eb9526c4f4 user: Serhiy Storchaka date: Sat Feb 04 11:04:00 2017 +0200 summary: Issue #27867: Silenced may-be-used-uninitialized warnings after using PySlice_GetIndicesEx() in debug builds. files: Include/sliceobject.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Include/sliceobject.h b/Include/sliceobject.h --- a/Include/sliceobject.h +++ b/Include/sliceobject.h @@ -46,8 +46,9 @@ #if !defined(Py_LIMITED_API) || (Py_LIMITED_API+0 >= 0x03050400 && Py_LIMITED_API+0 < 0x03060000) || Py_LIMITED_API+0 >= 0x03060100 #define PySlice_GetIndicesEx(slice, length, start, stop, step, slicelen) ( \ - PySlice_Unpack((slice), (start), (stop), (step)) < 0 ? -1 : \ - ((*slicelen = PySlice_AdjustIndices((length), (start), (stop), *(step))), \ + PySlice_Unpack((slice), (start), (stop), (step)) < 0 ? \ + ((*(slicelen) = 0), -1) : \ + ((*(slicelen) = PySlice_AdjustIndices((length), (start), (stop), *(step))), \ 0)) PyAPI_FUNC(int) PySlice_Unpack(PyObject *slice, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 04:08:28 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Feb 2017 09:08:28 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI3ODY3?= =?utf-8?q?=3A_Silenced_may-be-used-uninitialized_warnings_after?= Message-ID: <20170204090828.7901.58652.9BCDC475@psf.io> https://hg.python.org/cpython/rev/17d0cfc64a32 changeset: 106406:17d0cfc64a32 branch: 2.7 parent: 106394:14682d00b09a user: Serhiy Storchaka date: Sat Feb 04 11:04:00 2017 +0200 summary: Issue #27867: Silenced may-be-used-uninitialized warnings after using PySlice_GetIndicesEx() in debug builds. files: Include/sliceobject.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Include/sliceobject.h b/Include/sliceobject.h --- a/Include/sliceobject.h +++ b/Include/sliceobject.h @@ -39,8 +39,9 @@ Py_ssize_t *step, Py_ssize_t *slicelength); #define PySlice_GetIndicesEx(slice, length, start, stop, step, slicelen) ( \ - _PySlice_Unpack((PyObject *)(slice), (start), (stop), (step)) < 0 ? -1 : \ - ((*slicelen = _PySlice_AdjustIndices((length), (start), (stop), *(step))), \ + _PySlice_Unpack((PyObject *)(slice), (start), (stop), (step)) < 0 ? \ + ((*(slicelen) = 0), -1) : \ + ((*(slicelen) = PySlice_AdjustIndices((length), (start), (stop), *(step))), \ 0)) PyAPI_FUNC(int) _PySlice_Unpack(PyObject *slice, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 04:08:29 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Feb 2017 09:08:29 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2327867=3A_Silenced_may-be-used-uninitialized_warnings_?= =?utf-8?q?after?= Message-ID: <20170204090828.25874.95312.47BA9088@psf.io> https://hg.python.org/cpython/rev/b8fc4de84b9a changeset: 106407:b8fc4de84b9a branch: 3.6 parent: 106403:f49b6c35d1e3 parent: 106405:d7b637af5a7e user: Serhiy Storchaka date: Sat Feb 04 11:07:17 2017 +0200 summary: Issue #27867: Silenced may-be-used-uninitialized warnings after using PySlice_GetIndicesEx() in debug builds. files: Include/sliceobject.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Include/sliceobject.h b/Include/sliceobject.h --- a/Include/sliceobject.h +++ b/Include/sliceobject.h @@ -46,8 +46,9 @@ #if !defined(Py_LIMITED_API) || (Py_LIMITED_API+0 >= 0x03050400 && Py_LIMITED_API+0 < 0x03060000) || Py_LIMITED_API+0 >= 0x03060100 #define PySlice_GetIndicesEx(slice, length, start, stop, step, slicelen) ( \ - PySlice_Unpack((slice), (start), (stop), (step)) < 0 ? -1 : \ - ((*slicelen = PySlice_AdjustIndices((length), (start), (stop), *(step))), \ + PySlice_Unpack((slice), (start), (stop), (step)) < 0 ? \ + ((*(slicelen) = 0), -1) : \ + ((*(slicelen) = PySlice_AdjustIndices((length), (start), (stop), *(step))), \ 0)) PyAPI_FUNC(int) PySlice_Unpack(PyObject *slice, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 04:08:29 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Feb 2017 09:08:29 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2327867=3A_Silenced_may-be-used-uninitialized_war?= =?utf-8?q?nings_after?= Message-ID: <20170204090829.127832.39860.29AD4ECE@psf.io> https://hg.python.org/cpython/rev/af8315720e67 changeset: 106408:af8315720e67 parent: 106404:8a898cfd089a parent: 106407:b8fc4de84b9a user: Serhiy Storchaka date: Sat Feb 04 11:08:04 2017 +0200 summary: Issue #27867: Silenced may-be-used-uninitialized warnings after using PySlice_GetIndicesEx() in debug builds. files: Include/sliceobject.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Include/sliceobject.h b/Include/sliceobject.h --- a/Include/sliceobject.h +++ b/Include/sliceobject.h @@ -46,8 +46,9 @@ #if !defined(Py_LIMITED_API) || (Py_LIMITED_API+0 >= 0x03050400 && Py_LIMITED_API+0 < 0x03060000) || Py_LIMITED_API+0 >= 0x03060100 #define PySlice_GetIndicesEx(slice, length, start, stop, step, slicelen) ( \ - PySlice_Unpack((slice), (start), (stop), (step)) < 0 ? -1 : \ - ((*slicelen = PySlice_AdjustIndices((length), (start), (stop), *(step))), \ + PySlice_Unpack((slice), (start), (stop), (step)) < 0 ? \ + ((*(slicelen) = 0), -1) : \ + ((*(slicelen) = PySlice_AdjustIndices((length), (start), (stop), *(step))), \ 0)) PyAPI_FUNC(int) PySlice_Unpack(PyObject *slice, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 04:10:37 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Feb 2017 09:10:37 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI3ODY3?= =?utf-8?q?=3A_Fixed_merging_error=2E?= Message-ID: <20170204091037.110974.81063.3F1D1A47@psf.io> https://hg.python.org/cpython/rev/110ec861e5ea changeset: 106409:110ec861e5ea branch: 2.7 parent: 106406:17d0cfc64a32 user: Serhiy Storchaka date: Sat Feb 04 11:10:25 2017 +0200 summary: Issue #27867: Fixed merging error. files: Include/sliceobject.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Include/sliceobject.h b/Include/sliceobject.h --- a/Include/sliceobject.h +++ b/Include/sliceobject.h @@ -41,7 +41,7 @@ #define PySlice_GetIndicesEx(slice, length, start, stop, step, slicelen) ( \ _PySlice_Unpack((PyObject *)(slice), (start), (stop), (step)) < 0 ? \ ((*(slicelen) = 0), -1) : \ - ((*(slicelen) = PySlice_AdjustIndices((length), (start), (stop), *(step))), \ + ((*(slicelen) = _PySlice_AdjustIndices((length), (start), (stop), *(step))), \ 0)) PyAPI_FUNC(int) _PySlice_Unpack(PyObject *slice, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 04:15:09 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Feb 2017 09:15:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2329300=3A_Use_Argu?= =?utf-8?q?ment_Clinic_for_getting_struct_object_from_the_format=2E?= Message-ID: <20170204091509.127832.32272.E908A10F@psf.io> https://hg.python.org/cpython/rev/9245894af223 changeset: 106410:9245894af223 parent: 106408:af8315720e67 user: Serhiy Storchaka date: Sat Feb 04 11:14:52 2017 +0200 summary: Issue #29300: Use Argument Clinic for getting struct object from the format. files: Modules/_struct.c | 117 +++++++++++------------- Modules/clinic/_struct.c.h | 69 ++++++++++--- 2 files changed, 103 insertions(+), 83 deletions(-) diff --git a/Modules/_struct.c b/Modules/_struct.c --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -85,6 +85,19 @@ #pragma options align=reset #endif +/*[python input] +class cache_struct_converter(CConverter): + type = 'PyStructObject *' + converter = 'cache_struct_converter' + c_default = "NULL" + + def cleanup(self): + return "Py_XDECREF(%s);\n" % self.name +[python start generated code]*/ +/*[python end generated code: output=da39a3ee5e6b4b0d input=49957cca130ffb63]*/ + +static int cache_struct_converter(PyObject *, PyObject **); + #include "clinic/_struct.c.h" /* Helper for integer format codes: converts an arbitrary Python object to a @@ -2037,21 +2050,27 @@ #define MAXCACHE 100 static PyObject *cache = NULL; -static PyStructObject * -cache_struct(PyObject *fmt) +static int +cache_struct_converter(PyObject *fmt, PyObject **ptr) { PyObject * s_object; + if (fmt == NULL) { + Py_DECREF(*ptr); + return 1; + } + if (cache == NULL) { cache = PyDict_New(); if (cache == NULL) - return NULL; + return 0; } s_object = PyDict_GetItem(cache, fmt); if (s_object != NULL) { Py_INCREF(s_object); - return (PyStructObject *)s_object; + *ptr = s_object; + return Py_CLEANUP_SUPPORTED; } s_object = PyObject_CallFunctionObjArgs((PyObject *)(&PyStructType), fmt, NULL); @@ -2061,8 +2080,10 @@ /* Attempt to cache the result */ if (PyDict_SetItem(cache, fmt, s_object) == -1) PyErr_Clear(); + *ptr = s_object; + return Py_CLEANUP_SUPPORTED; } - return (PyStructObject *)s_object; + return 0; } /*[clinic input] @@ -2081,25 +2102,19 @@ /*[clinic input] -calcsize +calcsize -> Py_ssize_t - format: object + format as s_object: cache_struct / Return size in bytes of the struct described by the format string. [clinic start generated code]*/ -static PyObject * -calcsize(PyObject *module, PyObject *format) -/*[clinic end generated code: output=90fbcf191fe9470a input=55488303a06777fa]*/ +static Py_ssize_t +calcsize_impl(PyObject *module, PyStructObject *s_object) +/*[clinic end generated code: output=db7d23d09c6932c4 input=96a6a590c7717ecd]*/ { - Py_ssize_t n; - PyStructObject *s_object = cache_struct(format); - if (s_object == NULL) - return NULL; - n = s_object->s_size; - Py_DECREF(s_object); - return PyLong_FromSsize_t(n); + return s_object->s_size; } PyDoc_STRVAR(pack_doc, @@ -2111,7 +2126,7 @@ static PyObject * pack(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { - PyStructObject *s_object; + PyObject *s_object = NULL; PyObject *format, *result; if (nargs == 0) { @@ -2120,11 +2135,10 @@ } format = args[0]; - s_object = cache_struct(format); - if (s_object == NULL) { + if (!cache_struct_converter(format, &s_object)) { return NULL; } - result = s_pack((PyObject *)s_object, args + 1, nargs - 1, kwnames); + result = s_pack(s_object, args + 1, nargs - 1, kwnames); Py_DECREF(s_object); return result; } @@ -2140,7 +2154,7 @@ static PyObject * pack_into(PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { - PyStructObject *s_object; + PyObject *s_object = NULL; PyObject *format, *result; if (nargs == 0) { @@ -2149,11 +2163,10 @@ } format = args[0]; - s_object = cache_struct(format); - if (s_object == NULL) { + if (!cache_struct_converter(format, &s_object)) { return NULL; } - result = s_pack_into((PyObject *)s_object, args + 1, nargs - 1, kwnames); + result = s_pack_into(s_object, args + 1, nargs - 1, kwnames); Py_DECREF(s_object); return result; } @@ -2161,7 +2174,7 @@ /*[clinic input] unpack - format: object + format as s_object: cache_struct buffer: Py_buffer / @@ -2173,24 +2186,16 @@ [clinic start generated code]*/ static PyObject * -unpack_impl(PyObject *module, PyObject *format, Py_buffer *buffer) -/*[clinic end generated code: output=f75ada02aaa33b3b input=654078e6660c2df0]*/ +unpack_impl(PyObject *module, PyStructObject *s_object, Py_buffer *buffer) +/*[clinic end generated code: output=48ddd4d88eca8551 input=05fa3b91678da727]*/ { - PyStructObject *s_object; - PyObject *result; - - s_object = cache_struct(format); - if (s_object == NULL) - return NULL; - result = Struct_unpack_impl(s_object, buffer); - Py_DECREF(s_object); - return result; + return Struct_unpack_impl(s_object, buffer); } /*[clinic input] unpack_from - format: object + format as s_object: cache_struct / buffer: Py_buffer offset: Py_ssize_t = 0 @@ -2203,27 +2208,17 @@ [clinic start generated code]*/ static PyObject * -unpack_from_impl(PyObject *module, PyObject *format, Py_buffer *buffer, - Py_ssize_t offset) -/*[clinic end generated code: output=2492f0c3a0b82577 input=9ead76c6ac7164f7]*/ +unpack_from_impl(PyObject *module, PyStructObject *s_object, + Py_buffer *buffer, Py_ssize_t offset) +/*[clinic end generated code: output=1042631674c6e0d3 input=6e80a5398e985025]*/ { - PyStructObject *s_object; - PyObject *result; - - s_object = cache_struct(format); - if (s_object == NULL) { - return NULL; - } - result = Struct_unpack_from_impl(s_object, buffer, offset); - - Py_DECREF(s_object); - return result; + return Struct_unpack_from_impl(s_object, buffer, offset); } /*[clinic input] iter_unpack - format: object + format as s_object: cache_struct buffer: object / @@ -2236,19 +2231,11 @@ [clinic start generated code]*/ static PyObject * -iter_unpack_impl(PyObject *module, PyObject *format, PyObject *buffer) -/*[clinic end generated code: output=b1291e97a6d4cf3c input=8674dfd2f0dae416]*/ +iter_unpack_impl(PyObject *module, PyStructObject *s_object, + PyObject *buffer) +/*[clinic end generated code: output=0ae50e250d20e74d input=b214a58869a3c98d]*/ { - PyStructObject *s_object; - PyObject *result; - - s_object = cache_struct(format); - if (s_object == NULL) - return NULL; - - result = Struct_iter_unpack(s_object, buffer); - Py_DECREF(s_object); - return result; + return Struct_iter_unpack(s_object, buffer); } static struct PyMethodDef module_functions[] = { diff --git a/Modules/clinic/_struct.c.h b/Modules/clinic/_struct.c.h --- a/Modules/clinic/_struct.c.h +++ b/Modules/clinic/_struct.c.h @@ -155,6 +155,32 @@ #define CALCSIZE_METHODDEF \ {"calcsize", (PyCFunction)calcsize, METH_O, calcsize__doc__}, +static Py_ssize_t +calcsize_impl(PyObject *module, PyStructObject *s_object); + +static PyObject * +calcsize(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + PyStructObject *s_object = NULL; + Py_ssize_t _return_value; + + if (!PyArg_Parse(arg, "O&:calcsize", cache_struct_converter, &s_object)) { + goto exit; + } + _return_value = calcsize_impl(module, s_object); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyLong_FromSsize_t(_return_value); + +exit: + /* Cleanup for s_object */ + Py_XDECREF(s_object); + + return return_value; +} + PyDoc_STRVAR(unpack__doc__, "unpack($module, format, buffer, /)\n" "--\n" @@ -169,26 +195,28 @@ {"unpack", (PyCFunction)unpack, METH_FASTCALL, unpack__doc__}, static PyObject * -unpack_impl(PyObject *module, PyObject *format, Py_buffer *buffer); +unpack_impl(PyObject *module, PyStructObject *s_object, Py_buffer *buffer); static PyObject * unpack(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - PyObject *format; + PyStructObject *s_object = NULL; Py_buffer buffer = {NULL, NULL}; - if (!_PyArg_ParseStack(args, nargs, "Oy*:unpack", - &format, &buffer)) { + if (!_PyArg_ParseStack(args, nargs, "O&y*:unpack", + cache_struct_converter, &s_object, &buffer)) { goto exit; } if (!_PyArg_NoStackKeywords("unpack", kwnames)) { goto exit; } - return_value = unpack_impl(module, format, &buffer); + return_value = unpack_impl(module, s_object, &buffer); exit: + /* Cleanup for s_object */ + Py_XDECREF(s_object); /* Cleanup for buffer */ if (buffer.obj) { PyBuffer_Release(&buffer); @@ -211,26 +239,28 @@ {"unpack_from", (PyCFunction)unpack_from, METH_FASTCALL, unpack_from__doc__}, static PyObject * -unpack_from_impl(PyObject *module, PyObject *format, Py_buffer *buffer, - Py_ssize_t offset); +unpack_from_impl(PyObject *module, PyStructObject *s_object, + Py_buffer *buffer, Py_ssize_t offset); static PyObject * unpack_from(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; static const char * const _keywords[] = {"", "buffer", "offset", NULL}; - static _PyArg_Parser _parser = {"Oy*|n:unpack_from", _keywords, 0}; - PyObject *format; + static _PyArg_Parser _parser = {"O&y*|n:unpack_from", _keywords, 0}; + PyStructObject *s_object = NULL; Py_buffer buffer = {NULL, NULL}; Py_ssize_t offset = 0; if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, - &format, &buffer, &offset)) { + cache_struct_converter, &s_object, &buffer, &offset)) { goto exit; } - return_value = unpack_from_impl(module, format, &buffer, offset); + return_value = unpack_from_impl(module, s_object, &buffer, offset); exit: + /* Cleanup for s_object */ + Py_XDECREF(s_object); /* Cleanup for buffer */ if (buffer.obj) { PyBuffer_Release(&buffer); @@ -254,27 +284,30 @@ {"iter_unpack", (PyCFunction)iter_unpack, METH_FASTCALL, iter_unpack__doc__}, static PyObject * -iter_unpack_impl(PyObject *module, PyObject *format, PyObject *buffer); +iter_unpack_impl(PyObject *module, PyStructObject *s_object, + PyObject *buffer); static PyObject * iter_unpack(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; - PyObject *format; + PyStructObject *s_object = NULL; PyObject *buffer; - if (!_PyArg_UnpackStack(args, nargs, "iter_unpack", - 2, 2, - &format, &buffer)) { + if (!_PyArg_ParseStack(args, nargs, "O&O:iter_unpack", + cache_struct_converter, &s_object, &buffer)) { goto exit; } if (!_PyArg_NoStackKeywords("iter_unpack", kwnames)) { goto exit; } - return_value = iter_unpack_impl(module, format, buffer); + return_value = iter_unpack_impl(module, s_object, buffer); exit: + /* Cleanup for s_object */ + Py_XDECREF(s_object); + return return_value; } -/*[clinic end generated code: output=0714090a5d0ea8ce input=a9049054013a1b77]*/ +/*[clinic end generated code: output=03e0d193ab1983f9 input=a9049054013a1b77]*/ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 04:20:24 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Feb 2017 09:20:24 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2320185=3A_Converte?= =?utf-8?q?d_the_gc_module_to_Argument_Clinic=2E?= Message-ID: <20170204092024.110440.17110.1D7768B1@psf.io> https://hg.python.org/cpython/rev/50958e13c833 changeset: 106411:50958e13c833 user: Serhiy Storchaka date: Sat Feb 04 11:19:59 2017 +0200 summary: Issue #20185: Converted the gc module to Argument Clinic. files: Modules/clinic/gcmodule.c.h | 258 ++++++++++++++++++++++++ Modules/gcmodule.c | 230 ++++++++++++--------- 2 files changed, 390 insertions(+), 98 deletions(-) diff --git a/Modules/clinic/gcmodule.c.h b/Modules/clinic/gcmodule.c.h new file mode 100644 --- /dev/null +++ b/Modules/clinic/gcmodule.c.h @@ -0,0 +1,258 @@ +/*[clinic input] +preserve +[clinic start generated code]*/ + +PyDoc_STRVAR(gc_enable__doc__, +"enable($module, /)\n" +"--\n" +"\n" +"Enable automatic garbage collection."); + +#define GC_ENABLE_METHODDEF \ + {"enable", (PyCFunction)gc_enable, METH_NOARGS, gc_enable__doc__}, + +static PyObject * +gc_enable_impl(PyObject *module); + +static PyObject * +gc_enable(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return gc_enable_impl(module); +} + +PyDoc_STRVAR(gc_disable__doc__, +"disable($module, /)\n" +"--\n" +"\n" +"Disable automatic garbage collection."); + +#define GC_DISABLE_METHODDEF \ + {"disable", (PyCFunction)gc_disable, METH_NOARGS, gc_disable__doc__}, + +static PyObject * +gc_disable_impl(PyObject *module); + +static PyObject * +gc_disable(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return gc_disable_impl(module); +} + +PyDoc_STRVAR(gc_isenabled__doc__, +"isenabled($module, /)\n" +"--\n" +"\n" +"Returns true if automatic garbage collection is enabled."); + +#define GC_ISENABLED_METHODDEF \ + {"isenabled", (PyCFunction)gc_isenabled, METH_NOARGS, gc_isenabled__doc__}, + +static int +gc_isenabled_impl(PyObject *module); + +static PyObject * +gc_isenabled(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + PyObject *return_value = NULL; + int _return_value; + + _return_value = gc_isenabled_impl(module); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyBool_FromLong((long)_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(gc_collect__doc__, +"collect($module, /, generation=2)\n" +"--\n" +"\n" +"Run the garbage collector.\n" +"\n" +"With no arguments, run a full collection. The optional argument\n" +"may be an integer specifying which generation to collect. A ValueError\n" +"is raised if the generation number is invalid.\n" +"\n" +"The number of unreachable objects is returned."); + +#define GC_COLLECT_METHODDEF \ + {"collect", (PyCFunction)gc_collect, METH_FASTCALL, gc_collect__doc__}, + +static Py_ssize_t +gc_collect_impl(PyObject *module, int generation); + +static PyObject * +gc_collect(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + static const char * const _keywords[] = {"generation", NULL}; + static _PyArg_Parser _parser = {"|i:collect", _keywords, 0}; + int generation = NUM_GENERATIONS - 1; + Py_ssize_t _return_value; + + if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser, + &generation)) { + goto exit; + } + _return_value = gc_collect_impl(module, generation); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyLong_FromSsize_t(_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(gc_set_debug__doc__, +"set_debug($module, flags, /)\n" +"--\n" +"\n" +"Set the garbage collection debugging flags.\n" +"\n" +" flags\n" +" An integer that can have the following bits turned on:\n" +" DEBUG_STATS - Print statistics during collection.\n" +" DEBUG_COLLECTABLE - Print collectable objects found.\n" +" DEBUG_UNCOLLECTABLE - Print unreachable but uncollectable objects\n" +" found.\n" +" DEBUG_SAVEALL - Save objects to gc.garbage rather than freeing them.\n" +" DEBUG_LEAK - Debug leaking programs (everything but STATS).\n" +"\n" +"Debugging information is written to sys.stderr."); + +#define GC_SET_DEBUG_METHODDEF \ + {"set_debug", (PyCFunction)gc_set_debug, METH_O, gc_set_debug__doc__}, + +static PyObject * +gc_set_debug_impl(PyObject *module, int flags); + +static PyObject * +gc_set_debug(PyObject *module, PyObject *arg) +{ + PyObject *return_value = NULL; + int flags; + + if (!PyArg_Parse(arg, "i:set_debug", &flags)) { + goto exit; + } + return_value = gc_set_debug_impl(module, flags); + +exit: + return return_value; +} + +PyDoc_STRVAR(gc_get_debug__doc__, +"get_debug($module, /)\n" +"--\n" +"\n" +"Get the garbage collection debugging flags."); + +#define GC_GET_DEBUG_METHODDEF \ + {"get_debug", (PyCFunction)gc_get_debug, METH_NOARGS, gc_get_debug__doc__}, + +static int +gc_get_debug_impl(PyObject *module); + +static PyObject * +gc_get_debug(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + PyObject *return_value = NULL; + int _return_value; + + _return_value = gc_get_debug_impl(module); + if ((_return_value == -1) && PyErr_Occurred()) { + goto exit; + } + return_value = PyLong_FromLong((long)_return_value); + +exit: + return return_value; +} + +PyDoc_STRVAR(gc_get_threshold__doc__, +"get_threshold($module, /)\n" +"--\n" +"\n" +"Return the current collection thresholds."); + +#define GC_GET_THRESHOLD_METHODDEF \ + {"get_threshold", (PyCFunction)gc_get_threshold, METH_NOARGS, gc_get_threshold__doc__}, + +static PyObject * +gc_get_threshold_impl(PyObject *module); + +static PyObject * +gc_get_threshold(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return gc_get_threshold_impl(module); +} + +PyDoc_STRVAR(gc_get_count__doc__, +"get_count($module, /)\n" +"--\n" +"\n" +"Return a three-tuple of the current collection counts."); + +#define GC_GET_COUNT_METHODDEF \ + {"get_count", (PyCFunction)gc_get_count, METH_NOARGS, gc_get_count__doc__}, + +static PyObject * +gc_get_count_impl(PyObject *module); + +static PyObject * +gc_get_count(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return gc_get_count_impl(module); +} + +PyDoc_STRVAR(gc_get_objects__doc__, +"get_objects($module, /)\n" +"--\n" +"\n" +"Return a list of objects tracked by the collector (excluding the list returned)."); + +#define GC_GET_OBJECTS_METHODDEF \ + {"get_objects", (PyCFunction)gc_get_objects, METH_NOARGS, gc_get_objects__doc__}, + +static PyObject * +gc_get_objects_impl(PyObject *module); + +static PyObject * +gc_get_objects(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return gc_get_objects_impl(module); +} + +PyDoc_STRVAR(gc_get_stats__doc__, +"get_stats($module, /)\n" +"--\n" +"\n" +"Return a list of dictionaries containing per-generation statistics."); + +#define GC_GET_STATS_METHODDEF \ + {"get_stats", (PyCFunction)gc_get_stats, METH_NOARGS, gc_get_stats__doc__}, + +static PyObject * +gc_get_stats_impl(PyObject *module); + +static PyObject * +gc_get_stats(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return gc_get_stats_impl(module); +} + +PyDoc_STRVAR(gc_is_tracked__doc__, +"is_tracked($module, obj, /)\n" +"--\n" +"\n" +"Returns true if the object is tracked by the garbage collector.\n" +"\n" +"Simple atomic objects will return false."); + +#define GC_IS_TRACKED_METHODDEF \ + {"is_tracked", (PyCFunction)gc_is_tracked, METH_O, gc_is_tracked__doc__}, +/*[clinic end generated code: output=8f487abc53fe4161 input=a9049054013a1b77]*/ diff --git a/Modules/gcmodule.c b/Modules/gcmodule.c --- a/Modules/gcmodule.c +++ b/Modules/gcmodule.c @@ -28,6 +28,11 @@ #include "pydtrace.h" #include "pytime.h" /* for _PyTime_GetMonotonicClock() */ +/*[clinic input] +module gc +[clinic start generated code]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=b5c9690ecc842d79]*/ + /* Get an object's GC head */ #define AS_GC(o) ((PyGC_Head *)(o)-1) @@ -43,6 +48,8 @@ generations */ }; +/* If we change this, we need to change the default value in the signature of + gc.collect. */ #define NUM_GENERATIONS 3 #define GEN_HEAD(n) (&generations[n].head) @@ -1155,107 +1162,123 @@ return n; } -PyDoc_STRVAR(gc_enable__doc__, -"enable() -> None\n" -"\n" -"Enable automatic garbage collection.\n"); +#include "clinic/gcmodule.c.h" + +/*[clinic input] +gc.enable + +Enable automatic garbage collection. +[clinic start generated code]*/ static PyObject * -gc_enable(PyObject *self, PyObject *noargs) +gc_enable_impl(PyObject *module) +/*[clinic end generated code: output=45a427e9dce9155c input=81ac4940ca579707]*/ { enabled = 1; Py_RETURN_NONE; } -PyDoc_STRVAR(gc_disable__doc__, -"disable() -> None\n" -"\n" -"Disable automatic garbage collection.\n"); +/*[clinic input] +gc.disable + +Disable automatic garbage collection. +[clinic start generated code]*/ static PyObject * -gc_disable(PyObject *self, PyObject *noargs) +gc_disable_impl(PyObject *module) +/*[clinic end generated code: output=97d1030f7aa9d279 input=8c2e5a14e800d83b]*/ { enabled = 0; Py_RETURN_NONE; } -PyDoc_STRVAR(gc_isenabled__doc__, -"isenabled() -> status\n" -"\n" -"Returns true if automatic garbage collection is enabled.\n"); +/*[clinic input] +gc.isenabled -> bool -static PyObject * -gc_isenabled(PyObject *self, PyObject *noargs) +Returns true if automatic garbage collection is enabled. +[clinic start generated code]*/ + +static int +gc_isenabled_impl(PyObject *module) +/*[clinic end generated code: output=1874298331c49130 input=30005e0422373b31]*/ { - return PyBool_FromLong((long)enabled); + return enabled; } -PyDoc_STRVAR(gc_collect__doc__, -"collect([generation]) -> n\n" -"\n" -"With no arguments, run a full collection. The optional argument\n" -"may be an integer specifying which generation to collect. A ValueError\n" -"is raised if the generation number is invalid.\n\n" -"The number of unreachable objects is returned.\n"); +/*[clinic input] +gc.collect -> Py_ssize_t -static PyObject * -gc_collect(PyObject *self, PyObject *args, PyObject *kws) + generation: int(c_default="NUM_GENERATIONS - 1") = 2 + +Run the garbage collector. + +With no arguments, run a full collection. The optional argument +may be an integer specifying which generation to collect. A ValueError +is raised if the generation number is invalid. + +The number of unreachable objects is returned. +[clinic start generated code]*/ + +static Py_ssize_t +gc_collect_impl(PyObject *module, int generation) +/*[clinic end generated code: output=b697e633043233c7 input=40720128b682d879]*/ { - static char *keywords[] = {"generation", NULL}; - int genarg = NUM_GENERATIONS - 1; Py_ssize_t n; - if (!PyArg_ParseTupleAndKeywords(args, kws, "|i", keywords, &genarg)) - return NULL; - - else if (genarg < 0 || genarg >= NUM_GENERATIONS) { + if (generation < 0 || generation >= NUM_GENERATIONS) { PyErr_SetString(PyExc_ValueError, "invalid generation"); - return NULL; + return -1; } if (collecting) n = 0; /* already collecting, don't do anything */ else { collecting = 1; - n = collect_with_callback(genarg); + n = collect_with_callback(generation); collecting = 0; } - return PyLong_FromSsize_t(n); + return n; } -PyDoc_STRVAR(gc_set_debug__doc__, -"set_debug(flags) -> None\n" -"\n" -"Set the garbage collection debugging flags. Debugging information is\n" -"written to sys.stderr.\n" -"\n" -"flags is an integer and can have the following bits turned on:\n" -"\n" -" DEBUG_STATS - Print statistics during collection.\n" -" DEBUG_COLLECTABLE - Print collectable objects found.\n" -" DEBUG_UNCOLLECTABLE - Print unreachable but uncollectable objects found.\n" -" DEBUG_SAVEALL - Save objects to gc.garbage rather than freeing them.\n" -" DEBUG_LEAK - Debug leaking programs (everything but STATS).\n"); +/*[clinic input] +gc.set_debug + + flags: int + An integer that can have the following bits turned on: + DEBUG_STATS - Print statistics during collection. + DEBUG_COLLECTABLE - Print collectable objects found. + DEBUG_UNCOLLECTABLE - Print unreachable but uncollectable objects + found. + DEBUG_SAVEALL - Save objects to gc.garbage rather than freeing them. + DEBUG_LEAK - Debug leaking programs (everything but STATS). + / + +Set the garbage collection debugging flags. + +Debugging information is written to sys.stderr. +[clinic start generated code]*/ static PyObject * -gc_set_debug(PyObject *self, PyObject *args) +gc_set_debug_impl(PyObject *module, int flags) +/*[clinic end generated code: output=7c8366575486b228 input=5e5ce15e84fbed15]*/ { - if (!PyArg_ParseTuple(args, "i:set_debug", &debug)) - return NULL; + debug = flags; Py_RETURN_NONE; } -PyDoc_STRVAR(gc_get_debug__doc__, -"get_debug() -> flags\n" -"\n" -"Get the garbage collection debugging flags.\n"); +/*[clinic input] +gc.get_debug -> int -static PyObject * -gc_get_debug(PyObject *self, PyObject *noargs) +Get the garbage collection debugging flags. +[clinic start generated code]*/ + +static int +gc_get_debug_impl(PyObject *module) +/*[clinic end generated code: output=91242f3506cd1e50 input=91a101e1c3b98366]*/ { - return Py_BuildValue("i", debug); + return debug; } PyDoc_STRVAR(gc_set_thresh__doc__, @@ -1281,13 +1304,15 @@ Py_RETURN_NONE; } -PyDoc_STRVAR(gc_get_thresh__doc__, -"get_threshold() -> (threshold0, threshold1, threshold2)\n" -"\n" -"Return the current collection thresholds\n"); +/*[clinic input] +gc.get_threshold + +Return the current collection thresholds. +[clinic start generated code]*/ static PyObject * -gc_get_thresh(PyObject *self, PyObject *noargs) +gc_get_threshold_impl(PyObject *module) +/*[clinic end generated code: output=7902bc9f41ecbbd8 input=286d79918034d6e6]*/ { return Py_BuildValue("(iii)", generations[0].threshold, @@ -1295,13 +1320,15 @@ generations[2].threshold); } -PyDoc_STRVAR(gc_get_count__doc__, -"get_count() -> (count0, count1, count2)\n" -"\n" -"Return the current collection counts\n"); +/*[clinic input] +gc.get_count + +Return a three-tuple of the current collection counts. +[clinic start generated code]*/ static PyObject * -gc_get_count(PyObject *self, PyObject *noargs) +gc_get_count_impl(PyObject *module) +/*[clinic end generated code: output=354012e67b16398f input=a392794a08251751]*/ { return Py_BuildValue("(iii)", generations[0].count, @@ -1395,14 +1422,15 @@ return result; } -PyDoc_STRVAR(gc_get_objects__doc__, -"get_objects() -> [...]\n" -"\n" -"Return a list of objects tracked by the collector (excluding the list\n" -"returned).\n"); +/*[clinic input] +gc.get_objects + +Return a list of objects tracked by the collector (excluding the list returned). +[clinic start generated code]*/ static PyObject * -gc_get_objects(PyObject *self, PyObject *noargs) +gc_get_objects_impl(PyObject *module) +/*[clinic end generated code: output=fcb95d2e23e1f750 input=9439fe8170bf35d8]*/ { int i; PyObject* result; @@ -1419,13 +1447,15 @@ return result; } -PyDoc_STRVAR(gc_get_stats__doc__, -"get_stats() -> [...]\n" -"\n" -"Return a list of dictionaries containing per-generation statistics.\n"); +/*[clinic input] +gc.get_stats + +Return a list of dictionaries containing per-generation statistics. +[clinic start generated code]*/ static PyObject * -gc_get_stats(PyObject *self, PyObject *noargs) +gc_get_stats_impl(PyObject *module) +/*[clinic end generated code: output=a8ab1d8a5d26f3ab input=1ef4ed9d17b1a470]*/ { int i; PyObject *result; @@ -1465,15 +1495,20 @@ } -PyDoc_STRVAR(gc_is_tracked__doc__, -"is_tracked(obj) -> bool\n" -"\n" -"Returns true if the object is tracked by the garbage collector.\n" -"Simple atomic objects will return false.\n" -); +/*[clinic input] +gc.is_tracked + + obj: object + / + +Returns true if the object is tracked by the garbage collector. + +Simple atomic objects will return false. +[clinic start generated code]*/ static PyObject * -gc_is_tracked(PyObject *self, PyObject *obj) +gc_is_tracked(PyObject *module, PyObject *obj) +/*[clinic end generated code: output=14f0103423b28e31 input=d83057f170ea2723]*/ { PyObject *result; @@ -1505,19 +1540,18 @@ "get_referents() -- Return the list of objects that an object refers to.\n"); static PyMethodDef GcMethods[] = { - {"enable", gc_enable, METH_NOARGS, gc_enable__doc__}, - {"disable", gc_disable, METH_NOARGS, gc_disable__doc__}, - {"isenabled", gc_isenabled, METH_NOARGS, gc_isenabled__doc__}, - {"set_debug", gc_set_debug, METH_VARARGS, gc_set_debug__doc__}, - {"get_debug", gc_get_debug, METH_NOARGS, gc_get_debug__doc__}, - {"get_count", gc_get_count, METH_NOARGS, gc_get_count__doc__}, + GC_ENABLE_METHODDEF + GC_DISABLE_METHODDEF + GC_ISENABLED_METHODDEF + GC_SET_DEBUG_METHODDEF + GC_GET_DEBUG_METHODDEF + GC_GET_COUNT_METHODDEF {"set_threshold", gc_set_thresh, METH_VARARGS, gc_set_thresh__doc__}, - {"get_threshold", gc_get_thresh, METH_NOARGS, gc_get_thresh__doc__}, - {"collect", (PyCFunction)gc_collect, - METH_VARARGS | METH_KEYWORDS, gc_collect__doc__}, - {"get_objects", gc_get_objects,METH_NOARGS, gc_get_objects__doc__}, - {"get_stats", gc_get_stats, METH_NOARGS, gc_get_stats__doc__}, - {"is_tracked", gc_is_tracked, METH_O, gc_is_tracked__doc__}, + GC_GET_THRESHOLD_METHODDEF + GC_COLLECT_METHODDEF + GC_GET_OBJECTS_METHODDEF + GC_GET_STATS_METHODDEF + GC_IS_TRACKED_METHODDEF {"get_referrers", gc_get_referrers, METH_VARARGS, gc_get_referrers__doc__}, {"get_referents", gc_get_referents, METH_VARARGS, -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Sat Feb 4 04:32:01 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 04 Feb 2017 09:32:01 +0000 Subject: [Python-checkins] Daily reference leaks (b382206aeb2b): sum=4 Message-ID: <20170204093201.16132.17074.C426B215@psf.io> results for b382206aeb2b on branch "default" -------------------------------------------- test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_spawn leaked [0, -2, 2] memory blocks, sum=0 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogkpTUki', '--timeout', '7200'] From python-checkins at python.org Sat Feb 4 04:53:42 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Feb 2017 09:53:42 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Removed_redundant_Argument?= =?utf-8?q?_Clinic_directives=2E?= Message-ID: <20170204095342.128178.38418.5B9B0943@psf.io> https://hg.python.org/cpython/rev/fc2707fb17a6 changeset: 106412:fc2707fb17a6 user: Serhiy Storchaka date: Sat Feb 04 11:53:22 2017 +0200 summary: Removed redundant Argument Clinic directives. files: Modules/pyexpat.c | 5 ----- Modules/sha512module.c | 9 --------- Python/import.c | 5 ----- 3 files changed, 0 insertions(+), 19 deletions(-) diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -1980,8 +1980,3 @@ {NULL, NULL, NULL} /* sentinel */ }; - -/*[clinic input] -dump buffer -[clinic start generated code]*/ -/*[clinic end generated code: output=da39a3ee5e6b4b0d input=524ce2e021e4eba6]*/ diff --git a/Modules/sha512module.c b/Modules/sha512module.c --- a/Modules/sha512module.c +++ b/Modules/sha512module.c @@ -550,10 +550,6 @@ PyBuffer_Release(&buf); Py_RETURN_NONE; } -/*[clinic input] -dump buffer -[clinic start generated code]*/ -/*[clinic end generated code: output=da39a3ee5e6b4b0d input=524ce2e021e4eba6]*/ static PyMethodDef SHA_methods[] = { SHA512TYPE_COPY_METHODDEF @@ -747,11 +743,6 @@ } -/*[clinic input] -dump buffer -[clinic start generated code]*/ -/*[clinic end generated code: output=da39a3ee5e6b4b0d input=524ce2e021e4eba6]*/ - /* List of functions exported by this module */ static struct PyMethodDef SHA_functions[] = { diff --git a/Python/import.c b/Python/import.c --- a/Python/import.c +++ b/Python/import.c @@ -2042,11 +2042,6 @@ return exec_builtin_or_dynamic(mod); } -/*[clinic input] -dump buffer -[clinic start generated code]*/ -/*[clinic end generated code: output=da39a3ee5e6b4b0d input=524ce2e021e4eba6]*/ - PyDoc_STRVAR(doc_imp, "(Extremely) low-level import machinery bits as used by importlib and imp."); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 05:13:43 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Feb 2017 10:13:43 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2320186=3A_Converte?= =?utf-8?q?d_the_symtable_module_to_Argument_Clinic=2E?= Message-ID: <20170204101343.8344.71809.64B97C67@psf.io> https://hg.python.org/cpython/rev/7f8a3eb3459e changeset: 106413:7f8a3eb3459e user: Serhiy Storchaka date: Sat Feb 04 12:13:20 2017 +0200 summary: Issue #20186: Converted the symtable module to Argument Clinic. Original patch by Georg Brandl. files: Modules/clinic/symtablemodule.c.h | 39 +++++++++++++++++++ Modules/symtablemodule.c | 33 ++++++++++----- 2 files changed, 61 insertions(+), 11 deletions(-) diff --git a/Modules/clinic/symtablemodule.c.h b/Modules/clinic/symtablemodule.c.h new file mode 100644 --- /dev/null +++ b/Modules/clinic/symtablemodule.c.h @@ -0,0 +1,39 @@ +/*[clinic input] +preserve +[clinic start generated code]*/ + +PyDoc_STRVAR(_symtable_symtable__doc__, +"symtable($module, str, filename, startstr, /)\n" +"--\n" +"\n" +"Return symbol and scope dictionaries used internally by compiler."); + +#define _SYMTABLE_SYMTABLE_METHODDEF \ + {"symtable", (PyCFunction)_symtable_symtable, METH_FASTCALL, _symtable_symtable__doc__}, + +static PyObject * +_symtable_symtable_impl(PyObject *module, const char *str, + PyObject *filename, const char *startstr); + +static PyObject * +_symtable_symtable(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + const char *str; + PyObject *filename; + const char *startstr; + + if (!_PyArg_ParseStack(args, nargs, "sO&s:symtable", + &str, PyUnicode_FSDecoder, &filename, &startstr)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("symtable", kwnames)) { + goto exit; + } + return_value = _symtable_symtable_impl(module, str, filename, startstr); + +exit: + return return_value; +} +/*[clinic end generated code: output=071dee4d836e2cfd input=a9049054013a1b77]*/ diff --git a/Modules/symtablemodule.c b/Modules/symtablemodule.c --- a/Modules/symtablemodule.c +++ b/Modules/symtablemodule.c @@ -4,20 +4,33 @@ #include "Python-ast.h" #include "symtable.h" +#include "clinic/symtablemodule.c.h" +/*[clinic input] +module _symtable +[clinic start generated code]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=f4685845a7100605]*/ + + +/*[clinic input] +_symtable.symtable + + str: str + filename: object(converter='PyUnicode_FSDecoder') + startstr: str + / + +Return symbol and scope dictionaries used internally by compiler. +[clinic start generated code]*/ + static PyObject * -symtable_symtable(PyObject *self, PyObject *args) +_symtable_symtable_impl(PyObject *module, const char *str, + PyObject *filename, const char *startstr) +/*[clinic end generated code: output=914b369c9b785956 input=6c615e84d5f408e3]*/ { struct symtable *st; PyObject *t; - - char *str; - PyObject *filename; - char *startstr; int start; - if (!PyArg_ParseTuple(args, "sO&s:symtable", - &str, PyUnicode_FSDecoder, &filename, &startstr)) - return NULL; if (strcmp(startstr, "exec") == 0) start = Py_file_input; else if (strcmp(startstr, "eval") == 0) @@ -42,9 +55,7 @@ } static PyMethodDef symtable_methods[] = { - {"symtable", symtable_symtable, METH_VARARGS, - PyDoc_STR("Return symbol and scope dictionaries" - " used internally by compiler.")}, + _SYMTABLE_SYMTABLE_METHODDEF {NULL, NULL} /* sentinel */ }; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 05:18:51 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Feb 2017 10:18:51 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2320186=3A_Converte?= =?utf-8?q?d_the_tracemalloc_module_to_Argument_Clinic=2E?= Message-ID: <20170204101850.97083.56537.E6E3BD43@psf.io> https://hg.python.org/cpython/rev/e1df73b46094 changeset: 106414:e1df73b46094 user: Serhiy Storchaka date: Sat Feb 04 12:18:38 2017 +0200 summary: Issue #20186: Converted the tracemalloc module to Argument Clinic. Based on patch by Georg Brandl. files: Modules/_tracemalloc.c | 225 ++++++++++--------- Modules/clinic/_tracemalloc.c.h | 192 +++++++++++++++++ 2 files changed, 315 insertions(+), 102 deletions(-) diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c --- a/Modules/_tracemalloc.c +++ b/Modules/_tracemalloc.c @@ -4,6 +4,12 @@ #include "pythread.h" #include "osdefs.h" +#include "clinic/_tracemalloc.c.h" +/*[clinic input] +module _tracemalloc +[clinic start generated code]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=708a98302fc46e5f]*/ + /* Trace memory blocks allocated by PyMem_RawMalloc() */ #define TRACE_RAW_MALLOC @@ -1161,27 +1167,31 @@ tracemalloc_traceback = NULL; } -PyDoc_STRVAR(tracemalloc_is_tracing_doc, - "is_tracing()->bool\n" - "\n" - "True if the tracemalloc module is tracing Python memory allocations,\n" - "False otherwise."); -static PyObject* -py_tracemalloc_is_tracing(PyObject *self) +/*[clinic input] +_tracemalloc.is_tracing + +Return True if the tracemalloc module is tracing Python memory allocations. +[clinic start generated code]*/ + +static PyObject * +_tracemalloc_is_tracing_impl(PyObject *module) +/*[clinic end generated code: output=2d763b42601cd3ef input=8beb4fb5446813be]*/ { return PyBool_FromLong(tracemalloc_config.tracing); } -PyDoc_STRVAR(tracemalloc_clear_traces_doc, - "clear_traces()\n" - "\n" - "Clear traces of memory blocks allocated by Python."); +/*[clinic input] +_tracemalloc.clear_traces -static PyObject* -py_tracemalloc_clear_traces(PyObject *self) +Clear traces of memory blocks allocated by Python. +[clinic start generated code]*/ + +static PyObject * +_tracemalloc_clear_traces_impl(PyObject *module) +/*[clinic end generated code: output=a86080ee41b84197 input=0dab5b6c785183a5]*/ { if (!tracemalloc_config.tracing) Py_RETURN_NONE; @@ -1343,17 +1353,21 @@ } -PyDoc_STRVAR(tracemalloc_get_traces_doc, - "_get_traces() -> list\n" - "\n" - "Get traces of all memory blocks allocated by Python.\n" - "Return a list of (size: int, traceback: tuple) tuples.\n" - "traceback is a tuple of (filename: str, lineno: int) tuples.\n" - "\n" - "Return an empty list if the tracemalloc module is disabled."); -static PyObject* -py_tracemalloc_get_traces(PyObject *self, PyObject *obj) +/*[clinic input] +_tracemalloc._get_traces + +Get traces of all memory blocks allocated by Python. + +Return a list of (size: int, traceback: tuple) tuples. +traceback is a tuple of (filename: str, lineno: int) tuples. + +Return an empty list if the tracemalloc module is disabled. +[clinic start generated code]*/ + +static PyObject * +_tracemalloc__get_traces_impl(PyObject *module) +/*[clinic end generated code: output=e9929876ced4b5cc input=6c7d2230b24255aa]*/ { get_traces_t get_traces; int err; @@ -1439,17 +1453,23 @@ } -PyDoc_STRVAR(tracemalloc_get_object_traceback_doc, - "_get_object_traceback(obj)\n" - "\n" - "Get the traceback where the Python object obj was allocated.\n" - "Return a tuple of (filename: str, lineno: int) tuples.\n" - "\n" - "Return None if the tracemalloc module is disabled or did not\n" - "trace the allocation of the object."); -static PyObject* -py_tracemalloc_get_object_traceback(PyObject *self, PyObject *obj) +/*[clinic input] +_tracemalloc._get_object_traceback + + obj: object + / + +Get the traceback where the Python object obj was allocated. + +Return a tuple of (filename: str, lineno: int) tuples. +Return None if the tracemalloc module is disabled or did not +trace the allocation of the object. +[clinic start generated code]*/ + +static PyObject * +_tracemalloc__get_object_traceback(PyObject *module, PyObject *obj) +/*[clinic end generated code: output=41ee0553a658b0aa input=29495f1b21c53212]*/ { PyTypeObject *type; void *ptr; @@ -1503,25 +1523,29 @@ #undef PUTS -PyDoc_STRVAR(tracemalloc_start_doc, - "start(nframe: int=1)\n" - "\n" - "Start tracing Python memory allocations. Set also the maximum number \n" - "of frames stored in the traceback of a trace to nframe."); -static PyObject* -py_tracemalloc_start(PyObject *self, PyObject *args) +/*[clinic input] +_tracemalloc.start + + nframe: Py_ssize_t = 1 + / + +Start tracing Python memory allocations. + +Also set the maximum number of frames stored in the traceback of a +trace to nframe. +[clinic start generated code]*/ + +static PyObject * +_tracemalloc_start_impl(PyObject *module, Py_ssize_t nframe) +/*[clinic end generated code: output=0f558d2079511553 input=997841629cc441cb]*/ { - Py_ssize_t nframe = 1; int nframe_int; - if (!PyArg_ParseTuple(args, "|n:start", &nframe)) - return NULL; - if (nframe < 1 || nframe > MAX_NFRAME) { PyErr_Format(PyExc_ValueError, "the number of frames must be in range [1; %i]", - MAX_NFRAME); + (int)MAX_NFRAME); return NULL; } nframe_int = Py_SAFE_DOWNCAST(nframe, Py_ssize_t, int); @@ -1532,48 +1556,55 @@ Py_RETURN_NONE; } -PyDoc_STRVAR(tracemalloc_stop_doc, - "stop()\n" - "\n" - "Stop tracing Python memory allocations and clear traces\n" - "of memory blocks allocated by Python."); +/*[clinic input] +_tracemalloc.stop -static PyObject* -py_tracemalloc_stop(PyObject *self) +Stop tracing Python memory allocations. + +Also clear traces of memory blocks allocated by Python. +[clinic start generated code]*/ + +static PyObject * +_tracemalloc_stop_impl(PyObject *module) +/*[clinic end generated code: output=c3c42ae03e3955cd input=7478f075e51dae18]*/ { tracemalloc_stop(); Py_RETURN_NONE; } -PyDoc_STRVAR(tracemalloc_get_traceback_limit_doc, - "get_traceback_limit() -> int\n" - "\n" - "Get the maximum number of frames stored in the traceback\n" - "of a trace.\n" - "\n" - "By default, a trace of an allocated memory block only stores\n" - "the most recent frame: the limit is 1."); +/*[clinic input] +_tracemalloc.get_traceback_limit -static PyObject* -py_tracemalloc_get_traceback_limit(PyObject *self) +Get the maximum number of frames stored in the traceback of a trace. + +By default, a trace of an allocated memory block only stores +the most recent frame: the limit is 1. +[clinic start generated code]*/ + +static PyObject * +_tracemalloc_get_traceback_limit_impl(PyObject *module) +/*[clinic end generated code: output=d556d9306ba95567 input=da3cd977fc68ae3b]*/ { return PyLong_FromLong(tracemalloc_config.max_nframe); } -PyDoc_STRVAR(tracemalloc_get_tracemalloc_memory_doc, - "get_tracemalloc_memory() -> int\n" - "\n" - "Get the memory usage in bytes of the tracemalloc module\n" - "used internally to trace memory allocations."); -static PyObject* -tracemalloc_get_tracemalloc_memory(PyObject *self) +/*[clinic input] +_tracemalloc.get_tracemalloc_memory + +Get the memory usage in bytes of the tracemalloc module. + +This memory is used internally to trace memory allocations. +[clinic start generated code]*/ + +static PyObject * +_tracemalloc_get_tracemalloc_memory_impl(PyObject *module) +/*[clinic end generated code: output=e3f14e280a55f5aa input=5d919c0f4d5132ad]*/ { size_t size; - PyObject *size_obj; size = _Py_hashtable_size(tracemalloc_tracebacks); size += _Py_hashtable_size(tracemalloc_filenames); @@ -1582,22 +1613,24 @@ size += _Py_hashtable_size(tracemalloc_traces); TABLES_UNLOCK(); - size_obj = PyLong_FromSize_t(size); - return Py_BuildValue("N", size_obj); + return PyLong_FromSize_t(size); } -PyDoc_STRVAR(tracemalloc_get_traced_memory_doc, - "get_traced_memory() -> (int, int)\n" - "\n" - "Get the current size and peak size of memory blocks traced\n" - "by the tracemalloc module as a tuple: (current: int, peak: int)."); -static PyObject* -tracemalloc_get_traced_memory(PyObject *self) +/*[clinic input] +_tracemalloc.get_traced_memory + +Get the current size and peak size of memory blocks traced by tracemalloc. + +Returns a tuple: (current: int, peak: int). +[clinic start generated code]*/ + +static PyObject * +_tracemalloc_get_traced_memory_impl(PyObject *module) +/*[clinic end generated code: output=5b167189adb9e782 input=61ddb5478400ff66]*/ { Py_ssize_t size, peak_size; - PyObject *size_obj, *peak_size_obj; if (!tracemalloc_config.tracing) return Py_BuildValue("ii", 0, 0); @@ -1607,32 +1640,20 @@ peak_size = tracemalloc_peak_traced_memory; TABLES_UNLOCK(); - size_obj = PyLong_FromSize_t(size); - peak_size_obj = PyLong_FromSize_t(peak_size); - return Py_BuildValue("NN", size_obj, peak_size_obj); + return Py_BuildValue("nn", size, peak_size); } static PyMethodDef module_methods[] = { - {"is_tracing", (PyCFunction)py_tracemalloc_is_tracing, - METH_NOARGS, tracemalloc_is_tracing_doc}, - {"clear_traces", (PyCFunction)py_tracemalloc_clear_traces, - METH_NOARGS, tracemalloc_clear_traces_doc}, - {"_get_traces", (PyCFunction)py_tracemalloc_get_traces, - METH_NOARGS, tracemalloc_get_traces_doc}, - {"_get_object_traceback", (PyCFunction)py_tracemalloc_get_object_traceback, - METH_O, tracemalloc_get_object_traceback_doc}, - {"start", (PyCFunction)py_tracemalloc_start, - METH_VARARGS, tracemalloc_start_doc}, - {"stop", (PyCFunction)py_tracemalloc_stop, - METH_NOARGS, tracemalloc_stop_doc}, - {"get_traceback_limit", (PyCFunction)py_tracemalloc_get_traceback_limit, - METH_NOARGS, tracemalloc_get_traceback_limit_doc}, - {"get_tracemalloc_memory", (PyCFunction)tracemalloc_get_tracemalloc_memory, - METH_NOARGS, tracemalloc_get_tracemalloc_memory_doc}, - {"get_traced_memory", (PyCFunction)tracemalloc_get_traced_memory, - METH_NOARGS, tracemalloc_get_traced_memory_doc}, - + _TRACEMALLOC_IS_TRACING_METHODDEF + _TRACEMALLOC_CLEAR_TRACES_METHODDEF + _TRACEMALLOC__GET_TRACES_METHODDEF + _TRACEMALLOC__GET_OBJECT_TRACEBACK_METHODDEF + _TRACEMALLOC_START_METHODDEF + _TRACEMALLOC_STOP_METHODDEF + _TRACEMALLOC_GET_TRACEBACK_LIMIT_METHODDEF + _TRACEMALLOC_GET_TRACEMALLOC_MEMORY_METHODDEF + _TRACEMALLOC_GET_TRACED_MEMORY_METHODDEF /* sentinel */ {NULL, NULL} }; diff --git a/Modules/clinic/_tracemalloc.c.h b/Modules/clinic/_tracemalloc.c.h new file mode 100644 --- /dev/null +++ b/Modules/clinic/_tracemalloc.c.h @@ -0,0 +1,192 @@ +/*[clinic input] +preserve +[clinic start generated code]*/ + +PyDoc_STRVAR(_tracemalloc_is_tracing__doc__, +"is_tracing($module, /)\n" +"--\n" +"\n" +"True if the tracemalloc module is tracing Python memory allocations, False otherwise."); + +#define _TRACEMALLOC_IS_TRACING_METHODDEF \ + {"is_tracing", (PyCFunction)_tracemalloc_is_tracing, METH_NOARGS, _tracemalloc_is_tracing__doc__}, + +static PyObject * +_tracemalloc_is_tracing_impl(PyObject *module); + +static PyObject * +_tracemalloc_is_tracing(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return _tracemalloc_is_tracing_impl(module); +} + +PyDoc_STRVAR(_tracemalloc_clear_traces__doc__, +"clear_traces($module, /)\n" +"--\n" +"\n" +"Clear traces of memory blocks allocated by Python."); + +#define _TRACEMALLOC_CLEAR_TRACES_METHODDEF \ + {"clear_traces", (PyCFunction)_tracemalloc_clear_traces, METH_NOARGS, _tracemalloc_clear_traces__doc__}, + +static PyObject * +_tracemalloc_clear_traces_impl(PyObject *module); + +static PyObject * +_tracemalloc_clear_traces(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return _tracemalloc_clear_traces_impl(module); +} + +PyDoc_STRVAR(_tracemalloc__get_traces__doc__, +"_get_traces($module, /)\n" +"--\n" +"\n" +"Get traces of all memory blocks allocated by Python.\n" +"\n" +"Return a list of (size: int, traceback: tuple) tuples.\n" +"traceback is a tuple of (filename: str, lineno: int) tuples.\n" +"\n" +"Return an empty list if the tracemalloc module is disabled."); + +#define _TRACEMALLOC__GET_TRACES_METHODDEF \ + {"_get_traces", (PyCFunction)_tracemalloc__get_traces, METH_NOARGS, _tracemalloc__get_traces__doc__}, + +static PyObject * +_tracemalloc__get_traces_impl(PyObject *module); + +static PyObject * +_tracemalloc__get_traces(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return _tracemalloc__get_traces_impl(module); +} + +PyDoc_STRVAR(_tracemalloc__get_object_traceback__doc__, +"_get_object_traceback($module, obj, /)\n" +"--\n" +"\n" +"Get the traceback where the Python object obj was allocated.\n" +"\n" +"Return a tuple of (filename: str, lineno: int) tuples.\n" +"Return None if the tracemalloc module is disabled or did not\n" +"trace the allocation of the object."); + +#define _TRACEMALLOC__GET_OBJECT_TRACEBACK_METHODDEF \ + {"_get_object_traceback", (PyCFunction)_tracemalloc__get_object_traceback, METH_O, _tracemalloc__get_object_traceback__doc__}, + +PyDoc_STRVAR(_tracemalloc_start__doc__, +"start($module, nframe=1, /)\n" +"--\n" +"\n" +"Start tracing Python memory allocations.\n" +"\n" +"Also set the maximum number of frames stored in the traceback of a\n" +"trace to nframe."); + +#define _TRACEMALLOC_START_METHODDEF \ + {"start", (PyCFunction)_tracemalloc_start, METH_FASTCALL, _tracemalloc_start__doc__}, + +static PyObject * +_tracemalloc_start_impl(PyObject *module, Py_ssize_t nframe); + +static PyObject * +_tracemalloc_start(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *return_value = NULL; + Py_ssize_t nframe = 1; + + if (!_PyArg_ParseStack(args, nargs, "|n:start", + &nframe)) { + goto exit; + } + + if (!_PyArg_NoStackKeywords("start", kwnames)) { + goto exit; + } + return_value = _tracemalloc_start_impl(module, nframe); + +exit: + return return_value; +} + +PyDoc_STRVAR(_tracemalloc_stop__doc__, +"stop($module, /)\n" +"--\n" +"\n" +"Stop tracing Python memory allocations.\n" +"\n" +"Also clear traces of memory blocks allocated by Python."); + +#define _TRACEMALLOC_STOP_METHODDEF \ + {"stop", (PyCFunction)_tracemalloc_stop, METH_NOARGS, _tracemalloc_stop__doc__}, + +static PyObject * +_tracemalloc_stop_impl(PyObject *module); + +static PyObject * +_tracemalloc_stop(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return _tracemalloc_stop_impl(module); +} + +PyDoc_STRVAR(_tracemalloc_get_traceback_limit__doc__, +"get_traceback_limit($module, /)\n" +"--\n" +"\n" +"Get the maximum number of frames stored in the traceback of a trace.\n" +"\n" +"By default, a trace of an allocated memory block only stores\n" +"the most recent frame: the limit is 1."); + +#define _TRACEMALLOC_GET_TRACEBACK_LIMIT_METHODDEF \ + {"get_traceback_limit", (PyCFunction)_tracemalloc_get_traceback_limit, METH_NOARGS, _tracemalloc_get_traceback_limit__doc__}, + +static PyObject * +_tracemalloc_get_traceback_limit_impl(PyObject *module); + +static PyObject * +_tracemalloc_get_traceback_limit(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return _tracemalloc_get_traceback_limit_impl(module); +} + +PyDoc_STRVAR(_tracemalloc_get_tracemalloc_memory__doc__, +"get_tracemalloc_memory($module, /)\n" +"--\n" +"\n" +"Get the memory usage in bytes of the tracemalloc module.\n" +"\n" +"This memory is used internally to trace memory allocations."); + +#define _TRACEMALLOC_GET_TRACEMALLOC_MEMORY_METHODDEF \ + {"get_tracemalloc_memory", (PyCFunction)_tracemalloc_get_tracemalloc_memory, METH_NOARGS, _tracemalloc_get_tracemalloc_memory__doc__}, + +static PyObject * +_tracemalloc_get_tracemalloc_memory_impl(PyObject *module); + +static PyObject * +_tracemalloc_get_tracemalloc_memory(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return _tracemalloc_get_tracemalloc_memory_impl(module); +} + +PyDoc_STRVAR(_tracemalloc_get_traced_memory__doc__, +"get_traced_memory($module, /)\n" +"--\n" +"\n" +"Get the current size and peak size of memory blocks traced by tracemalloc.\n" +"\n" +"Returns a tuple: (current: int, peak: int)."); + +#define _TRACEMALLOC_GET_TRACED_MEMORY_METHODDEF \ + {"get_traced_memory", (PyCFunction)_tracemalloc_get_traced_memory, METH_NOARGS, _tracemalloc_get_traced_memory__doc__}, + +static PyObject * +_tracemalloc_get_traced_memory_impl(PyObject *module); + +static PyObject * +_tracemalloc_get_traced_memory(PyObject *module, PyObject *Py_UNUSED(ignored)) +{ + return _tracemalloc_get_traced_memory_impl(module); +} +/*[clinic end generated code: output=1e059f24619e23f9 input=a9049054013a1b77]*/ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 05:43:52 2017 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 04 Feb 2017 10:43:52 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Reduce_load_factor_=28from?= =?utf-8?q?_66=25_to_60=25=29_to_improve_effectiveness_of_linear_probing?= =?utf-8?q?=2E?= Message-ID: <20170204104352.16444.48829.2B514B14@psf.io> https://hg.python.org/cpython/rev/ee64f4374daf changeset: 106415:ee64f4374daf user: Raymond Hettinger date: Sat Feb 04 02:43:42 2017 -0800 summary: Reduce load factor (from 66% to 60%) to improve effectiveness of linear probing. Decreased density gives better collision statistics (average of 2.5 probes in a full table versus 3.0 previously) and fewer occurences of starting a second possibly overlapping sequence of 10 linear probes. Makes resizes a little more frequent but each with less work (fewer insertions and fewer collisions). files: Objects/setobject.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Objects/setobject.c b/Objects/setobject.c --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -234,7 +234,7 @@ so->used++; entry->key = key; entry->hash = hash; - if ((size_t)so->fill*3 < mask*2) + if ((size_t)so->fill*5 < mask*3) return 0; return set_table_resize(so, so->used); @@ -642,7 +642,7 @@ * incrementally resizing as we insert new keys. Expect * that there will be no (or few) overlapping keys. */ - if ((so->fill + other->used)*3 >= so->mask*2) { + if ((so->fill + other->used)*5 >= so->mask*3) { if (set_table_resize(so, so->used + other->used) != 0) return -1; } @@ -986,7 +986,7 @@ */ if (dictsize < 0) return -1; - if ((so->fill + dictsize)*3 >= so->mask*2) { + if ((so->fill + dictsize)*5 >= so->mask*3) { if (set_table_resize(so, so->used + dictsize) != 0) return -1; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 08:59:40 2017 From: python-checkins at python.org (stefan.krah) Date: Sat, 04 Feb 2017 13:59:40 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy42Lg==?= Message-ID: <20170204135940.128704.32766.0279C4D3@psf.io> https://hg.python.org/cpython/rev/038dd5e1f01b changeset: 106417:038dd5e1f01b parent: 106415:ee64f4374daf parent: 106416:b60b46ad8751 user: Stefan Krah date: Sat Feb 04 14:59:11 2017 +0100 summary: Merge 3.6. files: setup.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -2015,7 +2015,7 @@ 'Modules', '_decimal', 'libmpdec'))] - libraries = [] + libraries = self.detect_math_libs() sources = [ '_decimal/_decimal.c', '_decimal/libmpdec/basearith.c', -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 08:59:40 2017 From: python-checkins at python.org (stefan.krah) Date: Sat, 04 Feb 2017 13:59:40 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUyOTQzOTog?= =?utf-8?q?=5Fdecimal_on_Android_requires_linking_with_libm=2E?= Message-ID: <20170204135940.16444.45564.20D488CD@psf.io> https://hg.python.org/cpython/rev/b60b46ad8751 changeset: 106416:b60b46ad8751 branch: 3.6 parent: 106407:b8fc4de84b9a user: Stefan Krah date: Sat Feb 04 14:58:50 2017 +0100 summary: Issue29439: _decimal on Android requires linking with libm. Patch by Chi Hsuan Yen. files: setup.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -2064,7 +2064,7 @@ 'Modules', '_decimal', 'libmpdec'))] - libraries = [] + libraries = self.detect_math_libs() sources = [ '_decimal/_decimal.c', '_decimal/libmpdec/basearith.c', -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 15:58:05 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Feb 2017 20:58:05 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5NDQ0?= =?utf-8?q?=3A_Fixed_out-of-bounds_buffer_access_in_the_group=28=29_method?= =?utf-8?q?_of?= Message-ID: <20170204205805.16088.86363.23C89F5E@psf.io> https://hg.python.org/cpython/rev/4e65d6c20dae changeset: 106418:4e65d6c20dae branch: 3.5 parent: 106405:d7b637af5a7e user: Serhiy Storchaka date: Sat Feb 04 22:53:57 2017 +0200 summary: Issue #29444: Fixed out-of-bounds buffer access in the group() method of the match object. Based on patch by WGH. files: Lib/test/test_re.py | 10 ++++++++++ Misc/NEWS | 3 +++ Modules/_sre.c | 9 +++++++-- 3 files changed, 20 insertions(+), 2 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 @@ -1679,6 +1679,16 @@ self.checkPatternError(r'(?<>)', 'unknown extension ?<>', 1) self.checkPatternError(r'(?', 'unexpected end of pattern', 2) + def test_bug_29444(self): + s = bytearray(b'abcdefgh') + m = re.search(b'[a-h]+', s) + m2 = re.search(b'[e-h]+', s) + self.assertEqual(m.group(), b'abcdefgh') + self.assertEqual(m2.group(), b'efgh') + s[:] = b'xyz' + self.assertEqual(m.group(), b'xyz') + self.assertEqual(m2.group(), b'') + class PatternReprTests(unittest.TestCase): def check(self, pattern, expected): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -21,6 +21,9 @@ Library ------- +- Issue #29444: Fixed out-of-bounds buffer access in the group() method of + the match object. Based on patch by WGH. + - Issue #29335: Fix subprocess.Popen.wait() when the child process has exited to a stopped instead of terminated state (ex: when under ptrace). diff --git a/Modules/_sre.c b/Modules/_sre.c --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -2015,6 +2015,7 @@ Py_buffer view; PyObject *result; void* ptr; + Py_ssize_t i, j; if (index < 0 || index >= self->groups) { /* raise IndexError if we were given a bad group number */ @@ -2036,8 +2037,12 @@ ptr = getstring(self->string, &length, &isbytes, &charsize, &view); if (ptr == NULL) return NULL; - result = getslice(isbytes, ptr, - self->string, self->mark[index], self->mark[index+1]); + + i = self->mark[index]; + j = self->mark[index+1]; + i = Py_MIN(i, length); + j = Py_MIN(j, length); + result = getslice(isbytes, ptr, self->string, i, j); if (isbytes && view.buf != NULL) PyBuffer_Release(&view); return result; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 15:58:06 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Feb 2017 20:58:06 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329444=3A_Fixed_out-of-bounds_buffer_access_in_the_gro?= =?utf-8?q?up=28=29_method_of?= Message-ID: <20170204205806.15931.65060.CD671E02@psf.io> https://hg.python.org/cpython/rev/393969776989 changeset: 106419:393969776989 branch: 3.6 parent: 106416:b60b46ad8751 parent: 106418:4e65d6c20dae user: Serhiy Storchaka date: Sat Feb 04 22:55:40 2017 +0200 summary: Issue #29444: Fixed out-of-bounds buffer access in the group() method of the match object. Based on patch by WGH. files: Lib/test/test_re.py | 10 ++++++++++ Misc/NEWS | 3 +++ Modules/_sre.c | 9 +++++++-- 3 files changed, 20 insertions(+), 2 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 @@ -1824,6 +1824,16 @@ warnings.simplefilter('error', BytesWarning) self.assertNotEqual(pattern3, pattern1) + def test_bug_29444(self): + s = bytearray(b'abcdefgh') + m = re.search(b'[a-h]+', s) + m2 = re.search(b'[e-h]+', s) + self.assertEqual(m.group(), b'abcdefgh') + self.assertEqual(m2.group(), b'efgh') + s[:] = b'xyz' + self.assertEqual(m.group(), b'xyz') + self.assertEqual(m2.group(), b'') + class PatternReprTests(unittest.TestCase): def check(self, pattern, expected): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -55,6 +55,9 @@ Library ------- +- Issue #29444: Fixed out-of-bounds buffer access in the group() method of + the match object. Based on patch by WGH. + - Issue #29335: Fix subprocess.Popen.wait() when the child process has exited to a stopped instead of terminated state (ex: when under ptrace). diff --git a/Modules/_sre.c b/Modules/_sre.c --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -2003,6 +2003,7 @@ Py_buffer view; PyObject *result; void* ptr; + Py_ssize_t i, j; if (index < 0 || index >= self->groups) { /* raise IndexError if we were given a bad group number */ @@ -2024,8 +2025,12 @@ ptr = getstring(self->string, &length, &isbytes, &charsize, &view); if (ptr == NULL) return NULL; - result = getslice(isbytes, ptr, - self->string, self->mark[index], self->mark[index+1]); + + i = self->mark[index]; + j = self->mark[index+1]; + i = Py_MIN(i, length); + j = Py_MIN(j, length); + result = getslice(isbytes, ptr, self->string, i, j); if (isbytes && view.buf != NULL) PyBuffer_Release(&view); return result; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 15:58:06 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Sat, 04 Feb 2017 20:58:06 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2329444=3A_Fixed_out-of-bounds_buffer_access_in_t?= =?utf-8?q?he_group=28=29_method_of?= Message-ID: <20170204205806.8248.45436.7D0C359D@psf.io> https://hg.python.org/cpython/rev/476b0fa34db4 changeset: 106420:476b0fa34db4 parent: 106417:038dd5e1f01b parent: 106419:393969776989 user: Serhiy Storchaka date: Sat Feb 04 22:57:44 2017 +0200 summary: Issue #29444: Fixed out-of-bounds buffer access in the group() method of the match object. Based on patch by WGH. files: Lib/test/test_re.py | 10 ++++++++++ Misc/NEWS | 3 +++ Modules/_sre.c | 9 +++++++-- 3 files changed, 20 insertions(+), 2 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 @@ -1821,6 +1821,16 @@ warnings.simplefilter('error', BytesWarning) self.assertNotEqual(pattern3, pattern1) + def test_bug_29444(self): + s = bytearray(b'abcdefgh') + m = re.search(b'[a-h]+', s) + m2 = re.search(b'[e-h]+', s) + self.assertEqual(m.group(), b'abcdefgh') + self.assertEqual(m2.group(), b'efgh') + s[:] = b'xyz' + self.assertEqual(m.group(), b'xyz') + self.assertEqual(m2.group(), b'') + class PatternReprTests(unittest.TestCase): def check(self, pattern, expected): diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -223,6 +223,9 @@ Library ------- +- Issue #29444: Fixed out-of-bounds buffer access in the group() method of + the match object. Based on patch by WGH. + - Issue #29377: Add SlotWrapperType, MethodWrapperType, and MethodDescriptorType built-in types to types module. Original patch by Manuel Krebber. diff --git a/Modules/_sre.c b/Modules/_sre.c --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -1945,6 +1945,7 @@ Py_buffer view; PyObject *result; void* ptr; + Py_ssize_t i, j; if (index < 0 || index >= self->groups) { /* raise IndexError if we were given a bad group number */ @@ -1966,8 +1967,12 @@ ptr = getstring(self->string, &length, &isbytes, &charsize, &view); if (ptr == NULL) return NULL; - result = getslice(isbytes, ptr, - self->string, self->mark[index], self->mark[index+1]); + + i = self->mark[index]; + j = self->mark[index+1]; + i = Py_MIN(i, length); + j = Py_MIN(j, length); + result = getslice(isbytes, ptr, self->string, i, j); if (isbytes && view.buf != NULL) PyBuffer_Release(&view); return result; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 17:57:22 2017 From: python-checkins at python.org (steve.dower) Date: Sat, 04 Feb 2017 22:57:22 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5NDE2?= =?utf-8?q?=3A_Prevent_infinite_loop_in_pathlib=2EPath=2Emkdir?= Message-ID: <20170204225722.7901.71143.785AFCD0@psf.io> https://hg.python.org/cpython/rev/8061d0967988 changeset: 106421:8061d0967988 branch: 3.5 parent: 106418:4e65d6c20dae user: Steve Dower date: Sat Feb 04 14:54:56 2017 -0800 summary: Issue #29416: Prevent infinite loop in pathlib.Path.mkdir files: Lib/pathlib.py | 2 +- Lib/test/test_pathlib.py | 11 +++++++++++ Misc/NEWS | 2 ++ 3 files changed, 14 insertions(+), 1 deletions(-) diff --git a/Lib/pathlib.py b/Lib/pathlib.py --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -1222,7 +1222,7 @@ if not exist_ok or not self.is_dir(): raise except OSError as e: - if e.errno != ENOENT: + if e.errno != ENOENT or self.parent == self: raise self.parent.mkdir(parents=True) self._accessor.mkdir(self, mode) 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 @@ -1727,6 +1727,17 @@ self.assertTrue(p.exists()) self.assertEqual(p.stat().st_ctime, st_ctime_first) + @only_nt # XXX: not sure how to test this on POSIX + def test_mkdir_with_unknown_drive(self): + for d in 'ZYXWVUTSRQPONMLKJIHGFEDCBA': + p = self.cls(d + ':\\') + if not p.is_dir(): + break + else: + self.skipTest("cannot find a drive that doesn't exist") + with self.assertRaises(OSError): + (p / 'child' / 'path').mkdir(parents=True) + def test_mkdir_with_child_file(self): p = self.cls(BASE, 'dirB', 'fileB') self.assertTrue(p.exists()) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -21,6 +21,8 @@ Library ------- +- Issue #29416: Prevent infinite loop in pathlib.Path.mkdir + - Issue #29444: Fixed out-of-bounds buffer access in the group() method of the match object. Based on patch by WGH. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 17:57:22 2017 From: python-checkins at python.org (steve.dower) Date: Sat, 04 Feb 2017 22:57:22 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329416=3A_Prevent_infinite_loop_in_pathlib=2EPath=2Emk?= =?utf-8?q?dir?= Message-ID: <20170204225722.16088.39768.152E7139@psf.io> https://hg.python.org/cpython/rev/3de58a54ed98 changeset: 106422:3de58a54ed98 branch: 3.6 parent: 106419:393969776989 parent: 106421:8061d0967988 user: Steve Dower date: Sat Feb 04 14:55:16 2017 -0800 summary: Issue #29416: Prevent infinite loop in pathlib.Path.mkdir files: Lib/pathlib.py | 2 +- Lib/test/test_pathlib.py | 11 +++++++++++ Misc/NEWS | 2 ++ 3 files changed, 14 insertions(+), 1 deletions(-) diff --git a/Lib/pathlib.py b/Lib/pathlib.py --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -1235,7 +1235,7 @@ if not exist_ok or not self.is_dir(): raise except OSError as e: - if e.errno != ENOENT: + if e.errno != ENOENT or self.parent == self: raise self.parent.mkdir(parents=True) self._accessor.mkdir(self, mode) 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 @@ -1776,6 +1776,17 @@ self.assertTrue(p.exists()) self.assertEqual(p.stat().st_ctime, st_ctime_first) + @only_nt # XXX: not sure how to test this on POSIX + def test_mkdir_with_unknown_drive(self): + for d in 'ZYXWVUTSRQPONMLKJIHGFEDCBA': + p = self.cls(d + ':\\') + if not p.is_dir(): + break + else: + self.skipTest("cannot find a drive that doesn't exist") + with self.assertRaises(OSError): + (p / 'child' / 'path').mkdir(parents=True) + def test_mkdir_with_child_file(self): p = self.cls(BASE, 'dirB', 'fileB') self.assertTrue(p.exists()) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -55,6 +55,8 @@ Library ------- +- Issue #29416: Prevent infinite loop in pathlib.Path.mkdir + - Issue #29444: Fixed out-of-bounds buffer access in the group() method of the match object. Based on patch by WGH. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 17:57:23 2017 From: python-checkins at python.org (steve.dower) Date: Sat, 04 Feb 2017 22:57:23 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2329416=3A_Prevent_infinite_loop_in_pathlib=2EPat?= =?utf-8?q?h=2Emkdir?= Message-ID: <20170204225723.7642.15005.4F0AFE57@psf.io> https://hg.python.org/cpython/rev/09c018897fb3 changeset: 106423:09c018897fb3 parent: 106420:476b0fa34db4 parent: 106422:3de58a54ed98 user: Steve Dower date: Sat Feb 04 14:56:57 2017 -0800 summary: Issue #29416: Prevent infinite loop in pathlib.Path.mkdir files: Lib/pathlib.py | 2 +- Lib/test/test_pathlib.py | 11 +++++++++++ Misc/NEWS | 2 ++ 3 files changed, 14 insertions(+), 1 deletions(-) diff --git a/Lib/pathlib.py b/Lib/pathlib.py --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -1235,7 +1235,7 @@ if not exist_ok or not self.is_dir(): raise except OSError as e: - if e.errno != ENOENT: + if e.errno != ENOENT or self.parent == self: raise self.parent.mkdir(parents=True) self._accessor.mkdir(self, mode) 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 @@ -1776,6 +1776,17 @@ self.assertTrue(p.exists()) self.assertEqual(p.stat().st_ctime, st_ctime_first) + @only_nt # XXX: not sure how to test this on POSIX + def test_mkdir_with_unknown_drive(self): + for d in 'ZYXWVUTSRQPONMLKJIHGFEDCBA': + p = self.cls(d + ':\\') + if not p.is_dir(): + break + else: + self.skipTest("cannot find a drive that doesn't exist") + with self.assertRaises(OSError): + (p / 'child' / 'path').mkdir(parents=True) + def test_mkdir_with_child_file(self): p = self.cls(BASE, 'dirB', 'fileB') self.assertTrue(p.exists()) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -223,6 +223,8 @@ Library ------- +- Issue #29416: Prevent infinite loop in pathlib.Path.mkdir + - Issue #29444: Fixed out-of-bounds buffer access in the group() method of the match object. Based on patch by WGH. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 18:06:02 2017 From: python-checkins at python.org (steve.dower) Date: Sat, 04 Feb 2017 23:06:02 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5Mzky?= =?utf-8?q?=3A_Prevent_crash_when_passing_invalid_arguments_into_msvcrt_mo?= =?utf-8?q?dule=2E?= Message-ID: <20170204230602.16444.63105.5F1376AC@psf.io> https://hg.python.org/cpython/rev/f48bdcd02b57 changeset: 106424:f48bdcd02b57 branch: 3.5 parent: 106421:8061d0967988 user: Steve Dower date: Sat Feb 04 15:05:13 2017 -0800 summary: Issue #29392: Prevent crash when passing invalid arguments into msvcrt module. files: Misc/NEWS | 5 ++ PC/msvcrtmodule.c | 60 +++++++++++++++++++++++++++------- 2 files changed, 52 insertions(+), 13 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -47,6 +47,11 @@ leading dots could match related hostnames again (e.g. .b.c matches a.b.c). Patch by Milan Oberkirch. +Windows +------- + +- Issue #29392: Prevent crash when passing invalid arguments into msvcrt module. + C API ----- diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c --- a/PC/msvcrtmodule.c +++ b/PC/msvcrtmodule.c @@ -111,7 +111,9 @@ int err; Py_BEGIN_ALLOW_THREADS + _Py_BEGIN_SUPPRESS_IPH err = _locking(fd, mode, nbytes); + _Py_END_SUPPRESS_IPH Py_END_ALLOW_THREADS if (err != 0) return PyErr_SetFromErrno(PyExc_IOError); @@ -138,7 +140,9 @@ msvcrt_setmode_impl(PyObject *module, int fd, int flags) /*[clinic end generated code: output=24a9be5ea07ccb9b input=76e7c01f6b137f75]*/ { + _Py_BEGIN_SUPPRESS_IPH flags = _setmode(fd, flags); + _Py_END_SUPPRESS_IPH if (flags == -1) PyErr_SetFromErrno(PyExc_IOError); @@ -165,7 +169,9 @@ { int fd; + _Py_BEGIN_SUPPRESS_IPH fd = _open_osfhandle(handle, flags); + _Py_END_SUPPRESS_IPH if (fd == -1) PyErr_SetFromErrno(PyExc_IOError); @@ -189,16 +195,11 @@ { Py_intptr_t handle = -1; - if (!_PyVerify_fd(fd)) { + _Py_BEGIN_SUPPRESS_IPH + handle = _get_osfhandle(fd); + _Py_END_SUPPRESS_IPH + if (handle == -1) PyErr_SetFromErrno(PyExc_IOError); - } - else { - _Py_BEGIN_SUPPRESS_IPH - handle = _get_osfhandle(fd); - _Py_END_SUPPRESS_IPH - if (handle == -1) - PyErr_SetFromErrno(PyExc_IOError); - } return handle; } @@ -308,7 +309,9 @@ msvcrt_putch_impl(PyObject *module, char char_value) /*[clinic end generated code: output=92ec9b81012d8f60 input=ec078dd10cb054d6]*/ { + _Py_BEGIN_SUPPRESS_IPH _putch(char_value); + _Py_END_SUPPRESS_IPH Py_RETURN_NONE; } @@ -325,7 +328,9 @@ msvcrt_putwch_impl(PyObject *module, int unicode_char) /*[clinic end generated code: output=a3bd1a8951d28eee input=996ccd0bbcbac4c3]*/ { + _Py_BEGIN_SUPPRESS_IPH _putwch(unicode_char); + _Py_END_SUPPRESS_IPH Py_RETURN_NONE; } @@ -347,7 +352,13 @@ msvcrt_ungetch_impl(PyObject *module, char char_value) /*[clinic end generated code: output=c6942a0efa119000 input=22f07ee9001bbf0f]*/ { - if (_ungetch(char_value) == EOF) + int res; + + _Py_BEGIN_SUPPRESS_IPH + res = _ungetch(char_value); + _Py_END_SUPPRESS_IPH + + if (res == EOF) return PyErr_SetFromErrno(PyExc_IOError); Py_RETURN_NONE; } @@ -365,7 +376,13 @@ msvcrt_ungetwch_impl(PyObject *module, int unicode_char) /*[clinic end generated code: output=e63af05438b8ba3d input=83ec0492be04d564]*/ { - if (_ungetwch(unicode_char) == WEOF) + int res; + + _Py_BEGIN_SUPPRESS_IPH + res = _ungetwch(unicode_char); + _Py_END_SUPPRESS_IPH + + if (res == WEOF) return PyErr_SetFromErrno(PyExc_IOError); Py_RETURN_NONE; } @@ -387,7 +404,13 @@ msvcrt_CrtSetReportFile_impl(PyObject *module, int type, int file) /*[clinic end generated code: output=df291c7fe032eb68 input=bb8f721a604fcc45]*/ { - return (long)_CrtSetReportFile(type, (_HFILE)file); + long res; + + _Py_BEGIN_SUPPRESS_IPH + res = (long)_CrtSetReportFile(type, (_HFILE)file); + _Py_END_SUPPRESS_IPH + + return res; } /*[clinic input] @@ -408,7 +431,9 @@ { int res; + _Py_BEGIN_SUPPRESS_IPH res = _CrtSetReportMode(type, mode); + _Py_END_SUPPRESS_IPH if (res == -1) PyErr_SetFromErrno(PyExc_IOError); return res; @@ -429,7 +454,13 @@ msvcrt_set_error_mode_impl(PyObject *module, int mode) /*[clinic end generated code: output=ac4a09040d8ac4e3 input=046fca59c0f20872]*/ { - return _set_error_mode(mode); + long res; + + _Py_BEGIN_SUPPRESS_IPH + res = _set_error_mode(mode); + _Py_END_SUPPRESS_IPH + + return res; } #endif /* _DEBUG */ @@ -448,7 +479,10 @@ { unsigned int res; + _Py_BEGIN_SUPPRESS_IPH res = SetErrorMode(mode); + _Py_END_SUPPRESS_IPH + return PyLong_FromUnsignedLong(res); } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 18:06:02 2017 From: python-checkins at python.org (steve.dower) Date: Sat, 04 Feb 2017 23:06:02 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2329392=3A_Prevent_crash_when_passing_invalid_arg?= =?utf-8?q?uments_into_msvcrt_module=2E?= Message-ID: <20170204230602.128841.22620.7DA1CCCA@psf.io> https://hg.python.org/cpython/rev/fb6a48fa8da3 changeset: 106426:fb6a48fa8da3 parent: 106423:09c018897fb3 parent: 106425:15bbb18d87fd user: Steve Dower date: Sat Feb 04 15:05:50 2017 -0800 summary: Issue #29392: Prevent crash when passing invalid arguments into msvcrt module. files: Misc/NEWS | 2 + PC/msvcrtmodule.c | 47 ++++++++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -871,6 +871,8 @@ Windows ------- +- Issue #29392: Prevent crash when passing invalid arguments into msvcrt module. + - Issue #25778: winreg does not truncate string correctly (Patch by Eryk Sun) - Issue #28896: Deprecate WindowsRegistryFinder and disable it by default. diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c --- a/PC/msvcrtmodule.c +++ b/PC/msvcrtmodule.c @@ -111,7 +111,9 @@ int err; Py_BEGIN_ALLOW_THREADS + _Py_BEGIN_SUPPRESS_IPH err = _locking(fd, mode, nbytes); + _Py_END_SUPPRESS_IPH Py_END_ALLOW_THREADS if (err != 0) return PyErr_SetFromErrno(PyExc_IOError); @@ -138,7 +140,9 @@ msvcrt_setmode_impl(PyObject *module, int fd, int flags) /*[clinic end generated code: output=24a9be5ea07ccb9b input=76e7c01f6b137f75]*/ { + _Py_BEGIN_SUPPRESS_IPH flags = _setmode(fd, flags); + _Py_END_SUPPRESS_IPH if (flags == -1) PyErr_SetFromErrno(PyExc_IOError); @@ -165,7 +169,9 @@ { int fd; + _Py_BEGIN_SUPPRESS_IPH fd = _open_osfhandle(handle, flags); + _Py_END_SUPPRESS_IPH if (fd == -1) PyErr_SetFromErrno(PyExc_IOError); @@ -303,7 +309,9 @@ msvcrt_putch_impl(PyObject *module, char char_value) /*[clinic end generated code: output=92ec9b81012d8f60 input=ec078dd10cb054d6]*/ { + _Py_BEGIN_SUPPRESS_IPH _putch(char_value); + _Py_END_SUPPRESS_IPH Py_RETURN_NONE; } @@ -320,7 +328,9 @@ msvcrt_putwch_impl(PyObject *module, int unicode_char) /*[clinic end generated code: output=a3bd1a8951d28eee input=996ccd0bbcbac4c3]*/ { + _Py_BEGIN_SUPPRESS_IPH _putwch(unicode_char); + _Py_END_SUPPRESS_IPH Py_RETURN_NONE; } @@ -342,7 +352,13 @@ msvcrt_ungetch_impl(PyObject *module, char char_value) /*[clinic end generated code: output=c6942a0efa119000 input=22f07ee9001bbf0f]*/ { - if (_ungetch(char_value) == EOF) + int res; + + _Py_BEGIN_SUPPRESS_IPH + res = _ungetch(char_value); + _Py_END_SUPPRESS_IPH + + if (res == EOF) return PyErr_SetFromErrno(PyExc_IOError); Py_RETURN_NONE; } @@ -360,7 +376,13 @@ msvcrt_ungetwch_impl(PyObject *module, int unicode_char) /*[clinic end generated code: output=e63af05438b8ba3d input=83ec0492be04d564]*/ { - if (_ungetwch(unicode_char) == WEOF) + int res; + + _Py_BEGIN_SUPPRESS_IPH + res = _ungetwch(unicode_char); + _Py_END_SUPPRESS_IPH + + if (res == WEOF) return PyErr_SetFromErrno(PyExc_IOError); Py_RETURN_NONE; } @@ -382,7 +404,13 @@ msvcrt_CrtSetReportFile_impl(PyObject *module, int type, int file) /*[clinic end generated code: output=df291c7fe032eb68 input=bb8f721a604fcc45]*/ { - return (long)_CrtSetReportFile(type, (_HFILE)file); + long res; + + _Py_BEGIN_SUPPRESS_IPH + res = (long)_CrtSetReportFile(type, (_HFILE)file); + _Py_END_SUPPRESS_IPH + + return res; } /*[clinic input] @@ -403,7 +431,9 @@ { int res; + _Py_BEGIN_SUPPRESS_IPH res = _CrtSetReportMode(type, mode); + _Py_END_SUPPRESS_IPH if (res == -1) PyErr_SetFromErrno(PyExc_IOError); return res; @@ -424,7 +454,13 @@ msvcrt_set_error_mode_impl(PyObject *module, int mode) /*[clinic end generated code: output=ac4a09040d8ac4e3 input=046fca59c0f20872]*/ { - return _set_error_mode(mode); + long res; + + _Py_BEGIN_SUPPRESS_IPH + res = _set_error_mode(mode); + _Py_END_SUPPRESS_IPH + + return res; } #endif /* _DEBUG */ @@ -443,7 +479,10 @@ { unsigned int res; + _Py_BEGIN_SUPPRESS_IPH res = SetErrorMode(mode); + _Py_END_SUPPRESS_IPH + return PyLong_FromUnsignedLong(res); } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 18:06:02 2017 From: python-checkins at python.org (steve.dower) Date: Sat, 04 Feb 2017 23:06:02 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329392=3A_Prevent_crash_when_passing_invalid_arguments?= =?utf-8?q?_into_msvcrt_module=2E?= Message-ID: <20170204230602.127873.14099.459D131A@psf.io> https://hg.python.org/cpython/rev/15bbb18d87fd changeset: 106425:15bbb18d87fd branch: 3.6 parent: 106422:3de58a54ed98 parent: 106424:f48bdcd02b57 user: Steve Dower date: Sat Feb 04 15:05:40 2017 -0800 summary: Issue #29392: Prevent crash when passing invalid arguments into msvcrt module. files: Misc/NEWS | 2 + PC/msvcrtmodule.c | 47 ++++++++++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -146,6 +146,8 @@ Windows ------- +- Issue #29392: Prevent crash when passing invalid arguments into msvcrt module. + - Issue #25778: winreg does not truncate string correctly (Patch by Eryk Sun) - Issue #28896: Deprecate WindowsRegistryFinder and disable it by default. diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c --- a/PC/msvcrtmodule.c +++ b/PC/msvcrtmodule.c @@ -111,7 +111,9 @@ int err; Py_BEGIN_ALLOW_THREADS + _Py_BEGIN_SUPPRESS_IPH err = _locking(fd, mode, nbytes); + _Py_END_SUPPRESS_IPH Py_END_ALLOW_THREADS if (err != 0) return PyErr_SetFromErrno(PyExc_IOError); @@ -138,7 +140,9 @@ msvcrt_setmode_impl(PyObject *module, int fd, int flags) /*[clinic end generated code: output=24a9be5ea07ccb9b input=76e7c01f6b137f75]*/ { + _Py_BEGIN_SUPPRESS_IPH flags = _setmode(fd, flags); + _Py_END_SUPPRESS_IPH if (flags == -1) PyErr_SetFromErrno(PyExc_IOError); @@ -165,7 +169,9 @@ { int fd; + _Py_BEGIN_SUPPRESS_IPH fd = _open_osfhandle(handle, flags); + _Py_END_SUPPRESS_IPH if (fd == -1) PyErr_SetFromErrno(PyExc_IOError); @@ -303,7 +309,9 @@ msvcrt_putch_impl(PyObject *module, char char_value) /*[clinic end generated code: output=92ec9b81012d8f60 input=ec078dd10cb054d6]*/ { + _Py_BEGIN_SUPPRESS_IPH _putch(char_value); + _Py_END_SUPPRESS_IPH Py_RETURN_NONE; } @@ -320,7 +328,9 @@ msvcrt_putwch_impl(PyObject *module, int unicode_char) /*[clinic end generated code: output=a3bd1a8951d28eee input=996ccd0bbcbac4c3]*/ { + _Py_BEGIN_SUPPRESS_IPH _putwch(unicode_char); + _Py_END_SUPPRESS_IPH Py_RETURN_NONE; } @@ -342,7 +352,13 @@ msvcrt_ungetch_impl(PyObject *module, char char_value) /*[clinic end generated code: output=c6942a0efa119000 input=22f07ee9001bbf0f]*/ { - if (_ungetch(char_value) == EOF) + int res; + + _Py_BEGIN_SUPPRESS_IPH + res = _ungetch(char_value); + _Py_END_SUPPRESS_IPH + + if (res == EOF) return PyErr_SetFromErrno(PyExc_IOError); Py_RETURN_NONE; } @@ -360,7 +376,13 @@ msvcrt_ungetwch_impl(PyObject *module, int unicode_char) /*[clinic end generated code: output=e63af05438b8ba3d input=83ec0492be04d564]*/ { - if (_ungetwch(unicode_char) == WEOF) + int res; + + _Py_BEGIN_SUPPRESS_IPH + res = _ungetwch(unicode_char); + _Py_END_SUPPRESS_IPH + + if (res == WEOF) return PyErr_SetFromErrno(PyExc_IOError); Py_RETURN_NONE; } @@ -382,7 +404,13 @@ msvcrt_CrtSetReportFile_impl(PyObject *module, int type, int file) /*[clinic end generated code: output=df291c7fe032eb68 input=bb8f721a604fcc45]*/ { - return (long)_CrtSetReportFile(type, (_HFILE)file); + long res; + + _Py_BEGIN_SUPPRESS_IPH + res = (long)_CrtSetReportFile(type, (_HFILE)file); + _Py_END_SUPPRESS_IPH + + return res; } /*[clinic input] @@ -403,7 +431,9 @@ { int res; + _Py_BEGIN_SUPPRESS_IPH res = _CrtSetReportMode(type, mode); + _Py_END_SUPPRESS_IPH if (res == -1) PyErr_SetFromErrno(PyExc_IOError); return res; @@ -424,7 +454,13 @@ msvcrt_set_error_mode_impl(PyObject *module, int mode) /*[clinic end generated code: output=ac4a09040d8ac4e3 input=046fca59c0f20872]*/ { - return _set_error_mode(mode); + long res; + + _Py_BEGIN_SUPPRESS_IPH + res = _set_error_mode(mode); + _Py_END_SUPPRESS_IPH + + return res; } #endif /* _DEBUG */ @@ -443,7 +479,10 @@ { unsigned int res; + _Py_BEGIN_SUPPRESS_IPH res = SetErrorMode(mode); + _Py_END_SUPPRESS_IPH + return PyLong_FromUnsignedLong(res); } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 18:14:32 2017 From: python-checkins at python.org (steve.dower) Date: Sat, 04 Feb 2017 23:14:32 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI5NDA5?= =?utf-8?q?=3A_Implement_PEP_529_for_io=2EFileIO_=28Patch_by_Eryk_Sun=29?= Message-ID: <20170204231432.128501.18508.31E0FFC3@psf.io> https://hg.python.org/cpython/rev/0bf72810f8ea changeset: 106427:0bf72810f8ea branch: 3.6 parent: 106425:15bbb18d87fd user: Steve Dower date: Sat Feb 04 14:38:11 2017 -0800 summary: Issue #29409: Implement PEP 529 for io.FileIO (Patch by Eryk Sun) files: Lib/test/test_fileio.py | 20 +++++++++++++++++- Misc/NEWS | 2 + Modules/_io/fileio.c | 31 +++++++++++++--------------- 3 files changed, 35 insertions(+), 18 deletions(-) diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py --- a/Lib/test/test_fileio.py +++ b/Lib/test/test_fileio.py @@ -9,7 +9,8 @@ from weakref import proxy from functools import wraps -from test.support import TESTFN, check_warnings, run_unittest, make_bad_fd, cpython_only +from test.support import (TESTFN, TESTFN_UNICODE, check_warnings, run_unittest, + make_bad_fd, cpython_only) from collections import UserList import _io # C implementation of io @@ -432,6 +433,23 @@ finally: os.unlink(TESTFN) + @unittest.skipIf(sys.getfilesystemencoding() != 'utf-8', + "test only works for utf-8 filesystems") + def testUtf8BytesOpen(self): + # Opening a UTF-8 bytes filename + try: + fn = TESTFN_UNICODE.encode("utf-8") + except UnicodeEncodeError: + self.skipTest('could not encode %r to utf-8' % TESTFN_UNICODE) + f = self.FileIO(fn, "w") + try: + f.write(b"abc") + f.close() + with open(TESTFN_UNICODE, "rb") as f: + self.assertEqual(f.read(), b"abc") + finally: + os.unlink(TESTFN_UNICODE) + def testConstructorHandlesNULChars(self): fn_with_NUL = 'foo\0bar' self.assertRaises(ValueError, self.FileIO, fn_with_NUL, 'w') diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -146,6 +146,8 @@ Windows ------- +- Issue #29409: Implement PEP 529 for io.FileIO (Patch by Eryk Sun) + - Issue #29392: Prevent crash when passing invalid arguments into msvcrt module. - Issue #25778: winreg does not truncate string correctly (Patch by Eryk Sun) diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -230,12 +230,13 @@ int closefd, PyObject *opener) /*[clinic end generated code: output=23413f68e6484bbd input=193164e293d6c097]*/ { +#ifdef MS_WINDOWS + Py_UNICODE *widename = NULL; +#else const char *name = NULL; +#endif PyObject *stringobj = NULL; const char *s; -#ifdef MS_WINDOWS - Py_UNICODE *widename = NULL; -#endif int ret = 0; int rwa = 0, plus = 0; int flags = 0; @@ -277,24 +278,21 @@ PyErr_Clear(); } + if (fd < 0) { #ifdef MS_WINDOWS - if (PyUnicode_Check(nameobj)) { Py_ssize_t length; - widename = PyUnicode_AsUnicodeAndSize(nameobj, &length); + if (!PyUnicode_FSDecoder(nameobj, &stringobj)) { + return -1; + } + widename = PyUnicode_AsUnicodeAndSize(stringobj, &length); if (widename == NULL) return -1; - if (wcslen(widename) != length) { - PyErr_SetString(PyExc_ValueError, "embedded null character"); - return -1; - } - } else -#endif - if (fd < 0) - { +#else if (!PyUnicode_FSConverter(nameobj, &stringobj)) { return -1; } name = PyBytes_AS_STRING(stringobj); +#endif } s = mode; @@ -386,11 +384,10 @@ do { Py_BEGIN_ALLOW_THREADS #ifdef MS_WINDOWS - if (widename != NULL) - self->fd = _wopen(widename, flags, 0666); - else + self->fd = _wopen(widename, flags, 0666); +#else + self->fd = open(name, flags, 0666); #endif - self->fd = open(name, flags, 0666); Py_END_ALLOW_THREADS } while (self->fd < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 18:14:33 2017 From: python-checkins at python.org (steve.dower) Date: Sat, 04 Feb 2017 23:14:33 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4MTY0?= =?utf-8?q?=3A_Correctly_handle_special_console_filenames_=28patch_by_Eryk?= =?utf-8?q?_Sun=29?= Message-ID: <20170204231433.16006.97944.8ABD5B70@psf.io> https://hg.python.org/cpython/rev/ed0c05c739c9 changeset: 106428:ed0c05c739c9 branch: 3.6 user: Steve Dower date: Sat Feb 04 15:07:46 2017 -0800 summary: Issue #28164: Correctly handle special console filenames (patch by Eryk Sun) files: Lib/test/test_winconsoleio.py | 28 +++++++++- Misc/NEWS | 2 + Modules/_io/winconsoleio.c | 67 ++++++++++++++++------ 3 files changed, 76 insertions(+), 21 deletions(-) diff --git a/Lib/test/test_winconsoleio.py b/Lib/test/test_winconsoleio.py --- a/Lib/test/test_winconsoleio.py +++ b/Lib/test/test_winconsoleio.py @@ -1,9 +1,11 @@ '''Tests for WindowsConsoleIO ''' +import os import io +import sys import unittest -import sys +import tempfile if sys.platform != 'win32': raise unittest.SkipTest("test only relevant on win32") @@ -19,6 +21,16 @@ self.assertFalse(issubclass(ConIO, io.TextIOBase)) def test_open_fd(self): + self.assertRaisesRegex(ValueError, + "negative file descriptor", ConIO, -1) + + fd, _ = tempfile.mkstemp() + try: + self.assertRaisesRegex(ValueError, + "Cannot open non-console file", ConIO, fd) + finally: + os.close(fd) + try: f = ConIO(0) except ValueError: @@ -56,6 +68,20 @@ f.close() def test_open_name(self): + self.assertRaises(ValueError, ConIO, sys.executable) + + f = open('C:/con', 'rb', buffering=0) + self.assertIsInstance(f, ConIO) + f.close() + + f = open(r'\\.\conin$', 'rb', buffering=0) + self.assertIsInstance(f, ConIO) + f.close() + + f = open('//?/conout$', 'wb', buffering=0) + self.assertIsInstance(f, ConIO) + f.close() + f = ConIO("CON") self.assertTrue(f.readable()) self.assertFalse(f.writable()) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -146,6 +146,8 @@ Windows ------- +- Issue #28164: Correctly handle special console filenames (patch by Eryk Sun) + - Issue #29409: Implement PEP 529 for io.FileIO (Patch by Eryk Sun) - Issue #29392: Prevent crash when passing invalid arguments into msvcrt module. diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c --- a/Modules/_io/winconsoleio.c +++ b/Modules/_io/winconsoleio.c @@ -60,51 +60,68 @@ } char _PyIO_get_console_type(PyObject *path_or_fd) { - int fd; - - fd = PyLong_AsLong(path_or_fd); + int fd = PyLong_AsLong(path_or_fd); PyErr_Clear(); if (fd >= 0) { HANDLE handle; _Py_BEGIN_SUPPRESS_IPH handle = (HANDLE)_get_osfhandle(fd); _Py_END_SUPPRESS_IPH - if (!handle) + if (handle == INVALID_HANDLE_VALUE) return '\0'; return _get_console_type(handle); } - PyObject *decoded, *decoded_upper; + PyObject *decoded; + wchar_t *decoded_wstr; - int d = PyUnicode_FSDecoder(path_or_fd, &decoded); - if (!d) { + if (!PyUnicode_FSDecoder(path_or_fd, &decoded)) { PyErr_Clear(); return '\0'; } - if (!PyUnicode_Check(decoded)) { - Py_CLEAR(decoded); - return '\0'; - } - decoded_upper = PyObject_CallMethod(decoded, "upper", ""); + decoded_wstr = PyUnicode_AsWideCharString(decoded, NULL); Py_CLEAR(decoded); - if (!decoded_upper) { + if (!decoded_wstr) { PyErr_Clear(); return '\0'; } + DWORD length; + wchar_t name_buf[MAX_PATH], *pname_buf = name_buf; + + length = GetFullPathNameW(decoded_wstr, MAX_PATH, pname_buf, NULL); + if (length > MAX_PATH) { + pname_buf = PyMem_New(wchar_t, length); + if (pname_buf) + length = GetFullPathNameW(decoded_wstr, length, pname_buf, NULL); + else + length = 0; + } + PyMem_Free(decoded_wstr); + char m = '\0'; - if (_PyUnicode_EqualToASCIIString(decoded_upper, "CONIN$")) { - m = 'r'; - } else if (_PyUnicode_EqualToASCIIString(decoded_upper, "CONOUT$")) { - m = 'w'; - } else if (_PyUnicode_EqualToASCIIString(decoded_upper, "CON")) { - m = 'x'; + if (length) { + wchar_t *name = pname_buf; + if (length >= 4 && name[3] == L'\\' && + (name[2] == L'.' || name[2] == L'?') && + name[1] == L'\\' && name[0] == L'\\') { + name += 4; + } + if (!_wcsicmp(name, L"CONIN$")) { + m = 'r'; + } else if (!_wcsicmp(name, L"CONOUT$")) { + m = 'w'; + } else if (!_wcsicmp(name, L"CON")) { + m = 'x'; + } } - Py_CLEAR(decoded_upper); + if (pname_buf != name_buf) + PyMem_Free(pname_buf); return m; } + /*[clinic input] module _io class _io._WindowsConsoleIO "winconsoleio *" "&PyWindowsConsoleIO_Type" @@ -289,6 +306,11 @@ Py_CLEAR(decodedname); if (name == NULL) return -1; + if (console_type == '\0') { + PyErr_SetString(PyExc_ValueError, + "Cannot open non-console file"); + return -1; + } if (wcslen(name) != length) { PyMem_Free(name); @@ -370,6 +392,11 @@ if (console_type == '\0') console_type = _get_console_type(self->handle); + if (console_type == '\0') { + PyErr_SetString(PyExc_ValueError, + "Cannot open non-console file"); + goto error; + } if (self->writable && console_type != 'w') { PyErr_SetString(PyExc_ValueError, "Cannot open console input buffer for writing"); -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 18:14:33 2017 From: python-checkins at python.org (steve.dower) Date: Sat, 04 Feb 2017 23:14:33 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Merge_issue_=2328164_and_issue_=2329409?= Message-ID: <20170204231433.96586.85106.5B03ADD5@psf.io> https://hg.python.org/cpython/rev/a5538734cc87 changeset: 106429:a5538734cc87 parent: 106426:fb6a48fa8da3 parent: 106428:ed0c05c739c9 user: Steve Dower date: Sat Feb 04 15:14:18 2017 -0800 summary: Merge issue #28164 and issue #29409 files: Lib/test/test_fileio.py | 20 +++++++- Lib/test/test_winconsoleio.py | 28 ++++++++++- Misc/NEWS | 4 + Modules/_io/fileio.c | 31 +++++------ Modules/_io/winconsoleio.c | 57 ++++++++++++++-------- 5 files changed, 101 insertions(+), 39 deletions(-) diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py --- a/Lib/test/test_fileio.py +++ b/Lib/test/test_fileio.py @@ -9,7 +9,8 @@ from weakref import proxy from functools import wraps -from test.support import TESTFN, check_warnings, run_unittest, make_bad_fd, cpython_only +from test.support import (TESTFN, TESTFN_UNICODE, check_warnings, run_unittest, + make_bad_fd, cpython_only) from collections import UserList import _io # C implementation of io @@ -432,6 +433,23 @@ finally: os.unlink(TESTFN) + @unittest.skipIf(sys.getfilesystemencoding() != 'utf-8', + "test only works for utf-8 filesystems") + def testUtf8BytesOpen(self): + # Opening a UTF-8 bytes filename + try: + fn = TESTFN_UNICODE.encode("utf-8") + except UnicodeEncodeError: + self.skipTest('could not encode %r to utf-8' % TESTFN_UNICODE) + f = self.FileIO(fn, "w") + try: + f.write(b"abc") + f.close() + with open(TESTFN_UNICODE, "rb") as f: + self.assertEqual(f.read(), b"abc") + finally: + os.unlink(TESTFN_UNICODE) + def testConstructorHandlesNULChars(self): fn_with_NUL = 'foo\0bar' self.assertRaises(ValueError, self.FileIO, fn_with_NUL, 'w') diff --git a/Lib/test/test_winconsoleio.py b/Lib/test/test_winconsoleio.py --- a/Lib/test/test_winconsoleio.py +++ b/Lib/test/test_winconsoleio.py @@ -1,9 +1,11 @@ '''Tests for WindowsConsoleIO ''' +import os import io +import sys import unittest -import sys +import tempfile if sys.platform != 'win32': raise unittest.SkipTest("test only relevant on win32") @@ -19,6 +21,16 @@ self.assertFalse(issubclass(ConIO, io.TextIOBase)) def test_open_fd(self): + self.assertRaisesRegex(ValueError, + "negative file descriptor", ConIO, -1) + + fd, _ = tempfile.mkstemp() + try: + self.assertRaisesRegex(ValueError, + "Cannot open non-console file", ConIO, fd) + finally: + os.close(fd) + try: f = ConIO(0) except ValueError: @@ -56,6 +68,20 @@ f.close() def test_open_name(self): + self.assertRaises(ValueError, ConIO, sys.executable) + + f = open('C:/con', 'rb', buffering=0) + self.assertIsInstance(f, ConIO) + f.close() + + f = open(r'\\.\conin$', 'rb', buffering=0) + self.assertIsInstance(f, ConIO) + f.close() + + f = open('//?/conout$', 'wb', buffering=0) + self.assertIsInstance(f, ConIO) + f.close() + f = ConIO("CON") self.assertTrue(f.readable()) self.assertFalse(f.writable()) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -871,6 +871,10 @@ Windows ------- +- Issue #28164: Correctly handle special console filenames (patch by Eryk Sun) + +- Issue #29409: Implement PEP 529 for io.FileIO (Patch by Eryk Sun) + - Issue #29392: Prevent crash when passing invalid arguments into msvcrt module. - Issue #25778: winreg does not truncate string correctly (Patch by Eryk Sun) diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -230,12 +230,13 @@ int closefd, PyObject *opener) /*[clinic end generated code: output=23413f68e6484bbd input=193164e293d6c097]*/ { +#ifdef MS_WINDOWS + Py_UNICODE *widename = NULL; +#else const char *name = NULL; +#endif PyObject *stringobj = NULL; const char *s; -#ifdef MS_WINDOWS - Py_UNICODE *widename = NULL; -#endif int ret = 0; int rwa = 0, plus = 0; int flags = 0; @@ -277,24 +278,21 @@ PyErr_Clear(); } + if (fd < 0) { #ifdef MS_WINDOWS - if (PyUnicode_Check(nameobj)) { Py_ssize_t length; - widename = PyUnicode_AsUnicodeAndSize(nameobj, &length); + if (!PyUnicode_FSDecoder(nameobj, &stringobj)) { + return -1; + } + widename = PyUnicode_AsUnicodeAndSize(stringobj, &length); if (widename == NULL) return -1; - if (wcslen(widename) != length) { - PyErr_SetString(PyExc_ValueError, "embedded null character"); - return -1; - } - } else -#endif - if (fd < 0) - { +#else if (!PyUnicode_FSConverter(nameobj, &stringobj)) { return -1; } name = PyBytes_AS_STRING(stringobj); +#endif } s = mode; @@ -386,11 +384,10 @@ do { Py_BEGIN_ALLOW_THREADS #ifdef MS_WINDOWS - if (widename != NULL) - self->fd = _wopen(widename, flags, 0666); - else + self->fd = _wopen(widename, flags, 0666); +#else + self->fd = open(name, flags, 0666); #endif - self->fd = open(name, flags, 0666); Py_END_ALLOW_THREADS } while (self->fd < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals())); diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c --- a/Modules/_io/winconsoleio.c +++ b/Modules/_io/winconsoleio.c @@ -60,51 +60,68 @@ } char _PyIO_get_console_type(PyObject *path_or_fd) { - int fd; - - fd = PyLong_AsLong(path_or_fd); + int fd = PyLong_AsLong(path_or_fd); PyErr_Clear(); if (fd >= 0) { HANDLE handle; _Py_BEGIN_SUPPRESS_IPH handle = (HANDLE)_get_osfhandle(fd); _Py_END_SUPPRESS_IPH - if (!handle) + if (handle == INVALID_HANDLE_VALUE) return '\0'; return _get_console_type(handle); } - PyObject *decoded, *decoded_upper; + PyObject *decoded; + wchar_t *decoded_wstr; - int d = PyUnicode_FSDecoder(path_or_fd, &decoded); - if (!d) { + if (!PyUnicode_FSDecoder(path_or_fd, &decoded)) { PyErr_Clear(); return '\0'; } - if (!PyUnicode_Check(decoded)) { - Py_CLEAR(decoded); - return '\0'; - } - decoded_upper = PyObject_CallMethod(decoded, "upper", NULL); + decoded_wstr = PyUnicode_AsWideCharString(decoded, NULL); Py_CLEAR(decoded); - if (!decoded_upper) { + if (!decoded_wstr) { PyErr_Clear(); return '\0'; } + DWORD length; + wchar_t name_buf[MAX_PATH], *pname_buf = name_buf; + + length = GetFullPathNameW(decoded_wstr, MAX_PATH, pname_buf, NULL); + if (length > MAX_PATH) { + pname_buf = PyMem_New(wchar_t, length); + if (pname_buf) + length = GetFullPathNameW(decoded_wstr, length, pname_buf, NULL); + else + length = 0; + } + PyMem_Free(decoded_wstr); + char m = '\0'; - if (_PyUnicode_EqualToASCIIString(decoded_upper, "CONIN$")) { - m = 'r'; - } else if (_PyUnicode_EqualToASCIIString(decoded_upper, "CONOUT$")) { - m = 'w'; - } else if (_PyUnicode_EqualToASCIIString(decoded_upper, "CON")) { - m = 'x'; + if (length) { + wchar_t *name = pname_buf; + if (length >= 4 && name[3] == L'\\' && + (name[2] == L'.' || name[2] == L'?') && + name[1] == L'\\' && name[0] == L'\\') { + name += 4; + } + if (!_wcsicmp(name, L"CONIN$")) { + m = 'r'; + } else if (!_wcsicmp(name, L"CONOUT$")) { + m = 'w'; + } else if (!_wcsicmp(name, L"CON")) { + m = 'x'; + } } - Py_CLEAR(decoded_upper); + if (pname_buf != name_buf) + PyMem_Free(pname_buf); return m; } + /*[clinic input] module _io class _io._WindowsConsoleIO "winconsoleio *" "&PyWindowsConsoleIO_Type" -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 18:20:06 2017 From: python-checkins at python.org (steve.dower) Date: Sat, 04 Feb 2017 23:20:06 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2329326=3A_Ignores_blank_lines_in_=2E=5Fpth_files?= =?utf-8?q?_=28Patch_by_Alexey_Izbyshev=29?= Message-ID: <20170204232006.128501.81509.0259CE66@psf.io> https://hg.python.org/cpython/rev/a0ff777ab153 changeset: 106431:a0ff777ab153 parent: 106429:a5538734cc87 parent: 106430:54fea351e3f9 user: Steve Dower date: Sat Feb 04 15:19:46 2017 -0800 summary: Issue #29326: Ignores blank lines in ._pth files (Patch by Alexey Izbyshev) files: Lib/test/test_site.py | 40 ++++++++++++++++++++---------- Misc/ACKS | 1 + Misc/NEWS | 2 + PC/getpathp.c | 2 +- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py --- a/Lib/test/test_site.py +++ b/Lib/test/test_site.py @@ -511,16 +511,30 @@ os.unlink(_pth_file) os.unlink(exe_file) + @classmethod + def _calc_sys_path_for_underpth_nosite(self, sys_prefix, lines): + sys_path = [] + for line in lines: + if not line or line[0] == '#': + continue + abs_path = os.path.abspath(os.path.join(sys_prefix, line)) + sys_path.append(abs_path) + return sys_path + @unittest.skipUnless(sys.platform == 'win32', "only supported on Windows") def test_underpth_nosite_file(self): libpath = os.path.dirname(os.path.dirname(encodings.__file__)) exe_prefix = os.path.dirname(sys.executable) - exe_file = self._create_underpth_exe([ + pth_lines = [ 'fake-path-name', *[libpath for _ in range(200)], + '', '# comment', - 'import site' - ]) + ] + exe_file = self._create_underpth_exe(pth_lines) + sys_path = self._calc_sys_path_for_underpth_nosite( + os.path.dirname(exe_file), + pth_lines) try: env = os.environ.copy() @@ -529,14 +543,11 @@ rc = subprocess.call([exe_file, '-c', 'import sys; sys.exit(sys.flags.no_site and ' 'len(sys.path) > 200 and ' - '%r in sys.path and %r in sys.path and %r not in sys.path)' % ( - os.path.join(sys.prefix, 'fake-path-name'), - libpath, - os.path.join(sys.prefix, 'from-env'), - )], env=env) + 'sys.path == %r)' % sys_path, + ], env=env) finally: self._cleanup_underpth_exe(exe_file) - self.assertEqual(rc, 0) + self.assertTrue(rc, "sys.path is incorrect") @unittest.skipUnless(sys.platform == 'win32', "only supported on Windows") def test_underpth_file(self): @@ -545,23 +556,26 @@ exe_file = self._create_underpth_exe([ 'fake-path-name', *[libpath for _ in range(200)], + '', '# comment', 'import site' ]) + sys_prefix = os.path.dirname(exe_file) try: env = os.environ.copy() env['PYTHONPATH'] = 'from-env' env['PATH'] = '{};{}'.format(exe_prefix, os.getenv('PATH')) rc = subprocess.call([exe_file, '-c', 'import sys; sys.exit(not sys.flags.no_site and ' - '%r in sys.path and %r in sys.path and %r not in sys.path)' % ( - os.path.join(sys.prefix, 'fake-path-name'), + '%r in sys.path and %r in sys.path and %r not in sys.path and ' + 'all("\\r" not in p and "\\n" not in p for p in sys.path))' % ( + os.path.join(sys_prefix, 'fake-path-name'), libpath, - os.path.join(sys.prefix, 'from-env'), + os.path.join(sys_prefix, 'from-env'), )], env=env) finally: self._cleanup_underpth_exe(exe_file) - self.assertEqual(rc, 0) + self.assertTrue(rc, "sys.path is incorrect") if __name__ == "__main__": diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -684,6 +684,7 @@ Bob Ippolito Roger Irwin Atsuo Ishimoto +Alexey Izbyshev Kasia Jachim Adam Jackson Ben Jackson diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -871,6 +871,8 @@ Windows ------- +- Issue #29326: Ignores blank lines in ._pth files (Patch by Alexey Izbyshev) + - Issue #28164: Correctly handle special console filenames (patch by Eryk Sun) - Issue #29409: Implement PEP 529 for io.FileIO (Patch by Eryk Sun) diff --git a/PC/getpathp.c b/PC/getpathp.c --- a/PC/getpathp.c +++ b/PC/getpathp.c @@ -560,7 +560,7 @@ char *p = fgets(line, MAXPATHLEN + 1, sp_file); if (!p) break; - if (*p == '\0' || *p == '#') + if (*p == '\0' || *p == '\r' || *p == '\n' || *p == '#') continue; while (*++p) { if (*p == '\r' || *p == '\n') { -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 18:20:06 2017 From: python-checkins at python.org (steve.dower) Date: Sat, 04 Feb 2017 23:20:06 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI5MzI2?= =?utf-8?q?=3A_Ignores_blank_lines_in_=2E=5Fpth_files_=28Patch_by_Alexey_I?= =?utf-8?q?zbyshev=29?= Message-ID: <20170204232006.7901.70462.3C5A8F7D@psf.io> https://hg.python.org/cpython/rev/54fea351e3f9 changeset: 106430:54fea351e3f9 branch: 3.6 parent: 106428:ed0c05c739c9 user: Steve Dower date: Sat Feb 04 15:19:29 2017 -0800 summary: Issue #29326: Ignores blank lines in ._pth files (Patch by Alexey Izbyshev) files: Lib/test/test_site.py | 40 ++++++++++++++++++++---------- Misc/ACKS | 1 + Misc/NEWS | 2 + PC/getpathp.c | 2 +- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py --- a/Lib/test/test_site.py +++ b/Lib/test/test_site.py @@ -511,16 +511,30 @@ os.unlink(_pth_file) os.unlink(exe_file) + @classmethod + def _calc_sys_path_for_underpth_nosite(self, sys_prefix, lines): + sys_path = [] + for line in lines: + if not line or line[0] == '#': + continue + abs_path = os.path.abspath(os.path.join(sys_prefix, line)) + sys_path.append(abs_path) + return sys_path + @unittest.skipUnless(sys.platform == 'win32', "only supported on Windows") def test_underpth_nosite_file(self): libpath = os.path.dirname(os.path.dirname(encodings.__file__)) exe_prefix = os.path.dirname(sys.executable) - exe_file = self._create_underpth_exe([ + pth_lines = [ 'fake-path-name', *[libpath for _ in range(200)], + '', '# comment', - 'import site' - ]) + ] + exe_file = self._create_underpth_exe(pth_lines) + sys_path = self._calc_sys_path_for_underpth_nosite( + os.path.dirname(exe_file), + pth_lines) try: env = os.environ.copy() @@ -529,14 +543,11 @@ rc = subprocess.call([exe_file, '-c', 'import sys; sys.exit(sys.flags.no_site and ' 'len(sys.path) > 200 and ' - '%r in sys.path and %r in sys.path and %r not in sys.path)' % ( - os.path.join(sys.prefix, 'fake-path-name'), - libpath, - os.path.join(sys.prefix, 'from-env'), - )], env=env) + 'sys.path == %r)' % sys_path, + ], env=env) finally: self._cleanup_underpth_exe(exe_file) - self.assertEqual(rc, 0) + self.assertTrue(rc, "sys.path is incorrect") @unittest.skipUnless(sys.platform == 'win32', "only supported on Windows") def test_underpth_file(self): @@ -545,23 +556,26 @@ exe_file = self._create_underpth_exe([ 'fake-path-name', *[libpath for _ in range(200)], + '', '# comment', 'import site' ]) + sys_prefix = os.path.dirname(exe_file) try: env = os.environ.copy() env['PYTHONPATH'] = 'from-env' env['PATH'] = '{};{}'.format(exe_prefix, os.getenv('PATH')) rc = subprocess.call([exe_file, '-c', 'import sys; sys.exit(not sys.flags.no_site and ' - '%r in sys.path and %r in sys.path and %r not in sys.path)' % ( - os.path.join(sys.prefix, 'fake-path-name'), + '%r in sys.path and %r in sys.path and %r not in sys.path and ' + 'all("\\r" not in p and "\\n" not in p for p in sys.path))' % ( + os.path.join(sys_prefix, 'fake-path-name'), libpath, - os.path.join(sys.prefix, 'from-env'), + os.path.join(sys_prefix, 'from-env'), )], env=env) finally: self._cleanup_underpth_exe(exe_file) - self.assertEqual(rc, 0) + self.assertTrue(rc, "sys.path is incorrect") if __name__ == "__main__": diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -683,6 +683,7 @@ Bob Ippolito Roger Irwin Atsuo Ishimoto +Alexey Izbyshev Kasia Jachim Adam Jackson Ben Jackson diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -146,6 +146,8 @@ Windows ------- +- Issue #29326: Ignores blank lines in ._pth files (Patch by Alexey Izbyshev) + - Issue #28164: Correctly handle special console filenames (patch by Eryk Sun) - Issue #29409: Implement PEP 529 for io.FileIO (Patch by Eryk Sun) diff --git a/PC/getpathp.c b/PC/getpathp.c --- a/PC/getpathp.c +++ b/PC/getpathp.c @@ -560,7 +560,7 @@ char *p = fgets(line, MAXPATHLEN + 1, sp_file); if (!p) break; - if (*p == '\0' || *p == '#') + if (*p == '\0' || *p == '\r' || *p == '\n' || *p == '#') continue; while (*++p) { if (*p == '\r' || *p == '\n') { -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 18:41:32 2017 From: python-checkins at python.org (steve.dower) Date: Sat, 04 Feb 2017 23:41:32 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MzE5?= =?utf-8?q?=3A_Prevent_RunMainFromImporter_overwriting_sys=2Epath=5B0=5D?= =?utf-8?q?=2E?= Message-ID: <20170204234132.110587.32787.DE1D296E@psf.io> https://hg.python.org/cpython/rev/c6506f759db1 changeset: 106432:c6506f759db1 branch: 3.5 parent: 106424:f48bdcd02b57 user: Steve Dower date: Sat Feb 04 15:39:21 2017 -0800 summary: Issue #29319: Prevent RunMainFromImporter overwriting sys.path[0]. files: Misc/NEWS | 2 ++ Modules/main.c | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #29319: Prevent RunMainFromImporter overwriting sys.path[0]. + - Issue #29337: Fixed possible BytesWarning when compare the code objects. Warnings could be emitted at compile time. diff --git a/Modules/main.c b/Modules/main.c --- a/Modules/main.c +++ b/Modules/main.c @@ -223,7 +223,7 @@ static int RunMainFromImporter(wchar_t *filename) { - PyObject *argv0 = NULL, *importer, *sys_path; + PyObject *argv0 = NULL, *importer, *sys_path, *sys_path0; int sts; argv0 = PyUnicode_FromWideChar(filename, wcslen(filename)); @@ -248,7 +248,17 @@ PyErr_SetString(PyExc_RuntimeError, "unable to get sys.path"); goto error; } - if (PyList_SetItem(sys_path, 0, argv0)) { + sys_path0 = PyList_GetItem(sys_path, 0); + sts = 0; + if (!sys_path0) { + PyErr_Clear(); + sts = PyList_Append(sys_path, argv0); + } else if (PyObject_IsTrue(sys_path0)) { + sts = PyList_Insert(sys_path, 0, argv0); + } else { + sts = PyList_SetItem(sys_path, 0, argv0); + } + if (sts) { argv0 = NULL; goto error; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 18:41:33 2017 From: python-checkins at python.org (steve.dower) Date: Sat, 04 Feb 2017 23:41:33 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329319=3A_Prevent_RunMainFromImporter_overwriting_sys?= =?utf-8?b?LnBhdGhbMF0u?= Message-ID: <20170204234133.16288.21125.A421408C@psf.io> https://hg.python.org/cpython/rev/0965e2967056 changeset: 106433:0965e2967056 branch: 3.6 parent: 106430:54fea351e3f9 parent: 106432:c6506f759db1 user: Steve Dower date: Sat Feb 04 15:39:38 2017 -0800 summary: Issue #29319: Prevent RunMainFromImporter overwriting sys.path[0]. files: Misc/NEWS | 2 ++ Modules/main.c | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #29319: Prevent RunMainFromImporter overwriting sys.path[0]. + - Issue #29337: Fixed possible BytesWarning when compare the code objects. Warnings could be emitted at compile time. diff --git a/Modules/main.c b/Modules/main.c --- a/Modules/main.c +++ b/Modules/main.c @@ -228,7 +228,7 @@ static int RunMainFromImporter(wchar_t *filename) { - PyObject *argv0 = NULL, *importer, *sys_path; + PyObject *argv0 = NULL, *importer, *sys_path, *sys_path0; int sts; argv0 = PyUnicode_FromWideChar(filename, wcslen(filename)); @@ -253,7 +253,17 @@ PyErr_SetString(PyExc_RuntimeError, "unable to get sys.path"); goto error; } - if (PyList_SetItem(sys_path, 0, argv0)) { + sys_path0 = PyList_GetItem(sys_path, 0); + sts = 0; + if (!sys_path0) { + PyErr_Clear(); + sts = PyList_Append(sys_path, argv0); + } else if (PyObject_IsTrue(sys_path0)) { + sts = PyList_Insert(sys_path, 0, argv0); + } else { + sts = PyList_SetItem(sys_path, 0, argv0); + } + if (sts) { argv0 = NULL; goto error; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 18:41:34 2017 From: python-checkins at python.org (steve.dower) Date: Sat, 04 Feb 2017 23:41:34 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2329319=3A_Prevent_RunMainFromImporter_overwritin?= =?utf-8?b?ZyBzeXMucGF0aFswXS4=?= Message-ID: <20170204234134.25554.15346.E7698E4A@psf.io> https://hg.python.org/cpython/rev/d0f28ee3affe changeset: 106434:d0f28ee3affe parent: 106431:a0ff777ab153 parent: 106433:0965e2967056 user: Steve Dower date: Sat Feb 04 15:41:12 2017 -0800 summary: Issue #29319: Prevent RunMainFromImporter overwriting sys.path[0]. files: Misc/NEWS | 2 ++ Modules/main.c | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ Core and Builtins ----------------- +- Issue #29319: Prevent RunMainFromImporter overwriting sys.path[0]. + - Issue #29337: Fixed possible BytesWarning when compare the code objects. Warnings could be emitted at compile time. diff --git a/Modules/main.c b/Modules/main.c --- a/Modules/main.c +++ b/Modules/main.c @@ -228,7 +228,7 @@ static int RunMainFromImporter(wchar_t *filename) { - PyObject *argv0 = NULL, *importer, *sys_path; + PyObject *argv0 = NULL, *importer, *sys_path, *sys_path0; int sts; argv0 = PyUnicode_FromWideChar(filename, wcslen(filename)); @@ -253,7 +253,17 @@ PyErr_SetString(PyExc_RuntimeError, "unable to get sys.path"); goto error; } - if (PyList_SetItem(sys_path, 0, argv0)) { + sys_path0 = PyList_GetItem(sys_path, 0); + sts = 0; + if (!sys_path0) { + PyErr_Clear(); + sts = PyList_Append(sys_path, argv0); + } else if (PyObject_IsTrue(sys_path0)) { + sts = PyList_Insert(sys_path, 0, argv0); + } else { + sts = PyList_SetItem(sys_path, 0, argv0); + } + if (sts) { argv0 = NULL; goto error; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 19:47:02 2017 From: python-checkins at python.org (steve.dower) Date: Sun, 05 Feb 2017 00:47:02 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Updates_test?= =?utf-8?q?=5Fwinconsoleio_to_better_show_the_source_of_its_issues=2E?= Message-ID: <20170205004702.110885.65726.1E47B0CE@psf.io> https://hg.python.org/cpython/rev/d5292aad642b changeset: 106435:d5292aad642b branch: 3.6 parent: 106433:0965e2967056 user: Steve Dower date: Sat Feb 04 16:46:34 2017 -0800 summary: Updates test_winconsoleio to better show the source of its issues. files: Lib/test/test_winconsoleio.py | 42 ++++++++++++++-------- 1 files changed, 27 insertions(+), 15 deletions(-) diff --git a/Lib/test/test_winconsoleio.py b/Lib/test/test_winconsoleio.py --- a/Lib/test/test_winconsoleio.py +++ b/Lib/test/test_winconsoleio.py @@ -1,11 +1,11 @@ '''Tests for WindowsConsoleIO ''' +import io import os -import io import sys +import tempfile import unittest -import tempfile if sys.platform != 'win32': raise unittest.SkipTest("test only relevant on win32") @@ -26,8 +26,10 @@ fd, _ = tempfile.mkstemp() try: + # Windows 10: "Cannot open non-console file" + # Earlier: "Cannot open console output buffer for reading" self.assertRaisesRegex(ValueError, - "Cannot open non-console file", ConIO, fd) + "Cannot open (console|non-console file)", ConIO, fd) finally: os.close(fd) @@ -70,18 +72,6 @@ def test_open_name(self): self.assertRaises(ValueError, ConIO, sys.executable) - f = open('C:/con', 'rb', buffering=0) - self.assertIsInstance(f, ConIO) - f.close() - - f = open(r'\\.\conin$', 'rb', buffering=0) - self.assertIsInstance(f, ConIO) - f.close() - - f = open('//?/conout$', 'wb', buffering=0) - self.assertIsInstance(f, ConIO) - f.close() - f = ConIO("CON") self.assertTrue(f.readable()) self.assertFalse(f.writable()) @@ -103,6 +93,28 @@ f.close() f.close() + f = open('C:/con', 'rb', buffering=0) + self.assertIsInstance(f, ConIO) + f.close() + + try: + f = open(r'\\.\conin$', 'rb', buffering=0) + except FileNotFoundError: + # If we cannot find the file, this part should be skipped + print('\\\\.\\conin$ was not found on this OS') + else: + self.assertIsInstance(f, ConIO) + f.close() + + try: + f = open('//?/conout$', 'wb', buffering=0) + except FileNotFoundError: + # If we cannot find the file, this part should be skipped + print('//?/conout$ was not found on this OS') + else: + self.assertIsInstance(f, ConIO) + f.close() + def assertStdinRoundTrip(self, text): stdin = open('CONIN$', 'r') old_stdin = sys.stdin -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 19:47:02 2017 From: python-checkins at python.org (steve.dower) Date: Sun, 05 Feb 2017 00:47:02 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E6?= Message-ID: <20170205004702.25554.12511.50DA73DD@psf.io> https://hg.python.org/cpython/rev/ba0fd8d9084e changeset: 106436:ba0fd8d9084e parent: 106434:d0f28ee3affe parent: 106435:d5292aad642b user: Steve Dower date: Sat Feb 04 16:46:53 2017 -0800 summary: Merge from 3.6 files: Lib/test/test_winconsoleio.py | 42 ++++++++++++++-------- 1 files changed, 27 insertions(+), 15 deletions(-) diff --git a/Lib/test/test_winconsoleio.py b/Lib/test/test_winconsoleio.py --- a/Lib/test/test_winconsoleio.py +++ b/Lib/test/test_winconsoleio.py @@ -1,11 +1,11 @@ '''Tests for WindowsConsoleIO ''' +import io import os -import io import sys +import tempfile import unittest -import tempfile if sys.platform != 'win32': raise unittest.SkipTest("test only relevant on win32") @@ -26,8 +26,10 @@ fd, _ = tempfile.mkstemp() try: + # Windows 10: "Cannot open non-console file" + # Earlier: "Cannot open console output buffer for reading" self.assertRaisesRegex(ValueError, - "Cannot open non-console file", ConIO, fd) + "Cannot open (console|non-console file)", ConIO, fd) finally: os.close(fd) @@ -70,18 +72,6 @@ def test_open_name(self): self.assertRaises(ValueError, ConIO, sys.executable) - f = open('C:/con', 'rb', buffering=0) - self.assertIsInstance(f, ConIO) - f.close() - - f = open(r'\\.\conin$', 'rb', buffering=0) - self.assertIsInstance(f, ConIO) - f.close() - - f = open('//?/conout$', 'wb', buffering=0) - self.assertIsInstance(f, ConIO) - f.close() - f = ConIO("CON") self.assertTrue(f.readable()) self.assertFalse(f.writable()) @@ -103,6 +93,28 @@ f.close() f.close() + f = open('C:/con', 'rb', buffering=0) + self.assertIsInstance(f, ConIO) + f.close() + + try: + f = open(r'\\.\conin$', 'rb', buffering=0) + except FileNotFoundError: + # If we cannot find the file, this part should be skipped + print('\\\\.\\conin$ was not found on this OS') + else: + self.assertIsInstance(f, ConIO) + f.close() + + try: + f = open('//?/conout$', 'wb', buffering=0) + except FileNotFoundError: + # If we cannot find the file, this part should be skipped + print('//?/conout$ was not found on this OS') + else: + self.assertIsInstance(f, ConIO) + f.close() + def assertStdinRoundTrip(self, text): stdin = open('CONIN$', 'r') old_stdin = sys.stdin -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 20:27:56 2017 From: python-checkins at python.org (berker.peksag) Date: Sun, 05 Feb 2017 01:27:56 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4NDg5?= =?utf-8?q?=3A_Fix_comment_in_tokenizer=2Ec?= Message-ID: <20170205012756.7901.53366.018687A3@psf.io> https://hg.python.org/cpython/rev/8b20ed083a94 changeset: 106437:8b20ed083a94 branch: 3.6 parent: 106435:d5292aad642b user: Berker Peksag date: Sun Feb 05 04:32:39 2017 +0300 summary: Issue #28489: Fix comment in tokenizer.c Patch by Ryan Gonzalez. files: Parser/tokenizer.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -1508,7 +1508,7 @@ /* Identifier (most frequent token!) */ nonascii = 0; if (is_potential_identifier_start(c)) { - /* Process b"", r"", u"", br"" and rb"" */ + /* Process the various legal combinations of b"", r"", u"", and f"". */ int saw_b = 0, saw_r = 0, saw_u = 0, saw_f = 0; while (1) { if (!(saw_b || saw_u || saw_f) && (c == 'b' || c == 'B')) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 20:27:57 2017 From: python-checkins at python.org (berker.peksag) Date: Sun, 05 Feb 2017 01:27:57 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328489=3A_Merge_from_3=2E6?= Message-ID: <20170205012756.8344.63719.4CDB6A01@psf.io> https://hg.python.org/cpython/rev/72ec2c599301 changeset: 106438:72ec2c599301 parent: 106436:ba0fd8d9084e parent: 106437:8b20ed083a94 user: Berker Peksag date: Sun Feb 05 04:33:11 2017 +0300 summary: Issue #28489: Merge from 3.6 files: Parser/tokenizer.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -1508,7 +1508,7 @@ /* Identifier (most frequent token!) */ nonascii = 0; if (is_potential_identifier_start(c)) { - /* Process b"", r"", u"", br"" and rb"" */ + /* Process the various legal combinations of b"", r"", u"", and f"". */ int saw_b = 0, saw_r = 0, saw_u = 0, saw_f = 0; while (1) { if (!(saw_b || saw_u || saw_f) && (c == 'b' || c == 'B')) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 20:37:10 2017 From: python-checkins at python.org (steve.dower) Date: Sun, 05 Feb 2017 01:37:10 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E6?= Message-ID: <20170205013710.96931.94026.25528C56@psf.io> https://hg.python.org/cpython/rev/09ffaffca750 changeset: 106440:09ffaffca750 parent: 106438:72ec2c599301 parent: 106439:ea4728ef5956 user: Steve Dower date: Sat Feb 04 17:37:00 2017 -0800 summary: Merge from 3.6 files: Modules/_io/winconsoleio.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c --- a/Modules/_io/winconsoleio.c +++ b/Modules/_io/winconsoleio.c @@ -86,6 +86,19 @@ return '\0'; } + char m = '\0'; + if (!_wcsicmp(decoded_wstr, L"CONIN$")) { + m = 'r'; + } else if (!_wcsicmp(decoded_wstr, L"CONOUT$")) { + m = 'w'; + } else if (!_wcsicmp(decoded_wstr, L"CON")) { + m = 'x'; + } + if (m) { + PyMem_Free(decoded_wstr); + return m; + } + DWORD length; wchar_t name_buf[MAX_PATH], *pname_buf = name_buf; @@ -99,7 +112,6 @@ } PyMem_Free(decoded_wstr); - char m = '\0'; if (length) { wchar_t *name = pname_buf; if (length >= 4 && name[3] == L'\\' && -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sat Feb 4 20:37:10 2017 From: python-checkins at python.org (steve.dower) Date: Sun, 05 Feb 2017 01:37:10 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Adds_precheck_?= =?utf-8?q?for_console_filename_to_fix_Windows_7=2E?= Message-ID: <20170205013710.16804.81919.62B6682D@psf.io> https://hg.python.org/cpython/rev/ea4728ef5956 changeset: 106439:ea4728ef5956 branch: 3.6 parent: 106437:8b20ed083a94 user: Steve Dower date: Sat Feb 04 17:36:47 2017 -0800 summary: Adds precheck for console filename to fix Windows 7. files: Modules/_io/winconsoleio.c | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c --- a/Modules/_io/winconsoleio.c +++ b/Modules/_io/winconsoleio.c @@ -86,6 +86,19 @@ return '\0'; } + char m = '\0'; + if (!_wcsicmp(decoded_wstr, L"CONIN$")) { + m = 'r'; + } else if (!_wcsicmp(decoded_wstr, L"CONOUT$")) { + m = 'w'; + } else if (!_wcsicmp(decoded_wstr, L"CON")) { + m = 'x'; + } + if (m) { + PyMem_Free(decoded_wstr); + return m; + } + DWORD length; wchar_t name_buf[MAX_PATH], *pname_buf = name_buf; @@ -99,7 +112,6 @@ } PyMem_Free(decoded_wstr); - char m = '\0'; if (length) { wchar_t *name = pname_buf; if (length >= 4 && name[3] == L'\\' && -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Sun Feb 5 04:30:57 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 05 Feb 2017 09:30:57 +0000 Subject: [Python-checkins] Daily reference leaks (09ffaffca750): sum=70 Message-ID: <20170205093057.7642.90683.66BA4EFB@psf.io> results for 09ffaffca750 on branch "default" -------------------------------------------- test_collections leaked [0, 7, -7] memory blocks, sum=0 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_fork leaked [-2, 2, -1] memory blocks, sum=-1 test_multiprocessing_forkserver leaked [44, 0, 0] references, sum=44 test_multiprocessing_forkserver leaked [20, 1, 0] memory blocks, sum=21 test_multiprocessing_forkserver leaked [2, 0, 0] file descriptors, sum=2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogx8b3mg', '--timeout', '7200'] From python-checkins at python.org Sun Feb 5 15:59:03 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Sun, 05 Feb 2017 20:59:03 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2320186=3A_Regenera?= =?utf-8?q?ted_Argument_Clinic=2E?= Message-ID: <20170205205903.26437.74002.1AE585CC@psf.io> https://hg.python.org/cpython/rev/8ccb3ad39ee4 changeset: 106441:8ccb3ad39ee4 user: Serhiy Storchaka date: Sun Feb 05 22:58:46 2017 +0200 summary: Issue #20186: Regenerated Argument Clinic. files: Modules/_tracemalloc.c | 2 +- Modules/clinic/_tracemalloc.c.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c --- a/Modules/_tracemalloc.c +++ b/Modules/_tracemalloc.c @@ -1177,7 +1177,7 @@ static PyObject * _tracemalloc_is_tracing_impl(PyObject *module) -/*[clinic end generated code: output=2d763b42601cd3ef input=8beb4fb5446813be]*/ +/*[clinic end generated code: output=2d763b42601cd3ef input=af104b0a00192f63]*/ { return PyBool_FromLong(tracemalloc_config.tracing); } diff --git a/Modules/clinic/_tracemalloc.c.h b/Modules/clinic/_tracemalloc.c.h --- a/Modules/clinic/_tracemalloc.c.h +++ b/Modules/clinic/_tracemalloc.c.h @@ -6,7 +6,7 @@ "is_tracing($module, /)\n" "--\n" "\n" -"True if the tracemalloc module is tracing Python memory allocations, False otherwise."); +"Return True if the tracemalloc module is tracing Python memory allocations."); #define _TRACEMALLOC_IS_TRACING_METHODDEF \ {"is_tracing", (PyCFunction)_tracemalloc_is_tracing, METH_NOARGS, _tracemalloc_is_tracing__doc__}, @@ -189,4 +189,4 @@ { return _tracemalloc_get_traced_memory_impl(module); } -/*[clinic end generated code: output=1e059f24619e23f9 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=159ce5d627964f09 input=a9049054013a1b77]*/ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Sun Feb 5 21:51:01 2017 From: python-checkins at python.org (xiang.zhang) Date: Mon, 06 Feb 2017 02:51:01 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2329405=3A_Make_tot?= =?utf-8?q?al_calculation_in_=5Fguess=5Fdelimiter_more_accurate=2E?= Message-ID: <20170206025101.8040.40717.03549C99@psf.io> https://hg.python.org/cpython/rev/724d1aa7589b changeset: 106442:724d1aa7589b user: Xiang Zhang date: Mon Feb 06 10:50:09 2017 +0800 summary: Issue #29405: Make total calculation in _guess_delimiter more accurate. files: Lib/csv.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/csv.py b/Lib/csv.py --- a/Lib/csv.py +++ b/Lib/csv.py @@ -307,7 +307,7 @@ charFrequency = {} modes = {} delims = {} - start, end = 0, min(chunkLength, len(data)) + start, end = 0, chunkLength while start < len(data): iteration += 1 for line in data[start:end]: @@ -336,7 +336,7 @@ # build a list of possible delimiters modeList = modes.items() - total = float(chunkLength * iteration) + total = float(min(chunkLength * iteration, len(data))) # (rows of consistent data) / (number of rows) = 100% consistency = 1.0 # minimum consistency threshold -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Feb 6 03:42:09 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Mon, 06 Feb 2017 08:42:09 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2329460=3A_=5FPyArg?= =?utf-8?q?=5FNoKeywords=28=29=2C_=5FPyArg=5FNoStackKeywords=28=29_and?= Message-ID: <20170206084209.96018.53361.0C2C5935@psf.io> https://hg.python.org/cpython/rev/82d1c8d15e18 changeset: 106443:82d1c8d15e18 user: Serhiy Storchaka date: Mon Feb 06 10:41:46 2017 +0200 summary: Issue #29460: _PyArg_NoKeywords(), _PyArg_NoStackKeywords() and _PyArg_NoPositional() now are macros. files: Include/modsupport.h | 7 +++++++ Modules/_operator.c | 6 +++--- Objects/setobject.c | 5 ++--- Python/getargs.c | 4 ++++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Include/modsupport.h b/Include/modsupport.h --- a/Include/modsupport.h +++ b/Include/modsupport.h @@ -62,6 +62,13 @@ PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kwargs); PyAPI_FUNC(int) _PyArg_NoStackKeywords(const char *funcname, PyObject *kwnames); PyAPI_FUNC(int) _PyArg_NoPositional(const char *funcname, PyObject *args); +#define _PyArg_NoKeywords(funcname, kwargs) \ + ((kwargs) == NULL || _PyArg_NoKeywords((funcname), (kwargs))) +#define _PyArg_NoStackKeywords(funcname, kwnames) \ + ((kwnames) == NULL || _PyArg_NoStackKeywords((funcname), (kwnames))) +#define _PyArg_NoPositional(funcname, args) \ + ((args) == NULL || _PyArg_NoPositional((funcname), (args))) + #endif PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list); diff --git a/Modules/_operator.c b/Modules/_operator.c --- a/Modules/_operator.c +++ b/Modules/_operator.c @@ -993,7 +993,7 @@ PyObject *obj, *result; Py_ssize_t i, nitems=ig->nitems; - if (kw != NULL && !_PyArg_NoKeywords("itemgetter", kw)) + if (!_PyArg_NoKeywords("itemgetter", kw)) return NULL; if (!PyArg_UnpackTuple(args, "itemgetter", 1, 1, &obj)) return NULL; @@ -1283,7 +1283,7 @@ PyObject *obj, *result; Py_ssize_t i, nattrs=ag->nattrs; - if (kw != NULL && !_PyArg_NoKeywords("attrgetter", kw)) + if (!_PyArg_NoKeywords("attrgetter", kw)) return NULL; if (!PyArg_UnpackTuple(args, "attrgetter", 1, 1, &obj)) return NULL; @@ -1527,7 +1527,7 @@ { PyObject *method, *obj, *result; - if (kw != NULL && !_PyArg_NoKeywords("methodcaller", kw)) + if (!_PyArg_NoKeywords("methodcaller", kw)) return NULL; if (!PyArg_UnpackTuple(args, "methodcaller", 1, 1, &obj)) return NULL; diff --git a/Objects/setobject.c b/Objects/setobject.c --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -1084,8 +1084,7 @@ { PyObject *iterable = NULL, *result; - if (kwds != NULL && type == &PyFrozenSet_Type - && !_PyArg_NoKeywords("frozenset()", kwds)) + if (type == &PyFrozenSet_Type && !_PyArg_NoKeywords("frozenset()", kwds)) return NULL; if (!PyArg_UnpackTuple(args, type->tp_name, 0, 1, &iterable)) @@ -2002,7 +2001,7 @@ { PyObject *iterable = NULL; - if (kwds != NULL && !_PyArg_NoKeywords("set()", kwds)) + if (!_PyArg_NoKeywords("set()", kwds)) return -1; if (!PyArg_UnpackTuple(args, Py_TYPE(self)->tp_name, 0, 1, &iterable)) return -1; diff --git a/Python/getargs.c b/Python/getargs.c --- a/Python/getargs.c +++ b/Python/getargs.c @@ -2446,6 +2446,10 @@ } +#undef _PyArg_NoKeywords +#undef _PyArg_NoStackKeywords +#undef _PyArg_NoPositional + /* For type constructors that don't take keyword args * * Sets a TypeError and returns 0 if the args/kwargs is -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Mon Feb 6 04:30:38 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 06 Feb 2017 09:30:38 +0000 Subject: [Python-checkins] Daily reference leaks (724d1aa7589b): sum=11 Message-ID: <20170206093038.110974.95448.D6D6A986@psf.io> results for 724d1aa7589b on branch "default" -------------------------------------------- test_collections leaked [0, 7, 0] memory blocks, sum=7 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/reflog9LbWzG', '--timeout', '7200'] From python-checkins at python.org Mon Feb 6 05:32:23 2017 From: python-checkins at python.org (berker.peksag) Date: Mon, 06 Feb 2017 10:32:23 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Fix_usage_of_d?= =?utf-8?q?ata_directive?= Message-ID: <20170206103223.96198.53848.A6F2F514@psf.io> https://hg.python.org/cpython/rev/764a9905588f changeset: 106444:764a9905588f branch: 3.6 parent: 106439:ea4728ef5956 user: Berker Peksag date: Mon Feb 06 13:37:19 2017 +0300 summary: Fix usage of data directive files: Doc/library/ssl.rst | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -636,7 +636,7 @@ .. deprecated:: 3.6 - Use data:`PROTOCOL_TLS` instead. + Use :data:`PROTOCOL_TLS` instead. .. data:: PROTOCOL_SSLv2 @@ -667,7 +667,7 @@ .. deprecated:: 3.6 OpenSSL has deprecated all version specific protocols. Use the default - protocol data:`PROTOCOL_TLS` with flags like data:`OP_NO_SSLv3` instead. + protocol :data:`PROTOCOL_TLS` with flags like :data:`OP_NO_SSLv3` instead. .. data:: PROTOCOL_TLSv1 @@ -676,7 +676,7 @@ .. deprecated:: 3.6 OpenSSL has deprecated all version specific protocols. Use the default - protocol data:`PROTOCOL_TLS` with flags like data:`OP_NO_SSLv3` instead. + protocol :data:`PROTOCOL_TLS` with flags like :data:`OP_NO_SSLv3` instead. .. data:: PROTOCOL_TLSv1_1 @@ -688,7 +688,7 @@ .. deprecated:: 3.6 OpenSSL has deprecated all version specific protocols. Use the default - protocol data:`PROTOCOL_TLS` with flags like data:`OP_NO_SSLv3` instead. + protocol :data:`PROTOCOL_TLS` with flags like :data:`OP_NO_SSLv3` instead. .. data:: PROTOCOL_TLSv1_2 @@ -701,7 +701,7 @@ .. deprecated:: 3.6 OpenSSL has deprecated all version specific protocols. Use the default - protocol data:`PROTOCOL_TLS` with flags like data:`OP_NO_SSLv3` instead. + protocol :data:`PROTOCOL_TLS` with flags like :data:`OP_NO_SSLv3` instead. .. data:: OP_ALL -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Feb 6 05:32:24 2017 From: python-checkins at python.org (berker.peksag) Date: Mon, 06 Feb 2017 10:32:24 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Merge_from_3=2E6?= Message-ID: <20170206103223.25554.16930.801028FE@psf.io> https://hg.python.org/cpython/rev/f4cef2a3845e changeset: 106445:f4cef2a3845e parent: 106443:82d1c8d15e18 parent: 106444:764a9905588f user: Berker Peksag date: Mon Feb 06 13:37:45 2017 +0300 summary: Merge from 3.6 files: Doc/library/ssl.rst | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst --- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -636,7 +636,7 @@ .. deprecated:: 3.6 - Use data:`PROTOCOL_TLS` instead. + Use :data:`PROTOCOL_TLS` instead. .. data:: PROTOCOL_SSLv2 @@ -667,7 +667,7 @@ .. deprecated:: 3.6 OpenSSL has deprecated all version specific protocols. Use the default - protocol data:`PROTOCOL_TLS` with flags like data:`OP_NO_SSLv3` instead. + protocol :data:`PROTOCOL_TLS` with flags like :data:`OP_NO_SSLv3` instead. .. data:: PROTOCOL_TLSv1 @@ -676,7 +676,7 @@ .. deprecated:: 3.6 OpenSSL has deprecated all version specific protocols. Use the default - protocol data:`PROTOCOL_TLS` with flags like data:`OP_NO_SSLv3` instead. + protocol :data:`PROTOCOL_TLS` with flags like :data:`OP_NO_SSLv3` instead. .. data:: PROTOCOL_TLSv1_1 @@ -688,7 +688,7 @@ .. deprecated:: 3.6 OpenSSL has deprecated all version specific protocols. Use the default - protocol data:`PROTOCOL_TLS` with flags like data:`OP_NO_SSLv3` instead. + protocol :data:`PROTOCOL_TLS` with flags like :data:`OP_NO_SSLv3` instead. .. data:: PROTOCOL_TLSv1_2 @@ -701,7 +701,7 @@ .. deprecated:: 3.6 OpenSSL has deprecated all version specific protocols. Use the default - protocol data:`PROTOCOL_TLS` with flags like data:`OP_NO_SSLv3` instead. + protocol :data:`PROTOCOL_TLS` with flags like :data:`OP_NO_SSLv3` instead. .. data:: OP_ALL -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Feb 6 06:54:25 2017 From: python-checkins at python.org (victor.stinner) Date: Mon, 06 Feb 2017 11:54:25 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_regrtest=3A_don=27t_fail_i?= =?utf-8?q?mmediately_if_a_child_does_crash?= Message-ID: <20170206115425.128105.86549.63213825@psf.io> https://hg.python.org/cpython/rev/4446613000a3 changeset: 106446:4446613000a3 user: Victor Stinner date: Mon Feb 06 12:42:00 2017 +0100 summary: regrtest: don't fail immediately if a child does crash Issue #29362: Catch a crash of a worker process as a normal failure and continue to run next tests. It allows to get the usual test summary: single line result (OK/FAIL), total duration, etc. files: Lib/test/libregrtest/main.py | 2 +- Lib/test/libregrtest/runtest_mp.py | 7 +++---- Lib/test/test_regrtest.py | 13 ++++++++++++- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py --- a/Lib/test/libregrtest/main.py +++ b/Lib/test/libregrtest/main.py @@ -107,7 +107,7 @@ self.test_times.append((test_time, test)) if ok == PASSED: self.good.append(test) - elif ok == FAILED: + elif ok in (FAILED, CHILD_ERROR): self.bad.append(test) elif ok == ENV_CHANGED: self.environment_changed.append(test) diff --git a/Lib/test/libregrtest/runtest_mp.py b/Lib/test/libregrtest/runtest_mp.py --- a/Lib/test/libregrtest/runtest_mp.py +++ b/Lib/test/libregrtest/runtest_mp.py @@ -129,7 +129,7 @@ result = (CHILD_ERROR, "Exit code %s" % retcode) self.output.put((test, stdout.rstrip(), stderr.rstrip(), result)) - return True + return False if not result: self.output.put((None, None, None, None)) @@ -203,6 +203,8 @@ and test_time >= PROGRESS_MIN_TIME and not regrtest.ns.pgo): text += ' (%.0f sec)' % test_time + elif ok == CHILD_ERROR: + text = '%s (%s)' % (text, test_time) running = get_running(workers) if running and not regrtest.ns.pgo: text += ' -- running: %s' % ', '.join(running) @@ -216,9 +218,6 @@ if result[0] == INTERRUPTED: raise KeyboardInterrupt - if result[0] == CHILD_ERROR: - msg = "Child error on {}: {}".format(test, result[1]) - raise Exception(msg) test_index += 1 except KeyboardInterrupt: regrtest.interrupted = True diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py --- a/Lib/test/test_regrtest.py +++ b/Lib/test/test_regrtest.py @@ -354,7 +354,7 @@ self.assertRegex(output, regex) def parse_executed_tests(self, output): - regex = (r'^[0-9]+:[0-9]+:[0-9]+ \[ *[0-9]+(?:/ *[0-9]+)?\] (%s)' + regex = (r'^[0-9]+:[0-9]+:[0-9]+ \[ *[0-9]+(?:/ *[0-9]+)*\] (%s)' % self.TESTNAME_REGEX) parser = re.finditer(regex, output, re.MULTILINE) return list(match.group(1) for match in parser) @@ -809,6 +809,17 @@ self.assertEqual(output.rstrip().splitlines(), tests) + def test_crashed(self): + # Any code which causes a crash + code = 'import faulthandler; faulthandler._sigsegv()' + crash_test = self.create_test(name="crash", code=code) + ok_test = self.create_test(name="ok") + + tests = [crash_test, ok_test] + output = self.run_tests("-j2", *tests, exitcode=1) + self.check_executed_tests(output, tests, failed=crash_test, + randomize=True) + if __name__ == '__main__': unittest.main() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Feb 6 08:25:43 2017 From: python-checkins at python.org (victor.stinner) Date: Mon, 06 Feb 2017 13:25:43 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Prohibit_implicit_C_functi?= =?utf-8?q?on_declarations?= Message-ID: <20170206132542.128888.76563.9C9CD4B7@psf.io> https://hg.python.org/cpython/rev/ca2f024ce7cb changeset: 106447:ca2f024ce7cb user: Victor Stinner date: Mon Feb 06 14:24:00 2017 +0100 summary: Prohibit implicit C function declarations Issue #27659: use -Werror=implicit-function-declaration when possible (GCC and Clang, but it depends on the compiler version). Patch written by Chi Hsuan Yen. files: Misc/NEWS | 4 +++ configure | 41 ++++++++++++++++++++++++++++++++++++++++ configure.ac | 20 +++++++++++++++++++ 3 files changed, 65 insertions(+), 0 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -698,6 +698,10 @@ Build ----- +- Issue #27659: Prohibit implicit C function declarations: use + -Werror=implicit-function-declaration when possible (GCC and Clang, but it + depends on the compiler version). Patch written by Chi Hsuan Yen. + - Issue #29384: Remove old Be OS helper scripts. - Issue #26851: Set Android compilation and link flags. diff --git a/configure b/configure --- a/configure +++ b/configure @@ -7242,6 +7242,47 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_unreachable_code_warning" >&5 $as_echo "$ac_cv_enable_unreachable_code_warning" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can make implicit function declaration an error in $CC" >&5 +$as_echo_n "checking if we can make implicit function declaration an error in $CC... " >&6; } + ac_save_cc="$CC" + CC="$CC -Werror=implicit-function-declaration" + if ${ac_cv_enable_implicit_function_declaration_error+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + ac_cv_enable_implicit_function_declaration_error=yes + +else + + ac_cv_enable_implicit_function_declaration_error=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + CC="$ac_save_cc" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enable_implicit_function_declaration_error" >&5 +$as_echo "$ac_cv_enable_implicit_function_declaration_error" >&6; } + + if test $ac_cv_enable_implicit_function_declaration_error = yes + then + CFLAGS_NODIST="$CFLAGS_NODIST -Werror=implicit-function-declaration" + fi + # if using gcc on alpha, use -mieee to get (near) full IEEE 754 # support. Without this, treatment of subnormals doesn't follow # the standard. diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -1689,6 +1689,26 @@ fi AC_MSG_RESULT($ac_cv_enable_unreachable_code_warning) + AC_MSG_CHECKING(if we can make implicit function declaration an error in $CC) + ac_save_cc="$CC" + CC="$CC -Werror=implicit-function-declaration" + AC_CACHE_VAL(ac_cv_enable_implicit_function_declaration_error, + AC_COMPILE_IFELSE( + [ + AC_LANG_PROGRAM([[]], [[]]) + ],[ + ac_cv_enable_implicit_function_declaration_error=yes + ],[ + ac_cv_enable_implicit_function_declaration_error=no + ])) + CC="$ac_save_cc" + AC_MSG_RESULT($ac_cv_enable_implicit_function_declaration_error) + + if test $ac_cv_enable_implicit_function_declaration_error = yes + then + CFLAGS_NODIST="$CFLAGS_NODIST -Werror=implicit-function-declaration" + fi + # if using gcc on alpha, use -mieee to get (near) full IEEE 754 # support. Without this, treatment of subnormals doesn't follow # the standard. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Feb 6 10:07:17 2017 From: python-checkins at python.org (victor.stinner) Date: Mon, 06 Feb 2017 15:07:17 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Optimize_deque_index=2C_in?= =?utf-8?q?sert_and_rotate=28=29_methods?= Message-ID: <20170206150716.8335.41038.87B61509@psf.io> https://hg.python.org/cpython/rev/1c048539200c changeset: 106448:1c048539200c user: Victor Stinner date: Mon Feb 06 16:06:49 2017 +0100 summary: Optimize deque index, insert and rotate() methods Issue #29452: Use METH_FASTCALL calling convention for index(), insert() and rotate() methods of collections.deque to avoid the creation a temporary tuple to pass position arguments. Speedup on deque methods: * d.rotate(): 1.10x faster * d.rotate(1): 1.24x faster * d.insert(): 1.18x faster * d.index(): 1.24x faster files: Modules/_collectionsmodule.c | 40 +++++++++++++++++------ 1 files changed, 29 insertions(+), 11 deletions(-) diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -908,12 +908,18 @@ } static PyObject * -deque_rotate(dequeobject *deque, PyObject *args) +deque_rotate(dequeobject *deque, PyObject **args, Py_ssize_t nargs, + PyObject *kwnames) { Py_ssize_t n=1; - if (!PyArg_ParseTuple(args, "|n:rotate", &n)) + if (!_PyArg_NoStackKeywords("rotate", kwnames)) { return NULL; + } + if (!_PyArg_ParseStack(args, nargs, "|n:rotate", &n)) { + return NULL; + } + if (!_deque_rotate(deque, n)) Py_RETURN_NONE; return NULL; @@ -1042,7 +1048,8 @@ } static PyObject * -deque_index(dequeobject *deque, PyObject *args) +deque_index(dequeobject *deque, PyObject **args, Py_ssize_t nargs, + PyObject *kwnames) { Py_ssize_t i, n, start=0, stop=Py_SIZE(deque); PyObject *v, *item; @@ -1051,10 +1058,15 @@ size_t start_state = deque->state; int cmp; - if (!PyArg_ParseTuple(args, "O|O&O&:index", &v, - _PyEval_SliceIndex, &start, - _PyEval_SliceIndex, &stop)) + if (!_PyArg_NoStackKeywords("index", kwnames)) { return NULL; + } + if (!_PyArg_ParseStack(args, nargs, "O|O&O&:index", &v, + _PyEval_SliceIndex, &start, + _PyEval_SliceIndex, &stop)) { + return NULL; + } + if (start < 0) { start += Py_SIZE(deque); if (start < 0) @@ -1117,15 +1129,21 @@ */ static PyObject * -deque_insert(dequeobject *deque, PyObject *args) +deque_insert(dequeobject *deque, PyObject **args, Py_ssize_t nargs, + PyObject *kwnames) { Py_ssize_t index; Py_ssize_t n = Py_SIZE(deque); PyObject *value; PyObject *rv; - if (!PyArg_ParseTuple(args, "nO:insert", &index, &value)) + if (!_PyArg_NoStackKeywords("insert", kwnames)) { return NULL; + } + if (!_PyArg_ParseStack(args, nargs, "nO:insert", &index, &value)) { + return NULL; + } + if (deque->maxlen == Py_SIZE(deque)) { PyErr_SetString(PyExc_IndexError, "deque already at its maximum size"); return NULL; @@ -1595,9 +1613,9 @@ {"extendleft", (PyCFunction)deque_extendleft, METH_O, extendleft_doc}, {"index", (PyCFunction)deque_index, - METH_VARARGS, index_doc}, + METH_FASTCALL, index_doc}, {"insert", (PyCFunction)deque_insert, - METH_VARARGS, insert_doc}, + METH_FASTCALL, insert_doc}, {"pop", (PyCFunction)deque_pop, METH_NOARGS, pop_doc}, {"popleft", (PyCFunction)deque_popleft, @@ -1611,7 +1629,7 @@ {"reverse", (PyCFunction)deque_reverse, METH_NOARGS, reverse_doc}, {"rotate", (PyCFunction)deque_rotate, - METH_VARARGS, rotate_doc}, + METH_FASTCALL, rotate_doc}, {"__sizeof__", (PyCFunction)deque_sizeof, METH_NOARGS, sizeof_doc}, {NULL, NULL} /* sentinel */ -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Feb 6 10:16:04 2017 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 06 Feb 2017 15:16:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_merge?= Message-ID: <20170206151603.128178.42171.0E928B80@psf.io> https://hg.python.org/cpython/rev/e06af4027546 changeset: 106450:e06af4027546 parent: 106448:1c048539200c parent: 106449:844ce25a0617 user: Raymond Hettinger date: Mon Feb 06 07:15:57 2017 -0800 summary: merge 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 @@ -1465,7 +1465,7 @@ elif kind == 'SKIP': pass elif kind == 'MISMATCH': - raise RuntimeError('%r unexpected on line %d' % (value, line_num)) + raise RuntimeError(f'{value!r} unexpected on line {line_num}') else: if kind == 'ID' and value in keywords: kind = value -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Feb 6 10:16:04 2017 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 06 Feb 2017 15:16:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Substitute_a_m?= =?utf-8?q?ore_readable_f-string?= Message-ID: <20170206151603.128888.78717.A5D52024@psf.io> https://hg.python.org/cpython/rev/844ce25a0617 changeset: 106449:844ce25a0617 branch: 3.6 parent: 106444:764a9905588f user: Raymond Hettinger date: Mon Feb 06 07:15:31 2017 -0800 summary: Substitute a more readable f-string 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 @@ -1465,7 +1465,7 @@ elif kind == 'SKIP': pass elif kind == 'MISMATCH': - raise RuntimeError('%r unexpected on line %d' % (value, line_num)) + raise RuntimeError(f'{value!r} unexpected on line {line_num}') else: if kind == 'ID' and value in keywords: kind = value -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Mon Feb 6 15:35:40 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Mon, 6 Feb 2017 12:35:40 -0800 Subject: [Python-checkins] BAD Benchmark Results for Python 2.7 2017-02-06 Message-ID: Results for project Python 2.7, build date 2017-02-06 11:48:14 +0000 commit: 110ec861e5ea previous commit: 14682d00b09a revision date: 2017-02-04 09:10:25 +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% -1.21% 3.62% 9.83% :-) pybench 0.15% 0.01% 7.74% 2.39% :-| regex_v8 0.59% -0.17% -0.36% 10.25% :-) nbody 0.07% 0.01% 12.01% 4.51% :-| json_dump_v2 0.30% -0.18% 0.27% 12.36% :-( normal_startup 1.95% 0.40% -2.23% 2.09% :-| ssbench 0.17% -0.25% -0.13% 3.03% ---------------------------------------------------------------------------------- * 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-2017-02-06/ 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 Feb 6 15:39:43 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Mon, 6 Feb 2017 12:39:43 -0800 Subject: [Python-checkins] BAD Benchmark Results for Python Default 2017-02-06 Message-ID: Results for project Python default, build date 2017-02-06 11:03:46 +0000 commit: 724d1aa7589b previous commit: 135a9a0c09f9 revision date: 2017-02-06 02:50:09 +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% -1.71% 10.76% 13.45% :-) pybench 0.28% 0.12% 4.05% 5.40% :-| regex_v8 3.58% -1.47% 0.46% 5.18% :-| nbody 0.07% 0.50% -1.33% 5.55% :-) json_dump_v2 0.41% -2.00% 9.24% 10.62% :-| normal_startup 0.90% -0.10% 0.77% 6.36% ---------------------------------------------------------------------------------- * 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-2017-02-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 Feb 6 17:13:31 2017 From: python-checkins at python.org (steve.dower) Date: Mon, 06 Feb 2017 22:13:31 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Includes_ensurepip_and_venv_packages_in_nuget_package=2E?= Message-ID: <20170206221331.96359.94569.15D66174@psf.io> https://hg.python.org/cpython/rev/98c17a44f7c1 changeset: 106453:98c17a44f7c1 parent: 106450:e06af4027546 parent: 106452:9c325166ba5f user: Steve Dower date: Mon Feb 06 14:12:57 2017 -0800 summary: Includes ensurepip and venv packages in nuget package. files: Tools/msi/make_zip.py | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 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 @@ -29,12 +29,15 @@ EXCLUDE_FROM_LIBRARY = { '__pycache__', - 'ensurepip', 'idlelib', 'pydoc_data', 'site-packages', 'tkinter', 'turtledemo', +} + +EXCLUDE_FROM_EMBEDDABLE_LIBRARY = { + 'ensurepip', 'venv', } @@ -82,6 +85,12 @@ suffix = p.suffix.lower() return suffix not in {'.pyc', '.pyo', '.exe'} +def include_in_embeddable_lib(p): + if p.is_dir() and p.name.lower() in EXCLUDE_FROM_EMBEDDABLE_LIBRARY: + return False + + return include_in_lib(p) + def include_in_libs(p): if not is_not_debug(p): return False @@ -114,7 +123,7 @@ ('/', 'PCBuild/$arch', 'python*.exe', is_not_debug), ('/', 'PCBuild/$arch', '*.pyd', is_not_debug), ('/', 'PCBuild/$arch', '*.dll', is_not_debug), - ('{}.zip'.format(BASE_NAME), 'Lib', '**/*', include_in_lib), + ('{}.zip'.format(BASE_NAME), 'Lib', '**/*', include_in_embeddable_lib), ] if os.getenv('DOC_FILENAME'): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Feb 6 17:13:30 2017 From: python-checkins at python.org (steve.dower) Date: Mon, 06 Feb 2017 22:13:30 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E5=29=3A_Includes_ensur?= =?utf-8?q?epip_and_venv_packages_in_nuget_package=2E?= Message-ID: <20170206221330.110885.10298.AEC7FBCD@psf.io> https://hg.python.org/cpython/rev/dc4bcc4bc8c6 changeset: 106451:dc4bcc4bc8c6 branch: 3.5 parent: 106432:c6506f759db1 user: Steve Dower date: Mon Feb 06 14:11:34 2017 -0800 summary: Includes ensurepip and venv packages in nuget package. files: Tools/msi/make_zip.py | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 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 @@ -28,12 +28,15 @@ EXCLUDE_FROM_LIBRARY = { '__pycache__', - 'ensurepip', 'idlelib', 'pydoc_data', 'site-packages', 'tkinter', 'turtledemo', +} + +EXCLUDE_FROM_EMBEDDABLE_LIBRARY = { + 'ensurepip', 'venv', } @@ -78,6 +81,12 @@ suffix = p.suffix.lower() return suffix not in {'.pyc', '.pyo', '.exe'} +def include_in_embeddable_lib(p): + if p.is_dir() and p.name.lower() in EXCLUDE_FROM_EMBEDDABLE_LIBRARY: + return False + + return include_in_lib(p) + def include_in_libs(p): if not is_not_debug(p): return False @@ -108,7 +117,7 @@ ('/', '$build', 'python*.exe', is_not_debug), ('/', '$build', '*.pyd', is_not_debug), ('/', '$build', '*.dll', is_not_debug), - ('python{0.major}{0.minor}.zip'.format(sys.version_info), 'Lib', '**/*', include_in_lib), + ('python{0.major}{0.minor}.zip'.format(sys.version_info), 'Lib', '**/*', include_in_embeddable_lib), ] if os.getenv('DOC_FILENAME'): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Feb 6 17:13:31 2017 From: python-checkins at python.org (steve.dower) Date: Mon, 06 Feb 2017 22:13:31 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Includes_ensurepip_and_venv_packages_in_nuget_package=2E?= Message-ID: <20170206221330.8248.88962.BFB5FA49@psf.io> https://hg.python.org/cpython/rev/9c325166ba5f changeset: 106452:9c325166ba5f branch: 3.6 parent: 106449:844ce25a0617 parent: 106451:dc4bcc4bc8c6 user: Steve Dower date: Mon Feb 06 14:12:19 2017 -0800 summary: Includes ensurepip and venv packages in nuget package. files: Tools/msi/make_zip.py | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 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 @@ -29,12 +29,15 @@ EXCLUDE_FROM_LIBRARY = { '__pycache__', - 'ensurepip', 'idlelib', 'pydoc_data', 'site-packages', 'tkinter', 'turtledemo', +} + +EXCLUDE_FROM_EMBEDDABLE_LIBRARY = { + 'ensurepip', 'venv', } @@ -82,6 +85,12 @@ suffix = p.suffix.lower() return suffix not in {'.pyc', '.pyo', '.exe'} +def include_in_embeddable_lib(p): + if p.is_dir() and p.name.lower() in EXCLUDE_FROM_EMBEDDABLE_LIBRARY: + return False + + return include_in_lib(p) + def include_in_libs(p): if not is_not_debug(p): return False @@ -114,7 +123,7 @@ ('/', 'PCBuild/$arch', 'python*.exe', is_not_debug), ('/', 'PCBuild/$arch', '*.pyd', is_not_debug), ('/', 'PCBuild/$arch', '*.dll', is_not_debug), - ('{}.zip'.format(BASE_NAME), 'Lib', '**/*', include_in_lib), + ('{}.zip'.format(BASE_NAME), 'Lib', '**/*', include_in_embeddable_lib), ] if os.getenv('DOC_FILENAME'): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Feb 6 17:53:31 2017 From: python-checkins at python.org (steve.dower) Date: Mon, 06 Feb 2017 22:53:31 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI4MTY0?= =?utf-8?q?=3A_Improves_test_on_Windows_7?= Message-ID: <20170206225331.16205.83781.8DD6E812@psf.io> https://hg.python.org/cpython/rev/4463e311f5bd changeset: 106454:4463e311f5bd branch: 3.6 parent: 106452:9c325166ba5f user: Steve Dower date: Mon Feb 06 14:50:17 2017 -0800 summary: Issue #28164: Improves test on Windows 7 files: Lib/test/test_winconsoleio.py | 38 +++++++++++++--------- 1 files changed, 22 insertions(+), 16 deletions(-) diff --git a/Lib/test/test_winconsoleio.py b/Lib/test/test_winconsoleio.py --- a/Lib/test/test_winconsoleio.py +++ b/Lib/test/test_winconsoleio.py @@ -6,6 +6,7 @@ import sys import tempfile import unittest +from test import support if sys.platform != 'win32': raise unittest.SkipTest("test only relevant on win32") @@ -97,23 +98,28 @@ self.assertIsInstance(f, ConIO) f.close() - try: - f = open(r'\\.\conin$', 'rb', buffering=0) - except FileNotFoundError: - # If we cannot find the file, this part should be skipped - print('\\\\.\\conin$ was not found on this OS') - else: - self.assertIsInstance(f, ConIO) - f.close() + @unittest.skipIf(sys.getwindowsversion()[:2] <= (6, 1), + "test does not work on Windows 7 and earlier") + def test_conin_conout_names(self): + f = open(r'\\.\conin$', 'rb', buffering=0) + self.assertIsInstance(f, ConIO) + f.close() - try: - f = open('//?/conout$', 'wb', buffering=0) - except FileNotFoundError: - # If we cannot find the file, this part should be skipped - print('//?/conout$ was not found on this OS') - else: - self.assertIsInstance(f, ConIO) - f.close() + f = open('//?/conout$', 'wb', buffering=0) + self.assertIsInstance(f, ConIO) + f.close() + + def test_conout_path(self): + temp_path = tempfile.mkdtemp() + self.addCleanup(support.rmtree, temp_path) + + conout_path = os.path.join(temp_path, 'CONOUT$') + + with open(conout_path, 'wb', buffering=0) as f: + if sys.getwindowsversion()[:2] > (6, 1): + self.assertIsInstance(f, ConIO) + else: + self.assertNotIsInstance(f, ConIO) def assertStdinRoundTrip(self, text): stdin = open('CONIN$', 'r') -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Feb 6 17:53:31 2017 From: python-checkins at python.org (steve.dower) Date: Mon, 06 Feb 2017 22:53:31 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2328164=3A_Improves_test_on_Windows_7?= Message-ID: <20170206225331.128501.45634.92F8035C@psf.io> https://hg.python.org/cpython/rev/8132bcc1522d changeset: 106455:8132bcc1522d parent: 106453:98c17a44f7c1 parent: 106454:4463e311f5bd user: Steve Dower date: Mon Feb 06 14:53:21 2017 -0800 summary: Issue #28164: Improves test on Windows 7 files: Lib/test/test_winconsoleio.py | 38 +++++++++++++--------- 1 files changed, 22 insertions(+), 16 deletions(-) diff --git a/Lib/test/test_winconsoleio.py b/Lib/test/test_winconsoleio.py --- a/Lib/test/test_winconsoleio.py +++ b/Lib/test/test_winconsoleio.py @@ -6,6 +6,7 @@ import sys import tempfile import unittest +from test import support if sys.platform != 'win32': raise unittest.SkipTest("test only relevant on win32") @@ -97,23 +98,28 @@ self.assertIsInstance(f, ConIO) f.close() - try: - f = open(r'\\.\conin$', 'rb', buffering=0) - except FileNotFoundError: - # If we cannot find the file, this part should be skipped - print('\\\\.\\conin$ was not found on this OS') - else: - self.assertIsInstance(f, ConIO) - f.close() + @unittest.skipIf(sys.getwindowsversion()[:2] <= (6, 1), + "test does not work on Windows 7 and earlier") + def test_conin_conout_names(self): + f = open(r'\\.\conin$', 'rb', buffering=0) + self.assertIsInstance(f, ConIO) + f.close() - try: - f = open('//?/conout$', 'wb', buffering=0) - except FileNotFoundError: - # If we cannot find the file, this part should be skipped - print('//?/conout$ was not found on this OS') - else: - self.assertIsInstance(f, ConIO) - f.close() + f = open('//?/conout$', 'wb', buffering=0) + self.assertIsInstance(f, ConIO) + f.close() + + def test_conout_path(self): + temp_path = tempfile.mkdtemp() + self.addCleanup(support.rmtree, temp_path) + + conout_path = os.path.join(temp_path, 'CONOUT$') + + with open(conout_path, 'wb', buffering=0) as f: + if sys.getwindowsversion()[:2] > (6, 1): + self.assertIsInstance(f, ConIO) + else: + self.assertNotIsInstance(f, ConIO) def assertStdinRoundTrip(self, text): stdin = open('CONIN$', 'r') -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Feb 6 23:19:02 2017 From: python-checkins at python.org (mariatta.wijaya) Date: Tue, 07 Feb 2017 04:19:02 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5Mzcx?= =?utf-8?q?=3A_Clarify_bitwise_OR_operation_in_doctest_option_flags=2E?= Message-ID: <20170207041901.15845.23825.470861B0@psf.io> https://hg.python.org/cpython/rev/df62e833eeb1 changeset: 106456:df62e833eeb1 branch: 3.5 parent: 106451:dc4bcc4bc8c6 user: Mariatta Wijaya date: Mon Feb 06 20:15:01 2017 -0800 summary: Issue #29371: Clarify bitwise OR operation in doctest option flags. files: Doc/library/doctest.rst | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -510,9 +510,9 @@ A number of option flags control various aspects of doctest's behavior. Symbolic names for the flags are supplied as module constants, which can be -or'ed together and passed to various functions. The names can also be used in -:ref:`doctest directives `, and may be passed to the -doctest command line interface via the ``-o`` option. +:ref:`bitwise ORed ` together and passed to various functions. +The names can also be used in :ref:`doctest directives `, +and may be passed to the doctest command line interface via the ``-o`` option. .. versionadded:: 3.4 The ``-o`` command line option. @@ -877,8 +877,9 @@ nothing at the end. In verbose mode, the summary is detailed, else the summary is very brief (in fact, empty if all tests passed). - Optional argument *optionflags* (default value 0) takes the bitwise-or of - option flags. See section :ref:`doctest-options`. + Optional argument *optionflags* (default value 0) takes the + :ref:`bitwise OR ` of option flags. + See section :ref:`doctest-options`. Optional argument *raise_on_error* defaults to false. If true, an exception is raised upon the first failure or unexpected exception in an example. This @@ -1098,18 +1099,19 @@ Set the :mod:`doctest` reporting flags to use. - Argument *flags* takes the bitwise-or of option flags. See section - :ref:`doctest-options`. Only "reporting flags" can be used. + Argument *flags* takes the :ref:`bitwise OR ` of option flags. See + section :ref:`doctest-options`. Only "reporting flags" can be used. This is a module-global setting, and affects all future doctests run by module :mod:`unittest`: the :meth:`runTest` method of :class:`DocTestCase` looks at the option flags specified for the test case when the :class:`DocTestCase` instance was constructed. If no reporting flags were specified (which is the typical and expected case), :mod:`doctest`'s :mod:`unittest` reporting flags are - or'ed into the option flags, and the option flags so augmented are passed to the - :class:`DocTestRunner` instance created to run the doctest. If any reporting - flags were specified when the :class:`DocTestCase` instance was constructed, - :mod:`doctest`'s :mod:`unittest` reporting flags are ignored. + :ref:`bitwise ORed ` into the option flags, and the option flags + so augmented are passed to the :class:`DocTestRunner` instance created to + run the doctest. If any reporting flags were specified when the + :class:`DocTestCase` instance was constructed, :mod:`doctest`'s + :mod:`unittest` reporting flags are ignored. The value of the :mod:`unittest` reporting flags in effect before the function was called is returned by the function. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Feb 6 23:19:03 2017 From: python-checkins at python.org (mariatta.wijaya) Date: Tue, 07 Feb 2017 04:19:03 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329371=3A_merge_with_3=2E5?= Message-ID: <20170207041902.110166.48050.F343160C@psf.io> https://hg.python.org/cpython/rev/c3d779f96b20 changeset: 106457:c3d779f96b20 branch: 3.6 parent: 106454:4463e311f5bd parent: 106456:df62e833eeb1 user: Mariatta Wijaya date: Mon Feb 06 20:16:58 2017 -0800 summary: Issue #29371: merge with 3.5 files: Doc/library/doctest.rst | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -510,9 +510,9 @@ A number of option flags control various aspects of doctest's behavior. Symbolic names for the flags are supplied as module constants, which can be -or'ed together and passed to various functions. The names can also be used in -:ref:`doctest directives `, and may be passed to the -doctest command line interface via the ``-o`` option. +:ref:`bitwise ORed ` together and passed to various functions. +The names can also be used in :ref:`doctest directives `, +and may be passed to the doctest command line interface via the ``-o`` option. .. versionadded:: 3.4 The ``-o`` command line option. @@ -877,8 +877,9 @@ nothing at the end. In verbose mode, the summary is detailed, else the summary is very brief (in fact, empty if all tests passed). - Optional argument *optionflags* (default value 0) takes the bitwise-or of - option flags. See section :ref:`doctest-options`. + Optional argument *optionflags* (default value 0) takes the + :ref:`bitwise OR ` of option flags. + See section :ref:`doctest-options`. Optional argument *raise_on_error* defaults to false. If true, an exception is raised upon the first failure or unexpected exception in an example. This @@ -1098,18 +1099,19 @@ Set the :mod:`doctest` reporting flags to use. - Argument *flags* takes the bitwise-or of option flags. See section - :ref:`doctest-options`. Only "reporting flags" can be used. + Argument *flags* takes the :ref:`bitwise OR ` of option flags. See + section :ref:`doctest-options`. Only "reporting flags" can be used. This is a module-global setting, and affects all future doctests run by module :mod:`unittest`: the :meth:`runTest` method of :class:`DocTestCase` looks at the option flags specified for the test case when the :class:`DocTestCase` instance was constructed. If no reporting flags were specified (which is the typical and expected case), :mod:`doctest`'s :mod:`unittest` reporting flags are - or'ed into the option flags, and the option flags so augmented are passed to the - :class:`DocTestRunner` instance created to run the doctest. If any reporting - flags were specified when the :class:`DocTestCase` instance was constructed, - :mod:`doctest`'s :mod:`unittest` reporting flags are ignored. + :ref:`bitwise ORed ` into the option flags, and the option flags + so augmented are passed to the :class:`DocTestRunner` instance created to + run the doctest. If any reporting flags were specified when the + :class:`DocTestCase` instance was constructed, :mod:`doctest`'s + :mod:`unittest` reporting flags are ignored. The value of the :mod:`unittest` reporting flags in effect before the function was called is returned by the function. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Feb 6 23:19:03 2017 From: python-checkins at python.org (mariatta.wijaya) Date: Tue, 07 Feb 2017 04:19:03 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2329371=3A_merge_with_3=2E6?= Message-ID: <20170207041903.8213.25402.AB3C2BCC@psf.io> https://hg.python.org/cpython/rev/e376d2bfde9b changeset: 106458:e376d2bfde9b parent: 106455:8132bcc1522d parent: 106457:c3d779f96b20 user: Mariatta Wijaya date: Mon Feb 06 20:18:39 2017 -0800 summary: Issue #29371: merge with 3.6 files: Doc/library/doctest.rst | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -510,9 +510,9 @@ A number of option flags control various aspects of doctest's behavior. Symbolic names for the flags are supplied as module constants, which can be -or'ed together and passed to various functions. The names can also be used in -:ref:`doctest directives `, and may be passed to the -doctest command line interface via the ``-o`` option. +:ref:`bitwise ORed ` together and passed to various functions. +The names can also be used in :ref:`doctest directives `, +and may be passed to the doctest command line interface via the ``-o`` option. .. versionadded:: 3.4 The ``-o`` command line option. @@ -877,8 +877,9 @@ nothing at the end. In verbose mode, the summary is detailed, else the summary is very brief (in fact, empty if all tests passed). - Optional argument *optionflags* (default value 0) takes the bitwise-or of - option flags. See section :ref:`doctest-options`. + Optional argument *optionflags* (default value 0) takes the + :ref:`bitwise OR ` of option flags. + See section :ref:`doctest-options`. Optional argument *raise_on_error* defaults to false. If true, an exception is raised upon the first failure or unexpected exception in an example. This @@ -1098,18 +1099,19 @@ Set the :mod:`doctest` reporting flags to use. - Argument *flags* takes the bitwise-or of option flags. See section - :ref:`doctest-options`. Only "reporting flags" can be used. + Argument *flags* takes the :ref:`bitwise OR ` of option flags. See + section :ref:`doctest-options`. Only "reporting flags" can be used. This is a module-global setting, and affects all future doctests run by module :mod:`unittest`: the :meth:`runTest` method of :class:`DocTestCase` looks at the option flags specified for the test case when the :class:`DocTestCase` instance was constructed. If no reporting flags were specified (which is the typical and expected case), :mod:`doctest`'s :mod:`unittest` reporting flags are - or'ed into the option flags, and the option flags so augmented are passed to the - :class:`DocTestRunner` instance created to run the doctest. If any reporting - flags were specified when the :class:`DocTestCase` instance was constructed, - :mod:`doctest`'s :mod:`unittest` reporting flags are ignored. + :ref:`bitwise ORed ` into the option flags, and the option flags + so augmented are passed to the :class:`DocTestRunner` instance created to + run the doctest. If any reporting flags were specified when the + :class:`DocTestCase` instance was constructed, :mod:`doctest`'s + :mod:`unittest` reporting flags are ignored. The value of the :mod:`unittest` reporting flags in effect before the function was called is returned by the function. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Mon Feb 6 23:30:21 2017 From: python-checkins at python.org (mariatta.wijaya) Date: Tue, 07 Feb 2017 04:30:21 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI5Mzcx?= =?utf-8?q?=3A_Clarify_bitwise_OR_operation_in_doctest_option_flags=2E?= Message-ID: <20170207043021.25874.36832.B2CEA1A3@psf.io> https://hg.python.org/cpython/rev/3fd198b80f29 changeset: 106459:3fd198b80f29 branch: 2.7 parent: 106409:110ec861e5ea user: Mariatta Wijaya date: Mon Feb 06 20:30:10 2017 -0800 summary: Issue #29371: Clarify bitwise OR operation in doctest option flags. files: Doc/library/doctest.rst | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst --- a/Doc/library/doctest.rst +++ b/Doc/library/doctest.rst @@ -530,8 +530,8 @@ A number of option flags control various aspects of doctest's behavior. Symbolic names for the flags are supplied as module constants, which can be -or'ed together and passed to various functions. The names can also be used in -:ref:`doctest directives `. +:ref:`bitwise ORed ` together and passed to various functions. +The names can also be used in :ref:`doctest directives `. The first group of options define test semantics, controlling aspects of how doctest decides whether actual output matches an example's expected output: @@ -1161,10 +1161,11 @@ the option flags specified for the test case when the :class:`DocTestCase` instance was constructed. If no reporting flags were specified (which is the typical and expected case), :mod:`doctest`'s :mod:`unittest` reporting flags are - or'ed into the option flags, and the option flags so augmented are passed to the - :class:`DocTestRunner` instance created to run the doctest. If any reporting - flags were specified when the :class:`DocTestCase` instance was constructed, - :mod:`doctest`'s :mod:`unittest` reporting flags are ignored. + :ref:`bitwise ORed ` into the option flags, and the option flags + so augmented are passed to the :class:`DocTestRunner` instance created to + run the doctest. If any reporting flags were specified when the + :class:`DocTestCase` instance was constructed, :mod:`doctest`'s + :mod:`unittest` reporting flags are ignored. The value of the :mod:`unittest` reporting flags in effect before the function was called is returned by the function. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Feb 7 01:06:37 2017 From: python-checkins at python.org (mariatta.wijaya) Date: Tue, 07 Feb 2017 06:06:37 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5MzE0?= =?utf-8?q?=3A_Set_the_stacklevel_to_two_in_asyncio=2Easync=28=29_Deprecat?= =?utf-8?q?ion_Warning?= Message-ID: <20170207060637.16132.71445.80BDE99C@psf.io> https://hg.python.org/cpython/rev/0f5161f865d7 changeset: 106460:0f5161f865d7 branch: 3.5 parent: 106456:df62e833eeb1 user: Mariatta Wijaya date: Mon Feb 06 22:03:00 2017 -0800 summary: Issue #29314: Set the stacklevel to two in asyncio.async() Deprecation Warning files: Lib/asyncio/tasks.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -535,7 +535,8 @@ """ warnings.warn("asyncio.async() function is deprecated, use ensure_future()", - DeprecationWarning) + DeprecationWarning, + stacklevel=2) return ensure_future(coro_or_future, loop=loop) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Feb 7 01:06:38 2017 From: python-checkins at python.org (mariatta.wijaya) Date: Tue, 07 Feb 2017 06:06:38 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329314=3A_Merge_with_3=2E5?= Message-ID: <20170207060638.25680.42030.D0F5FE63@psf.io> https://hg.python.org/cpython/rev/6dbe9051cdec changeset: 106461:6dbe9051cdec branch: 3.6 parent: 106457:c3d779f96b20 parent: 106460:0f5161f865d7 user: Mariatta Wijaya date: Mon Feb 06 22:05:10 2017 -0800 summary: Issue #29314: Merge with 3.5 files: Lib/asyncio/tasks.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -487,7 +487,8 @@ """ warnings.warn("asyncio.async() function is deprecated, use ensure_future()", - DeprecationWarning) + DeprecationWarning, + stacklevel=2) return ensure_future(coro_or_future, loop=loop) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Feb 7 01:06:39 2017 From: python-checkins at python.org (mariatta.wijaya) Date: Tue, 07 Feb 2017 06:06:39 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2329314=3A_Merge_with_3=2E6?= Message-ID: <20170207060639.16582.37035.D484BA4C@psf.io> https://hg.python.org/cpython/rev/9f16900bebaa changeset: 106462:9f16900bebaa parent: 106458:e376d2bfde9b parent: 106461:6dbe9051cdec user: Mariatta Wijaya date: Mon Feb 06 22:06:04 2017 -0800 summary: Issue #29314: Merge with 3.6 files: Lib/asyncio/tasks.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py --- a/Lib/asyncio/tasks.py +++ b/Lib/asyncio/tasks.py @@ -487,7 +487,8 @@ """ warnings.warn("asyncio.async() function is deprecated, use ensure_future()", - DeprecationWarning) + DeprecationWarning, + stacklevel=2) return ensure_future(coro_or_future, loop=loop) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Feb 7 03:22:55 2017 From: python-checkins at python.org (berker.peksag) Date: Tue, 07 Feb 2017 08:22:55 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI5NDQx?= =?utf-8?q?=3A_Update_examples_to_use_async_and_await_keywords_in?= Message-ID: <20170207082255.110213.12111.B3929F2B@psf.io> https://hg.python.org/cpython/rev/514571268743 changeset: 106463:514571268743 branch: 3.5 parent: 106460:0f5161f865d7 user: Berker Peksag date: Tue Feb 07 11:27:09 2017 +0300 summary: Issue #29441: Update examples to use async and await keywords in asyncio-task.rst files: Doc/library/asyncio-task.rst | 21 ++++----------------- 1 files changed, 4 insertions(+), 17 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 @@ -136,17 +136,6 @@ loop.run_until_complete(display_date(loop)) loop.close() -The same coroutine implemented using a generator:: - - @asyncio.coroutine - def display_date(loop): - end_time = loop.time() + 5.0 - while True: - print(datetime.datetime.now()) - if (loop.time() + 1.0) >= end_time: - break - yield from asyncio.sleep(1) - .. seealso:: The :ref:`display the current date with call_later() @@ -309,9 +298,8 @@ import asyncio - @asyncio.coroutine - def slow_operation(future): - yield from asyncio.sleep(1) + async def slow_operation(future): + await asyncio.sleep(1) future.set_result('Future is done!') loop = asyncio.get_event_loop() @@ -341,9 +329,8 @@ import asyncio - @asyncio.coroutine - def slow_operation(future): - yield from asyncio.sleep(1) + async def slow_operation(future): + await asyncio.sleep(1) future.set_result('Future is done!') def got_result(future): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Feb 7 03:23:14 2017 From: python-checkins at python.org (berker.peksag) Date: Tue, 07 Feb 2017 08:23:14 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Issue_=2329441=3A_Merge_from_3=2E6?= Message-ID: <20170207082255.128068.28535.316F71F3@psf.io> https://hg.python.org/cpython/rev/ee074604bf0c changeset: 106465:ee074604bf0c parent: 106462:9f16900bebaa parent: 106464:975e03b0aea6 user: Berker Peksag date: Tue Feb 07 11:28:19 2017 +0300 summary: Issue #29441: Merge from 3.6 files: Doc/library/asyncio-task.rst | 21 ++++----------------- 1 files changed, 4 insertions(+), 17 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 @@ -136,17 +136,6 @@ loop.run_until_complete(display_date(loop)) loop.close() -The same coroutine implemented using a generator:: - - @asyncio.coroutine - def display_date(loop): - end_time = loop.time() + 5.0 - while True: - print(datetime.datetime.now()) - if (loop.time() + 1.0) >= end_time: - break - yield from asyncio.sleep(1) - .. seealso:: The :ref:`display the current date with call_later() @@ -309,9 +298,8 @@ import asyncio - @asyncio.coroutine - def slow_operation(future): - yield from asyncio.sleep(1) + async def slow_operation(future): + await asyncio.sleep(1) future.set_result('Future is done!') loop = asyncio.get_event_loop() @@ -341,9 +329,8 @@ import asyncio - @asyncio.coroutine - def slow_operation(future): - yield from asyncio.sleep(1) + async def slow_operation(future): + await asyncio.sleep(1) future.set_result('Future is done!') def got_result(future): -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Tue Feb 7 03:23:14 2017 From: python-checkins at python.org (berker.peksag) Date: Tue, 07 Feb 2017 08:23:14 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Issue_=2329441=3A_Merge_from_3=2E5?= Message-ID: <20170207082255.96407.94095.56EFFE0A@psf.io> https://hg.python.org/cpython/rev/975e03b0aea6 changeset: 106464:975e03b0aea6 branch: 3.6 parent: 106461:6dbe9051cdec parent: 106463:514571268743 user: Berker Peksag date: Tue Feb 07 11:27:48 2017 +0300 summary: Issue #29441: Merge from 3.5 files: Doc/library/asyncio-task.rst | 21 ++++----------------- 1 files changed, 4 insertions(+), 17 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 @@ -136,17 +136,6 @@ loop.run_until_complete(display_date(loop)) loop.close() -The same coroutine implemented using a generator:: - - @asyncio.coroutine - def display_date(loop): - end_time = loop.time() + 5.0 - while True: - print(datetime.datetime.now()) - if (loop.time() + 1.0) >= end_time: - break - yield from asyncio.sleep(1) - .. seealso:: The :ref:`display the current date with call_later() @@ -309,9 +298,8 @@ import asyncio - @asyncio.coroutine - def slow_operation(future): - yield from asyncio.sleep(1) + async def slow_operation(future): + await asyncio.sleep(1) future.set_result('Future is done!') loop = asyncio.get_event_loop() @@ -341,9 +329,8 @@ import asyncio - @asyncio.coroutine - def slow_operation(future): - yield from asyncio.sleep(1) + async def slow_operation(future): + await asyncio.sleep(1) future.set_result('Future is done!') def got_result(future): -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Tue Feb 7 04:30:03 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 07 Feb 2017 09:30:03 +0000 Subject: [Python-checkins] Daily reference leaks (e376d2bfde9b): sum=0 Message-ID: <20170207093003.128501.93522.B2D09812@psf.io> results for e376d2bfde9b on branch "default" -------------------------------------------- test_collections leaked [-7, 1, 0] memory blocks, sum=-6 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_fork leaked [-1, -1, 2] memory blocks, sum=0 test_multiprocessing_spawn leaked [2, 0, 0] memory blocks, sum=2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogqlf6S4', '--timeout', '7200'] From lp_benchmark_robot at intel.com Tue Feb 7 21:12:42 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 7 Feb 2017 18:12:42 -0800 Subject: [Python-checkins] UGLY Benchmark Results for Python Default 2017-02-07 Message-ID: <37bc160c-75a4-4154-838e-1b34c504155b@orsmsx105.amr.corp.intel.com> Results for project Python default, build date 2017-02-07 11:03:40 +0000 commit: 8132bcc1522d previous commit: 724d1aa7589b revision date: 2017-02-06 22:53:21 +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% -1.65% 9.29% 16.23% :-) pybench 0.35% 0.35% 4.39% 4.68% :-| regex_v8 3.60% 0.76% 1.22% 4.15% :-| nbody 0.12% 1.30% -0.01% 6.31% :-) json_dump_v2 0.52% 0.80% 9.96% 11.13% :-| normal_startup 1.02% -0.02% 0.90% 6.44% ---------------------------------------------------------------------------------- * 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-2017-02-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 lp_benchmark_robot at intel.com Tue Feb 7 21:11:51 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 7 Feb 2017 18:11:51 -0800 Subject: [Python-checkins] BAD Benchmark Results for Python 2.7 2017-02-07 Message-ID: No new revisions. Here are the previous results: Results for project Python 2.7, build date 2017-02-07 11:47:42 +0000 commit: 110ec861e5ea previous commit: 14682d00b09a revision date: 2017-02-04 09:10:25 +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% -1.21% 3.62% 9.83% :-) pybench 0.15% 0.01% 7.74% 2.39% :-| regex_v8 0.59% -0.17% -0.36% 10.25% :-) nbody 0.07% 0.01% 12.01% 4.51% :-| json_dump_v2 0.30% -0.18% 0.27% 12.36% :-( normal_startup 1.95% 0.40% -2.23% 2.09% :-| ssbench 0.17% -0.25% -0.13% 3.03% ---------------------------------------------------------------------------------- * 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-2017-02-07/ 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 Wed Feb 8 04:28:27 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 08 Feb 2017 09:28:27 +0000 Subject: [Python-checkins] Daily reference leaks (ee074604bf0c): sum=10 Message-ID: <20170208092827.25784.97650.96BCE01B@psf.io> results for ee074604bf0c on branch "default" -------------------------------------------- test_collections leaked [0, 7, 0] memory blocks, sum=7 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_fork leaked [2, 0, -1] memory blocks, sum=1 test_multiprocessing_forkserver leaked [0, 0, -2] memory blocks, sum=-2 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/reflogyUw1W_', '--timeout', '7200'] From python-checkins at python.org Wed Feb 8 06:25:16 2017 From: python-checkins at python.org (victor.stinner) Date: Wed, 08 Feb 2017 11:25:16 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_support=3A_add_more_info_o?= =?utf-8?q?n_temp=5Fdir=28=29_and_change=5Fcwd=28=29_failure?= Message-ID: <20170208112516.26489.72996.ED0EC041@psf.io> https://hg.python.org/cpython/rev/a35337a02a0e changeset: 106467:a35337a02a0e user: Victor Stinner date: Wed Feb 08 12:25:00 2017 +0100 summary: support: add more info on temp_dir() and change_cwd() failure Log the OSError exception message. files: Lib/test/support/__init__.py | 10 ++++++---- 1 files changed, 6 insertions(+), 4 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 @@ -954,10 +954,11 @@ try: os.mkdir(path) dir_created = True - except OSError: + except OSError as exc: if not quiet: raise - warnings.warn('tests may fail, unable to create temp dir: ' + path, + warnings.warn(f'tests may fail, unable to create ' + f'temporary directory {path}: {exc}', RuntimeWarning, stacklevel=3) try: yield path @@ -981,10 +982,11 @@ saved_dir = os.getcwd() try: os.chdir(path) - except OSError: + except OSError as exc: if not quiet: raise - warnings.warn('tests may fail, unable to change CWD to: ' + path, + warnings.warn(f'tests may fail, unable to change current working ' + f'directory to {path}: {exc}', RuntimeWarning, stacklevel=3) try: yield os.getcwd() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Feb 8 06:25:16 2017 From: python-checkins at python.org (victor.stinner) Date: Wed, 08 Feb 2017 11:25:16 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2329306=3A_Fix_usag?= =?utf-8?q?e_of_Py=5FEnterRecursiveCall=28=29?= Message-ID: <20170208112515.25680.58078.B7CA53F2@psf.io> https://hg.python.org/cpython/rev/88ed9d9eabc1 changeset: 106466:88ed9d9eabc1 user: Victor Stinner date: Wed Feb 08 12:06:00 2017 +0100 summary: Issue #29306: Fix usage of Py_EnterRecursiveCall() * *PyCFunction_*Call*() functions now call Py_EnterRecursiveCall(). * PyObject_Call() now calls directly _PyFunction_FastCallDict() and PyCFunction_Call() to avoid calling Py_EnterRecursiveCall() twice per function call files: Objects/abstract.c | 112 +++++++++++++++------------- Objects/methodobject.c | 61 +++++++++------ 2 files changed, 95 insertions(+), 78 deletions(-) diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2239,21 +2239,32 @@ assert(PyTuple_Check(args)); assert(kwargs == NULL || PyDict_Check(kwargs)); - call = callable->ob_type->tp_call; - if (call == NULL) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable", - callable->ob_type->tp_name); - return NULL; + if (PyFunction_Check(callable)) { + return _PyFunction_FastCallDict(callable, + &PyTuple_GET_ITEM(args, 0), + PyTuple_GET_SIZE(args), + kwargs); } - - if (Py_EnterRecursiveCall(" while calling a Python object")) - return NULL; - - result = (*call)(callable, args, kwargs); - - Py_LeaveRecursiveCall(); - - return _Py_CheckFunctionResult(callable, result, NULL); + else if (PyCFunction_Check(callable)) { + return PyCFunction_Call(callable, args, kwargs); + } + else { + call = callable->ob_type->tp_call; + if (call == NULL) { + PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable", + callable->ob_type->tp_name); + return NULL; + } + + if (Py_EnterRecursiveCall(" while calling a Python object")) + return NULL; + + result = (*call)(callable, args, kwargs); + + Py_LeaveRecursiveCall(); + + return _Py_CheckFunctionResult(callable, result, NULL); + } } /* Issue #29234: Inlining _PyStack_AsTuple() into callers increases their @@ -2305,9 +2316,6 @@ _PyObject_FastCallDict(PyObject *callable, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { - ternaryfunc call; - PyObject *result = NULL; - /* _PyObject_FastCallDict() must not be called with an exception set, because it can clear it (directly or indirectly) and so the caller loses its exception */ @@ -2318,42 +2326,41 @@ assert(nargs == 0 || args != NULL); assert(kwargs == NULL || PyDict_Check(kwargs)); - if (Py_EnterRecursiveCall(" while calling a Python object")) { - return NULL; - } - if (PyFunction_Check(callable)) { - result = _PyFunction_FastCallDict(callable, args, nargs, kwargs); + return _PyFunction_FastCallDict(callable, args, nargs, kwargs); } else if (PyCFunction_Check(callable)) { - result = _PyCFunction_FastCallDict(callable, args, nargs, kwargs); + return _PyCFunction_FastCallDict(callable, args, nargs, kwargs); } else { - PyObject *tuple; + PyObject *argstuple, *result; + ternaryfunc call; /* Slow-path: build a temporary tuple */ call = callable->ob_type->tp_call; if (call == NULL) { PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable", callable->ob_type->tp_name); - goto exit; + return NULL; } - tuple = _PyStack_AsTuple(args, nargs); - if (tuple == NULL) { - goto exit; + argstuple = _PyStack_AsTuple(args, nargs); + if (argstuple == NULL) { + return NULL; } - result = (*call)(callable, tuple, kwargs); - Py_DECREF(tuple); - + if (Py_EnterRecursiveCall(" while calling a Python object")) { + return NULL; + } + + result = (*call)(callable, argstuple, kwargs); + + Py_LeaveRecursiveCall(); + + Py_DECREF(argstuple); result = _Py_CheckFunctionResult(callable, result, NULL); + return result; } - -exit: - Py_LeaveRecursiveCall(); - - return result; } /* Positional arguments are obj followed by args: @@ -2506,49 +2513,48 @@ temporary dictionary for keyword arguments (if any) */ ternaryfunc call; - PyObject *argtuple; + PyObject *argstuple; PyObject *kwdict, *result; Py_ssize_t nkwargs; - result = NULL; nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames); assert((nargs == 0 && nkwargs == 0) || stack != NULL); - if (Py_EnterRecursiveCall(" while calling a Python object")) { - return NULL; - } - call = callable->ob_type->tp_call; if (call == NULL) { PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable", callable->ob_type->tp_name); - goto exit; + return NULL; } - argtuple = _PyStack_AsTuple(stack, nargs); - if (argtuple == NULL) { - goto exit; + argstuple = _PyStack_AsTuple(stack, nargs); + if (argstuple == NULL) { + return NULL; } if (nkwargs > 0) { kwdict = _PyStack_AsDict(stack + nargs, kwnames); if (kwdict == NULL) { - Py_DECREF(argtuple); - goto exit; + Py_DECREF(argstuple); + return NULL; } } else { kwdict = NULL; } - result = (*call)(callable, argtuple, kwdict); - Py_DECREF(argtuple); + if (Py_EnterRecursiveCall(" while calling a Python object")) { + return NULL; + } + + result = (*call)(callable, argstuple, kwdict); + + Py_LeaveRecursiveCall(); + + Py_DECREF(argstuple); Py_XDECREF(kwdict); result = _Py_CheckFunctionResult(callable, result, NULL); - - exit: - Py_LeaveRecursiveCall(); return result; } } diff --git a/Objects/methodobject.c b/Objects/methodobject.c --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -90,11 +90,6 @@ _PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { - PyCFunction meth; - PyObject *result; - int flags; - PyObject *argstuple; - /* _PyMethodDef_RawFastCallDict() must not be called with an exception set, because it can clear it (directly or indirectly) and so the caller loses its exception */ @@ -105,18 +100,23 @@ assert(nargs == 0 || args != NULL); assert(kwargs == NULL || PyDict_Check(kwargs)); - meth = method->ml_meth; - flags = method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST); + PyCFunction meth = method->ml_meth; + int flags = method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST); + PyObject *result = NULL; + + if (Py_EnterRecursiveCall(" while calling a Python object")) { + return NULL; + } switch (flags) { case METH_NOARGS: - if (nargs != 0) { + if (nargs != 0) { PyErr_Format(PyExc_TypeError, "%.200s() takes no arguments (%zd given)", method->ml_name, nargs); - return NULL; - } + goto exit; + } if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) { goto no_keyword_error; @@ -130,7 +130,7 @@ PyErr_Format(PyExc_TypeError, "%.200s() takes exactly one argument (%zd given)", method->ml_name, nargs); - return NULL; + goto exit; } if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) { @@ -148,10 +148,11 @@ /* fall through next case */ case METH_VARARGS | METH_KEYWORDS: + { /* Slow-path: create a temporary tuple for positional arguments */ - argstuple = _PyStack_AsTuple(args, nargs); + PyObject *argstuple = _PyStack_AsTuple(args, nargs); if (argstuple == NULL) { - return NULL; + goto exit; } if (flags & METH_KEYWORDS) { @@ -162,6 +163,7 @@ } Py_DECREF(argstuple); break; + } case METH_FASTCALL: { @@ -170,7 +172,7 @@ _PyCFunctionFast fastmeth = (_PyCFunctionFast)meth; if (_PyStack_UnpackDict(args, nargs, kwargs, &stack, &kwnames) < 0) { - return NULL; + goto exit; } result = (*fastmeth) (self, stack, nargs, kwnames); @@ -185,17 +187,19 @@ PyErr_SetString(PyExc_SystemError, "Bad call flags in _PyMethodDef_RawFastCallDict. " "METH_OLDARGS is no longer supported!"); - return NULL; + goto exit; } - return result; + goto exit; no_keyword_error: PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", method->ml_name, nargs); - return NULL; +exit: + Py_LeaveRecursiveCall(); + return result; } PyObject * @@ -232,7 +236,11 @@ PyCFunction meth = method->ml_meth; int flags = method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST); Py_ssize_t nkwargs = kwnames == NULL ? 0 : PyTuple_Size(kwnames); - PyObject *result; + PyObject *result = NULL; + + if (Py_EnterRecursiveCall(" while calling a Python object")) { + return NULL; + } switch (flags) { @@ -241,7 +249,7 @@ PyErr_Format(PyExc_TypeError, "%.200s() takes no arguments (%zd given)", method->ml_name, nargs); - return NULL; + goto exit; } if (nkwargs) { @@ -256,7 +264,7 @@ PyErr_Format(PyExc_TypeError, "%.200s() takes exactly one argument (%zd given)", method->ml_name, nargs); - return NULL; + goto exit; } if (nkwargs) { @@ -284,7 +292,7 @@ argtuple = _PyStack_AsTuple(args, nargs); if (argtuple == NULL) { - return NULL; + goto exit; } if (flags & METH_KEYWORDS) { @@ -294,7 +302,7 @@ kwdict = _PyStack_AsDict(args + nargs, kwnames); if (kwdict == NULL) { Py_DECREF(argtuple); - return NULL; + goto exit; } } else { @@ -315,16 +323,19 @@ PyErr_SetString(PyExc_SystemError, "Bad call flags in _PyCFunction_FastCallKeywords. " "METH_OLDARGS is no longer supported!"); - return NULL; + goto exit; } - return result; + goto exit; no_keyword_error: PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", method->ml_name); - return NULL; + +exit: + Py_LeaveRecursiveCall(); + return result; } PyObject * -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Feb 8 06:49:13 2017 From: python-checkins at python.org (victor.stinner) Date: Wed, 08 Feb 2017 11:49:13 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Update_test=5Fsupport_for_?= =?utf-8?q?my_temp=5Fdir/change=5Fcwd_changes?= Message-ID: <20170208114913.96227.39792.24554456@psf.io> https://hg.python.org/cpython/rev/b86f698aeee7 changeset: 106468:b86f698aeee7 user: Victor Stinner date: Wed Feb 08 12:49:02 2017 +0100 summary: Update test_support for my temp_dir/change_cwd changes files: Lib/test/support/__init__.py | 2 +- Lib/test/test_support.py | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 6 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 @@ -985,7 +985,7 @@ except OSError as exc: if not quiet: raise - warnings.warn(f'tests may fail, unable to change current working ' + warnings.warn(f'tests may fail, unable to change the current working ' f'directory to {path}: {exc}', RuntimeWarning, stacklevel=3) try: diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -155,8 +155,11 @@ finally: shutil.rmtree(path) - expected = ['tests may fail, unable to create temp dir: ' + path] - self.assertEqual(warnings, expected) + self.assertEqual(len(warnings), 1, warnings) + warn = warnings[0] + self.assertTrue(warn.startswith(f'tests may fail, unable to create ' + f'temporary directory {path}: '), + warn) # Tests for change_cwd() @@ -197,8 +200,12 @@ self.assertEqual(os.getcwd(), new_cwd) warnings = [str(w.message) for w in recorder.warnings] - expected = ['tests may fail, unable to change CWD to: ' + bad_dir] - self.assertEqual(warnings, expected) + self.assertEqual(len(warnings), 1, warnings) + warn = warnings[0] + self.assertTrue(warn.startswith(f'tests may fail, unable to change ' + f'the current working directory ' + f'to {bad_dir}: '), + warn) # Tests for change_cwd() @@ -209,7 +216,13 @@ with support.change_cwd(path=path, quiet=True): pass messages = [str(w.message) for w in recorder.warnings] - self.assertEqual(messages, ['tests may fail, unable to change CWD to: ' + path]) + + self.assertEqual(len(messages), 1, messages) + msg = messages[0] + self.assertTrue(msg.startswith(f'tests may fail, unable to change ' + f'the current working directory ' + f'to {path}: '), + msg) # Tests for temp_cwd() -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Feb 8 07:08:40 2017 From: python-checkins at python.org (victor.stinner) Date: Wed, 08 Feb 2017 12:08:40 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fix_refleaks_if_Py=5FEnter?= =?utf-8?q?RecursiveCall=28=29_fails?= Message-ID: <20170208120840.96198.25704.5283B1AD@psf.io> https://hg.python.org/cpython/rev/37705f89c72b changeset: 106470:37705f89c72b user: Victor Stinner date: Wed Feb 08 12:57:09 2017 +0100 summary: Fix refleaks if Py_EnterRecursiveCall() fails Issue #29306: Destroy argstuple and kwdict if Py_EnterRecursiveCall() fails. files: Objects/abstract.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2350,14 +2350,15 @@ } if (Py_EnterRecursiveCall(" while calling a Python object")) { + Py_DECREF(argstuple); return NULL; } result = (*call)(callable, argstuple, kwargs); Py_LeaveRecursiveCall(); - Py_DECREF(argstuple); + result = _Py_CheckFunctionResult(callable, result, NULL); return result; } @@ -2544,6 +2545,8 @@ } if (Py_EnterRecursiveCall(" while calling a Python object")) { + Py_DECREF(argstuple); + Py_XDECREF(kwdict); return NULL; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Feb 8 07:08:40 2017 From: python-checkins at python.org (victor.stinner) Date: Wed, 08 Feb 2017 12:08:40 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fix_regrtest_-j0_-R_output?= Message-ID: <20170208120839.7701.22561.BF1B7EAE@psf.io> https://hg.python.org/cpython/rev/df334ed278ce changeset: 106469:df334ed278ce user: Victor Stinner date: Wed Feb 08 13:06:08 2017 +0100 summary: Fix regrtest -j0 -R output Write also dots into stderr, instead of stdout. files: Lib/test/libregrtest/refleak.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Lib/test/libregrtest/refleak.py b/Lib/test/libregrtest/refleak.py --- a/Lib/test/libregrtest/refleak.py +++ b/Lib/test/libregrtest/refleak.py @@ -84,7 +84,7 @@ indirect_test() alloc_after, rc_after, fd_after = dash_R_cleanup(fs, ps, pic, zdc, abcs) - print('.', end='', flush=True) + print('.', end='', file=sys.stderr, flush=True) if i >= nwarmup: rc_deltas[i] = rc_after - rc_before alloc_deltas[i] = alloc_after - alloc_before -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Wed Feb 8 09:49:18 2017 From: python-checkins at python.org (victor.stinner) Date: Wed, 08 Feb 2017 14:49:18 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_support=3A_temp=5Fdir=28?= =?utf-8?q?=29_and_change=5Fcwd=28=29_uses_repr=28=29_in_error_message?= Message-ID: <20170208144917.128178.24771.3B18D6C9@psf.io> https://hg.python.org/cpython/rev/f507545ad22a changeset: 106471:f507545ad22a user: Victor Stinner date: Wed Feb 08 15:49:10 2017 +0100 summary: support: temp_dir() and change_cwd() uses repr() in error message Serhiy Storshaka pointed me that str(path) can emit a BytesWarning: use repr(path) instead. files: Lib/test/support/__init__.py | 4 ++-- Lib/test/test_support.py | 6 +++--- 2 files changed, 5 insertions(+), 5 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 @@ -958,7 +958,7 @@ if not quiet: raise warnings.warn(f'tests may fail, unable to create ' - f'temporary directory {path}: {exc}', + f'temporary directory {path!r}: {exc}', RuntimeWarning, stacklevel=3) try: yield path @@ -986,7 +986,7 @@ if not quiet: raise warnings.warn(f'tests may fail, unable to change the current working ' - f'directory to {path}: {exc}', + f'directory to {path!r}: {exc}', RuntimeWarning, stacklevel=3) try: yield os.getcwd() diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -158,7 +158,7 @@ self.assertEqual(len(warnings), 1, warnings) warn = warnings[0] self.assertTrue(warn.startswith(f'tests may fail, unable to create ' - f'temporary directory {path}: '), + f'temporary directory {path!r}: '), warn) # Tests for change_cwd() @@ -204,7 +204,7 @@ warn = warnings[0] self.assertTrue(warn.startswith(f'tests may fail, unable to change ' f'the current working directory ' - f'to {bad_dir}: '), + f'to {bad_dir!r}: '), warn) # Tests for change_cwd() @@ -221,7 +221,7 @@ msg = messages[0] self.assertTrue(msg.startswith(f'tests may fail, unable to change ' f'the current working directory ' - f'to {path}: '), + f'to {path!r}: '), msg) # Tests for temp_cwd() -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Wed Feb 8 18:38:43 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 8 Feb 2017 15:38:43 -0800 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2017-02-08 Message-ID: <88a4c69c-b034-4434-9492-42af1caa06fe@orsmsx106.amr.corp.intel.com> Results for project Python 2.7, build date 2017-02-08 11:47:49 +0000 commit: 3fd198b80f29 previous commit: 110ec861e5ea revision date: 2017-02-07 04:30:10 +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.11% 0.65% 4.24% 7.38% :-) pybench 0.17% -0.11% 7.64% 3.72% :-| regex_v8 0.59% 0.03% -0.33% 9.72% :-) nbody 0.08% -0.02% 11.99% 2.41% :-| json_dump_v2 0.26% -0.03% 0.24% 10.52% :-( normal_startup 1.96% -0.99% -3.24% 2.85% :-| ssbench 0.15% 0.24% 0.11% 3.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-2017-02-08/ 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 Wed Feb 8 18:39:32 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 8 Feb 2017 15:39:32 -0800 Subject: [Python-checkins] BAD Benchmark Results for Python Default 2017-02-08 Message-ID: Results for project Python default, build date 2017-02-08 11:03:40 +0000 commit: ee074604bf0c previous commit: 8132bcc1522d revision date: 2017-02-07 08:28:19 +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.42% -1.48% 7.94% 17.69% :-) pybench 0.18% -0.01% 4.38% 5.20% :-| regex_v8 3.62% -0.07% 1.15% 4.28% :-| nbody 0.19% -0.05% -0.06% 7.59% :-) json_dump_v2 0.28% 0.80% 10.68% 9.96% :-| normal_startup 1.06% -0.08% 1.05% 6.29% ---------------------------------------------------------------------------------- * 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-2017-02-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 Feb 8 20:03:04 2017 From: python-checkins at python.org (victor.stinner) Date: Thu, 09 Feb 2017 01:03:04 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Fix_PyCFunction=5FCall=28?= =?utf-8?q?=29_performance_issue?= Message-ID: <20170209010304.110166.31717.914EC120@psf.io> https://hg.python.org/cpython/rev/31342913fb1e changeset: 106472:31342913fb1e user: Victor Stinner date: Thu Feb 09 02:01:37 2017 +0100 summary: Fix PyCFunction_Call() performance issue Issue #29259, #29465: PyCFunction_Call() doesn't create anymore a redundant tuple to pass positional arguments for METH_VARARGS. Add a new cfunction_call() subfunction. files: Objects/methodobject.c | 54 +++++++++++++++++++++++++++-- 1 files changed, 50 insertions(+), 4 deletions(-) diff --git a/Objects/methodobject.c b/Objects/methodobject.c --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -77,13 +77,59 @@ return PyCFunction_GET_FLAGS(op); } +static PyObject * +cfunction_call_varargs(PyObject *func, PyObject *args, PyObject *kwargs) +{ + assert(!PyErr_Occurred()); + + PyCFunction meth = PyCFunction_GET_FUNCTION(func); + PyObject *self = PyCFunction_GET_SELF(func); + PyObject *result; + + if (PyCFunction_GET_FLAGS(func) & METH_KEYWORDS) { + if (Py_EnterRecursiveCall(" while calling a Python object")) { + return NULL; + } + + result = (*(PyCFunctionWithKeywords)meth)(self, args, kwargs); + + Py_LeaveRecursiveCall(); + } + else { + if (kwargs != NULL && PyDict_Size(kwargs) != 0) { + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + ((PyCFunctionObject*)func)->m_ml->ml_name); + return NULL; + } + + if (Py_EnterRecursiveCall(" while calling a Python object")) { + return NULL; + } + + result = (*meth)(self, args); + + Py_LeaveRecursiveCall(); + } + + return _Py_CheckFunctionResult(func, result, NULL); +} + + PyObject * PyCFunction_Call(PyObject *func, PyObject *args, PyObject *kwargs) { - return _PyCFunction_FastCallDict(func, - &PyTuple_GET_ITEM(args, 0), - PyTuple_GET_SIZE(args), - kwargs); + /* first try METH_VARARGS to pass directly args tuple unchanged. + _PyMethodDef_RawFastCallDict() creates a new temporary tuple + for METH_VARARGS. */ + if (PyCFunction_GET_FLAGS(func) & METH_VARARGS) { + return cfunction_call_varargs(func, args, kwargs); + } + else { + return _PyCFunction_FastCallDict(func, + &PyTuple_GET_ITEM(args, 0), + PyTuple_GET_SIZE(args), + kwargs); + } } PyObject * -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Thu Feb 9 04:19:12 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 09 Feb 2017 09:19:12 +0000 Subject: [Python-checkins] Daily reference leaks (31342913fb1e): sum=3 Message-ID: <20170209091912.111010.49287.B8BDAEC0@psf.io> results for 31342913fb1e on branch "default" -------------------------------------------- test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [-2, 1, 0] memory blocks, sum=-1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflog30e5PS', '--timeout', '7200'] From python-checkins at python.org Thu Feb 9 10:09:16 2017 From: python-checkins at python.org (nick.coghlan) Date: Thu, 09 Feb 2017 15:09:16 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Merge_issue_=2326355_fix_from_Python_3=2E5?= Message-ID: <20170209150915.128206.80463.14F9B822@psf.io> https://hg.python.org/cpython/rev/80970cf56048 changeset: 106474:80970cf56048 branch: 3.6 parent: 106464:975e03b0aea6 parent: 106473:c63b09833141 user: Nick Coghlan date: Thu Feb 09 16:08:17 2017 +0100 summary: Merge issue #26355 fix from Python 3.5 files: Doc/tools/templates/layout.html | 1 + Misc/ACKS | 1 + Misc/NEWS | 3 +++ 3 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html --- a/Doc/tools/templates/layout.html +++ b/Doc/tools/templates/layout.html @@ -38,6 +38,7 @@ {% endblock %} {% block extrahead %} + {% if builder != "htmlhelp" %} {% if not embedded %}{% endif %} {% if versionswitcher is defined and not embedded %}{% endif %} diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -220,6 +220,7 @@ Tarn Weisner Burton Lee Busby Katherine Busch +Matthias Bussonnier Ralph Butler Laurent De Buyst Zach Byrne diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -180,6 +180,9 @@ Documentation ------------- +- Issue #26355: Add canonical header link on each page to corresponding major + version of the documentation. Patch by Matthias Bussonnier. + - Issue #29349: Fix Python 2 syntax in code for building the documentation. Tests -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 9 10:09:16 2017 From: python-checkins at python.org (nick.coghlan) Date: Thu, 09 Feb 2017 15:09:16 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogSXNzdWUgIzI2MzU1?= =?utf-8?q?=3A_Specify_canonical_URLs_in_docs_pages?= Message-ID: <20170209150914.96931.80608.AD455F38@psf.io> https://hg.python.org/cpython/rev/c63b09833141 changeset: 106473:c63b09833141 branch: 3.5 parent: 106463:514571268743 user: Nick Coghlan date: Thu Feb 09 16:03:59 2017 +0100 summary: Issue #26355: Specify canonical URLs in docs pages Add canonical header link on each page to corresponding major version of the documentation. Patch by Matthias Bussonnier. files: Doc/tools/templates/layout.html | 1 + Misc/ACKS | 1 + Misc/NEWS | 3 +++ 3 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html --- a/Doc/tools/templates/layout.html +++ b/Doc/tools/templates/layout.html @@ -38,6 +38,7 @@ {% endblock %} {% block extrahead %} + {% if builder != "htmlhelp" %} {% if not embedded %}{% endif %} {% if versionswitcher is defined and not embedded %}{% endif %} diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -218,6 +218,7 @@ Tarn Weisner Burton Lee Busby Katherine Busch +Matthias Bussonnier Ralph Butler Laurent De Buyst Zach Byrne diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -70,6 +70,9 @@ Documentation ------------- +- Issue #26355: Add canonical header link on each page to corresponding major + version of the documentation. Patch by Matthias Bussonnier. + - Issue #29349: Fix Python 2 syntax in code for building the documentation. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 9 10:09:18 2017 From: python-checkins at python.org (nick.coghlan) Date: Thu, 09 Feb 2017 15:09:18 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Merge_issue_=2326355_fix_from_3=2E6?= Message-ID: <20170209150915.16288.14514.3CF65C14@psf.io> https://hg.python.org/cpython/rev/26af402c291f changeset: 106475:26af402c291f parent: 106472:31342913fb1e parent: 106474:80970cf56048 user: Nick Coghlan date: Thu Feb 09 16:09:03 2017 +0100 summary: Merge issue #26355 fix from 3.6 files: Doc/tools/templates/layout.html | 1 + Misc/ACKS | 1 + Misc/NEWS | 3 +++ 3 files changed, 5 insertions(+), 0 deletions(-) diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html --- a/Doc/tools/templates/layout.html +++ b/Doc/tools/templates/layout.html @@ -38,6 +38,7 @@ {% endblock %} {% block extrahead %} + {% if builder != "htmlhelp" %} {% if not embedded %}{% endif %} {% if versionswitcher is defined and not embedded %}{% endif %} diff --git a/Misc/ACKS b/Misc/ACKS --- a/Misc/ACKS +++ b/Misc/ACKS @@ -220,6 +220,7 @@ Tarn Weisner Burton Lee Busby Katherine Busch +Matthias Bussonnier Ralph Butler Laurent De Buyst Zach Byrne diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -686,6 +686,9 @@ Documentation ------------- +- Issue #26355: Add canonical header link on each page to corresponding major + version of the documentation. Patch by Matthias Bussonnier. + - Issue #29349: Fix Python 2 syntax in code for building the documentation. - Issue #23722: The data model reference and the porting section in the -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 9 11:00:46 2017 From: python-checkins at python.org (nick.coghlan) Date: Thu, 09 Feb 2017 16:00:46 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMi43KTogSXNzdWUgIzI2MzU1?= =?utf-8?q?=3A_Specify_canonical_URLs_in_docs_pages?= Message-ID: <20170209160040.96794.26651.1ED6BDB9@psf.io> https://hg.python.org/cpython/rev/b07d454e45a2 changeset: 106476:b07d454e45a2 branch: 2.7 parent: 106459:3fd198b80f29 user: Nick Coghlan date: Thu Feb 09 17:00:31 2017 +0100 summary: Issue #26355: Specify canonical URLs in docs pages Add canonical header link on each page to corresponding major version of the documentation. Patch by Matthias Bussonnier. files: Doc/tools/templates/layout.html | 1 + Misc/NEWS | 3 +++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/Doc/tools/templates/layout.html b/Doc/tools/templates/layout.html --- a/Doc/tools/templates/layout.html +++ b/Doc/tools/templates/layout.html @@ -16,6 +16,7 @@ {% block relbar2 %} {% if builder != 'qthelp' %} {{ relbar() }} {% endif %} {% endblock %} {% block extrahead %} + {% if not embedded %}{% endif %} {% if versionswitcher is defined and not embedded %}{% endif %} {{ super() }} diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -85,6 +85,9 @@ Documentation ------------- +- Issue #26355: Add canonical header link on each page to corresponding major + version of the documentation. Patch by Matthias Bussonnier. + - 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. Added default behaviour and consistency suggestions -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 9 13:07:36 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 09 Feb 2017 18:07:36 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogSXNzdWUgIzI5NTEz?= =?utf-8?q?=3A_Fixed_a_reference_leak_in_os=2Escandir=28=29_added_in_issue?= =?utf-8?q?_=2329034=2E?= Message-ID: <20170209180735.128575.13443.B1AEE945@psf.io> https://hg.python.org/cpython/rev/4e3a16bdadae changeset: 106477:4e3a16bdadae branch: 3.6 parent: 106474:80970cf56048 user: Serhiy Storchaka date: Thu Feb 09 20:02:37 2017 +0200 summary: Issue #29513: Fixed a reference leak in os.scandir() added in issue #29034. files: Modules/posixmodule.c | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -11865,7 +11865,6 @@ } } - Py_CLEAR(iterator->path.object); path_cleanup(&iterator->path); /* Restore the saved exception. */ @@ -11969,12 +11968,6 @@ path_converter, &iterator->path)) goto error; - /* path_converter doesn't keep path.object around, so do it - manually for the lifetime of the iterator here (the refcount - is decremented in ScandirIterator_dealloc) - */ - Py_XINCREF(iterator->path.object); - #ifdef MS_WINDOWS iterator->first_time = 1; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 9 13:07:36 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 09 Feb 2017 18:07:36 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?q?=29=3A_Null_merge?= Message-ID: <20170209180735.8344.25151.380D7F3C@psf.io> https://hg.python.org/cpython/rev/73a7bc169329 changeset: 106479:73a7bc169329 parent: 106478:a3f8c5d172b4 parent: 106477:4e3a16bdadae user: Serhiy Storchaka date: Thu Feb 09 20:07:15 2017 +0200 summary: Null merge files: -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 9 13:07:36 2017 From: python-checkins at python.org (serhiy.storchaka) Date: Thu, 09 Feb 2017 18:07:36 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2329513=3A_Fix_outd?= =?utf-8?q?ated_comment_and_remove_redundand_code_is_os=2Escandir=28=29=2E?= Message-ID: <20170209180735.96586.82304.3C985804@psf.io> https://hg.python.org/cpython/rev/a3f8c5d172b4 changeset: 106478:a3f8c5d172b4 parent: 106475:26af402c291f user: Serhiy Storchaka date: Thu Feb 09 20:05:51 2017 +0200 summary: Issue #29513: Fix outdated comment and remove redundand code is os.scandir(). files: Modules/posixmodule.c | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -11856,7 +11856,6 @@ } } - Py_CLEAR(iterator->path.object); path_cleanup(&iterator->path); /* Restore the saved exception. */ @@ -11968,12 +11967,9 @@ #endif memcpy(&iterator->path, path, sizeof(path_t)); - /* path_converter doesn't keep path.object around, so do it - manually for the lifetime of the iterator here (the refcount - is decremented in ScandirIterator_dealloc) - */ - Py_XINCREF(iterator->path.object); - Py_XINCREF(iterator->path.cleanup); + /* Move the ownership to iterator->path */ + path->object = NULL; + path->cleanup = NULL; #ifdef MS_WINDOWS iterator->first_time = 1; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 9 17:00:31 2017 From: python-checkins at python.org (victor.stinner) Date: Thu, 09 Feb 2017 22:00:31 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Optimize_slots=3A_avoid_te?= =?utf-8?q?mporary_PyMethodObject?= Message-ID: <20170209220031.61942.47716.775AC712@psf.io> https://hg.python.org/cpython/rev/7b8df4a5d81d changeset: 106480:7b8df4a5d81d user: Victor Stinner date: Thu Feb 09 22:53:47 2017 +0100 summary: Optimize slots: avoid temporary PyMethodObject Issue #29507: Optimize slots calling Python methods. For Python methods, get the unbound Python function and prepend arguments with self, rather than calling the descriptor which creates a temporary PyMethodObject. Add a new _PyObject_FastCall_Prepend() function used to call the unbound Python method with self. It avoids the creation of a temporary tuple to pass positional arguments. Avoiding temporary PyMethodObject and avoiding temporary tuple makes Python slots up to 1.46x faster. Microbenchmark on a __getitem__() method implemented in Python: Median +- std dev: 121 ns +- 5 ns -> 82.8 ns +- 1.0 ns: 1.46x faster (-31%) Co-Authored-by: INADA Naoki files: Include/abstract.h | 6 + Objects/abstract.c | 35 +++++ Objects/typeobject.c | 191 ++++++++++++++++++++---------- 3 files changed, 170 insertions(+), 62 deletions(-) diff --git a/Include/abstract.h b/Include/abstract.h --- a/Include/abstract.h +++ b/Include/abstract.h @@ -257,6 +257,12 @@ PyObject *args, PyObject *kwargs); +PyAPI_FUNC(PyObject *) _PyObject_FastCall_Prepend( + PyObject *callable, + PyObject *obj, + PyObject **args, + Py_ssize_t nargs); + PyAPI_FUNC(PyObject *) _Py_CheckFunctionResult(PyObject *callable, PyObject *result, const char *where); diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2367,6 +2367,41 @@ /* Positional arguments are obj followed by args: call callable(obj, *args, **kwargs) */ PyObject * +_PyObject_FastCall_Prepend(PyObject *callable, + PyObject *obj, PyObject **args, Py_ssize_t nargs) +{ + PyObject *small_stack[_PY_FASTCALL_SMALL_STACK]; + PyObject **args2; + PyObject *result; + + nargs++; + if (nargs <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) { + args2 = small_stack; + } + else { + args2 = PyMem_Malloc(nargs * sizeof(PyObject *)); + if (args2 == NULL) { + PyErr_NoMemory(); + return NULL; + } + } + + /* use borrowed references */ + args2[0] = obj; + memcpy(&args2[1], + args, + (nargs - 1)* sizeof(PyObject *)); + + result = _PyObject_FastCall(callable, args2, nargs); + if (args2 != small_stack) { + PyMem_Free(args2); + } + return result; +} + + +/* Call callable(obj, *args, **kwargs). */ +PyObject * _PyObject_Call_Prepend(PyObject *callable, PyObject *obj, PyObject *args, PyObject *kwargs) { diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1394,14 +1394,18 @@ the method name as a C string, and the address of a static variable used to cache the interned Python string. - Two variants: + Variants: - lookup_maybe() returns NULL without raising an exception when the _PyType_Lookup() call fails; - - lookup_method() always raises an exception upon errors. - - - _PyObject_LookupSpecial() exported for the benefit of other places. + - lookup_maybe_method() and lookup_method() are similar to + lookup_maybe(), but can return unbound PyFunction + to avoid temporary method object. Pass self as first argument when + unbound == 1. + + - _PyObject_LookupSpecial() expose lookup_maybe for the benefit of + other places. */ static PyObject * @@ -1421,11 +1425,38 @@ } static PyObject * -lookup_method(PyObject *self, _Py_Identifier *attrid) -{ - PyObject *res = lookup_maybe(self, attrid); - if (res == NULL && !PyErr_Occurred()) +lookup_maybe_method(PyObject *self, _Py_Identifier *attrid, int *unbound) +{ + PyObject *res = _PyType_LookupId(Py_TYPE(self), attrid); + if (res == NULL) { + return NULL; + } + + if (PyFunction_Check(res)) { + /* Avoid temporary PyMethodObject */ + *unbound = 1; + Py_INCREF(res); + } + else { + *unbound = 0; + descrgetfunc f = Py_TYPE(res)->tp_descr_get; + if (f == NULL) { + Py_INCREF(res); + } + else { + res = f(res, self, (PyObject *)(Py_TYPE(self))); + } + } + return res; +} + +static PyObject * +lookup_method(PyObject *self, _Py_Identifier *attrid, int *unbound) +{ + PyObject *res = lookup_maybe_method(self, attrid, unbound); + if (res == NULL && !PyErr_Occurred()) { PyErr_SetObject(PyExc_AttributeError, attrid->object); + } return res; } @@ -1435,26 +1466,49 @@ return lookup_maybe(self, attrid); } -/* A variation of PyObject_CallMethodObjArgs that uses lookup_method() +static PyObject* +call_unbound(int unbound, PyObject *func, PyObject *self, + PyObject **args, Py_ssize_t nargs) +{ + if (unbound) { + return _PyObject_FastCall_Prepend(func, self, args, nargs); + } + else { + return _PyObject_FastCall(func, args, nargs); + } +} + +static PyObject* +call_unbound_noarg(int unbound, PyObject *func, PyObject *self) +{ + if (unbound) { + PyObject *args[1] = {self}; + return _PyObject_FastCall(func, args, 1); + } + else { + return _PyObject_CallNoArg(func); + } +} + +/* A variation of PyObject_CallMethodObjArgs that uses lookup_maybe_method() instead of PyObject_GetAttrString(). This uses the same convention - as lookup_method to cache the interned name string object. */ - + as lookup_maybe_method to cache the interned name string object. */ static PyObject * call_method(PyObject *obj, _Py_Identifier *name, PyObject **args, Py_ssize_t nargs) { + int unbound; PyObject *func, *retval; - func = lookup_maybe(obj, name); + func = lookup_maybe_method(obj, name, &unbound); if (func == NULL) { if (!PyErr_Occurred()) PyErr_SetObject(PyExc_AttributeError, name->object); return NULL; } - retval = _PyObject_FastCall(func, args, nargs); + retval = call_unbound(unbound, func, obj, args, nargs); Py_DECREF(func); - return retval; } @@ -1464,18 +1518,18 @@ call_maybe(PyObject *obj, _Py_Identifier *name, PyObject **args, Py_ssize_t nargs) { + int unbound; PyObject *func, *retval; - func = lookup_maybe(obj, name); + func = lookup_maybe_method(obj, name, &unbound); if (func == NULL) { if (!PyErr_Occurred()) Py_RETURN_NOTIMPLEMENTED; return NULL; } - retval = _PyObject_FastCall(func, args, nargs); + retval = call_unbound(unbound, func, obj, args, nargs); Py_DECREF(func); - return retval; } @@ -1830,10 +1884,12 @@ if (custom) { _Py_IDENTIFIER(mro); - PyObject *mro_meth = lookup_method((PyObject *)type, &PyId_mro); + int unbound; + PyObject *mro_meth = lookup_method((PyObject *)type, &PyId_mro, + &unbound); if (mro_meth == NULL) return NULL; - mro_result = _PyObject_CallNoArg(mro_meth); + mro_result = call_unbound_noarg(unbound, mro_meth, (PyObject *)type); Py_DECREF(mro_meth); } else { @@ -5892,10 +5948,10 @@ slot_sq_contains(PyObject *self, PyObject *value) { PyObject *func, *res; - int result = -1; + int result = -1, unbound; _Py_IDENTIFIER(__contains__); - func = lookup_maybe(self, &PyId___contains__); + func = lookup_maybe_method(self, &PyId___contains__, &unbound); if (func == Py_None) { Py_DECREF(func); PyErr_Format(PyExc_TypeError, @@ -5904,7 +5960,8 @@ return -1; } if (func != NULL) { - res = PyObject_CallFunctionObjArgs(func, value, NULL); + PyObject *args[1] = {value}; + res = call_unbound(unbound, func, self, args, 1); Py_DECREF(func); if (res != NULL) { result = PyObject_IsTrue(res); @@ -5982,17 +6039,17 @@ slot_nb_bool(PyObject *self) { PyObject *func, *value; - int result; + int result, unbound; int using_len = 0; _Py_IDENTIFIER(__bool__); - func = lookup_maybe(self, &PyId___bool__); + func = lookup_maybe_method(self, &PyId___bool__, &unbound); if (func == NULL) { if (PyErr_Occurred()) { return -1; } - func = lookup_maybe(self, &PyId___len__); + func = lookup_maybe_method(self, &PyId___len__, &unbound); if (func == NULL) { if (PyErr_Occurred()) { return -1; @@ -6002,7 +6059,7 @@ using_len = 1; } - value = _PyObject_CallNoArg(func); + value = call_unbound_noarg(unbound, func, self); if (value == NULL) { goto error; } @@ -6078,10 +6135,11 @@ { PyObject *func, *res; _Py_IDENTIFIER(__repr__); - - func = lookup_method(self, &PyId___repr__); + int unbound; + + func = lookup_method(self, &PyId___repr__, &unbound); if (func != NULL) { - res = PyEval_CallObject(func, NULL); + res = call_unbound_noarg(unbound, func, self); Py_DECREF(func); return res; } @@ -6090,27 +6148,16 @@ Py_TYPE(self)->tp_name, self); } -static PyObject * -slot_tp_str(PyObject *self) -{ - PyObject *func, *res; - _Py_IDENTIFIER(__str__); - - func = lookup_method(self, &PyId___str__); - if (func == NULL) - return NULL; - res = PyEval_CallObject(func, NULL); - Py_DECREF(func); - return res; -} +SLOT0(slot_tp_str, "__str__") static Py_hash_t slot_tp_hash(PyObject *self) { PyObject *func, *res; Py_ssize_t h; - - func = lookup_method(self, &PyId___hash__); + int unbound; + + func = lookup_method(self, &PyId___hash__, &unbound); if (func == Py_None) { Py_DECREF(func); @@ -6121,7 +6168,7 @@ return PyObject_HashNotImplemented(self); } - res = PyEval_CallObject(func, NULL); + res = call_unbound_noarg(unbound, func, self); Py_DECREF(func); if (res == NULL) return -1; @@ -6155,13 +6202,19 @@ slot_tp_call(PyObject *self, PyObject *args, PyObject *kwds) { _Py_IDENTIFIER(__call__); - PyObject *meth = lookup_method(self, &PyId___call__); + int unbound; + PyObject *meth = lookup_method(self, &PyId___call__, &unbound); PyObject *res; if (meth == NULL) return NULL; - res = PyObject_Call(meth, args, kwds); + if (unbound) { + res = _PyObject_Call_Prepend(meth, self, args, kwds); + } + else { + res = PyObject_Call(meth, args, kwds); + } Py_DECREF(meth); return res; @@ -6280,14 +6333,17 @@ static PyObject * slot_tp_richcompare(PyObject *self, PyObject *other, int op) { + int unbound; PyObject *func, *res; - func = lookup_method(self, &name_op[op]); + func = lookup_method(self, &name_op[op], &unbound); if (func == NULL) { PyErr_Clear(); Py_RETURN_NOTIMPLEMENTED; } - res = PyObject_CallFunctionObjArgs(func, other, NULL); + + PyObject *args[1] = {other}; + res = call_unbound(unbound, func, self, args, 1); Py_DECREF(func); return res; } @@ -6295,10 +6351,11 @@ static PyObject * slot_tp_iter(PyObject *self) { + int unbound; PyObject *func, *res; _Py_IDENTIFIER(__iter__); - func = lookup_method(self, &PyId___iter__); + func = lookup_method(self, &PyId___iter__, &unbound); if (func == Py_None) { Py_DECREF(func); PyErr_Format(PyExc_TypeError, @@ -6308,13 +6365,13 @@ } if (func != NULL) { - res = _PyObject_CallNoArg(func); + res = call_unbound_noarg(unbound, func, self); Py_DECREF(func); return res; } PyErr_Clear(); - func = lookup_method(self, &PyId___getitem__); + func = lookup_method(self, &PyId___getitem__, &unbound); if (func == NULL) { PyErr_Format(PyExc_TypeError, "'%.200s' object is not iterable", @@ -6380,12 +6437,18 @@ slot_tp_init(PyObject *self, PyObject *args, PyObject *kwds) { _Py_IDENTIFIER(__init__); - PyObject *meth = lookup_method(self, &PyId___init__); + int unbound; + PyObject *meth = lookup_method(self, &PyId___init__, &unbound); PyObject *res; if (meth == NULL) return -1; - res = PyObject_Call(meth, args, kwds); + if (unbound) { + res = _PyObject_Call_Prepend(meth, self, args, kwds); + } + else { + res = PyObject_Call(meth, args, kwds); + } Py_DECREF(meth); if (res == NULL) return -1; @@ -6419,6 +6482,7 @@ slot_tp_finalize(PyObject *self) { _Py_IDENTIFIER(__del__); + int unbound; PyObject *del, *res; PyObject *error_type, *error_value, *error_traceback; @@ -6426,9 +6490,9 @@ PyErr_Fetch(&error_type, &error_value, &error_traceback); /* Execute __del__ method, if any. */ - del = lookup_maybe(self, &PyId___del__); + del = lookup_maybe_method(self, &PyId___del__, &unbound); if (del != NULL) { - res = PyEval_CallObject(del, NULL); + res = call_unbound_noarg(unbound, del, self); if (res == NULL) PyErr_WriteUnraisable(del); else @@ -6443,12 +6507,13 @@ static PyObject * slot_am_await(PyObject *self) { + int unbound; PyObject *func, *res; _Py_IDENTIFIER(__await__); - func = lookup_method(self, &PyId___await__); + func = lookup_method(self, &PyId___await__, &unbound); if (func != NULL) { - res = PyEval_CallObject(func, NULL); + res = call_unbound_noarg(unbound, func, self); Py_DECREF(func); return res; } @@ -6461,12 +6526,13 @@ static PyObject * slot_am_aiter(PyObject *self) { + int unbound; PyObject *func, *res; _Py_IDENTIFIER(__aiter__); - func = lookup_method(self, &PyId___aiter__); + func = lookup_method(self, &PyId___aiter__, &unbound); if (func != NULL) { - res = PyEval_CallObject(func, NULL); + res = call_unbound_noarg(unbound, func, self); Py_DECREF(func); return res; } @@ -6479,12 +6545,13 @@ static PyObject * slot_am_anext(PyObject *self) { + int unbound; PyObject *func, *res; _Py_IDENTIFIER(__anext__); - func = lookup_method(self, &PyId___anext__); + func = lookup_method(self, &PyId___anext__, &unbound); if (func != NULL) { - res = PyEval_CallObject(func, NULL); + res = call_unbound_noarg(unbound, func, self); Py_DECREF(func); return res; } -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Thu Feb 9 17:51:18 2017 From: python-checkins at python.org (victor.stinner) Date: Thu, 09 Feb 2017 22:51:18 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2329507=3A_Update_t?= =?utf-8?q?est=5Fexceptions?= Message-ID: <20170209225116.3128.31086.E2877672@psf.io> https://hg.python.org/cpython/rev/be663c9a9e24 changeset: 106481:be663c9a9e24 user: Victor Stinner date: Thu Feb 09 23:49:50 2017 +0100 summary: Issue #29507: Update test_exceptions test_unraisable() of test_exceptions expects that PyErr_WriteUnraisable(method) fails on repr(method). Before the previous change (7b8df4a5d81d), slot_tp_finalize() called PyErr_WriteUnraisable() with a PyMethodObject. In this case, repr(method) calls repr(self) which is BrokenRepr.__repr__() and the calls raises a new exception. After the previous change, slot_tp_finalize() uses an unbound method: repr() is called on a regular __del__() method which doesn't call repr(self). repr() doesn't fail anymore. PyErr_WriteUnraisable() doesn't call __repr__() anymore, so remove BrokenRepr unit test. files: Lib/test/test_exceptions.py | 11 ++--------- 1 files changed, 2 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -1023,27 +1023,20 @@ # The following line is included in the traceback report: raise exc - class BrokenRepr(BrokenDel): - def __repr__(self): - raise AttributeError("repr() is broken") - class BrokenExceptionDel: def __del__(self): exc = BrokenStrException() # The following line is included in the traceback report: raise exc - for test_class in (BrokenDel, BrokenRepr, BrokenExceptionDel): + for test_class in (BrokenDel, BrokenExceptionDel): with self.subTest(test_class): obj = test_class() with captured_stderr() as stderr: del obj report = stderr.getvalue() self.assertIn("Exception ignored", report) - if test_class is BrokenRepr: - self.assertIn("", report) - else: - self.assertIn(test_class.__del__.__qualname__, report) + self.assertIn(test_class.__del__.__qualname__, report) self.assertIn("test_exceptions.py", report) self.assertIn("raise exc", report) if test_class is BrokenExceptionDel: -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Thu Feb 9 18:14:26 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 9 Feb 2017 15:14:26 -0800 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2017-02-09 Message-ID: No new revisions. Here are the previous results: Results for project Python 2.7, build date 2017-02-09 11:48:10 +0000 commit: 3fd198b80f29 previous commit: 110ec861e5ea revision date: 2017-02-07 04:30:10 +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.11% 0.65% 4.24% 7.38% :-) pybench 0.17% -0.11% 7.64% 3.72% :-| regex_v8 0.59% 0.03% -0.33% 9.72% :-) nbody 0.08% -0.02% 11.99% 2.41% :-| json_dump_v2 0.26% -0.03% 0.24% 10.52% :-( normal_startup 1.96% -0.99% -3.24% 2.85% :-| ssbench 0.15% 0.24% 0.11% 3.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-2017-02-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 lp_benchmark_robot at intel.com Thu Feb 9 18:21:17 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 9 Feb 2017 15:21:17 -0800 Subject: [Python-checkins] UGLY Benchmark Results for Python Default 2017-02-09 Message-ID: <9c5b3632-db9c-4c2e-b675-e9f65813d8d5@orsmsx155.amr.corp.intel.com> Results for project Python default, build date 2017-02-09 11:04:01 +0000 commit: 31342913fb1e previous commit: ee074604bf0c revision date: 2017-02-09 01:01:37 +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% 2.16% 9.93% 13.56% :-) pybench 0.20% -0.70% 3.71% 4.42% :-| regex_v8 3.64% 0.31% 1.46% 4.14% :-| nbody 0.17% 1.65% 1.59% 3.14% :-) json_dump_v2 0.32% -1.29% 9.52% 9.25% :-| normal_startup 1.14% -0.16% 0.62% 6.79% ---------------------------------------------------------------------------------- * 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-2017-02-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 python-checkins at python.org Thu Feb 9 18:41:37 2017 From: python-checkins at python.org (victor.stinner) Date: Thu, 09 Feb 2017 23:41:37 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2329507=3A_Fix_=5FP?= =?utf-8?q?yObject=5FCallFunctionVa=28=29?= Message-ID: <20170209234137.53855.68765.2BBD4105@psf.io> https://hg.python.org/cpython/rev/e5cd74868dfc changeset: 106482:e5cd74868dfc user: Victor Stinner date: Fri Feb 10 00:41:06 2017 +0100 summary: Issue #29507: Fix _PyObject_CallFunctionVa() is_size_t test was reversed. Bug spotted by INADA Naoki. files: Objects/abstract.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2616,10 +2616,12 @@ } if (is_size_t) { - stack = _Py_VaBuildStack(small_stack, small_stack_len, format, va, &nargs); + stack = _Py_VaBuildStack_SizeT(small_stack, small_stack_len, + format, va, &nargs); } else { - stack = _Py_VaBuildStack_SizeT(small_stack, small_stack_len, format, va, &nargs); + stack = _Py_VaBuildStack(small_stack, small_stack_len, + format, va, &nargs); } if (stack == NULL) { return NULL; -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Feb 10 01:35:30 2017 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 10 Feb 2017 06:35:30 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_massage_Englis?= =?utf-8?q?h_for_-X_descriptions_a_bit?= Message-ID: <20170210063530.53496.14077.63706C08@psf.io> https://hg.python.org/cpython/rev/59e54de17dd8 changeset: 106483:59e54de17dd8 branch: 3.6 parent: 106477:4e3a16bdadae user: Benjamin Peterson date: Thu Feb 09 22:31:17 2017 -0800 summary: massage English for -X descriptions a bit files: Doc/using/cmdline.rst | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -396,21 +396,23 @@ defines the following possible values: * ``-X faulthandler`` to enable :mod:`faulthandler`; - * ``-X showrefcount`` to enable the output of the total reference count - and memory blocks (only works on debug builds); + * ``-X showrefcount`` to output the total reference count and number of used + memory blocks when the program finishes or after each statement in the + interactive interpreter. This only works on debug builds. * ``-X tracemalloc`` to start tracing Python memory allocations using the :mod:`tracemalloc` module. By default, only the most recent frame is stored in a traceback of a trace. Use ``-X tracemalloc=NFRAME`` to start tracing with a traceback limit of *NFRAME* frames. See the :func:`tracemalloc.start` for more information. - * ``-X showalloccount`` to enable the output of the total count of allocated - objects for each type (only works when built with ``COUNT_ALLOCS`` defined); + * ``-X showalloccount`` to output the total count of allocated objects for + each type when the program finishes. This only works when Python was built with + ``COUNT_ALLOCS`` defined. It also allows passing arbitrary values and retrieving them through the :data:`sys._xoptions` dictionary. .. versionchanged:: 3.2 - It is now allowed to pass :option:`-X` with CPython. + The :option:`-X` option was added. .. versionadded:: 3.3 The ``-X faulthandler`` option. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Feb 10 01:35:44 2017 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 10 Feb 2017 06:35:44 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogbWVyZ2UgMy42?= Message-ID: <20170210063544.53832.78290.453AF257@psf.io> https://hg.python.org/cpython/rev/b1f4ace59eb9 changeset: 106484:b1f4ace59eb9 parent: 106482:e5cd74868dfc parent: 106483:59e54de17dd8 user: Benjamin Peterson date: Thu Feb 09 22:35:38 2017 -0800 summary: merge 3.6 files: Doc/using/cmdline.rst | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst --- a/Doc/using/cmdline.rst +++ b/Doc/using/cmdline.rst @@ -396,21 +396,23 @@ defines the following possible values: * ``-X faulthandler`` to enable :mod:`faulthandler`; - * ``-X showrefcount`` to enable the output of the total reference count - and memory blocks (only works on debug builds); + * ``-X showrefcount`` to output the total reference count and number of used + memory blocks when the program finishes or after each statement in the + interactive interpreter. This only works on debug builds. * ``-X tracemalloc`` to start tracing Python memory allocations using the :mod:`tracemalloc` module. By default, only the most recent frame is stored in a traceback of a trace. Use ``-X tracemalloc=NFRAME`` to start tracing with a traceback limit of *NFRAME* frames. See the :func:`tracemalloc.start` for more information. - * ``-X showalloccount`` to enable the output of the total count of allocated - objects for each type (only works when built with ``COUNT_ALLOCS`` defined); + * ``-X showalloccount`` to output the total count of allocated objects for + each type when the program finishes. This only works when Python was built with + ``COUNT_ALLOCS`` defined. It also allows passing arbitrary values and retrieving them through the :data:`sys._xoptions` dictionary. .. versionchanged:: 3.2 - It is now allowed to pass :option:`-X` with CPython. + The :option:`-X` option was added. .. versionadded:: 3.3 The ``-X faulthandler`` option. -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Feb 10 03:20:38 2017 From: python-checkins at python.org (lukasz.langa) Date: Fri, 10 Feb 2017 08:20:38 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy41KTogRml4ICMyOTUxOTog?= =?utf-8?q?weakref_spewing_exceptions_during_interp_finalization?= Message-ID: <20170210082038.52952.11247.41462CF0@psf.io> https://hg.python.org/cpython/rev/2cb530243943 changeset: 106485:2cb530243943 branch: 3.5 parent: 106473:c63b09833141 user: ?ukasz Langa date: Fri Feb 10 00:14:55 2017 -0800 summary: Fix #29519: weakref spewing exceptions during interp finalization files: Lib/weakref.py | 4 ++-- Misc/NEWS | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Lib/weakref.py b/Lib/weakref.py --- a/Lib/weakref.py +++ b/Lib/weakref.py @@ -106,7 +106,7 @@ self, *args = args if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) - def remove(wr, selfref=ref(self)): + def remove(wr, selfref=ref(self), _atomic_removal=_remove_dead_weakref): self = selfref() if self is not None: if self._iterating: @@ -114,7 +114,7 @@ else: # Atomic removal is necessary since this function # can be called asynchronously by the GC - _remove_dead_weakref(d, wr.key) + _atomic_removal(d, wr.key) self._remove = remove # A list of keys to be removed self._pending_removals = [] diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -23,6 +23,9 @@ Library ------- +- Issue #29519: Fix weakref spewing exceptions during interpreter shutdown + when used with a rare combination of multiprocessing and custom codecs. + - Issue #29416: Prevent infinite loop in pathlib.Path.mkdir - Issue #29444: Fixed out-of-bounds buffer access in the group() method of -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Feb 10 03:20:39 2017 From: python-checkins at python.org (lukasz.langa) Date: Fri, 10 Feb 2017 08:20:39 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAobWVyZ2UgMy41IC0+IDMuNik6?= =?utf-8?q?_Merge_3=2E5_=28fix_=2329519=29?= Message-ID: <20170210082039.61942.86528.DC2ECB60@psf.io> https://hg.python.org/cpython/rev/c5267272e66a changeset: 106486:c5267272e66a branch: 3.6 parent: 106483:59e54de17dd8 parent: 106485:2cb530243943 user: ?ukasz Langa date: Fri Feb 10 00:16:10 2017 -0800 summary: Merge 3.5 (fix #29519) files: Lib/weakref.py | 4 ++-- Misc/NEWS | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Lib/weakref.py b/Lib/weakref.py --- a/Lib/weakref.py +++ b/Lib/weakref.py @@ -106,7 +106,7 @@ self, *args = args if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) - def remove(wr, selfref=ref(self)): + def remove(wr, selfref=ref(self), _atomic_removal=_remove_dead_weakref): self = selfref() if self is not None: if self._iterating: @@ -114,7 +114,7 @@ else: # Atomic removal is necessary since this function # can be called asynchronously by the GC - _remove_dead_weakref(d, wr.key) + _atomic_removal(d, wr.key) self._remove = remove # A list of keys to be removed self._pending_removals = [] diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -57,6 +57,9 @@ Library ------- +- Issue #29519: Fix weakref spewing exceptions during interpreter shutdown + when used with a rare combination of multiprocessing and custom codecs. + - Issue #29416: Prevent infinite loop in pathlib.Path.mkdir - Issue #29444: Fixed out-of-bounds buffer access in the group() method of -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Feb 10 03:20:40 2017 From: python-checkins at python.org (lukasz.langa) Date: Fri, 10 Feb 2017 08:20:40 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy42IChmaXggIzI5NTE5KQ==?= Message-ID: <20170210082040.3325.57658.027D1623@psf.io> https://hg.python.org/cpython/rev/e91ec62da088 changeset: 106487:e91ec62da088 parent: 106484:b1f4ace59eb9 parent: 106486:c5267272e66a user: ?ukasz Langa date: Fri Feb 10 00:20:16 2017 -0800 summary: Merge 3.6 (fix #29519) files: Lib/weakref.py | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/weakref.py b/Lib/weakref.py --- a/Lib/weakref.py +++ b/Lib/weakref.py @@ -106,7 +106,7 @@ self, *args = args if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) - def remove(wr, selfref=ref(self)): + def remove(wr, selfref=ref(self), _atomic_removal=_remove_dead_weakref): self = selfref() if self is not None: if self._iterating: @@ -114,7 +114,7 @@ else: # Atomic removal is necessary since this function # can be called asynchronously by the GC - _remove_dead_weakref(d, wr.key) + _atomic_removal(d, wr.key) self._remove = remove # A list of keys to be removed self._pending_removals = [] -- Repository URL: https://hg.python.org/cpython From solipsis at pitrou.net Fri Feb 10 04:20:01 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 10 Feb 2017 09:20:01 +0000 Subject: [Python-checkins] Daily reference leaks (e5cd74868dfc): sum=5 Message-ID: <20170210092001.107222.1865.C8C193F3@psf.io> results for e5cd74868dfc on branch "default" -------------------------------------------- test_collections leaked [0, -7, 8] 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/reflogiIx0zf', '--timeout', '7200'] From python-checkins at python.org Fri Feb 10 04:35:00 2017 From: python-checkins at python.org (victor.stinner) Date: Fri, 10 Feb 2017 09:35:00 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=283=2E6=29=3A_Fix_datetime?= =?utf-8?q?=2Efromtimestamp=28=29=3A_check_bounds?= Message-ID: <20170210093459.2867.63168.8E7D785F@psf.io> https://hg.python.org/cpython/rev/383c0238b5b0 changeset: 106488:383c0238b5b0 branch: 3.6 parent: 106486:c5267272e66a user: Victor Stinner date: Fri Feb 10 10:34:02 2017 +0100 summary: Fix datetime.fromtimestamp(): check bounds Issue #29100: Fix datetime.fromtimestamp() regression introduced in Python 3.6.0: check minimum and maximum years. files: Lib/test/datetimetester.py | 36 +++++++++++++++ Misc/NEWS | 3 + Modules/_datetimemodule.c | 61 +++++++++++++++++-------- 3 files changed, 79 insertions(+), 21 deletions(-) diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -1989,6 +1989,42 @@ self.assertEqual(t.second, 0) self.assertEqual(t.microsecond, 7812) + def test_timestamp_limits(self): + # minimum timestamp + min_dt = self.theclass.min.replace(tzinfo=timezone.utc) + min_ts = min_dt.timestamp() + # date 0001-01-01 00:00:00+00:00: timestamp=-62135596800 + self.assertEqual(self.theclass.fromtimestamp(min_ts, tz=timezone.utc), + min_dt) + + # maximum timestamp: set seconds to zero to avoid rounding issues + max_dt = self.theclass.max.replace(tzinfo=timezone.utc, + second=0, microsecond=0) + max_ts = max_dt.timestamp() + # date 9999-12-31 23:59:00+00:00: timestamp 253402300740 + self.assertEqual(self.theclass.fromtimestamp(max_ts, tz=timezone.utc), + max_dt) + + # number of seconds greater than 1 year: make sure that the new date + # is not valid in datetime.datetime limits + delta = 3600 * 24 * 400 + + # too small + ts = min_ts - delta + # converting a Python int to C time_t can raise a OverflowError, + # especially on 32-bit platforms. + with self.assertRaises((ValueError, OverflowError)): + self.theclass.fromtimestamp(ts) + with self.assertRaises((ValueError, OverflowError)): + self.theclass.utcfromtimestamp(ts) + + # too big + ts = max_dt.timestamp() + delta + with self.assertRaises((ValueError, OverflowError)): + self.theclass.fromtimestamp(ts) + with self.assertRaises((ValueError, OverflowError)): + self.theclass.utcfromtimestamp(ts) + def test_insane_fromtimestamp(self): # It's possible that some platform maps time_t to double, # and that this test will fail there. This test should diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -57,6 +57,9 @@ Library ------- +- Issue #29100: Fix datetime.fromtimestamp() regression introduced in Python + 3.6.0: check minimum and maximum years. + - Issue #29519: Fix weakref spewing exceptions during interpreter shutdown when used with a rare combination of multiprocessing and custom codecs. diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -120,6 +120,8 @@ static PyTypeObject PyDateTime_TZInfoType; static PyTypeObject PyDateTime_TimeZoneType; +static int check_tzinfo_subclass(PyObject *p); + _Py_IDENTIFIER(as_integer_ratio); _Py_IDENTIFIER(fromutc); _Py_IDENTIFIER(isoformat); @@ -400,8 +402,7 @@ { if (year < MINYEAR || year > MAXYEAR) { - PyErr_SetString(PyExc_ValueError, - "year is out of range"); + PyErr_Format(PyExc_ValueError, "year %i is out of range", year); return -1; } if (month < 1 || month > 12) { @@ -672,6 +673,10 @@ { PyDateTime_Date *self; + if (check_date_args(year, month, day) < 0) { + return NULL; + } + self = (PyDateTime_Date *) (type->tp_alloc(type, 0)); if (self != NULL) set_date_fields(self, year, month, day); @@ -689,6 +694,16 @@ PyDateTime_DateTime *self; char aware = tzinfo != Py_None; + if (check_date_args(year, month, day) < 0) { + return NULL; + } + if (check_time_args(hour, minute, second, usecond, fold) < 0) { + return NULL; + } + if (check_tzinfo_subclass(tzinfo) < 0) { + return NULL; + } + self = (PyDateTime_DateTime *) (type->tp_alloc(type, aware)); if (self != NULL) { self->hastzinfo = aware; @@ -726,6 +741,13 @@ PyDateTime_Time *self; char aware = tzinfo != Py_None; + if (check_time_args(hour, minute, second, usecond, fold) < 0) { + return NULL; + } + if (check_tzinfo_subclass(tzinfo) < 0) { + return NULL; + } + self = (PyDateTime_Time *) (type->tp_alloc(type, aware)); if (self != NULL) { self->hastzinfo = aware; @@ -2500,8 +2522,6 @@ if (PyArg_ParseTupleAndKeywords(args, kw, "iii", date_kws, &year, &month, &day)) { - if (check_date_args(year, month, day) < 0) - return NULL; self = new_date_ex(year, month, day, type); } return self; @@ -3586,10 +3606,6 @@ if (PyArg_ParseTupleAndKeywords(args, kw, "|iiiiO$i", time_kws, &hour, &minute, &second, &usecond, &tzinfo, &fold)) { - if (check_time_args(hour, minute, second, usecond, fold) < 0) - return NULL; - if (check_tzinfo_subclass(tzinfo) < 0) - return NULL; self = new_time_ex2(hour, minute, second, usecond, tzinfo, fold, type); } @@ -4176,12 +4192,6 @@ if (PyArg_ParseTupleAndKeywords(args, kw, "iii|iiiiO$i", datetime_kws, &year, &month, &day, &hour, &minute, &second, &usecond, &tzinfo, &fold)) { - if (check_date_args(year, month, day) < 0) - return NULL; - if (check_time_args(hour, minute, second, usecond, fold) < 0) - return NULL; - if (check_tzinfo_subclass(tzinfo) < 0) - return NULL; self = new_datetime_ex2(year, month, day, hour, minute, second, usecond, tzinfo, fold, type); @@ -4203,7 +4213,15 @@ utc_to_seconds(int year, int month, int day, int hour, int minute, int second) { - long long ordinal = ymd_to_ord(year, month, day); + long long ordinal; + + /* ymd_to_ord() doesn't support year <= 0 */ + if (year < MINYEAR || year > MAXYEAR) { + PyErr_Format(PyExc_ValueError, "year %i is out of range", year); + return -1; + } + + ordinal = ymd_to_ord(year, month, day); return ((ordinal * 24 + hour) * 60 + minute) * 60 + second; } @@ -4219,7 +4237,6 @@ "timestamp out of range for platform time_t"); return -1; } - /* XXX: add bounds checking */ if (_PyTime_localtime(t, &local_time) != 0) return -1; return utc_to_seconds(local_time.tm_year + 1900, @@ -4257,6 +4274,7 @@ */ second = Py_MIN(59, tm.tm_sec); + /* local timezone requires to compute fold */ if (tzinfo == Py_None && f == _PyTime_localtime) { long long probe_seconds, result_seconds, transition; @@ -4516,12 +4534,13 @@ assert(factor == 1 || factor == -1); if (normalize_datetime(&year, &month, &day, - &hour, &minute, &second, µsecond) < 0) + &hour, &minute, &second, µsecond) < 0) { return NULL; - else - return new_datetime(year, month, day, - hour, minute, second, microsecond, - HASTZINFO(date) ? date->tzinfo : Py_None, 0); + } + + return new_datetime(year, month, day, + hour, minute, second, microsecond, + HASTZINFO(date) ? date->tzinfo : Py_None, 0); } static PyObject * -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Feb 10 04:35:00 2017 From: python-checkins at python.org (victor.stinner) Date: Fri, 10 Feb 2017 09:35:00 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy42?= Message-ID: <20170210093500.99809.42934.010600D1@psf.io> https://hg.python.org/cpython/rev/ab25f53c5c25 changeset: 106489:ab25f53c5c25 parent: 106487:e91ec62da088 parent: 106488:383c0238b5b0 user: Victor Stinner date: Fri Feb 10 10:34:37 2017 +0100 summary: Merge 3.6 files: Lib/test/datetimetester.py | 36 +++++++++++++++ Misc/NEWS | 3 + Modules/_datetimemodule.c | 61 +++++++++++++++++-------- 3 files changed, 79 insertions(+), 21 deletions(-) diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -1989,6 +1989,42 @@ self.assertEqual(t.second, 0) self.assertEqual(t.microsecond, 7812) + def test_timestamp_limits(self): + # minimum timestamp + min_dt = self.theclass.min.replace(tzinfo=timezone.utc) + min_ts = min_dt.timestamp() + # date 0001-01-01 00:00:00+00:00: timestamp=-62135596800 + self.assertEqual(self.theclass.fromtimestamp(min_ts, tz=timezone.utc), + min_dt) + + # maximum timestamp: set seconds to zero to avoid rounding issues + max_dt = self.theclass.max.replace(tzinfo=timezone.utc, + second=0, microsecond=0) + max_ts = max_dt.timestamp() + # date 9999-12-31 23:59:00+00:00: timestamp 253402300740 + self.assertEqual(self.theclass.fromtimestamp(max_ts, tz=timezone.utc), + max_dt) + + # number of seconds greater than 1 year: make sure that the new date + # is not valid in datetime.datetime limits + delta = 3600 * 24 * 400 + + # too small + ts = min_ts - delta + # converting a Python int to C time_t can raise a OverflowError, + # especially on 32-bit platforms. + with self.assertRaises((ValueError, OverflowError)): + self.theclass.fromtimestamp(ts) + with self.assertRaises((ValueError, OverflowError)): + self.theclass.utcfromtimestamp(ts) + + # too big + ts = max_dt.timestamp() + delta + with self.assertRaises((ValueError, OverflowError)): + self.theclass.fromtimestamp(ts) + with self.assertRaises((ValueError, OverflowError)): + self.theclass.utcfromtimestamp(ts) + def test_insane_fromtimestamp(self): # It's possible that some platform maps time_t to double, # and that this test will fail there. This test should diff --git a/Misc/NEWS b/Misc/NEWS --- a/Misc/NEWS +++ b/Misc/NEWS @@ -225,6 +225,9 @@ Library ------- +- Issue #29100: Fix datetime.fromtimestamp() regression introduced in Python + 3.6.0: check minimum and maximum years. + - Issue #29416: Prevent infinite loop in pathlib.Path.mkdir - Issue #29444: Fixed out-of-bounds buffer access in the group() method of diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -120,6 +120,8 @@ static PyTypeObject PyDateTime_TZInfoType; static PyTypeObject PyDateTime_TimeZoneType; +static int check_tzinfo_subclass(PyObject *p); + _Py_IDENTIFIER(as_integer_ratio); _Py_IDENTIFIER(fromutc); _Py_IDENTIFIER(isoformat); @@ -400,8 +402,7 @@ { if (year < MINYEAR || year > MAXYEAR) { - PyErr_SetString(PyExc_ValueError, - "year is out of range"); + PyErr_Format(PyExc_ValueError, "year %i is out of range", year); return -1; } if (month < 1 || month > 12) { @@ -672,6 +673,10 @@ { PyDateTime_Date *self; + if (check_date_args(year, month, day) < 0) { + return NULL; + } + self = (PyDateTime_Date *) (type->tp_alloc(type, 0)); if (self != NULL) set_date_fields(self, year, month, day); @@ -689,6 +694,16 @@ PyDateTime_DateTime *self; char aware = tzinfo != Py_None; + if (check_date_args(year, month, day) < 0) { + return NULL; + } + if (check_time_args(hour, minute, second, usecond, fold) < 0) { + return NULL; + } + if (check_tzinfo_subclass(tzinfo) < 0) { + return NULL; + } + self = (PyDateTime_DateTime *) (type->tp_alloc(type, aware)); if (self != NULL) { self->hastzinfo = aware; @@ -726,6 +741,13 @@ PyDateTime_Time *self; char aware = tzinfo != Py_None; + if (check_time_args(hour, minute, second, usecond, fold) < 0) { + return NULL; + } + if (check_tzinfo_subclass(tzinfo) < 0) { + return NULL; + } + self = (PyDateTime_Time *) (type->tp_alloc(type, aware)); if (self != NULL) { self->hastzinfo = aware; @@ -2511,8 +2533,6 @@ if (PyArg_ParseTupleAndKeywords(args, kw, "iii", date_kws, &year, &month, &day)) { - if (check_date_args(year, month, day) < 0) - return NULL; self = new_date_ex(year, month, day, type); } return self; @@ -3598,10 +3618,6 @@ if (PyArg_ParseTupleAndKeywords(args, kw, "|iiiiO$i", time_kws, &hour, &minute, &second, &usecond, &tzinfo, &fold)) { - if (check_time_args(hour, minute, second, usecond, fold) < 0) - return NULL; - if (check_tzinfo_subclass(tzinfo) < 0) - return NULL; self = new_time_ex2(hour, minute, second, usecond, tzinfo, fold, type); } @@ -4188,12 +4204,6 @@ if (PyArg_ParseTupleAndKeywords(args, kw, "iii|iiiiO$i", datetime_kws, &year, &month, &day, &hour, &minute, &second, &usecond, &tzinfo, &fold)) { - if (check_date_args(year, month, day) < 0) - return NULL; - if (check_time_args(hour, minute, second, usecond, fold) < 0) - return NULL; - if (check_tzinfo_subclass(tzinfo) < 0) - return NULL; self = new_datetime_ex2(year, month, day, hour, minute, second, usecond, tzinfo, fold, type); @@ -4215,7 +4225,15 @@ utc_to_seconds(int year, int month, int day, int hour, int minute, int second) { - long long ordinal = ymd_to_ord(year, month, day); + long long ordinal; + + /* ymd_to_ord() doesn't support year <= 0 */ + if (year < MINYEAR || year > MAXYEAR) { + PyErr_Format(PyExc_ValueError, "year %i is out of range", year); + return -1; + } + + ordinal = ymd_to_ord(year, month, day); return ((ordinal * 24 + hour) * 60 + minute) * 60 + second; } @@ -4231,7 +4249,6 @@ "timestamp out of range for platform time_t"); return -1; } - /* XXX: add bounds checking */ if (_PyTime_localtime(t, &local_time) != 0) return -1; return utc_to_seconds(local_time.tm_year + 1900, @@ -4269,6 +4286,7 @@ */ second = Py_MIN(59, tm.tm_sec); + /* local timezone requires to compute fold */ if (tzinfo == Py_None && f == _PyTime_localtime) { long long probe_seconds, result_seconds, transition; @@ -4528,12 +4546,13 @@ assert(factor == 1 || factor == -1); if (normalize_datetime(&year, &month, &day, - &hour, &minute, &second, µsecond) < 0) + &hour, &minute, &second, µsecond) < 0) { return NULL; - else - return new_datetime(year, month, day, - hour, minute, second, microsecond, - HASTZINFO(date) ? date->tzinfo : Py_None, 0); + } + + return new_datetime(year, month, day, + hour, minute, second, microsecond, + HASTZINFO(date) ? date->tzinfo : Py_None, 0); } static PyObject * -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Feb 10 05:45:48 2017 From: python-checkins at python.org (victor.stinner) Date: Fri, 10 Feb 2017 10:45:48 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogRml4IHRlc3RfZGF0?= =?utf-8?q?etime_on_system_with_32-bit_time=5Ft?= Message-ID: <20170210104548.53141.22262.6B29244A@psf.io> https://hg.python.org/cpython/rev/1c6b87b07586 changeset: 106490:1c6b87b07586 branch: 3.6 parent: 106488:383c0238b5b0 user: Victor Stinner date: Fri Feb 10 11:45:14 2017 +0100 summary: Fix test_datetime on system with 32-bit time_t Issue #29100: Catch OverflowError in the new test_timestamp_limits() test. files: Lib/test/datetimetester.py | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -1993,9 +1993,13 @@ # minimum timestamp min_dt = self.theclass.min.replace(tzinfo=timezone.utc) min_ts = min_dt.timestamp() - # date 0001-01-01 00:00:00+00:00: timestamp=-62135596800 - self.assertEqual(self.theclass.fromtimestamp(min_ts, tz=timezone.utc), - min_dt) + try: + # date 0001-01-01 00:00:00+00:00: timestamp=-62135596800 + self.assertEqual(self.theclass.fromtimestamp(min_ts, tz=timezone.utc), + min_dt) + except OverflowError as exc: + # the date 0001-01-01 doesn't fit into 32-bit time_t + self.skipTest(str(exc)) # maximum timestamp: set seconds to zero to avoid rounding issues max_dt = self.theclass.max.replace(tzinfo=timezone.utc, -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Feb 10 05:45:49 2017 From: python-checkins at python.org (victor.stinner) Date: Fri, 10 Feb 2017 10:45:49 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy42?= Message-ID: <20170210104549.3573.85360.BF9B3074@psf.io> https://hg.python.org/cpython/rev/a60a9bc02d1d changeset: 106491:a60a9bc02d1d parent: 106489:ab25f53c5c25 parent: 106490:1c6b87b07586 user: Victor Stinner date: Fri Feb 10 11:45:28 2017 +0100 summary: Merge 3.6 files: Lib/test/datetimetester.py | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -1993,9 +1993,13 @@ # minimum timestamp min_dt = self.theclass.min.replace(tzinfo=timezone.utc) min_ts = min_dt.timestamp() - # date 0001-01-01 00:00:00+00:00: timestamp=-62135596800 - self.assertEqual(self.theclass.fromtimestamp(min_ts, tz=timezone.utc), - min_dt) + try: + # date 0001-01-01 00:00:00+00:00: timestamp=-62135596800 + self.assertEqual(self.theclass.fromtimestamp(min_ts, tz=timezone.utc), + min_dt) + except OverflowError as exc: + # the date 0001-01-01 doesn't fit into 32-bit time_t + self.skipTest(str(exc)) # maximum timestamp: set seconds to zero to avoid rounding issues max_dt = self.theclass.max.replace(tzinfo=timezone.utc, -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Feb 10 06:38:30 2017 From: python-checkins at python.org (victor.stinner) Date: Fri, 10 Feb 2017 11:38:30 +0000 Subject: [Python-checkins] =?utf-8?b?Y3B5dGhvbiAoMy42KTogRml4IHRlc3RfZGF0?= =?utf-8?q?etime_on_Windows?= Message-ID: <20170210113829.125733.34296.1C40FC64@psf.io> https://hg.python.org/cpython/rev/1555e7776321 changeset: 106492:1555e7776321 branch: 3.6 parent: 106490:1c6b87b07586 user: Victor Stinner date: Fri Feb 10 12:37:21 2017 +0100 summary: Fix test_datetime on Windows Issue #29100: On Windows, datetime.datetime.fromtimestamp(min_ts) fails with an OSError in test_timestamp_limits(). files: Lib/test/datetimetester.py | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -1997,8 +1997,9 @@ # date 0001-01-01 00:00:00+00:00: timestamp=-62135596800 self.assertEqual(self.theclass.fromtimestamp(min_ts, tz=timezone.utc), min_dt) - except OverflowError as exc: - # the date 0001-01-01 doesn't fit into 32-bit time_t + except (OverflowError, OSError) as exc: + # the date 0001-01-01 doesn't fit into 32-bit time_t, + # or platform doesn't support such very old date self.skipTest(str(exc)) # maximum timestamp: set seconds to zero to avoid rounding issues -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Feb 10 06:38:30 2017 From: python-checkins at python.org (victor.stinner) Date: Fri, 10 Feb 2017 11:38:30 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=28merge_3=2E6_-=3E_default?= =?utf-8?b?KTogTWVyZ2UgMy42?= Message-ID: <20170210113830.62694.98966.6D820C42@psf.io> https://hg.python.org/cpython/rev/6bd09ab4d6d6 changeset: 106493:6bd09ab4d6d6 parent: 106491:a60a9bc02d1d parent: 106492:1555e7776321 user: Victor Stinner date: Fri Feb 10 12:38:02 2017 +0100 summary: Merge 3.6 files: Lib/test/datetimetester.py | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -1997,8 +1997,9 @@ # date 0001-01-01 00:00:00+00:00: timestamp=-62135596800 self.assertEqual(self.theclass.fromtimestamp(min_ts, tz=timezone.utc), min_dt) - except OverflowError as exc: - # the date 0001-01-01 doesn't fit into 32-bit time_t + except (OverflowError, OSError) as exc: + # the date 0001-01-01 doesn't fit into 32-bit time_t, + # or platform doesn't support such very old date self.skipTest(str(exc)) # maximum timestamp: set seconds to zero to avoid rounding issues -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Feb 10 08:15:37 2017 From: python-checkins at python.org (victor.stinner) Date: Fri, 10 Feb 2017 13:15:37 +0000 Subject: [Python-checkins] =?utf-8?q?cpython_=282=2E7=29=3A_Backport_test?= =?utf-8?q?=5Fgdb_fixes_for_s390x_buildbots?= Message-ID: <20170210131537.125733.64953.DFEBCE72@psf.io> https://hg.python.org/cpython/rev/54c93e0fe79b changeset: 106495:54c93e0fe79b branch: 2.7 parent: 106476:b07d454e45a2 user: Victor Stinner date: Fri Feb 10 14:14:04 2017 +0100 summary: Backport test_gdb fixes for s390x buildbots files: Lib/test/test_gdb.py | 24 +++++++----------------- 1 files changed, 7 insertions(+), 17 deletions(-) diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py --- a/Lib/test/test_gdb.py +++ b/Lib/test/test_gdb.py @@ -203,27 +203,17 @@ # Ignore some benign messages on stderr. ignore_patterns = ( 'Function "%s" not defined.' % breakpoint, - "warning: no loadable sections found in added symbol-file" - " system-supplied DSO", - "warning: Unable to find libthread_db matching" - " inferior's thread library, thread debugging will" - " not be available.", - "warning: Cannot initialize thread debugging" - " library: Debugger service failed", - 'warning: Could not load shared library symbols for ' - 'linux-vdso.so', - 'warning: Could not load shared library symbols for ' - 'linux-gate.so', - 'warning: Could not load shared library symbols for ' - 'linux-vdso64.so', 'Do you need "set solib-search-path" or ' '"set sysroot"?', - 'warning: Source file is more recent than executable.', - # Issue #19753: missing symbols on System Z - 'Missing separate debuginfo for ', - 'Try: zypper install -C ', + # BFD: /usr/lib/debug/(...): unable to initialize decompress + # status for section .debug_aranges + 'BFD: ', + # ignore all warnings + 'warning: ', ) for line in errlines: + if not line: + continue if not line.startswith(ignore_patterns): unexpected_errlines.append(line) -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Feb 10 08:15:36 2017 From: python-checkins at python.org (victor.stinner) Date: Fri, 10 Feb 2017 13:15:36 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Issue_=2329465=3A_Add_Obje?= =?utf-8?q?cts/call=2Ec_file?= Message-ID: <20170210131536.99373.53340.9048C96C@psf.io> https://hg.python.org/cpython/rev/f23fa1f7b68f changeset: 106494:f23fa1f7b68f user: Victor Stinner date: Fri Feb 10 13:32:29 2017 +0100 summary: Issue #29465: Add Objects/call.c file * Move all functions to call objects in a new Objects/call.c file. * Rename fast_function() to _PyFunction_FastCallKeywords(). * Copy null_error() from Objects/abstract.c * Inline type_error() in call.c to not have to copy it, it was only called once. * Export _PyEval_EvalCodeWithName() since it is now called from call.c. files: Include/eval.h | 22 +- Makefile.pre.in | 1 + Objects/abstract.c | 725 ------------ Objects/call.c | 1368 ++++++++++++++++++++++++ Objects/methodobject.c | 323 ----- PCbuild/pythoncore.vcxproj | 3 +- Python/ceval.c | 242 +---- Python/modsupport.c | 51 - 8 files changed, 1390 insertions(+), 1345 deletions(-) diff --git a/Include/eval.h b/Include/eval.h --- a/Include/eval.h +++ b/Include/eval.h @@ -10,14 +10,24 @@ PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyObject *, PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyObject *co, - PyObject *globals, - PyObject *locals, - PyObject **args, int argc, - PyObject **kwds, int kwdc, - PyObject **defs, int defc, - PyObject *kwdefs, PyObject *closure); + PyObject *globals, + PyObject *locals, + PyObject **args, int argc, + PyObject **kwds, int kwdc, + PyObject **defs, int defc, + PyObject *kwdefs, PyObject *closure); #ifndef Py_LIMITED_API +PyAPI_FUNC(PyObject *) _PyEval_EvalCodeWithName( + PyObject *co, + PyObject *globals, PyObject *locals, + PyObject **args, Py_ssize_t argcount, + PyObject **kwnames, PyObject **kwargs, + Py_ssize_t kwcount, int kwstep, + PyObject **defs, Py_ssize_t defcount, + PyObject *kwdefs, PyObject *closure, + PyObject *name, PyObject *qualname); + PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args); #endif diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -409,6 +409,7 @@ Objects/bytes_methods.o \ Objects/bytearrayobject.o \ Objects/bytesobject.o \ + Objects/call.o \ Objects/cellobject.o \ Objects/classobject.o \ Objects/codeobject.o \ diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2168,731 +2168,6 @@ return fast; } -/* Operations on callable objects */ - -/* XXX PyCallable_Check() is in object.c */ - -PyObject * -PyObject_CallObject(PyObject *callable, PyObject *args) -{ - return PyEval_CallObjectWithKeywords(callable, args, NULL); -} - -PyObject* -_Py_CheckFunctionResult(PyObject *callable, PyObject *result, const char *where) -{ - int err_occurred = (PyErr_Occurred() != NULL); - - assert((callable != NULL) ^ (where != NULL)); - - if (result == NULL) { - if (!err_occurred) { - if (callable) - PyErr_Format(PyExc_SystemError, - "%R returned NULL without setting an error", - callable); - else - PyErr_Format(PyExc_SystemError, - "%s returned NULL without setting an error", - where); -#ifdef Py_DEBUG - /* Ensure that the bug is caught in debug mode */ - Py_FatalError("a function returned NULL without setting an error"); -#endif - return NULL; - } - } - else { - if (err_occurred) { - Py_DECREF(result); - - if (callable) { - _PyErr_FormatFromCause(PyExc_SystemError, - "%R returned a result with an error set", - callable); - } - else { - _PyErr_FormatFromCause(PyExc_SystemError, - "%s returned a result with an error set", - where); - } -#ifdef Py_DEBUG - /* Ensure that the bug is caught in debug mode */ - Py_FatalError("a function returned a result with an error set"); -#endif - return NULL; - } - } - return result; -} - -PyObject * -PyObject_Call(PyObject *callable, PyObject *args, PyObject *kwargs) -{ - ternaryfunc call; - PyObject *result; - - /* PyObject_Call() must not be called with an exception set, - because it can clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - assert(PyTuple_Check(args)); - assert(kwargs == NULL || PyDict_Check(kwargs)); - - if (PyFunction_Check(callable)) { - return _PyFunction_FastCallDict(callable, - &PyTuple_GET_ITEM(args, 0), - PyTuple_GET_SIZE(args), - kwargs); - } - else if (PyCFunction_Check(callable)) { - return PyCFunction_Call(callable, args, kwargs); - } - else { - call = callable->ob_type->tp_call; - if (call == NULL) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable", - callable->ob_type->tp_name); - return NULL; - } - - if (Py_EnterRecursiveCall(" while calling a Python object")) - return NULL; - - result = (*call)(callable, args, kwargs); - - Py_LeaveRecursiveCall(); - - return _Py_CheckFunctionResult(callable, result, NULL); - } -} - -/* Issue #29234: Inlining _PyStack_AsTuple() into callers increases their - stack consumption, Disable inlining to optimize the stack consumption. */ -PyObject* _Py_NO_INLINE -_PyStack_AsTuple(PyObject **stack, Py_ssize_t nargs) -{ - PyObject *args; - Py_ssize_t i; - - args = PyTuple_New(nargs); - if (args == NULL) { - return NULL; - } - - for (i=0; i < nargs; i++) { - PyObject *item = stack[i]; - Py_INCREF(item); - PyTuple_SET_ITEM(args, i, item); - } - return args; -} - -PyObject* -_PyStack_AsTupleSlice(PyObject **stack, Py_ssize_t nargs, - Py_ssize_t start, Py_ssize_t end) -{ - PyObject *args; - Py_ssize_t i; - - assert(0 <= start); - assert(end <= nargs); - assert(start <= end); - - args = PyTuple_New(end - start); - if (args == NULL) { - return NULL; - } - - for (i=start; i < end; i++) { - PyObject *item = stack[i]; - Py_INCREF(item); - PyTuple_SET_ITEM(args, i - start, item); - } - return args; -} - -PyObject * -_PyObject_FastCallDict(PyObject *callable, PyObject **args, Py_ssize_t nargs, - PyObject *kwargs) -{ - /* _PyObject_FastCallDict() must not be called with an exception set, - because it can clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - - assert(callable != NULL); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - assert(kwargs == NULL || PyDict_Check(kwargs)); - - if (PyFunction_Check(callable)) { - return _PyFunction_FastCallDict(callable, args, nargs, kwargs); - } - else if (PyCFunction_Check(callable)) { - return _PyCFunction_FastCallDict(callable, args, nargs, kwargs); - } - else { - PyObject *argstuple, *result; - ternaryfunc call; - - /* Slow-path: build a temporary tuple */ - call = callable->ob_type->tp_call; - if (call == NULL) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable", - callable->ob_type->tp_name); - return NULL; - } - - argstuple = _PyStack_AsTuple(args, nargs); - if (argstuple == NULL) { - return NULL; - } - - if (Py_EnterRecursiveCall(" while calling a Python object")) { - Py_DECREF(argstuple); - return NULL; - } - - result = (*call)(callable, argstuple, kwargs); - - Py_LeaveRecursiveCall(); - Py_DECREF(argstuple); - - result = _Py_CheckFunctionResult(callable, result, NULL); - return result; - } -} - -/* Positional arguments are obj followed by args: - call callable(obj, *args, **kwargs) */ -PyObject * -_PyObject_FastCall_Prepend(PyObject *callable, - PyObject *obj, PyObject **args, Py_ssize_t nargs) -{ - PyObject *small_stack[_PY_FASTCALL_SMALL_STACK]; - PyObject **args2; - PyObject *result; - - nargs++; - if (nargs <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) { - args2 = small_stack; - } - else { - args2 = PyMem_Malloc(nargs * sizeof(PyObject *)); - if (args2 == NULL) { - PyErr_NoMemory(); - return NULL; - } - } - - /* use borrowed references */ - args2[0] = obj; - memcpy(&args2[1], - args, - (nargs - 1)* sizeof(PyObject *)); - - result = _PyObject_FastCall(callable, args2, nargs); - if (args2 != small_stack) { - PyMem_Free(args2); - } - return result; -} - - -/* Call callable(obj, *args, **kwargs). */ -PyObject * -_PyObject_Call_Prepend(PyObject *callable, - PyObject *obj, PyObject *args, PyObject *kwargs) -{ - PyObject *small_stack[_PY_FASTCALL_SMALL_STACK]; - PyObject **stack; - Py_ssize_t argcount; - PyObject *result; - - assert(PyTuple_Check(args)); - - argcount = PyTuple_GET_SIZE(args); - if (argcount + 1 <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) { - stack = small_stack; - } - else { - stack = PyMem_Malloc((argcount + 1) * sizeof(PyObject *)); - if (stack == NULL) { - PyErr_NoMemory(); - return NULL; - } - } - - /* use borrowed references */ - stack[0] = obj; - memcpy(&stack[1], - &PyTuple_GET_ITEM(args, 0), - argcount * sizeof(PyObject *)); - - result = _PyObject_FastCallDict(callable, - stack, argcount + 1, - kwargs); - if (stack != small_stack) { - PyMem_Free(stack); - } - return result; -} - -PyObject * -_PyStack_AsDict(PyObject **values, PyObject *kwnames) -{ - Py_ssize_t nkwargs; - PyObject *kwdict; - Py_ssize_t i; - - assert(kwnames != NULL); - nkwargs = PyTuple_GET_SIZE(kwnames); - kwdict = _PyDict_NewPresized(nkwargs); - if (kwdict == NULL) { - return NULL; - } - - for (i = 0; i < nkwargs; i++) { - PyObject *key = PyTuple_GET_ITEM(kwnames, i); - PyObject *value = *values++; - /* If key already exists, replace it with the new value */ - if (PyDict_SetItem(kwdict, key, value)) { - Py_DECREF(kwdict); - return NULL; - } - } - return kwdict; -} - -int -_PyStack_UnpackDict(PyObject **args, Py_ssize_t nargs, PyObject *kwargs, - PyObject ***p_stack, PyObject **p_kwnames) -{ - PyObject **stack, **kwstack; - Py_ssize_t nkwargs; - Py_ssize_t pos, i; - PyObject *key, *value; - PyObject *kwnames; - - assert(nargs >= 0); - assert(kwargs == NULL || PyDict_CheckExact(kwargs)); - - if (kwargs == NULL || (nkwargs = PyDict_GET_SIZE(kwargs)) == 0) { - *p_stack = args; - *p_kwnames = NULL; - return 0; - } - - if ((size_t)nargs > PY_SSIZE_T_MAX / sizeof(stack[0]) - (size_t)nkwargs) { - PyErr_NoMemory(); - return -1; - } - - stack = PyMem_Malloc((nargs + nkwargs) * sizeof(stack[0])); - if (stack == NULL) { - PyErr_NoMemory(); - return -1; - } - - kwnames = PyTuple_New(nkwargs); - if (kwnames == NULL) { - PyMem_Free(stack); - return -1; - } - - /* Copy position arguments (borrowed references) */ - memcpy(stack, args, nargs * sizeof(stack[0])); - - kwstack = stack + nargs; - pos = i = 0; - /* This loop doesn't support lookup function mutating the dictionary - to change its size. It's a deliberate choice for speed, this function is - called in the performance critical hot code. */ - while (PyDict_Next(kwargs, &pos, &key, &value)) { - Py_INCREF(key); - PyTuple_SET_ITEM(kwnames, i, key); - /* The stack contains borrowed references */ - kwstack[i] = value; - i++; - } - - *p_stack = stack; - *p_kwnames = kwnames; - return 0; -} - -PyObject * -_PyObject_FastCallKeywords(PyObject *callable, PyObject **stack, Py_ssize_t nargs, - PyObject *kwnames) -{ - /* _PyObject_FastCallKeywords() must not be called with an exception set, - because it can clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - - assert(nargs >= 0); - assert(kwnames == NULL || PyTuple_CheckExact(kwnames)); - - /* kwnames must only contains str strings, no subclass, and all keys must - be unique: these checks are implemented in Python/ceval.c and - _PyArg_ParseStackAndKeywords(). */ - - if (PyFunction_Check(callable)) { - return _PyFunction_FastCallKeywords(callable, stack, nargs, kwnames); - } - if (PyCFunction_Check(callable)) { - return _PyCFunction_FastCallKeywords(callable, stack, nargs, kwnames); - } - else { - /* Slow-path: build a temporary tuple for positional arguments and a - temporary dictionary for keyword arguments (if any) */ - - ternaryfunc call; - PyObject *argstuple; - PyObject *kwdict, *result; - Py_ssize_t nkwargs; - - nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames); - assert((nargs == 0 && nkwargs == 0) || stack != NULL); - - call = callable->ob_type->tp_call; - if (call == NULL) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable", - callable->ob_type->tp_name); - return NULL; - } - - argstuple = _PyStack_AsTuple(stack, nargs); - if (argstuple == NULL) { - return NULL; - } - - if (nkwargs > 0) { - kwdict = _PyStack_AsDict(stack + nargs, kwnames); - if (kwdict == NULL) { - Py_DECREF(argstuple); - return NULL; - } - } - else { - kwdict = NULL; - } - - if (Py_EnterRecursiveCall(" while calling a Python object")) { - Py_DECREF(argstuple); - Py_XDECREF(kwdict); - return NULL; - } - - result = (*call)(callable, argstuple, kwdict); - - Py_LeaveRecursiveCall(); - - Py_DECREF(argstuple); - Py_XDECREF(kwdict); - - result = _Py_CheckFunctionResult(callable, result, NULL); - return result; - } -} - -static PyObject * -_PyObject_CallFunctionVa(PyObject *callable, const char *format, - va_list va, int is_size_t) -{ - PyObject* small_stack[_PY_FASTCALL_SMALL_STACK]; - const Py_ssize_t small_stack_len = Py_ARRAY_LENGTH(small_stack); - PyObject **stack; - Py_ssize_t nargs, i; - PyObject *result; - - if (callable == NULL) { - return null_error(); - } - - if (!format || !*format) { - return _PyObject_CallNoArg(callable); - } - - if (is_size_t) { - stack = _Py_VaBuildStack_SizeT(small_stack, small_stack_len, - format, va, &nargs); - } - else { - stack = _Py_VaBuildStack(small_stack, small_stack_len, - format, va, &nargs); - } - if (stack == NULL) { - return NULL; - } - - if (nargs == 1 && PyTuple_Check(stack[0])) { - /* Special cases for backward compatibility: - - PyObject_CallFunction(func, "O", tuple) calls func(*tuple) - - PyObject_CallFunction(func, "(OOO)", arg1, arg2, arg3) calls - func(*(arg1, arg2, arg3)): func(arg1, arg2, arg3) */ - PyObject *args = stack[0]; - result = _PyObject_FastCall(callable, - &PyTuple_GET_ITEM(args, 0), - PyTuple_GET_SIZE(args)); - } - else { - result = _PyObject_FastCall(callable, stack, nargs); - } - - for (i = 0; i < nargs; ++i) { - Py_DECREF(stack[i]); - } - if (stack != small_stack) { - PyMem_Free(stack); - } - return result; -} - -PyObject * -PyObject_CallFunction(PyObject *callable, const char *format, ...) -{ - va_list va; - PyObject *result; - - va_start(va, format); - result = _PyObject_CallFunctionVa(callable, format, va, 0); - va_end(va); - - return result; -} - -PyObject * -_PyObject_CallFunction_SizeT(PyObject *callable, const char *format, ...) -{ - va_list va; - PyObject *result; - - va_start(va, format); - result = _PyObject_CallFunctionVa(callable, format, va, 1); - va_end(va); - - return result; -} - -static PyObject* -callmethod(PyObject* callable, const char *format, va_list va, int is_size_t) -{ - assert(callable != NULL); - - if (!PyCallable_Check(callable)) { - type_error("attribute of type '%.200s' is not callable", callable); - return NULL; - } - - return _PyObject_CallFunctionVa(callable, format, va, is_size_t); -} - -PyObject * -PyObject_CallMethod(PyObject *obj, const char *name, const char *format, ...) -{ - va_list va; - PyObject *callable, *retval; - - if (obj == NULL || name == NULL) { - return null_error(); - } - - callable = PyObject_GetAttrString(obj, name); - if (callable == NULL) - return NULL; - - va_start(va, format); - retval = callmethod(callable, format, va, 0); - va_end(va); - - Py_DECREF(callable); - return retval; -} - -PyObject * -_PyObject_CallMethodId(PyObject *obj, _Py_Identifier *name, - const char *format, ...) -{ - va_list va; - PyObject *callable, *retval; - - if (obj == NULL || name == NULL) { - return null_error(); - } - - callable = _PyObject_GetAttrId(obj, name); - if (callable == NULL) - return NULL; - - va_start(va, format); - retval = callmethod(callable, format, va, 0); - va_end(va); - - Py_DECREF(callable); - return retval; -} - -PyObject * -_PyObject_CallMethod_SizeT(PyObject *obj, const char *name, - const char *format, ...) -{ - va_list va; - PyObject *callable, *retval; - - if (obj == NULL || name == NULL) { - return null_error(); - } - - callable = PyObject_GetAttrString(obj, name); - if (callable == NULL) - return NULL; - - va_start(va, format); - retval = callmethod(callable, format, va, 1); - va_end(va); - - Py_DECREF(callable); - return retval; -} - -PyObject * -_PyObject_CallMethodId_SizeT(PyObject *obj, _Py_Identifier *name, - const char *format, ...) -{ - va_list va; - PyObject *callable, *retval; - - if (obj == NULL || name == NULL) { - return null_error(); - } - - callable = _PyObject_GetAttrId(obj, name); - if (callable == NULL) { - return NULL; - } - - va_start(va, format); - retval = callmethod(callable, format, va, 1); - va_end(va); - - Py_DECREF(callable); - return retval; -} - -static PyObject * -object_vacall(PyObject *callable, va_list vargs) -{ - PyObject *small_stack[_PY_FASTCALL_SMALL_STACK]; - PyObject **stack; - Py_ssize_t nargs; - PyObject *result; - Py_ssize_t i; - va_list countva; - - if (callable == NULL) { - return null_error(); - } - - /* Count the number of arguments */ - va_copy(countva, vargs); - nargs = 0; - while (1) { - PyObject *arg = va_arg(countva, PyObject *); - if (arg == NULL) { - break; - } - nargs++; - } - va_end(countva); - - /* Copy arguments */ - if (nargs <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) { - stack = small_stack; - } - else { - stack = PyMem_Malloc(nargs * sizeof(stack[0])); - if (stack == NULL) { - PyErr_NoMemory(); - return NULL; - } - } - - for (i = 0; i < nargs; ++i) { - stack[i] = va_arg(vargs, PyObject *); - } - - /* Call the function */ - result = _PyObject_FastCall(callable, stack, nargs); - - if (stack != small_stack) { - PyMem_Free(stack); - } - return result; -} - -PyObject * -PyObject_CallMethodObjArgs(PyObject *callable, PyObject *name, ...) -{ - va_list vargs; - PyObject *result; - - if (callable == NULL || name == NULL) { - return null_error(); - } - - callable = PyObject_GetAttr(callable, name); - if (callable == NULL) { - return NULL; - } - - va_start(vargs, name); - result = object_vacall(callable, vargs); - va_end(vargs); - - Py_DECREF(callable); - return result; -} - -PyObject * -_PyObject_CallMethodIdObjArgs(PyObject *obj, - struct _Py_Identifier *name, ...) -{ - va_list vargs; - PyObject *callable, *result; - - if (obj == NULL || name == NULL) { - return null_error(); - } - - callable = _PyObject_GetAttrId(obj, name); - if (callable == NULL) { - return NULL; - } - - va_start(vargs, name); - result = object_vacall(callable, vargs); - va_end(vargs); - - Py_DECREF(callable); - return result; -} - -PyObject * -PyObject_CallFunctionObjArgs(PyObject *callable, ...) -{ - va_list vargs; - PyObject *result; - - va_start(vargs, callable); - result = object_vacall(callable, vargs); - va_end(vargs); - - return result; -} - - /* isinstance(), issubclass() */ /* abstract_get_bases() has logically 4 return states: diff --git a/Objects/call.c b/Objects/call.c new file mode 100644 --- /dev/null +++ b/Objects/call.c @@ -0,0 +1,1368 @@ +#include "Python.h" +#include "frameobject.h" + + +static PyObject * +null_error(void) +{ + if (!PyErr_Occurred()) + PyErr_SetString(PyExc_SystemError, + "null argument to internal routine"); + return NULL; +} + + +PyObject* +_Py_CheckFunctionResult(PyObject *callable, PyObject *result, const char *where) +{ + int err_occurred = (PyErr_Occurred() != NULL); + + assert((callable != NULL) ^ (where != NULL)); + + if (result == NULL) { + if (!err_occurred) { + if (callable) + PyErr_Format(PyExc_SystemError, + "%R returned NULL without setting an error", + callable); + else + PyErr_Format(PyExc_SystemError, + "%s returned NULL without setting an error", + where); +#ifdef Py_DEBUG + /* Ensure that the bug is caught in debug mode */ + Py_FatalError("a function returned NULL without setting an error"); +#endif + return NULL; + } + } + else { + if (err_occurred) { + Py_DECREF(result); + + if (callable) { + _PyErr_FormatFromCause(PyExc_SystemError, + "%R returned a result with an error set", + callable); + } + else { + _PyErr_FormatFromCause(PyExc_SystemError, + "%s returned a result with an error set", + where); + } +#ifdef Py_DEBUG + /* Ensure that the bug is caught in debug mode */ + Py_FatalError("a function returned a result with an error set"); +#endif + return NULL; + } + } + return result; +} + + +/* --- Core PyObject call functions ------------------------------- */ + +PyObject * +_PyObject_FastCallDict(PyObject *callable, PyObject **args, Py_ssize_t nargs, + PyObject *kwargs) +{ + /* _PyObject_FastCallDict() must not be called with an exception set, + because it can clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); + + assert(callable != NULL); + assert(nargs >= 0); + assert(nargs == 0 || args != NULL); + assert(kwargs == NULL || PyDict_Check(kwargs)); + + if (PyFunction_Check(callable)) { + return _PyFunction_FastCallDict(callable, args, nargs, kwargs); + } + else if (PyCFunction_Check(callable)) { + return _PyCFunction_FastCallDict(callable, args, nargs, kwargs); + } + else { + PyObject *argstuple, *result; + ternaryfunc call; + + /* Slow-path: build a temporary tuple */ + call = callable->ob_type->tp_call; + if (call == NULL) { + PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable", + callable->ob_type->tp_name); + return NULL; + } + + argstuple = _PyStack_AsTuple(args, nargs); + if (argstuple == NULL) { + return NULL; + } + + if (Py_EnterRecursiveCall(" while calling a Python object")) { + Py_DECREF(argstuple); + return NULL; + } + + result = (*call)(callable, argstuple, kwargs); + + Py_LeaveRecursiveCall(); + Py_DECREF(argstuple); + + result = _Py_CheckFunctionResult(callable, result, NULL); + return result; + } +} + + +PyObject * +_PyObject_FastCallKeywords(PyObject *callable, PyObject **stack, Py_ssize_t nargs, + PyObject *kwnames) +{ + /* _PyObject_FastCallKeywords() must not be called with an exception set, + because it can clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); + + assert(nargs >= 0); + assert(kwnames == NULL || PyTuple_CheckExact(kwnames)); + + /* kwnames must only contains str strings, no subclass, and all keys must + be unique: these checks are implemented in Python/ceval.c and + _PyArg_ParseStackAndKeywords(). */ + + if (PyFunction_Check(callable)) { + return _PyFunction_FastCallKeywords(callable, stack, nargs, kwnames); + } + if (PyCFunction_Check(callable)) { + return _PyCFunction_FastCallKeywords(callable, stack, nargs, kwnames); + } + else { + /* Slow-path: build a temporary tuple for positional arguments and a + temporary dictionary for keyword arguments (if any) */ + + ternaryfunc call; + PyObject *argstuple; + PyObject *kwdict, *result; + Py_ssize_t nkwargs; + + nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames); + assert((nargs == 0 && nkwargs == 0) || stack != NULL); + + call = callable->ob_type->tp_call; + if (call == NULL) { + PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable", + callable->ob_type->tp_name); + return NULL; + } + + argstuple = _PyStack_AsTuple(stack, nargs); + if (argstuple == NULL) { + return NULL; + } + + if (nkwargs > 0) { + kwdict = _PyStack_AsDict(stack + nargs, kwnames); + if (kwdict == NULL) { + Py_DECREF(argstuple); + return NULL; + } + } + else { + kwdict = NULL; + } + + if (Py_EnterRecursiveCall(" while calling a Python object")) { + Py_DECREF(argstuple); + Py_XDECREF(kwdict); + return NULL; + } + + result = (*call)(callable, argstuple, kwdict); + + Py_LeaveRecursiveCall(); + + Py_DECREF(argstuple); + Py_XDECREF(kwdict); + + result = _Py_CheckFunctionResult(callable, result, NULL); + return result; + } +} + + +PyObject * +PyObject_Call(PyObject *callable, PyObject *args, PyObject *kwargs) +{ + ternaryfunc call; + PyObject *result; + + /* PyObject_Call() must not be called with an exception set, + because it can clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); + assert(PyTuple_Check(args)); + assert(kwargs == NULL || PyDict_Check(kwargs)); + + if (PyFunction_Check(callable)) { + return _PyFunction_FastCallDict(callable, + &PyTuple_GET_ITEM(args, 0), + PyTuple_GET_SIZE(args), + kwargs); + } + else if (PyCFunction_Check(callable)) { + return PyCFunction_Call(callable, args, kwargs); + } + else { + call = callable->ob_type->tp_call; + if (call == NULL) { + PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable", + callable->ob_type->tp_name); + return NULL; + } + + if (Py_EnterRecursiveCall(" while calling a Python object")) + return NULL; + + result = (*call)(callable, args, kwargs); + + Py_LeaveRecursiveCall(); + + return _Py_CheckFunctionResult(callable, result, NULL); + } +} + + +/* --- PyFunction call functions ---------------------------------- */ + +static PyObject* _Py_HOT_FUNCTION +function_code_fastcall(PyCodeObject *co, PyObject **args, Py_ssize_t nargs, + PyObject *globals) +{ + PyFrameObject *f; + PyThreadState *tstate = PyThreadState_GET(); + PyObject **fastlocals; + Py_ssize_t i; + PyObject *result; + + assert(globals != NULL); + /* XXX Perhaps we should create a specialized + _PyFrame_New_NoTrack() that doesn't take locals, but does + take builtins without sanity checking them. + */ + assert(tstate != NULL); + f = _PyFrame_New_NoTrack(tstate, co, globals, NULL); + if (f == NULL) { + return NULL; + } + + fastlocals = f->f_localsplus; + + for (i = 0; i < nargs; i++) { + Py_INCREF(*args); + fastlocals[i] = *args++; + } + result = PyEval_EvalFrameEx(f,0); + + if (Py_REFCNT(f) > 1) { + Py_DECREF(f); + _PyObject_GC_TRACK(f); + } + else { + ++tstate->recursion_depth; + Py_DECREF(f); + --tstate->recursion_depth; + } + return result; +} + + +PyObject * +_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, + PyObject *kwargs) +{ + PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); + PyObject *globals = PyFunction_GET_GLOBALS(func); + PyObject *argdefs = PyFunction_GET_DEFAULTS(func); + PyObject *kwdefs, *closure, *name, *qualname; + PyObject *kwtuple, **k; + PyObject **d; + Py_ssize_t nd, nk; + PyObject *result; + + assert(func != NULL); + assert(nargs >= 0); + assert(nargs == 0 || args != NULL); + assert(kwargs == NULL || PyDict_Check(kwargs)); + + if (co->co_kwonlyargcount == 0 && + (kwargs == NULL || PyDict_GET_SIZE(kwargs) == 0) && + co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) + { + /* Fast paths */ + if (argdefs == NULL && co->co_argcount == nargs) { + return function_code_fastcall(co, args, nargs, globals); + } + else if (nargs == 0 && argdefs != NULL + && co->co_argcount == Py_SIZE(argdefs)) { + /* function called with no arguments, but all parameters have + a default value: use default values as arguments .*/ + args = &PyTuple_GET_ITEM(argdefs, 0); + return function_code_fastcall(co, args, Py_SIZE(argdefs), globals); + } + } + + nk = (kwargs != NULL) ? PyDict_GET_SIZE(kwargs) : 0; + if (nk != 0) { + Py_ssize_t pos, i; + + /* Issue #29318: Caller and callee functions must not share the + dictionary: kwargs must be copied. */ + kwtuple = PyTuple_New(2 * nk); + if (kwtuple == NULL) { + return NULL; + } + + k = &PyTuple_GET_ITEM(kwtuple, 0); + pos = i = 0; + while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { + /* We must hold strong references because keyword arguments can be + indirectly modified while the function is called: + see issue #2016 and test_extcall */ + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); + i += 2; + } + nk = i / 2; + } + else { + kwtuple = NULL; + k = NULL; + } + + kwdefs = PyFunction_GET_KW_DEFAULTS(func); + closure = PyFunction_GET_CLOSURE(func); + name = ((PyFunctionObject *)func) -> func_name; + qualname = ((PyFunctionObject *)func) -> func_qualname; + + if (argdefs != NULL) { + d = &PyTuple_GET_ITEM(argdefs, 0); + nd = Py_SIZE(argdefs); + } + else { + d = NULL; + nd = 0; + } + + result = _PyEval_EvalCodeWithName((PyObject*)co, globals, (PyObject *)NULL, + args, nargs, + k, k + 1, nk, 2, + d, nd, kwdefs, + closure, name, qualname); + Py_XDECREF(kwtuple); + return result; +} + +PyObject * +_PyFunction_FastCallKeywords(PyObject *func, PyObject **stack, + Py_ssize_t nargs, PyObject *kwnames) +{ + PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); + PyObject *globals = PyFunction_GET_GLOBALS(func); + PyObject *argdefs = PyFunction_GET_DEFAULTS(func); + PyObject *kwdefs, *closure, *name, *qualname; + PyObject **d; + Py_ssize_t nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames); + Py_ssize_t nd; + + assert(PyFunction_Check(func)); + assert(nargs >= 0); + assert(kwnames == NULL || PyTuple_CheckExact(kwnames)); + assert((nargs == 0 && nkwargs == 0) || stack != NULL); + /* kwnames must only contains str strings, no subclass, and all keys must + be unique */ + + if (co->co_kwonlyargcount == 0 && nkwargs == 0 && + co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) + { + if (argdefs == NULL && co->co_argcount == nargs) { + return function_code_fastcall(co, stack, nargs, globals); + } + else if (nargs == 0 && argdefs != NULL + && co->co_argcount == Py_SIZE(argdefs)) { + /* function called with no arguments, but all parameters have + a default value: use default values as arguments .*/ + stack = &PyTuple_GET_ITEM(argdefs, 0); + return function_code_fastcall(co, stack, Py_SIZE(argdefs), globals); + } + } + + kwdefs = PyFunction_GET_KW_DEFAULTS(func); + closure = PyFunction_GET_CLOSURE(func); + name = ((PyFunctionObject *)func) -> func_name; + qualname = ((PyFunctionObject *)func) -> func_qualname; + + if (argdefs != NULL) { + d = &PyTuple_GET_ITEM(argdefs, 0); + nd = Py_SIZE(argdefs); + } + else { + d = NULL; + nd = 0; + } + return _PyEval_EvalCodeWithName((PyObject*)co, globals, (PyObject *)NULL, + stack, nargs, + nkwargs ? &PyTuple_GET_ITEM(kwnames, 0) : NULL, + stack + nargs, + nkwargs, 1, + d, (int)nd, kwdefs, + closure, name, qualname); +} + + +/* --- PyCFunction call functions --------------------------------- */ + +PyObject * +_PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self, PyObject **args, + Py_ssize_t nargs, PyObject *kwargs) +{ + /* _PyMethodDef_RawFastCallDict() must not be called with an exception set, + because it can clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); + + assert(method != NULL); + assert(nargs >= 0); + assert(nargs == 0 || args != NULL); + assert(kwargs == NULL || PyDict_Check(kwargs)); + + PyCFunction meth = method->ml_meth; + int flags = method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST); + PyObject *result = NULL; + + if (Py_EnterRecursiveCall(" while calling a Python object")) { + return NULL; + } + + switch (flags) + { + case METH_NOARGS: + if (nargs != 0) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%zd given)", + method->ml_name, nargs); + goto exit; + } + + if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) { + goto no_keyword_error; + } + + result = (*meth) (self, NULL); + break; + + case METH_O: + if (nargs != 1) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%zd given)", + method->ml_name, nargs); + goto exit; + } + + if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) { + goto no_keyword_error; + } + + result = (*meth) (self, args[0]); + break; + + case METH_VARARGS: + if (!(flags & METH_KEYWORDS) + && kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) { + goto no_keyword_error; + } + /* fall through next case */ + + case METH_VARARGS | METH_KEYWORDS: + { + /* Slow-path: create a temporary tuple for positional arguments */ + PyObject *argstuple = _PyStack_AsTuple(args, nargs); + if (argstuple == NULL) { + goto exit; + } + + if (flags & METH_KEYWORDS) { + result = (*(PyCFunctionWithKeywords)meth) (self, argstuple, kwargs); + } + else { + result = (*meth) (self, argstuple); + } + Py_DECREF(argstuple); + break; + } + + case METH_FASTCALL: + { + PyObject **stack; + PyObject *kwnames; + _PyCFunctionFast fastmeth = (_PyCFunctionFast)meth; + + if (_PyStack_UnpackDict(args, nargs, kwargs, &stack, &kwnames) < 0) { + goto exit; + } + + result = (*fastmeth) (self, stack, nargs, kwnames); + if (stack != args) { + PyMem_Free(stack); + } + Py_XDECREF(kwnames); + break; + } + + default: + PyErr_SetString(PyExc_SystemError, + "Bad call flags in _PyMethodDef_RawFastCallDict. " + "METH_OLDARGS is no longer supported!"); + goto exit; + } + + goto exit; + +no_keyword_error: + PyErr_Format(PyExc_TypeError, + "%.200s() takes no keyword arguments", + method->ml_name, nargs); + +exit: + Py_LeaveRecursiveCall(); + return result; +} + + +PyObject * +_PyCFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, + PyObject *kwargs) +{ + PyObject *result; + + assert(func != NULL); + assert(PyCFunction_Check(func)); + + result = _PyMethodDef_RawFastCallDict(((PyCFunctionObject*)func)->m_ml, + PyCFunction_GET_SELF(func), + args, nargs, kwargs); + result = _Py_CheckFunctionResult(func, result, NULL); + return result; +} + + +PyObject * +_PyMethodDef_RawFastCallKeywords(PyMethodDef *method, PyObject *self, PyObject **args, + Py_ssize_t nargs, PyObject *kwnames) +{ + /* _PyMethodDef_RawFastCallKeywords() must not be called with an exception set, + because it can clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); + + assert(method != NULL); + assert(nargs >= 0); + assert(kwnames == NULL || PyTuple_CheckExact(kwnames)); + /* kwnames must only contains str strings, no subclass, and all keys must + be unique */ + + PyCFunction meth = method->ml_meth; + int flags = method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST); + Py_ssize_t nkwargs = kwnames == NULL ? 0 : PyTuple_Size(kwnames); + PyObject *result = NULL; + + if (Py_EnterRecursiveCall(" while calling a Python object")) { + return NULL; + } + + switch (flags) + { + case METH_NOARGS: + if (nargs != 0) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%zd given)", + method->ml_name, nargs); + goto exit; + } + + if (nkwargs) { + goto no_keyword_error; + } + + result = (*meth) (self, NULL); + break; + + case METH_O: + if (nargs != 1) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%zd given)", + method->ml_name, nargs); + goto exit; + } + + if (nkwargs) { + goto no_keyword_error; + } + + result = (*meth) (self, args[0]); + break; + + case METH_FASTCALL: + /* Fast-path: avoid temporary dict to pass keyword arguments */ + result = ((_PyCFunctionFast)meth) (self, args, nargs, kwnames); + break; + + case METH_VARARGS: + case METH_VARARGS | METH_KEYWORDS: + { + /* Slow-path: create a temporary tuple for positional arguments + and a temporary dict for keyword arguments */ + PyObject *argtuple; + + if (!(flags & METH_KEYWORDS) && nkwargs) { + goto no_keyword_error; + } + + argtuple = _PyStack_AsTuple(args, nargs); + if (argtuple == NULL) { + goto exit; + } + + if (flags & METH_KEYWORDS) { + PyObject *kwdict; + + if (nkwargs > 0) { + kwdict = _PyStack_AsDict(args + nargs, kwnames); + if (kwdict == NULL) { + Py_DECREF(argtuple); + goto exit; + } + } + else { + kwdict = NULL; + } + + result = (*(PyCFunctionWithKeywords)meth) (self, argtuple, kwdict); + Py_XDECREF(kwdict); + } + else { + result = (*meth) (self, argtuple); + } + Py_DECREF(argtuple); + break; + } + + default: + PyErr_SetString(PyExc_SystemError, + "Bad call flags in _PyCFunction_FastCallKeywords. " + "METH_OLDARGS is no longer supported!"); + goto exit; + } + + goto exit; + +no_keyword_error: + PyErr_Format(PyExc_TypeError, + "%.200s() takes no keyword arguments", + method->ml_name); + +exit: + Py_LeaveRecursiveCall(); + return result; +} + + +PyObject * +_PyCFunction_FastCallKeywords(PyObject *func, PyObject **args, + Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *result; + + assert(func != NULL); + assert(PyCFunction_Check(func)); + + result = _PyMethodDef_RawFastCallKeywords(((PyCFunctionObject*)func)->m_ml, + PyCFunction_GET_SELF(func), + args, nargs, kwnames); + result = _Py_CheckFunctionResult(func, result, NULL); + return result; +} + + +static PyObject * +cfunction_call_varargs(PyObject *func, PyObject *args, PyObject *kwargs) +{ + assert(!PyErr_Occurred()); + + PyCFunction meth = PyCFunction_GET_FUNCTION(func); + PyObject *self = PyCFunction_GET_SELF(func); + PyObject *result; + + if (PyCFunction_GET_FLAGS(func) & METH_KEYWORDS) { + if (Py_EnterRecursiveCall(" while calling a Python object")) { + return NULL; + } + + result = (*(PyCFunctionWithKeywords)meth)(self, args, kwargs); + + Py_LeaveRecursiveCall(); + } + else { + if (kwargs != NULL && PyDict_Size(kwargs) != 0) { + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + ((PyCFunctionObject*)func)->m_ml->ml_name); + return NULL; + } + + if (Py_EnterRecursiveCall(" while calling a Python object")) { + return NULL; + } + + result = (*meth)(self, args); + + Py_LeaveRecursiveCall(); + } + + return _Py_CheckFunctionResult(func, result, NULL); +} + + +PyObject * +PyCFunction_Call(PyObject *func, PyObject *args, PyObject *kwargs) +{ + /* first try METH_VARARGS to pass directly args tuple unchanged. + _PyMethodDef_RawFastCallDict() creates a new temporary tuple + for METH_VARARGS. */ + if (PyCFunction_GET_FLAGS(func) & METH_VARARGS) { + return cfunction_call_varargs(func, args, kwargs); + } + else { + return _PyCFunction_FastCallDict(func, + &PyTuple_GET_ITEM(args, 0), + PyTuple_GET_SIZE(args), + kwargs); + } +} + + +/* --- More complex call functions -------------------------------- */ + +/* External interface to call any callable object. + The args must be a tuple or NULL. The kwargs must be a dict or NULL. */ +PyObject * +PyEval_CallObjectWithKeywords(PyObject *callable, + PyObject *args, PyObject *kwargs) +{ +#ifdef Py_DEBUG + /* PyEval_CallObjectWithKeywords() must not be called with an exception + set. It raises a new exception if parameters are invalid or if + PyTuple_New() fails, and so the original exception is lost. */ + assert(!PyErr_Occurred()); +#endif + + if (args == NULL) { + return _PyObject_FastCallDict(callable, NULL, 0, kwargs); + } + + if (!PyTuple_Check(args)) { + PyErr_SetString(PyExc_TypeError, + "argument list must be a tuple"); + return NULL; + } + + if (kwargs != NULL && !PyDict_Check(kwargs)) { + PyErr_SetString(PyExc_TypeError, + "keyword list must be a dictionary"); + return NULL; + } + + return PyObject_Call(callable, args, kwargs); +} + + +PyObject * +PyObject_CallObject(PyObject *callable, PyObject *args) +{ + return PyEval_CallObjectWithKeywords(callable, args, NULL); +} + + +/* Positional arguments are obj followed by args: + call callable(obj, *args, **kwargs) */ +PyObject * +_PyObject_FastCall_Prepend(PyObject *callable, + PyObject *obj, PyObject **args, Py_ssize_t nargs) +{ + PyObject *small_stack[_PY_FASTCALL_SMALL_STACK]; + PyObject **args2; + PyObject *result; + + nargs++; + if (nargs <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) { + args2 = small_stack; + } + else { + args2 = PyMem_Malloc(nargs * sizeof(PyObject *)); + if (args2 == NULL) { + PyErr_NoMemory(); + return NULL; + } + } + + /* use borrowed references */ + args2[0] = obj; + memcpy(&args2[1], + args, + (nargs - 1)* sizeof(PyObject *)); + + result = _PyObject_FastCall(callable, args2, nargs); + if (args2 != small_stack) { + PyMem_Free(args2); + } + return result; +} + + +/* Call callable(obj, *args, **kwargs). */ +PyObject * +_PyObject_Call_Prepend(PyObject *callable, + PyObject *obj, PyObject *args, PyObject *kwargs) +{ + PyObject *small_stack[_PY_FASTCALL_SMALL_STACK]; + PyObject **stack; + Py_ssize_t argcount; + PyObject *result; + + assert(PyTuple_Check(args)); + + argcount = PyTuple_GET_SIZE(args); + if (argcount + 1 <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) { + stack = small_stack; + } + else { + stack = PyMem_Malloc((argcount + 1) * sizeof(PyObject *)); + if (stack == NULL) { + PyErr_NoMemory(); + return NULL; + } + } + + /* use borrowed references */ + stack[0] = obj; + memcpy(&stack[1], + &PyTuple_GET_ITEM(args, 0), + argcount * sizeof(PyObject *)); + + result = _PyObject_FastCallDict(callable, + stack, argcount + 1, + kwargs); + if (stack != small_stack) { + PyMem_Free(stack); + } + return result; +} + + +/* --- Call with a format string ---------------------------------- */ + +static PyObject * +_PyObject_CallFunctionVa(PyObject *callable, const char *format, + va_list va, int is_size_t) +{ + PyObject* small_stack[_PY_FASTCALL_SMALL_STACK]; + const Py_ssize_t small_stack_len = Py_ARRAY_LENGTH(small_stack); + PyObject **stack; + Py_ssize_t nargs, i; + PyObject *result; + + if (callable == NULL) { + return null_error(); + } + + if (!format || !*format) { + return _PyObject_CallNoArg(callable); + } + + if (is_size_t) { + stack = _Py_VaBuildStack_SizeT(small_stack, small_stack_len, + format, va, &nargs); + } + else { + stack = _Py_VaBuildStack(small_stack, small_stack_len, + format, va, &nargs); + } + if (stack == NULL) { + return NULL; + } + + if (nargs == 1 && PyTuple_Check(stack[0])) { + /* Special cases for backward compatibility: + - PyObject_CallFunction(func, "O", tuple) calls func(*tuple) + - PyObject_CallFunction(func, "(OOO)", arg1, arg2, arg3) calls + func(*(arg1, arg2, arg3)): func(arg1, arg2, arg3) */ + PyObject *args = stack[0]; + result = _PyObject_FastCall(callable, + &PyTuple_GET_ITEM(args, 0), + PyTuple_GET_SIZE(args)); + } + else { + result = _PyObject_FastCall(callable, stack, nargs); + } + + for (i = 0; i < nargs; ++i) { + Py_DECREF(stack[i]); + } + if (stack != small_stack) { + PyMem_Free(stack); + } + return result; +} + + +PyObject * +PyObject_CallFunction(PyObject *callable, const char *format, ...) +{ + va_list va; + PyObject *result; + + va_start(va, format); + result = _PyObject_CallFunctionVa(callable, format, va, 0); + va_end(va); + + return result; +} + + +PyObject * +PyEval_CallFunction(PyObject *callable, const char *format, ...) +{ + va_list vargs; + PyObject *args; + PyObject *res; + + va_start(vargs, format); + + args = Py_VaBuildValue(format, vargs); + va_end(vargs); + + if (args == NULL) + return NULL; + + res = PyEval_CallObject(callable, args); + Py_DECREF(args); + + return res; +} + + +PyObject * +_PyObject_CallFunction_SizeT(PyObject *callable, const char *format, ...) +{ + va_list va; + PyObject *result; + + va_start(va, format); + result = _PyObject_CallFunctionVa(callable, format, va, 1); + va_end(va); + + return result; +} + + +static PyObject* +callmethod(PyObject* callable, const char *format, va_list va, int is_size_t) +{ + assert(callable != NULL); + + if (!PyCallable_Check(callable)) { + PyErr_Format(PyExc_TypeError, + "attribute of type '%.200s' is not callable", + Py_TYPE(callable)->tp_name); + return NULL; + } + + return _PyObject_CallFunctionVa(callable, format, va, is_size_t); +} + + +PyObject * +PyObject_CallMethod(PyObject *obj, const char *name, const char *format, ...) +{ + va_list va; + PyObject *callable, *retval; + + if (obj == NULL || name == NULL) { + return null_error(); + } + + callable = PyObject_GetAttrString(obj, name); + if (callable == NULL) + return NULL; + + va_start(va, format); + retval = callmethod(callable, format, va, 0); + va_end(va); + + Py_DECREF(callable); + return retval; +} + + +PyObject * +PyEval_CallMethod(PyObject *obj, const char *name, const char *format, ...) +{ + va_list vargs; + PyObject *meth; + PyObject *args; + PyObject *res; + + meth = PyObject_GetAttrString(obj, name); + if (meth == NULL) + return NULL; + + va_start(vargs, format); + + args = Py_VaBuildValue(format, vargs); + va_end(vargs); + + if (args == NULL) { + Py_DECREF(meth); + return NULL; + } + + res = PyEval_CallObject(meth, args); + Py_DECREF(meth); + Py_DECREF(args); + + return res; +} + + +PyObject * +_PyObject_CallMethodId(PyObject *obj, _Py_Identifier *name, + const char *format, ...) +{ + va_list va; + PyObject *callable, *retval; + + if (obj == NULL || name == NULL) { + return null_error(); + } + + callable = _PyObject_GetAttrId(obj, name); + if (callable == NULL) + return NULL; + + va_start(va, format); + retval = callmethod(callable, format, va, 0); + va_end(va); + + Py_DECREF(callable); + return retval; +} + + +PyObject * +_PyObject_CallMethod_SizeT(PyObject *obj, const char *name, + const char *format, ...) +{ + va_list va; + PyObject *callable, *retval; + + if (obj == NULL || name == NULL) { + return null_error(); + } + + callable = PyObject_GetAttrString(obj, name); + if (callable == NULL) + return NULL; + + va_start(va, format); + retval = callmethod(callable, format, va, 1); + va_end(va); + + Py_DECREF(callable); + return retval; +} + + +PyObject * +_PyObject_CallMethodId_SizeT(PyObject *obj, _Py_Identifier *name, + const char *format, ...) +{ + va_list va; + PyObject *callable, *retval; + + if (obj == NULL || name == NULL) { + return null_error(); + } + + callable = _PyObject_GetAttrId(obj, name); + if (callable == NULL) { + return NULL; + } + + va_start(va, format); + retval = callmethod(callable, format, va, 1); + va_end(va); + + Py_DECREF(callable); + return retval; +} + + +/* --- Call with "..." arguments ---------------------------------- */ + +static PyObject * +object_vacall(PyObject *callable, va_list vargs) +{ + PyObject *small_stack[_PY_FASTCALL_SMALL_STACK]; + PyObject **stack; + Py_ssize_t nargs; + PyObject *result; + Py_ssize_t i; + va_list countva; + + if (callable == NULL) { + return null_error(); + } + + /* Count the number of arguments */ + va_copy(countva, vargs); + nargs = 0; + while (1) { + PyObject *arg = va_arg(countva, PyObject *); + if (arg == NULL) { + break; + } + nargs++; + } + va_end(countva); + + /* Copy arguments */ + if (nargs <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) { + stack = small_stack; + } + else { + stack = PyMem_Malloc(nargs * sizeof(stack[0])); + if (stack == NULL) { + PyErr_NoMemory(); + return NULL; + } + } + + for (i = 0; i < nargs; ++i) { + stack[i] = va_arg(vargs, PyObject *); + } + + /* Call the function */ + result = _PyObject_FastCall(callable, stack, nargs); + + if (stack != small_stack) { + PyMem_Free(stack); + } + return result; +} + + +PyObject * +PyObject_CallMethodObjArgs(PyObject *callable, PyObject *name, ...) +{ + va_list vargs; + PyObject *result; + + if (callable == NULL || name == NULL) { + return null_error(); + } + + callable = PyObject_GetAttr(callable, name); + if (callable == NULL) { + return NULL; + } + + va_start(vargs, name); + result = object_vacall(callable, vargs); + va_end(vargs); + + Py_DECREF(callable); + return result; +} + + +PyObject * +_PyObject_CallMethodIdObjArgs(PyObject *obj, + struct _Py_Identifier *name, ...) +{ + va_list vargs; + PyObject *callable, *result; + + if (obj == NULL || name == NULL) { + return null_error(); + } + + callable = _PyObject_GetAttrId(obj, name); + if (callable == NULL) { + return NULL; + } + + va_start(vargs, name); + result = object_vacall(callable, vargs); + va_end(vargs); + + Py_DECREF(callable); + return result; +} + + +PyObject * +PyObject_CallFunctionObjArgs(PyObject *callable, ...) +{ + va_list vargs; + PyObject *result; + + va_start(vargs, callable); + result = object_vacall(callable, vargs); + va_end(vargs); + + return result; +} + + +/* --- PyStack functions ------------------------------------------ */ + +/* Issue #29234: Inlining _PyStack_AsTuple() into callers increases their + stack consumption, Disable inlining to optimize the stack consumption. */ +PyObject* _Py_NO_INLINE +_PyStack_AsTuple(PyObject **stack, Py_ssize_t nargs) +{ + PyObject *args; + Py_ssize_t i; + + args = PyTuple_New(nargs); + if (args == NULL) { + return NULL; + } + + for (i=0; i < nargs; i++) { + PyObject *item = stack[i]; + Py_INCREF(item); + PyTuple_SET_ITEM(args, i, item); + } + return args; +} + + +PyObject* +_PyStack_AsTupleSlice(PyObject **stack, Py_ssize_t nargs, + Py_ssize_t start, Py_ssize_t end) +{ + PyObject *args; + Py_ssize_t i; + + assert(0 <= start); + assert(end <= nargs); + assert(start <= end); + + args = PyTuple_New(end - start); + if (args == NULL) { + return NULL; + } + + for (i=start; i < end; i++) { + PyObject *item = stack[i]; + Py_INCREF(item); + PyTuple_SET_ITEM(args, i - start, item); + } + return args; +} + + +PyObject * +_PyStack_AsDict(PyObject **values, PyObject *kwnames) +{ + Py_ssize_t nkwargs; + PyObject *kwdict; + Py_ssize_t i; + + assert(kwnames != NULL); + nkwargs = PyTuple_GET_SIZE(kwnames); + kwdict = _PyDict_NewPresized(nkwargs); + if (kwdict == NULL) { + return NULL; + } + + for (i = 0; i < nkwargs; i++) { + PyObject *key = PyTuple_GET_ITEM(kwnames, i); + PyObject *value = *values++; + /* If key already exists, replace it with the new value */ + if (PyDict_SetItem(kwdict, key, value)) { + Py_DECREF(kwdict); + return NULL; + } + } + return kwdict; +} + + +int +_PyStack_UnpackDict(PyObject **args, Py_ssize_t nargs, PyObject *kwargs, + PyObject ***p_stack, PyObject **p_kwnames) +{ + PyObject **stack, **kwstack; + Py_ssize_t nkwargs; + Py_ssize_t pos, i; + PyObject *key, *value; + PyObject *kwnames; + + assert(nargs >= 0); + assert(kwargs == NULL || PyDict_CheckExact(kwargs)); + + if (kwargs == NULL || (nkwargs = PyDict_GET_SIZE(kwargs)) == 0) { + *p_stack = args; + *p_kwnames = NULL; + return 0; + } + + if ((size_t)nargs > PY_SSIZE_T_MAX / sizeof(stack[0]) - (size_t)nkwargs) { + PyErr_NoMemory(); + return -1; + } + + stack = PyMem_Malloc((nargs + nkwargs) * sizeof(stack[0])); + if (stack == NULL) { + PyErr_NoMemory(); + return -1; + } + + kwnames = PyTuple_New(nkwargs); + if (kwnames == NULL) { + PyMem_Free(stack); + return -1; + } + + /* Copy position arguments (borrowed references) */ + memcpy(stack, args, nargs * sizeof(stack[0])); + + kwstack = stack + nargs; + pos = i = 0; + /* This loop doesn't support lookup function mutating the dictionary + to change its size. It's a deliberate choice for speed, this function is + called in the performance critical hot code. */ + while (PyDict_Next(kwargs, &pos, &key, &value)) { + Py_INCREF(key); + PyTuple_SET_ITEM(kwnames, i, key); + /* The stack contains borrowed references */ + kwstack[i] = value; + i++; + } + + *p_stack = stack; + *p_kwnames = kwnames; + return 0; +} diff --git a/Objects/methodobject.c b/Objects/methodobject.c --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -77,329 +77,6 @@ return PyCFunction_GET_FLAGS(op); } -static PyObject * -cfunction_call_varargs(PyObject *func, PyObject *args, PyObject *kwargs) -{ - assert(!PyErr_Occurred()); - - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - PyObject *result; - - if (PyCFunction_GET_FLAGS(func) & METH_KEYWORDS) { - if (Py_EnterRecursiveCall(" while calling a Python object")) { - return NULL; - } - - result = (*(PyCFunctionWithKeywords)meth)(self, args, kwargs); - - Py_LeaveRecursiveCall(); - } - else { - if (kwargs != NULL && PyDict_Size(kwargs) != 0) { - PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", - ((PyCFunctionObject*)func)->m_ml->ml_name); - return NULL; - } - - if (Py_EnterRecursiveCall(" while calling a Python object")) { - return NULL; - } - - result = (*meth)(self, args); - - Py_LeaveRecursiveCall(); - } - - return _Py_CheckFunctionResult(func, result, NULL); -} - - -PyObject * -PyCFunction_Call(PyObject *func, PyObject *args, PyObject *kwargs) -{ - /* first try METH_VARARGS to pass directly args tuple unchanged. - _PyMethodDef_RawFastCallDict() creates a new temporary tuple - for METH_VARARGS. */ - if (PyCFunction_GET_FLAGS(func) & METH_VARARGS) { - return cfunction_call_varargs(func, args, kwargs); - } - else { - return _PyCFunction_FastCallDict(func, - &PyTuple_GET_ITEM(args, 0), - PyTuple_GET_SIZE(args), - kwargs); - } -} - -PyObject * -_PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self, PyObject **args, - Py_ssize_t nargs, PyObject *kwargs) -{ - /* _PyMethodDef_RawFastCallDict() must not be called with an exception set, - because it can clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - - assert(method != NULL); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - assert(kwargs == NULL || PyDict_Check(kwargs)); - - PyCFunction meth = method->ml_meth; - int flags = method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST); - PyObject *result = NULL; - - if (Py_EnterRecursiveCall(" while calling a Python object")) { - return NULL; - } - - switch (flags) - { - case METH_NOARGS: - if (nargs != 0) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%zd given)", - method->ml_name, nargs); - goto exit; - } - - if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) { - goto no_keyword_error; - } - - result = (*meth) (self, NULL); - break; - - case METH_O: - if (nargs != 1) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%zd given)", - method->ml_name, nargs); - goto exit; - } - - if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) { - goto no_keyword_error; - } - - result = (*meth) (self, args[0]); - break; - - case METH_VARARGS: - if (!(flags & METH_KEYWORDS) - && kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) { - goto no_keyword_error; - } - /* fall through next case */ - - case METH_VARARGS | METH_KEYWORDS: - { - /* Slow-path: create a temporary tuple for positional arguments */ - PyObject *argstuple = _PyStack_AsTuple(args, nargs); - if (argstuple == NULL) { - goto exit; - } - - if (flags & METH_KEYWORDS) { - result = (*(PyCFunctionWithKeywords)meth) (self, argstuple, kwargs); - } - else { - result = (*meth) (self, argstuple); - } - Py_DECREF(argstuple); - break; - } - - case METH_FASTCALL: - { - PyObject **stack; - PyObject *kwnames; - _PyCFunctionFast fastmeth = (_PyCFunctionFast)meth; - - if (_PyStack_UnpackDict(args, nargs, kwargs, &stack, &kwnames) < 0) { - goto exit; - } - - result = (*fastmeth) (self, stack, nargs, kwnames); - if (stack != args) { - PyMem_Free(stack); - } - Py_XDECREF(kwnames); - break; - } - - default: - PyErr_SetString(PyExc_SystemError, - "Bad call flags in _PyMethodDef_RawFastCallDict. " - "METH_OLDARGS is no longer supported!"); - goto exit; - } - - goto exit; - -no_keyword_error: - PyErr_Format(PyExc_TypeError, - "%.200s() takes no keyword arguments", - method->ml_name, nargs); - -exit: - Py_LeaveRecursiveCall(); - return result; -} - -PyObject * -_PyCFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, - PyObject *kwargs) -{ - PyObject *result; - - assert(func != NULL); - assert(PyCFunction_Check(func)); - - result = _PyMethodDef_RawFastCallDict(((PyCFunctionObject*)func)->m_ml, - PyCFunction_GET_SELF(func), - args, nargs, kwargs); - result = _Py_CheckFunctionResult(func, result, NULL); - return result; -} - -PyObject * -_PyMethodDef_RawFastCallKeywords(PyMethodDef *method, PyObject *self, PyObject **args, - Py_ssize_t nargs, PyObject *kwnames) -{ - /* _PyMethodDef_RawFastCallKeywords() must not be called with an exception set, - because it can clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - - assert(method != NULL); - assert(nargs >= 0); - assert(kwnames == NULL || PyTuple_CheckExact(kwnames)); - /* kwnames must only contains str strings, no subclass, and all keys must - be unique */ - - PyCFunction meth = method->ml_meth; - int flags = method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST); - Py_ssize_t nkwargs = kwnames == NULL ? 0 : PyTuple_Size(kwnames); - PyObject *result = NULL; - - if (Py_EnterRecursiveCall(" while calling a Python object")) { - return NULL; - } - - switch (flags) - { - case METH_NOARGS: - if (nargs != 0) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%zd given)", - method->ml_name, nargs); - goto exit; - } - - if (nkwargs) { - goto no_keyword_error; - } - - result = (*meth) (self, NULL); - break; - - case METH_O: - if (nargs != 1) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%zd given)", - method->ml_name, nargs); - goto exit; - } - - if (nkwargs) { - goto no_keyword_error; - } - - result = (*meth) (self, args[0]); - break; - - case METH_FASTCALL: - /* Fast-path: avoid temporary dict to pass keyword arguments */ - result = ((_PyCFunctionFast)meth) (self, args, nargs, kwnames); - break; - - case METH_VARARGS: - case METH_VARARGS | METH_KEYWORDS: - { - /* Slow-path: create a temporary tuple for positional arguments - and a temporary dict for keyword arguments */ - PyObject *argtuple; - - if (!(flags & METH_KEYWORDS) && nkwargs) { - goto no_keyword_error; - } - - argtuple = _PyStack_AsTuple(args, nargs); - if (argtuple == NULL) { - goto exit; - } - - if (flags & METH_KEYWORDS) { - PyObject *kwdict; - - if (nkwargs > 0) { - kwdict = _PyStack_AsDict(args + nargs, kwnames); - if (kwdict == NULL) { - Py_DECREF(argtuple); - goto exit; - } - } - else { - kwdict = NULL; - } - - result = (*(PyCFunctionWithKeywords)meth) (self, argtuple, kwdict); - Py_XDECREF(kwdict); - } - else { - result = (*meth) (self, argtuple); - } - Py_DECREF(argtuple); - break; - } - - default: - PyErr_SetString(PyExc_SystemError, - "Bad call flags in _PyCFunction_FastCallKeywords. " - "METH_OLDARGS is no longer supported!"); - goto exit; - } - - goto exit; - -no_keyword_error: - PyErr_Format(PyExc_TypeError, - "%.200s() takes no keyword arguments", - method->ml_name); - -exit: - Py_LeaveRecursiveCall(); - return result; -} - -PyObject * -_PyCFunction_FastCallKeywords(PyObject *func, PyObject **args, - Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *result; - - assert(func != NULL); - assert(PyCFunction_Check(func)); - - result = _PyMethodDef_RawFastCallKeywords(((PyCFunctionObject*)func)->m_ml, - PyCFunction_GET_SELF(func), - args, nargs, kwnames); - result = _Py_CheckFunctionResult(func, result, NULL); - return result; -} - /* Methods (the standard built-in methods, that is) */ static void diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -294,9 +294,10 @@ + - + diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -37,7 +37,6 @@ /* Forward declarations */ Py_LOCAL_INLINE(PyObject *) call_function(PyObject ***, Py_ssize_t, PyObject *); -static PyObject * fast_function(PyObject *, PyObject **, Py_ssize_t, PyObject *); static PyObject * do_call_core(PyObject *, PyObject *, PyObject *); #ifdef LLTRACE @@ -3895,7 +3894,7 @@ PyEval_EvalFrame() and PyEval_EvalCodeEx() you will need to adjust the test in the if statements in Misc/gdbinit (pystack and pystackv). */ -static PyObject * +PyObject * _PyEval_EvalCodeWithName(PyObject *_co, PyObject *globals, PyObject *locals, PyObject **args, Py_ssize_t argcount, PyObject **kwnames, PyObject **kwargs, @@ -4732,39 +4731,6 @@ } -/* External interface to call any callable object. - The arg must be a tuple or NULL. The kw must be a dict or NULL. */ - -PyObject * -PyEval_CallObjectWithKeywords(PyObject *callable, - PyObject *args, PyObject *kwargs) -{ -#ifdef Py_DEBUG - /* PyEval_CallObjectWithKeywords() must not be called with an exception - set. It raises a new exception if parameters are invalid or if - PyTuple_New() fails, and so the original exception is lost. */ - assert(!PyErr_Occurred()); -#endif - - if (args == NULL) { - return _PyObject_FastCallDict(callable, NULL, 0, kwargs); - } - - if (!PyTuple_Check(args)) { - PyErr_SetString(PyExc_TypeError, - "argument list must be a tuple"); - return NULL; - } - - if (kwargs != NULL && !PyDict_Check(kwargs)) { - PyErr_SetString(PyExc_TypeError, - "keyword list must be a dictionary"); - return NULL; - } - - return PyObject_Call(callable, args, kwargs); -} - const char * PyEval_GetFuncName(PyObject *func) { @@ -4865,7 +4831,7 @@ } if (PyFunction_Check(func)) { - x = fast_function(func, stack, nargs, kwnames); + x = _PyFunction_FastCallKeywords(func, stack, nargs, kwnames); } else { x = _PyObject_FastCallKeywords(func, stack, nargs, kwnames); @@ -4875,10 +4841,7 @@ assert((x != NULL) ^ (PyErr_Occurred() != NULL)); - /* Clear the stack of the function object. Also removes - the arguments in case they weren't consumed already - (fast_function() and err_args() leave them on the stack). - */ + /* Clear the stack of the function object. */ while ((*pp_stack) > pfunc) { w = EXT_POP(*pp_stack); Py_DECREF(w); @@ -4887,205 +4850,6 @@ return x; } -/* The fast_function() function optimize calls for which no argument - tuple is necessary; the objects are passed directly from the stack. - For the simplest case -- a function that takes only positional - arguments and is called with only positional arguments -- it - inlines the most primitive frame setup code from - PyEval_EvalCodeEx(), which vastly reduces the checks that must be - done before evaluating the frame. -*/ - -static PyObject* _Py_HOT_FUNCTION -_PyFunction_FastCall(PyCodeObject *co, PyObject **args, Py_ssize_t nargs, - PyObject *globals) -{ - PyFrameObject *f; - PyThreadState *tstate = PyThreadState_GET(); - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - _PyFrame_New_NoTrack() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = _PyFrame_New_NoTrack(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - - fastlocals = f->f_localsplus; - - for (i = 0; i < nargs; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - - if (Py_REFCNT(f) > 1) { - Py_DECREF(f); - _PyObject_GC_TRACK(f); - } - else { - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - } - return result; -} - -static PyObject * -fast_function(PyObject *func, PyObject **stack, - Py_ssize_t nargs, PyObject *kwnames) -{ - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *kwdefs, *closure, *name, *qualname; - PyObject **d; - Py_ssize_t nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames); - Py_ssize_t nd; - - assert(PyFunction_Check(func)); - assert(nargs >= 0); - assert(kwnames == NULL || PyTuple_CheckExact(kwnames)); - assert((nargs == 0 && nkwargs == 0) || stack != NULL); - /* kwnames must only contains str strings, no subclass, and all keys must - be unique */ - - if (co->co_kwonlyargcount == 0 && nkwargs == 0 && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) - { - if (argdefs == NULL && co->co_argcount == nargs) { - return _PyFunction_FastCall(co, stack, nargs, globals); - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - stack = &PyTuple_GET_ITEM(argdefs, 0); - return _PyFunction_FastCall(co, stack, Py_SIZE(argdefs), globals); - } - } - - kwdefs = PyFunction_GET_KW_DEFAULTS(func); - closure = PyFunction_GET_CLOSURE(func); - name = ((PyFunctionObject *)func) -> func_name; - qualname = ((PyFunctionObject *)func) -> func_qualname; - - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } - return _PyEval_EvalCodeWithName((PyObject*)co, globals, (PyObject *)NULL, - stack, nargs, - nkwargs ? &PyTuple_GET_ITEM(kwnames, 0) : NULL, - stack + nargs, - nkwargs, 1, - d, (int)nd, kwdefs, - closure, name, qualname); -} - -PyObject * -_PyFunction_FastCallKeywords(PyObject *func, PyObject **stack, - Py_ssize_t nargs, PyObject *kwnames) -{ - return fast_function(func, stack, nargs, kwnames); -} - -PyObject * -_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, - PyObject *kwargs) -{ - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *kwdefs, *closure, *name, *qualname; - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd, nk; - PyObject *result; - - assert(func != NULL); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - assert(kwargs == NULL || PyDict_Check(kwargs)); - - if (co->co_kwonlyargcount == 0 && - (kwargs == NULL || PyDict_GET_SIZE(kwargs) == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) - { - /* Fast paths */ - if (argdefs == NULL && co->co_argcount == nargs) { - return _PyFunction_FastCall(co, args, nargs, globals); - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - return _PyFunction_FastCall(co, args, Py_SIZE(argdefs), globals); - } - } - - nk = (kwargs != NULL) ? PyDict_GET_SIZE(kwargs) : 0; - if (nk != 0) { - Py_ssize_t pos, i; - - /* Issue #29318: Caller and callee functions must not share the - dictionary: kwargs must be copied. */ - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - return NULL; - } - - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - /* We must hold strong references because keyword arguments can be - indirectly modified while the function is called: - see issue #2016 and test_extcall */ - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - - kwdefs = PyFunction_GET_KW_DEFAULTS(func); - closure = PyFunction_GET_CLOSURE(func); - name = ((PyFunctionObject *)func) -> func_name; - qualname = ((PyFunctionObject *)func) -> func_qualname; - - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } - - result = _PyEval_EvalCodeWithName((PyObject*)co, globals, (PyObject *)NULL, - args, nargs, - k, k + 1, nk, 2, - d, nd, kwdefs, - closure, name, qualname); - Py_XDECREF(kwtuple); - return result; -} - static PyObject * do_call_core(PyObject *func, PyObject *callargs, PyObject *kwdict) { diff --git a/Python/modsupport.c b/Python/modsupport.c --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -586,57 +586,6 @@ } -PyObject * -PyEval_CallFunction(PyObject *callable, const char *format, ...) -{ - va_list vargs; - PyObject *args; - PyObject *res; - - va_start(vargs, format); - - args = Py_VaBuildValue(format, vargs); - va_end(vargs); - - if (args == NULL) - return NULL; - - res = PyEval_CallObject(callable, args); - Py_DECREF(args); - - return res; -} - - -PyObject * -PyEval_CallMethod(PyObject *obj, const char *name, const char *format, ...) -{ - va_list vargs; - PyObject *meth; - PyObject *args; - PyObject *res; - - meth = PyObject_GetAttrString(obj, name); - if (meth == NULL) - return NULL; - - va_start(vargs, format); - - args = Py_VaBuildValue(format, vargs); - va_end(vargs); - - if (args == NULL) { - Py_DECREF(meth); - return NULL; - } - - res = PyEval_CallObject(meth, args); - Py_DECREF(meth); - Py_DECREF(args); - - return res; -} - int PyModule_AddObject(PyObject *m, const char *name, PyObject *o) { -- Repository URL: https://hg.python.org/cpython From python-checkins at python.org Fri Feb 10 08:21:41 2017 From: python-checkins at python.org (victor.stinner) Date: Fri, 10 Feb 2017 13:21:41 +0000 Subject: [Python-checkins] =?utf-8?q?cpython=3A_Backed_out_changeset_f23fa?= =?utf-8?q?1f7b68f?= Message-ID: <20170210132141.106329.26274.9902CBBC@psf.io> https://hg.python.org/cpython/rev/4243df51fe43 changeset: 106496:4243df51fe43 parent: 106494:f23fa1f7b68f user: Victor Stinner date: Fri Feb 10 14:19:36 2017 +0100 summary: Backed out changeset f23fa1f7b68f Sorry, I didn't want to push this change before the review :-( I was pushing a change into the 2.7 branch. files: Include/eval.h | 22 +- Makefile.pre.in | 1 - Objects/abstract.c | 725 ++++++++++++ Objects/call.c | 1368 ------------------------ Objects/methodobject.c | 323 +++++ PCbuild/pythoncore.vcxproj | 3 +- Python/ceval.c | 242 ++++- Python/modsupport.c | 51 + 8 files changed, 1345 insertions(+), 1390 deletions(-) diff --git a/Include/eval.h b/Include/eval.h --- a/Include/eval.h +++ b/Include/eval.h @@ -10,24 +10,14 @@ PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyObject *, PyObject *, PyObject *); PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyObject *co, - PyObject *globals, - PyObject *locals, - PyObject **args, int argc, - PyObject **kwds, int kwdc, - PyObject **defs, int defc, - PyObject *kwdefs, PyObject *closure); + PyObject *globals, + PyObject *locals, + PyObject **args, int argc, + PyObject **kwds, int kwdc, + PyObject **defs, int defc, + PyObject *kwdefs, PyObject *closure); #ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject *) _PyEval_EvalCodeWithName( - PyObject *co, - PyObject *globals, PyObject *locals, - PyObject **args, Py_ssize_t argcount, - PyObject **kwnames, PyObject **kwargs, - Py_ssize_t kwcount, int kwstep, - PyObject **defs, Py_ssize_t defcount, - PyObject *kwdefs, PyObject *closure, - PyObject *name, PyObject *qualname); - PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args); #endif diff --git a/Makefile.pre.in b/Makefile.pre.in --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -409,7 +409,6 @@ Objects/bytes_methods.o \ Objects/bytearrayobject.o \ Objects/bytesobject.o \ - Objects/call.o \ Objects/cellobject.o \ Objects/classobject.o \ Objects/codeobject.o \ diff --git a/Objects/abstract.c b/Objects/abstract.c --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2168,6 +2168,731 @@ return fast; } +/* Operations on callable objects */ + +/* XXX PyCallable_Check() is in object.c */ + +PyObject * +PyObject_CallObject(PyObject *callable, PyObject *args) +{ + return PyEval_CallObjectWithKeywords(callable, args, NULL); +} + +PyObject* +_Py_CheckFunctionResult(PyObject *callable, PyObject *result, const char *where) +{ + int err_occurred = (PyErr_Occurred() != NULL); + + assert((callable != NULL) ^ (where != NULL)); + + if (result == NULL) { + if (!err_occurred) { + if (callable) + PyErr_Format(PyExc_SystemError, + "%R returned NULL without setting an error", + callable); + else + PyErr_Format(PyExc_SystemError, + "%s returned NULL without setting an error", + where); +#ifdef Py_DEBUG + /* Ensure that the bug is caught in debug mode */ + Py_FatalError("a function returned NULL without setting an error"); +#endif + return NULL; + } + } + else { + if (err_occurred) { + Py_DECREF(result); + + if (callable) { + _PyErr_FormatFromCause(PyExc_SystemError, + "%R returned a result with an error set", + callable); + } + else { + _PyErr_FormatFromCause(PyExc_SystemError, + "%s returned a result with an error set", + where); + } +#ifdef Py_DEBUG + /* Ensure that the bug is caught in debug mode */ + Py_FatalError("a function returned a result with an error set"); +#endif + return NULL; + } + } + return result; +} + +PyObject * +PyObject_Call(PyObject *callable, PyObject *args, PyObject *kwargs) +{ + ternaryfunc call; + PyObject *result; + + /* PyObject_Call() must not be called with an exception set, + because it can clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); + assert(PyTuple_Check(args)); + assert(kwargs == NULL || PyDict_Check(kwargs)); + + if (PyFunction_Check(callable)) { + return _PyFunction_FastCallDict(callable, + &PyTuple_GET_ITEM(args, 0), + PyTuple_GET_SIZE(args), + kwargs); + } + else if (PyCFunction_Check(callable)) { + return PyCFunction_Call(callable, args, kwargs); + } + else { + call = callable->ob_type->tp_call; + if (call == NULL) { + PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable", + callable->ob_type->tp_name); + return NULL; + } + + if (Py_EnterRecursiveCall(" while calling a Python object")) + return NULL; + + result = (*call)(callable, args, kwargs); + + Py_LeaveRecursiveCall(); + + return _Py_CheckFunctionResult(callable, result, NULL); + } +} + +/* Issue #29234: Inlining _PyStack_AsTuple() into callers increases their + stack consumption, Disable inlining to optimize the stack consumption. */ +PyObject* _Py_NO_INLINE +_PyStack_AsTuple(PyObject **stack, Py_ssize_t nargs) +{ + PyObject *args; + Py_ssize_t i; + + args = PyTuple_New(nargs); + if (args == NULL) { + return NULL; + } + + for (i=0; i < nargs; i++) { + PyObject *item = stack[i]; + Py_INCREF(item); + PyTuple_SET_ITEM(args, i, item); + } + return args; +} + +PyObject* +_PyStack_AsTupleSlice(PyObject **stack, Py_ssize_t nargs, + Py_ssize_t start, Py_ssize_t end) +{ + PyObject *args; + Py_ssize_t i; + + assert(0 <= start); + assert(end <= nargs); + assert(start <= end); + + args = PyTuple_New(end - start); + if (args == NULL) { + return NULL; + } + + for (i=start; i < end; i++) { + PyObject *item = stack[i]; + Py_INCREF(item); + PyTuple_SET_ITEM(args, i - start, item); + } + return args; +} + +PyObject * +_PyObject_FastCallDict(PyObject *callable, PyObject **args, Py_ssize_t nargs, + PyObject *kwargs) +{ + /* _PyObject_FastCallDict() must not be called with an exception set, + because it can clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); + + assert(callable != NULL); + assert(nargs >= 0); + assert(nargs == 0 || args != NULL); + assert(kwargs == NULL || PyDict_Check(kwargs)); + + if (PyFunction_Check(callable)) { + return _PyFunction_FastCallDict(callable, args, nargs, kwargs); + } + else if (PyCFunction_Check(callable)) { + return _PyCFunction_FastCallDict(callable, args, nargs, kwargs); + } + else { + PyObject *argstuple, *result; + ternaryfunc call; + + /* Slow-path: build a temporary tuple */ + call = callable->ob_type->tp_call; + if (call == NULL) { + PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable", + callable->ob_type->tp_name); + return NULL; + } + + argstuple = _PyStack_AsTuple(args, nargs); + if (argstuple == NULL) { + return NULL; + } + + if (Py_EnterRecursiveCall(" while calling a Python object")) { + Py_DECREF(argstuple); + return NULL; + } + + result = (*call)(callable, argstuple, kwargs); + + Py_LeaveRecursiveCall(); + Py_DECREF(argstuple); + + result = _Py_CheckFunctionResult(callable, result, NULL); + return result; + } +} + +/* Positional arguments are obj followed by args: + call callable(obj, *args, **kwargs) */ +PyObject * +_PyObject_FastCall_Prepend(PyObject *callable, + PyObject *obj, PyObject **args, Py_ssize_t nargs) +{ + PyObject *small_stack[_PY_FASTCALL_SMALL_STACK]; + PyObject **args2; + PyObject *result; + + nargs++; + if (nargs <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) { + args2 = small_stack; + } + else { + args2 = PyMem_Malloc(nargs * sizeof(PyObject *)); + if (args2 == NULL) { + PyErr_NoMemory(); + return NULL; + } + } + + /* use borrowed references */ + args2[0] = obj; + memcpy(&args2[1], + args, + (nargs - 1)* sizeof(PyObject *)); + + result = _PyObject_FastCall(callable, args2, nargs); + if (args2 != small_stack) { + PyMem_Free(args2); + } + return result; +} + + +/* Call callable(obj, *args, **kwargs). */ +PyObject * +_PyObject_Call_Prepend(PyObject *callable, + PyObject *obj, PyObject *args, PyObject *kwargs) +{ + PyObject *small_stack[_PY_FASTCALL_SMALL_STACK]; + PyObject **stack; + Py_ssize_t argcount; + PyObject *result; + + assert(PyTuple_Check(args)); + + argcount = PyTuple_GET_SIZE(args); + if (argcount + 1 <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) { + stack = small_stack; + } + else { + stack = PyMem_Malloc((argcount + 1) * sizeof(PyObject *)); + if (stack == NULL) { + PyErr_NoMemory(); + return NULL; + } + } + + /* use borrowed references */ + stack[0] = obj; + memcpy(&stack[1], + &PyTuple_GET_ITEM(args, 0), + argcount * sizeof(PyObject *)); + + result = _PyObject_FastCallDict(callable, + stack, argcount + 1, + kwargs); + if (stack != small_stack) { + PyMem_Free(stack); + } + return result; +} + +PyObject * +_PyStack_AsDict(PyObject **values, PyObject *kwnames) +{ + Py_ssize_t nkwargs; + PyObject *kwdict; + Py_ssize_t i; + + assert(kwnames != NULL); + nkwargs = PyTuple_GET_SIZE(kwnames); + kwdict = _PyDict_NewPresized(nkwargs); + if (kwdict == NULL) { + return NULL; + } + + for (i = 0; i < nkwargs; i++) { + PyObject *key = PyTuple_GET_ITEM(kwnames, i); + PyObject *value = *values++; + /* If key already exists, replace it with the new value */ + if (PyDict_SetItem(kwdict, key, value)) { + Py_DECREF(kwdict); + return NULL; + } + } + return kwdict; +} + +int +_PyStack_UnpackDict(PyObject **args, Py_ssize_t nargs, PyObject *kwargs, + PyObject ***p_stack, PyObject **p_kwnames) +{ + PyObject **stack, **kwstack; + Py_ssize_t nkwargs; + Py_ssize_t pos, i; + PyObject *key, *value; + PyObject *kwnames; + + assert(nargs >= 0); + assert(kwargs == NULL || PyDict_CheckExact(kwargs)); + + if (kwargs == NULL || (nkwargs = PyDict_GET_SIZE(kwargs)) == 0) { + *p_stack = args; + *p_kwnames = NULL; + return 0; + } + + if ((size_t)nargs > PY_SSIZE_T_MAX / sizeof(stack[0]) - (size_t)nkwargs) { + PyErr_NoMemory(); + return -1; + } + + stack = PyMem_Malloc((nargs + nkwargs) * sizeof(stack[0])); + if (stack == NULL) { + PyErr_NoMemory(); + return -1; + } + + kwnames = PyTuple_New(nkwargs); + if (kwnames == NULL) { + PyMem_Free(stack); + return -1; + } + + /* Copy position arguments (borrowed references) */ + memcpy(stack, args, nargs * sizeof(stack[0])); + + kwstack = stack + nargs; + pos = i = 0; + /* This loop doesn't support lookup function mutating the dictionary + to change its size. It's a deliberate choice for speed, this function is + called in the performance critical hot code. */ + while (PyDict_Next(kwargs, &pos, &key, &value)) { + Py_INCREF(key); + PyTuple_SET_ITEM(kwnames, i, key); + /* The stack contains borrowed references */ + kwstack[i] = value; + i++; + } + + *p_stack = stack; + *p_kwnames = kwnames; + return 0; +} + +PyObject * +_PyObject_FastCallKeywords(PyObject *callable, PyObject **stack, Py_ssize_t nargs, + PyObject *kwnames) +{ + /* _PyObject_FastCallKeywords() must not be called with an exception set, + because it can clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); + + assert(nargs >= 0); + assert(kwnames == NULL || PyTuple_CheckExact(kwnames)); + + /* kwnames must only contains str strings, no subclass, and all keys must + be unique: these checks are implemented in Python/ceval.c and + _PyArg_ParseStackAndKeywords(). */ + + if (PyFunction_Check(callable)) { + return _PyFunction_FastCallKeywords(callable, stack, nargs, kwnames); + } + if (PyCFunction_Check(callable)) { + return _PyCFunction_FastCallKeywords(callable, stack, nargs, kwnames); + } + else { + /* Slow-path: build a temporary tuple for positional arguments and a + temporary dictionary for keyword arguments (if any) */ + + ternaryfunc call; + PyObject *argstuple; + PyObject *kwdict, *result; + Py_ssize_t nkwargs; + + nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames); + assert((nargs == 0 && nkwargs == 0) || stack != NULL); + + call = callable->ob_type->tp_call; + if (call == NULL) { + PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable", + callable->ob_type->tp_name); + return NULL; + } + + argstuple = _PyStack_AsTuple(stack, nargs); + if (argstuple == NULL) { + return NULL; + } + + if (nkwargs > 0) { + kwdict = _PyStack_AsDict(stack + nargs, kwnames); + if (kwdict == NULL) { + Py_DECREF(argstuple); + return NULL; + } + } + else { + kwdict = NULL; + } + + if (Py_EnterRecursiveCall(" while calling a Python object")) { + Py_DECREF(argstuple); + Py_XDECREF(kwdict); + return NULL; + } + + result = (*call)(callable, argstuple, kwdict); + + Py_LeaveRecursiveCall(); + + Py_DECREF(argstuple); + Py_XDECREF(kwdict); + + result = _Py_CheckFunctionResult(callable, result, NULL); + return result; + } +} + +static PyObject * +_PyObject_CallFunctionVa(PyObject *callable, const char *format, + va_list va, int is_size_t) +{ + PyObject* small_stack[_PY_FASTCALL_SMALL_STACK]; + const Py_ssize_t small_stack_len = Py_ARRAY_LENGTH(small_stack); + PyObject **stack; + Py_ssize_t nargs, i; + PyObject *result; + + if (callable == NULL) { + return null_error(); + } + + if (!format || !*format) { + return _PyObject_CallNoArg(callable); + } + + if (is_size_t) { + stack = _Py_VaBuildStack_SizeT(small_stack, small_stack_len, + format, va, &nargs); + } + else { + stack = _Py_VaBuildStack(small_stack, small_stack_len, + format, va, &nargs); + } + if (stack == NULL) { + return NULL; + } + + if (nargs == 1 && PyTuple_Check(stack[0])) { + /* Special cases for backward compatibility: + - PyObject_CallFunction(func, "O", tuple) calls func(*tuple) + - PyObject_CallFunction(func, "(OOO)", arg1, arg2, arg3) calls + func(*(arg1, arg2, arg3)): func(arg1, arg2, arg3) */ + PyObject *args = stack[0]; + result = _PyObject_FastCall(callable, + &PyTuple_GET_ITEM(args, 0), + PyTuple_GET_SIZE(args)); + } + else { + result = _PyObject_FastCall(callable, stack, nargs); + } + + for (i = 0; i < nargs; ++i) { + Py_DECREF(stack[i]); + } + if (stack != small_stack) { + PyMem_Free(stack); + } + return result; +} + +PyObject * +PyObject_CallFunction(PyObject *callable, const char *format, ...) +{ + va_list va; + PyObject *result; + + va_start(va, format); + result = _PyObject_CallFunctionVa(callable, format, va, 0); + va_end(va); + + return result; +} + +PyObject * +_PyObject_CallFunction_SizeT(PyObject *callable, const char *format, ...) +{ + va_list va; + PyObject *result; + + va_start(va, format); + result = _PyObject_CallFunctionVa(callable, format, va, 1); + va_end(va); + + return result; +} + +static PyObject* +callmethod(PyObject* callable, const char *format, va_list va, int is_size_t) +{ + assert(callable != NULL); + + if (!PyCallable_Check(callable)) { + type_error("attribute of type '%.200s' is not callable", callable); + return NULL; + } + + return _PyObject_CallFunctionVa(callable, format, va, is_size_t); +} + +PyObject * +PyObject_CallMethod(PyObject *obj, const char *name, const char *format, ...) +{ + va_list va; + PyObject *callable, *retval; + + if (obj == NULL || name == NULL) { + return null_error(); + } + + callable = PyObject_GetAttrString(obj, name); + if (callable == NULL) + return NULL; + + va_start(va, format); + retval = callmethod(callable, format, va, 0); + va_end(va); + + Py_DECREF(callable); + return retval; +} + +PyObject * +_PyObject_CallMethodId(PyObject *obj, _Py_Identifier *name, + const char *format, ...) +{ + va_list va; + PyObject *callable, *retval; + + if (obj == NULL || name == NULL) { + return null_error(); + } + + callable = _PyObject_GetAttrId(obj, name); + if (callable == NULL) + return NULL; + + va_start(va, format); + retval = callmethod(callable, format, va, 0); + va_end(va); + + Py_DECREF(callable); + return retval; +} + +PyObject * +_PyObject_CallMethod_SizeT(PyObject *obj, const char *name, + const char *format, ...) +{ + va_list va; + PyObject *callable, *retval; + + if (obj == NULL || name == NULL) { + return null_error(); + } + + callable = PyObject_GetAttrString(obj, name); + if (callable == NULL) + return NULL; + + va_start(va, format); + retval = callmethod(callable, format, va, 1); + va_end(va); + + Py_DECREF(callable); + return retval; +} + +PyObject * +_PyObject_CallMethodId_SizeT(PyObject *obj, _Py_Identifier *name, + const char *format, ...) +{ + va_list va; + PyObject *callable, *retval; + + if (obj == NULL || name == NULL) { + return null_error(); + } + + callable = _PyObject_GetAttrId(obj, name); + if (callable == NULL) { + return NULL; + } + + va_start(va, format); + retval = callmethod(callable, format, va, 1); + va_end(va); + + Py_DECREF(callable); + return retval; +} + +static PyObject * +object_vacall(PyObject *callable, va_list vargs) +{ + PyObject *small_stack[_PY_FASTCALL_SMALL_STACK]; + PyObject **stack; + Py_ssize_t nargs; + PyObject *result; + Py_ssize_t i; + va_list countva; + + if (callable == NULL) { + return null_error(); + } + + /* Count the number of arguments */ + va_copy(countva, vargs); + nargs = 0; + while (1) { + PyObject *arg = va_arg(countva, PyObject *); + if (arg == NULL) { + break; + } + nargs++; + } + va_end(countva); + + /* Copy arguments */ + if (nargs <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) { + stack = small_stack; + } + else { + stack = PyMem_Malloc(nargs * sizeof(stack[0])); + if (stack == NULL) { + PyErr_NoMemory(); + return NULL; + } + } + + for (i = 0; i < nargs; ++i) { + stack[i] = va_arg(vargs, PyObject *); + } + + /* Call the function */ + result = _PyObject_FastCall(callable, stack, nargs); + + if (stack != small_stack) { + PyMem_Free(stack); + } + return result; +} + +PyObject * +PyObject_CallMethodObjArgs(PyObject *callable, PyObject *name, ...) +{ + va_list vargs; + PyObject *result; + + if (callable == NULL || name == NULL) { + return null_error(); + } + + callable = PyObject_GetAttr(callable, name); + if (callable == NULL) { + return NULL; + } + + va_start(vargs, name); + result = object_vacall(callable, vargs); + va_end(vargs); + + Py_DECREF(callable); + return result; +} + +PyObject * +_PyObject_CallMethodIdObjArgs(PyObject *obj, + struct _Py_Identifier *name, ...) +{ + va_list vargs; + PyObject *callable, *result; + + if (obj == NULL || name == NULL) { + return null_error(); + } + + callable = _PyObject_GetAttrId(obj, name); + if (callable == NULL) { + return NULL; + } + + va_start(vargs, name); + result = object_vacall(callable, vargs); + va_end(vargs); + + Py_DECREF(callable); + return result; +} + +PyObject * +PyObject_CallFunctionObjArgs(PyObject *callable, ...) +{ + va_list vargs; + PyObject *result; + + va_start(vargs, callable); + result = object_vacall(callable, vargs); + va_end(vargs); + + return result; +} + + /* isinstance(), issubclass() */ /* abstract_get_bases() has logically 4 return states: diff --git a/Objects/call.c b/Objects/call.c deleted file mode 100644 --- a/Objects/call.c +++ /dev/null @@ -1,1368 +0,0 @@ -#include "Python.h" -#include "frameobject.h" - - -static PyObject * -null_error(void) -{ - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_SystemError, - "null argument to internal routine"); - return NULL; -} - - -PyObject* -_Py_CheckFunctionResult(PyObject *callable, PyObject *result, const char *where) -{ - int err_occurred = (PyErr_Occurred() != NULL); - - assert((callable != NULL) ^ (where != NULL)); - - if (result == NULL) { - if (!err_occurred) { - if (callable) - PyErr_Format(PyExc_SystemError, - "%R returned NULL without setting an error", - callable); - else - PyErr_Format(PyExc_SystemError, - "%s returned NULL without setting an error", - where); -#ifdef Py_DEBUG - /* Ensure that the bug is caught in debug mode */ - Py_FatalError("a function returned NULL without setting an error"); -#endif - return NULL; - } - } - else { - if (err_occurred) { - Py_DECREF(result); - - if (callable) { - _PyErr_FormatFromCause(PyExc_SystemError, - "%R returned a result with an error set", - callable); - } - else { - _PyErr_FormatFromCause(PyExc_SystemError, - "%s returned a result with an error set", - where); - } -#ifdef Py_DEBUG - /* Ensure that the bug is caught in debug mode */ - Py_FatalError("a function returned a result with an error set"); -#endif - return NULL; - } - } - return result; -} - - -/* --- Core PyObject call functions ------------------------------- */ - -PyObject * -_PyObject_FastCallDict(PyObject *callable, PyObject **args, Py_ssize_t nargs, - PyObject *kwargs) -{ - /* _PyObject_FastCallDict() must not be called with an exception set, - because it can clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - - assert(callable != NULL); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - assert(kwargs == NULL || PyDict_Check(kwargs)); - - if (PyFunction_Check(callable)) { - return _PyFunction_FastCallDict(callable, args, nargs, kwargs); - } - else if (PyCFunction_Check(callable)) { - return _PyCFunction_FastCallDict(callable, args, nargs, kwargs); - } - else { - PyObject *argstuple, *result; - ternaryfunc call; - - /* Slow-path: build a temporary tuple */ - call = callable->ob_type->tp_call; - if (call == NULL) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable", - callable->ob_type->tp_name); - return NULL; - } - - argstuple = _PyStack_AsTuple(args, nargs); - if (argstuple == NULL) { - return NULL; - } - - if (Py_EnterRecursiveCall(" while calling a Python object")) { - Py_DECREF(argstuple); - return NULL; - } - - result = (*call)(callable, argstuple, kwargs); - - Py_LeaveRecursiveCall(); - Py_DECREF(argstuple); - - result = _Py_CheckFunctionResult(callable, result, NULL); - return result; - } -} - - -PyObject * -_PyObject_FastCallKeywords(PyObject *callable, PyObject **stack, Py_ssize_t nargs, - PyObject *kwnames) -{ - /* _PyObject_FastCallKeywords() must not be called with an exception set, - because it can clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - - assert(nargs >= 0); - assert(kwnames == NULL || PyTuple_CheckExact(kwnames)); - - /* kwnames must only contains str strings, no subclass, and all keys must - be unique: these checks are implemented in Python/ceval.c and - _PyArg_ParseStackAndKeywords(). */ - - if (PyFunction_Check(callable)) { - return _PyFunction_FastCallKeywords(callable, stack, nargs, kwnames); - } - if (PyCFunction_Check(callable)) { - return _PyCFunction_FastCallKeywords(callable, stack, nargs, kwnames); - } - else { - /* Slow-path: build a temporary tuple for positional arguments and a - temporary dictionary for keyword arguments (if any) */ - - ternaryfunc call; - PyObject *argstuple; - PyObject *kwdict, *result; - Py_ssize_t nkwargs; - - nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames); - assert((nargs == 0 && nkwargs == 0) || stack != NULL); - - call = callable->ob_type->tp_call; - if (call == NULL) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable", - callable->ob_type->tp_name); - return NULL; - } - - argstuple = _PyStack_AsTuple(stack, nargs); - if (argstuple == NULL) { - return NULL; - } - - if (nkwargs > 0) { - kwdict = _PyStack_AsDict(stack + nargs, kwnames); - if (kwdict == NULL) { - Py_DECREF(argstuple); - return NULL; - } - } - else { - kwdict = NULL; - } - - if (Py_EnterRecursiveCall(" while calling a Python object")) { - Py_DECREF(argstuple); - Py_XDECREF(kwdict); - return NULL; - } - - result = (*call)(callable, argstuple, kwdict); - - Py_LeaveRecursiveCall(); - - Py_DECREF(argstuple); - Py_XDECREF(kwdict); - - result = _Py_CheckFunctionResult(callable, result, NULL); - return result; - } -} - - -PyObject * -PyObject_Call(PyObject *callable, PyObject *args, PyObject *kwargs) -{ - ternaryfunc call; - PyObject *result; - - /* PyObject_Call() must not be called with an exception set, - because it can clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - assert(PyTuple_Check(args)); - assert(kwargs == NULL || PyDict_Check(kwargs)); - - if (PyFunction_Check(callable)) { - return _PyFunction_FastCallDict(callable, - &PyTuple_GET_ITEM(args, 0), - PyTuple_GET_SIZE(args), - kwargs); - } - else if (PyCFunction_Check(callable)) { - return PyCFunction_Call(callable, args, kwargs); - } - else { - call = callable->ob_type->tp_call; - if (call == NULL) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable", - callable->ob_type->tp_name); - return NULL; - } - - if (Py_EnterRecursiveCall(" while calling a Python object")) - return NULL; - - result = (*call)(callable, args, kwargs); - - Py_LeaveRecursiveCall(); - - return _Py_CheckFunctionResult(callable, result, NULL); - } -} - - -/* --- PyFunction call functions ---------------------------------- */ - -static PyObject* _Py_HOT_FUNCTION -function_code_fastcall(PyCodeObject *co, PyObject **args, Py_ssize_t nargs, - PyObject *globals) -{ - PyFrameObject *f; - PyThreadState *tstate = PyThreadState_GET(); - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - _PyFrame_New_NoTrack() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = _PyFrame_New_NoTrack(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; - } - - fastlocals = f->f_localsplus; - - for (i = 0; i < nargs; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; - } - result = PyEval_EvalFrameEx(f,0); - - if (Py_REFCNT(f) > 1) { - Py_DECREF(f); - _PyObject_GC_TRACK(f); - } - else { - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - } - return result; -} - - -PyObject * -_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, - PyObject *kwargs) -{ - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *kwdefs, *closure, *name, *qualname; - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd, nk; - PyObject *result; - - assert(func != NULL); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - assert(kwargs == NULL || PyDict_Check(kwargs)); - - if (co->co_kwonlyargcount == 0 && - (kwargs == NULL || PyDict_GET_SIZE(kwargs) == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) - { - /* Fast paths */ - if (argdefs == NULL && co->co_argcount == nargs) { - return function_code_fastcall(co, args, nargs, globals); - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - return function_code_fastcall(co, args, Py_SIZE(argdefs), globals); - } - } - - nk = (kwargs != NULL) ? PyDict_GET_SIZE(kwargs) : 0; - if (nk != 0) { - Py_ssize_t pos, i; - - /* Issue #29318: Caller and callee functions must not share the - dictionary: kwargs must be copied. */ - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - return NULL; - } - - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - /* We must hold strong references because keyword arguments can be - indirectly modified while the function is called: - see issue #2016 and test_extcall */ - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; - } - else { - kwtuple = NULL; - k = NULL; - } - - kwdefs = PyFunction_GET_KW_DEFAULTS(func); - closure = PyFunction_GET_CLOSURE(func); - name = ((PyFunctionObject *)func) -> func_name; - qualname = ((PyFunctionObject *)func) -> func_qualname; - - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } - - result = _PyEval_EvalCodeWithName((PyObject*)co, globals, (PyObject *)NULL, - args, nargs, - k, k + 1, nk, 2, - d, nd, kwdefs, - closure, name, qualname); - Py_XDECREF(kwtuple); - return result; -} - -PyObject * -_PyFunction_FastCallKeywords(PyObject *func, PyObject **stack, - Py_ssize_t nargs, PyObject *kwnames) -{ - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *kwdefs, *closure, *name, *qualname; - PyObject **d; - Py_ssize_t nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames); - Py_ssize_t nd; - - assert(PyFunction_Check(func)); - assert(nargs >= 0); - assert(kwnames == NULL || PyTuple_CheckExact(kwnames)); - assert((nargs == 0 && nkwargs == 0) || stack != NULL); - /* kwnames must only contains str strings, no subclass, and all keys must - be unique */ - - if (co->co_kwonlyargcount == 0 && nkwargs == 0 && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) - { - if (argdefs == NULL && co->co_argcount == nargs) { - return function_code_fastcall(co, stack, nargs, globals); - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - stack = &PyTuple_GET_ITEM(argdefs, 0); - return function_code_fastcall(co, stack, Py_SIZE(argdefs), globals); - } - } - - kwdefs = PyFunction_GET_KW_DEFAULTS(func); - closure = PyFunction_GET_CLOSURE(func); - name = ((PyFunctionObject *)func) -> func_name; - qualname = ((PyFunctionObject *)func) -> func_qualname; - - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } - return _PyEval_EvalCodeWithName((PyObject*)co, globals, (PyObject *)NULL, - stack, nargs, - nkwargs ? &PyTuple_GET_ITEM(kwnames, 0) : NULL, - stack + nargs, - nkwargs, 1, - d, (int)nd, kwdefs, - closure, name, qualname); -} - - -/* --- PyCFunction call functions --------------------------------- */ - -PyObject * -_PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self, PyObject **args, - Py_ssize_t nargs, PyObject *kwargs) -{ - /* _PyMethodDef_RawFastCallDict() must not be called with an exception set, - because it can clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - - assert(method != NULL); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - assert(kwargs == NULL || PyDict_Check(kwargs)); - - PyCFunction meth = method->ml_meth; - int flags = method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST); - PyObject *result = NULL; - - if (Py_EnterRecursiveCall(" while calling a Python object")) { - return NULL; - } - - switch (flags) - { - case METH_NOARGS: - if (nargs != 0) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%zd given)", - method->ml_name, nargs); - goto exit; - } - - if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) { - goto no_keyword_error; - } - - result = (*meth) (self, NULL); - break; - - case METH_O: - if (nargs != 1) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%zd given)", - method->ml_name, nargs); - goto exit; - } - - if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) { - goto no_keyword_error; - } - - result = (*meth) (self, args[0]); - break; - - case METH_VARARGS: - if (!(flags & METH_KEYWORDS) - && kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) { - goto no_keyword_error; - } - /* fall through next case */ - - case METH_VARARGS | METH_KEYWORDS: - { - /* Slow-path: create a temporary tuple for positional arguments */ - PyObject *argstuple = _PyStack_AsTuple(args, nargs); - if (argstuple == NULL) { - goto exit; - } - - if (flags & METH_KEYWORDS) { - result = (*(PyCFunctionWithKeywords)meth) (self, argstuple, kwargs); - } - else { - result = (*meth) (self, argstuple); - } - Py_DECREF(argstuple); - break; - } - - case METH_FASTCALL: - { - PyObject **stack; - PyObject *kwnames; - _PyCFunctionFast fastmeth = (_PyCFunctionFast)meth; - - if (_PyStack_UnpackDict(args, nargs, kwargs, &stack, &kwnames) < 0) { - goto exit; - } - - result = (*fastmeth) (self, stack, nargs, kwnames); - if (stack != args) { - PyMem_Free(stack); - } - Py_XDECREF(kwnames); - break; - } - - default: - PyErr_SetString(PyExc_SystemError, - "Bad call flags in _PyMethodDef_RawFastCallDict. " - "METH_OLDARGS is no longer supported!"); - goto exit; - } - - goto exit; - -no_keyword_error: - PyErr_Format(PyExc_TypeError, - "%.200s() takes no keyword arguments", - method->ml_name, nargs); - -exit: - Py_LeaveRecursiveCall(); - return result; -} - - -PyObject * -_PyCFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, - PyObject *kwargs) -{ - PyObject *result; - - assert(func != NULL); - assert(PyCFunction_Check(func)); - - result = _PyMethodDef_RawFastCallDict(((PyCFunctionObject*)func)->m_ml, - PyCFunction_GET_SELF(func), - args, nargs, kwargs); - result = _Py_CheckFunctionResult(func, result, NULL); - return result; -} - - -PyObject * -_PyMethodDef_RawFastCallKeywords(PyMethodDef *method, PyObject *self, PyObject **args, - Py_ssize_t nargs, PyObject *kwnames) -{ - /* _PyMethodDef_RawFastCallKeywords() must not be called with an exception set, - because it can clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - - assert(method != NULL); - assert(nargs >= 0); - assert(kwnames == NULL || PyTuple_CheckExact(kwnames)); - /* kwnames must only contains str strings, no subclass, and all keys must - be unique */ - - PyCFunction meth = method->ml_meth; - int flags = method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST); - Py_ssize_t nkwargs = kwnames == NULL ? 0 : PyTuple_Size(kwnames); - PyObject *result = NULL; - - if (Py_EnterRecursiveCall(" while calling a Python object")) { - return NULL; - } - - switch (flags) - { - case METH_NOARGS: - if (nargs != 0) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%zd given)", - method->ml_name, nargs); - goto exit; - } - - if (nkwargs) { - goto no_keyword_error; - } - - result = (*meth) (self, NULL); - break; - - case METH_O: - if (nargs != 1) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%zd given)", - method->ml_name, nargs); - goto exit; - } - - if (nkwargs) { - goto no_keyword_error; - } - - result = (*meth) (self, args[0]); - break; - - case METH_FASTCALL: - /* Fast-path: avoid temporary dict to pass keyword arguments */ - result = ((_PyCFunctionFast)meth) (self, args, nargs, kwnames); - break; - - case METH_VARARGS: - case METH_VARARGS | METH_KEYWORDS: - { - /* Slow-path: create a temporary tuple for positional arguments - and a temporary dict for keyword arguments */ - PyObject *argtuple; - - if (!(flags & METH_KEYWORDS) && nkwargs) { - goto no_keyword_error; - } - - argtuple = _PyStack_AsTuple(args, nargs); - if (argtuple == NULL) { - goto exit; - } - - if (flags & METH_KEYWORDS) { - PyObject *kwdict; - - if (nkwargs > 0) { - kwdict = _PyStack_AsDict(args + nargs, kwnames); - if (kwdict == NULL) { - Py_DECREF(argtuple); - goto exit; - } - } - else { - kwdict = NULL; - } - - result = (*(PyCFunctionWithKeywords)meth) (self, argtuple, kwdict); - Py_XDECREF(kwdict); - } - else { - result = (*meth) (self, argtuple); - } - Py_DECREF(argtuple); - break; - } - - default: - PyErr_SetString(PyExc_SystemError, - "Bad call flags in _PyCFunction_FastCallKeywords. " - "METH_OLDARGS is no longer supported!"); - goto exit; - } - - goto exit; - -no_keyword_error: - PyErr_Format(PyExc_TypeError, - "%.200s() takes no keyword arguments", - method->ml_name); - -exit: - Py_LeaveRecursiveCall(); - return result; -} - - -PyObject * -_PyCFunction_FastCallKeywords(PyObject *func, PyObject **args, - Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *result; - - assert(func != NULL); - assert(PyCFunction_Check(func)); - - result = _PyMethodDef_RawFastCallKeywords(((PyCFunctionObject*)func)->m_ml, - PyCFunction_GET_SELF(func), - args, nargs, kwnames); - result = _Py_CheckFunctionResult(func, result, NULL); - return result; -} - - -static PyObject * -cfunction_call_varargs(PyObject *func, PyObject *args, PyObject *kwargs) -{ - assert(!PyErr_Occurred()); - - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - PyObject *result; - - if (PyCFunction_GET_FLAGS(func) & METH_KEYWORDS) { - if (Py_EnterRecursiveCall(" while calling a Python object")) { - return NULL; - } - - result = (*(PyCFunctionWithKeywords)meth)(self, args, kwargs); - - Py_LeaveRecursiveCall(); - } - else { - if (kwargs != NULL && PyDict_Size(kwargs) != 0) { - PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", - ((PyCFunctionObject*)func)->m_ml->ml_name); - return NULL; - } - - if (Py_EnterRecursiveCall(" while calling a Python object")) { - return NULL; - } - - result = (*meth)(self, args); - - Py_LeaveRecursiveCall(); - } - - return _Py_CheckFunctionResult(func, result, NULL); -} - - -PyObject * -PyCFunction_Call(PyObject *func, PyObject *args, PyObject *kwargs) -{ - /* first try METH_VARARGS to pass directly args tuple unchanged. - _PyMethodDef_RawFastCallDict() creates a new temporary tuple - for METH_VARARGS. */ - if (PyCFunction_GET_FLAGS(func) & METH_VARARGS) { - return cfunction_call_varargs(func, args, kwargs); - } - else { - return _PyCFunction_FastCallDict(func, - &PyTuple_GET_ITEM(args, 0), - PyTuple_GET_SIZE(args), - kwargs); - } -} - - -/* --- More complex call functions -------------------------------- */ - -/* External interface to call any callable object. - The args must be a tuple or NULL. The kwargs must be a dict or NULL. */ -PyObject * -PyEval_CallObjectWithKeywords(PyObject *callable, - PyObject *args, PyObject *kwargs) -{ -#ifdef Py_DEBUG - /* PyEval_CallObjectWithKeywords() must not be called with an exception - set. It raises a new exception if parameters are invalid or if - PyTuple_New() fails, and so the original exception is lost. */ - assert(!PyErr_Occurred()); -#endif - - if (args == NULL) { - return _PyObject_FastCallDict(callable, NULL, 0, kwargs); - } - - if (!PyTuple_Check(args)) { - PyErr_SetString(PyExc_TypeError, - "argument list must be a tuple"); - return NULL; - } - - if (kwargs != NULL && !PyDict_Check(kwargs)) { - PyErr_SetString(PyExc_TypeError, - "keyword list must be a dictionary"); - return NULL; - } - - return PyObject_Call(callable, args, kwargs); -} - - -PyObject * -PyObject_CallObject(PyObject *callable, PyObject *args) -{ - return PyEval_CallObjectWithKeywords(callable, args, NULL); -} - - -/* Positional arguments are obj followed by args: - call callable(obj, *args, **kwargs) */ -PyObject * -_PyObject_FastCall_Prepend(PyObject *callable, - PyObject *obj, PyObject **args, Py_ssize_t nargs) -{ - PyObject *small_stack[_PY_FASTCALL_SMALL_STACK]; - PyObject **args2; - PyObject *result; - - nargs++; - if (nargs <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) { - args2 = small_stack; - } - else { - args2 = PyMem_Malloc(nargs * sizeof(PyObject *)); - if (args2 == NULL) { - PyErr_NoMemory(); - return NULL; - } - } - - /* use borrowed references */ - args2[0] = obj; - memcpy(&args2[1], - args, - (nargs - 1)* sizeof(PyObject *)); - - result = _PyObject_FastCall(callable, args2, nargs); - if (args2 != small_stack) { - PyMem_Free(args2); - } - return result; -} - - -/* Call callable(obj, *args, **kwargs). */ -PyObject * -_PyObject_Call_Prepend(PyObject *callable, - PyObject *obj, PyObject *args, PyObject *kwargs) -{ - PyObject *small_stack[_PY_FASTCALL_SMALL_STACK]; - PyObject **stack; - Py_ssize_t argcount; - PyObject *result; - - assert(PyTuple_Check(args)); - - argcount = PyTuple_GET_SIZE(args); - if (argcount + 1 <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) { - stack = small_stack; - } - else { - stack = PyMem_Malloc((argcount + 1) * sizeof(PyObject *)); - if (stack == NULL) { - PyErr_NoMemory(); - return NULL; - } - } - - /* use borrowed references */ - stack[0] = obj; - memcpy(&stack[1], - &PyTuple_GET_ITEM(args, 0), - argcount * sizeof(PyObject *)); - - result = _PyObject_FastCallDict(callable, - stack, argcount + 1, - kwargs); - if (stack != small_stack) { - PyMem_Free(stack); - } - return result; -} - - -/* --- Call with a format string ---------------------------------- */ - -static PyObject * -_PyObject_CallFunctionVa(PyObject *callable, const char *format, - va_list va, int is_size_t) -{ - PyObject* small_stack[_PY_FASTCALL_SMALL_STACK]; - const Py_ssize_t small_stack_len = Py_ARRAY_LENGTH(small_stack); - PyObject **stack; - Py_ssize_t nargs, i; - PyObject *result; - - if (callable == NULL) { - return null_error(); - } - - if (!format || !*format) { - return _PyObject_CallNoArg(callable); - } - - if (is_size_t) { - stack = _Py_VaBuildStack_SizeT(small_stack, small_stack_len, - format, va, &nargs); - } - else { - stack = _Py_VaBuildStack(small_stack, small_stack_len, - format, va, &nargs); - } - if (stack == NULL) { - return NULL; - } - - if (nargs == 1 && PyTuple_Check(stack[0])) { - /* Special cases for backward compatibility: - - PyObject_CallFunction(func, "O", tuple) calls func(*tuple) - - PyObject_CallFunction(func, "(OOO)", arg1, arg2, arg3) calls - func(*(arg1, arg2, arg3)): func(arg1, arg2, arg3) */ - PyObject *args = stack[0]; - result = _PyObject_FastCall(callable, - &PyTuple_GET_ITEM(args, 0), - PyTuple_GET_SIZE(args)); - } - else { - result = _PyObject_FastCall(callable, stack, nargs); - } - - for (i = 0; i < nargs; ++i) { - Py_DECREF(stack[i]); - } - if (stack != small_stack) { - PyMem_Free(stack); - } - return result; -} - - -PyObject * -PyObject_CallFunction(PyObject *callable, const char *format, ...) -{ - va_list va; - PyObject *result; - - va_start(va, format); - result = _PyObject_CallFunctionVa(callable, format, va, 0); - va_end(va); - - return result; -} - - -PyObject * -PyEval_CallFunction(PyObject *callable, const char *format, ...) -{ - va_list vargs; - PyObject *args; - PyObject *res; - - va_start(vargs, format); - - args = Py_VaBuildValue(format, vargs); - va_end(vargs); - - if (args == NULL) - return NULL; - - res = PyEval_CallObject(callable, args); - Py_DECREF(args); - - return res; -} - - -PyObject * -_PyObject_CallFunction_SizeT(PyObject *callable, const char *format, ...) -{ - va_list va; - PyObject *result; - - va_start(va, format); - result = _PyObject_CallFunctionVa(callable, format, va, 1); - va_end(va); - - return result; -} - - -static PyObject* -callmethod(PyObject* callable, const char *format, va_list va, int is_size_t) -{ - assert(callable != NULL); - - if (!PyCallable_Check(callable)) { - PyErr_Format(PyExc_TypeError, - "attribute of type '%.200s' is not callable", - Py_TYPE(callable)->tp_name); - return NULL; - } - - return _PyObject_CallFunctionVa(callable, format, va, is_size_t); -} - - -PyObject * -PyObject_CallMethod(PyObject *obj, const char *name, const char *format, ...) -{ - va_list va; - PyObject *callable, *retval; - - if (obj == NULL || name == NULL) { - return null_error(); - } - - callable = PyObject_GetAttrString(obj, name); - if (callable == NULL) - return NULL; - - va_start(va, format); - retval = callmethod(callable, format, va, 0); - va_end(va); - - Py_DECREF(callable); - return retval; -} - - -PyObject * -PyEval_CallMethod(PyObject *obj, const char *name, const char *format, ...) -{ - va_list vargs; - PyObject *meth; - PyObject *args; - PyObject *res; - - meth = PyObject_GetAttrString(obj, name); - if (meth == NULL) - return NULL; - - va_start(vargs, format); - - args = Py_VaBuildValue(format, vargs); - va_end(vargs); - - if (args == NULL) { - Py_DECREF(meth); - return NULL; - } - - res = PyEval_CallObject(meth, args); - Py_DECREF(meth); - Py_DECREF(args); - - return res; -} - - -PyObject * -_PyObject_CallMethodId(PyObject *obj, _Py_Identifier *name, - const char *format, ...) -{ - va_list va; - PyObject *callable, *retval; - - if (obj == NULL || name == NULL) { - return null_error(); - } - - callable = _PyObject_GetAttrId(obj, name); - if (callable == NULL) - return NULL; - - va_start(va, format); - retval = callmethod(callable, format, va, 0); - va_end(va); - - Py_DECREF(callable); - return retval; -} - - -PyObject * -_PyObject_CallMethod_SizeT(PyObject *obj, const char *name, - const char *format, ...) -{ - va_list va; - PyObject *callable, *retval; - - if (obj == NULL || name == NULL) { - return null_error(); - } - - callable = PyObject_GetAttrString(obj, name); - if (callable == NULL) - return NULL; - - va_start(va, format); - retval = callmethod(callable, format, va, 1); - va_end(va); - - Py_DECREF(callable); - return retval; -} - - -PyObject * -_PyObject_CallMethodId_SizeT(PyObject *obj, _Py_Identifier *name, - const char *format, ...) -{ - va_list va; - PyObject *callable, *retval; - - if (obj == NULL || name == NULL) { - return null_error(); - } - - callable = _PyObject_GetAttrId(obj, name); - if (callable == NULL) { - return NULL; - } - - va_start(va, format); - retval = callmethod(callable, format, va, 1); - va_end(va); - - Py_DECREF(callable); - return retval; -} - - -/* --- Call with "..." arguments ---------------------------------- */ - -static PyObject * -object_vacall(PyObject *callable, va_list vargs) -{ - PyObject *small_stack[_PY_FASTCALL_SMALL_STACK]; - PyObject **stack; - Py_ssize_t nargs; - PyObject *result; - Py_ssize_t i; - va_list countva; - - if (callable == NULL) { - return null_error(); - } - - /* Count the number of arguments */ - va_copy(countva, vargs); - nargs = 0; - while (1) { - PyObject *arg = va_arg(countva, PyObject *); - if (arg == NULL) { - break; - } - nargs++; - } - va_end(countva); - - /* Copy arguments */ - if (nargs <= (Py_ssize_t)Py_ARRAY_LENGTH(small_stack)) { - stack = small_stack; - } - else { - stack = PyMem_Malloc(nargs * sizeof(stack[0])); - if (stack == NULL) { - PyErr_NoMemory(); - return NULL; - } - } - - for (i = 0; i < nargs; ++i) { - stack[i] = va_arg(vargs, PyObject *); - } - - /* Call the function */ - result = _PyObject_FastCall(callable, stack, nargs); - - if (stack != small_stack) { - PyMem_Free(stack); - } - return result; -} - - -PyObject * -PyObject_CallMethodObjArgs(PyObject *callable, PyObject *name, ...) -{ - va_list vargs; - PyObject *result; - - if (callable == NULL || name == NULL) { - return null_error(); - } - - callable = PyObject_GetAttr(callable, name); - if (callable == NULL) { - return NULL; - } - - va_start(vargs, name); - result = object_vacall(callable, vargs); - va_end(vargs); - - Py_DECREF(callable); - return result; -} - - -PyObject * -_PyObject_CallMethodIdObjArgs(PyObject *obj, - struct _Py_Identifier *name, ...) -{ - va_list vargs; - PyObject *callable, *result; - - if (obj == NULL || name == NULL) { - return null_error(); - } - - callable = _PyObject_GetAttrId(obj, name); - if (callable == NULL) { - return NULL; - } - - va_start(vargs, name); - result = object_vacall(callable, vargs); - va_end(vargs); - - Py_DECREF(callable); - return result; -} - - -PyObject * -PyObject_CallFunctionObjArgs(PyObject *callable, ...) -{ - va_list vargs; - PyObject *result; - - va_start(vargs, callable); - result = object_vacall(callable, vargs); - va_end(vargs); - - return result; -} - - -/* --- PyStack functions ------------------------------------------ */ - -/* Issue #29234: Inlining _PyStack_AsTuple() into callers increases their - stack consumption, Disable inlining to optimize the stack consumption. */ -PyObject* _Py_NO_INLINE -_PyStack_AsTuple(PyObject **stack, Py_ssize_t nargs) -{ - PyObject *args; - Py_ssize_t i; - - args = PyTuple_New(nargs); - if (args == NULL) { - return NULL; - } - - for (i=0; i < nargs; i++) { - PyObject *item = stack[i]; - Py_INCREF(item); - PyTuple_SET_ITEM(args, i, item); - } - return args; -} - - -PyObject* -_PyStack_AsTupleSlice(PyObject **stack, Py_ssize_t nargs, - Py_ssize_t start, Py_ssize_t end) -{ - PyObject *args; - Py_ssize_t i; - - assert(0 <= start); - assert(end <= nargs); - assert(start <= end); - - args = PyTuple_New(end - start); - if (args == NULL) { - return NULL; - } - - for (i=start; i < end; i++) { - PyObject *item = stack[i]; - Py_INCREF(item); - PyTuple_SET_ITEM(args, i - start, item); - } - return args; -} - - -PyObject * -_PyStack_AsDict(PyObject **values, PyObject *kwnames) -{ - Py_ssize_t nkwargs; - PyObject *kwdict; - Py_ssize_t i; - - assert(kwnames != NULL); - nkwargs = PyTuple_GET_SIZE(kwnames); - kwdict = _PyDict_NewPresized(nkwargs); - if (kwdict == NULL) { - return NULL; - } - - for (i = 0; i < nkwargs; i++) { - PyObject *key = PyTuple_GET_ITEM(kwnames, i); - PyObject *value = *values++; - /* If key already exists, replace it with the new value */ - if (PyDict_SetItem(kwdict, key, value)) { - Py_DECREF(kwdict); - return NULL; - } - } - return kwdict; -} - - -int -_PyStack_UnpackDict(PyObject **args, Py_ssize_t nargs, PyObject *kwargs, - PyObject ***p_stack, PyObject **p_kwnames) -{ - PyObject **stack, **kwstack; - Py_ssize_t nkwargs; - Py_ssize_t pos, i; - PyObject *key, *value; - PyObject *kwnames; - - assert(nargs >= 0); - assert(kwargs == NULL || PyDict_CheckExact(kwargs)); - - if (kwargs == NULL || (nkwargs = PyDict_GET_SIZE(kwargs)) == 0) { - *p_stack = args; - *p_kwnames = NULL; - return 0; - } - - if ((size_t)nargs > PY_SSIZE_T_MAX / sizeof(stack[0]) - (size_t)nkwargs) { - PyErr_NoMemory(); - return -1; - } - - stack = PyMem_Malloc((nargs + nkwargs) * sizeof(stack[0])); - if (stack == NULL) { - PyErr_NoMemory(); - return -1; - } - - kwnames = PyTuple_New(nkwargs); - if (kwnames == NULL) { - PyMem_Free(stack); - return -1; - } - - /* Copy position arguments (borrowed references) */ - memcpy(stack, args, nargs * sizeof(stack[0])); - - kwstack = stack + nargs; - pos = i = 0; - /* This loop doesn't support lookup function mutating the dictionary - to change its size. It's a deliberate choice for speed, this function is - called in the performance critical hot code. */ - while (PyDict_Next(kwargs, &pos, &key, &value)) { - Py_INCREF(key); - PyTuple_SET_ITEM(kwnames, i, key); - /* The stack contains borrowed references */ - kwstack[i] = value; - i++; - } - - *p_stack = stack; - *p_kwnames = kwnames; - return 0; -} diff --git a/Objects/methodobject.c b/Objects/methodobject.c --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -77,6 +77,329 @@ return PyCFunction_GET_FLAGS(op); } +static PyObject * +cfunction_call_varargs(PyObject *func, PyObject *args, PyObject *kwargs) +{ + assert(!PyErr_Occurred()); + + PyCFunction meth = PyCFunction_GET_FUNCTION(func); + PyObject *self = PyCFunction_GET_SELF(func); + PyObject *result; + + if (PyCFunction_GET_FLAGS(func) & METH_KEYWORDS) { + if (Py_EnterRecursiveCall(" while calling a Python object")) { + return NULL; + } + + result = (*(PyCFunctionWithKeywords)meth)(self, args, kwargs); + + Py_LeaveRecursiveCall(); + } + else { + if (kwargs != NULL && PyDict_Size(kwargs) != 0) { + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + ((PyCFunctionObject*)func)->m_ml->ml_name); + return NULL; + } + + if (Py_EnterRecursiveCall(" while calling a Python object")) { + return NULL; + } + + result = (*meth)(self, args); + + Py_LeaveRecursiveCall(); + } + + return _Py_CheckFunctionResult(func, result, NULL); +} + + +PyObject * +PyCFunction_Call(PyObject *func, PyObject *args, PyObject *kwargs) +{ + /* first try METH_VARARGS to pass directly args tuple unchanged. + _PyMethodDef_RawFastCallDict() creates a new temporary tuple + for METH_VARARGS. */ + if (PyCFunction_GET_FLAGS(func) & METH_VARARGS) { + return cfunction_call_varargs(func, args, kwargs); + } + else { + return _PyCFunction_FastCallDict(func, + &PyTuple_GET_ITEM(args, 0), + PyTuple_GET_SIZE(args), + kwargs); + } +} + +PyObject * +_PyMethodDef_RawFastCallDict(PyMethodDef *method, PyObject *self, PyObject **args, + Py_ssize_t nargs, PyObject *kwargs) +{ + /* _PyMethodDef_RawFastCallDict() must not be called with an exception set, + because it can clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); + + assert(method != NULL); + assert(nargs >= 0); + assert(nargs == 0 || args != NULL); + assert(kwargs == NULL || PyDict_Check(kwargs)); + + PyCFunction meth = method->ml_meth; + int flags = method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST); + PyObject *result = NULL; + + if (Py_EnterRecursiveCall(" while calling a Python object")) { + return NULL; + } + + switch (flags) + { + case METH_NOARGS: + if (nargs != 0) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%zd given)", + method->ml_name, nargs); + goto exit; + } + + if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) { + goto no_keyword_error; + } + + result = (*meth) (self, NULL); + break; + + case METH_O: + if (nargs != 1) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%zd given)", + method->ml_name, nargs); + goto exit; + } + + if (kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) { + goto no_keyword_error; + } + + result = (*meth) (self, args[0]); + break; + + case METH_VARARGS: + if (!(flags & METH_KEYWORDS) + && kwargs != NULL && PyDict_GET_SIZE(kwargs) != 0) { + goto no_keyword_error; + } + /* fall through next case */ + + case METH_VARARGS | METH_KEYWORDS: + { + /* Slow-path: create a temporary tuple for positional arguments */ + PyObject *argstuple = _PyStack_AsTuple(args, nargs); + if (argstuple == NULL) { + goto exit; + } + + if (flags & METH_KEYWORDS) { + result = (*(PyCFunctionWithKeywords)meth) (self, argstuple, kwargs); + } + else { + result = (*meth) (self, argstuple); + } + Py_DECREF(argstuple); + break; + } + + case METH_FASTCALL: + { + PyObject **stack; + PyObject *kwnames; + _PyCFunctionFast fastmeth = (_PyCFunctionFast)meth; + + if (_PyStack_UnpackDict(args, nargs, kwargs, &stack, &kwnames) < 0) { + goto exit; + } + + result = (*fastmeth) (self, stack, nargs, kwnames); + if (stack != args) { + PyMem_Free(stack); + } + Py_XDECREF(kwnames); + break; + } + + default: + PyErr_SetString(PyExc_SystemError, + "Bad call flags in _PyMethodDef_RawFastCallDict. " + "METH_OLDARGS is no longer supported!"); + goto exit; + } + + goto exit; + +no_keyword_error: + PyErr_Format(PyExc_TypeError, + "%.200s() takes no keyword arguments", + method->ml_name, nargs); + +exit: + Py_LeaveRecursiveCall(); + return result; +} + +PyObject * +_PyCFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, + PyObject *kwargs) +{ + PyObject *result; + + assert(func != NULL); + assert(PyCFunction_Check(func)); + + result = _PyMethodDef_RawFastCallDict(((PyCFunctionObject*)func)->m_ml, + PyCFunction_GET_SELF(func), + args, nargs, kwargs); + result = _Py_CheckFunctionResult(func, result, NULL); + return result; +} + +PyObject * +_PyMethodDef_RawFastCallKeywords(PyMethodDef *method, PyObject *self, PyObject **args, + Py_ssize_t nargs, PyObject *kwnames) +{ + /* _PyMethodDef_RawFastCallKeywords() must not be called with an exception set, + because it can clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); + + assert(method != NULL); + assert(nargs >= 0); + assert(kwnames == NULL || PyTuple_CheckExact(kwnames)); + /* kwnames must only contains str strings, no subclass, and all keys must + be unique */ + + PyCFunction meth = method->ml_meth; + int flags = method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST); + Py_ssize_t nkwargs = kwnames == NULL ? 0 : PyTuple_Size(kwnames); + PyObject *result = NULL; + + if (Py_EnterRecursiveCall(" while calling a Python object")) { + return NULL; + } + + switch (flags) + { + case METH_NOARGS: + if (nargs != 0) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%zd given)", + method->ml_name, nargs); + goto exit; + } + + if (nkwargs) { + goto no_keyword_error; + } + + result = (*meth) (self, NULL); + break; + + case METH_O: + if (nargs != 1) { + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%zd given)", + method->ml_name, nargs); + goto exit; + } + + if (nkwargs) { + goto no_keyword_error; + } + + result = (*meth) (self, args[0]); + break; + + case METH_FASTCALL: + /* Fast-path: avoid temporary dict to pass keyword arguments */ + result = ((_PyCFunctionFast)meth) (self, args, nargs, kwnames); + break; + + case METH_VARARGS: + case METH_VARARGS | METH_KEYWORDS: + { + /* Slow-path: create a temporary tuple for positional arguments + and a temporary dict for keyword arguments */ + PyObject *argtuple; + + if (!(flags & METH_KEYWORDS) && nkwargs) { + goto no_keyword_error; + } + + argtuple = _PyStack_AsTuple(args, nargs); + if (argtuple == NULL) { + goto exit; + } + + if (flags & METH_KEYWORDS) { + PyObject *kwdict; + + if (nkwargs > 0) { + kwdict = _PyStack_AsDict(args + nargs, kwnames); + if (kwdict == NULL) { + Py_DECREF(argtuple); + goto exit; + } + } + else { + kwdict = NULL; + } + + result = (*(PyCFunctionWithKeywords)meth) (self, argtuple, kwdict); + Py_XDECREF(kwdict); + } + else { + result = (*meth) (self, argtuple); + } + Py_DECREF(argtuple); + break; + } + + default: + PyErr_SetString(PyExc_SystemError, + "Bad call flags in _PyCFunction_FastCallKeywords. " + "METH_OLDARGS is no longer supported!"); + goto exit; + } + + goto exit; + +no_keyword_error: + PyErr_Format(PyExc_TypeError, + "%.200s() takes no keyword arguments", + method->ml_name); + +exit: + Py_LeaveRecursiveCall(); + return result; +} + +PyObject * +_PyCFunction_FastCallKeywords(PyObject *func, PyObject **args, + Py_ssize_t nargs, PyObject *kwnames) +{ + PyObject *result; + + assert(func != NULL); + assert(PyCFunction_Check(func)); + + result = _PyMethodDef_RawFastCallKeywords(((PyCFunctionObject*)func)->m_ml, + PyCFunction_GET_SELF(func), + args, nargs, kwnames); + result = _Py_CheckFunctionResult(func, result, NULL); + return result; +} + /* Methods (the standard built-in methods, that is) */ static void diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -294,10 +294,9 @@ + - - diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -37,6 +37,7 @@ /* Forward declarations */ Py_LOCAL_INLINE(PyObject *) call_function(PyObject ***, Py_ssize_t, PyObject *); +static PyObject * fast_function(PyObject *, PyObject **, Py_ssize_t, PyObject *); static PyObject * do_call_core(PyObject *, PyObject *, PyObject *); #ifdef LLTRACE @@ -3894,7 +3895,7 @@ PyEval_EvalFrame() and PyEval_EvalCodeEx() you will need to adjust the test in the if statements in Misc/gdbinit (pystack and pystackv). */ -PyObject * +static PyObject * _PyEval_EvalCodeWithName(PyObject *_co, PyObject *globals, PyObject *locals, PyObject **args, Py_ssize_t argcount, PyObject **kwnames, PyObject **kwargs, @@ -4731,6 +4732,39 @@ } +/* External interface to call any callable object. + The arg must be a tuple or NULL. The kw must be a dict or NULL. */ + +PyObject * +PyEval_CallObjectWithKeywords(PyObject *callable, + PyObject *args, PyObject *kwargs) +{ +#ifdef Py_DEBUG + /* PyEval_CallObjectWithKeywords() must not be called with an exception + set. It raises a new exception if parameters are invalid or if + PyTuple_New() fails, and so the original exception is lost. */ + assert(!PyErr_Occurred()); +#endif + + if (args == NULL) { + return _PyObject_FastCallDict(callable, NULL, 0, kwargs); + } + + if (!PyTuple_Check(args)) { + PyErr_SetString(PyExc_TypeError, + "argument list must be a tuple"); + return NULL; + } + + if (kwargs != NULL && !PyDict_Check(kwargs)) { + PyErr_SetString(PyExc_TypeError, + "keyword list must be a dictionary"); + return NULL; + } + + return PyObject_Call(callable, args, kwargs); +} + const char * PyEval_GetFuncName(PyObject *func) { @@ -4831,7 +4865,7 @@ } if (PyFunction_Check(func)) { - x = _PyFunction_FastCallKeywords(func, stack, nargs, kwnames); + x = fast_function(func, stack, nargs, kwnames); } else { x = _PyObject_FastCallKeywords(func, stack, nargs, kwnames); @@ -4841,7 +4875,10 @@ assert((x != NULL) ^ (PyErr_Occurred() != NULL)); - /* Clear the stack of the function object. */ + /* Clear the stack of the function object. Also removes + the arguments in case they weren't consumed already + (fast_function() and err_args() leave them on the stack). + */ while ((*pp_stack) > pfunc) { w = EXT_POP(*pp_stack); Py_DECREF(w); @@ -4850,6 +4887,205 @@ return x; } +/* The fast_function() function optimize calls for which no argument + tuple is necessary; the objects are passed directly from the stack. + For the simplest case -- a function that takes only positional + arguments and is called with only positional arguments -- it + inlines the most primitive frame setup code from + PyEval_EvalCodeEx(), which vastly reduces the checks that must be + done before evaluating the frame. +*/ + +static PyObject* _Py_HOT_FUNCTION +_PyFunction_FastCall(PyCodeObject *co, PyObject **args, Py_ssize_t nargs, + PyObject *globals) +{ + PyFrameObject *f; + PyThreadState *tstate = PyThreadState_GET(); + PyObject **fastlocals; + Py_ssize_t i; + PyObject *result; + + assert(globals != NULL); + /* XXX Perhaps we should create a specialized + _PyFrame_New_NoTrack() that doesn't take locals, but does + take builtins without sanity checking them. + */ + assert(tstate != NULL); + f = _PyFrame_New_NoTrack(tstate, co, globals, NULL); + if (f == NULL) { + return NULL; + } + + fastlocals = f->f_localsplus; + + for (i = 0; i < nargs; i++) { + Py_INCREF(*args); + fastlocals[i] = *args++; + } + result = PyEval_EvalFrameEx(f,0); + + if (Py_REFCNT(f) > 1) { + Py_DECREF(f); + _PyObject_GC_TRACK(f); + } + else { + ++tstate->recursion_depth; + Py_DECREF(f); + --tstate->recursion_depth; + } + return result; +} + +static PyObject * +fast_function(PyObject *func, PyObject **stack, + Py_ssize_t nargs, PyObject *kwnames) +{ + PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); + PyObject *globals = PyFunction_GET_GLOBALS(func); + PyObject *argdefs = PyFunction_GET_DEFAULTS(func); + PyObject *kwdefs, *closure, *name, *qualname; + PyObject **d; + Py_ssize_t nkwargs = (kwnames == NULL) ? 0 : PyTuple_GET_SIZE(kwnames); + Py_ssize_t nd; + + assert(PyFunction_Check(func)); + assert(nargs >= 0); + assert(kwnames == NULL || PyTuple_CheckExact(kwnames)); + assert((nargs == 0 && nkwargs == 0) || stack != NULL); + /* kwnames must only contains str strings, no subclass, and all keys must + be unique */ + + if (co->co_kwonlyargcount == 0 && nkwargs == 0 && + co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) + { + if (argdefs == NULL && co->co_argcount == nargs) { + return _PyFunction_FastCall(co, stack, nargs, globals); + } + else if (nargs == 0 && argdefs != NULL + && co->co_argcount == Py_SIZE(argdefs)) { + /* function called with no arguments, but all parameters have + a default value: use default values as arguments .*/ + stack = &PyTuple_GET_ITEM(argdefs, 0); + return _PyFunction_FastCall(co, stack, Py_SIZE(argdefs), globals); + } + } + + kwdefs = PyFunction_GET_KW_DEFAULTS(func); + closure = PyFunction_GET_CLOSURE(func); + name = ((PyFunctionObject *)func) -> func_name; + qualname = ((PyFunctionObject *)func) -> func_qualname; + + if (argdefs != NULL) { + d = &PyTuple_GET_ITEM(argdefs, 0); + nd = Py_SIZE(argdefs); + } + else { + d = NULL; + nd = 0; + } + return _PyEval_EvalCodeWithName((PyObject*)co, globals, (PyObject *)NULL, + stack, nargs, + nkwargs ? &PyTuple_GET_ITEM(kwnames, 0) : NULL, + stack + nargs, + nkwargs, 1, + d, (int)nd, kwdefs, + closure, name, qualname); +} + +PyObject * +_PyFunction_FastCallKeywords(PyObject *func, PyObject **stack, + Py_ssize_t nargs, PyObject *kwnames) +{ + return fast_function(func, stack, nargs, kwnames); +} + +PyObject * +_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, + PyObject *kwargs) +{ + PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); + PyObject *globals = PyFunction_GET_GLOBALS(func); + PyObject *argdefs = PyFunction_GET_DEFAULTS(func); + PyObject *kwdefs, *closure, *name, *qualname; + PyObject *kwtuple, **k; + PyObject **d; + Py_ssize_t nd, nk; + PyObject *result; + + assert(func != NULL); + assert(nargs >= 0); + assert(nargs == 0 || args != NULL); + assert(kwargs == NULL || PyDict_Check(kwargs)); + + if (co->co_kwonlyargcount == 0 && + (kwargs == NULL || PyDict_GET_SIZE(kwargs) == 0) && + co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) + { + /* Fast paths */ + if (argdefs == NULL && co->co_argcount == nargs) { + return _PyFunction_FastCall(co, args, nargs, globals); + } + else if (nargs == 0 && argdefs != NULL + && co->co_argcount == Py_SIZE(argdefs)) { + /* function called with no arguments, but all parameters have + a default value: use default values as arguments .*/ + args = &PyTuple_GET_ITEM(argdefs, 0); + return _PyFunction_FastCall(co, args, Py_SIZE(argdefs), globals); + } + } + + nk = (kwargs != NULL) ? PyDict_GET_SIZE(kwargs) : 0; + if (nk != 0) { + Py_ssize_t pos, i; + + /* Issue #29318: Caller and callee functions must not share the + dictionary: kwargs must be copied. */ + kwtuple = PyTuple_New(2 * nk); + if (kwtuple == NULL) { + return NULL; + } + + k = &PyTuple_GET_ITEM(kwtuple, 0); + pos = i = 0; + while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { + /* We must hold strong references because keyword arguments can be + indirectly modified while the function is called: + see issue #2016 and test_extcall */ + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); + i += 2; + } + nk = i / 2; + } + else { + kwtuple = NULL; + k = NULL; + } + + kwdefs = PyFunction_GET_KW_DEFAULTS(func); + closure = PyFunction_GET_CLOSURE(func); + name = ((PyFunctionObject *)func) -> func_name; + qualname = ((PyFunctionObject *)func) -> func_qualname; + + if (argdefs != NULL) { + d = &PyTuple_GET_ITEM(argdefs, 0); + nd = Py_SIZE(argdefs); + } + else { + d = NULL; + nd = 0; + } + + result = _PyEval_EvalCodeWithName((PyObject*)co, globals, (PyObject *)NULL, + args, nargs, + k, k + 1, nk, 2, + d, nd, kwdefs, + closure, name, qualname); + Py_XDECREF(kwtuple); + return result; +} + static PyObject * do_call_core(PyObject *func, PyObject *callargs, PyObject *kwdict) { diff --git a/Python/modsupport.c b/Python/modsupport.c --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -586,6 +586,57 @@ } +PyObject * +PyEval_CallFunction(PyObject *callable, const char *format, ...) +{ + va_list vargs; + PyObject *args; + PyObject *res; + + va_start(vargs, format); + + args = Py_VaBuildValue(format, vargs); + va_end(vargs); + + if (args == NULL) + return NULL; + + res = PyEval_CallObject(callable, args); + Py_DECREF(args); + + return res; +} + + +PyObject * +PyEval_CallMethod(PyObject *obj, const char *name, const char *format, ...) +{ + va_list vargs; + PyObject *meth; + PyObject *args; + PyObject *res; + + meth = PyObject_GetAttrString(obj, name); + if (meth == NULL) + return NULL; + + va_start(vargs, format); + + args = Py_VaBuildValue(format, vargs); + va_end(vargs); + + if (args == NULL) { + Py_DECREF(meth); + return NULL; + } + + res = PyEval_CallObject(meth, args); + Py_DECREF(meth); + Py_DECREF(args); + + return res; +} + int PyModule_AddObject(PyObject *m, const char *name, PyObject *o) { -- Repository URL: https://hg.python.org/cpython From lp_benchmark_robot at intel.com Fri Feb 10 16:41:29 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 10 Feb 2017 13:41:29 -0800 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2017-02-10 Message-ID: <82f3405f-3822-4b97-839a-1c28973c5bfa@orsmsx103.amr.corp.intel.com> Results for project Python 2.7, build date 2017-02-10 11:49:11 +0000 commit: b07d454e45a2 previous commit: 3fd198b80f29 revision date: 2017-02-09 16:00:31 +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% -0.14% 4.10% 4.74% :-) pybench 0.18% 0.02% 7.65% 2.98% :-| regex_v8 0.55% 0.17% -0.16% 9.77% :-) nbody 0.12% -0.08% 11.92% 1.81% :-| json_dump_v2 0.30% 0.26% 0.50% 10.45% :-( normal_startup 2.08% 0.47% -2.75% 2.44% :-| ssbench 0.20% 0.08% 0.19% 2.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-2017-02-10/ 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 Fri Feb 10 16:42:34 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 10 Feb 2017 13:42:34 -0800 Subject: [Python-checkins] UGLY Benchmark Results for Python Default 2017-02-10 Message-ID: <1918fb07-52b7-458c-8e1c-60c946be1ffd@orsmsx103.amr.corp.intel.com> Results for project Python default, build date 2017-02-10 11:05:01 +0000 commit: e5cd74868dfc previous commit: 31342913fb1e revision date: 2017-02-09 23:41:06 +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.28% -1.03% 9.00% 17.48% :-) pybench 0.15% 0.66% 4.34% 3.30% :-| regex_v8 3.66% 0.39% 1.84% 3.66% :-| nbody 0.20% -0.95% 0.66% 2.22% :-) json_dump_v2 0.30% 1.29% 10.69% 8.38% :-| normal_startup 1.00% 0.32% 0.89% 6.03% ---------------------------------------------------------------------------------- * 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-2017-02-10/ 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 noreply at github.com Fri Feb 10 17:24:17 2017 From: noreply at github.com (GitHub) Date: Fri, 10 Feb 2017 14:24:17 -0800 Subject: [Python-checkins] [python/cpython] 348185: Add a codecov configuration file Message-ID: <589e3d91df359_20e73fa7d682fc2c5746e@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 34818577b84c587f30694c9804437b0987b2013d https://github.com/python/cpython/commit/34818577b84c587f30694c9804437b0987b2013d Author: Brett Cannon Date: 2017-02-10 (Fri, 10 Feb 2017) Changed paths: A .codecov.yml Log Message: ----------- Add a codecov configuration file From noreply at github.com Fri Feb 10 17:21:16 2017 From: noreply at github.com (GitHub) Date: Fri, 10 Feb 2017 14:21:16 -0800 Subject: [Python-checkins] [python/cpython] bb09c8: Add a Travis configuration file Message-ID: <589e3cdc71168_14893f83ec04bc4453528@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: bb09c863e94b40d6169481b89e708949252e4756 https://github.com/python/cpython/commit/bb09c863e94b40d6169481b89e708949252e4756 Author: Brett Cannon Date: 2017-02-10 (Fri, 10 Feb 2017) Changed paths: A .travis.yml Log Message: ----------- Add a Travis configuration file From noreply at github.com Fri Feb 10 17:33:57 2017 From: noreply at github.com (GitHub) Date: Fri, 10 Feb 2017 14:33:57 -0800 Subject: [Python-checkins] [python/cpython] aa2a62: Add the Codecov badge for master Message-ID: <589e3fd556cdf_27f743fbf70c4bc28546c@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: aa2a621c8bb476444bd3a9f2c003b3620562d88b https://github.com/python/cpython/commit/aa2a621c8bb476444bd3a9f2c003b3620562d88b Author: Brett Cannon Date: 2017-02-10 (Fri, 10 Feb 2017) Changed paths: M .github/CONTRIBUTING.rst Log Message: ----------- Add the Codecov badge for master From noreply at github.com Fri Feb 10 17:31:09 2017 From: noreply at github.com (GitHub) Date: Fri, 10 Feb 2017 14:31:09 -0800 Subject: [Python-checkins] [python/cpython] 3f9339: Add a Travis badge for the master branch Message-ID: <589e3f2de34c8_280e03fdac9961c3c33572@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 3f9339b569b09e8999d84ac80c921f2633f56307 https://github.com/python/cpython/commit/3f9339b569b09e8999d84ac80c921f2633f56307 Author: Brett Cannon Date: 2017-02-10 (Fri, 10 Feb 2017) Changed paths: M .github/CONTRIBUTING.rst Log Message: ----------- Add a Travis badge for the master branch From noreply at github.com Fri Feb 10 17:41:44 2017 From: noreply at github.com (GitHub) Date: Fri, 10 Feb 2017 14:41:44 -0800 Subject: [Python-checkins] [python/cpython] 190074: Support "bpo-" in Misc/NEWS Message-ID: <589e41a8e40ef_16c53fc068d7bc30969c4@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/bpo-news-support Home: https://github.com/python/cpython Commit: 190074030329e6f37f58122fed3b0e7c17fe1d48 https://github.com/python/cpython/commit/190074030329e6f37f58122fed3b0e7c17fe1d48 Author: Brett Cannon Date: 2017-02-10 (Fri, 10 Feb 2017) Changed paths: M Doc/tools/extensions/pyspecific.py Log Message: ----------- Support "bpo-" in Misc/NEWS From noreply at github.com Fri Feb 10 17:34:59 2017 From: noreply at github.com (GitHub) Date: Fri, 10 Feb 2017 14:34:59 -0800 Subject: [Python-checkins] [python/cpython] f6516a: Fix formatting issue with Codecov badge Message-ID: <589e40137641d_de13fd5e6209c3897256@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: f6516af8f31003ce99fc68bbf86ea31aabbd0015 https://github.com/python/cpython/commit/f6516af8f31003ce99fc68bbf86ea31aabbd0015 Author: Brett Cannon Date: 2017-02-10 (Fri, 10 Feb 2017) Changed paths: M .github/CONTRIBUTING.rst Log Message: ----------- Fix formatting issue with Codecov badge From noreply at github.com Fri Feb 10 17:53:52 2017 From: noreply at github.com (GitHub) Date: Fri, 10 Feb 2017 14:53:52 -0800 Subject: [Python-checkins] [python/cpython] 540116: Fix up the match and substitution regexes Message-ID: <589e448025bb2_196f3fe5261d5c2c240bd@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/bpo-news-support Home: https://github.com/python/cpython Commit: 54011640183be0f18eebe2da7b0e3e81160dbb17 https://github.com/python/cpython/commit/54011640183be0f18eebe2da7b0e3e81160dbb17 Author: Brett Cannon Date: 2017-02-10 (Fri, 10 Feb 2017) Changed paths: M Doc/tools/extensions/pyspecific.py Log Message: ----------- Fix up the match and substitution regexes Make the prefix match non-capturing and fix a bug where a backslash was left into the substitution. From noreply at github.com Fri Feb 10 18:06:07 2017 From: noreply at github.com (GitHub) Date: Fri, 10 Feb 2017 15:06:07 -0800 Subject: [Python-checkins] [python/cpython] 02a87c: Address reviewer comments Message-ID: <589e475f1d933_222f3fcfab443c3862393@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/bpo-news-support Home: https://github.com/python/cpython Commit: 02a87ce98d14f4d9d6e72ade7b4146201657bb33 https://github.com/python/cpython/commit/02a87ce98d14f4d9d6e72ade7b4146201657bb33 Author: Brett Cannon Date: 2017-02-10 (Fri, 10 Feb 2017) Changed paths: M Doc/tools/extensions/pyspecific.py Log Message: ----------- Address reviewer comments From noreply at github.com Fri Feb 10 18:10:15 2017 From: noreply at github.com (GitHub) Date: Fri, 10 Feb 2017 15:10:15 -0800 Subject: [Python-checkins] [python/cpython] 79ab8b: Support "bpo-" in Misc/NEWS (#1) Message-ID: <589e48577aa6c_287e83f8a609cbc40329a0@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 79ab8be05fb4ffb5c258d2ca49be5fc2d4880431 https://github.com/python/cpython/commit/79ab8be05fb4ffb5c258d2ca49be5fc2d4880431 Author: Brett Cannon Date: 2017-02-10 (Fri, 10 Feb 2017) Changed paths: M Doc/tools/extensions/pyspecific.py Log Message: ----------- Support "bpo-" in Misc/NEWS (#1) From noreply at github.com Fri Feb 10 18:10:33 2017 From: noreply at github.com (GitHub) Date: Fri, 10 Feb 2017 15:10:33 -0800 Subject: [Python-checkins] [python/cpython] Message-ID: <589e48697bed_19b33fcf7e66fc3c204b1@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/bpo-news-support Home: https://github.com/python/cpython From noreply at github.com Fri Feb 10 19:26:12 2017 From: noreply at github.com (GitHub) Date: Fri, 10 Feb 2017 16:26:12 -0800 Subject: [Python-checkins] [python/cpython] 0d5f11: Don't treat warnings as error in Travis docs job (... Message-ID: <589e5a24772c8_120d3ff5a5b4fc28451d7@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 0d5f11061a873e9fb67ae59e46b3313e5ba22fc3 https://github.com/python/cpython/commit/0d5f11061a873e9fb67ae59e46b3313e5ba22fc3 Author: Victor Stinner Date: 2017-02-11 (Sat, 11 Feb 2017) Changed paths: M .travis.yml Log Message: ----------- Don't treat warnings as error in Travis docs job (#7) bpo-29527. From noreply at github.com Fri Feb 10 19:58:36 2017 From: noreply at github.com (GitHub) Date: Fri, 10 Feb 2017 16:58:36 -0800 Subject: [Python-checkins] [python/cpython] 4538dd: Fix bpo-29528 Use a secure variable to stop spam (... Message-ID: <589e61bcbaba_7f783fb29586dc2449911@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 4538ddcacc8e8f00d5d36d7bc84e551a56ce6da2 https://github.com/python/cpython/commit/4538ddcacc8e8f00d5d36d7bc84e551a56ce6da2 Author: Donald Stufft Date: 2017-02-11 (Sat, 11 Feb 2017) Changed paths: M .travis.yml Log Message: ----------- Fix bpo-29528 Use a secure variable to stop spam (#13) If the IRC notification is stored in plaintext, then anyone who forks the repository and also adds it to travis will send notifications to the IRC channel for their fork by default. Since the secure variable is encrypted using a repository specific key, this will only work when it is being built using the correct repository. From noreply at github.com Fri Feb 10 20:21:40 2017 From: noreply at github.com (GitHub) Date: Fri, 10 Feb 2017 17:21:40 -0800 Subject: [Python-checkins] [python/cpython] d783b0: Rename README to README.rst and enhance formatting... Message-ID: <589e6724811a1_e2e3fa0ecd05c382374d@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: d783b01fdfb01955c1854e78ee69c731a5c035b6 https://github.com/python/cpython/commit/d783b01fdfb01955c1854e78ee69c731a5c035b6 Author: Victor Stinner Date: 2017-02-11 (Sat, 11 Feb 2017) Changed paths: M Makefile.pre.in R README A README.rst Log Message: ----------- Rename README to README.rst and enhance formatting (#2) Update also the Release Schedule to Python 3.7. From noreply at github.com Fri Feb 10 20:44:58 2017 From: noreply at github.com (GitHub) Date: Fri, 10 Feb 2017 17:44:58 -0800 Subject: [Python-checkins] [python/cpython] 5c3298: bpo-29474: Improve documentation for weakref.WeakV... Message-ID: <589e6c9ad3ff1_28bdf3faaadbbdc343681b@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/2.7 Home: https://github.com/python/cpython Commit: 5c329882fa20f615375f068176e569de7389fa3f https://github.com/python/cpython/commit/5c329882fa20f615375f068176e569de7389fa3f Author: Mariatta Date: 2017-02-10 (Fri, 10 Feb 2017) Changed paths: M Doc/library/weakref.rst Log Message: ----------- bpo-29474: Improve documentation for weakref.WeakValueDictionary (#11) There were some grammatical errors in weakref.WeakValueDictionary documentation. From noreply at github.com Fri Feb 10 22:02:19 2017 From: noreply at github.com (GitHub) Date: Fri, 10 Feb 2017 19:02:19 -0800 Subject: [Python-checkins] [python/cpython] 29896a: Make Travis docs build more lenient (#16) Message-ID: <589e7ebbc9515_1c403ff0c7093c4084145@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 29896ad3d33aaf1b9cb1e0f117f7d989843b4a19 https://github.com/python/cpython/commit/29896ad3d33aaf1b9cb1e0f117f7d989843b4a19 Author: Zachary Ware Date: 2017-02-11 (Sat, 11 Feb 2017) Changed paths: M .travis.yml Log Message: ----------- Make Travis docs build more lenient (#16) From noreply at github.com Fri Feb 10 23:47:39 2017 From: noreply at github.com (GitHub) Date: Fri, 10 Feb 2017 20:47:39 -0800 Subject: [Python-checkins] [python/cpython] e7ffb9: Fix some sphinx warnings (#9) Message-ID: <589e976b9035b_22ab3fa8213d9c2c95469@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: e7ffb99f842ebff97cffa0fc90b18be4e5abecf2 https://github.com/python/cpython/commit/e7ffb99f842ebff97cffa0fc90b18be4e5abecf2 Author: Ryan Gonzalez Date: 2017-02-11 (Sat, 11 Feb 2017) Changed paths: M Doc/Makefile M Doc/conf.py M Misc/NEWS Log Message: ----------- Fix some sphinx warnings (#9) * Fix some deprecation warnings in Doc/conf.py * Fix an rst error in Misc/NEWS From solipsis at pitrou.net Sat Feb 11 04:17:53 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 11 Feb 2017 09:17:53 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=5 Message-ID: <20170211091753.53496.91417.B7582067@psf.io> results for 4243df51fe43 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/reflogLA_NJk', '--timeout', '7200'] From noreply at github.com Sat Feb 11 23:51:31 2017 From: noreply at github.com (GitHub) Date: Sat, 11 Feb 2017 20:51:31 -0800 Subject: [Python-checkins] [python/cpython] 2294f3: bpo-29438: fixed use-after-free in key sharing dic... Message-ID: <589fe9d3df980_216b3ff7dc041c30271e@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 2294f3aee14a6074b17c67ef936c607430bb3c7a https://github.com/python/cpython/commit/2294f3aee14a6074b17c67ef936c607430bb3c7a Author: INADA Naoki Date: 2017-02-12 (Sun, 12 Feb 2017) Changed paths: M Misc/NEWS M Objects/dictobject.c Log Message: ----------- bpo-29438: fixed use-after-free in key sharing dict (#17) From solipsis at pitrou.net Sun Feb 12 04:16:25 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 12 Feb 2017 09:16:25 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=3 Message-ID: <20170212091624.125344.42704.28313E6C@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [7, -7, 1] memory blocks, sum=1 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_fork leaked [-1, 2, -2] memory blocks, sum=-1 test_multiprocessing_spawn leaked [-2, 2, -1] memory blocks, sum=-1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogQDavDr', '--timeout', '7200'] From noreply at github.com Sun Feb 12 06:37:25 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 03:37:25 -0800 Subject: [Python-checkins] [python/cpython] af88e7: bpo-27122: Fix comment to point to correct issue n... Message-ID: <58a048f5e26c9_ec53f82bac45c306005@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: af88e7eda4101f36e904771d3cf59a5f740b3b00 https://github.com/python/cpython/commit/af88e7eda4101f36e904771d3cf59a5f740b3b00 Author: Nathaniel J. Smith Date: 2017-02-12 (Sun, 12 Feb 2017) Changed paths: M Lib/contextlib.py Log Message: ----------- bpo-27122: Fix comment to point to correct issue number (#47) It took me quite a bit to figure out what this was referring to, since the given issue number is wrong, and the original commit message I found through git blame lists a different, also wrong issue number... see https://bugs.python.org/issue27122#msg279449 From noreply at github.com Sun Feb 12 06:44:56 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 03:44:56 -0800 Subject: [Python-checkins] [python/cpython] 79f292: bpo-27122: Fix comment to point to correct issue n... Message-ID: <58a04ab8b0e5e_12d13fafcdc05c30756b3@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/backport-3.6-pr-47 Home: https://github.com/python/cpython Commit: 79f292f1ba63c6e3128b8c855a727bef16dc7c54 https://github.com/python/cpython/commit/79f292f1ba63c6e3128b8c855a727bef16dc7c54 Author: Nathaniel J. Smith Date: 2017-02-12 (Sun, 12 Feb 2017) Changed paths: M Lib/contextlib.py Log Message: ----------- bpo-27122: Fix comment to point to correct issue number (#47) It took me quite a bit to figure out what this was referring to, since the given issue number is wrong, and the original commit message I found through git blame lists a different, also wrong issue number... see https://bugs.python.org/issue27122#msg279449(cherry picked from commit af88e7eda4101f36e904771d3cf59a5f740b3b00) From noreply at github.com Sun Feb 12 06:49:04 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 03:49:04 -0800 Subject: [Python-checkins] [python/cpython] df948f: bpo-27122: Fix comment to point to correct issue n... Message-ID: <58a04bb05562b_1a303f92597dfc28820bd@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/backport-3.5-pr-47 Home: https://github.com/python/cpython Commit: df948fd8300bcd2ddcfd18ddcb0f3d3e0e3b9498 https://github.com/python/cpython/commit/df948fd8300bcd2ddcfd18ddcb0f3d3e0e3b9498 Author: Nathaniel J. Smith Date: 2017-02-12 (Sun, 12 Feb 2017) Changed paths: M Lib/contextlib.py Log Message: ----------- bpo-27122: Fix comment to point to correct issue number (#47) It took me quite a bit to figure out what this was referring to, since the given issue number is wrong, and the original commit message I found through git blame lists a different, also wrong issue number... see https://bugs.python.org/issue27122#msg279449 (cherry picked from commit af88e7eda4101f36e904771d3cf59a5f740b3b00) From noreply at github.com Sun Feb 12 07:18:47 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 04:18:47 -0800 Subject: [Python-checkins] [python/cpython] c2328e: [backport to 3.6] Support "bpo-" in Misc/NEWS (#42... Message-ID: <58a052a753762_19ff3fc4efdf7c28369ee@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: c2328ec0f4ad45d84b3d96c2b3f80017ef30af52 https://github.com/python/cpython/commit/c2328ec0f4ad45d84b3d96c2b3f80017ef30af52 Author: Mariatta Date: 2017-02-12 (Sun, 12 Feb 2017) Changed paths: M Doc/tools/extensions/pyspecific.py Log Message: ----------- [backport to 3.6] Support "bpo-" in Misc/NEWS (#42) (cherry picked from commit 79ab8be05fb4ffb5c258d2ca49be5fc2d4880431) From noreply at github.com Sun Feb 12 11:13:33 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 08:13:33 -0800 Subject: [Python-checkins] [python/cpython] 89b182: bpo-27122: Fix comment to point to correct issue n... Message-ID: <58a089ad3adc3_6e63fe5dc645c38895b0@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 89b1824e693419b20b6a9113e5293f1c1a78065f https://github.com/python/cpython/commit/89b1824e693419b20b6a9113e5293f1c1a78065f Author: Berker Peksag Date: 2017-02-12 (Sun, 12 Feb 2017) Changed paths: M Lib/contextlib.py Log Message: ----------- bpo-27122: Fix comment to point to correct issue number (#48) It took me quite a bit to figure out what this was referring to, since the given issue number is wrong, and the original commit message I found through git blame lists a different, also wrong issue number... see https://bugs.python.org/issue27122#msg279449 (cherry picked from commit af88e7eda4101f36e904771d3cf59a5f740b3b00) From noreply at github.com Sun Feb 12 11:13:35 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 08:13:35 -0800 Subject: [Python-checkins] [python/cpython] Message-ID: <58a089af9c646_38e3fafbfb0fc441069c9@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/backport-3.6-pr-47 Home: https://github.com/python/cpython From noreply at github.com Sun Feb 12 11:17:52 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 08:17:52 -0800 Subject: [Python-checkins] [python/cpython] 3110a3: bpo-29474: Improve documentation for weakref.WeakV... Message-ID: <58a08ab0351f3_277a3ff0526dfc2c3706d@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 3110a379bbb1ec10a84d70a2f0faffcf8d22c7ed https://github.com/python/cpython/commit/3110a379bbb1ec10a84d70a2f0faffcf8d22c7ed Author: Mariatta Date: 2017-02-12 (Sun, 12 Feb 2017) Changed paths: M Doc/library/weakref.rst Log Message: ----------- bpo-29474: Improve documentation for weakref.WeakValueDictionary (#10) There were some grammatical errors in weakref.WeakValueDictionary documentation. From noreply at github.com Sun Feb 12 11:18:03 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 08:18:03 -0800 Subject: [Python-checkins] [python/cpython] c6d2f4: bpo-27122: Fix comment to point to correct issue n... Message-ID: <58a08abb23cce_bb93f81697f9c2810319@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: c6d2f498142c29ed62241ab6d89cb7b5e38f2fca https://github.com/python/cpython/commit/c6d2f498142c29ed62241ab6d89cb7b5e38f2fca Author: Berker Peksag Date: 2017-02-12 (Sun, 12 Feb 2017) Changed paths: M Lib/contextlib.py Log Message: ----------- bpo-27122: Fix comment to point to correct issue number (#50) It took me quite a bit to figure out what this was referring to, since the given issue number is wrong, and the original commit message I found through git blame lists a different, also wrong issue number... see https://bugs.python.org/issue27122#msg279449 (cherry picked from commit af88e7eda4101f36e904771d3cf59a5f740b3b00) From noreply at github.com Sun Feb 12 11:18:08 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 08:18:08 -0800 Subject: [Python-checkins] [python/cpython] 308f78: bpo-29474: Improve documentation for weakref.WeakV... Message-ID: <58a08ac097e64_1fc13faf08df1c3022890@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 308f789d00735e6707dbc5c8f60a1c8cf245fb4b https://github.com/python/cpython/commit/308f789d00735e6707dbc5c8f60a1c8cf245fb4b Author: Mariatta Date: 2017-02-12 (Sun, 12 Feb 2017) Changed paths: M Doc/library/weakref.rst Log Message: ----------- bpo-29474: Improve documentation for weakref.WeakValueDictionary (#22) There were some grammatical errors in weakref.WeakValueDictionary documentation. From noreply at github.com Sun Feb 12 11:18:11 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 08:18:11 -0800 Subject: [Python-checkins] [python/cpython] Message-ID: <58a08ac39f554_20eb3fa7e14f1c3092055@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/backport-3.5-pr-47 Home: https://github.com/python/cpython From noreply at github.com Sun Feb 12 11:21:37 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 08:21:37 -0800 Subject: [Python-checkins] [python/cpython] ae8287: bpo-29474: Improve documentation for weakref.WeakV... Message-ID: <58a08b91afb10_283ea3feafb4dbc3410795c@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: ae828714ebdb7a0d69bf23c1f6d606e5e63bdcfe https://github.com/python/cpython/commit/ae828714ebdb7a0d69bf23c1f6d606e5e63bdcfe Author: Mariatta Date: 2017-02-12 (Sun, 12 Feb 2017) Changed paths: M Doc/library/weakref.rst Log Message: ----------- bpo-29474: Improve documentation for weakref.WeakValueDictionary (#23) There were some grammatical errors in weakref.WeakValueDictionary documentation. From noreply at github.com Sun Feb 12 13:27:07 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 10:27:07 -0800 Subject: [Python-checkins] [python/cpython] c22bfa: bpo-29524: Add Objects/call.c file (#12) Message-ID: <58a0a8fb7c8e7_1e9d3fc3fbb0dc3c905a5@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: c22bfaae83ab5436d008ac0d13e7b47cbe776f08 https://github.com/python/cpython/commit/c22bfaae83ab5436d008ac0d13e7b47cbe776f08 Author: Victor Stinner Date: 2017-02-12 (Sun, 12 Feb 2017) Changed paths: M Include/eval.h M Makefile.pre.in M Objects/abstract.c A Objects/call.c M Objects/methodobject.c M PCbuild/pythoncore.vcxproj M PCbuild/pythoncore.vcxproj.filters M Python/ceval.c M Python/modsupport.c Log Message: ----------- bpo-29524: Add Objects/call.c file (#12) * Move all functions to call objects in a new Objects/call.c file. * Rename fast_function() to _PyFunction_FastCallKeywords(). * Copy null_error() from Objects/abstract.c * Inline type_error() in call.c to not have to copy it, it was only called once. * Export _PyEval_EvalCodeWithName() since it is now called from call.c. From noreply at github.com Sun Feb 12 15:59:21 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 12:59:21 -0800 Subject: [Python-checkins] [python/cpython] 52b8c5: [backport to 2.7] Change documentation's `Show Sou... Message-ID: <58a0cca9df625_11173fb54e3afc44109b7@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/2.7 Home: https://github.com/python/cpython Commit: 52b8c5591b7523111b90a8a960d018d284f5a81a https://github.com/python/cpython/commit/52b8c5591b7523111b90a8a960d018d284f5a81a Author: Mariatta Date: 2017-02-12 (Sun, 12 Feb 2017) Changed paths: M Doc/tools/extensions/pyspecific.py Log Message: ----------- [backport to 2.7] Change documentation's `Show Source` link to GitHub (#44) * Support "bpo-" in Misc/NEWS (#1) Change the url to 2.7 (cherry picked from commit 79ab8be05fb4ffb5c258d2ca49be5fc2d4880431) * pyspecific.py: remove space after` bpo-` From noreply at github.com Sun Feb 12 16:07:07 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 13:07:07 -0800 Subject: [Python-checkins] [python/cpython] d4a97d: bpo-28929: Link the documentation to its source fi... Message-ID: <58a0ce7b55777_7df03f946e2cdc2849676@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: d4a97d894859d4bb52937d46460049ba016e00b2 https://github.com/python/cpython/commit/d4a97d894859d4bb52937d46460049ba016e00b2 Author: Mariatta Date: 2017-02-12 (Sun, 12 Feb 2017) Changed paths: M Doc/tools/templates/customsourcelink.html Log Message: ----------- bpo-28929: Link the documentation to its source file on GitHub (#35) * bpo-28929: Link the documentation to its source file on GitHub Change the documentation's `Show Source` link on the left menu to GitHub source file. * change version to master From noreply at github.com Sun Feb 12 16:07:35 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 13:07:35 -0800 Subject: [Python-checkins] [python/cpython] e15259: bpo-28929: Link the documentation to its source fi... Message-ID: <58a0ce972a5e0_1e263fb30ccedc3c141b0@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/2.7 Home: https://github.com/python/cpython Commit: e15259c2dfef58df5f7cfa2305811a00c05e0353 https://github.com/python/cpython/commit/e15259c2dfef58df5f7cfa2305811a00c05e0353 Author: Mariatta Date: 2017-02-12 (Sun, 12 Feb 2017) Changed paths: M Doc/tools/templates/layout.html Log Message: ----------- bpo-28929: Link the documentation to its source file on GitHub (#38) Change the documentation's `Show Source` link on the left menu to GitHub source file. From noreply at github.com Sun Feb 12 16:08:01 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 13:08:01 -0800 Subject: [Python-checkins] [python/cpython] cabd1c: [backport to 3.5] bpo-28929: Link the documentatio... Message-ID: <58a0ceb1d5b23_8c03fd98f3c7c44444dc@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: cabd1c7462ef991937e0e759b9bf307b3091ef06 https://github.com/python/cpython/commit/cabd1c7462ef991937e0e759b9bf307b3091ef06 Author: Mariatta Date: 2017-02-12 (Sun, 12 Feb 2017) Changed paths: M Doc/tools/templates/customsourcelink.html Log Message: ----------- [backport to 3.5] bpo-28929: Link the documentation to its source file on GitHub (#36) * bpo-28929: Link the documentation to its source file on GitHub Change the documentation's `Show Source` link on the left menu to GitHub source file. (cherry picked from commit 23bafa294c75c20cb85ae5d97d7571a3a0ad8dd3) * remove if statement From noreply at github.com Sun Feb 12 16:08:26 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 13:08:26 -0800 Subject: [Python-checkins] [python/cpython] f66c81: [backport to 3.6] bpo-28929: Link the documentatio... Message-ID: <58a0ceca1818c_8713f91c6cb9c3c8951@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: f66c81ff499fb431e56bc68f5e39c2f7b9fcb6a7 https://github.com/python/cpython/commit/f66c81ff499fb431e56bc68f5e39c2f7b9fcb6a7 Author: Mariatta Date: 2017-02-12 (Sun, 12 Feb 2017) Changed paths: M Doc/tools/templates/customsourcelink.html Log Message: ----------- [backport to 3.6] bpo-28929: Link the documentation to its source file on GitHub (#37) * bpo-28929: Link the documentation to its source file on GitHub Change the documentation's `Show Source` link on the left menu to GitHub source file. (cherry picked from commit 23bafa294c75c20cb85ae5d97d7571a3a0ad8dd3) * remove if statement From noreply at github.com Sun Feb 12 17:10:49 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 14:10:49 -0800 Subject: [Python-checkins] [python/cpython] baf7bb: getpass: update docstrings (#49) Message-ID: <58a0dd69f0ed7_284973ff9ac48dc2c9963e@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: baf7bb30a02aabde260143136bdf5b3738a1d409 https://github.com/python/cpython/commit/baf7bb30a02aabde260143136bdf5b3738a1d409 Author: MRMillon Date: 2017-02-12 (Sun, 12 Feb 2017) Changed paths: M Lib/getpass.py Log Message: ----------- getpass: update docstrings (#49) EasyDialogs was removed in 3.x. fallback_getpass will always be the answer here. ff47a133e1eee9dab60b86fb0d56ccd1022f841a From noreply at github.com Sun Feb 12 17:42:03 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 14:42:03 -0800 Subject: [Python-checkins] [python/cpython] 61e2bc: bpo-29176: Fix name of the _curses.window class (#... Message-ID: <58a0e4bbc328b_4b13fed794e1c30836d4@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 61e2bc74dfab1ceee332d3f480dcf86c478c87c5 https://github.com/python/cpython/commit/61e2bc74dfab1ceee332d3f480dcf86c478c87c5 Author: Victor Stinner Date: 2017-02-12 (Sun, 12 Feb 2017) Changed paths: M Modules/_cursesmodule.c Log Message: ----------- bpo-29176: Fix name of the _curses.window class (#52) Set name to "_curses.window" instead of "_curses.curses window" (with a space!?). From noreply at github.com Sun Feb 12 19:16:21 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 16:16:21 -0800 Subject: [Python-checkins] [python/cpython] 06a4fc: bpo-29438: Fixed use-after-free in key sharing dic... Message-ID: <58a0fad58b014_1acf3fb5f8fddc2876941@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 06a4fcb2458c5904968b5c8fe6b64940ba83a50d https://github.com/python/cpython/commit/06a4fcb2458c5904968b5c8fe6b64940ba83a50d Author: INADA Naoki Date: 2017-02-13 (Mon, 13 Feb 2017) Changed paths: M Misc/NEWS M Objects/dictobject.c Log Message: ----------- bpo-29438: Fixed use-after-free in key sharing dict (#40) From noreply at github.com Sun Feb 12 19:19:06 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 16:19:06 -0800 Subject: [Python-checkins] [python/cpython] 89ddff: bpo-29438: fixed use-after-free in key sharing dic... Message-ID: <58a0fb7ac1e2b_137c3f8d719cdc345075a@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 89ddffbe9dcb38b79f99563b0d4d594d1105a192 https://github.com/python/cpython/commit/89ddffbe9dcb38b79f99563b0d4d594d1105a192 Author: INADA Naoki Date: 2017-02-13 (Mon, 13 Feb 2017) Changed paths: M Misc/NEWS M Objects/dictobject.c Log Message: ----------- bpo-29438: fixed use-after-free in key sharing dict (#39) From noreply at github.com Sun Feb 12 23:21:20 2017 From: noreply at github.com (GitHub) Date: Sun, 12 Feb 2017 20:21:20 -0800 Subject: [Python-checkins] [python/cpython] 649a7c: Allow up to a 0.01% drop in coverage (#30) Message-ID: <58a13440d7684_22a93f9d522abc4496391@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 649a7caf6b26b3bf62485951c44bd1606a5f65f9 https://github.com/python/cpython/commit/649a7caf6b26b3bf62485951c44bd1606a5f65f9 Author: Zachary Ware Date: 2017-02-12 (Sun, 12 Feb 2017) Changed paths: M .codecov.yml Log Message: ----------- Allow up to a 0.01% drop in coverage (#30) From solipsis at pitrou.net Mon Feb 13 04:17:56 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 13 Feb 2017 09:17:56 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=11 Message-ID: <20170213091755.52952.6600.E6EB0617@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [7, 0, 0] memory blocks, sum=7 test_functools leaked [0, 3, 1] memory blocks, sum=4 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/reflogbO99Gi', '--timeout', '7200'] From noreply at github.com Mon Feb 13 08:57:14 2017 From: noreply at github.com (GitHub) Date: Mon, 13 Feb 2017 05:57:14 -0800 Subject: [Python-checkins] [python/cpython] 3d707b: bpo-29521 Fix two minor documentation build warnin... Message-ID: <58a1bb3aeb305_39f3fa306a87c24483ab@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 3d707be950b387552585451071928e7b39cdfa53 https://github.com/python/cpython/commit/3d707be950b387552585451071928e7b39cdfa53 Author: Jim DeLaHunt Date: 2017-02-13 (Mon, 13 Feb 2017) Changed paths: M Doc/faq/windows.rst M Doc/make.bat Log Message: ----------- bpo-29521 Fix two minor documentation build warnings (#41) Much of bpo-29521 was fixed in parallel with commit e7ffb99 . This cleans up the rest. Apply parallel change to Doc/make.bat to read "set SPHINXOPTS=-D latex_elements.papersize=" I don't have a Windows system on which to observe the warning, but it should be necessary. The warning: .../workspace/cpython_github/Doc/faq/windows.rst:303: WARNING: unknown option: -t In the Windows FAQ, `How do I keep editors from inserting tabs into my Python source?`, contained a reference to a Python -t option. In Python 2.x, this caused Python to issue warnings about lines with mixed spaces and tabs, but as of Python 3.6 it does nothing. Per discussion at http://bugs.python.org/issue29387, take their wording. Python [3] raises an IndentationError or TabError. Tabnanny is now a module. From noreply at github.com Mon Feb 13 09:18:50 2017 From: noreply at github.com (GitHub) Date: Mon, 13 Feb 2017 06:18:50 -0800 Subject: [Python-checkins] [python/cpython] d61bc4: Fix trailing whitespaces in Doc/faq/windows.rst Message-ID: <58a1c04a22dd5_1cf33fce5090bc2c1300d@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/berkerpeksag-patch-1 Home: https://github.com/python/cpython Commit: d61bc46f4e3b028eafcdd2166275d43842d6b081 https://github.com/python/cpython/commit/d61bc46f4e3b028eafcdd2166275d43842d6b081 Author: Berker Peksag Date: 2017-02-13 (Mon, 13 Feb 2017) Changed paths: M Doc/faq/windows.rst Log Message: ----------- Fix trailing whitespaces in Doc/faq/windows.rst From noreply at github.com Mon Feb 13 09:21:14 2017 From: noreply at github.com (GitHub) Date: Mon, 13 Feb 2017 06:21:14 -0800 Subject: [Python-checkins] [python/cpython] Message-ID: <58a1c0da88a64_101e3fa8da9c9c2c36297@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/berkerpeksag-patch-1 Home: https://github.com/python/cpython From noreply at github.com Mon Feb 13 09:30:07 2017 From: noreply at github.com (GitHub) Date: Mon, 13 Feb 2017 06:30:07 -0800 Subject: [Python-checkins] [python/cpython] 2b5018: Travis CI: run rstlint.py in the docs job (#68) Message-ID: <58a1c2ef6c20c_98d3fb363413c2c25899@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 2b501866ed493758e4c4b29f0ce9b24023d910a1 https://github.com/python/cpython/commit/2b501866ed493758e4c4b29f0ce9b24023d910a1 Author: Victor Stinner Date: 2017-02-13 (Mon, 13 Feb 2017) Changed paths: M .travis.yml M Doc/faq/windows.rst Log Message: ----------- Travis CI: run rstlint.py in the docs job (#68) Currently, http://buildbot.python.org/all/buildslaves/ware-docs buildbot is only run as post-commit. For example, bpo-29521 (PR#41) introduced two warnings, unnotified by the Travis CI docs job. Modify the docs job to run toosl/rstlint.py. Fix also the two minor warnings which causes the buildbot slave to fail. From amk at amk.ca Sat Feb 11 20:11:36 2017 From: amk at amk.ca (Andrew M. Kuchling) Date: Sat, 11 Feb 2017 20:11:36 -0500 Subject: [Python-checkins] [python/cpython] 4538dd: Fix bpo-29528 Use a secure variable to stop spam (... In-Reply-To: <589e61bcbaba_7f783fb29586dc2449911@hookshot-fe2-cp1-prd.iad.github.net.mail> References: <589e61bcbaba_7f783fb29586dc2449911@hookshot-fe2-cp1-prd.iad.github.net.mail> Message-ID: <20170212011136.GA17693@gazelle> On Fri, Feb 10, 2017 at 04:58:36PM -0800, GitHub wrote: > Branch: refs/heads/master > Home: https://github.com/python/cpython > Commit: 4538ddcacc8e8f00d5d36d7bc84e551a56ce6da2 > https://github.com/python/cpython/commit/4538ddcacc8e8f00d5d36d7bc84e551a56ce6da2 > Author: Donald Stufft > Date: 2017-02-11 (Sat, 11 Feb 2017) > > Changed paths: > M .travis.yml > > Log Message: > ----------- > Fix bpo-29528 Use a secure variable to stop spam (#13) Are we planning to include the diffs in python-checkins e-mail, or are they gone for good? (While they made the list's messages and digests larger, I liked having the diffs because you could page through them to see what changes were made without having to go through to another site.) --amk From barry at python.org Mon Feb 13 10:10:26 2017 From: barry at python.org (Barry Warsaw) Date: Mon, 13 Feb 2017 10:10:26 -0500 Subject: [Python-checkins] [python/cpython] 4538dd: Fix bpo-29528 Use a secure variable to stop spam (... In-Reply-To: <20170212011136.GA17693@gazelle> References: <589e61bcbaba_7f783fb29586dc2449911@hookshot-fe2-cp1-prd.iad.github.net.mail> <20170212011136.GA17693@gazelle> Message-ID: <20170213101026.4cee089a@subdivisions.wooz.org> On Feb 11, 2017, at 08:11 PM, Andrew M. Kuchling wrote: >Are we planning to include the diffs in python-checkins e-mail, or are >they gone for good? > >(While they made the list's messages and digests larger, I liked >having the diffs because you could page through them to see what >changes were made without having to go through to another site.) Yep, this was recently discussed and I think the plan is to bring them back for python-checkins, but that it's not possible to enable them on PRs due to GH limitations. Cheers, -Barry From noreply at github.com Mon Feb 13 10:57:32 2017 From: noreply at github.com (GitHub) Date: Mon, 13 Feb 2017 07:57:32 -0800 Subject: [Python-checkins] [python/cpython] c9b62b: Add Travis CI and Codecov badges to README (#70) Message-ID: <58a1d76ca8dea_11eb3fc2ed96dc38697c4@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: c9b62b4294035bddb5b59720fb33757cef0a6311 https://github.com/python/cpython/commit/c9b62b4294035bddb5b59720fb33757cef0a6311 Author: Victor Stinner Date: 2017-02-13 (Mon, 13 Feb 2017) Changed paths: M .github/CONTRIBUTING.rst M README.rst Log Message: ----------- Add Travis CI and Codecov badges to README (#70) Badges are small images which gives the status of the Travis CI and the coverage percentage of Codecode. It helps to check the status of the Travis CI and to get the link to Travis CI. See also https://shields.io/ From noreply at github.com Mon Feb 13 12:05:49 2017 From: noreply at github.com (GitHub) Date: Mon, 13 Feb 2017 09:05:49 -0800 Subject: [Python-checkins] [python/cpython] 3cdbd6: A few README tweaks (#73) Message-ID: <58a1e76dcda8_277a3ff0526dfc2c548fd@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 3cdbd68ce8230cff1afb67472b96fbfa7f047e32 https://github.com/python/cpython/commit/3cdbd68ce8230cff1afb67472b96fbfa7f047e32 Author: Ned Batchelder Date: 2017-02-13 (Mon, 13 Feb 2017) Changed paths: M README.rst Log Message: ----------- A few README tweaks (#73) * Add a paragraph at the top for users, not builders, of Python. * Use nicer rst url syntax to avoid borking paragraphs in the plain text. From brett at snarky.ca Mon Feb 13 12:54:51 2017 From: brett at snarky.ca (Brett Cannon) Date: Mon, 13 Feb 2017 17:54:51 +0000 Subject: [Python-checkins] [python/cpython] 4538dd: Fix bpo-29528 Use a secure variable to stop spam (... In-Reply-To: <20170213101026.4cee089a@subdivisions.wooz.org> References: <589e61bcbaba_7f783fb29586dc2449911@hookshot-fe2-cp1-prd.iad.github.net.mail> <20170212011136.GA17693@gazelle> <20170213101026.4cee089a@subdivisions.wooz.org> Message-ID: On Mon, 13 Feb 2017 at 07:10 Barry Warsaw wrote: > On Feb 11, 2017, at 08:11 PM, Andrew M. Kuchling wrote: > > >Are we planning to include the diffs in python-checkins e-mail, or are > >they gone for good? > > > >(While they made the list's messages and digests larger, I liked > >having the diffs because you could page through them to see what > >changes were made without having to go through to another site.) > > Yep, this was recently discussed and I think the plan is to bring them back > for python-checkins, but that it's not possible to enable them on PRs due > to > GH limitations. > Serhiy asked about it and I said that the email integration we are using from GitHub doesn't allow for customizing the email it sends out beyond how is listed in the From line. If people find a different integration that they want to use for sending email then that can be set up. -------------- next part -------------- An HTML attachment was scrubbed... URL: From berker.peksag at gmail.com Mon Feb 13 13:25:34 2017 From: berker.peksag at gmail.com (=?UTF-8?Q?Berker_Peksa=C4=9F?=) Date: Mon, 13 Feb 2017 21:25:34 +0300 Subject: [Python-checkins] [python/cpython] 4538dd: Fix bpo-29528 Use a secure variable to stop spam (... In-Reply-To: References: <589e61bcbaba_7f783fb29586dc2449911@hookshot-fe2-cp1-prd.iad.github.net.mail> <20170212011136.GA17693@gazelle> <20170213101026.4cee089a@subdivisions.wooz.org> Message-ID: --Berker On Mon, Feb 13, 2017 at 8:54 PM, Brett Cannon wrote: > > > On Mon, 13 Feb 2017 at 07:10 Barry Warsaw wrote: >> >> On Feb 11, 2017, at 08:11 PM, Andrew M. Kuchling wrote: >> >> >Are we planning to include the diffs in python-checkins e-mail, or are >> >they gone for good? >> > >> >(While they made the list's messages and digests larger, I liked >> >having the diffs because you could page through them to see what >> >changes were made without having to go through to another site.) >> >> Yep, this was recently discussed and I think the plan is to bring them >> back >> for python-checkins, but that it's not possible to enable them on PRs due >> to >> GH limitations. > > > Serhiy asked about it and I said that the email integration we are using > from GitHub doesn't allow for customizing the email it sends out beyond how > is listed in the From line. If people find a different integration that they > want to use for sending email then that can be set up. I wrote a webhook that includes diffs: An example output can be seen at https://github.com/python/core-workflow/issues/24#issuecomment-279162079 Since it listens all 'push' events, it's possible to catch all commits and send them to python-checkins. --Berker From noreply at github.com Mon Feb 13 15:11:26 2017 From: noreply at github.com (GitHub) Date: Mon, 13 Feb 2017 12:11:26 -0800 Subject: [Python-checkins] [python/cpython] af456b: Support "bpo-" in Misc/NEWS (#1) (#43) Message-ID: <58a212eee8475_286e93fe0c73cdc401001b@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: af456b241bd4889ac94eb215e73da400380460a0 https://github.com/python/cpython/commit/af456b241bd4889ac94eb215e73da400380460a0 Author: Mariatta Date: 2017-02-13 (Mon, 13 Feb 2017) Changed paths: M Doc/tools/extensions/pyspecific.py Log Message: ----------- Support "bpo-" in Misc/NEWS (#1) (#43) Change the url to 3.5 (cherry picked from commit 79ab8be05fb4ffb5c258d2ca49be5fc2d4880431) Contributed by Brett Cannon From lp_benchmark_robot at intel.com Mon Feb 13 16:19:04 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Mon, 13 Feb 2017 13:19:04 -0800 Subject: [Python-checkins] BAD Benchmark Results for Python Default 2017-02-13 Message-ID: <410f3841-832c-4a84-952e-23c5a6b6de84@orsmsx153.amr.corp.intel.com> Results for project Python default, build date 2017-02-13 11:03:47 +0000 commit: 4243df51fe43 previous commit: e5cd74868dfc revision date: 2017-02-10 13:19:36 +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% -1.13% 7.97% 18.54% :-) pybench 0.21% -0.00% 4.34% 4.75% :-| regex_v8 3.69% -0.00% 1.84% 3.58% :-| nbody 0.16% -0.10% 0.56% 3.59% :-) json_dump_v2 0.28% 0.58% 11.20% 8.29% :-| normal_startup 0.92% -0.02% 0.71% 6.40% ---------------------------------------------------------------------------------- * 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-2017-02-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 lp_benchmark_robot at intel.com Mon Feb 13 16:18:29 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Mon, 13 Feb 2017 13:18:29 -0800 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2017-02-13 Message-ID: Results for project Python 2.7, build date 2017-02-13 11:47:47 +0000 commit: 54c93e0fe79b previous commit: b07d454e45a2 revision date: 2017-02-10 13:14:04 +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.16% 3.95% 9.48% :-) pybench 0.17% -0.05% 7.61% 4.20% :-| regex_v8 0.55% 0.05% -0.10% 10.60% :-) nbody 0.13% -0.07% 11.86% 4.16% :-| json_dump_v2 0.29% -0.17% 0.33% 11.93% :-| normal_startup 1.70% 0.81% -1.93% 1.91% :-| ssbench 0.15% -0.28% -0.09% 2.95% ---------------------------------------------------------------------------------- * 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-2017-02-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 noreply at github.com Mon Feb 13 16:50:16 2017 From: noreply at github.com (GitHub) Date: Mon, 13 Feb 2017 13:50:16 -0800 Subject: [Python-checkins] [python/cpython] b692dc: bpo-28556: Various updates to typing (#28) Message-ID: <58a22a18d0c1_1c403ff0c7093c401059ab@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: b692dc8475a032740576129d0990ddc3edccab2b https://github.com/python/cpython/commit/b692dc8475a032740576129d0990ddc3edccab2b Author: Ivan Levkivskyi Date: 2017-02-13 (Mon, 13 Feb 2017) Changed paths: A Lib/test/mod_generics_cache.py M Lib/test/test_typing.py M Lib/typing.py M Misc/NEWS Log Message: ----------- bpo-28556: Various updates to typing (#28) various updates from upstream python/typing repo: - Added typing.Counter and typing.ChainMap generics - More flexible typing.NamedTuple - Improved generic ABC caching - More tests - Bugfixes - Other updates * Add Misc/NEWS entry * Add issue number From noreply at github.com Mon Feb 13 17:28:59 2017 From: noreply at github.com (GitHub) Date: Mon, 13 Feb 2017 14:28:59 -0800 Subject: [Python-checkins] [python/cpython] 9c5684: bpo-28556: Various updates to typing (#28) (#78) Message-ID: <58a2332bd0aff_13f13fd32507bc2c109346@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 9c5684e0d380cf5bc109888603756084588ce617 https://github.com/python/cpython/commit/9c5684e0d380cf5bc109888603756084588ce617 Author: Mariatta Date: 2017-02-13 (Mon, 13 Feb 2017) Changed paths: A Lib/test/mod_generics_cache.py M Lib/test/test_typing.py M Lib/typing.py M Misc/NEWS Log Message: ----------- bpo-28556: Various updates to typing (#28) (#78) various updates from upstream python/typing repo: - Added typing.Counter and typing.ChainMap generics - More flexible typing.NamedTuple - Improved generic ABC caching - More tests - Bugfixes - Other updates * Add Misc/NEWS entry * Add issue number Contributed by Ivan Levkivskyi @ilevkivskyi (cherry picked from commit b692dc8475a032740576129d0990ddc3edccab2b) From noreply at github.com Mon Feb 13 18:48:42 2017 From: noreply at github.com (GitHub) Date: Mon, 13 Feb 2017 15:48:42 -0800 Subject: [Python-checkins] [python/cpython] 2d0c22: A few README tweaks (#73) (#79) Message-ID: <58a245da24c53_119b3f9b7cab3c34114476@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 2d0c2286f8e19e5d6a45cf16f766382115431c2e https://github.com/python/cpython/commit/2d0c2286f8e19e5d6a45cf16f766382115431c2e Author: Mariatta Date: 2017-02-13 (Mon, 13 Feb 2017) Changed paths: M README Log Message: ----------- A few README tweaks (#73) (#79) * Add a paragraph at the top for users, not builders, of Python. * Use nicer rst url syntax to avoid borking paragraphs in the plain text. Contributed by Ned Batchelder @nedbat (cherry picked from commit 3cdbd68ce8230cff1afb67472b96fbfa7f047e32) From noreply at github.com Mon Feb 13 18:49:09 2017 From: noreply at github.com (GitHub) Date: Mon, 13 Feb 2017 15:49:09 -0800 Subject: [Python-checkins] [python/cpython] 3ae8fd: A few README tweaks (#73) (#80) Message-ID: <58a245f5cdba6_7dd03fcf08b1bc34630f5@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 3ae8fd43fd18160dcb619d7d367cb1b41aeab32a https://github.com/python/cpython/commit/3ae8fd43fd18160dcb619d7d367cb1b41aeab32a Author: Mariatta Date: 2017-02-13 (Mon, 13 Feb 2017) Changed paths: M README Log Message: ----------- A few README tweaks (#73) (#80) * Add a paragraph at the top for users, not builders, of Python. * Use nicer rst url syntax to avoid borking paragraphs in the plain text. Contributed by Ned Batchelder @nedbat (cherry picked from commit 3cdbd68ce8230cff1afb67472b96fbfa7f047e32) From noreply at github.com Mon Feb 13 23:01:05 2017 From: noreply at github.com (GitHub) Date: Mon, 13 Feb 2017 20:01:05 -0800 Subject: [Python-checkins] [python/cpython] d50f18: Various updates to README.rst (#21) Message-ID: <58a2810144373_16c53fc068d7bc3014277f@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: d50f188b1bdf69377364f4a9db33af11cc704a70 https://github.com/python/cpython/commit/d50f188b1bdf69377364f4a9db33af11cc704a70 Author: Zachary Ware Date: 2017-02-13 (Mon, 13 Feb 2017) Changed paths: M README.rst Log Message: ----------- Various updates to README.rst (#21) These include spelling/grammar fixes, removing some outdated prose, updating some superseded prose, and adding/cleaning up some links. Also rewraps the entire file at 79 columns. From solipsis at pitrou.net Tue Feb 14 04:17:48 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 14 Feb 2017 09:17:48 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=5 Message-ID: <20170214091747.124834.216.197B9F78@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [7, -7, 1] 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/reflog7L4xAJ', '--timeout', '7200'] From noreply at github.com Tue Feb 14 04:56:15 2017 From: noreply at github.com (GitHub) Date: Tue, 14 Feb 2017 01:56:15 -0800 Subject: [Python-checkins] [python/cpython] 22ba52: Tweak .codedoc.yml to make it more useful (#71) Message-ID: <58a2d43f3d59f_288b53f89b6b59c245454@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 22ba52b8431ecfc9c07926c8b245733a638c347f https://github.com/python/cpython/commit/22ba52b8431ecfc9c07926c8b245733a638c347f Author: Berker Peksag Date: 2017-02-14 (Tue, 14 Feb 2017) Changed paths: M .codecov.yml Log Message: ----------- Tweak .codedoc.yml to make it more useful (#71) From noreply at github.com Tue Feb 14 04:57:27 2017 From: noreply at github.com (GitHub) Date: Tue, 14 Feb 2017 01:57:27 -0800 Subject: [Python-checkins] [python/cpython] 157c0b: Only run CI checks when appropriate files have cha... Message-ID: <58a2d487e2725_1fc13faf08df1c3040866@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 157c0b86b805a6a27b44efd4bf168a66e60ecf18 https://github.com/python/cpython/commit/157c0b86b805a6a27b44efd4bf168a66e60ecf18 Author: Berker Peksag Date: 2017-02-14 (Tue, 14 Feb 2017) Changed paths: M .travis.yml Log Message: ----------- Only run CI checks when appropriate files have changed (#74) Closes python/core-workflow#14 From noreply at github.com Tue Feb 14 08:29:39 2017 From: noreply at github.com (GitHub) Date: Tue, 14 Feb 2017 05:29:39 -0800 Subject: [Python-checkins] [python/cpython] 0741b2: Use 'make check' instead of 'python3 tools/rstlint... Message-ID: <58a306438a1c0_21503feb5b9e3c301034eb@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/berkerpeksag-patch-1 Home: https://github.com/python/cpython Commit: 0741b24a77486eaeabd97a68025bf6da56632399 https://github.com/python/cpython/commit/0741b24a77486eaeabd97a68025bf6da56632399 Author: Berker Peksag Date: 2017-02-14 (Tue, 14 Feb 2017) Changed paths: M .travis.yml Log Message: ----------- Use 'make check' instead of 'python3 tools/rstlint.py' From noreply at github.com Tue Feb 14 09:11:14 2017 From: noreply at github.com (GitHub) Date: Tue, 14 Feb 2017 06:11:14 -0800 Subject: [Python-checkins] [python/cpython] 0230e6: bpo-28556: Various updates to typing (#28) (#77) Message-ID: <58a31002ee1f9_7473fbf1645fc30106818@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 0230e64d2c976ab755c145e97bf86032e0fe3a53 https://github.com/python/cpython/commit/0230e64d2c976ab755c145e97bf86032e0fe3a53 Author: Mariatta Date: 2017-02-14 (Tue, 14 Feb 2017) Changed paths: A Lib/test/mod_generics_cache.py M Lib/test/test_typing.py M Lib/typing.py M Misc/NEWS Log Message: ----------- bpo-28556: Various updates to typing (#28) (#77) various updates from upstream python/typing repo: - Added typing.Counter and typing.ChainMap generics - More flexible typing.NamedTuple - Improved generic ABC caching - More tests - Bugfixes - Other updates * Add Misc/NEWS entry (cherry picked from commit b692dc8475a032740576129d0990ddc3edccab2b) From noreply at github.com Tue Feb 14 09:11:50 2017 From: noreply at github.com (GitHub) Date: Tue, 14 Feb 2017 06:11:50 -0800 Subject: [Python-checkins] [python/cpython] 926885: Fix some sphinx warnings (#9) (#81) Message-ID: <58a31026761f4_15e13f9f56435c30810d9@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 9268855ba6e99bf595e75b75780cf29667371f45 https://github.com/python/cpython/commit/9268855ba6e99bf595e75b75780cf29667371f45 Author: Mariatta Date: 2017-02-14 (Tue, 14 Feb 2017) Changed paths: M Doc/Makefile M Doc/conf.py Log Message: ----------- Fix some sphinx warnings (#9) (#81) * Fix some deprecation warnings in Doc/conf.py * Fix an rst error in Misc/NEWS Contributed by Ryan Gonzalez @kirbyfan64 (cherry picked from commit e7ffb99f842ebff97cffa0fc90b18be4e5abecf2) From noreply at github.com Tue Feb 14 09:12:16 2017 From: noreply at github.com (GitHub) Date: Tue, 14 Feb 2017 06:12:16 -0800 Subject: [Python-checkins] [python/cpython] c0f901: Fix some sphinx warnings (#9) (#82) Message-ID: <58a31040f2c25_e443f8b26febc444428@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: c0f9014a51593b2d58721819f8686f96dce5be71 https://github.com/python/cpython/commit/c0f9014a51593b2d58721819f8686f96dce5be71 Author: Mariatta Date: 2017-02-14 (Tue, 14 Feb 2017) Changed paths: M Doc/Makefile M Doc/conf.py Log Message: ----------- Fix some sphinx warnings (#9) (#82) * Fix some deprecation warnings in Doc/conf.py * Fix an rst error in Misc/NEWS Contributed by Ryan Gonzalez @kirbyfan64 (cherry picked from commit e7ffb99f842ebff97cffa0fc90b18be4e5abecf2) From noreply at github.com Tue Feb 14 09:19:38 2017 From: noreply at github.com (GitHub) Date: Tue, 14 Feb 2017 06:19:38 -0800 Subject: [Python-checkins] [python/cpython] Message-ID: <58a311faedbf6_27cad3f983da9dc3c1025dc@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/berkerpeksag-patch-1 Home: https://github.com/python/cpython From noreply at github.com Tue Feb 14 09:19:36 2017 From: noreply at github.com (GitHub) Date: Tue, 14 Feb 2017 06:19:36 -0800 Subject: [Python-checkins] [python/cpython] c33ee8: Use 'make check' instead of 'python3 tools/rstlint... Message-ID: <58a311f885b67_15663fb516941c308809f@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: c33ee85b6fbed7f9c68e9fd39cd0582af9237ef1 https://github.com/python/cpython/commit/c33ee85b6fbed7f9c68e9fd39cd0582af9237ef1 Author: Berker Peksag Date: 2017-02-14 (Tue, 14 Feb 2017) Changed paths: M .travis.yml Log Message: ----------- Use 'make check' instead of 'python3 tools/rstlint.py' (#96) From noreply at github.com Tue Feb 14 11:54:24 2017 From: noreply at github.com (GitHub) Date: Tue, 14 Feb 2017 08:54:24 -0800 Subject: [Python-checkins] [python/cpython] 38c835: bpo-29521 Fix two minor documentation build warnin... Message-ID: <58a336409d6e6_110f3fb3183e1c405263b@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 38c8354f3204441f6c6bd22213b449d2d8954fcc https://github.com/python/cpython/commit/38c8354f3204441f6c6bd22213b449d2d8954fcc Author: Mariatta Date: 2017-02-14 (Tue, 14 Feb 2017) Changed paths: M Doc/faq/windows.rst M Doc/make.bat Log Message: ----------- bpo-29521 Fix two minor documentation build warnings (#41) (#84) Much of bpo-29521 was fixed in parallel with commit e7ffb99 . This cleans up the rest. Apply parallel change to Doc/make.bat to read "set SPHINXOPTS=-D latex_elements.papersize=" I don't have a Windows system on which to observe the warning, but it should be necessary. The warning: .../workspace/cpython_github/Doc/faq/windows.rst:303: WARNING: unknown option: -t In the Windows FAQ, `How do I keep editors from inserting tabs into my Python source?`, contained a reference to a Python -t option. In Python 2.x, this caused Python to issue warnings about lines with mixed spaces and tabs, but as of Python 3.6 it does nothing. Per discussion at http://bugs.python.org/issue29387, take their wording. Python [3] raises an IndentationError or TabError. Tabnanny is now a module. (cherry picked from commit 3d707be950b387552585451071928e7b39cdfa53) From noreply at github.com Tue Feb 14 11:55:01 2017 From: noreply at github.com (GitHub) Date: Tue, 14 Feb 2017 08:55:01 -0800 Subject: [Python-checkins] [python/cpython] db3deb: bpo-29521 Fix two minor documentation build warnin... Message-ID: <58a33665a07c2_22a43ff3e749fc30957ef@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: db3deb98e969d3f43b169cd320abd46b21a10c6d https://github.com/python/cpython/commit/db3deb98e969d3f43b169cd320abd46b21a10c6d Author: Mariatta Date: 2017-02-14 (Tue, 14 Feb 2017) Changed paths: M Doc/faq/windows.rst M Doc/make.bat Log Message: ----------- bpo-29521 Fix two minor documentation build warnings (#41) (#83) Much of bpo-29521 was fixed in parallel with commit e7ffb99 . This cleans up the rest. Apply parallel change to Doc/make.bat to read "set SPHINXOPTS=-D latex_elements.papersize=" I don't have a Windows system on which to observe the warning, but it should be necessary. The warning: .../workspace/cpython_github/Doc/faq/windows.rst:303: WARNING: unknown option: -t In the Windows FAQ, `How do I keep editors from inserting tabs into my Python source?`, contained a reference to a Python -t option. In Python 2.x, this caused Python to issue warnings about lines with mixed spaces and tabs, but as of Python 3.6 it does nothing. Per discussion at http://bugs.python.org/issue29387, take their wording. Python [3] raises an IndentationError or TabError. Tabnanny is now a module. (cherry picked from commit 3d707be950b387552585451071928e7b39cdfa53) From noreply at github.com Tue Feb 14 13:22:57 2017 From: noreply at github.com (GitHub) Date: Tue, 14 Feb 2017 10:22:57 -0800 Subject: [Python-checkins] [python/cpython] 6d1dec: Fixed #29534 - _decimal difference with _pydecimal... Message-ID: <58a34b013e70d_13853f80b8675c286815f@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 6d1dece06d13a7d40637e07b2c79f34aab368766 https://github.com/python/cpython/commit/6d1dece06d13a7d40637e07b2c79f34aab368766 Author: Andrew Nester Date: 2017-02-14 (Tue, 14 Feb 2017) Changed paths: M Lib/_pydecimal.py M Lib/test/test_decimal.py M Misc/NEWS Log Message: ----------- Fixed #29534 - _decimal difference with _pydecimal (#65) From noreply at github.com Tue Feb 14 14:18:56 2017 From: noreply at github.com (GitHub) Date: Tue, 14 Feb 2017 11:18:56 -0800 Subject: [Python-checkins] [python/cpython] 996c38: Issue #29534: move Misc/NEWS entry to correct sect... Message-ID: <58a3582022022_97f3ffa5e851c348254c@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 996c3874fdbc91d29f0a06b37043f62cf4ead6cb https://github.com/python/cpython/commit/996c3874fdbc91d29f0a06b37043f62cf4ead6cb Author: Mark Dickinson Date: 2017-02-14 (Tue, 14 Feb 2017) Changed paths: M Misc/ACKS M Misc/NEWS Log Message: ----------- Issue #29534: move Misc/NEWS entry to correct section; add Misc/ACS entry for Andrew Nester. (#99) From lp_benchmark_robot at intel.com Tue Feb 14 15:08:54 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 14 Feb 2017 12:08:54 -0800 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2017-02-14 Message-ID: No new revisions. Here are the previous results: Results for project Python 2.7, build date 2017-02-14 11:06:11 +0000 commit: 54c93e0fe79b previous commit: b07d454e45a2 revision date: 2017-02-10 13:14:04 +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.16% 3.95% 9.48% :-) pybench 0.17% -0.05% 7.61% 4.20% :-| regex_v8 0.55% 0.05% -0.10% 10.60% :-) nbody 0.13% -0.07% 11.86% 4.16% :-| json_dump_v2 0.29% -0.17% 0.33% 11.93% :-| normal_startup 1.70% 0.81% -1.93% 1.91% :-| ssbench 0.15% -0.28% -0.09% 2.95% ---------------------------------------------------------------------------------- * 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-2017-02-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 lp_benchmark_robot at intel.com Tue Feb 14 15:09:15 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 14 Feb 2017 12:09:15 -0800 Subject: [Python-checkins] BAD Benchmark Results for Python Default 2017-02-14 Message-ID: <784696cf-4cca-4485-a8a4-dfc69e50eda9@orsmsx154.amr.corp.intel.com> No new revisions. Here are the previous results: Results for project Python default, build date 2017-02-14 11:03:37 +0000 commit: 4243df51fe43 previous commit: e5cd74868dfc revision date: 2017-02-10 13:19:36 +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% -1.13% 7.97% 18.54% :-) pybench 0.21% -0.00% 4.34% 4.75% :-| regex_v8 3.69% -0.00% 1.84% 3.58% :-| nbody 0.16% -0.10% 0.56% 3.59% :-) json_dump_v2 0.28% 0.58% 11.20% 8.29% :-| normal_startup 0.92% -0.02% 0.71% 6.40% ---------------------------------------------------------------------------------- * 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-2017-02-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 noreply at github.com Tue Feb 14 17:37:51 2017 From: noreply at github.com (GitHub) Date: Tue, 14 Feb 2017 14:37:51 -0800 Subject: [Python-checkins] [python/cpython] 6de2b7: bpo-29557: Remove ambiguous line in binhex docs (#... Message-ID: <58a386bf79f68_10483fe9732bbc301316d6@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 6de2b7817fa9403e81dc38f13f3690f0bbf3d064 https://github.com/python/cpython/commit/6de2b7817fa9403e81dc38f13f3690f0bbf3d064 Author: David Wilemski Date: 2017-02-15 (Wed, 15 Feb 2017) Changed paths: M Doc/library/binhex.rst Log Message: ----------- bpo-29557: Remove ambiguous line in binhex docs (#90) "appears to not work in all cases" does not inspire confidence in this module. I can find no context for what bug this was referencing so it should be removed. From noreply at github.com Tue Feb 14 17:46:10 2017 From: noreply at github.com (GitHub) Date: Tue, 14 Feb 2017 14:46:10 -0800 Subject: [Python-checkins] [python/cpython] 5ec08c: Remove double definition of IPPROTO_IPV6 (#100) Message-ID: <58a388b2864d7_99b3f97a63e5c3815784d@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 5ec08cea9574cf53c985af5dbed6bc3d56ff58b7 https://github.com/python/cpython/commit/5ec08cea9574cf53c985af5dbed6bc3d56ff58b7 Author: Maximilian Hils Date: 2017-02-15 (Wed, 15 Feb 2017) Changed paths: M Modules/socketmodule.c Log Message: ----------- Remove double definition of IPPROTO_IPV6 (#100) IPPROTO_IPV6 is already defined further above in the same way. From noreply at github.com Tue Feb 14 19:05:27 2017 From: noreply at github.com (GitHub) Date: Tue, 14 Feb 2017 16:05:27 -0800 Subject: [Python-checkins] [python/cpython] bc4bed: bpo-29546: Set 'path' on ImportError for ``from ..... Message-ID: <58a39b4718954_6e73fda3f39bc38617d9@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: bc4bed440504597cac47d0a215ee094bfa99ba7e https://github.com/python/cpython/commit/bc4bed440504597cac47d0a215ee094bfa99ba7e Author: Matthias Bussonnier Date: 2017-02-14 (Tue, 14 Feb 2017) Changed paths: M Lib/test/test_import/__init__.py M Misc/NEWS M Python/ceval.c Log Message: ----------- bpo-29546: Set 'path' on ImportError for ``from ... import ...`` (GH-91) From noreply at github.com Tue Feb 14 19:11:54 2017 From: noreply at github.com (GitHub) Date: Tue, 14 Feb 2017 16:11:54 -0800 Subject: [Python-checkins] [python/cpython] 71a8ad: Have Travis consider a pull request as passing as ... Message-ID: <58a39cca9948d_1483fa5703ffc3c918d8@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/travis-fast-finish Home: https://github.com/python/cpython Commit: 71a8adf4ed7f93c47d83f35b60d24e6c0c8d1ec5 https://github.com/python/cpython/commit/71a8adf4ed7f93c47d83f35b60d24e6c0c8d1ec5 Author: Brett Cannon Date: 2017-02-14 (Tue, 14 Feb 2017) Changed paths: M .travis.yml Log Message: ----------- Have Travis consider a pull request as passing as soon as required tests complete Without this flag, the coverage test will hold up the status of the pull request. From noreply at github.com Tue Feb 14 19:37:16 2017 From: noreply at github.com (GitHub) Date: Tue, 14 Feb 2017 16:37:16 -0800 Subject: [Python-checkins] [python/cpython] b52260: Have Travis consider a pull request as passing as ... Message-ID: <58a3a2bc6c061_1a5d3fec06597c3413311d@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: b52260d8bf392aa04c48b8c2467a4c034184de86 https://github.com/python/cpython/commit/b52260d8bf392aa04c48b8c2467a4c034184de86 Author: Brett Cannon Date: 2017-02-14 (Tue, 14 Feb 2017) Changed paths: M .travis.yml Log Message: ----------- Have Travis consider a pull request as passing as soon as required tests complete (#101) Without this flag, the coverage test will hold up the status of the pull request. From noreply at github.com Tue Feb 14 19:37:18 2017 From: noreply at github.com (GitHub) Date: Tue, 14 Feb 2017 16:37:18 -0800 Subject: [Python-checkins] [python/cpython] Message-ID: <58a3a2be2429_189d3fd03c1e7c3c13999@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/travis-fast-finish Home: https://github.com/python/cpython From noreply at github.com Tue Feb 14 20:21:33 2017 From: noreply at github.com (GitHub) Date: Tue, 14 Feb 2017 17:21:33 -0800 Subject: [Python-checkins] [python/cpython] 984eef: Only run Travis tests on master and X.Y branches (... Message-ID: <58a3ad1daa518_7ec53fd9ad237c44102643@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 984eef7d6d78e1213d6ea99897343a5059a07c59 https://github.com/python/cpython/commit/984eef7d6d78e1213d6ea99897343a5059a07c59 Author: Donald Stufft Date: 2017-02-14 (Tue, 14 Feb 2017) Changed paths: M .travis.yml Log Message: ----------- Only run Travis tests on master and X.Y branches (GH-102) If someone pushes a branch to python/cpython and then creates a PR it will cause Travis to run tests needlessly, once for the PR and once for the push. This will limit the branches that Travis will run tests for to the `master` branch and branches that match the regex `^\d\.\d$`. This will have the effect that if someone purposely makes another branch they won't get tests to run, but in that rare case they can adjust this themselves. From noreply at github.com Wed Feb 15 04:04:45 2017 From: noreply at github.com (GitHub) Date: Wed, 15 Feb 2017 01:04:45 -0800 Subject: [Python-checkins] [python/cpython] f15fa8: Update URL of Mersenne Twister Home Page (#20) Message-ID: <58a419ad1150c_26983fa87d36fc301207bd@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: f15fa87e5a66c0000f63be5065ddee4a52d5660f https://github.com/python/cpython/commit/f15fa87e5a66c0000f63be5065ddee4a52d5660f Author: Hiroki Noda Date: 2017-02-15 (Wed, 15 Feb 2017) Changed paths: M Modules/_randommodule.c Log Message: ----------- Update URL of Mersenne Twister Home Page (#20) From solipsis at pitrou.net Wed Feb 15 04:18:18 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 15 Feb 2017 09:18:18 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=-2 Message-ID: <20170215091817.107222.85287.61B9F386@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [-7, 8, -7] memory blocks, sum=-6 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/reflog1UfMoh', '--timeout', '7200'] From noreply at github.com Wed Feb 15 04:59:47 2017 From: noreply at github.com (GitHub) Date: Wed, 15 Feb 2017 01:59:47 -0800 Subject: [Python-checkins] [python/cpython] 1bfd33: Update URL of Mersenne Twister Home Page (#20) (#1... Message-ID: <58a426934551c_27c953ff0d4a01c34135081@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 1bfd33f5732ba5f6d15e99d88e45a62a9cc42542 https://github.com/python/cpython/commit/1bfd33f5732ba5f6d15e99d88e45a62a9cc42542 Author: INADA Naoki Date: 2017-02-15 (Wed, 15 Feb 2017) Changed paths: M Modules/_randommodule.c Log Message: ----------- Update URL of Mersenne Twister Home Page (#20) (#114) From noreply at github.com Wed Feb 15 04:59:49 2017 From: noreply at github.com (GitHub) Date: Wed, 15 Feb 2017 01:59:49 -0800 Subject: [Python-checkins] [python/cpython] 7d5587: Update URL of Mersenne Twister Home Page (#20) (#1... Message-ID: <58a4269549a09_119a3fb297795c3c129776@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 7d5587e687ba78563b0f026019e638800497e021 https://github.com/python/cpython/commit/7d5587e687ba78563b0f026019e638800497e021 Author: INADA Naoki Date: 2017-02-15 (Wed, 15 Feb 2017) Changed paths: M Modules/_randommodule.c Log Message: ----------- Update URL of Mersenne Twister Home Page (#20) (#115) From noreply at github.com Wed Feb 15 07:45:24 2017 From: noreply at github.com (GitHub) Date: Wed, 15 Feb 2017 04:45:24 -0800 Subject: [Python-checkins] [python/cpython] 2d33d6: Update README.rst Message-ID: <58a44d64e4651_a0a3fe1703a9c38732a1@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/ncoghlan-devguide-link Home: https://github.com/python/cpython Commit: 2d33d601a9e9eee2b7fb543a85dfb31f4be61c32 https://github.com/python/cpython/commit/2d33d601a9e9eee2b7fb543a85dfb31f4be61c32 Author: Nick Coghlan Date: 2017-02-15 (Wed, 15 Feb 2017) Changed paths: M README.rst Log Message: ----------- Update README.rst From noreply at github.com Wed Feb 15 11:00:56 2017 From: noreply at github.com (GitHub) Date: Wed, 15 Feb 2017 08:00:56 -0800 Subject: [Python-checkins] [python/cpython] 0f48ec: Update URL of Mersenne Twister Home Page (GH-116) Message-ID: <58a47b38833f4_1c173fe6489d9c341059e8@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/2.7 Home: https://github.com/python/cpython Commit: 0f48ecddfb79ef541500ecfcbda0b4178af1cc29 https://github.com/python/cpython/commit/0f48ecddfb79ef541500ecfcbda0b4178af1cc29 Author: INADA Naoki Date: 2017-02-16 (Thu, 16 Feb 2017) Changed paths: M Modules/_randommodule.c Log Message: ----------- Update URL of Mersenne Twister Home Page (GH-116) From noreply at github.com Wed Feb 15 14:29:18 2017 From: noreply at github.com (GitHub) Date: Wed, 15 Feb 2017 11:29:18 -0800 Subject: [Python-checkins] [python/cpython] 1e8cc8: Backport master's README.rst to 3.6 (GH-86) Message-ID: <58a4ac0e1de65_3d13f83a2b73c3815355b@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 1e8cc88a48a049b064f786bb4b97ea60b70dc504 https://github.com/python/cpython/commit/1e8cc88a48a049b064f786bb4b97ea60b70dc504 Author: Zachary Ware Date: 2017-02-15 (Wed, 15 Feb 2017) Changed paths: R README A README.rst Log Message: ----------- Backport master's README.rst to 3.6 (GH-86) Includes GH-2, GH-70, GH-73 (GH-79), and GH-21. From noreply at github.com Wed Feb 15 14:37:20 2017 From: noreply at github.com (GitHub) Date: Wed, 15 Feb 2017 11:37:20 -0800 Subject: [Python-checkins] [python/cpython] 36da1c: bpo-29481: add versionadded 3.6.1 to typing.Deque ... Message-ID: <58a4adf01879b_1e083f80903d3c4015826d@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 36da1c3589e1bc4246cccf6bd0094a110416a43a https://github.com/python/cpython/commit/36da1c3589e1bc4246cccf6bd0094a110416a43a Author: Mariatta Date: 2017-02-15 (Wed, 15 Feb 2017) Changed paths: M Doc/library/typing.rst Log Message: ----------- bpo-29481: add versionadded 3.6.1 to typing.Deque docs (#107) From noreply at github.com Wed Feb 15 14:38:49 2017 From: noreply at github.com (GitHub) Date: Wed, 15 Feb 2017 11:38:49 -0800 Subject: [Python-checkins] [python/cpython] 7224a0: bpo-29481: add versionadded 3.6.1 to typing.Deque ... Message-ID: <58a4ae49c88df_6433fe799a09c346921@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 7224a049b88ed37c510861528147e0db54911bb7 https://github.com/python/cpython/commit/7224a049b88ed37c510861528147e0db54911bb7 Author: Mariatta Date: 2017-02-15 (Wed, 15 Feb 2017) Changed paths: M Doc/library/typing.rst Log Message: ----------- bpo-29481: add versionadded 3.6.1 to typing.Deque docs (#108) (cherry picked from commit 7e147f1ddb8233964ff0981e6b64fc12edac99aa) From noreply at github.com Wed Feb 15 14:39:39 2017 From: noreply at github.com (GitHub) Date: Wed, 15 Feb 2017 11:39:39 -0800 Subject: [Python-checkins] [python/cpython] bb53a2: [cherry-pick for 3.5] bpo-29481: add versionadded ... Message-ID: <58a4ae7b64250_15823f80d3743c341131e6@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: bb53a27a5d56a4f33c3fc8eebb486b34808c92b7 https://github.com/python/cpython/commit/bb53a27a5d56a4f33c3fc8eebb486b34808c92b7 Author: Mariatta Date: 2017-02-15 (Wed, 15 Feb 2017) Changed paths: M Doc/library/typing.rst Log Message: ----------- [cherry-pick for 3.5] bpo-29481: add versionadded 3.5.4 to typing.Deque docs (#109) (cherry picked from commit 7e147f1ddb8233964ff0981e6b64fc12edac99aa) From noreply at github.com Wed Feb 15 17:18:04 2017 From: noreply at github.com (GitHub) Date: Wed, 15 Feb 2017 14:18:04 -0800 Subject: [Python-checkins] [python/cpython] 532519: More Travis docs build tweaks (GH-113) Message-ID: <58a4d39cac7cf_19ad3ff471293c2c133685@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 532519770dea5d353f0b0d718c8881a15c7542df https://github.com/python/cpython/commit/532519770dea5d353f0b0d718c8881a15c7542df Author: Zachary Ware Date: 2017-02-15 (Wed, 15 Feb 2017) Changed paths: M .travis.yml Log Message: ----------- More Travis docs build tweaks (GH-113) - Return to always building the docs, it's a relatively cheap operation, the check had a bug, and the docs build depends on other files. - Add `make suspicious` - Do all three checks as one `make check suspicious html` invocation for earliest possible exit in case of issues. From noreply at github.com Wed Feb 15 17:36:10 2017 From: noreply at github.com (GitHub) Date: Wed, 15 Feb 2017 14:36:10 -0800 Subject: [Python-checkins] [python/cpython] 91b0e7: Doc/Makefile: set PYTHON to python3 (#124) Message-ID: <58a4d7da53b6c_e2e3fa0ecd05c38916f2@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 91b0e7d0ca7c59df28f6a6fc1e8eb86a3925b76c https://github.com/python/cpython/commit/91b0e7d0ca7c59df28f6a6fc1e8eb86a3925b76c Author: Victor Stinner Date: 2017-02-15 (Wed, 15 Feb 2017) Changed paths: M .travis.yml M Doc/Makefile Log Message: ----------- Doc/Makefile: set PYTHON to python3 (#124) rstlint.py run by "make check" doesn't support Python 2. "make venv" runs "$(PYTHON) -m venv", whereas Python 2 doens't provide the venv module: it's a module of Python 3 standard library. From noreply at github.com Wed Feb 15 17:54:07 2017 From: noreply at github.com (GitHub) Date: Wed, 15 Feb 2017 14:54:07 -0800 Subject: [Python-checkins] [python/cpython] b3f1f5: Rename Doc/README.txt to Doc/README.rst and add fo... Message-ID: <58a4dc0f43228_1e1f3fb4dfb8fc301039a0@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: b3f1f59cf451d4a25b204e7a24f7be4c95e40be8 https://github.com/python/cpython/commit/b3f1f59cf451d4a25b204e7a24f7be4c95e40be8 Author: Roger Date: 2017-02-15 (Wed, 15 Feb 2017) Changed paths: M Doc/Makefile A Doc/README.rst R Doc/README.txt M Doc/conf.py M Doc/make.bat M README.rst Log Message: ----------- Rename Doc/README.txt to Doc/README.rst and add formatting (#104) * Reformat Doc/README.txt to Doc/README.rst * Update mention of Doc/README.rst * Update mention of README.txt to README.rst * Make line fold * rstlint ignore Doc/README.rst * conf.py ignore Doc/README.rst * Update issue tracker url in Docs/README.rst From noreply at github.com Wed Feb 15 18:14:40 2017 From: noreply at github.com (GitHub) Date: Wed, 15 Feb 2017 15:14:40 -0800 Subject: [Python-checkins] [python/cpython] de553b: bpo-29521 update Misc/ACKS (#111) Message-ID: <58a4e0e07587a_1aec3fc0c12f7c2412147f@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: de553b8210882823d3df3f1ef6882eba3f8accf3 https://github.com/python/cpython/commit/de553b8210882823d3df3f1ef6882eba3f8accf3 Author: Mariatta Date: 2017-02-16 (Thu, 16 Feb 2017) Changed paths: M Misc/ACKS Log Message: ----------- bpo-29521 update Misc/ACKS (#111) (cherry picked from commit 6420088b924a23e5de40be6623d2a80b12f71d97) From noreply at github.com Wed Feb 15 18:14:43 2017 From: noreply at github.com (GitHub) Date: Wed, 15 Feb 2017 15:14:43 -0800 Subject: [Python-checkins] [python/cpython] 02e335: bpo-29521 update Misc/ACKS (#110) Message-ID: <58a4e0e3566a9_108b3f8bf0b79c2c16306d@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 02e3357e089f37c23d0f3d1ebee9aa3d7a1492a9 https://github.com/python/cpython/commit/02e3357e089f37c23d0f3d1ebee9aa3d7a1492a9 Author: Mariatta Date: 2017-02-16 (Thu, 16 Feb 2017) Changed paths: M Misc/ACKS Log Message: ----------- bpo-29521 update Misc/ACKS (#110) (cherry picked from commit 6420088b924a23e5de40be6623d2a80b12f71d97) From noreply at github.com Wed Feb 15 18:16:26 2017 From: noreply at github.com (GitHub) Date: Wed, 15 Feb 2017 15:16:26 -0800 Subject: [Python-checkins] [python/cpython] 85064d: bpo-29521 update Misc/ACKS (#106) Message-ID: <58a4e14a1a009_27c953ff0d4a01c341556c7@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 85064db281545d587992df61154e76439138319f https://github.com/python/cpython/commit/85064db281545d587992df61154e76439138319f Author: Mariatta Date: 2017-02-16 (Thu, 16 Feb 2017) Changed paths: M Misc/ACKS Log Message: ----------- bpo-29521 update Misc/ACKS (#106) From lp_benchmark_robot at intel.com Wed Feb 15 18:24:41 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 15 Feb 2017 15:24:41 -0800 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2017-02-15 Message-ID: <040f263e-b35c-4a38-a246-e952cc2f1b39@orsmsx104.amr.corp.intel.com> No new revisions. Here are the previous results: Results for project Python 2.7, build date 2017-02-15 11:06:20 +0000 commit: 54c93e0fe79b previous commit: b07d454e45a2 revision date: 2017-02-10 13:14:04 +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.16% 3.95% 9.48% :-) pybench 0.17% -0.05% 7.61% 4.20% :-| regex_v8 0.55% 0.05% -0.10% 10.60% :-) nbody 0.13% -0.07% 11.86% 4.16% :-| json_dump_v2 0.29% -0.17% 0.33% 11.93% :-| normal_startup 1.70% 0.81% -1.93% 1.91% :-| ssbench 0.15% -0.28% -0.09% 2.95% ---------------------------------------------------------------------------------- * 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-2017-02-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 noreply at github.com Wed Feb 15 18:34:31 2017 From: noreply at github.com (GitHub) Date: Wed, 15 Feb 2017 15:34:31 -0800 Subject: [Python-checkins] [python/cpython] 72e81d: bpo-29556: Remove unused #include (#9... Message-ID: <58a4e58795be4_277a3ff0526dfc2c117866@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 72e81d00eee685cfe33aaddf2aa9feef2d07591f https://github.com/python/cpython/commit/72e81d00eee685cfe33aaddf2aa9feef2d07591f Author: Yen Chi Hsuan Date: 2017-02-16 (Thu, 16 Feb 2017) Changed paths: M Modules/posixmodule.c M Python/bltinmodule.c M Python/pythonrun.c M Python/sysmodule.c Log Message: ----------- bpo-29556: Remove unused #include (#98) bltinmodule.c: Added in b744ba1 and no longer necessary since d64e8a7 posixmodule.c: Added in d1cd4d4 and no longer necessary since efb00c0 pythonrun.c: Added in 73d538b and no longer necessary since d600951 sysmodule.c: Added in 5467d4c and no longer necessary since a2c17c5 From lp_benchmark_robot at intel.com Wed Feb 15 18:36:42 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Wed, 15 Feb 2017 15:36:42 -0800 Subject: [Python-checkins] BAD Benchmark Results for Python Default 2017-02-15 Message-ID: No new revisions. Here are the previous results: Results for project Python default, build date 2017-02-15 11:03:46 +0000 commit: 4243df51fe43 previous commit: e5cd74868dfc revision date: 2017-02-10 13:19:36 +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% -1.13% 7.97% 18.54% :-) pybench 0.21% -0.00% 4.34% 4.75% :-| regex_v8 3.69% -0.00% 1.84% 3.58% :-| nbody 0.16% -0.10% 0.56% 3.59% :-) json_dump_v2 0.28% 0.58% 11.20% 8.29% :-| normal_startup 0.92% -0.02% 0.71% 6.40% ---------------------------------------------------------------------------------- * 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-2017-02-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 noreply at github.com Wed Feb 15 18:56:55 2017 From: noreply at github.com (GitHub) Date: Wed, 15 Feb 2017 15:56:55 -0800 Subject: [Python-checkins] [python/cpython] b300c6: Backport36 doc fixes: PR#68 and PR#124 (#125) Message-ID: <58a4eac7ede20_1ac43fbed8e29c2c1175ae@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: b300c660d34d2027d443098ea605a8e0eb51d383 https://github.com/python/cpython/commit/b300c660d34d2027d443098ea605a8e0eb51d383 Author: Victor Stinner Date: 2017-02-16 (Thu, 16 Feb 2017) Changed paths: M Doc/Makefile M Doc/faq/windows.rst Log Message: ----------- Backport36 doc fixes: PR#68 and PR#124 (#125) * Travis CI: run rstlint.py in the docs job (#68) Currently, http://buildbot.python.org/all/buildslaves/ware-docs buildbot is only run as post-commit. For example, bpo-29521 (PR#41) introduced two warnings, unnotified by the Travis CI docs job. Modify the docs job to run toosl/rstlint.py. Fix also the two minor warnings which causes the buildbot slave to fail. (cherry picked from commit 2b501866ed493758e4c4b29f0ce9b24023d910a1) * Doc/Makefile: set PYTHON to python3 (#124) rstlint.py run by "make check" doesn't support Python 2. "make venv" runs "$(PYTHON) -m venv", whereas Python 2 doens't provide the venv module: it's a module of Python 3 standard library. (cherry picked from commit 91b0e7d0ca7c59df28f6a6fc1e8eb86a3925b76c) From noreply at github.com Wed Feb 15 19:26:02 2017 From: noreply at github.com (GitHub) Date: Wed, 15 Feb 2017 16:26:02 -0800 Subject: [Python-checkins] [python/cpython] 72dccd: bpo-29548: Fix some inefficient call API usage (GH... Message-ID: <58a4f19a88564_8bb3fa6275d7c2811621e@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 72dccde884d89586b0cafd990675b7e21720a81f https://github.com/python/cpython/commit/72dccde884d89586b0cafd990675b7e21720a81f Author: INADA Naoki Date: 2017-02-16 (Thu, 16 Feb 2017) Changed paths: M Modules/_testcapimodule.c M Modules/_threadmodule.c M Modules/_tkinter.c M Objects/abstract.c M Objects/fileobject.c M Objects/typeobject.c M Objects/weakrefobject.c Log Message: ----------- bpo-29548: Fix some inefficient call API usage (GH-97) From noreply at github.com Wed Feb 15 21:00:33 2017 From: noreply at github.com (GitHub) Date: Wed, 15 Feb 2017 18:00:33 -0800 Subject: [Python-checkins] [python/cpython] 1d4601: bpo-29576: add explicit deprecation for importlib.... Message-ID: <58a507c174cf6_177a3f998b163c30144479@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 1d4601c2c6952d03fc4dda2b041be9aa8713c0bc https://github.com/python/cpython/commit/1d4601c2c6952d03fc4dda2b041be9aa8713c0bc Author: Matthias Bussonnier Date: 2017-02-15 (Wed, 15 Feb 2017) Changed paths: M Doc/whatsnew/3.7.rst M Lib/importlib/__init__.py M Lib/importlib/abc.py M Lib/test/test_importlib/test_abc.py M Misc/NEWS Log Message: ----------- bpo-29576: add explicit deprecation for importlib.abc.find_loader() and find_module() (GH-32) From noreply at github.com Thu Feb 16 02:34:31 2017 From: noreply at github.com (GitHub) Date: Wed, 15 Feb 2017 23:34:31 -0800 Subject: [Python-checkins] [python/cpython] db44b8: reinit the TLS before anything else Message-ID: <58a5560764339_7e193f9193a45c4010654e@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/benjamin-reinit-tls Home: https://github.com/python/cpython Commit: db44b8848f88ee3fa48122ceb88268665a975e26 https://github.com/python/cpython/commit/db44b8848f88ee3fa48122ceb88268665a975e26 Author: Benjamin Peterson Date: 2017-02-15 (Wed, 15 Feb 2017) Changed paths: M Parser/intrcheck.c Log Message: ----------- reinit the TLS before anything else PyEval_ReInitThread can run arbitrary Python code, which really ought to have the TLS initialized. From solipsis at pitrou.net Thu Feb 16 04:15:51 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 16 Feb 2017 09:15:51 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=3 Message-ID: <20170216091551.3492.79625.FD18FB39@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_spawn leaked [-2, 0, 1] memory blocks, sum=-1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogw2UUYI', '--timeout', '7200'] From noreply at github.com Thu Feb 16 04:43:17 2017 From: noreply at github.com (GitHub) Date: Thu, 16 Feb 2017 01:43:17 -0800 Subject: [Python-checkins] [python/cpython] 5e04df: Backport35 doc fixes: PR#68 and PR#124 (#125) (#12... Message-ID: <58a57435b794e_284af3fd9826ddc381263f@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 5e04dfecec478db13031fa507d6b2e21adbce035 https://github.com/python/cpython/commit/5e04dfecec478db13031fa507d6b2e21adbce035 Author: Victor Stinner Date: 2017-02-16 (Thu, 16 Feb 2017) Changed paths: M Doc/Makefile M Doc/faq/windows.rst Log Message: ----------- Backport35 doc fixes: PR#68 and PR#124 (#125) (#126) * Travis CI: run rstlint.py in the docs job (#68) Currently, http://buildbot.python.org/all/buildslaves/ware-docs buildbot is only run as post-commit. For example, bpo-29521 (PR#41) introduced two warnings, unnotified by the Travis CI docs job. Modify the docs job to run toosl/rstlint.py. Fix also the two minor warnings which causes the buildbot slave to fail. (cherry picked from commit 2b501866ed493758e4c4b29f0ce9b24023d910a1) * Doc/Makefile: set PYTHON to python3 (#124) rstlint.py run by "make check" doesn't support Python 2. "make venv" runs "$(PYTHON) -m venv", whereas Python 2 doens't provide the venv module: it's a module of Python 3 standard library. (cherry picked from commit 91b0e7d0ca7c59df28f6a6fc1e8eb86a3925b76c) (cherry picked from commit b300c660d34d2027d443098ea605a8e0eb51d383) From noreply at github.com Thu Feb 16 05:00:47 2017 From: noreply at github.com (GitHub) Date: Thu, 16 Feb 2017 02:00:47 -0800 Subject: [Python-checkins] [python/cpython] 23557d: bpo-29026: Clarify documentation of time.time (#34... Message-ID: <58a5784f22ed2_1e273fd7257adc44100033@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 23557d59b819f57800ddef0b1373acef8e024670 https://github.com/python/cpython/commit/23557d59b819f57800ddef0b1373acef8e024670 Author: Eric Appelt Date: 2017-02-16 (Thu, 16 Feb 2017) Changed paths: M Doc/library/time.rst Log Message: ----------- bpo-29026: Clarify documentation of time.time (#34) * bpo-29026: Clarity documentation of time.time Clarify the documentation of time.time by more precisely defining what is meant by "seconds since the epoch" on most platforms. Additionally explain how gmtime and localtime may be used to extract calendar components and convert to a more common date format. * bpo-29026: Minor improvements for time.time doc * bpo-29026: Consistency fixes for time.time doc From noreply at github.com Thu Feb 16 08:41:32 2017 From: noreply at github.com (GitHub) Date: Thu, 16 Feb 2017 05:41:32 -0800 Subject: [Python-checkins] [python/cpython] 9764c1: update test_socket AEAD test for kernel 4.9 and up... Message-ID: <58a5ac0c93d30_110f3fb3183e1c409605e@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 9764c151c51480a7ca6042b1ccd69be2620ff360 https://github.com/python/cpython/commit/9764c151c51480a7ca6042b1ccd69be2620ff360 Author: matejcik Date: 2017-02-16 (Thu, 16 Feb 2017) Changed paths: M Lib/test/test_socket.py Log Message: ----------- update test_socket AEAD test for kernel 4.9 and up (#133) From noreply at github.com Thu Feb 16 10:18:44 2017 From: noreply at github.com (GitHub) Date: Thu, 16 Feb 2017 07:18:44 -0800 Subject: [Python-checkins] [python/cpython] b2ee40: Change some mercurial/ hg.python.org references. (... Message-ID: <58a5c2d47c3cf_280683ff102fb5c2415812d@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: b2ee40ed9c9041dcff9c898aa19aacf9ec60308a https://github.com/python/cpython/commit/b2ee40ed9c9041dcff9c898aa19aacf9ec60308a Author: Senthil Kumaran Date: 2017-02-16 (Thu, 16 Feb 2017) Changed paths: M Doc/faq/general.rst M Lib/idlelib/help.html M Tools/README M Tools/importbench/README Log Message: ----------- Change some mercurial/ hg.python.org references. (#8) From lp_benchmark_robot at intel.com Thu Feb 16 20:23:11 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 16 Feb 2017 17:23:11 -0800 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2017-02-16 Message-ID: <6b162d08-db48-4555-8c7f-d9889286449f@orsmsx155.amr.corp.intel.com> No new revisions. Here are the previous results: Results for project Python 2.7, build date 2017-02-16 11:06:24 +0000 commit: 54c93e0fe79b previous commit: b07d454e45a2 revision date: 2017-02-10 13:14:04 +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.16% 3.95% 9.48% :-) pybench 0.17% -0.05% 7.61% 4.20% :-| regex_v8 0.55% 0.05% -0.10% 10.60% :-) nbody 0.13% -0.07% 11.86% 4.16% :-| json_dump_v2 0.29% -0.17% 0.33% 11.93% :-| normal_startup 1.70% 0.81% -1.93% 1.91% :-| ssbench 0.15% -0.28% -0.09% 2.95% ---------------------------------------------------------------------------------- * 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-2017-02-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 lp_benchmark_robot at intel.com Thu Feb 16 20:23:36 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Thu, 16 Feb 2017 17:23:36 -0800 Subject: [Python-checkins] BAD Benchmark Results for Python Default 2017-02-16 Message-ID: No new revisions. Here are the previous results: Results for project Python default, build date 2017-02-16 11:03:50 +0000 commit: 4243df51fe43 previous commit: e5cd74868dfc revision date: 2017-02-10 13:19:36 +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% -1.13% 7.97% 18.54% :-) pybench 0.21% -0.00% 4.34% 4.75% :-| regex_v8 3.69% -0.00% 1.84% 3.58% :-| nbody 0.16% -0.10% 0.56% 3.59% :-) json_dump_v2 0.28% 0.58% 11.20% 8.29% :-| normal_startup 0.92% -0.02% 0.71% 6.40% ---------------------------------------------------------------------------------- * 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-2017-02-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 solipsis at pitrou.net Fri Feb 17 04:14:36 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 17 Feb 2017 09:14:36 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=14 Message-ID: <20170217091436.31088.17580.78C48CAD@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_asyncio leaked [0, 3, 0] memory blocks, sum=3 test_collections leaked [7, 0, 0] memory blocks, sum=7 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/reflog6TUtNU', '--timeout', '7200'] From lp_benchmark_robot at intel.com Fri Feb 17 14:01:11 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 17 Feb 2017 11:01:11 -0800 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2017-02-17 Message-ID: No new revisions. Here are the previous results: Results for project Python 2.7, build date 2017-02-17 11:06:17 +0000 commit: 54c93e0fe79b previous commit: b07d454e45a2 revision date: 2017-02-10 13:14:04 +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.16% 3.95% 9.48% :-) pybench 0.17% -0.05% 7.61% 4.20% :-| regex_v8 0.55% 0.05% -0.10% 10.60% :-) nbody 0.13% -0.07% 11.86% 4.16% :-| json_dump_v2 0.29% -0.17% 0.33% 11.93% :-| normal_startup 1.70% 0.81% -1.93% 1.91% :-| ssbench 0.15% -0.28% -0.09% 2.95% ---------------------------------------------------------------------------------- * 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-2017-02-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 lp_benchmark_robot at intel.com Fri Feb 17 14:01:36 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Fri, 17 Feb 2017 11:01:36 -0800 Subject: [Python-checkins] BAD Benchmark Results for Python Default 2017-02-17 Message-ID: <6baf5760-6c8a-422d-9f7e-477ce7e7be81@orsmsx156.amr.corp.intel.com> No new revisions. Here are the previous results: Results for project Python default, build date 2017-02-17 11:03:41 +0000 commit: 4243df51fe43 previous commit: e5cd74868dfc revision date: 2017-02-10 13:19:36 +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% -1.13% 7.97% 18.54% :-) pybench 0.21% -0.00% 4.34% 4.75% :-| regex_v8 3.69% -0.00% 1.84% 3.58% :-| nbody 0.16% -0.10% 0.56% 3.59% :-) json_dump_v2 0.28% 0.58% 11.20% 8.29% :-| normal_startup 0.92% -0.02% 0.71% 6.40% ---------------------------------------------------------------------------------- * 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-2017-02-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 noreply at github.com Sat Feb 18 00:11:18 2017 From: noreply at github.com (GitHub) Date: Fri, 17 Feb 2017 21:11:18 -0800 Subject: [Python-checkins] [python/cpython] 8873a5: Remove redundant devguide link Message-ID: <58a7d776e85f9_70e3f82ec755c34206767@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/ncoghlan-devguide-link Home: https://github.com/python/cpython Commit: 8873a5fbc10993bdd9c56320f72ad388ef453a85 https://github.com/python/cpython/commit/8873a5fbc10993bdd9c56320f72ad388ef453a85 Author: Nick Coghlan Date: 2017-02-18 (Sat, 18 Feb 2017) Changed paths: M README.rst Log Message: ----------- Remove redundant devguide link From noreply at github.com Sat Feb 18 00:13:17 2017 From: noreply at github.com (GitHub) Date: Fri, 17 Feb 2017 21:13:17 -0800 Subject: [Python-checkins] [python/cpython] 36da1c: bpo-29481: add versionadded 3.6.1 to typing.Deque ... Message-ID: <58a7d7ed4e33f_1aa33fa9504ffc3419076e@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/ncoghlan-devguide-link Home: https://github.com/python/cpython Commit: 36da1c3589e1bc4246cccf6bd0094a110416a43a https://github.com/python/cpython/commit/36da1c3589e1bc4246cccf6bd0094a110416a43a Author: Mariatta Date: 2017-02-15 (Wed, 15 Feb 2017) Changed paths: M Doc/library/typing.rst Log Message: ----------- bpo-29481: add versionadded 3.6.1 to typing.Deque docs (#107) Commit: 532519770dea5d353f0b0d718c8881a15c7542df https://github.com/python/cpython/commit/532519770dea5d353f0b0d718c8881a15c7542df Author: Zachary Ware Date: 2017-02-15 (Wed, 15 Feb 2017) Changed paths: M .travis.yml Log Message: ----------- More Travis docs build tweaks (GH-113) - Return to always building the docs, it's a relatively cheap operation, the check had a bug, and the docs build depends on other files. - Add `make suspicious` - Do all three checks as one `make check suspicious html` invocation for earliest possible exit in case of issues. Commit: 91b0e7d0ca7c59df28f6a6fc1e8eb86a3925b76c https://github.com/python/cpython/commit/91b0e7d0ca7c59df28f6a6fc1e8eb86a3925b76c Author: Victor Stinner Date: 2017-02-15 (Wed, 15 Feb 2017) Changed paths: M .travis.yml M Doc/Makefile Log Message: ----------- Doc/Makefile: set PYTHON to python3 (#124) rstlint.py run by "make check" doesn't support Python 2. "make venv" runs "$(PYTHON) -m venv", whereas Python 2 doens't provide the venv module: it's a module of Python 3 standard library. Commit: b3f1f59cf451d4a25b204e7a24f7be4c95e40be8 https://github.com/python/cpython/commit/b3f1f59cf451d4a25b204e7a24f7be4c95e40be8 Author: Roger Date: 2017-02-15 (Wed, 15 Feb 2017) Changed paths: M Doc/Makefile A Doc/README.rst R Doc/README.txt M Doc/conf.py M Doc/make.bat M README.rst Log Message: ----------- Rename Doc/README.txt to Doc/README.rst and add formatting (#104) * Reformat Doc/README.txt to Doc/README.rst * Update mention of Doc/README.rst * Update mention of README.txt to README.rst * Make line fold * rstlint ignore Doc/README.rst * conf.py ignore Doc/README.rst * Update issue tracker url in Docs/README.rst Commit: 85064db281545d587992df61154e76439138319f https://github.com/python/cpython/commit/85064db281545d587992df61154e76439138319f Author: Mariatta Date: 2017-02-16 (Thu, 16 Feb 2017) Changed paths: M Misc/ACKS Log Message: ----------- bpo-29521 update Misc/ACKS (#106) Commit: 72e81d00eee685cfe33aaddf2aa9feef2d07591f https://github.com/python/cpython/commit/72e81d00eee685cfe33aaddf2aa9feef2d07591f Author: Yen Chi Hsuan Date: 2017-02-16 (Thu, 16 Feb 2017) Changed paths: M Modules/posixmodule.c M Python/bltinmodule.c M Python/pythonrun.c M Python/sysmodule.c Log Message: ----------- bpo-29556: Remove unused #include (#98) bltinmodule.c: Added in b744ba1 and no longer necessary since d64e8a7 posixmodule.c: Added in d1cd4d4 and no longer necessary since efb00c0 pythonrun.c: Added in 73d538b and no longer necessary since d600951 sysmodule.c: Added in 5467d4c and no longer necessary since a2c17c5 Commit: 72dccde884d89586b0cafd990675b7e21720a81f https://github.com/python/cpython/commit/72dccde884d89586b0cafd990675b7e21720a81f Author: INADA Naoki Date: 2017-02-16 (Thu, 16 Feb 2017) Changed paths: M Modules/_testcapimodule.c M Modules/_threadmodule.c M Modules/_tkinter.c M Objects/abstract.c M Objects/fileobject.c M Objects/typeobject.c M Objects/weakrefobject.c Log Message: ----------- bpo-29548: Fix some inefficient call API usage (GH-97) Commit: 1d4601c2c6952d03fc4dda2b041be9aa8713c0bc https://github.com/python/cpython/commit/1d4601c2c6952d03fc4dda2b041be9aa8713c0bc Author: Matthias Bussonnier Date: 2017-02-15 (Wed, 15 Feb 2017) Changed paths: M Doc/whatsnew/3.7.rst M Lib/importlib/__init__.py M Lib/importlib/abc.py M Lib/test/test_importlib/test_abc.py M Misc/NEWS Log Message: ----------- bpo-29576: add explicit deprecation for importlib.abc.find_loader() and find_module() (GH-32) Commit: 23557d59b819f57800ddef0b1373acef8e024670 https://github.com/python/cpython/commit/23557d59b819f57800ddef0b1373acef8e024670 Author: Eric Appelt Date: 2017-02-16 (Thu, 16 Feb 2017) Changed paths: M Doc/library/time.rst Log Message: ----------- bpo-29026: Clarify documentation of time.time (#34) * bpo-29026: Clarity documentation of time.time Clarify the documentation of time.time by more precisely defining what is meant by "seconds since the epoch" on most platforms. Additionally explain how gmtime and localtime may be used to extract calendar components and convert to a more common date format. * bpo-29026: Minor improvements for time.time doc * bpo-29026: Consistency fixes for time.time doc Commit: 9764c151c51480a7ca6042b1ccd69be2620ff360 https://github.com/python/cpython/commit/9764c151c51480a7ca6042b1ccd69be2620ff360 Author: matejcik Date: 2017-02-16 (Thu, 16 Feb 2017) Changed paths: M Lib/test/test_socket.py Log Message: ----------- update test_socket AEAD test for kernel 4.9 and up (#133) Commit: b2ee40ed9c9041dcff9c898aa19aacf9ec60308a https://github.com/python/cpython/commit/b2ee40ed9c9041dcff9c898aa19aacf9ec60308a Author: Senthil Kumaran Date: 2017-02-16 (Thu, 16 Feb 2017) Changed paths: M Doc/faq/general.rst M Lib/idlelib/help.html M Tools/README M Tools/importbench/README Log Message: ----------- Change some mercurial/ hg.python.org references. (#8) Commit: 351802902369e6ac649066a3b6c82bfdd7d9915b https://github.com/python/cpython/commit/351802902369e6ac649066a3b6c82bfdd7d9915b Author: Nick Coghlan Date: 2017-02-18 (Sat, 18 Feb 2017) Changed paths: M .travis.yml M Doc/Makefile A Doc/README.rst R Doc/README.txt M Doc/conf.py M Doc/faq/general.rst M Doc/library/time.rst M Doc/library/typing.rst M Doc/make.bat M Doc/whatsnew/3.7.rst M Lib/idlelib/help.html M Lib/importlib/__init__.py M Lib/importlib/abc.py M Lib/test/test_importlib/test_abc.py M Lib/test/test_socket.py M Misc/ACKS M Misc/NEWS M Modules/_testcapimodule.c M Modules/_threadmodule.c M Modules/_tkinter.c M Modules/posixmodule.c M Objects/abstract.c M Objects/fileobject.c M Objects/typeobject.c M Objects/weakrefobject.c M Python/bltinmodule.c M Python/pythonrun.c M Python/sysmodule.c M README.rst M Tools/README M Tools/importbench/README Log Message: ----------- Merge branch 'master' into ncoghlan-devguide-link Compare: https://github.com/python/cpython/compare/8873a5fbc109...351802902369 From noreply at github.com Sat Feb 18 00:22:43 2017 From: noreply at github.com (GitHub) Date: Fri, 17 Feb 2017 21:22:43 -0800 Subject: [Python-checkins] [python/cpython] 76bdcb: Make devguide link in README more prominent Message-ID: <58a7da23527b0_28bdf3faaadbbdc34173458@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/ncoghlan-README-devguide-link Home: https://github.com/python/cpython Commit: 76bdcb42d66777ec43c3dec50056f627e37a04ef https://github.com/python/cpython/commit/76bdcb42d66777ec43c3dec50056f627e37a04ef Author: Nick Coghlan Date: 2017-02-18 (Sat, 18 Feb 2017) Changed paths: M README.rst Log Message: ----------- Make devguide link in README more prominent From noreply at github.com Sat Feb 18 01:31:49 2017 From: noreply at github.com (GitHub) Date: Fri, 17 Feb 2017 22:31:49 -0800 Subject: [Python-checkins] [python/cpython] 1b3d88: Make devguide link in README more prominent (#145) Message-ID: <58a7ea551813d_20f23fe6113bbc3021233b@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 1b3d88eb33085e90af729c4c2f78b5ba1b942b1e https://github.com/python/cpython/commit/1b3d88eb33085e90af729c4c2f78b5ba1b942b1e Author: Nick Coghlan Date: 2017-02-18 (Sat, 18 Feb 2017) Changed paths: M README.rst Log Message: ----------- Make devguide link in README more prominent (#145) From solipsis at pitrou.net Sat Feb 18 04:14:54 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 18 Feb 2017 09:14:54 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=12 Message-ID: <20170218091454.20317.37512.1F9179BD@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [7, -7, 8] memory blocks, sum=8 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/reflogDTt_As', '--timeout', '7200'] From noreply at github.com Sat Feb 18 04:31:24 2017 From: noreply at github.com (GitHub) Date: Sat, 18 Feb 2017 01:31:24 -0800 Subject: [Python-checkins] [python/cpython] ace5c0: bpo-29571: Use correct locale encoding in test_re ... Message-ID: <58a8146c875d5_27db83f8ed881dc3c200693@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: ace5c0fdd9b962e6e886c29dbcea72c53f051dc4 https://github.com/python/cpython/commit/ace5c0fdd9b962e6e886c29dbcea72c53f051dc4 Author: Nick Coghlan Date: 2017-02-18 (Sat, 18 Feb 2017) Changed paths: M Lib/test/test_re.py M Misc/NEWS Log Message: ----------- bpo-29571: Use correct locale encoding in test_re (#149) ``local.getlocale(locale.LC_CTYPE)`` and ``locale.getpreferredencoding(False)`` may give different answers in some cases (such as the ``en_IN`` locale). ``re.LOCALE`` uses the latter, so update the test case to match. From noreply at github.com Sat Feb 18 15:45:51 2017 From: noreply at github.com (GitHub) Date: Sat, 18 Feb 2017 12:45:51 -0800 Subject: [Python-checkins] [python/cpython] 8c130d: bpo-22807: Expose platform UUID generation safety ... Message-ID: <58a8b27f16579_197a3f7e493e7c342192a3@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 8c130d7f8114158f5b94749032ec0c17dba96f83 https://github.com/python/cpython/commit/8c130d7f8114158f5b94749032ec0c17dba96f83 Author: Barry Warsaw Date: 2017-02-18 (Sat, 18 Feb 2017) Changed paths: M Doc/library/uuid.rst M Lib/test/test_uuid.py M Lib/uuid.py M Misc/NEWS Log Message: ----------- bpo-22807: Expose platform UUID generation safety information. (#138) bpo-22807: Expose platform UUID generation safety information. From noreply at github.com Sat Feb 18 16:44:30 2017 From: noreply at github.com (GitHub) Date: Sat, 18 Feb 2017 13:44:30 -0800 Subject: [Python-checkins] [python/cpython] Message-ID: <58a8c03e5aaec_98c3ffb23b7dc3013524e@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/ncoghlan-README-devguide-link Home: https://github.com/python/cpython From noreply at github.com Sat Feb 18 16:44:34 2017 From: noreply at github.com (GitHub) Date: Sat, 18 Feb 2017 13:44:34 -0800 Subject: [Python-checkins] [python/cpython] Message-ID: <58a8c042bd5ee_20ee3f9c44527c341317dc@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/ncoghlan-devguide-link Home: https://github.com/python/cpython From noreply at github.com Sat Feb 18 19:12:03 2017 From: noreply at github.com (GitHub) Date: Sat, 18 Feb 2017 16:12:03 -0800 Subject: [Python-checkins] [python/cpython] 52a7e9: bpo-29579: Removes readme.txt from the installer. ... Message-ID: <58a8e2d36cd69_1c773fe8018fdc3813915c@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 52a7e92e3d38d3d003552db6795deeeee75db2e4 https://github.com/python/cpython/commit/52a7e92e3d38d3d003552db6795deeeee75db2e4 Author: Steve Dower Date: 2017-02-18 (Sat, 18 Feb 2017) Changed paths: M Misc/NEWS M Tools/msi/exe/exe_files.wxs Log Message: ----------- bpo-29579: Removes readme.txt from the installer. (#160) From noreply at github.com Sat Feb 18 19:12:08 2017 From: noreply at github.com (GitHub) Date: Sat, 18 Feb 2017 16:12:08 -0800 Subject: [Python-checkins] [python/cpython] d372cd: bpo-29579: Removes readme.txt from the installer. ... Message-ID: <58a8e2d83d21_6853f8def849c2c1321f5@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: d372cda5cd46712c4e59262ec1ab981773b20bff https://github.com/python/cpython/commit/d372cda5cd46712c4e59262ec1ab981773b20bff Author: Steve Dower Date: 2017-02-18 (Sat, 18 Feb 2017) Changed paths: M Misc/NEWS M Tools/msi/exe/exe_files.wxs Log Message: ----------- bpo-29579: Removes readme.txt from the installer. (#161) From noreply at github.com Sat Feb 18 19:17:37 2017 From: noreply at github.com (GitHub) Date: Sat, 18 Feb 2017 16:17:37 -0800 Subject: [Python-checkins] [python/cpython] d4d487: Tweak PEP 519 documentation in stdlib (#163) Message-ID: <58a8e42119ba7_f143fcbecd87c30200024@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: d4d48743ac20854de104e08dd66972471684f676 https://github.com/python/cpython/commit/d4d48743ac20854de104e08dd66972471684f676 Author: Berker Peksag Date: 2017-02-19 (Sun, 19 Feb 2017) Changed paths: M Doc/library/lzma.rst M Doc/library/os.rst Log Message: ----------- Tweak PEP 519 documentation in stdlib (#163) * Drop duplicate work 'object' in lzma docs * Fix typo in os docs: fpr -> for From noreply at github.com Sat Feb 18 23:33:36 2017 From: noreply at github.com (GitHub) Date: Sat, 18 Feb 2017 20:33:36 -0800 Subject: [Python-checkins] [python/cpython] 0683d6: [3.6] bpo-29571: Use correct locale encoding in te... Message-ID: <58a92020b38ab_99b3f97a63e5c382779cf@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 0683d6889bd4430599d22e12e201b8e9c45be5a2 https://github.com/python/cpython/commit/0683d6889bd4430599d22e12e201b8e9c45be5a2 Author: Nick Coghlan Date: 2017-02-19 (Sun, 19 Feb 2017) Changed paths: M Lib/test/test_re.py M Misc/NEWS Log Message: ----------- [3.6] bpo-29571: Use correct locale encoding in test_re (#149) (#153) ``local.getlocale(locale.LC_CTYPE)`` and ``locale.getpreferredencoding(False)`` may give different answers in some cases (such as the ``en_IN`` locale). ``re.LOCALE`` uses the latter, so update the test case to match. From noreply at github.com Sat Feb 18 23:33:51 2017 From: noreply at github.com (GitHub) Date: Sat, 18 Feb 2017 20:33:51 -0800 Subject: [Python-checkins] [python/cpython] 760f59: [3.5] bpo-29571: Use correct locale encoding in te... Message-ID: <58a9202fbb551_187e3fc06b6f1c2c1683c7@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 760f596b6a4b5514afe35e521621f484aef35413 https://github.com/python/cpython/commit/760f596b6a4b5514afe35e521621f484aef35413 Author: Nick Coghlan Date: 2017-02-19 (Sun, 19 Feb 2017) Changed paths: M Lib/test/test_re.py M Misc/NEWS Log Message: ----------- [3.5] bpo-29571: Use correct locale encoding in test_re (#149) (#154) ``local.getlocale(locale.LC_CTYPE)`` and ``locale.getpreferredencoding(False)`` may give different answers in some cases (such as the ``en_IN`` locale). ``re.LOCALE`` uses the latter, so update the test case to match. From noreply at github.com Sun Feb 19 00:12:01 2017 From: noreply at github.com (GitHub) Date: Sat, 18 Feb 2017 21:12:01 -0800 Subject: [Python-checkins] [python/cpython] 3337d3: [backport to 3.6] bpo-29529: Add .travis.yml to 3.... Message-ID: <58a929213e608_287123fe0a145fc24145178@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 3337d33a4518f7ab8a7ab6c9a75b8b92ba348b27 https://github.com/python/cpython/commit/3337d33a4518f7ab8a7ab6c9a75b8b92ba348b27 Author: INADA Naoki Date: 2017-02-19 (Sun, 19 Feb 2017) Changed paths: A .travis.yml Log Message: ----------- [backport to 3.6] bpo-29529: Add .travis.yml to 3.6 branch (#25) * Add .travis.yml to 3.6 branch * Travis CI: run rstlint.py in the docs job (#68) Currently, http://buildbot.python.org/all/buildslaves/ware-docs buildbot is only run as post-commit. For example, bpo-29521 (PR#41) introduced two warnings, unnotified by the Travis CI docs job. Modify the docs job to run toosl/rstlint.py. Fix also the two minor warnings which causes the buildbot slave to fail. * Only run CI checks when appropriate files have changed (#74) Closes python/core-workflow#14 * Use 'make check' instead of 'python3 tools/rstlint.py' (#96) From noreply at github.com Sun Feb 19 00:13:03 2017 From: noreply at github.com (GitHub) Date: Sat, 18 Feb 2017 21:13:03 -0800 Subject: [Python-checkins] [python/cpython] 24bfe1: [backport to 3.5] bpo-29529: Add .travis.yml to 3.... Message-ID: <58a9295faeda1_1e263fb30ccedc3c14806f@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 24bfe15e83c24bf2c2e2654050da809553789002 https://github.com/python/cpython/commit/24bfe15e83c24bf2c2e2654050da809553789002 Author: INADA Naoki Date: 2017-02-19 (Sun, 19 Feb 2017) Changed paths: A .travis.yml Log Message: ----------- [backport to 3.5] bpo-29529: Add .travis.yml to 3.5 branch (#26) * Add .travis.yml to 3.5 branch * Only run CI checks when appropriate files have changed (#74) Closes python/core-workflow#14 * Travis CI: run rstlint.py in the docs job (#68) Currently, http://buildbot.python.org/all/buildslaves/ware-docs buildbot is only run as post-commit. For example, bpo-29521 (PR#41) introduced two warnings, unnotified by the Travis CI docs job. Modify the docs job to run toosl/rstlint.py. Fix also the two minor warnings which causes the buildbot slave to fail. * Use 'make check' instead of 'python3 tools/rstlint.py' (#96) From solipsis at pitrou.net Sun Feb 19 04:19:59 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 19 Feb 2017 09:19:59 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=0 Message-ID: <20170219091457.3614.70373.AD9CF532@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [0, 7, -7] memory blocks, sum=0 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [0, 0, -2] memory blocks, sum=-2 test_multiprocessing_spawn leaked [-1, 1, -2] memory blocks, sum=-2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogbz5LsB', '--timeout', '7200'] From noreply at github.com Sun Feb 19 06:40:56 2017 From: noreply at github.com (GitHub) Date: Sun, 19 Feb 2017 03:40:56 -0800 Subject: [Python-checkins] [python/cpython] b121d7: Tweak PEP 519 documentation in stdlib (#164) Message-ID: <58a98448b7c48_223203fa050133c30168932@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: b121d737fe60e56dac5a44535e02089c6c02613d https://github.com/python/cpython/commit/b121d737fe60e56dac5a44535e02089c6c02613d Author: Berker Peksag Date: 2017-02-19 (Sun, 19 Feb 2017) Changed paths: M Doc/library/lzma.rst M Doc/library/os.rst Log Message: ----------- Tweak PEP 519 documentation in stdlib (#164) * Drop duplicate word 'object' in lzma docs * Fix typo in os docs: fpr -> for (cherry picked from commit d4d48743ac20854de104e08dd66972471684f676) From noreply at github.com Sun Feb 19 12:07:34 2017 From: noreply at github.com (GitHub) Date: Sun, 19 Feb 2017 09:07:34 -0800 Subject: [Python-checkins] [python/cpython] 3eea8c: bpo-29520: doc: fix deprecation warning from 'defi... Message-ID: <58a9d0d61d94_147d3ff96e557c4021938d@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 3eea8c67fa870c6e2b7a521d292afe7fe3e95f58 https://github.com/python/cpython/commit/3eea8c67fa870c6e2b7a521d292afe7fe3e95f58 Author: INADA Naoki Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Doc/tools/templates/indexcontent.html Log Message: ----------- bpo-29520: doc: fix deprecation warning from 'defindex' template (GH-165) From noreply at github.com Sun Feb 19 14:32:53 2017 From: noreply at github.com (GitHub) Date: Sun, 19 Feb 2017 11:32:53 -0800 Subject: [Python-checkins] [python/cpython] 4bfb60: Remove redundant footnote (#181) Message-ID: <58a9f2e5c1ce_27d133fb7b1d25c2822689e@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/2.7 Home: https://github.com/python/cpython Commit: 4bfb6038102431df834a01453a89437647d19483 https://github.com/python/cpython/commit/4bfb6038102431df834a01453a89437647d19483 Author: Qingpeng "Q.P." Zhang Date: 2017-02-19 (Sun, 19 Feb 2017) Changed paths: M Doc/tutorial/datastructures.rst Log Message: ----------- Remove redundant footnote (#181) It was accidentally added in cc79837. From noreply at github.com Sun Feb 19 19:16:34 2017 From: noreply at github.com (GitHub) Date: Sun, 19 Feb 2017 16:16:34 -0800 Subject: [Python-checkins] [python/cpython] a86339: Fixed bpo-29565: Corrected ctypes passing of large... Message-ID: <58aa356281444_3a63fe987541c34132048@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: a86339b83fbd0932e0529a3c91935e997a234582 https://github.com/python/cpython/commit/a86339b83fbd0932e0529a3c91935e997a234582 Author: Vinay Sajip Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Lib/ctypes/test/test_callbacks.py M Lib/ctypes/test/test_structures.py M Modules/_ctypes/_ctypes_test.c M Modules/_ctypes/libffi_msvc/ffi.c Log Message: ----------- Fixed bpo-29565: Corrected ctypes passing of large structs by value on Windows AMD64. (#168) * Fixed bpo-29565: Corrected ctypes passing of large structs by value. Added code and test to check that when a structure passed by value is large enough to need to be passed by reference, a copy of the original structure is passed. The callee updates the passed-in value, and the test verifies that the caller's copy is unchanged. A similar change was also added to the test added for bpo-20160 (that test was passing, but the changes should guard against regressions). * Reverted unintended whitespace changes. From noreply at github.com Sun Feb 19 19:44:55 2017 From: noreply at github.com (GitHub) Date: Sun, 19 Feb 2017 16:44:55 -0800 Subject: [Python-checkins] [python/cpython] 98604c: bpo-29529: Add .travis.yml to 2.7 branch (GH-27) Message-ID: <58aa3c07a303_14393fcc9b983c382103e6@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/2.7 Home: https://github.com/python/cpython Commit: 98604c7683f41f04c633935bb582399c50db838c https://github.com/python/cpython/commit/98604c7683f41f04c633935bb582399c50db838c Author: INADA Naoki Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: A .travis.yml Log Message: ----------- bpo-29529: Add .travis.yml to 2.7 branch (GH-27) From noreply at github.com Sun Feb 19 19:45:57 2017 From: noreply at github.com (GitHub) Date: Sun, 19 Feb 2017 16:45:57 -0800 Subject: [Python-checkins] [python/cpython] cf44d9: bpo-29520: doc: fix deprecation warning from 'defi... Message-ID: <58aa3c454320f_c043ff2d1413c3822824d@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/2.7 Home: https://github.com/python/cpython Commit: cf44d957ec177be62f5349ef88515190dcfccbd6 https://github.com/python/cpython/commit/cf44d957ec177be62f5349ef88515190dcfccbd6 Author: INADA Naoki Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Doc/tools/templates/indexcontent.html Log Message: ----------- bpo-29520: doc: fix deprecation warning from 'defindex' template (GH-180) From noreply at github.com Sun Feb 19 19:46:26 2017 From: noreply at github.com (GitHub) Date: Sun, 19 Feb 2017 16:46:26 -0800 Subject: [Python-checkins] [python/cpython] f0174c: bpo-29520: doc: fix deprecation warning from 'defi... Message-ID: <58aa3c622ab0a_19b33fcf7e66fc3c124132@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: f0174c69b7b8bd27ee32d96e890d665da29472af https://github.com/python/cpython/commit/f0174c69b7b8bd27ee32d96e890d665da29472af Author: INADA Naoki Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Doc/tools/templates/indexcontent.html Log Message: ----------- bpo-29520: doc: fix deprecation warning from 'defindex' template (GH-179) From noreply at github.com Sun Feb 19 19:46:48 2017 From: noreply at github.com (GitHub) Date: Sun, 19 Feb 2017 16:46:48 -0800 Subject: [Python-checkins] [python/cpython] 7970cd: bpo-29520: doc: fix deprecation warning from 'defi... Message-ID: <58aa3c786fcee_28a983fe408379c3c10553f@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 7970cd483346dfd7723da214fb27399ecc574095 https://github.com/python/cpython/commit/7970cd483346dfd7723da214fb27399ecc574095 Author: INADA Naoki Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Doc/tools/templates/indexcontent.html Log Message: ----------- bpo-29520: doc: fix deprecation warning from 'defindex' template (GH-178) From noreply at github.com Sun Feb 19 20:22:30 2017 From: noreply at github.com (GitHub) Date: Sun, 19 Feb 2017 17:22:30 -0800 Subject: [Python-checkins] [python/cpython] e395c4: bpo-29520: doc: add missing dot (GH-182) Message-ID: <58aa44d6ec5b_a213fedd0d01c38127392@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: e395c4dbe19115aaab315c2a113b172e9fef307a https://github.com/python/cpython/commit/e395c4dbe19115aaab315c2a113b172e9fef307a Author: INADA Naoki Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Doc/tools/templates/indexcontent.html Log Message: ----------- bpo-29520: doc: add missing dot (GH-182) 3eea8c6 missed dot at the end of paragraph. From noreply at github.com Sun Feb 19 20:49:56 2017 From: noreply at github.com (GitHub) Date: Sun, 19 Feb 2017 17:49:56 -0800 Subject: [Python-checkins] [python/cpython] af9a40: [2.7] Change some mercurial/ hg.python.org referen... Message-ID: <58aa4b449a1c0_108e3f843992bc2c1732a6@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/2.7 Home: https://github.com/python/cpython Commit: af9a40d58c5992b60dc7f361d1b52720c1641cca https://github.com/python/cpython/commit/af9a40d58c5992b60dc7f361d1b52720c1641cca Author: Senthil Kumaran Date: 2017-02-19 (Sun, 19 Feb 2017) Changed paths: M Doc/faq/general.rst M Tools/README Log Message: ----------- [2.7] Change some mercurial/ hg.python.org references. (#8) (#183) (cherry picked from commit b2ee40ed9c9041dcff9c898aa19aacf9ec60308a) From noreply at github.com Sun Feb 19 21:58:21 2017 From: noreply at github.com (GitHub) Date: Sun, 19 Feb 2017 18:58:21 -0800 Subject: [Python-checkins] [python/cpython] 314a86: Change some mercurial/ hg.python.org references. (... Message-ID: <58aa5b4d7d19b_d883fbc8f27fc3c2253dc@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 314a86bae2ecc5e22bc874ad8a1bb71eb732dda6 https://github.com/python/cpython/commit/314a86bae2ecc5e22bc874ad8a1bb71eb732dda6 Author: Senthil Kumaran Date: 2017-02-19 (Sun, 19 Feb 2017) Changed paths: M Doc/faq/general.rst M Lib/idlelib/help.html M Tools/README M Tools/importbench/README Log Message: ----------- Change some mercurial/ hg.python.org references. (#8) (#184) (cherry picked from commit b2ee40ed9c9041dcff9c898aa19aacf9ec60308a) From noreply at github.com Sun Feb 19 21:58:34 2017 From: noreply at github.com (GitHub) Date: Sun, 19 Feb 2017 18:58:34 -0800 Subject: [Python-checkins] [python/cpython] a4afdf: Change some mercurial/ hg.python.org references. (... Message-ID: <58aa5b5acb873_f453f8a2a103c38161736@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: a4afdfcf27c2fa53c60b65867765244361abb1fc https://github.com/python/cpython/commit/a4afdfcf27c2fa53c60b65867765244361abb1fc Author: Senthil Kumaran Date: 2017-02-19 (Sun, 19 Feb 2017) Changed paths: M Doc/faq/general.rst M Lib/idlelib/help.html M Tools/README M Tools/importbench/README Log Message: ----------- Change some mercurial/ hg.python.org references. (#8) (#185) (cherry picked from commit b2ee40ed9c9041dcff9c898aa19aacf9ec60308a) From noreply at github.com Sun Feb 19 23:25:17 2017 From: noreply at github.com (GitHub) Date: Sun, 19 Feb 2017 20:25:17 -0800 Subject: [Python-checkins] [python/cpython] d0e821: bpo-29347: Fix possibly dereferencing undefined po... Message-ID: <58aa6fadce0b4_280603f8a1f95fc341703ae@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: d0e8212ed70445cc3d48b0d4ae7c9cb480004010 https://github.com/python/cpython/commit/d0e8212ed70445cc3d48b0d4ae7c9cb480004010 Author: Xiang Zhang Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Misc/NEWS M Objects/weakrefobject.c Log Message: ----------- bpo-29347: Fix possibly dereferencing undefined pointers when creating weakref objects (#128) From noreply at github.com Mon Feb 20 01:32:55 2017 From: noreply at github.com (GitHub) Date: Sun, 19 Feb 2017 22:32:55 -0800 Subject: [Python-checkins] [python/cpython] 7131a7: bpo-29347: Fix possibly dereferencing undefined po... Message-ID: <58aa8d9722701_6983faaab6cbc3c1719cf@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/2.7 Home: https://github.com/python/cpython Commit: 7131a73f9655cfd325c798385905326f57b94640 https://github.com/python/cpython/commit/7131a73f9655cfd325c798385905326f57b94640 Author: Xiang Zhang Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Misc/NEWS M Objects/weakrefobject.c Log Message: ----------- bpo-29347: Fix possibly dereferencing undefined pointers when creating weakref objects (#128) (#187) From noreply at github.com Mon Feb 20 01:33:04 2017 From: noreply at github.com (GitHub) Date: Sun, 19 Feb 2017 22:33:04 -0800 Subject: [Python-checkins] [python/cpython] 9a4577: bpo-29347: Fix possibly dereferencing undefined po... Message-ID: <58aa8da03cf77_27db83f8ed881dc3c21225@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 9a4577a4bb23888fed2cf192cf1a4c95ce5c26f8 https://github.com/python/cpython/commit/9a4577a4bb23888fed2cf192cf1a4c95ce5c26f8 Author: Xiang Zhang Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Misc/NEWS M Objects/weakrefobject.c Log Message: ----------- bpo-29347: Fix possibly dereferencing undefined pointers when creating weakref objects (#128) (#186) From noreply at github.com Mon Feb 20 01:33:07 2017 From: noreply at github.com (GitHub) Date: Sun, 19 Feb 2017 22:33:07 -0800 Subject: [Python-checkins] [python/cpython] 7c95a9: bpo-29347: Fix possibly dereferencing undefined po... Message-ID: <58aa8da387a77_27c953ff0d4a01c342262ac@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 7c95a94c3ab41e4296e94335d66b2400ad16f052 https://github.com/python/cpython/commit/7c95a94c3ab41e4296e94335d66b2400ad16f052 Author: Xiang Zhang Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Misc/NEWS M Objects/weakrefobject.c Log Message: ----------- bpo-29347: Fix possibly dereferencing undefined pointers when creating weakref objects (#128) (#188) From solipsis at pitrou.net Mon Feb 20 04:13:28 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 20 Feb 2017 09:13:28 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=5 Message-ID: <20170220091328.10409.21223.3DBDD612@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [7, -7, 1] 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/reflogbOv1Dq', '--timeout', '7200'] From noreply at github.com Mon Feb 20 06:29:31 2017 From: noreply at github.com (GitHub) Date: Mon, 20 Feb 2017 03:29:31 -0800 Subject: [Python-checkins] [python/cpython] 66fa9d: bpo-24274: fix comment in dictobject.c (GH-194) Message-ID: <58aad31bb0968_143b3fdda1f21c2813681d@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 66fa9d4205e0da672ed19a397069281a4b177af4 https://github.com/python/cpython/commit/66fa9d4205e0da672ed19a397069281a4b177af4 Author: INADA Naoki Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Objects/dictobject.c Log Message: ----------- bpo-24274: fix comment in dictobject.c (GH-194) From noreply at github.com Mon Feb 20 07:04:32 2017 From: noreply at github.com (GitHub) Date: Mon, 20 Feb 2017 04:04:32 -0800 Subject: [Python-checkins] [python/cpython] 9639e4: bpo-29532: Altering a kwarg dictionary passed to f... Message-ID: <58aadb504b29_8bb3fa6275d7c28166672@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 9639e4ab6d5bd3ca0ab34fef127e9fc84b6b88b9 https://github.com/python/cpython/commit/9639e4ab6d5bd3ca0ab34fef127e9fc84b6b88b9 Author: Serhiy Storchaka Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Lib/test/test_functools.py M Misc/NEWS M Modules/_functoolsmodule.c Log Message: ----------- bpo-29532: Altering a kwarg dictionary passed to functools.partial() (#190) no longer affects a partial object after creation. From noreply at github.com Mon Feb 20 08:09:01 2017 From: noreply at github.com (GitHub) Date: Mon, 20 Feb 2017 05:09:01 -0800 Subject: [Python-checkins] [python/cpython] c08668: README: OS X -> macOS (GH-55) Message-ID: <58aaea6d4daf5_1a973faaea33bc2c226516@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: c0866855d54bbbe7bcac299c4af45389efacce0b https://github.com/python/cpython/commit/c0866855d54bbbe7bcac299c4af45389efacce0b Author: Paul Schreiber Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M README.rst Log Message: ----------- README: OS X -> macOS (GH-55) From noreply at github.com Mon Feb 20 08:48:12 2017 From: noreply at github.com (GitHub) Date: Mon, 20 Feb 2017 05:48:12 -0800 Subject: [Python-checkins] [python/cpython] 1b8df1: bpo-24274: fix erroneous comment in dictobject.c (... Message-ID: <58aaf39c146c1_6d93f8cb307fc2c1367fd@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 1b8df107f867fb05ff39ebee7c55f0a907e7ad5f https://github.com/python/cpython/commit/1b8df107f867fb05ff39ebee7c55f0a907e7ad5f Author: INADA Naoki Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Objects/dictobject.c Log Message: ----------- bpo-24274: fix erroneous comment in dictobject.c (GH-196) lookdict_unicode() and lookdict_unicode_nodummy() may raise exception when key is not unicode. From noreply at github.com Mon Feb 20 08:58:13 2017 From: noreply at github.com (GitHub) Date: Mon, 20 Feb 2017 05:58:13 -0800 Subject: [Python-checkins] [python/cpython] ce552e: bpo-24274: fix erroneous comment in dictobject.c (... Message-ID: <58aaf5f5c138_18803fbaa6295c3419538b@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: ce552e2d5c4ff90218fb41847e8ffb1fd3ba3b2d https://github.com/python/cpython/commit/ce552e2d5c4ff90218fb41847e8ffb1fd3ba3b2d Author: INADA Naoki Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Objects/dictobject.c Log Message: ----------- bpo-24274: fix erroneous comment in dictobject.c (GH-200) lookdict_unicode() and lookdict_unicode_nodummy() may raise exception when key is not unicode. From noreply at github.com Mon Feb 20 15:28:17 2017 From: noreply at github.com (GitHub) Date: Mon, 20 Feb 2017 12:28:17 -0800 Subject: [Python-checkins] [python/cpython] 112ec3: bpo-29602: fix signed zero handling in complex con... Message-ID: <58ab51613e310_12773fdec32b9c38214287@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 112ec38c15b388fe025ccb85369a584d218b1160 https://github.com/python/cpython/commit/112ec38c15b388fe025ccb85369a584d218b1160 Author: Mark Dickinson Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Lib/test/test_complex.py M Misc/NEWS M Objects/complexobject.c Log Message: ----------- bpo-29602: fix signed zero handling in complex constructor. (#203) * Fix incorrect handling of signed zeros for complex-related classes. * Add Misc/NEWS entry. From noreply at github.com Mon Feb 20 15:57:56 2017 From: noreply at github.com (GitHub) Date: Mon, 20 Feb 2017 12:57:56 -0800 Subject: [Python-checkins] [python/cpython] 4ddd89: bpo-29602: fix signed zero handling in complex con... Message-ID: <58ab5854b6168_11173fb54e3afc44155968@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/bpo-29549-backport Home: https://github.com/python/cpython Commit: 4ddd89780fdb823f427c743ea7326a3c958a2f4b https://github.com/python/cpython/commit/4ddd89780fdb823f427c743ea7326a3c958a2f4b Author: Mark Dickinson Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Lib/test/test_complex.py M Misc/NEWS M Objects/complexobject.c Log Message: ----------- bpo-29602: fix signed zero handling in complex constructor Commit: 23e14d6763cec97c2fd6384df0820dfa2f4e461a https://github.com/python/cpython/commit/23e14d6763cec97c2fd6384df0820dfa2f4e461a Author: Mark Dickinson Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Lib/test/test_complex.py Log Message: ----------- Add missing have_getformat definition; remove use of unittest subtests. Compare: https://github.com/python/cpython/compare/4ddd89780fdb^...23e14d6763ce From noreply at github.com Mon Feb 20 16:14:54 2017 From: noreply at github.com (GitHub) Date: Mon, 20 Feb 2017 13:14:54 -0800 Subject: [Python-checkins] [python/cpython] c0b336: bpo-29602: fix signed zero handling in complex con... Message-ID: <58ab5c4e5f6fb_19b33fcf7e66fc3c1333fc@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/2.7 Home: https://github.com/python/cpython Commit: c0b336e0ada74b1242b9ef10c19eb87b0a21d106 https://github.com/python/cpython/commit/c0b336e0ada74b1242b9ef10c19eb87b0a21d106 Author: Mark Dickinson Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Lib/test/test_complex.py M Misc/NEWS M Objects/complexobject.c Log Message: ----------- bpo-29602: fix signed zero handling in complex constructor (#204) * bpo-29602: fix signed zero handling in complex constructor * Add missing have_getformat definition; remove use of unittest subtests. From noreply at github.com Mon Feb 20 16:14:56 2017 From: noreply at github.com (GitHub) Date: Mon, 20 Feb 2017 13:14:56 -0800 Subject: [Python-checkins] [python/cpython] Message-ID: <58ab5c5048441_10413ffac6599c40199232@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/bpo-29549-backport Home: https://github.com/python/cpython From noreply at github.com Mon Feb 20 16:50:51 2017 From: noreply at github.com (GitHub) Date: Mon, 20 Feb 2017 13:50:51 -0800 Subject: [Python-checkins] [python/cpython] 0936a0: bpo-29602: fix signed zero handling in complex con... Message-ID: <58ab64bbbbb9_1dce3fe5217a7c2c144678@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 0936a00fe035e3e52c30bcbc59668dc0f519ced6 https://github.com/python/cpython/commit/0936a00fe035e3e52c30bcbc59668dc0f519ced6 Author: Mark Dickinson Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Lib/test/test_complex.py M Misc/NEWS M Objects/complexobject.c Log Message: ----------- bpo-29602: fix signed zero handling in complex constructor. (#203) (#205) * Fix incorrect handling of signed zeros for complex-related classes. * Add Misc/NEWS entry. (cherry picked from commit 112ec38c15b388fe025ccb85369a584d218b1160) From noreply at github.com Mon Feb 20 16:59:31 2017 From: noreply at github.com (GitHub) Date: Mon, 20 Feb 2017 13:59:31 -0800 Subject: [Python-checkins] [python/cpython] d9b3cd: bpo-29602: fix signed zero handling in complex con... Message-ID: <58ab66c387b42_6853f8def849c2c1501bd@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: d9b3cdd137239a5913de2252c3ce269e35ac63d2 https://github.com/python/cpython/commit/d9b3cdd137239a5913de2252c3ce269e35ac63d2 Author: Mark Dickinson Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Lib/test/test_complex.py M Misc/NEWS M Objects/complexobject.c Log Message: ----------- bpo-29602: fix signed zero handling in complex constructor. (#203) (#206) * Fix incorrect handling of signed zeros for complex-related classes. * Add Misc/NEWS entry. (cherry picked from commit 112ec38c15b388fe025ccb85369a584d218b1160) From noreply at github.com Tue Feb 21 00:30:02 2017 From: noreply at github.com (GitHub) Date: Mon, 20 Feb 2017 21:30:02 -0800 Subject: [Python-checkins] [python/cpython] 8fb1f6: bpo-29554: Improve docs for pstat module and profi... Message-ID: <58abd05a1c093_20eb3fa7e14f1c303386c2@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 8fb1f6e039cbdeb333d83b7a62f0f37af4ce6e02 https://github.com/python/cpython/commit/8fb1f6e039cbdeb333d83b7a62f0f37af4ce6e02 Author: Matthias Bussonnier Date: 2017-02-21 (Tue, 21 Feb 2017) Changed paths: M Doc/library/profile.rst M Lib/pstats.py Log Message: ----------- bpo-29554: Improve docs for pstat module and profile. (#88) Clarify that methods take a string which is interpreted as a regex, not a regex object. Also clarify what the old `-1`, `0`, `1` and `2` options were. From noreply at github.com Tue Feb 21 01:20:25 2017 From: noreply at github.com (GitHub) Date: Mon, 20 Feb 2017 22:20:25 -0800 Subject: [Python-checkins] [python/cpython] 32e8f9: bpo-29453: Remove reference to undefined dictionar... Message-ID: <58abdc2920603_d813fa43018fc2c27321b@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 32e8f9bdfd4324f1aa4fbbdf1ed8536f2b00cabb https://github.com/python/cpython/commit/32e8f9bdfd4324f1aa4fbbdf1ed8536f2b00cabb Author: Jim Fasarakis-Hilliard Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Doc/tutorial/controlflow.rst Log Message: ----------- bpo-29453: Remove reference to undefined dictionary ordering in Tutorial (GH-140) As of Python 3.6 **kwargs are ordered, thus, remove the paragraph stating that ordering is undefined and change snippet to remove the unecessary sorted call. * Add sentence mentioning guaranteed output order of kwargs From noreply at github.com Tue Feb 21 02:43:16 2017 From: noreply at github.com (GitHub) Date: Mon, 20 Feb 2017 23:43:16 -0800 Subject: [Python-checkins] [python/cpython] d9a757: reinit the TLS before anything else (#130) Message-ID: <58abef94840ec_253d3fcd4633bc4420891a@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/2.7 Home: https://github.com/python/cpython Commit: d9a75744eeaa882e6203cdb864289a6534ac86c8 https://github.com/python/cpython/commit/d9a75744eeaa882e6203cdb864289a6534ac86c8 Author: Benjamin Peterson Date: 2017-02-20 (Mon, 20 Feb 2017) Changed paths: M Parser/intrcheck.c Log Message: ----------- reinit the TLS before anything else (#130) PyEval_ReInitThread can run arbitrary Python code, which really ought to have the TLS initialized. From noreply at github.com Tue Feb 21 02:53:11 2017 From: noreply at github.com (GitHub) Date: Mon, 20 Feb 2017 23:53:11 -0800 Subject: [Python-checkins] [python/cpython] Message-ID: <58abf1e7cf60f_1e1f3fc796027c34189276@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/benjamin-reinit-tls Home: https://github.com/python/cpython From solipsis at pitrou.net Tue Feb 21 04:08:33 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 21 Feb 2017 09:08:33 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=4 Message-ID: <20170221090833.89615.28412.B638F100@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [0, 7, -7] 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/reflogjSMSyP', '--timeout', '7200'] From noreply at github.com Tue Feb 21 04:17:08 2017 From: noreply at github.com (GitHub) Date: Tue, 21 Feb 2017 01:17:08 -0800 Subject: [Python-checkins] [python/cpython] 3f3d03: Reduce conflict on Misc/NEWS (GH-212) Message-ID: <58ac0594c876f_1c733f8eb9571c3c1874d6@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 3f3d0364a91aa8b89e175a49f93ad04dd4676186 https://github.com/python/cpython/commit/3f3d0364a91aa8b89e175a49f93ad04dd4676186 Author: INADA Naoki Date: 2017-02-21 (Tue, 21 Feb 2017) Changed paths: A .gitattribute Log Message: ----------- Reduce conflict on Misc/NEWS (GH-212) use "union" merge strategy for Misc/NEWS. From noreply at github.com Tue Feb 21 04:39:42 2017 From: noreply at github.com (GitHub) Date: Tue, 21 Feb 2017 01:39:42 -0800 Subject: [Python-checkins] [python/cpython] 2c700a: .gitattribute -> .gitattributes (GH-213) Message-ID: <58ac0aded3861_6c23fa5aa453c30187338@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 2c700af5a761f83f303cc7295b660ac31f7d4ed1 https://github.com/python/cpython/commit/2c700af5a761f83f303cc7295b660ac31f7d4ed1 Author: INADA Naoki Date: 2017-02-21 (Tue, 21 Feb 2017) Changed paths: R .gitattribute A .gitattributes Log Message: ----------- .gitattribute -> .gitattributes (GH-213) From noreply at github.com Tue Feb 21 07:12:04 2017 From: noreply at github.com (GitHub) Date: Tue, 21 Feb 2017 04:12:04 -0800 Subject: [Python-checkins] [python/cpython] 9436bb: bpo-29165: doc: make extending/newtypes more Pytho... Message-ID: <58ac2e94d57d6_1c773fe8018fdc38164132@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/2.7 Home: https://github.com/python/cpython Commit: 9436bbd87b7eed18dec4c32f25b88452fe282e1c https://github.com/python/cpython/commit/9436bbd87b7eed18dec4c32f25b88452fe282e1c Author: INADA Naoki Date: 2017-02-21 (Tue, 21 Feb 2017) Changed paths: M Doc/extending/newtypes.rst M Doc/includes/noddy.c M Doc/includes/noddy2.c M Doc/includes/noddy3.c M Doc/includes/noddy4.c M Doc/includes/setup.py M Doc/includes/shoddy.c Log Message: ----------- bpo-29165: doc: make extending/newtypes more Python 3 friendly (GH-211) * Use PyVarObject_HEAD_INIT instead of PyObject_HEAD_INIT on type struct header. * Backport many minor fixes from Python 3 doc to minimize diff. From noreply at github.com Tue Feb 21 07:51:48 2017 From: noreply at github.com (GitHub) Date: Tue, 21 Feb 2017 04:51:48 -0800 Subject: [Python-checkins] [python/cpython] fb8fe7: doc: fix compile error on "shoddy" example extensi... Message-ID: <58ac37e42483_3b6f3fd5b5901c242623ee@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: fb8fe72fc593438f6a0b934c6ff2d9c4aa28673d https://github.com/python/cpython/commit/fb8fe72fc593438f6a0b934c6ff2d9c4aa28673d Author: INADA Naoki Date: 2017-02-21 (Tue, 21 Feb 2017) Changed paths: M Doc/includes/setup.py M Doc/includes/shoddy.c Log Message: ----------- doc: fix compile error on "shoddy" example extension (GH-215) From noreply at github.com Tue Feb 21 08:25:23 2017 From: noreply at github.com (GitHub) Date: Tue, 21 Feb 2017 05:25:23 -0800 Subject: [Python-checkins] [python/cpython] 3a9ac8: bpo-29607: Fix stack_effect computation for CALL_F... Message-ID: <58ac3fc381185_20eb3fa7e14f1c3035183b@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 3a9ac827c7c87dffc60c4200323948551bcb6662 https://github.com/python/cpython/commit/3a9ac827c7c87dffc60c4200323948551bcb6662 Author: Matthieu Dartiailh Date: 2017-02-21 (Tue, 21 Feb 2017) Changed paths: M Misc/NEWS M Python/compile.c Log Message: ----------- bpo-29607: Fix stack_effect computation for CALL_FUNCTION_EX (#202) From noreply at github.com Tue Feb 21 09:55:51 2017 From: noreply at github.com (GitHub) Date: Tue, 21 Feb 2017 06:55:51 -0800 Subject: [Python-checkins] [python/cpython] 9ab8ea: doc: fix compile error on "shoddy" example extensi... Message-ID: <58ac54f778cc6_17563fa17d253c401363e2@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 9ab8eaf965cc75dfd6dbb195c77f9d2c1f33505f https://github.com/python/cpython/commit/9ab8eaf965cc75dfd6dbb195c77f9d2c1f33505f Author: INADA Naoki Date: 2017-02-21 (Tue, 21 Feb 2017) Changed paths: M Doc/includes/setup.py M Doc/includes/shoddy.c Log Message: ----------- doc: fix compile error on "shoddy" example extension (GH-217) (cherry picked from commit fb8fe72fc593438f6a0b934c6ff2d9c4aa28673d) From noreply at github.com Tue Feb 21 09:56:28 2017 From: noreply at github.com (GitHub) Date: Tue, 21 Feb 2017 06:56:28 -0800 Subject: [Python-checkins] [python/cpython] 51a477: doc: fix compile error on "shoddy" example extensi... Message-ID: <58ac551c4aca3_277d3fe82fc31c3c2202a4@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 51a477c0d53b09d5e876c23288ad006ad64c1e97 https://github.com/python/cpython/commit/51a477c0d53b09d5e876c23288ad006ad64c1e97 Author: INADA Naoki Date: 2017-02-21 (Tue, 21 Feb 2017) Changed paths: M Doc/includes/setup.py M Doc/includes/shoddy.c Log Message: ----------- doc: fix compile error on "shoddy" example extension (GH-216) (cherry picked from commit fb8fe72fc593438f6a0b934c6ff2d9c4aa28673d) From noreply at github.com Tue Feb 21 09:57:27 2017 From: noreply at github.com (GitHub) Date: Tue, 21 Feb 2017 06:57:27 -0800 Subject: [Python-checkins] [python/cpython] 3e8d6c: bpo-29509: skip redundant intern (GH-197) Message-ID: <58ac555749bd0_69c3fedf8ce3c38253571@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 3e8d6cb1892377394e4b11819c33fbac728ea9e0 https://github.com/python/cpython/commit/3e8d6cb1892377394e4b11819c33fbac728ea9e0 Author: INADA Naoki Date: 2017-02-21 (Tue, 21 Feb 2017) Changed paths: M Objects/object.c Log Message: ----------- bpo-29509: skip redundant intern (GH-197) PyObject_GetAttrString intern temporary key string. It's completely redudant. From noreply at github.com Tue Feb 21 11:18:30 2017 From: noreply at github.com (GitHub) Date: Tue, 21 Feb 2017 08:18:30 -0800 Subject: [Python-checkins] [python/cpython] e48fd9: bpo-29532: Altering a kwarg dictionary passed to f... Message-ID: <58ac68566b4ac_21ac3fbfc9b27c44206970@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: e48fd93bbb36c6d80aa4eb6af09f58c69d8cf965 https://github.com/python/cpython/commit/e48fd93bbb36c6d80aa4eb6af09f58c69d8cf965 Author: Serhiy Storchaka Date: 2017-02-21 (Tue, 21 Feb 2017) Changed paths: M Lib/test/test_functools.py M Misc/NEWS M Modules/_functoolsmodule.c Log Message: ----------- bpo-29532: Altering a kwarg dictionary passed to functools.partial() no longer affects a partial object after creation. (#209) From noreply at github.com Tue Feb 21 12:33:26 2017 From: noreply at github.com (GitHub) Date: Tue, 21 Feb 2017 09:33:26 -0800 Subject: [Python-checkins] [python/cpython] 3ab24b: bpo-29607: Fix stack_effect computation for CALL_F... Message-ID: <58ac79e63e9f1_d883fbc8f27fc3c272911@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 3ab24bdd47fdd9d45719ad49f93d3878d4442d7e https://github.com/python/cpython/commit/3ab24bdd47fdd9d45719ad49f93d3878d4442d7e Author: INADA Naoki Date: 2017-02-22 (Wed, 22 Feb 2017) Changed paths: M Misc/NEWS M Python/compile.c Log Message: ----------- bpo-29607: Fix stack_effect computation for CALL_FUNCTION_EX (GH-219) (cherry picked from commit 3a9ac827c7c87dffc60c4200323948551bcb6662) From noreply at github.com Tue Feb 21 13:30:09 2017 From: noreply at github.com (GitHub) Date: Tue, 21 Feb 2017 10:30:09 -0800 Subject: [Python-checkins] [python/cpython] 9b4913: bpo-29453: Remove reference to undefined dictionar... Message-ID: <58ac87318cfe0_20eb3fa7e14f1c30361667@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 9b49133082ec23b67e84d2589e66d7810018e424 https://github.com/python/cpython/commit/9b49133082ec23b67e84d2589e66d7810018e424 Author: Mariatta Date: 2017-02-21 (Tue, 21 Feb 2017) Changed paths: M Doc/tutorial/controlflow.rst Log Message: ----------- bpo-29453: Remove reference to undefined dictionary ordering in Tutorial (GH-140) (#208) As of Python 3.6 **kwargs are ordered, thus, remove the paragraph stating that ordering is undefined and change snippet to remove the unecessary sorted call. * Add sentence mentioning guaranteed output order of kwargs (cherry picked from commit 32e8f9bdfd4324f1aa4fbbdf1ed8536f2b00cabb) From noreply at github.com Tue Feb 21 14:56:09 2017 From: noreply at github.com (GitHub) Date: Tue, 21 Feb 2017 11:56:09 -0800 Subject: [Python-checkins] [python/cpython] e9c0e5: [3.6] Add .codecov.yml (#210) Message-ID: <58ac9b59b603_6e73fda3f39bc381286fb@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: e9c0e5559bbadb164d7c57b5a47b5544746dcb89 https://github.com/python/cpython/commit/e9c0e5559bbadb164d7c57b5a47b5544746dcb89 Author: Berker Peksag Date: 2017-02-21 (Tue, 21 Feb 2017) Changed paths: A .codecov.yml Log Message: ----------- [3.6] Add .codecov.yml (#210) From lp_benchmark_robot at intel.com Tue Feb 21 20:03:47 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 21 Feb 2017 17:03:47 -0800 Subject: [Python-checkins] NEUTRAL Benchmark Results for Python 2.7 2017-02-22 Message-ID: <6e64c8a3-eda2-4148-badc-02f9afecf686@orsmsx152.amr.corp.intel.com> No new revisions. Here are the previous results: Results for project Python 2.7, build date 2017-02-22 01:25:19 +0000 commit: 54c93e0fe79b previous commit: b07d454e45a2 revision date: 2017-02-10 13:14:04 +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.16% 3.95% 9.48% :-) pybench 0.17% -0.05% 7.61% 4.20% :-| regex_v8 0.55% 0.05% -0.10% 10.60% :-) nbody 0.13% -0.07% 11.86% 4.16% :-| json_dump_v2 0.29% -0.17% 0.33% 11.93% :-| normal_startup 1.70% 0.81% -1.93% 1.91% :-| ssbench 0.15% -0.28% -0.09% 2.95% ---------------------------------------------------------------------------------- * 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-2017-02-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 lp_benchmark_robot at intel.com Tue Feb 21 20:07:26 2017 From: lp_benchmark_robot at intel.com (lp_benchmark_robot at intel.com) Date: Tue, 21 Feb 2017 17:07:26 -0800 Subject: [Python-checkins] BAD Benchmark Results for Python Default 2017-02-22 Message-ID: <68e3ae19-3f79-4ba3-8dc5-ac20f836ad51@orsmsx152.amr.corp.intel.com> No new revisions. Here are the previous results: Results for project Python default, build date 2017-02-22 01:22:40 +0000 commit: 4243df51fe43 previous commit: e5cd74868dfc revision date: 2017-02-10 13:19:36 +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% -1.13% 7.97% 18.54% :-) pybench 0.21% -0.00% 4.34% 4.75% :-| regex_v8 3.69% -0.00% 1.84% 3.58% :-| nbody 0.16% -0.10% 0.56% 3.59% :-) json_dump_v2 0.28% 0.58% 11.20% 8.29% :-| normal_startup 0.92% -0.02% 0.71% 6.40% ---------------------------------------------------------------------------------- * 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-2017-02-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 noreply at github.com Tue Feb 21 20:55:04 2017 From: noreply at github.com (GitHub) Date: Tue, 21 Feb 2017 17:55:04 -0800 Subject: [Python-checkins] [python/cpython] 6336f0: bpo-29554: Improve docs for pstat module and profi... Message-ID: <58acef78afae0_28dcd3ff9796d3c302105fc@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 6336f0d156feec0f109a8d01da108cf96e3d9c60 https://github.com/python/cpython/commit/6336f0d156feec0f109a8d01da108cf96e3d9c60 Author: Berker Peksag Date: 2017-02-22 (Wed, 22 Feb 2017) Changed paths: M Doc/library/profile.rst M Lib/pstats.py Log Message: ----------- bpo-29554: Improve docs for pstat module and profile. (#88) (#228) Clarify that methods take a string which is interpreted as a regex, not a regex object. Also clarify what the old `-1`, `0`, `1` and `2` options were. (cherry picked from commit 8fb1f6e039cbdeb333d83b7a62f0f37af4ce6e02) From noreply at github.com Tue Feb 21 20:55:34 2017 From: noreply at github.com (GitHub) Date: Tue, 21 Feb 2017 17:55:34 -0800 Subject: [Python-checkins] [python/cpython] b067a5: bpo-29554: Improve docs for pstat module and profi... Message-ID: <58acef96b76ba_11bd3f8549141c30188369@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: b067a5eef7fdf69264d3578654996fc3755df4ea https://github.com/python/cpython/commit/b067a5eef7fdf69264d3578654996fc3755df4ea Author: Berker Peksag Date: 2017-02-22 (Wed, 22 Feb 2017) Changed paths: M Doc/library/profile.rst M Lib/pstats.py Log Message: ----------- bpo-29554: Improve docs for pstat module and profile. (#88) (#227) Clarify that methods take a string which is interpreted as a regex, not a regex object. Also clarify what the old `-1`, `0`, `1` and `2` options were. (cherry picked from commit 8fb1f6e039cbdeb333d83b7a62f0f37af4ce6e02) From noreply at github.com Tue Feb 21 23:32:31 2017 From: noreply at github.com (GitHub) Date: Tue, 21 Feb 2017 20:32:31 -0800 Subject: [Python-checkins] [python/cpython] 4cee04: bpo-27660: remove unnecessary overflow checks in l... Message-ID: <58ad145feb636_1e263fb30ccedc3c1852ee@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 4cee049f5b6864066b8315e9b54de955e5487dfc https://github.com/python/cpython/commit/4cee049f5b6864066b8315e9b54de955e5487dfc Author: Xiang Zhang Date: 2017-02-22 (Wed, 22 Feb 2017) Changed paths: M Objects/listobject.c Log Message: ----------- bpo-27660: remove unnecessary overflow checks in list_resize (GH-189) From noreply at github.com Wed Feb 22 00:02:18 2017 From: noreply at github.com (GitHub) Date: Tue, 21 Feb 2017 21:02:18 -0800 Subject: [Python-checkins] [python/cpython] f802fa: Add .codecov.yml (#210) (#229) Message-ID: <58ad1b5a8c768_13bd3fbd85ed7c4014973d@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: f802facf5605b0b88e3735456442a74055c2431b https://github.com/python/cpython/commit/f802facf5605b0b88e3735456442a74055c2431b Author: Berker Peksag Date: 2017-02-22 (Wed, 22 Feb 2017) Changed paths: A .codecov.yml Log Message: ----------- Add .codecov.yml (#210) (#229) (cherry picked from commit e9c0e5559bbadb164d7c57b5a47b5544746dcb89) From noreply at github.com Wed Feb 22 00:45:52 2017 From: noreply at github.com (GitHub) Date: Tue, 21 Feb 2017 21:45:52 -0800 Subject: [Python-checkins] [python/cpython] 0899b9: bpo-28814: Undeprecate inadvertently deprecated in... Message-ID: <58ad2590e5f97_15e13f9f56435c30164274@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 0899b9809547ec2894dcf88cf4bba732c5d47d0d https://github.com/python/cpython/commit/0899b9809547ec2894dcf88cf4bba732c5d47d0d Author: Matthias Bussonnier Date: 2017-02-22 (Wed, 22 Feb 2017) Changed paths: M Doc/library/inspect.rst M Doc/whatsnew/3.5.rst Log Message: ----------- bpo-28814: Undeprecate inadvertently deprecated inspect functions. (#122) Nick Coghlan said on bpo-28814: > inspect.getargvalues() and inspect.formatargvalues() were deprecated > in Python 3.5 as part of implementing bpo-20438 > This is incorrect, as these are *frame* introspection related functions, > not callable introspection ones. The documentation and implementation > layout is confusing though, as they're interleaved with the callable > introspection operation This commit undeprecates these functions and adds a note to ignore previous deprecation notices. From noreply at github.com Wed Feb 22 01:19:57 2017 From: noreply at github.com (GitHub) Date: Tue, 21 Feb 2017 22:19:57 -0800 Subject: [Python-checkins] [python/cpython] 8fa7e2: Fixed bpo-29565: Corrected ctypes passing of large... Message-ID: <58ad2d8d381a4_1e1f3fc796027c342090ee@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 8fa7e22134ac9626b2188ff877f6aeecd3c9e618 https://github.com/python/cpython/commit/8fa7e22134ac9626b2188ff877f6aeecd3c9e618 Author: Vinay Sajip Date: 2017-02-22 (Wed, 22 Feb 2017) Changed paths: M Lib/ctypes/test/test_callbacks.py M Lib/ctypes/test/test_structures.py M Modules/_ctypes/_ctypes_test.c M Modules/_ctypes/libffi_msvc/ffi.c Log Message: ----------- Fixed bpo-29565: Corrected ctypes passing of large structs by value on Windows AMD64. (#168) (#221) Fixed bpo-29565: Corrected ctypes passing of large structs by value. (cherry picked from commit a86339b83fbd0932e0529a3c91935e997a234582) From noreply at github.com Wed Feb 22 01:21:19 2017 From: noreply at github.com (GitHub) Date: Tue, 21 Feb 2017 22:21:19 -0800 Subject: [Python-checkins] [python/cpython] 3cc581: Fixed bpo-29565: Corrected ctypes passing of large... Message-ID: <58ad2ddf2406d_112b3fb83d48bc34225671@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 3cc5817cfaf5663645f4ee447eaed603d2ad290a https://github.com/python/cpython/commit/3cc5817cfaf5663645f4ee447eaed603d2ad290a Author: Vinay Sajip Date: 2017-02-22 (Wed, 22 Feb 2017) Changed paths: M Lib/ctypes/test/test_callbacks.py M Lib/ctypes/test/test_structures.py M Modules/_ctypes/_ctypes_test.c M Modules/_ctypes/libffi_msvc/ffi.c Log Message: ----------- Fixed bpo-29565: Corrected ctypes passing of large structs by value on Windows AMD64. (#168) (#220) Fixed bpo-29565: Corrected ctypes passing of large structs by value. (cherry picked from commit a86339b83fbd0932e0529a3c91935e997a234582) From noreply at github.com Wed Feb 22 02:23:32 2017 From: noreply at github.com (GitHub) Date: Tue, 21 Feb 2017 23:23:32 -0800 Subject: [Python-checkins] [python/cpython] 03f68b: bpo-29110: Fix file object leak in `aifc.open` whe... Message-ID: <58ad3c747112b_19e3fd9bf831c3c181983@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 03f68b60e17b57f6f13729ff73245dbb37b30a4c https://github.com/python/cpython/commit/03f68b60e17b57f6f13729ff73245dbb37b30a4c Author: Anthony Zhang Date: 2017-02-22 (Wed, 22 Feb 2017) Changed paths: M Lib/aifc.py M Lib/test/test_aifc.py M Misc/NEWS Log Message: ----------- bpo-29110: Fix file object leak in `aifc.open` when given invalid AIFF file. (GH-162) From noreply at github.com Wed Feb 22 02:37:38 2017 From: noreply at github.com (GitHub) Date: Tue, 21 Feb 2017 23:37:38 -0800 Subject: [Python-checkins] [python/cpython] 0e7561: mark various test data binary Message-ID: <58ad3fc27cd42_1a903fc403bc7c3823691d@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/benjamin-binary-test-data Home: https://github.com/python/cpython Commit: 0e7561d1c7dcbd6f7ebadff7f62646a592227467 https://github.com/python/cpython/commit/0e7561d1c7dcbd6f7ebadff7f62646a592227467 Author: Benjamin Peterson Date: 2017-02-21 (Tue, 21 Feb 2017) Changed paths: M .gitattributes Log Message: ----------- mark various test data binary From solipsis at pitrou.net Wed Feb 22 04:13:13 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Wed, 22 Feb 2017 09:13:13 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=5 Message-ID: <20170222091312.3780.46873.225586E1@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_fork leaked [-2, 2, 0] memory blocks, sum=0 test_multiprocessing_forkserver leaked [-1, 2, 0] memory blocks, sum=1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogB2zMFJ', '--timeout', '7200'] From noreply at github.com Wed Feb 22 04:46:34 2017 From: noreply at github.com (GitHub) Date: Wed, 22 Feb 2017 01:46:34 -0800 Subject: [Python-checkins] [python/cpython] 5010a7: [3.5] bpo-29532: Altering a kwarg dictionary passe... Message-ID: <58ad5dfa92141_10893fc8713c3c2c22273d@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 5010a77a4da76d8d3fd861a63a7f1ce8f0e9c520 https://github.com/python/cpython/commit/5010a77a4da76d8d3fd861a63a7f1ce8f0e9c520 Author: Serhiy Storchaka Date: 2017-02-22 (Wed, 22 Feb 2017) Changed paths: M Lib/test/test_functools.py M Misc/NEWS M Modules/_functoolsmodule.c Log Message: ----------- [3.5] bpo-29532: Altering a kwarg dictionary passed to functools.partial() no longer affects a partial object after creation. (#222) From noreply at github.com Wed Feb 22 06:12:02 2017 From: noreply at github.com (GitHub) Date: Wed, 22 Feb 2017 03:12:02 -0800 Subject: [Python-checkins] [python/cpython] d37c06: Add sockaddr_alg to sock_addr_t (#234) Message-ID: <58ad720249efe_28e893fc4f81d7c3c31944a@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: d37c068e695f8ec72b5c1b5a5a5ece2337fda768 https://github.com/python/cpython/commit/d37c068e695f8ec72b5c1b5a5a5ece2337fda768 Author: Christian Heimes Date: 2017-02-22 (Wed, 22 Feb 2017) Changed paths: M Modules/socketmodule.c M Modules/socketmodule.h Log Message: ----------- Add sockaddr_alg to sock_addr_t (#234) sock_addr_t is used to define the minimum size of any socket address on the stack. Let's make sure that an AF_ALG address always fits. Coverity complains because in theory, AF_ALG might be larger than any of the other structs. In practice it already fits. Closes Coverity CID 1398948, 1398949, 1398950 Signed-off-by: Christian Heimes From noreply at github.com Wed Feb 22 10:06:52 2017 From: noreply at github.com (GitHub) Date: Wed, 22 Feb 2017 07:06:52 -0800 Subject: [Python-checkins] [python/cpython] 1bc156: bpo-29546: Improve from-import error message with ... Message-ID: <58ada90c48511_7df53fac2c5a3c381098ed@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 1bc156430bad8177b5beecf57979628c1d071230 https://github.com/python/cpython/commit/1bc156430bad8177b5beecf57979628c1d071230 Author: Matthias Bussonnier Date: 2017-02-22 (Wed, 22 Feb 2017) Changed paths: M Doc/whatsnew/3.7.rst M Lib/test/test_import/__init__.py M Misc/NEWS M Python/ceval.c Log Message: ----------- bpo-29546: Improve from-import error message with location (#103) bpo-29546: Improve from-import error message with location From noreply at github.com Wed Feb 22 10:32:01 2017 From: noreply at github.com (GitHub) Date: Wed, 22 Feb 2017 07:32:01 -0800 Subject: [Python-checkins] [python/cpython] cb41b2: bpo-29463: Add docstring field to some AST nodes. ... Message-ID: <58adaef158fc4_17763fcde4001c2427129e@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: cb41b2766de646435743b6af7dd152751b54e73f https://github.com/python/cpython/commit/cb41b2766de646435743b6af7dd152751b54e73f Author: INADA Naoki Date: 2017-02-22 (Wed, 22 Feb 2017) Changed paths: M Doc/library/ast.rst M Doc/whatsnew/3.7.rst M Include/Python-ast.h M Lib/ast.py M Lib/test/test_ast.py M Lib/test/test_opcodes.py M Misc/NEWS M Parser/Python.asdl M Python/Python-ast.c M Python/ast.c M Python/compile.c M Python/future.c M Python/importlib.h M Python/importlib_external.h M Tools/parser/unparse.py Log Message: ----------- bpo-29463: Add docstring field to some AST nodes. (#46) * bpo-29463: Add docstring field to some AST nodes. ClassDef, ModuleDef, FunctionDef, and AsyncFunctionDef has docstring field for now. It was first statement of there body. * fix document. thanks travis! * doc fixes From noreply at github.com Thu Feb 23 01:38:50 2017 From: noreply at github.com (GitHub) Date: Wed, 22 Feb 2017 22:38:50 -0800 Subject: [Python-checkins] [python/cpython] 277130: mark various test data binary (#233) Message-ID: <58ae837aeeff_16ee3fa0530f5c3412584b@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 2771304357607aa62801a67acc1e3c7c8ec489ce https://github.com/python/cpython/commit/2771304357607aa62801a67acc1e3c7c8ec489ce Author: Benjamin Peterson Date: 2017-02-22 (Wed, 22 Feb 2017) Changed paths: M .gitattributes Log Message: ----------- mark various test data binary (#233) From noreply at github.com Thu Feb 23 01:38:53 2017 From: noreply at github.com (GitHub) Date: Wed, 22 Feb 2017 22:38:53 -0800 Subject: [Python-checkins] [python/cpython] Message-ID: <58ae837dc6917_2b13fbb12555c3c2319f0@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/benjamin-binary-test-data Home: https://github.com/python/cpython From solipsis at pitrou.net Thu Feb 23 04:09:11 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Thu, 23 Feb 2017 09:09:11 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=-5 Message-ID: <20170223090911.30608.78170.9A20551A@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [-7, 1, 0] memory blocks, sum=-6 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_fork leaked [1, 0, -2] memory blocks, sum=-1 test_multiprocessing_spawn leaked [0, 0, -2] memory blocks, sum=-2 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogRetbBK', '--timeout', '7200'] From noreply at github.com Thu Feb 23 08:38:06 2017 From: noreply at github.com (GitHub) Date: Thu, 23 Feb 2017 05:38:06 -0800 Subject: [Python-checkins] [python/cpython] d7e643: bpo-28598: Support __rmod__ for RHS subclasses of ... Message-ID: <58aee5be4cfd6_1ac43fbed8e29c2c2251b4@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: d7e64337ef45085792b382a09f5b3a45d3687c8c https://github.com/python/cpython/commit/d7e64337ef45085792b382a09f5b3a45d3687c8c Author: Martijn Pieters Date: 2017-02-23 (Thu, 23 Feb 2017) Changed paths: M Lib/test/test_unicode.py M Misc/NEWS M Python/ceval.c Log Message: ----------- bpo-28598: Support __rmod__ for RHS subclasses of str in % string formatting operations (#51) When you use `'%s' % SubClassOfStr()`, where `SubClassOfStr.__rmod__` exists, the reverse operation is ignored as normally such string formatting operations use the `PyUnicode_Format()` fast path. This patch tests for subclasses of `str` first and picks the slow path in that case. Patch by Martijn Pieters. From noreply at github.com Thu Feb 23 09:57:26 2017 From: noreply at github.com (GitHub) Date: Thu, 23 Feb 2017 06:57:26 -0800 Subject: [Python-checkins] [python/cpython] 324c5d: bpo-28911: Clarify the behaviour of assert_called_... Message-ID: <58aef856ebcf3_1e1f3fb4dfb8fc301937a9@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 324c5d8ca6ed1c964d3b20e5762139ec65c7827c https://github.com/python/cpython/commit/324c5d8ca6ed1c964d3b20e5762139ec65c7827c Author: Arne de Laat Date: 2017-02-23 (Thu, 23 Feb 2017) Changed paths: M Doc/library/unittest.mock.rst M Lib/unittest/mock.py Log Message: ----------- bpo-28911: Clarify the behaviour of assert_called_once_with. (#251) From noreply at github.com Thu Feb 23 10:17:12 2017 From: noreply at github.com (GitHub) Date: Thu, 23 Feb 2017 07:17:12 -0800 Subject: [Python-checkins] [python/cpython] 55b82e: bpo-28911: Clarify the behaviour of assert_called_... Message-ID: <58aefcf89ce45_27043fd937fd7c303265af@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 55b82e10dc6b75b30a72fa56beb60eaf54a008d4 https://github.com/python/cpython/commit/55b82e10dc6b75b30a72fa56beb60eaf54a008d4 Author: Arne de Laat Date: 2017-02-23 (Thu, 23 Feb 2017) Changed paths: M Doc/library/unittest.mock.rst M Lib/unittest/mock.py Log Message: ----------- bpo-28911: Clarify the behaviour of assert_called_once_with. (#252) (cherry picked from commit 9d56b34af2efc4e266bf3ae62da5cd2e422a42be) From noreply at github.com Thu Feb 23 10:42:32 2017 From: noreply at github.com (GitHub) Date: Thu, 23 Feb 2017 07:42:32 -0800 Subject: [Python-checkins] [python/cpython] 2197ea: bpo-28814: Undeprecate inadvertently deprecated in... Message-ID: <58af02e827081_137e3ff538337c2424927c@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 2197eac6104311472f200645bc844adb46444b10 https://github.com/python/cpython/commit/2197eac6104311472f200645bc844adb46444b10 Author: Berker Peksag Date: 2017-02-24 (Fri, 24 Feb 2017) Changed paths: M Doc/library/inspect.rst M Doc/whatsnew/3.5.rst Log Message: ----------- bpo-28814: Undeprecate inadvertently deprecated inspect functions. (#122) (#243) Nick Coghlan said on bpo-28814: > inspect.getargvalues() and inspect.formatargvalues() were deprecated > in Python 3.5 as part of implementing bpo-20438 > This is incorrect, as these are *frame* introspection related functions, > not callable introspection ones. The documentation and implementation > layout is confusing though, as they're interleaved with the callable > introspection operation This commit undeprecates these functions and adds a note to ignore previous deprecation notices. (cherry picked from commit 0899b9809547ec2894dcf88cf4bba732c5d47d0d) From noreply at github.com Thu Feb 23 10:45:59 2017 From: noreply at github.com (GitHub) Date: Thu, 23 Feb 2017 07:45:59 -0800 Subject: [Python-checkins] [python/cpython] 024642: bpo-28814: Undeprecate inadvertently deprecated in... Message-ID: <58af03b7c44c_3b53ff5d8175c382056f3@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 0246422b974b1a0c50dd30b0e1a1138674ef87a5 https://github.com/python/cpython/commit/0246422b974b1a0c50dd30b0e1a1138674ef87a5 Author: Berker Peksag Date: 2017-02-24 (Fri, 24 Feb 2017) Changed paths: M Doc/library/inspect.rst M Doc/whatsnew/3.5.rst Log Message: ----------- bpo-28814: Undeprecate inadvertently deprecated inspect functions. (#122) (#244) Nick Coghlan said on bpo-28814: > inspect.getargvalues() and inspect.formatargvalues() were deprecated > in Python 3.5 as part of implementing bpo-20438 > This is incorrect, as these are *frame* introspection related functions, > not callable introspection ones. The documentation and implementation > layout is confusing though, as they're interleaved with the callable > introspection operation This commit undeprecates these functions and adds a note to ignore previous deprecation notices. (cherry picked from commit 0899b9809547ec2894dcf88cf4bba732c5d47d0d) From noreply at github.com Thu Feb 23 11:16:58 2017 From: noreply at github.com (GitHub) Date: Thu, 23 Feb 2017 08:16:58 -0800 Subject: [Python-checkins] [python/cpython] fa3045: bpo-28911: Clarify the behaviour of assert_called_... Message-ID: <58af0afa6690_28e7f3fb8c2135c44339089@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: fa30453568ae71861aa1928373bd76da4f3a33f6 https://github.com/python/cpython/commit/fa30453568ae71861aa1928373bd76da4f3a33f6 Author: Arne de Laat Date: 2017-02-23 (Thu, 23 Feb 2017) Changed paths: M Doc/library/unittest.mock.rst M Lib/unittest/mock.py Log Message: ----------- bpo-28911: Clarify the behaviour of assert_called_once_with. (#254) (cherry picked from commit 9d56b34af2efc4e266bf3ae62da5cd2e422a42be) From noreply at github.com Thu Feb 23 12:26:44 2017 From: noreply at github.com (GitHub) Date: Thu, 23 Feb 2017 09:26:44 -0800 Subject: [Python-checkins] [python/cpython] 561ca8: Document why functools.partial() must copy kwargs ... Message-ID: <58af1b548fc6b_2583fd54a173c34233684@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 561ca80cffd37445bac82ff820b8f52b98c50517 https://github.com/python/cpython/commit/561ca80cffd37445bac82ff820b8f52b98c50517 Author: Victor Stinner Date: 2017-02-23 (Thu, 23 Feb 2017) Changed paths: M Modules/_functoolsmodule.c M Objects/call.c Log Message: ----------- Document why functools.partial() must copy kwargs (#253) Add a comment to prevent further attempts to avoid a copy for optimization. From noreply at github.com Thu Feb 23 12:48:19 2017 From: noreply at github.com (GitHub) Date: Thu, 23 Feb 2017 09:48:19 -0800 Subject: [Python-checkins] [python/cpython] 4c78c5: bpo-29622: Make AST constructor to accept less tha... Message-ID: <58af2063841a7_25873fdf57195c3c969af@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 4c78c527d215c37472145152cb0e95f196cdddc9 https://github.com/python/cpython/commit/4c78c527d215c37472145152cb0e95f196cdddc9 Author: INADA Naoki Date: 2017-02-24 (Fri, 24 Feb 2017) Changed paths: M Lib/test/test_ast.py M Parser/asdl_c.py M Python/Python-ast.c Log Message: ----------- bpo-29622: Make AST constructor to accept less than enough number of positional arguments (GH-249) bpo-29463 added optional "docstring" field to 4 AST types. While it is optional, it breaks backward compatibility because AST constructor requires number of positional argument is same to number of fields. AST types accepts empty arguments, and incomplete keyword arguments. But it's not big problem because field can be filled after creation, and checked when compiling. So stop requiring complete set of fields for positional arguments too. From noreply at github.com Thu Feb 23 17:11:38 2017 From: noreply at github.com (GitHub) Date: Thu, 23 Feb 2017 14:11:38 -0800 Subject: [Python-checkins] [python/cpython] 1aceb0: bpo-29624: Adds purge step and layout test after u... Message-ID: <58af5e1acfe8b_1c023ff45bcb1c383619ab@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 1aceb024172ea3d6f9dd6e90f4fbe63ea1fb054e https://github.com/python/cpython/commit/1aceb024172ea3d6f9dd6e90f4fbe63ea1fb054e Author: Steve Dower Date: 2017-02-23 (Thu, 23 Feb 2017) Changed paths: M Tools/msi/uploadrelease.bat M Tools/msi/uploadrelease.proj Log Message: ----------- bpo-29624: Adds purge step and layout test after uploading files. (#258) From noreply at github.com Thu Feb 23 18:02:44 2017 From: noreply at github.com (GitHub) Date: Thu, 23 Feb 2017 15:02:44 -0800 Subject: [Python-checkins] [python/cpython] e29741: bpo-29624: Adds purge step and layout test after u... Message-ID: <58af6a14cae22_9cb3f991a8a9c402110ac@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: e29741466df0cd01a49bf5ec3b1df3e2bad119a7 https://github.com/python/cpython/commit/e29741466df0cd01a49bf5ec3b1df3e2bad119a7 Author: Steve Dower Date: 2017-02-23 (Thu, 23 Feb 2017) Changed paths: M Tools/msi/uploadrelease.bat M Tools/msi/uploadrelease.proj Log Message: ----------- bpo-29624: Adds purge step and layout test after uploading files. (#258) (#263) From noreply at github.com Thu Feb 23 18:03:22 2017 From: noreply at github.com (GitHub) Date: Thu, 23 Feb 2017 15:03:22 -0800 Subject: [Python-checkins] [python/cpython] f2bece: bpo-29624: Adds purge step and layout test after u... Message-ID: <58af6a3aa12be_6f63ff2186b7c3c176641@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: f2beceb7e54fadc507137f86cbe9d74f7e5b8f7c https://github.com/python/cpython/commit/f2beceb7e54fadc507137f86cbe9d74f7e5b8f7c Author: Steve Dower Date: 2017-02-23 (Thu, 23 Feb 2017) Changed paths: M Tools/msi/uploadrelease.bat M Tools/msi/uploadrelease.proj Log Message: ----------- bpo-29624: Adds purge step and layout test after uploading files. (#258) (#264) From noreply at github.com Thu Feb 23 22:03:30 2017 From: noreply at github.com (GitHub) Date: Thu, 23 Feb 2017 19:03:30 -0800 Subject: [Python-checkins] [python/cpython] abb3b8: Update to typing: treat subscripted generics as pr... Message-ID: <58afa28214090_1a5d3fec06597c3430816d@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: abb3b8ad94d699c8560d94ee9bac9c917b382abe https://github.com/python/cpython/commit/abb3b8ad94d699c8560d94ee9bac9c917b382abe Author: Ivan Levkivskyi Date: 2017-02-23 (Thu, 23 Feb 2017) Changed paths: M Lib/test/test_typing.py M Lib/typing.py Log Message: ----------- Update to typing: treat subscripted generics as proxies (#265) From noreply at github.com Thu Feb 23 22:59:51 2017 From: noreply at github.com (GitHub) Date: Thu, 23 Feb 2017 19:59:51 -0800 Subject: [Python-checkins] [python/cpython] 357bad: bpo-29634: Reduce deque repeat execution when maxl... Message-ID: <58afafb7249bb_289493fbcdb10fc34230952@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 357bad7101df196d7f4ea3dc6ed9a6436afb022c https://github.com/python/cpython/commit/357bad7101df196d7f4ea3dc6ed9a6436afb022c Author: Louie Lu Date: 2017-02-23 (Thu, 23 Feb 2017) Changed paths: M Modules/_collectionsmodule.c Log Message: ----------- bpo-29634: Reduce deque repeat execution when maxlen exist and size is not 1 (#255) (#255) From noreply at github.com Fri Feb 24 01:44:21 2017 From: noreply at github.com (GitHub) Date: Thu, 23 Feb 2017 22:44:21 -0800 Subject: [Python-checkins] [python/cpython] 41cea7: bpo-29637: clean docstring only if not None (GH-26... Message-ID: <58afd64547c66_197a3f7e493e7c34319816@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 41cea70aa38de50c1d714209aa2b7694d86a7e0c https://github.com/python/cpython/commit/41cea70aa38de50c1d714209aa2b7694d86a7e0c Author: Matthias Bussonnier Date: 2017-02-24 (Fri, 24 Feb 2017) Changed paths: M Lib/ast.py M Lib/test/test_ast.py Log Message: ----------- bpo-29637: clean docstring only if not None (GH-267) From solipsis at pitrou.net Fri Feb 24 04:08:52 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Fri, 24 Feb 2017 09:08:52 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=6 Message-ID: <20170224090851.108522.13748.D13AA529@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_fork leaked [0, 1, -2] memory blocks, sum=-1 test_multiprocessing_forkserver leaked [2, -1, 1] memory blocks, sum=2 test_multiprocessing_spawn leaked [-1, 2, 0] memory blocks, sum=1 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogDosA_e', '--timeout', '7200'] From noreply at github.com Fri Feb 24 05:47:36 2017 From: noreply at github.com (GitHub) Date: Fri, 24 Feb 2017 02:47:36 -0800 Subject: [Python-checkins] [python/cpython] 6059ce: bpo-27788 : synchronise platform.py version number... Message-ID: <58b00f4850c_253d3fcd4633bc4428737f@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 6059ce45aa96f52fa0150e68ea655fbfdc25609a https://github.com/python/cpython/commit/6059ce45aa96f52fa0150e68ea655fbfdc25609a Author: Matthias Bussonnier Date: 2017-02-24 (Fri, 24 Feb 2017) Changed paths: M Lib/platform.py Log Message: ----------- bpo-27788 : synchronise platform.py version number (#246) Was bumped in the docstring by b9f4feab1b9c9ffa8ea29af3d82bc536f9f3005a but not in `__version__` From noreply at github.com Fri Feb 24 12:28:27 2017 From: noreply at github.com (GitHub) Date: Fri, 24 Feb 2017 09:28:27 -0800 Subject: [Python-checkins] [python/cpython] 365cb5: bpo-28556: Fix regression that sneaked into recent... Message-ID: <58b06d3bad9fc_bb93f81697f9c28283690@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 365cb5bb9069273e6970c9d5d17ee2fe5003e7ac https://github.com/python/cpython/commit/365cb5bb9069273e6970c9d5d17ee2fe5003e7ac Author: Ivan Levkivskyi Date: 2017-02-24 (Fri, 24 Feb 2017) Changed paths: M Lib/test/test_typing.py M Lib/typing.py Log Message: ----------- bpo-28556: Fix regression that sneaked into recent typing updates (GH-270) From noreply at github.com Fri Feb 24 14:06:00 2017 From: noreply at github.com (GitHub) Date: Fri, 24 Feb 2017 11:06:00 -0800 Subject: [Python-checkins] [python/cpython] fba79d: bpo-25008: Deprecate smtpd and point to aiosmtpd (... Message-ID: <58b084188ce13_1a1d3f9051c83c3420943@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: fba79dc568030091f84110fccac4cb64c2fef020 https://github.com/python/cpython/commit/fba79dc568030091f84110fccac4cb64c2fef020 Author: Barry Warsaw Date: 2017-02-24 (Fri, 24 Feb 2017) Changed paths: M Doc/library/smtpd.rst M Misc/NEWS Log Message: ----------- bpo-25008: Deprecate smtpd and point to aiosmtpd (#274) * bpo-25008: Deprecate smtpd and point to aiosmtpd. * Simplify the aiosmtpd URL. From noreply at github.com Fri Feb 24 15:31:50 2017 From: noreply at github.com (GitHub) Date: Fri, 24 Feb 2017 12:31:50 -0800 Subject: [Python-checkins] [python/cpython] f37b0c: bpo-25008: Deprecate smtpd and point to aiosmtpd (... Message-ID: <58b09836852b0_185e3f832b2e5c3c2245d@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.4 Home: https://github.com/python/cpython Commit: f37b0cb230069481609b0bb06891b5dd26320504 https://github.com/python/cpython/commit/f37b0cb230069481609b0bb06891b5dd26320504 Author: Barry Warsaw Date: 2017-02-24 (Fri, 24 Feb 2017) Changed paths: M Doc/library/smtpd.rst M Misc/NEWS Log Message: ----------- bpo-25008: Deprecate smtpd and point to aiosmtpd (#274) (#280) From noreply at github.com Fri Feb 24 15:32:56 2017 From: noreply at github.com (GitHub) Date: Fri, 24 Feb 2017 12:32:56 -0800 Subject: [Python-checkins] [python/cpython] 132ac3: Fix small typos in expressions.rst (GH-276) Message-ID: <58b098784fc18_142f3fe138283c382513e1@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 132ac381fe7eb593e3d7c63926f90285bba13cdc https://github.com/python/cpython/commit/132ac381fe7eb593e3d7c63926f90285bba13cdc Author: Jim Fasarakis-Hilliard Date: 2017-02-24 (Fri, 24 Feb 2017) Changed paths: M Doc/reference/expressions.rst Log Message: ----------- Fix small typos in expressions.rst (GH-276) From noreply at github.com Fri Feb 24 15:44:36 2017 From: noreply at github.com (GitHub) Date: Fri, 24 Feb 2017 12:44:36 -0800 Subject: [Python-checkins] [python/cpython] 0a1b65: bpo-25008: Deprecate smtpd and point to aiosmtpd (... Message-ID: <58b09b3481e66_127c3fb976299c3427407f@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 0a1b656d8ce3da14f8acf947477b8e998e68ef3b https://github.com/python/cpython/commit/0a1b656d8ce3da14f8acf947477b8e998e68ef3b Author: Barry Warsaw Date: 2017-02-24 (Fri, 24 Feb 2017) Changed paths: M Doc/library/smtpd.rst M Misc/NEWS Log Message: ----------- bpo-25008: Deprecate smtpd and point to aiosmtpd (#274) (#278) From noreply at github.com Fri Feb 24 16:15:19 2017 From: noreply at github.com (GitHub) Date: Fri, 24 Feb 2017 13:15:19 -0800 Subject: [Python-checkins] [python/cpython] 66b509: bpo-25008: Deprecate smtpd and point to aiosmtpd (... Message-ID: <58b0a2676a6ab_4083fbc237bfc2c205410@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 66b5092fac4264efdc9c508a7dd425fa9833e147 https://github.com/python/cpython/commit/66b5092fac4264efdc9c508a7dd425fa9833e147 Author: Barry Warsaw Date: 2017-02-24 (Fri, 24 Feb 2017) Changed paths: M Doc/library/smtpd.rst M Misc/NEWS Log Message: ----------- bpo-25008: Deprecate smtpd and point to aiosmtpd (#274) (#279) From noreply at github.com Fri Feb 24 19:39:31 2017 From: noreply at github.com (GitHub) Date: Fri, 24 Feb 2017 16:39:31 -0800 Subject: [Python-checkins] [python/cpython] f28db6: [3.6] Fix small typos in expressions.rst (GH-276) ... Message-ID: <58b0d2439bc00_6e73fda3f39bc381758b@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: f28db60179e59633a99fab27646d22d0bd5976a0 https://github.com/python/cpython/commit/f28db60179e59633a99fab27646d22d0bd5976a0 Author: Mariatta Date: 2017-02-24 (Fri, 24 Feb 2017) Changed paths: M Doc/reference/expressions.rst Log Message: ----------- [3.6] Fix small typos in expressions.rst (GH-276) (GH-281) (cherry picked from commit 132ac381fe7eb593e3d7c63926f90285bba13cdc) From noreply at github.com Fri Feb 24 19:40:51 2017 From: noreply at github.com (GitHub) Date: Fri, 24 Feb 2017 16:40:51 -0800 Subject: [Python-checkins] [python/cpython] bea9d2: [3.6] bpo-28556: Update to typing: treat subscript... Message-ID: <58b0d293e933e_f143fcbecd87c3028255a@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: bea9d2f6488f01794098d9fd4710b98df1bd9472 https://github.com/python/cpython/commit/bea9d2f6488f01794098d9fd4710b98df1bd9472 Author: Mariatta Date: 2017-02-24 (Fri, 24 Feb 2017) Changed paths: M Lib/test/test_typing.py M Lib/typing.py Log Message: ----------- [3.6] bpo-28556: Update to typing: treat subscripted generics as proxies (GH-265) (GH-268) (cherry picked from commit abb3b8ad94d699c8560d94ee9bac9c917b382abe) (cherry picked from commit 365cb5bb9069273e6970c9d5d17ee2fe5003e7ac) From noreply at github.com Fri Feb 24 19:41:20 2017 From: noreply at github.com (GitHub) Date: Fri, 24 Feb 2017 16:41:20 -0800 Subject: [Python-checkins] [python/cpython] bc33cd: [3.5] bpo-28556: Update to typing: treat subscript... Message-ID: <58b0d2b0d626c_108e3f843992bc2c26574a@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: bc33cd4e7a36ed4c309807ca9a911ef955582710 https://github.com/python/cpython/commit/bc33cd4e7a36ed4c309807ca9a911ef955582710 Author: Mariatta Date: 2017-02-24 (Fri, 24 Feb 2017) Changed paths: M Lib/test/test_typing.py M Lib/typing.py Log Message: ----------- [3.5] bpo-28556: Update to typing: treat subscripted generics as proxies (GH-265) (GH-269) (cherry picked from commit abb3b8ad94d699c8560d94ee9bac9c917b382abe) (cherry picked from commit 365cb5bb9069273e6970c9d5d17ee2fe5003e7ac) From noreply at github.com Fri Feb 24 21:09:23 2017 From: noreply at github.com (GitHub) Date: Fri, 24 Feb 2017 18:09:23 -0800 Subject: [Python-checkins] [python/cpython] e3bf4c: bpo-28929: Add to Misc/NEWS (GH-112) Message-ID: <58b0e753e6371_11803feeeab47c3824322a@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: e3bf4cdd3db9004220d3ec7f5db4e7d16a99c743 https://github.com/python/cpython/commit/e3bf4cdd3db9004220d3ec7f5db4e7d16a99c743 Author: Mariatta Date: 2017-02-24 (Fri, 24 Feb 2017) Changed paths: M Misc/NEWS Log Message: ----------- bpo-28929: Add to Misc/NEWS (GH-112) mention bpo-28929 in the Documentation section of What's New in Python 3.7.0 alpha 1 From noreply at github.com Fri Feb 24 23:47:39 2017 From: noreply at github.com (GitHub) Date: Fri, 24 Feb 2017 20:47:39 -0800 Subject: [Python-checkins] [python/cpython] e3ce69: bpo-24241: Improve preferred webbrowser handling (... Message-ID: <58b10c6b92201_fc73fda04a23c3024961d@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: e3ce69522ffd7c0354d6e70d18f42bce325ed97e https://github.com/python/cpython/commit/e3ce69522ffd7c0354d6e70d18f42bce325ed97e Author: David Steele Date: 2017-02-25 (Sat, 25 Feb 2017) Changed paths: M Doc/library/webbrowser.rst M Lib/webbrowser.py M Misc/ACKS M Misc/NEWS Log Message: ----------- bpo-24241: Improve preferred webbrowser handling (#85) - Add 'preferred' argument to webbrowser.register - Use xdg-settings to specify preferred X browser The first change replaces the existing undocumented tri-state 'try_order' parameter with the documented boolean keyword-only 'preferred' parameter. Setting it to True places the browser at the front of the list, preferring it as the return to a subsequent get() call. The second change adds a private `_os_preferred_browser` setting and then uses that to make the default browser reported by `xdg-settings` first in the try list when running under X (or another environment that sets the `DISPLAY` variable). This avoids the problem where the first entry in the tryorder queue otherwise defaults to xdg-open, which doesn't support the "new window" option. From noreply at github.com Sat Feb 25 03:14:08 2017 From: noreply at github.com (GitHub) Date: Sat, 25 Feb 2017 00:14:08 -0800 Subject: [Python-checkins] [python/cpython] 56a8ec: bpo-24241: Add dedicated webbrowser.register test ... Message-ID: <58b13cd08cd51_21c13fc3ead01c3450336a@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 56a8eccc43c66ae51c5a6bfc89635b1998fd419e https://github.com/python/cpython/commit/56a8eccc43c66ae51c5a6bfc89635b1998fd419e Author: Nick Coghlan Date: 2017-02-25 (Sat, 25 Feb 2017) Changed paths: M Lib/test/test_webbrowser.py Log Message: ----------- bpo-24241: Add dedicated webbrowser.register test case (#288) From noreply at github.com Sat Feb 25 03:40:08 2017 From: noreply at github.com (GitHub) Date: Sat, 25 Feb 2017 00:40:08 -0800 Subject: [Python-checkins] [python/cpython] 140792: bpo-29644: suppress subprocess output from webbrow... Message-ID: <58b142e8db83d_bb93f81697f9c282906f8@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 140792bd514ee4ba739fda899785bea3ce746f05 https://github.com/python/cpython/commit/140792bd514ee4ba739fda899785bea3ce746f05 Author: Nick Coghlan Date: 2017-02-25 (Sat, 25 Feb 2017) Changed paths: M Lib/webbrowser.py Log Message: ----------- bpo-29644: suppress subprocess output from webbrowser (#289) When checking for the default X web browser, xdg-settings may emit messages on stderr if some components (such as kreadconfig5) are unavailable. These messages aren't of interest to Python, so we just ignore them. From noreply at github.com Sat Feb 25 04:00:30 2017 From: noreply at github.com (GitHub) Date: Sat, 25 Feb 2017 01:00:30 -0800 Subject: [Python-checkins] [python/cpython] 21024f: bpo-16285: Update urllib quoting to RFC 3986 (#173... Message-ID: <58b147aeb1065_1e263fb30ccedc3c2680c1@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 21024f06622c4c55b666adb130797a4ee205d005 https://github.com/python/cpython/commit/21024f06622c4c55b666adb130797a4ee205d005 Author: Ratnadeep Debnath Date: 2017-02-25 (Sat, 25 Feb 2017) Changed paths: M Doc/library/urllib.parse.rst M Doc/whatsnew/3.7.rst M Lib/test/test_urllib.py M Lib/urllib/parse.py M Misc/ACKS M Misc/NEWS Log Message: ----------- bpo-16285: Update urllib quoting to RFC 3986 (#173) * bpo-16285: Update urllib quoting to RFC 3986 urllib.parse.quote is now based on RFC 3986, and hence includes `'~'` in the set of characters that is not escaped by default. Patch by Christian Theune and Ratnadeep Debnath. From solipsis at pitrou.net Sat Feb 25 04:07:33 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sat, 25 Feb 2017 09:07:33 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=4 Message-ID: <20170225090733.51281.68162.31E52A95@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [0, 7, -7] memory blocks, sum=0 test_functools leaked [0, 3, 1] memory blocks, sum=4 test_multiprocessing_forkserver leaked [1, -2, 1] memory blocks, sum=0 Command line was: ['./python', '-m', 'test.regrtest', '-uall', '-R', '3:3:/home/psf-users/antoine/refleaks/reflogjmwkBg', '--timeout', '7200'] From noreply at github.com Sat Feb 25 09:59:06 2017 From: noreply at github.com (GitHub) Date: Sat, 25 Feb 2017 06:59:06 -0800 Subject: [Python-checkins] [python/cpython] ae160b: bpo-26128: Added __init__to subprocess.STARTUPINFO... Message-ID: <58b19bba819d1_99b3f97a63e5c384511e5@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: ae160bba2030a7b6c86f6c7aeaf2f9d3fdb627b7 https://github.com/python/cpython/commit/ae160bba2030a7b6c86f6c7aeaf2f9d3fdb627b7 Author: Subhendu Ghosh Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Doc/library/subprocess.rst M Lib/subprocess.py M Lib/test/test_subprocess.py M Misc/ACKS M Misc/NEWS Log Message: ----------- bpo-26128: Added __init__to subprocess.STARTUPINFO (#171) The Windows-specific subprocess.STARTUPINFO class now accepts keyword-only arguments to its constructor to set the various data attributes. Patch by Subhendu Ghosh. From noreply at github.com Sat Feb 25 11:59:27 2017 From: noreply at github.com (GitHub) Date: Sat, 25 Feb 2017 08:59:27 -0800 Subject: [Python-checkins] [python/cpython] e32ec9: README.rst: List out relevant links to the project... Message-ID: <58b1b7ef9294e_20733fc22fe45c3829696@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: e32ec9334b35f897ace8a05128838f92c5e0b2fb https://github.com/python/cpython/commit/e32ec9334b35f897ace8a05128838f92c5e0b2fb Author: Mariatta Date: 2017-02-25 (Sat, 25 Feb 2017) Changed paths: M README.rst Log Message: ----------- README.rst: List out relevant links to the project (#283) From noreply at github.com Sat Feb 25 14:49:39 2017 From: noreply at github.com (GitHub) Date: Sat, 25 Feb 2017 11:49:39 -0800 Subject: [Python-checkins] [python/cpython] 6329ae: README.rst: Change the devguide url to docs.python... Message-ID: <58b1dfd3da123_1dce3fe5217a7c2c35891@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 6329aea78e3627d250009aa5aaaf47cd11587f4d https://github.com/python/cpython/commit/6329aea78e3627d250009aa5aaaf47cd11587f4d Author: Mariatta Date: 2017-02-25 (Sat, 25 Feb 2017) Changed paths: M README.rst Log Message: ----------- README.rst: Change the devguide url to docs.python.org/devguide (GH-295) From noreply at github.com Sat Feb 25 14:56:49 2017 From: noreply at github.com (GitHub) Date: Sat, 25 Feb 2017 11:56:49 -0800 Subject: [Python-checkins] [python/cpython] 814213: [3.6] Backport README.rst changes (GH-294) Message-ID: <58b1e181a8a99_10663fc6493edc402809aa@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 814213bdf1b95a5d863311b61c671010291f1197 https://github.com/python/cpython/commit/814213bdf1b95a5d863311b61c671010291f1197 Author: Mariatta Date: 2017-02-25 (Sat, 25 Feb 2017) Changed paths: M Doc/Makefile A Doc/README.rst R Doc/README.txt M Doc/conf.py M Doc/make.bat M README.rst Log Message: ----------- [3.6] Backport README.rst changes (GH-294) (cherry picked from commit b3f1f59cf451d4a25b204e7a24f7be4c95e40be8) (cherry picked from commit 1b3d88eb33085e90af729c4c2f78b5ba1b942b1e) (cherry picked from commit c0866855d54bbbe7bcac299c4af45389efacce0b) (cherry picked from commit e32ec9334b35f897ace8a05128838f92c5e0b2fb) (cherry picked from commit 6329aea78e3627d250009aa5aaaf47cd11587f4d) From noreply at github.com Sat Feb 25 16:13:35 2017 From: noreply at github.com (GitHub) Date: Sat, 25 Feb 2017 13:13:35 -0800 Subject: [Python-checkins] [python/cpython] 53c189: Fix small typos in introduction and datastructures... Message-ID: <58b1f37f6934d_67a3faba5663c4029008c@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 53c1892dc3de1de612b1cf95dc7bf09f82c1babf https://github.com/python/cpython/commit/53c1892dc3de1de612b1cf95dc7bf09f82c1babf Author: Jim Fasarakis-Hilliard Date: 2017-02-25 (Sat, 25 Feb 2017) Changed paths: M Doc/tutorial/datastructures.rst M Doc/tutorial/introduction.rst Log Message: ----------- Fix small typos in introduction and datastructures of tutorial (GH-272) * Fix small typos in introduction and datastructures * Use iterable instead of L in the doc for list.extend From noreply at github.com Sun Feb 26 00:58:06 2017 From: noreply at github.com (GitHub) Date: Sat, 25 Feb 2017 21:58:06 -0800 Subject: [Python-checkins] [python/cpython] 160edb: bpo-29655: Fixed possible reference leaks in `impo... Message-ID: <58b26e6ef3347_60f83f90bbdbbc2c74946@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 160edb43571311a3785785c1dfa784afc52d87be https://github.com/python/cpython/commit/160edb43571311a3785785c1dfa784afc52d87be Author: Matthias Bussonnier Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Python/ceval.c Log Message: ----------- bpo-29655: Fixed possible reference leaks in `import *`. (#301) Patch by Matthias Bussonnier. From noreply at github.com Sun Feb 26 01:33:38 2017 From: noreply at github.com (GitHub) Date: Sat, 25 Feb 2017 22:33:38 -0800 Subject: [Python-checkins] [python/cpython] 23d2c3: [2.7] bpo-28929: Add to Misc/NEWS (GH-286) Message-ID: <58b276c29b286_5ec23fe513135c3015772@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/2.7 Home: https://github.com/python/cpython Commit: 23d2c31cbf3032b8c6bb254f06c4532a6db466b6 https://github.com/python/cpython/commit/23d2c31cbf3032b8c6bb254f06c4532a6db466b6 Author: Mariatta Date: 2017-02-25 (Sat, 25 Feb 2017) Changed paths: M Misc/NEWS Log Message: ----------- [2.7] bpo-28929: Add to Misc/NEWS (GH-286) mention bpo-28929 in the Documentation section of What's New in Python 2.7.14 From noreply at github.com Sun Feb 26 01:33:53 2017 From: noreply at github.com (GitHub) Date: Sat, 25 Feb 2017 22:33:53 -0800 Subject: [Python-checkins] [python/cpython] 502368: [3.5] bpo-28929: Add to Misc/NEWS (GH-285) Message-ID: <58b276d135152_77163fd2981fbc38914f9@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 5023686f7ee69e9da07cda4b7da6691f19892111 https://github.com/python/cpython/commit/5023686f7ee69e9da07cda4b7da6691f19892111 Author: Mariatta Date: 2017-02-25 (Sat, 25 Feb 2017) Changed paths: M Misc/NEWS Log Message: ----------- [3.5] bpo-28929: Add to Misc/NEWS (GH-285) mention bpo-28929 in the Documentation section of What's New in Python 3.5.4 release candidate 1 From noreply at github.com Sun Feb 26 01:34:07 2017 From: noreply at github.com (GitHub) Date: Sat, 25 Feb 2017 22:34:07 -0800 Subject: [Python-checkins] [python/cpython] 1a8dd9: [3.6] bpo-28929: Add to Misc/NEWS (GH-284) Message-ID: <58b276dfd2475_73523fe259e1bc2c89f6@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 1a8dd944d4016593e78a7a6c3c635adee783abfd https://github.com/python/cpython/commit/1a8dd944d4016593e78a7a6c3c635adee783abfd Author: Mariatta Date: 2017-02-25 (Sat, 25 Feb 2017) Changed paths: M Misc/NEWS Log Message: ----------- [3.6] bpo-28929: Add to Misc/NEWS (GH-284) mention bpo-28929 in the Documentation section of What's New in Python 3.6.1 release candidate 1 From noreply at github.com Sun Feb 26 01:34:52 2017 From: noreply at github.com (GitHub) Date: Sat, 25 Feb 2017 22:34:52 -0800 Subject: [Python-checkins] [python/cpython] b00232: Fix small typos in introduction and datastructures... Message-ID: <58b2770cc4514_5ec93feac4dfbc3861999@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: b00232842c5dd0d41054a02a7800fc5f82a92beb https://github.com/python/cpython/commit/b00232842c5dd0d41054a02a7800fc5f82a92beb Author: Mariatta Date: 2017-02-25 (Sat, 25 Feb 2017) Changed paths: M Doc/tutorial/datastructures.rst M Doc/tutorial/introduction.rst Log Message: ----------- Fix small typos in introduction and datastructures of tutorial (GH-272) (GH-297) (cherry picked from commit 53c1892dc3de1de612b1cf95dc7bf09f82c1babf) From noreply at github.com Sun Feb 26 01:35:40 2017 From: noreply at github.com (GitHub) Date: Sat, 25 Feb 2017 22:35:40 -0800 Subject: [Python-checkins] [python/cpython] 4c7846: [3.5] Fix small typos in introduction and datastru... Message-ID: <58b2773ce0e0e_68383fe27acf9c2431541@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 4c784632f7cb5ede6df4b1b20cdfae155069a81b https://github.com/python/cpython/commit/4c784632f7cb5ede6df4b1b20cdfae155069a81b Author: Mariatta Date: 2017-02-25 (Sat, 25 Feb 2017) Changed paths: M Doc/tutorial/datastructures.rst M Doc/tutorial/introduction.rst Log Message: ----------- [3.5] Fix small typos in introduction and datastructures of tutorial (GH-272) (GH-299) (cherry picked from commit 5bd5b9d81322d2cb6edd5f3804a347f8b2e65a15) (cherry picked from commit 8c5e190d360b9f1a08c9fff249ae80d9c18007d5) (cherry picked from commit 53c1892dc3de1de612b1cf95dc7bf09f82c1babf) From noreply at github.com Sun Feb 26 02:17:58 2017 From: noreply at github.com (GitHub) Date: Sat, 25 Feb 2017 23:17:58 -0800 Subject: [Python-checkins] [python/cpython] 4c0e02: mark various test data binary (#233) Message-ID: <58b2812685e9_472e3fc154429c30477e9@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/benjamin-binary-test-data Home: https://github.com/python/cpython Commit: 4c0e028ddf46719e671b22e610a1ce85c4245660 https://github.com/python/cpython/commit/4c0e028ddf46719e671b22e610a1ce85c4245660 Author: Benjamin Peterson Date: 2017-02-25 (Sat, 25 Feb 2017) Changed paths: A .gitattributes Log Message: ----------- mark various test data binary (#233) From noreply at github.com Sun Feb 26 02:25:29 2017 From: noreply at github.com (GitHub) Date: Sat, 25 Feb 2017 23:25:29 -0800 Subject: [Python-checkins] [python/cpython] 6e9e64: mark various test data binary (#233) (#303) Message-ID: <58b282e96cb58_62783fc393525c24290f9@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/2.7 Home: https://github.com/python/cpython Commit: 6e9e6496ef4ed916edbb81407a0ae76b013f2fe5 https://github.com/python/cpython/commit/6e9e6496ef4ed916edbb81407a0ae76b013f2fe5 Author: Benjamin Peterson Date: 2017-02-25 (Sat, 25 Feb 2017) Changed paths: A .gitattributes Log Message: ----------- mark various test data binary (#233) (#303) From noreply at github.com Sun Feb 26 02:26:33 2017 From: noreply at github.com (GitHub) Date: Sat, 25 Feb 2017 23:26:33 -0800 Subject: [Python-checkins] [python/cpython] Message-ID: <58b28329bb549_74cc3fb352403c3442511@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/benjamin-binary-test-data Home: https://github.com/python/cpython From noreply at github.com Sun Feb 26 02:26:38 2017 From: noreply at github.com (GitHub) Date: Sat, 25 Feb 2017 23:26:38 -0800 Subject: [Python-checkins] [python/cpython] 233458: mark various test data binary (#233) Message-ID: <58b2832e23d81_7cef3fe35ad87c2820320@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/benjamin-binary-test-data Home: https://github.com/python/cpython Commit: 2334587526205b280dcdb2061df7e2b4dd0b29ad https://github.com/python/cpython/commit/2334587526205b280dcdb2061df7e2b4dd0b29ad Author: Benjamin Peterson Date: 2017-02-25 (Sat, 25 Feb 2017) Changed paths: A .gitattributes Log Message: ----------- mark various test data binary (#233) From noreply at github.com Sun Feb 26 03:00:11 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 00:00:11 -0800 Subject: [Python-checkins] [python/cpython] 91c499: mark various test data binary (#233) (#304) Message-ID: <58b28b0b4e3d1_57ad3fdfb68cdc3462d4@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 91c499f8f94b89c08686ac9e7c81ea1d89221cbc https://github.com/python/cpython/commit/91c499f8f94b89c08686ac9e7c81ea1d89221cbc Author: Benjamin Peterson Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: A .gitattributes Log Message: ----------- mark various test data binary (#233) (#304) From solipsis at pitrou.net Sun Feb 26 04:07:02 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Sun, 26 Feb 2017 09:07:02 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=5 Message-ID: <20170226090701.3970.71268.7229BF34@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [7, -7, 1] 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/reflogOgBX8K', '--timeout', '7200'] From noreply at github.com Sun Feb 26 07:04:13 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 04:04:13 -0800 Subject: [Python-checkins] [python/cpython] 5aa385: bpo-28961: Address my comments from earlier code r... Message-ID: <58b2c43ded6b_237b93ffdd0127c2c32189@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 5aa3856b4f325457e8ec1ccf669369f543e1f6b5 https://github.com/python/cpython/commit/5aa3856b4f325457e8ec1ccf669369f543e1f6b5 Author: Berker Peksag Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Lib/unittest/test/testmock/testhelpers.py Log Message: ----------- bpo-28961: Address my comments from earlier code review (#305) From noreply at github.com Sun Feb 26 07:12:00 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 04:12:00 -0800 Subject: [Python-checkins] [python/cpython] 5dc33e: bpo-29110: add test for Aifc_write. (GH-293) Message-ID: <58b2c61049d2d_630a3fe513a21c2c192a2@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 5dc33eea538361f8a218255f83db2e9298dd8c53 https://github.com/python/cpython/commit/5dc33eea538361f8a218255f83db2e9298dd8c53 Author: INADA Naoki Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Lib/aifc.py M Lib/test/test_aifc.py Log Message: ----------- bpo-29110: add test for Aifc_write. (GH-293) follow up of GH-162 From noreply at github.com Sun Feb 26 07:37:30 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 04:37:30 -0800 Subject: [Python-checkins] [python/cpython] Message-ID: <58b2cc0a12866_5f923f88b51a9c306951b@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/benjamin-binary-test-data Home: https://github.com/python/cpython From noreply at github.com Sun Feb 26 08:05:32 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 05:05:32 -0800 Subject: [Python-checkins] [python/cpython] fae59e: bpo-28961: Address my comments from earlier code r... Message-ID: <58b2d29c445ba_74993fe1f91cfc447521@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: fae59e1aa87ee9598d032e0bd697969a5784025f https://github.com/python/cpython/commit/fae59e1aa87ee9598d032e0bd697969a5784025f Author: Berker Peksag Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Lib/unittest/test/testmock/testhelpers.py Log Message: ----------- bpo-28961: Address my comments from earlier code review (#306) (cherry picked from commit dea1536fd3a8424d537794cd53715df0989cbbe1) From noreply at github.com Sun Feb 26 08:06:13 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 05:06:13 -0800 Subject: [Python-checkins] [python/cpython] 6b585f: Fix unittest.mock._Call: don't ignore name (#307) Message-ID: <58b2d2c545691_60bf3fce66f6fc381556c@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 6b585fddc9ad472d8c962aba26cf25809451b2b5 https://github.com/python/cpython/commit/6b585fddc9ad472d8c962aba26cf25809451b2b5 Author: Berker Peksag Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Lib/unittest/mock.py M Lib/unittest/test/testmock/testhelpers.py M Misc/NEWS Log Message: ----------- Fix unittest.mock._Call: don't ignore name (#307) Issue #28961: Fix unittest.mock._Call helper: don't ignore the name parameter anymore. Patch written by Jiajun Huang. (cherry picked from commits 84b6fb0eea29b3b28a1a11124526b01ec0c9d17a and dea1536fd3a8424d537794cd53715df0989cbbe1) Conflicts: Misc/NEWS From noreply at github.com Sun Feb 26 08:07:13 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 05:07:13 -0800 Subject: [Python-checkins] [python/cpython] 5c7b8f: Backport recent .travis.yml changes (#308) Message-ID: <58b2d301d349e_42c03fa6f4bc7c3c162d0@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 5c7b8f423ab1de6221351036ac4e139861a2f4a6 https://github.com/python/cpython/commit/5c7b8f423ab1de6221351036ac4e139861a2f4a6 Author: Berker Peksag Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M .travis.yml Log Message: ----------- Backport recent .travis.yml changes (#308) Backported changes from master: * b52260d8bf392aa04c48b8c2467a4c034184de86 * 984eef7d6d78e1213d6ea99897343a5059a07c59 * 532519770dea5d353f0b0d718c8881a15c7542df * 91b0e7d0ca7c59df28f6a6fc1e8eb86a3925b76c From noreply at github.com Sun Feb 26 08:07:43 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 05:07:43 -0800 Subject: [Python-checkins] [python/cpython] 7963be: Backport recent .travis.yml changes (#309) Message-ID: <58b2d31fb5231_5cf93ff78e95dc2c3252a@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 7963bed009c3b1800bfebd0aecad53960edec55c https://github.com/python/cpython/commit/7963bed009c3b1800bfebd0aecad53960edec55c Author: Berker Peksag Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M .travis.yml Log Message: ----------- Backport recent .travis.yml changes (#309) Backported changes from master: * b52260d8bf392aa04c48b8c2467a4c034184de86 * 984eef7d6d78e1213d6ea99897343a5059a07c59 * 532519770dea5d353f0b0d718c8881a15c7542df * 91b0e7d0ca7c59df28f6a6fc1e8eb86a3925b76c (cherry picked from commit 05e1a32170dacfa3ffbbd9266c1cb461f96aabdf) From noreply at github.com Sun Feb 26 10:14:46 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 07:14:46 -0800 Subject: [Python-checkins] [python/cpython] 46ce75: bpo-29648: import.rst: Add reference to create_mod... Message-ID: <58b2f0e67cd0c_680d3f81913c7c2c188b1@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 46ce7599af82a929506baeaaee5c149970440c4c https://github.com/python/cpython/commit/46ce7599af82a929506baeaaee5c149970440c4c Author: Marco Buttu Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Doc/reference/import.rst Log Message: ----------- bpo-29648: import.rst: Add reference to create_module() (GH-290) Add a reference to create_module(), in the first versionadded of section Loaders. From noreply at github.com Sun Feb 26 10:22:40 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 07:22:40 -0800 Subject: [Python-checkins] [python/cpython] 4a926c: bpo-28518: Start a transaction implicitly before a... Message-ID: <58b2f2c041a83_5c5c3fe61ead5c34328f9@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 4a926caf8e5fd8af771b2c34bfb6e91c732331fe https://github.com/python/cpython/commit/4a926caf8e5fd8af771b2c34bfb6e91c732331fe Author: Berker Peksag Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Lib/sqlite3/test/transactions.py M Misc/NEWS M Modules/_sqlite/cursor.c M Modules/_sqlite/statement.c M Modules/_sqlite/statement.h Log Message: ----------- bpo-28518: Start a transaction implicitly before a DML statement (#245) Patch by Aviv Palivoda. From noreply at github.com Sun Feb 26 10:26:24 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 07:26:24 -0800 Subject: [Python-checkins] [python/cpython] ed6795: bpo-22594: Add a link to the regex module in re do... Message-ID: <58b2f3a0bb475_45183fdf3bd13c3859623@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: ed6795e46f7653e23b862efad240a93453e7df97 https://github.com/python/cpython/commit/ed6795e46f7653e23b862efad240a93453e7df97 Author: Marco Buttu Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Doc/library/re.rst Log Message: ----------- bpo-22594: Add a link to the regex module in re documentation (GH-241) From noreply at github.com Sun Feb 26 10:31:13 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 07:31:13 -0800 Subject: [Python-checkins] [python/cpython] fe70d9: bpo-29121: Remove outdated documentation about tra... Message-ID: <58b2f4c19e261_6b303faf8cd0fc34362ac@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: fe70d924bb6106d4c21eb414f4a1ba1324e8f46a https://github.com/python/cpython/commit/fe70d924bb6106d4c21eb414f4a1ba1324e8f46a Author: Berker Peksag Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Doc/library/sqlite3.rst Log Message: ----------- bpo-29121: Remove outdated documentation about transactions (#313) Patch by Aviv Palivoda. From noreply at github.com Sun Feb 26 10:33:55 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 07:33:55 -0800 Subject: [Python-checkins] [python/cpython] 7333d1: bpo-29648: import.rst: Add reference to create_mod... Message-ID: <58b2f563976d8_602a3fc8f25cdc3017120@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 7333d1760e12cf27bcf63265f72521892285c10a https://github.com/python/cpython/commit/7333d1760e12cf27bcf63265f72521892285c10a Author: Mariatta Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Doc/reference/import.rst Log Message: ----------- bpo-29648: import.rst: Add reference to create_module() (GH-290) (GH-314) (cherry picked from commit 46ce7599af82a929506baeaaee5c149970440c4c) From noreply at github.com Sun Feb 26 10:36:58 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 07:36:58 -0800 Subject: [Python-checkins] [python/cpython] 6b4a5f: bpo-26184: import.rst: Improve versionchanged note... Message-ID: <58b2f61ad32ae_74ad3fc216e61c305077b@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 6b4a5f45e2df524174a97832571c82c76a3d424a https://github.com/python/cpython/commit/6b4a5f45e2df524174a97832571c82c76a3d424a Author: Mariatta Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Doc/reference/import.rst Log Message: ----------- bpo-26184: import.rst: Improve versionchanged note (GH-277) Mention that an ImportError is raised when exec_module() is defined, but create_module() is not. From noreply at github.com Sun Feb 26 10:40:04 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 07:40:04 -0800 Subject: [Python-checkins] [python/cpython] 63ed9b: bpo-29648: import.rst: Add reference to create_mod... Message-ID: <58b2f6d499efb_41823fae19d4dc387532@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 63ed9bc94d8df45b16aee9b92f658ebb34aa1012 https://github.com/python/cpython/commit/63ed9bc94d8df45b16aee9b92f658ebb34aa1012 Author: Mariatta Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Doc/reference/import.rst Log Message: ----------- bpo-29648: import.rst: Add reference to create_module() (GH-290) (GH-315) (cherry picked from commit 46ce7599af82a929506baeaaee5c149970440c4c) From noreply at github.com Sun Feb 26 10:44:17 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 07:44:17 -0800 Subject: [Python-checkins] [python/cpython] 145798: bpo-22594: Add a link to the regex module in re do... Message-ID: <58b2f7d1e9982_62363fc11c207c2835569@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 1457984c003b1e461f8aab93bfc37fd8e42312d5 https://github.com/python/cpython/commit/1457984c003b1e461f8aab93bfc37fd8e42312d5 Author: Mariatta Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Doc/library/re.rst Log Message: ----------- bpo-22594: Add a link to the regex module in re documentation (GH-241) (GH-316) (cherry picked from commit ed6795e46f7653e23b862efad240a93453e7df97) From noreply at github.com Sun Feb 26 10:44:37 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 07:44:37 -0800 Subject: [Python-checkins] [python/cpython] 21c697: bpo-22594: Add a link to the regex module in re do... Message-ID: <58b2f7e5d8f36_6a223fba60ab1c38471d6@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 21c697fd1073d6ab59e2ba82ea80bc81b9c4125c https://github.com/python/cpython/commit/21c697fd1073d6ab59e2ba82ea80bc81b9c4125c Author: Mariatta Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Doc/library/re.rst Log Message: ----------- bpo-22594: Add a link to the regex module in re documentation (GH-241) (GH-317) (cherry picked from commit ed6795e46f7653e23b862efad240a93453e7df97) From noreply at github.com Sun Feb 26 11:04:01 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 08:04:01 -0800 Subject: [Python-checkins] [python/cpython] 893e86: bpo-29121: Remove outdated documentation about tra... Message-ID: <58b2fc71bc061_5f603fe735037c38364e7@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 893e86e9d3c0caeb878ccb1120c7259e022f3b68 https://github.com/python/cpython/commit/893e86e9d3c0caeb878ccb1120c7259e022f3b68 Author: Berker Peksag Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Doc/library/sqlite3.rst Log Message: ----------- bpo-29121: Remove outdated documentation about transactions (#313) (#319) Patch by Aviv Palivoda. (cherry picked from commit fe70d924bb6106d4c21eb414f4a1ba1324e8f46a) From noreply at github.com Sun Feb 26 11:09:11 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 08:09:11 -0800 Subject: [Python-checkins] [python/cpython] 76995c: bpo-28518: Start a transaction implicitly before a... Message-ID: <58b2fda7bef02_6eb53faece0c1c3465721@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 76995cab69d5ef83d31d8a5754cbad11be4038cb https://github.com/python/cpython/commit/76995cab69d5ef83d31d8a5754cbad11be4038cb Author: Berker Peksag Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Lib/sqlite3/test/transactions.py M Misc/NEWS M Modules/_sqlite/cursor.c M Modules/_sqlite/statement.c M Modules/_sqlite/statement.h Log Message: ----------- bpo-28518: Start a transaction implicitly before a DML statement (#245) (#318) Patch by Aviv Palivoda. (cherry picked from commit 4a926caf8e5fd8af771b2c34bfb6e91c732331fe) From noreply at github.com Sun Feb 26 11:55:24 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 08:55:24 -0800 Subject: [Python-checkins] [python/cpython] deea29: bpo-26184: import.rst: Improve versionchanged note... Message-ID: <58b3087cae7ac_665a3f8ee45fbc2c10972@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: deea29e61e61f0e216bff3f0ca008f5ee231793f https://github.com/python/cpython/commit/deea29e61e61f0e216bff3f0ca008f5ee231793f Author: Mariatta Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Doc/reference/import.rst Log Message: ----------- bpo-26184: import.rst: Improve versionchanged note (GH-277) (#320) (cherry picked from commit 6b4a5f45e2df524174a97832571c82c76a3d424a) From noreply at github.com Sun Feb 26 11:56:22 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 08:56:22 -0800 Subject: [Python-checkins] [python/cpython] c8e202: bpo-22594: Add a link to the regex module in re do... Message-ID: <58b308b69e2c5_237b93ffdd0127c2c32915@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/2.7 Home: https://github.com/python/cpython Commit: c8e20218d77c5b8c16fd76d45612ae48ca3fba91 https://github.com/python/cpython/commit/c8e20218d77c5b8c16fd76d45612ae48ca3fba91 Author: Mariatta Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Doc/library/re.rst Log Message: ----------- bpo-22594: Add a link to the regex module in re documentation (GH-241) (GH-321) (cherry picked from commit ed6795e46f7653e23b862efad240a93453e7df97) From noreply at github.com Sun Feb 26 12:06:12 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 09:06:12 -0800 Subject: [Python-checkins] [python/cpython] d5c11f: bpo-28624: Add a test that checks that cwd paramet... Message-ID: <58b30b045ff57_6c053f9c11837c40128d8@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: d5c11f7ace48701bb950c6345deee88c35c66e26 https://github.com/python/cpython/commit/d5c11f7ace48701bb950c6345deee88c35c66e26 Author: Sayan Chowdhury Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Doc/library/subprocess.rst M Lib/test/test_subprocess.py M Misc/ACKS M Misc/NEWS Log Message: ----------- bpo-28624: Add a test that checks that cwd parameter of Popen() accepts PathLike objects (#157) From noreply at github.com Sun Feb 26 12:38:33 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 09:38:33 -0800 Subject: [Python-checkins] [python/cpython] 6b8100: bpo-28624: Add a test that checks that cwd paramet... Message-ID: <58b31299694e1_61533ff5b3195c247032b@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 6b81003bdbd9375886bae54f876650bcdccfe6c7 https://github.com/python/cpython/commit/6b81003bdbd9375886bae54f876650bcdccfe6c7 Author: Berker Peksag Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Doc/library/subprocess.rst M Lib/test/test_subprocess.py M Misc/ACKS M Misc/NEWS Log Message: ----------- bpo-28624: Add a test that checks that cwd parameter of Popen() accepts PathLike objects (#157) (#323) (cherry picked from commit d5c11f7ace48701bb950c6345deee88c35c66e26) From noreply at github.com Sun Feb 26 14:09:33 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 11:09:33 -0800 Subject: [Python-checkins] [python/cpython] c9131b: [3.6] bpo-29110: Fix file object leak in `aifc.ope... Message-ID: <58b327edb48bb_230403fd9de7a3c3810687@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: c9131b61fa060a51ec181053cade9f0a7ee91e4f https://github.com/python/cpython/commit/c9131b61fa060a51ec181053cade9f0a7ee91e4f Author: INADA Naoki Date: 2017-02-27 (Mon, 27 Feb 2017) Changed paths: M Lib/aifc.py M Lib/test/test_aifc.py M Misc/NEWS Log Message: ----------- [3.6] bpo-29110: Fix file object leak in `aifc.open` (#310) (cherry picked from commit 03f68b60e17b57f6f13729ff73245dbb37b30a4c) (GH-162) (cherry picked from commit 5dc33eea538361f8a218255f83db2e9298dd8c53) (GH-293) From noreply at github.com Sun Feb 26 14:35:02 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 11:35:02 -0800 Subject: [Python-checkins] [python/cpython] b7fb1e: bpo-29110: Fix file object leak in `aifc.open` (GH... Message-ID: <58b32de6333a3_61423fc1c8075c3c9765e@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: b7fb1e25c89a9eb85b95027f4167bc0977687c43 https://github.com/python/cpython/commit/b7fb1e25c89a9eb85b95027f4167bc0977687c43 Author: INADA Naoki Date: 2017-02-27 (Mon, 27 Feb 2017) Changed paths: M Lib/aifc.py M Lib/test/test_aifc.py M Misc/NEWS Log Message: ----------- bpo-29110: Fix file object leak in `aifc.open` (GH-311) (cherry picked from commit 03f68b6) (GH-162) (cherry picked from commit 5dc33ee) (GH-293) From noreply at github.com Sun Feb 26 16:23:40 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 13:23:40 -0800 Subject: [Python-checkins] [python/cpython] 1f5639: bpo-26184: import.rst: Improve versionchanged note... Message-ID: <58b3475c50cf3_6eb53faece0c1c34673f9@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 1f5639c77f736c18fb5a85b4a1850121e25c788e https://github.com/python/cpython/commit/1f5639c77f736c18fb5a85b4a1850121e25c788e Author: Mariatta Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Doc/reference/import.rst Log Message: ----------- bpo-26184: import.rst: Improve versionchanged note (GH-325) From noreply at github.com Sun Feb 26 16:30:46 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 13:30:46 -0800 Subject: [Python-checkins] [python/cpython] 7e4897: bpo-26184: import.rst: Improve versionchanged note... Message-ID: <58b349065a983_66233ff1da7bdc3c137b2@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 7e4897a2fb91e49f131a42ed6de88b5185f7dea8 https://github.com/python/cpython/commit/7e4897a2fb91e49f131a42ed6de88b5185f7dea8 Author: Mariatta Date: 2017-02-26 (Sun, 26 Feb 2017) Changed paths: M Doc/reference/import.rst Log Message: ----------- bpo-26184: import.rst: Improve versionchanged note (GH-325) (GH-326) (cherry picked from commit 1f5639c77f736c18fb5a85b4a1850121e25c788e) From noreply at github.com Sun Feb 26 22:01:31 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 19:01:31 -0800 Subject: [Python-checkins] [python/cpython] f3a9fa: bpo-29376: Fix assertion error in threading._Dummy... Message-ID: <58b3968be4623_75e33fa71f9f3c3c4677d@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: f3a9faba4bad91286b78b498547de928078f55da https://github.com/python/cpython/commit/f3a9faba4bad91286b78b498547de928078f55da Author: Xiang Zhang Date: 2017-02-27 (Mon, 27 Feb 2017) Changed paths: M Lib/test/test_threading.py M Lib/threading.py M Misc/NEWS Log Message: ----------- bpo-29376: Fix assertion error in threading._DummyThread.is_alive() (GH-236) From noreply at github.com Sun Feb 26 22:45:44 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 19:45:44 -0800 Subject: [Python-checkins] [python/cpython] 4b6c41: bpo-29376: Fix assertion error in threading._Dummy... Message-ID: <58b3a0e886642_41603fc0e1d87c2880711@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 4b6c41768a15fc85e3069603ef89344bd97f79af https://github.com/python/cpython/commit/4b6c41768a15fc85e3069603ef89344bd97f79af Author: Xiang Zhang Date: 2017-02-27 (Mon, 27 Feb 2017) Changed paths: M Lib/test/test_threading.py M Lib/threading.py M Misc/NEWS Log Message: ----------- bpo-29376: Fix assertion error in threading._DummyThread.is_alive() (GH-330) From noreply at github.com Sun Feb 26 22:46:39 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 19:46:39 -0800 Subject: [Python-checkins] [python/cpython] 8400ae: bpo-29376: Fix assertion error in threading._Dummy... Message-ID: <58b3a11f747f3_3f523fe0c697fc349563b@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 8400ae209b5fa3d3bdc39d3876eef13d1ea9a72a https://github.com/python/cpython/commit/8400ae209b5fa3d3bdc39d3876eef13d1ea9a72a Author: Xiang Zhang Date: 2017-02-27 (Mon, 27 Feb 2017) Changed paths: M Lib/test/test_threading.py M Lib/threading.py M Misc/NEWS Log Message: ----------- bpo-29376: Fix assertion error in threading._DummyThread.is_alive() (GH-329) From noreply at github.com Mon Feb 27 00:42:02 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 21:42:02 -0800 Subject: [Python-checkins] [python/cpython] 210d6a: bpo-29662: fix wrong indentation in timeit.Timer's... Message-ID: <58b3bc2aa149f_6ed33fe3cc2b9c3439537@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 210d6a9f951b621b095bc5b72821cf60198ffea8 https://github.com/python/cpython/commit/210d6a9f951b621b095bc5b72821cf60198ffea8 Author: Xiang Zhang Date: 2017-02-27 (Mon, 27 Feb 2017) Changed paths: M Doc/library/timeit.rst Log Message: ----------- bpo-29662: fix wrong indentation in timeit.Timer's doc (GH-332) From noreply at github.com Mon Feb 27 00:55:09 2017 From: noreply at github.com (GitHub) Date: Sun, 26 Feb 2017 21:55:09 -0800 Subject: [Python-checkins] [python/cpython] 8aa1ad: bpo-29662: fix wrong indentation in timeit.Timer's... Message-ID: <58b3bf3d644ed_6d913f7ec4831c3893e4@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 8aa1ad892ff3cf4d8881cdae0e95be1a5bad175e https://github.com/python/cpython/commit/8aa1ad892ff3cf4d8881cdae0e95be1a5bad175e Author: Xiang Zhang Date: 2017-02-27 (Mon, 27 Feb 2017) Changed paths: M Doc/library/timeit.rst Log Message: ----------- bpo-29662: fix wrong indentation in timeit.Timer's doc (GH-333) From solipsis at pitrou.net Mon Feb 27 04:08:19 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Mon, 27 Feb 2017 09:08:19 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=10 Message-ID: <20170227090819.3050.17145.93AC803E@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- test_collections leaked [7, 0, 0] memory blocks, sum=7 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/reflog0yDlMt', '--timeout', '7200'] From noreply at github.com Mon Feb 27 08:42:42 2017 From: noreply at github.com (GitHub) Date: Mon, 27 Feb 2017 05:42:42 -0800 Subject: [Python-checkins] [python/cpython] f669ff: fix minor bug in pymalloc. (#335) Message-ID: <58b42cd28e65c_67323f947e093c403907a@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: f669ffff6010a94f2d441200e0fd73e9dea2883e https://github.com/python/cpython/commit/f669ffff6010a94f2d441200e0fd73e9dea2883e Author: INADA Naoki Date: 2017-02-27 (Mon, 27 Feb 2017) Changed paths: M Doc/c-api/memory.rst Log Message: ----------- fix minor bug in pymalloc. (#335) reported by Alexis Lopez-Garcia. From noreply at github.com Mon Feb 27 08:44:17 2017 From: noreply at github.com (GitHub) Date: Mon, 27 Feb 2017 05:44:17 -0800 Subject: [Python-checkins] [python/cpython] 091b84: Asyncio documentation: remove `self` from method s... Message-ID: <58b42d31934b7_237b93ffdd0127c2c43565@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 091b84f23a2ff57e8320ebf6fdf889af39096ab9 https://github.com/python/cpython/commit/091b84f23a2ff57e8320ebf6fdf889af39096ab9 Author: Mariatta Date: 2017-02-27 (Mon, 27 Feb 2017) Changed paths: M Doc/library/asyncio-protocol.rst Log Message: ----------- Asyncio documentation: remove `self` from method signatures (GH-334) From noreply at github.com Mon Feb 27 09:02:01 2017 From: noreply at github.com (GitHub) Date: Mon, 27 Feb 2017 06:02:01 -0800 Subject: [Python-checkins] [python/cpython] b945e0: Asyncio documentation: remove `self` from method s... Message-ID: <58b431597a535_7b843fc253b09c30818b6@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: b945e0784f8b64f9dba41c47844cadf483168a0f https://github.com/python/cpython/commit/b945e0784f8b64f9dba41c47844cadf483168a0f Author: Mariatta Date: 2017-02-27 (Mon, 27 Feb 2017) Changed paths: M Doc/library/asyncio-protocol.rst Log Message: ----------- Asyncio documentation: remove `self` from method signatures (GH-334) (GH-336) (cherry picked from commit 091b84f23a2ff57e8320ebf6fdf889af39096ab9) From noreply at github.com Mon Feb 27 09:02:23 2017 From: noreply at github.com (GitHub) Date: Mon, 27 Feb 2017 06:02:23 -0800 Subject: [Python-checkins] [python/cpython] bc10e6: Asyncio documentation: remove `self` from method s... Message-ID: <58b4316f8a27_63c33fa19d08dc383041b@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: bc10e6bd7b6b4a738ce327e31550048d3dd8d8bd https://github.com/python/cpython/commit/bc10e6bd7b6b4a738ce327e31550048d3dd8d8bd Author: Mariatta Date: 2017-02-27 (Mon, 27 Feb 2017) Changed paths: M Doc/library/asyncio-protocol.rst Log Message: ----------- Asyncio documentation: remove `self` from method signatures (GH-334) (GH-337) (cherry picked from commit 091b84f23a2ff57e8320ebf6fdf889af39096ab9) From noreply at github.com Mon Feb 27 09:27:46 2017 From: noreply at github.com (GitHub) Date: Mon, 27 Feb 2017 06:27:46 -0800 Subject: [Python-checkins] [python/cpython] 046041: Delete accidentally merged entries from Misc/NEWS ... Message-ID: <58b43762177fa_665a3f8ee45fbc2c185d3@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 046041e23b3c7e0b4a08705e2792ef3e28d03384 https://github.com/python/cpython/commit/046041e23b3c7e0b4a08705e2792ef3e28d03384 Author: Berker Peksag Date: 2017-02-27 (Mon, 27 Feb 2017) Changed paths: M Misc/NEWS Log Message: ----------- Delete accidentally merged entries from Misc/NEWS (#338) From noreply at github.com Mon Feb 27 09:43:28 2017 From: noreply at github.com (GitHub) Date: Mon, 27 Feb 2017 06:43:28 -0800 Subject: [Python-checkins] [python/cpython] a86281: Use "Contributed by ..." style in whatsnew/3.7.rst... Message-ID: <58b43b10e920b_5b223ffaba527c3c944fe@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: a8628125658e08e4afe92e929f7f6becebdc363a https://github.com/python/cpython/commit/a8628125658e08e4afe92e929f7f6becebdc363a Author: Berker Peksag Date: 2017-02-27 (Mon, 27 Feb 2017) Changed paths: M Doc/whatsnew/3.7.rst Log Message: ----------- Use "Contributed by ..." style in whatsnew/3.7.rst (#339) From noreply at github.com Mon Feb 27 11:07:28 2017 From: noreply at github.com (GitHub) Date: Mon, 27 Feb 2017 08:07:28 -0800 Subject: [Python-checkins] [python/cpython] bc144f: bpo-28598: Support __rmod__ for RHS subclasses of ... Message-ID: <58b44ec0d17c4_2333a3ff676a85c3067985@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: bc144f0abff2b36595171377ee847c0266596ab2 https://github.com/python/cpython/commit/bc144f0abff2b36595171377ee847c0266596ab2 Author: Martijn Pieters Date: 2017-02-27 (Mon, 27 Feb 2017) Changed paths: M Lib/test/test_unicode.py M Misc/NEWS M Python/ceval.c Log Message: ----------- bpo-28598: Support __rmod__ for RHS subclasses of str in % string formatting operations (#94) From noreply at github.com Mon Feb 27 11:08:03 2017 From: noreply at github.com (GitHub) Date: Mon, 27 Feb 2017 08:08:03 -0800 Subject: [Python-checkins] [python/cpython] 53039a: bpo-28598: Support __rmod__ for RHS subclasses of ... Message-ID: <58b44ee3126ab_62363fc11c207c2852747@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 53039ad3814a8918c5311f37bd654428b9843fcc https://github.com/python/cpython/commit/53039ad3814a8918c5311f37bd654428b9843fcc Author: Martijn Pieters Date: 2017-02-27 (Mon, 27 Feb 2017) Changed paths: M Lib/test/test_unicode.py M Misc/NEWS M Python/ceval.c Log Message: ----------- bpo-28598: Support __rmod__ for RHS subclasses of str in % string formatting operations (#95) From noreply at github.com Mon Feb 27 11:13:42 2017 From: noreply at github.com (GitHub) Date: Mon, 27 Feb 2017 08:13:42 -0800 Subject: [Python-checkins] [python/cpython] 370f7a: bpo-24241: Add versionchanged directive to the doc... Message-ID: <58b45036b29e1_61973f83f386bc3890753@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 370f7a956cef5895c93ca5a53fc26b04df973aaf https://github.com/python/cpython/commit/370f7a956cef5895c93ca5a53fc26b04df973aaf Author: Berker Peksag Date: 2017-02-27 (Mon, 27 Feb 2017) Changed paths: M Doc/library/webbrowser.rst Log Message: ----------- bpo-24241: Add versionchanged directive to the documentation (#342) From noreply at github.com Mon Feb 27 11:14:13 2017 From: noreply at github.com (GitHub) Date: Mon, 27 Feb 2017 08:14:13 -0800 Subject: [Python-checkins] [python/cpython] bb59d8: bpo-27788 : synchronise platform.py version number... Message-ID: <58b4505535537_60da3f82a69e7c2c8387f@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: bb59d89ceeb1abfb4d73c7fc60b534e4464adf35 https://github.com/python/cpython/commit/bb59d89ceeb1abfb4d73c7fc60b534e4464adf35 Author: Berker Peksag Date: 2017-02-27 (Mon, 27 Feb 2017) Changed paths: M Lib/platform.py Log Message: ----------- bpo-27788 : synchronise platform.py version number (#246) (#341) Was bumped in the docstring by b9f4feab1b9c9ffa8ea29af3d82bc536f9f3005a but not in `__version__` (cherry picked from commit 6059ce45aa96f52fa0150e68ea655fbfdc25609a) From noreply at github.com Mon Feb 27 12:41:22 2017 From: noreply at github.com (GitHub) Date: Mon, 27 Feb 2017 09:41:22 -0800 Subject: [Python-checkins] [python/cpython] 7accf2: bpo-29655: Fixed possible reference leaks in `impo... Message-ID: <58b464c2bba8b_583d3fd81b073c3438644@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: 7accf2033d03025cc5324f8b9d22582bca3623e9 https://github.com/python/cpython/commit/7accf2033d03025cc5324f8b9d22582bca3623e9 Author: Berker Peksag Date: 2017-02-27 (Mon, 27 Feb 2017) Changed paths: M Python/ceval.c Log Message: ----------- bpo-29655: Fixed possible reference leaks in `import *`. (#301) (#348) Patch by Matthias Bussonnier. (cherry picked from commit 160edb43571311a3785785c1dfa784afc52d87be) From noreply at github.com Mon Feb 27 13:25:31 2017 From: noreply at github.com (GitHub) Date: Mon, 27 Feb 2017 10:25:31 -0800 Subject: [Python-checkins] [python/cpython] 0dadf5: bpo-29655: Fixed possible reference leaks in `impo... Message-ID: <58b46f1bc8cca_22f7c3fc7a5667c34100716@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/3.5 Home: https://github.com/python/cpython Commit: 0dadf56737f591c83d18db5e445960d39448583e https://github.com/python/cpython/commit/0dadf56737f591c83d18db5e445960d39448583e Author: Berker Peksag Date: 2017-02-27 (Mon, 27 Feb 2017) Changed paths: M Python/ceval.c Log Message: ----------- bpo-29655: Fixed possible reference leaks in `import *`. (#301) (#349) Patch by Matthias Bussonnier. (cherry picked from commit 160edb43571311a3785785c1dfa784afc52d87be) From noreply at github.com Mon Feb 27 22:06:08 2017 From: noreply at github.com (GitHub) Date: Mon, 27 Feb 2017 19:06:08 -0800 Subject: [Python-checkins] [python/cpython] ecf39b: bpo-29661: fix contradiction in timeit.Timer.autor... Message-ID: <58b4e920e721d_4ab33fdfd9077c247069e@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: ecf39bbc97adc0fb67654602e37d0d8313e9be9d https://github.com/python/cpython/commit/ecf39bbc97adc0fb67654602e37d0d8313e9be9d Author: Xiang Zhang Date: 2017-02-28 (Tue, 28 Feb 2017) Changed paths: M Lib/timeit.py Log Message: ----------- bpo-29661: fix contradiction in timeit.Timer.autorange's docstring (GH-331) From noreply at github.com Mon Feb 27 22:28:46 2017 From: noreply at github.com (GitHub) Date: Mon, 27 Feb 2017 19:28:46 -0800 Subject: [Python-checkins] [python/cpython] c4a786: bpo-29661: fix contradiction in timeit.Timer.autor... Message-ID: <58b4ee6e1b6fe_6f773ffacaed3c3028112@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: c4a786b8ad2a625594551ab3bc991a6831ba7688 https://github.com/python/cpython/commit/c4a786b8ad2a625594551ab3bc991a6831ba7688 Author: Xiang Zhang Date: 2017-02-28 (Tue, 28 Feb 2017) Changed paths: M Lib/timeit.py Log Message: ----------- bpo-29661: fix contradiction in timeit.Timer.autorange's docstring (GH-331) (GH-353) From noreply at github.com Tue Feb 28 01:32:09 2017 From: noreply at github.com (GitHub) Date: Mon, 27 Feb 2017 22:32:09 -0800 Subject: [Python-checkins] [python/cpython] 6db764: README: Use h3 headings for build sections, and ad... Message-ID: <58b519696dbab_45ca3fc56c1cfc3411652e@hookshot-fe6-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 6db764ad57c868130fc0db31893e8447a21b6bb9 https://github.com/python/cpython/commit/6db764ad57c868130fc0db31893e8447a21b6bb9 Author: Evan Klitzke Date: 2017-02-28 (Tue, 28 Feb 2017) Changed paths: M README.rst Log Message: ----------- README: Use h3 headings for build sections, and add TOC (GH-64) From noreply at github.com Tue Feb 28 02:27:01 2017 From: noreply at github.com (GitHub) Date: Mon, 27 Feb 2017 23:27:01 -0800 Subject: [Python-checkins] [python/cpython] 7c8b3f: README: move TOC to top (GH-355) Message-ID: <58b52645da120_5ecc3fb110c01c2c829fe@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 7c8b3fa31caf866572649e2bc82729d8fc081b89 https://github.com/python/cpython/commit/7c8b3fa31caf866572649e2bc82729d8fc081b89 Author: INADA Naoki Date: 2017-02-28 (Tue, 28 Feb 2017) Changed paths: M README.rst Log Message: ----------- README: move TOC to top (GH-355) From solipsis at pitrou.net Tue Feb 28 04:08:26 2017 From: solipsis at pitrou.net (solipsis at pitrou.net) Date: Tue, 28 Feb 2017 09:08:26 +0000 Subject: [Python-checkins] Daily reference leaks (4243df51fe43): sum=4 Message-ID: <20170228090825.29745.56958.983E4EA0@psf.io> results for 4243df51fe43 on branch "default" -------------------------------------------- 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/reflogoALY4d', '--timeout', '7200'] From noreply at github.com Tue Feb 28 04:12:54 2017 From: noreply at github.com (GitHub) Date: Tue, 28 Feb 2017 01:12:54 -0800 Subject: [Python-checkins] [python/cpython] 267b9d: bpo-7769: enable xmlrpc.server.SimpleXMLRPCDispatc... Message-ID: <58b53f16a02bc_237b93ffdd0127c2c6793c@hookshot-fe-6dbb0c4.cp1-iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 267b9d2fa8efce7c5bc34ce50048ebca8fddf04f https://github.com/python/cpython/commit/267b9d2fa8efce7c5bc34ce50048ebca8fddf04f Author: Xiang Zhang Date: 2017-02-28 (Tue, 28 Feb 2017) Changed paths: M Doc/library/xmlrpc.server.rst M Doc/whatsnew/3.7.rst M Lib/test/test_xmlrpc.py M Lib/xmlrpc/server.py M Misc/NEWS Log Message: ----------- bpo-7769: enable xmlrpc.server.SimpleXMLRPCDispatcher.register_function used as decorator (GH-231) From noreply at github.com Tue Feb 28 06:39:32 2017 From: noreply at github.com (GitHub) Date: Tue, 28 Feb 2017 03:39:32 -0800 Subject: [Python-checkins] [python/cpython] 02eb4b: bpo-29110: Fix file object leak in aifc.open (GH-3... Message-ID: <58b5617434be5_6c053f9c11837c40550e0@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/2.7 Home: https://github.com/python/cpython Commit: 02eb4b0bd4a7d86cf5e40567aaa8710b00e079a4 https://github.com/python/cpython/commit/02eb4b0bd4a7d86cf5e40567aaa8710b00e079a4 Author: INADA Naoki Date: 2017-02-28 (Tue, 28 Feb 2017) Changed paths: M Lib/aifc.py M Lib/test/test_aifc.py M Misc/NEWS Log Message: ----------- bpo-29110: Fix file object leak in aifc.open (GH-356) From noreply at github.com Tue Feb 28 13:50:12 2017 From: noreply at github.com (GitHub) Date: Tue, 28 Feb 2017 10:50:12 -0800 Subject: [Python-checkins] [python/cpython] 81788e: Add the mention-bot configuration file (GH-352) Message-ID: <58b5c664e15b2_39a23ffc83557c3c66488@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 81788e9a9766fbb7ef794214397969814b0d72d1 https://github.com/python/cpython/commit/81788e9a9766fbb7ef794214397969814b0d72d1 Author: Donald Stufft Date: 2017-02-28 (Tue, 28 Feb 2017) Changed paths: A .mention-bot Log Message: ----------- Add the mention-bot configuration file (GH-352) Discussed at https://github.com/python/core-workflow/issues/32. From noreply at github.com Tue Feb 28 15:07:20 2017 From: noreply at github.com (GitHub) Date: Tue, 28 Feb 2017 12:07:20 -0800 Subject: [Python-checkins] [python/cpython] 626584: correct documentation for enum.html (#358) Message-ID: <58b5d87888b06_680f3ffdafd8dc30783dd@hookshot-fe2-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 626584284e74a68fff8157f9afe77b3088ff7be9 https://github.com/python/cpython/commit/626584284e74a68fff8157f9afe77b3088ff7be9 Author: Kartik Anand Date: 2017-02-28 (Tue, 28 Feb 2017) Changed paths: M Doc/library/enum.rst Log Message: ----------- correct documentation for enum.html (#358) From noreply at github.com Tue Feb 28 19:29:29 2017 From: noreply at github.com (GitHub) Date: Tue, 28 Feb 2017 16:29:29 -0800 Subject: [Python-checkins] [python/cpython] 188001: Fix syntax error in .mention-bot Message-ID: <58b615e9d9b1c_1d183fc963045c3817234@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/berkerpeksag-patch-1 Home: https://github.com/python/cpython Commit: 188001a6b1a87a5aa511f706e74ce00ee34d2001 https://github.com/python/cpython/commit/188001a6b1a87a5aa511f706e74ce00ee34d2001 Author: Berker Peksag Date: 2017-03-01 (Wed, 01 Mar 2017) Changed paths: M .mention-bot Log Message: ----------- Fix syntax error in .mention-bot From noreply at github.com Tue Feb 28 22:26:57 2017 From: noreply at github.com (GitHub) Date: Tue, 28 Feb 2017 19:26:57 -0800 Subject: [Python-checkins] [python/cpython] 1cf2a8: Fixed a handful of typos (GH-343) Message-ID: <58b63f816956c_5ecb3f88b21d3c2c139be@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: 1cf2a809b1eb4f9fc8ac3ccc97424586892d1e1a https://github.com/python/cpython/commit/1cf2a809b1eb4f9fc8ac3ccc97424586892d1e1a Author: Alex Gaynor Date: 2017-02-28 (Tue, 28 Feb 2017) Changed paths: M Doc/library/email.compat32-message.rst M Doc/library/email.message.rst M Doc/library/idle.rst M Doc/library/ssl.rst Log Message: ----------- Fixed a handful of typos (GH-343) From noreply at github.com Tue Feb 28 22:33:09 2017 From: noreply at github.com (GitHub) Date: Tue, 28 Feb 2017 19:33:09 -0800 Subject: [Python-checkins] [python/cpython] eca522: Fix syntax error in .mention-bot (#361) Message-ID: <58b640f530a5d_52223f870d70dc34208ea@hookshot-fe5-cp1-prd.iad.github.net.mail> Branch: refs/heads/master Home: https://github.com/python/cpython Commit: eca52296da65ccbe5b5926451453769ce4a069c3 https://github.com/python/cpython/commit/eca52296da65ccbe5b5926451453769ce4a069c3 Author: Berker Peksag Date: 2017-02-28 (Tue, 28 Feb 2017) Changed paths: M .mention-bot Log Message: ----------- Fix syntax error in .mention-bot (#361) From noreply at github.com Tue Feb 28 22:33:13 2017 From: noreply at github.com (GitHub) Date: Tue, 28 Feb 2017 19:33:13 -0800 Subject: [Python-checkins] [python/cpython] Message-ID: <58b640f914489_18d63f9cd1569c3c32994@hookshot-fe1-cp1-prd.iad.github.net.mail> Branch: refs/heads/berkerpeksag-patch-1 Home: https://github.com/python/cpython From noreply at github.com Tue Feb 28 23:20:00 2017 From: noreply at github.com (GitHub) Date: Tue, 28 Feb 2017 20:20:00 -0800 Subject: [Python-checkins] [python/cpython] d413aa: Disable mention-bot for maintenance branches (GH-3... Message-ID: <58b64bf0458c2_10dd3fbd3b2a7c30378b9@hookshot-fe3-cp1-prd.iad.github.net.mail> Branch: refs/heads/3.6 Home: https://github.com/python/cpython Commit: d413aa7893fd8ac64693c22deb2c1eee1840dbd7 https://github.com/python/cpython/commit/d413aa7893fd8ac64693c22deb2c1eee1840dbd7 Author: Donald Stufft Date: 2017-02-28 (Tue, 28 Feb 2017) Changed paths: A .mention-bot Log Message: ----------- Disable mention-bot for maintenance branches (GH-365)